Esempio n. 1
0
  protected final void register(boolean isRewrite, LiRhsPart... children) {
    for (LiRhsPart part : children) {
      if (part == null) continue;

      part.setParent(this, isRewrite);
    }
  }
Esempio n. 2
0
 public static int structuralHashCode(LiRhsPart a[]) {
   if (a == null) {
     return 0;
   }
   int result = 1;
   for (LiRhsPart element : a) {
     result = 31 * result + (element == null ? 0 : element.structuralHashCode());
   }
   return result;
 }
Esempio n. 3
0
 protected final void toString(StringBuilder sb, LiRhsPart[] parts, String separator) {
   boolean first = true;
   for (LiRhsPart p : parts) {
     if (first) {
       first = false;
     } else {
       sb.append(separator);
     }
     p.toString(sb);
   }
 }
Esempio n. 4
0
 @Override
 public boolean equals(Object o) {
   if (this == o) return true;
   if (o == null || getClass() != o.getClass()) return false;
   StructuralObject that = (StructuralObject) o;
   return part.structurallyEquals(that.part);
 }
Esempio n. 5
0
  protected static boolean structurallyEquals(LiRhsPart[] left, LiRhsPart[] right) {
    if (left == right) {
      return true;
    }
    if (left == null || right == null) {
      return false;
    }

    int length = left.length;
    if (right.length != length) {
      return false;
    }

    for (int i = 0; i < length; i++) {
      LiRhsPart l = left[i];
      LiRhsPart r = right[i];
      if (l == null ? r != null : !l.structurallyEquals(r)) return false;
    }

    return true;
  }
Esempio n. 6
0
 @Override
 public int hashCode() {
   return part.structuralHashCode();
 }