Пример #1
0
  /**
   * Appends a string representation of this term to the buffer given as argument.
   *
   * @param buffer the buffer to which a string represention of this term is appended.
   */
  @Override
  public void toStringBuilder(java.lang.StringBuilder buffer) {
    buffer.append("E(");
    _Cond1.toStringBuilder(buffer);
    buffer.append(",");
    _c1.toStringBuilder(buffer);
    buffer.append(",");
    _c2.toStringBuilder(buffer);
    buffer.append(",");
    _Cond2.toStringBuilder(buffer);

    buffer.append(")");
  }
Пример #2
0
 /**
  * Apply a conversion on the ATerm contained in the String and returns a gram.i.types.Expressao
  * from it
  *
  * @param trm ATerm to convert into a Gom term
  * @param atConv ATerm Converter used to convert the ATerm
  * @return the Gom term
  */
 public static gram.i.types.Expressao fromTerm(
     aterm.ATerm trm, tom.library.utils.ATermConverter atConv) {
   trm = atConv.convert(trm);
   if (trm instanceof aterm.ATermAppl) {
     aterm.ATermAppl appl = (aterm.ATermAppl) trm;
     if (symbolName.equals(appl.getName()) && !appl.getAFun().isQuoted()) {
       return make(
           gram.i.types.Expressao.fromTerm(appl.getArgument(0), atConv),
           gram.i.types.LComentarios.fromTerm(appl.getArgument(1), atConv),
           gram.i.types.LComentarios.fromTerm(appl.getArgument(2), atConv),
           gram.i.types.Expressao.fromTerm(appl.getArgument(3), atConv));
     }
   }
   return null;
 }
Пример #3
0
  /**
   * Compute a hashcode for this term. (for internal use)
   *
   * @return a hash value
   */
  protected int hashFunction() {
    int a, b, c;
    /* Set up the internal state */
    a = 0x9e3779b9; /* the golden ratio; an arbitrary value */
    b = (-991433622 << 8);
    c = getArity();
    /* -------------------------------------- handle most of the key */
    /* ------------------------------------ handle the last 11 bytes */
    a += (_Cond1.hashCode() << 24);
    a += (_c1.hashCode() << 16);
    a += (_c2.hashCode() << 8);
    a += (_Cond2.hashCode());

    a -= b;
    a -= c;
    a ^= (c >> 13);
    b -= c;
    b -= a;
    b ^= (a << 8);
    c -= a;
    c -= b;
    c ^= (b >> 13);
    a -= b;
    a -= c;
    a ^= (c >> 12);
    b -= c;
    b -= a;
    b ^= (a << 16);
    c -= a;
    c -= b;
    c ^= (b >> 5);
    a -= b;
    a -= c;
    a ^= (c >> 3);
    b -= c;
    b -= a;
    b ^= (a << 10);
    c -= a;
    c -= b;
    c ^= (b >> 15);
    /* ------------------------------------------- report the result */
    return c;
  }