Package aterm

Examples of aterm.ATerm


      }
      return false;
    }

    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);
View Full Code Here


    for (int i = 0; i < args.length; i++) {
      if (i >= pattern_args.length) {
        return false;
      }

      ATerm arg = args[i];
      ATerm pattern_arg = pattern_args[i];

      if (pattern_arg.getType() == PLACEHOLDER) {
        ATerm ph_type = ((ATermPlaceholder) pattern_arg)
          .getPlaceholder();
        if (ph_type.getType() == APPL) {
          ATermAppl appl = (ATermAppl) ph_type;
          if (appl.getName().equals("list") && appl.getArguments().isEmpty()) {
            ATermList result = getPureFactory().getEmpty();
            for (int j = args.length - 1; j >= i; j--) {
              result = result.insert(args[j]);
View Full Code Here

    if (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("long") && afun.getArity() == 0 && !afun.isQuoted()) {
          list.add(new Long(value));
          return true;
View Full Code Here

      if (l.isEmpty()) {
        return this.isEmpty();
      }

      if (l.getFirst().getType() == PLACEHOLDER) {
        ATerm ph_type = ((ATermPlaceholder) l.getFirst()).getPlaceholder();
        if (ph_type.getType() == APPL) {
          ATermAppl appl = (ATermAppl) ph_type;
          if (appl.getName().equals("list")
              && appl.getArguments().isEmpty()) {
            list.add(this);
            return true;
View Full Code Here

  public ATerm make(List<Object> args) {
    if (first == null) {
      return this;
    }

    ATerm head = first.make(args);
    ATermList tail = (ATermList) next.make(args);
    if (isListPlaceHolder(first)) {
      /*
       * this is to solve the make([<list>],[]) problem the result should
       * be [] and not [[]] to be compatible with the C version
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;
View Full Code Here

   * Finds the next term we are going to serialize, based on the current state of the stack.
   *
   * @return The next term we are going to serialize.
   */
  private ATerm getNextTerm(){
    ATerm next = null;
   
    // Make sure the stack remains large enough
    ensureStackCapacity();

    while(next == null && stackPosition > -1){
      ATermMapping current = stack[stackPosition];
      ATerm term = current.term;

      if(term.getChildCount() > current.subTermIndex + 1){
        if(term.getType() != ATerm.LIST){
          next = (ATerm) term.getChildAt(++current.subTermIndex);
        }else{
          ATermList nextList = current.nextPartOfList;
          next = nextList.getFirst();
          current.nextPartOfList = nextList.getNext();
         
          current.subTermIndex++;
        }
       
        ATermMapping child = new ATermMapping();
        child.term = next;
        stack[++stackPosition] = child;
      }else if(!current.annosDone && term.hasAnnotations()){
        next = term.getAnnotations();

        ATermMapping annos = new ATermMapping();
        annos.term = next;
        stack[++stackPosition] = annos;

View Full Code Here

  public ATermList getEmpty() {
    return empty;
  }

  private ATerm parseAbbrev(ATermReader reader) throws IOException {
    ATerm result;
    int abbrev;

    int c = reader.read();

    abbrev = 0;
View Full Code Here

    return result;
  }

  private ATerm parseNumber(ATermReader reader) throws IOException {
  StringBuilder str = new StringBuilder();
    ATerm result;

    do {
      str.append((char) reader.getLastChar());
    } while (Character.isDigit(reader.read()));
View Full Code Here

  }

  private ATerm[] parseATermsArray(ATermReader reader) throws IOException {
    List<ATerm> list = new ArrayList<ATerm>();
   
    ATerm term = parseFromReader(reader);
    list.add(term);
    while (reader.getLastChar() == ',') {
      reader.readSkippingWS();
      term = parseFromReader(reader);
      list.add(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.