private static <E extends TitanElement> void addConstraint(RelationType type, TitanPredicate predicate, Object value, MultiCondition<E> conditions, StandardTitanTx tx) { if (type.isPropertyKey()) { if (value != null) value = tx.verifyAttribute((PropertyKey) type, value); } else { //t.isEdgeLabel() Preconditions.checkArgument(value instanceof TitanVertex); } PredicateCondition<RelationType, E> pc = new PredicateCondition<RelationType, E>(type, predicate, value); if (!conditions.contains(pc)) conditions.add(pc); }
@Override public boolean equals(Object other) { if (this == other) return true; if (other == null || !getClass().isInstance(other)) return false; MultiCondition oth = (MultiCondition)other; if (getType() != oth.getType() || size() != oth.size()) return false; for (int i = 0; i < size(); i++) { boolean foundEqual = false; for (int j = 0; j < oth.size(); j++) { if (get(i).equals(oth.get((i + j) % oth.size()))) { foundEqual = true; break; } } if (!foundEqual) return false; } return true; }
MultiCondition(MultiCondition<E> cond) { this(cond.size()); super.addAll(cond); }
@Override public int hashCode() { int sum = 0; for (Condition kp : this) sum += kp.hashCode(); return new HashCodeBuilder().append(getType()).append(sum).toHashCode(); }
MultiCondition(MultiCondition<E> cond) { this(cond.size()); super.addAll(cond); }
@Override public int hashCode() { int sum = 0; for (Condition kp : this) sum += kp.hashCode(); return new HashCodeBuilder().append(getType()).append(sum).toHashCode(); }
@Override public boolean equals(Object other) { if (this == other) return true; if (other == null || !getClass().isInstance(other)) return false; MultiCondition oth = (MultiCondition)other; if (getType() != oth.getType() || size() != oth.size()) return false; for (int i = 0; i < size(); i++) { boolean foundEqual = false; for (int j = 0; j < oth.size(); j++) { if (get(i).equals(oth.get((i + j) % oth.size()))) { foundEqual = true; break; } } if (!foundEqual) return false; } return true; }
private static <E extends TitanElement> void addConstraint(RelationType type, TitanPredicate predicate, Object value, MultiCondition<E> conditions, StandardTitanTx tx) { if (type.isPropertyKey()) { if (value != null) value = tx.verifyAttribute((PropertyKey) type, value); } else { //t.isEdgeLabel() Preconditions.checkArgument(value instanceof TitanVertex); } PredicateCondition<RelationType, E> pc = new PredicateCondition<RelationType, E>(type, predicate, value); if (!conditions.contains(pc)) conditions.add(pc); }
MultiCondition(MultiCondition<E> cond) { this(cond.size()); super.addAll(cond); }
@Override public int hashCode() { int sum = 0; for (Condition kp : this) sum += kp.hashCode(); return new HashCodeBuilder().append(getType()).append(sum).toHashCode(); }
@Override public boolean equals(Object other) { if (this == other) return true; if (other == null || !getClass().isInstance(other)) return false; MultiCondition oth = (MultiCondition)other; if (getType() != oth.getType() || size() != oth.size()) return false; for (int i = 0; i < size(); i++) { boolean foundEqual = false; for (int j = 0; j < oth.size(); j++) { if (get(i).equals(oth.get((i + j) % oth.size()))) { foundEqual = true; break; } } if (!foundEqual) return false; } return true; }
private static <E extends TitanElement> void addConstraint(RelationType type, TitanPredicate predicate, Object value, MultiCondition<E> conditions, StandardTitanTx tx) { if (type.isPropertyKey()) { if (value != null) value = tx.verifyAttribute((PropertyKey) type, value); } else { //t.isEdgeLabel() Preconditions.checkArgument(value instanceof TitanVertex); } PredicateCondition<RelationType, E> pc = new PredicateCondition<RelationType, E>(type, predicate, value); if (!conditions.contains(pc)) conditions.add(pc); }