Package aterm

Examples of aterm.AFun


        for (int i = 0; i < nrUniqueSymbols; i++) {
            SymEntry e = new SymEntry();
            symbols[i] = e;

            AFun fun = readSymbol();
            e.fun = fun;
            int arity = e.arity = fun.getArity();

            int v = reader.readInt();
            e.nrTerms = v;
            e.termWidth = bitWidth(v);
            // FIXME: original code is inconsistent at this point!
View Full Code Here


    if (pattern.getType() == ATerm.PLACEHOLDER) {
      ATerm type = ((ATermPlaceholder) pattern).getPlaceholder();
      if (type.getType() == ATerm.APPL) {
        ATermAppl appl = (ATermAppl) type;
        AFun afun = appl.getAFun();
        if (afun.getName().equals("int") && afun.getArity() == 0 && !afun.isQuoted()) {
          list.add(new Integer(value));
          return true;
        }
      }
    }
View Full Code Here

    currentBuffer.get(tempBytes, tempBytesIndex, bytesToRead);
    tempBytesIndex += bytesToRead;
   
    if(tempBytesIndex == length){
      if(tempType == ATerm.APPL){
        AFun fun = factory.makeAFun(new String(tempBytes), tempArity, tempIsQuoted);
        applSignatures.add(fun);
       
        ATermConstruct ac = stack[stackPosition];
        if(tempArity == 0 && !ac.hasAnnos){
          ATerm term = factory.makeAppl(fun);
View Full Code Here

   */
  private void touchAppl(byte header){
    if((header & ISFUNSHARED) == ISFUNSHARED){
      int key = readInt();

      AFun fun = applSignatures.get(key);
     
      int arity = fun.getArity();
     
      ATermConstruct ac = stack[stackPosition];
     
      if(arity == 0 && !ac.hasAnnos){
        ATerm term = factory.makeAppl(fun);
View Full Code Here

    ATerm constructedTerm;
    ATerm[] subTerms = ac.subTerms;
   
    int type = ac.type;
    if(type == ATerm.APPL){
      AFun fun = (AFun) ac.tempTerm;
      constructedTerm = factory.makeAppl(fun, subTerms, ac.annos);
    }else if(type == ATerm.LIST){
      ATermList list = factory.makeList();
      for(int i = subTerms.length - 1; i >= 0; i--){
        list = factory.makeList(subTerms[i], list);
View Full Code Here

    if (pattern.getType() == PLACEHOLDER) {
      ATerm type = ((ATermPlaceholder) pattern).getPlaceholder();
      if (type.getType() == APPL) {
        ATermAppl appl = (ATermAppl) type;
        AFun afun = appl.getAFun();
        if (afun.getName().equals("appl") && !afun.isQuoted()) {
          list.add(fun.getName());
          return matchArguments(appl.getArgumentArray(), list);
        } else if (afun.getName().equals("str") && !afun.isQuoted()) {
          if (fun.isQuoted()) {
            list.add(fun.getName());
            return matchArguments(appl.getArgumentArray(), list);
          }
        } else if (afun.getName().equals("fun") && !afun.isQuoted()) {
          if (!fun.isQuoted()) {
            list.add(fun.getName());
            return matchArguments(appl.getArgumentArray(), list);
          }
        } else if (afun.getName().equals("id") && !afun.isQuoted()) {
          if (!fun.isQuoted()) {
            list.add(fun.getName());
            return matchArguments(appl.getArgumentArray(), list);
          }
        }
View Full Code Here

    if (pattern.getType() == ATerm.PLACEHOLDER) {
      ATerm type = ((ATermPlaceholder) pattern).getPlaceholder();
      if (type.getType() == ATerm.APPL) {
        ATermAppl appl = (ATermAppl) type;
        AFun afun = appl.getAFun();
        if (afun.getName().equals("long") && afun.getArity() == 0 && !afun.isQuoted()) {
          list.add(new Long(value));
          return true;
        }
      }
    }
View Full Code Here

  private boolean isListPlaceHolder(ATerm pattern) {
    if (pattern.getType() == ATerm.PLACEHOLDER) {
      ATerm type = ((ATermPlaceholder) pattern).getPlaceholder();
      if (type.getType() == ATerm.APPL) {
        ATermAppl appl = (ATermAppl) type;
        AFun afun = appl.getAFun();
        if (afun.getName().equals("list") && afun.getArity() == 0
            && !afun.isQuoted()) {
          return true;
            }
      }
    }
    return false;
View Full Code Here

   */
  public void voidVisitAppl(ATermAppl arg) throws VisitFailure{
    if(indexInTerm == 0){
      byte header = getHeader(arg);

      AFun fun = arg.getAFun();
      Integer key = applSignatures.get(fun);
      if(key == null){
        if(arg.isQuoted()) header = (byte) (header | APPLQUOTED);
        currentBuffer.put(header);

        writeInt(arg.getArity());
       
        String name = fun.getName();
        byte[] nameBytes = name.getBytes();
        int length = nameBytes.length;
        writeInt(length);

        int endIndex = length;
View Full Code Here

   
    switch(term.getType()){
      case ATerm.APPL:
        ATermAppl appl = (ATermAppl) term;
       
        AFun fun = (AFun) importTerm(appl.getAFun());
       
        int nrOfArguments = appl.getArity();
        ATerm[] newArguments = new ATerm[nrOfArguments];
        for(int i = nrOfArguments - 1; i >= 0; i--){
          newArguments[i] = importTerm(appl.getArgument(i));
        }
       
        result = makeAppl(fun, newArguments);
        break;
      case ATerm.LIST:
        ATermList list = (ATermList) term;
        if(list.isEmpty()){
          result = empty;
          break;
        }
        ATerm first = importTerm(list.getFirst());
        ATermList next = (ATermList) importTerm(list.getNext());
       
        result = makeList(first, next);
        break;
      case ATerm.INT:
        ATermInt integer = (ATermInt) term;
       
        result = makeInt(integer.getInt());
        break;
      case ATerm.LONG:
        ATermLong elongatedType = (ATermLong) term;
       
        result = makeLong(elongatedType.getLong());
        break;
      case ATerm.REAL:
        ATermReal real = (ATermReal) term;
       
        result = makeReal(real.getReal());
        break;
      case ATerm.PLACEHOLDER:
        ATermPlaceholder placeHolder = (ATermPlaceholder) term;
       
        result = makePlaceholder(importTerm(placeHolder.getPlaceholder()));
        break;
      case ATerm.AFUN:
        AFun afun = (AFun) term;
       
        return makeAFun(afun.getName(), afun.getArity(), afun.isQuoted());
      default:
        throw new RuntimeException("Unknown term type id: "+term.getType());
    }
   
    if(term.hasAnnotations()){
View Full Code Here

TOP

Related Classes of aterm.AFun

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.