public boolean containsKey(String key) { return get(key) != null; }
public boolean isEmpty() { return size() == 0; }
public Map<KVDocument, SubDocType> collectTypes(KVDocument value) { Map<KVDocument, SubDocType> calculatedTypes = Maps.newHashMap(); value.accept(this, calculatedTypes); return calculatedTypes; }
AttributeReference.ObjectKey castedAtt = (AttributeReference.ObjectKey) nextAtt; if (!value.containsKey(castedAtt.getKeyValue())) { return null; = value.get(castedAtt.getKeyValue()); if (!atts.hasNext()) { return referencedValue;
@Override public Boolean visit(ContainsAttributesQueryCriteria criteria, KVValue<?> arg) { KVValue<?> referenced = resolve(criteria.getAttributeReference(), arg); if (referenced == null) { return false; } if (!(referenced instanceof KVDocument)) { return false; } KVDocument refObject = (KVDocument) referenced; HashSet<String> keySet = Sets.newHashSet(refObject.getKeys()); if (criteria.getAttributes().size() > keySet.size()) { return false; } if (criteria.isExclusive() && criteria.getAttributes().size()!= keySet.size()) { return false; } return keySet.containsAll(criteria.getAttributes()); }
@Override public Void visit(KVDocument value, LinkedList<AttributeReference.Key> arg) { for (DocEntry<?> entry : value) { arg.addLast(new AttributeReference.ObjectKey(entry.getKey())); entry.getValue().accept(this, arg); arg.removeLast(); } ContainsAttributesQueryCriteria caqc = new ContainsAttributesQueryCriteria( basicAttRef.append(arg), value.getKeys(), true); conjunctionBuilder.add(caqc); return null; }
@Override public BsonValue<?> visit(KVDocument value, Void arg) { List<Entry<?>> entryList = new ArrayList<>(value.size()); for (DocEntry<?> docEntry : value) { entryList.add(new SimpleEntry<>( docEntry.getKey(), docEntry.getValue().accept(this, arg)) ); } return newDocument(entryList); }
private SplitDocument translate( ToroDocument doc, int docId, Map<KVDocument, SubDocType> collectedTypes) { SplitDocument.Builder splitDocBuilder = new SplitDocument.Builder(); ValueTranslator translator = new ValueTranslator(docId, splitDocBuilder, collectedTypes); RootTranslatorConsumer consumer = new RootTranslatorConsumer(); doc.getRoot().accept(translator, consumer); splitDocBuilder.setId(docId); splitDocBuilder.setRoot(consumer.getRoot()); return splitDocBuilder.build(); }
@Override public int hashCode() { return Hashing.goodFastHash(32).hashInt(size()).asInt(); }