Package aterm

Examples of aterm.ATerm


    if (this.equals(pattern)) {
      return true;
    }

    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


    while(buffer.hasRemaining()){
      byte header = buffer.get();

      if((header & ISSHAREDFLAG) == ISSHAREDFLAG){
        int index = readInt();
        ATerm term = sharedTerms[index];
        stackPosition++;
       
        linkTerm(term);
      }else{
        int type = (header & TYPEMASK);
View Full Code Here

        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);
          sharedTerms[ac.termIndex] = term;
          linkTerm(term);
        }else{
          ac.tempTerm = fun;
          ac.subTerms = new ATerm[tempArity];
        }
      }else if(tempType == ATerm.BLOB){
        ATermConstruct ac = stack[stackPosition];
        ATerm term = factory.makeBlob(tempBytes);
       
        if(!ac.hasAnnos){
          sharedTerms[ac.termIndex] = term;
          linkTerm(term);
        }else{
View Full Code Here

      int arity = fun.getArity();
     
      ATermConstruct ac = stack[stackPosition];
     
      if(arity == 0 && !ac.hasAnnos){
        ATerm term = factory.makeAppl(fun);
        sharedTerms[ac.termIndex] = term;
        linkTerm(term);
      }else{
        ac.tempTerm = fun;
        ac.subTerms = new ATerm[arity];
View Full Code Here

    ATermConstruct ac = stack[stackPosition];
    ac.subTerms = new ATerm[size];

    if(size == 0){
      ATerm term = factory.makeList();

      if(!ac.hasAnnos){
        sharedTerms[ac.termIndex] = term;
        linkTerm(term);
      }else{
View Full Code Here

   */
  private void touchInt(){
    int value = readInt();

    ATermConstruct ac = stack[stackPosition];
    ATerm term = factory.makeInt(value);

    if(!ac.hasAnnos){
      sharedTerms[ac.termIndex] = term;
      linkTerm(term);
    }else{
View Full Code Here

   */
  private void touchReal(){
    double value = readDouble();

    ATermConstruct ac = stack[stackPosition];
    ATerm term = factory.makeReal(value);

    if(!ac.hasAnnos){
      sharedTerms[ac.termIndex] = term;
      linkTerm(term);
    }else{
View Full Code Here

   */
  private void touchLong(){
    long value = readLong();

    ATermConstruct ac = stack[stackPosition];
    ATerm term = factory.makeLong(value);

    if(!ac.hasAnnos){
      sharedTerms[ac.termIndex] = term;
      linkTerm(term);
    }else{
View Full Code Here

   * @param ac
   *            A structure that contains all the nessecary data to contruct the associated term.
   * @return The constructed aterm.
   */
  private ATerm buildTerm(ATermConstruct ac){
    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);
      }

      if(ac.hasAnnos) list = (ATermList) list.setAnnotations(ac.annos);

      constructedTerm = list;
    }else if(type == ATerm.PLACEHOLDER){
      ATerm placeholder = factory.makePlaceholder(subTerms[0]);

      constructedTerm = placeholder;
    }else if(ac.hasAnnos){
      constructedTerm = ac.tempTerm.setAnnotations(ac.annos);
    }else{
View Full Code Here

   *
   * @param aTerm
   *            The term that needs to be linked.
   */
  private void linkTerm(ATerm aTerm){
    ATerm term = aTerm;
   
    while(stackPosition != 0){
      ATermConstruct parent = stack[--stackPosition];
 
      ATerm[] subTerms = parent.subTerms;
      boolean hasAnnos = parent.hasAnnos;
      if(subTerms != null && subTerms.length > parent.subTermIndex) {
        subTerms[parent.subTermIndex++] = term;
       
        if(parent.subTerms.length != parent.subTermIndex || hasAnnos) return;
       
        if(!hasAnnos) parent.annos = factory.makeList();
      }else if(hasAnnos && (term instanceof ATermList)){
        parent.annos = (ATermList) term;
      } else {
        throw new RuntimeException("Encountered a term that didn't fit anywhere. Type: " + term.getType());
      }
     
      term = buildTerm(parent);
     
      sharedTerms[parent.termIndex] = term;
View Full Code Here

TOP

Related Classes of aterm.ATerm

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.