@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } return getChildren() != null ? getChildren().equals( ((CompositeConstraint)o).getChildren()) : ((CompositeConstraint)o).getChildren() == null; }
private GeneratedMessage visitAndOr( CompositeConstraint<AbstractConstraint> composite, CompositeType type) { CompositePlacementConstraintProto.Builder cb = CompositePlacementConstraintProto.newBuilder(); cb.setCompositeType(type); for (AbstractConstraint c : composite.getChildren()) { cb.addChildConstraints((PlacementConstraintProto) c.accept(this)); } CompositePlacementConstraintProto cProto = cb.build(); // Wrap around PlacementConstraintProto object. PlacementConstraintProto.Builder pb = PlacementConstraintProto.newBuilder(); pb.setCompositeConstraint(cProto); return pb.build(); }
@Override public int hashCode() { return getChildren() != null ? getChildren().hashCode() : 0; } }
private AbstractConstraint visitAndOr( CompositeConstraint<AbstractConstraint> constraint) { for (ListIterator<AbstractConstraint> iter = constraint.getChildren().listIterator(); iter.hasNext();) { AbstractConstraint child = iter.next(); child = child.accept(this); iter.set(child); } return constraint; }