public CompoundCBuilder(CType type) { this.type = type; this.values = new ByteBuffer[type.size()]; }
public boolean isCompatibleWith(CType previous) { if (this == previous) return true; // Extending with new components is fine, shrinking is not if (size() < previous.size()) return false; for (int i = 0; i < previous.size(); i++) { AbstractType<?> tprev = previous.subtype(i); AbstractType<?> tnew = subtype(i); if (!tnew.isCompatibleWith(tprev)) return false; } return true; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null) return false; if (!getClass().equals(o.getClass())) return false; CType c = (CType)o; if (size() != c.size()) return false; for (int i = 0; i < size(); i++) { if (!subtype(i).equals(c.subtype(i))) return false; } return true; }