public boolean isFlattened() { return this.isRelation(); }
@Override public boolean isFlattened() { // If this is flattened, its sub-condition should not be nested return this.left().isRelation() && this.right().isRelation(); } }
public void unsetCondition(Object key) { this.checkFlattened(); for (Iterator<Condition> iter = this.conditions.iterator(); iter.hasNext();) { Condition c = iter.next(); assert c.isRelation(); if (((Condition.Relation) c).key().equals(key)) { iter.remove(); } } }
public Object condition(Object key) { this.checkFlattened(); List<Object> values = new ArrayList<>(); for (Condition c : this.conditions) { if (c.isRelation()) { Condition.Relation r = (Condition.Relation) c; if (r.key().equals(key) && r.relation() == RelationType.EQ) { values.add(r.value()); } } } if (values.isEmpty()) { return null; } E.checkState(values.size() == 1, "Illegal key '%s' with more than one value", key); return values.get(0); }
"Not support querying edge by %s", conditions); Condition cond = conditions.iterator().next(); E.checkState(cond.isRelation(), "Not support querying edge by %s", conditions); Condition.Relation relation = (Condition.Relation) cond;
Object key = cond.isRelation() ? ((Relation) cond).key() : null; if (key instanceof Id && indexFields.contains(key)) {
public void checkFlattened() { for (Condition condition : this.conditions) { E.checkState(condition.isRelation(), "Condition Query has none-flatten condition '%s'", condition); } }
public void unsetCondition(Object key) { this.checkFlattened(); for (Iterator<Condition> iter = this.conditions.iterator(); iter.hasNext();) { Condition c = iter.next(); assert c.isRelation(); if (((Condition.Relation) c).key().equals(key)) { iter.remove(); } } }
public Object condition(Object key) { this.checkFlattened(); List<Object> values = new ArrayList<>(); for (Condition c : this.conditions) { if (c.isRelation()) { Condition.Relation r = (Condition.Relation) c; if (r.key().equals(key)) { values.add(r.value()); } } } if (values.isEmpty()) { return null; } E.checkState(values.size() == 1, "Illegal key '%s' with more than one value", key); return values.get(0); }
"Not support querying edge by %s", conditions); Condition cond = conditions.iterator().next(); E.checkState(cond.isRelation() && ((Condition.Relation) cond).key().equals(HugeKeys.LABEL), "Not support querying edge by %s", conditions);
Object key = cond.isRelation() ? ((Relation) cond).key() : null; if (key instanceof Id && indexFields.contains(key)) {