method2testcases
stringlengths
118
3.08k
### Question: MappableMapper implements NitriteMapper { @Override @SuppressWarnings("unchecked") public <Source, Target> Target convert(Source source, Class<Target> type) { if (source == null) { return null; } if (isValue(source)) { return (Target) source; } else { if (Document.class.isAssignableFrom(type)) { return (T...
### Question: EqualsFilter extends IndexAwareFilter { @Override protected Set<NitriteId> findIdSet(NitriteMap<NitriteId, Document> collection) { Set<NitriteId> idSet = new LinkedHashSet<>(); if (getOnIdField() && getValue() instanceof String) { NitriteId nitriteId = NitriteId.createId((String) getValue()); if (collecti...
### Question: EqualsFilter extends IndexAwareFilter { @Override public boolean apply(Pair<NitriteId, Document> element) { Document document = element.getSecond(); Object fieldValue = document.get(getField()); return deepEquals(fieldValue, getValue()); } EqualsFilter(String field, Object value); @Override boolean apply(...
### Question: EqualsFilter extends IndexAwareFilter { @Override public void setIsFieldIndexed(Boolean isFieldIndexed) { if (!(getIndexer() instanceof TextIndexer && getValue() instanceof String)) { super.setIsFieldIndexed(isFieldIndexed); } } EqualsFilter(String field, Object value); @Override boolean apply(Pair<Nitrit...
### Question: UpdateOptions { public static UpdateOptions updateOptions(boolean insertIfAbsent) { UpdateOptions options = new UpdateOptions(); options.setInsertIfAbsent(insertIfAbsent); return options; } static UpdateOptions updateOptions(boolean insertIfAbsent); static UpdateOptions updateOptions(boolean insertIfAbse...
### Question: CollectionFactory { public NitriteCollection getCollection(String name, NitriteConfig nitriteConfig, boolean writeCatalogue) { notNull(nitriteConfig, "configuration is null while creating collection"); notEmpty(name, "collection name is null or empty"); Lock lock = lockService.getWriteLock(this.getClass()...
### Question: WriteOperations { WriteResult remove(Filter filter, boolean justOnce) { DocumentCursor cursor; if (filter == null || filter == Filter.ALL) { cursor = readOperations.find(); } else { cursor = readOperations.find(filter); } WriteResultImpl result = new WriteResultImpl(); long count = 0; for (Document docume...
### Question: ReadOperations { public DocumentCursor find() { RecordStream<Pair<NitriteId, Document>> recordStream = nitriteMap.entries(); return new DocumentCursorImpl(recordStream); } ReadOperations(String collectionName, NitriteConfig nitriteConfig, NitriteMap<NitriteId, Documen...
### Question: ReadOperations { Document getById(NitriteId nitriteId) { return nitriteMap.get(nitriteId); } ReadOperations(String collectionName, NitriteConfig nitriteConfig, NitriteMap<NitriteId, Document> nitriteMap, IndexOperations indexOperations); DocumentCur...
### Question: SortedDocumentCursor implements RecordStream<Pair<NitriteId, Document>> { @Override public Iterator<Pair<NitriteId, Document>> iterator() { Iterator<Pair<NitriteId, Document>> iterator = recordStream == null ? Collections.emptyIterator() : recordStream.iterator(); return new SortedDocumentIterator(field, ...
### Question: UnionStreamIterator implements Iterator<Pair<NitriteId, Document>> { @Override public boolean hasNext() { return nextItemSet || setNextEntry(); } UnionStreamIterator(RecordStream<Pair<NitriteId, Document>> lhsStream, RecordStream<Pair<NitriteId, Document>> rhsStream); @Overr...
### Question: FilteredRecordStream implements RecordStream<Pair<NitriteId, Document>> { @Override public Iterator<Pair<NitriteId, Document>> iterator() { Iterator<Pair<NitriteId, Document>> iterator = recordStream == null ? Collections.emptyIterator() : recordStream.iterator(); return new FilteredIterator(iterator, fil...
### Question: JoinedDocumentStream implements RecordStream<Document> { @Override public String toString() { return toList().toString(); } JoinedDocumentStream(RecordStream<Pair<NitriteId, Document>> recordStream, DocumentCursor foreignCursor, Lookup lookup); @Override I...
### Question: ProjectedDocumentStream implements RecordStream<Document> { @Override public String toString() { return toList().toString(); } ProjectedDocumentStream(RecordStream<Pair<NitriteId, Document>> recordStream, Document projection); @Override Iterator<Document> iterator(); @Ov...
### Question: DocumentCursorImpl implements DocumentCursor { @Override public DocumentCursor sort(String field, SortOrder sortOrder, Collator collator, NullOrder nullOrder) { return new DocumentCursorImpl(new SortedDocumentCursor(field, sortOrder, collator, nullOrder, recordStream)); } DocumentCursorImpl(RecordStream<P...
### Question: DocumentCursorImpl implements DocumentCursor { @Override public DocumentCursor skipLimit(long skip, long limit) { return new DocumentCursorImpl(new BoundedDocumentStream(recordStream, skip, limit)); } DocumentCursorImpl(RecordStream<Pair<NitriteId, Document>> recordStream); @Override DocumentCursor sort(S...
### Question: DocumentCursorImpl implements DocumentCursor { @Override public RecordStream<Document> project(Document projection) { validateProjection(projection); return new ProjectedDocumentStream(recordStream, projection); } DocumentCursorImpl(RecordStream<Pair<NitriteId, Document>> recordStream); @Override Document...
### Question: DocumentCursorImpl implements DocumentCursor { @Override public RecordStream<Document> join(DocumentCursor foreignCursor, Lookup lookup) { return new JoinedDocumentStream(recordStream, foreignCursor, lookup); } DocumentCursorImpl(RecordStream<Pair<NitriteId, Document>> recordStream); @Override DocumentCur...
### Question: WriteResultImpl implements WriteResult { void setNitriteIds(Set<NitriteId> nitriteIds) { this.nitriteIds = nitriteIds; } int getAffectedCount(); @Override Iterator<NitriteId> iterator(); }### Answer: @Test public void testSetNitriteIds() { WriteResultImpl writeResultImpl = new WriteResultImpl(); writeRe...
### Question: WriteResultImpl implements WriteResult { void addToList(NitriteId nitriteId) { if (nitriteIds == null) { nitriteIds = new HashSet<>(); } nitriteIds.add(nitriteId); } int getAffectedCount(); @Override Iterator<NitriteId> iterator(); }### Answer: @Test public void testAddToList() { WriteResultImpl writeRe...
### Question: MappableMapper implements NitriteMapper { protected <Target> Target convertFromDocument(Document source, Class<Target> type) { if (source == null) { return null; } if (Mappable.class.isAssignableFrom(type)) { Target item = newInstance(type, false); if (item == null) return null; ((Mappable) item).read(thi...
### Question: WriteResultImpl implements WriteResult { public int getAffectedCount() { if (nitriteIds == null) return 0; return nitriteIds.size(); } int getAffectedCount(); @Override Iterator<NitriteId> iterator(); }### Answer: @Test public void testGetAffectedCount() { assertEquals(0, (new WriteResultImpl()).getAffe...
### Question: BoundedDocumentStream implements RecordStream<Pair<NitriteId, Document>> { @Override public Iterator<Pair<NitriteId, Document>> iterator() { Iterator<Pair<NitriteId, Document>> iterator = recordStream == null ? Collections.emptyIterator() : recordStream.iterator(); return new BoundedIterator<>(iterator, o...
### Question: NitriteId implements Comparable<NitriteId>, Serializable { public static boolean validId(Object value) { if (value == null) { throw new InvalidIdException("id cannot be null"); } try { Long.parseLong(value.toString()); return true; } catch (Exception e) { throw new InvalidIdException("id must be a string ...
### Question: NitriteId implements Comparable<NitriteId>, Serializable { @Override public int compareTo(NitriteId other) { if (other.idValue == null) { throw new InvalidIdException("cannot compare with null id"); } return Long.compare(Long.parseLong(idValue), Long.parseLong(other.idValue)); } private NitriteId(); priv...
### Question: NitriteDocument extends LinkedHashMap<String, Object> implements Document { @Override public Document put(String key, Object value) { if (isNullOrEmpty(key)) { throw new InvalidOperationException("document does not support empty or null key"); } if (DOC_ID.contentEquals(key) && !validId(value)) { throw ne...
### Question: NitriteDocument extends LinkedHashMap<String, Object> implements Document { @Override public Object get(String key) { if (key != null && key.contains(NitriteConfig.getFieldSeparator()) && !containsKey(key)) { return deepGet(key); } return super.get(key); } NitriteDocument(); NitriteDocument(Map<String, ...
### Question: NitriteDocument extends LinkedHashMap<String, Object> implements Document { @Override public Set<String> getFields() { return getFieldsInternal(""); } NitriteDocument(); NitriteDocument(Map<String, Object> objectMap); @Override Document put(String key, Object value); @Override Object get(String key); @O...
### Question: NitriteDocument extends LinkedHashMap<String, Object> implements Document { @Override public boolean hasId() { return super.containsKey(DOC_ID); } NitriteDocument(); NitriteDocument(Map<String, Object> objectMap); @Override Document put(String key, Object value); @Override Object get(String key); @Overr...
### Question: NitriteDocument extends LinkedHashMap<String, Object> implements Document { @Override @SuppressWarnings("unchecked") public Document clone() { Map<String, Object> clone = (Map<String, Object>) super.clone(); return new NitriteDocument(clone); } NitriteDocument(); NitriteDocument(Map<String, Object> obje...
### Question: NitriteDocument extends LinkedHashMap<String, Object> implements Document { @Override public boolean containsKey(String key) { return super.containsKey(key); } NitriteDocument(); NitriteDocument(Map<String, Object> objectMap); @Override Document put(String key, Object value); @Override Object get(String...
### Question: NitriteDocument extends LinkedHashMap<String, Object> implements Document { @Override public boolean equals(Object other) { if (other == this) return true; if (!(other instanceof NitriteDocument)) return false; NitriteDocument m = (NitriteDocument) other; if (m.size() != size()) return false; try { for (M...
### Question: NitriteTextIndexer implements TextIndexer { @Override public String getIndexType() { return IndexType.Fulltext; } NitriteTextIndexer(); NitriteTextIndexer(TextTokenizer textTokenizer); NitriteTextIndexer clone(); @Override String getIndexType(); @Override Set<NitriteId> findText(String collectionName, St...
### Question: RocksDBStore extends AbstractNitriteStore<RocksDBConfig> { @Override public boolean isClosed() { return closed.get(); } RocksDBStore(); @Override void openOrCreate(); @Override boolean isClosed(); @Override boolean hasUnsavedChanges(); @Override boolean isReadOnly(); @Override void commit(); @Override voi...
### Question: Estonian implements Language { @Override public Set<String> stopWords() { return new HashSet<>(Arrays.asList( "aga", "ei", "et", "ja", "jah", "kas", "kui", "kõik", "ma", "me", "mida", "midagi", "mind", "minu", "mis", "mu", "mul", "mulle", "nad", "nii", "oled", "olen", "oli", "oma", "on", "pole", "sa", "se...
### Question: MappableMapper implements NitriteMapper { protected <Source> Document convertToDocument(Source source) { if (source instanceof Mappable) { Mappable mappable = (Mappable) source; return mappable.write(this); } throw new ObjectMappingException("object must implements Mappable"); } MappableMapper(Class<?>......
### Question: Sesotho implements Language { @Override public Set<String> stopWords() { return new HashSet<>(Arrays.asList( "a", "ba", "bane", "bona", "e", "ea", "eaba", "empa", "ena", "ha", "hae", "hape", "ho", "hore", "ka", "ke", "la", "le", "li", "me", "mo", "moo", "ne", "o", "oa", "re", "sa", "se", "tloha", "tsa", "...
### Question: Armenian implements Language { @Override public Set<String> stopWords() { return new HashSet<>(Arrays.asList( "այդ", "այլ", "այն", "այս", "դու", "դուք", "եմ", "են", "ենք", "ես", "եք", "է", "էի", "էին", "էինք", "էիր", "էիք", "էր", "ըստ", "թ", "ի", "ին", "իսկ", "իր", "կամ", "համար", "հետ", "հետո", "մենք", "...
### Question: Afrikaans implements Language { @Override public Set<String> stopWords() { return new HashSet<>(Arrays.asList( "'n", "aan", "af", "al", "as", "baie", "by", "daar", "dag", "dat", "die", "dit", "een", "ek", "en", "gaan", "gesê", "haar", "het", "hom", "hulle", "hy", "in", "is", "jou", "jy", "kan", "kom", "ma...
### Question: Zulu implements Language { @Override public Set<String> stopWords() { return new HashSet<>(Arrays.asList( "futhi", "kahle", "kakhulu", "kanye", "khona", "kodwa", "kungani", "kusho", "la", "lakhe", "lapho", "mina", "ngesikhathi", "nje", "phansi", "phezulu", "u", "ukuba", "ukuthi", "ukuze", "uma", "wahamba"...
### Question: Ukrainian implements Language { @Override public Set<String> stopWords() { return new HashSet<>(Arrays.asList( "але", "ви", "вона", "вони", "воно", "він", "в╡д", "з", "й", "коли", "ми", "нам", "про", "та", "ти", "хоча", "це", "цей", "чи", "чого", "що", "як", "яко╞", "із", "інших", "╙", "╞х", "╡" )); } @O...
### Question: Somali implements Language { @Override public Set<String> stopWords() { return new HashSet<>(Arrays.asList( "aad", "albaabkii", "atabo", "ay", "ayaa", "ayee", "ayuu", "dhan", "hadana", "in", "inuu", "isku", "jiray", "jirtay", "ka", "kale", "kasoo", "ku", "kuu", "lakin", "markii", "oo", "si", "soo", "uga",...
### Question: Latin implements Language { @Override public Set<String> stopWords() { return new HashSet<>(Arrays.asList( "a", "ab", "ac", "ad", "at", "atque", "aut", "autem", "cum", "de", "dum", "e", "erant", "erat", "est", "et", "etiam", "ex", "haec", "hic", "hoc", "in", "ita", "me", "nec", "neque", "non", "per", "qua...
### Question: Hausa implements Language { @Override public Set<String> stopWords() { return new HashSet<>(Arrays.asList( "a", "amma", "ba", "ban", "ce", "cikin", "da", "don", "ga", "in", "ina", "ita", "ji", "ka", "ko", "kuma", "lokacin", "ma", "mai", "na", "ne", "ni", "sai", "shi", "su", "suka", "sun", "ta", "tafi", "t...
### Question: MappableMapper implements NitriteMapper { @Override public boolean isValueType(Class<?> type) { if (type.isPrimitive() && type != void.class) return true; if (valueTypes.contains(type)) return true; for (Class<?> valueType : valueTypes) { if (valueType.isAssignableFrom(type)) return true; } return false; ...
### Question: EnglishTextTokenizer extends BaseTextTokenizer { @Override public Languages getLanguage() { return Languages.English; } EnglishTextTokenizer(); @Override Languages getLanguage(); @Override Set<String> stopWords(); }### Answer: @Test public void testConstructor() { assertEquals(Languages.English, (new Eng...
### Question: EnglishTextTokenizer extends BaseTextTokenizer { @Override public Set<String> stopWords() { return language.stopWords(); } EnglishTextTokenizer(); @Override Languages getLanguage(); @Override Set<String> stopWords(); }### Answer: @Test public void testStopWords() { Set<String> actualStopWordsResult = (ne...
### Question: UniversalTextTokenizer extends BaseTextTokenizer { @Override public Languages getLanguage() { return Languages.ALL; } UniversalTextTokenizer(); UniversalTextTokenizer(Languages... languages); @Override Languages getLanguage(); @Override Set<String> stopWords(); }### Answer: @Test public void testConstru...
### Question: UniversalTextTokenizer extends BaseTextTokenizer { @Override public Set<String> stopWords() { return stopWords; } UniversalTextTokenizer(); UniversalTextTokenizer(Languages... languages); @Override Languages getLanguage(); @Override Set<String> stopWords(); }### Answer: @Test public void testStopWords()...
### Question: UniqueIndexer extends ComparableIndexer { @Override public String getIndexType() { return IndexType.Unique; } @Override String getIndexType(); @Override boolean isUnique(); }### Answer: @Test public void testGetIndexType() { assertEquals("Unique", (new UniqueIndexer()).getIndexType()); }
### Question: UniqueIndexer extends ComparableIndexer { @Override public boolean isUnique() { return true; } @Override String getIndexType(); @Override boolean isUnique(); }### Answer: @Test public void testIsUnique() { assertTrue((new UniqueIndexer()).isUnique()); }
### Question: IndexOptions { public static IndexOptions indexOptions(String indexType) { return indexOptions(indexType, false); } static IndexOptions indexOptions(String indexType); static IndexOptions indexOptions(String indexType, boolean async); }### Answer: @Test public void testIndexOptions() { IndexOptions actu...
### Question: IndexEntry implements Comparable<IndexEntry>, Serializable { @Override public int compareTo(IndexEntry other) { String string = collectionName + field + indexType; String otherString = other.collectionName + other.field + other.indexType; return string.compareTo(otherString); } IndexEntry(String indexType...
### Question: MappableMapper implements NitriteMapper { @Override public boolean isValue(Object object) { return isValueType(object.getClass()); } MappableMapper(Class<?>... valueTypes); @Override @SuppressWarnings("unchecked") Target convert(Source source, Class<Target> type); @Override boolean isValueType(Class<?> ty...
### Question: NonUniqueIndexer extends ComparableIndexer { @Override boolean isUnique() { return false; } @Override String getIndexType(); }### Answer: @Test public void testIsUnique() { assertFalse((new NonUniqueIndexer()).isUnique()); }
### Question: NonUniqueIndexer extends ComparableIndexer { @Override public String getIndexType() { return IndexType.NonUnique; } @Override String getIndexType(); }### Answer: @Test public void testGetIndexType() { assertEquals("NonUnique", (new NonUniqueIndexer()).getIndexType()); }
### Question: MapDBStore extends AbstractNitriteStore<MapDBConfig> { @Override public boolean isClosed() { return db == null || db.isClosed(); } MapDBStore(); @Override void openOrCreate(); @Override boolean isClosed(); @Override boolean hasUnsavedChanges(); @Override boolean isReadOnly(); @Override void commit(); @Ove...
### Question: MapDBStore extends AbstractNitriteStore<MapDBConfig> { @Override public boolean hasUnsavedChanges() { return false; } MapDBStore(); @Override void openOrCreate(); @Override boolean isClosed(); @Override boolean hasUnsavedChanges(); @Override boolean isReadOnly(); @Override void commit(); @Override void cl...
### Question: MapDBStore extends AbstractNitriteStore<MapDBConfig> { @Override public String getStoreVersion() { return "MapDB/" + getMapDbVersion(); } MapDBStore(); @Override void openOrCreate(); @Override boolean isClosed(); @Override boolean hasUnsavedChanges(); @Override boolean isReadOnly(); @Override void commit(...
### Question: MapDBModule implements StoreModule { public static MapDBModuleBuilder withConfig() { return new MapDBModuleBuilder(); } MapDBModule(String path); static MapDBModuleBuilder withConfig(); @Override NitriteStore<?> getStore(); @Override Set<NitritePlugin> plugins(); }### Answer: @Test public void testWithCo...
### Question: MapDBModule implements StoreModule { @Override public NitriteStore<?> getStore() { MapDBStore store = new MapDBStore(); store.setStoreConfig(storeConfig); return store; } MapDBModule(String path); static MapDBModuleBuilder withConfig(); @Override NitriteStore<?> getStore(); @Override Set<NitritePlugin> pl...
### Question: MapDBModule implements StoreModule { @Override public Set<NitritePlugin> plugins() { return setOf(getStore()); } MapDBModule(String path); static MapDBModuleBuilder withConfig(); @Override NitriteStore<?> getStore(); @Override Set<NitritePlugin> plugins(); }### Answer: @Test public void testPlugins() { a...
### Question: MessageFactory { public MessageHeader createHeader(MessageType messageType, String collectionName, String correlationId, String replicaId, String userName) { MessageHeader messageHeader = new MessageHeader(); messageHeader.setId(UUID.randomUUID().toString()); messageHeader.setCorrelationId(correlationId);...
### Question: ObjectCursor implements Cursor<T> { @Override public <P> RecordStream<P> project(Class<P> projectionType) { notNull(projectionType, "projection cannot be null"); Document dummyDoc = emptyDocument(nitriteMapper, projectionType); return new MutatedObjectStream<>(nitriteMapper, cursor.project(dummyDoc), proj...
### Question: ReplicationException extends NitriteException { public boolean isFatal() { return fatal; } ReplicationException(String errorMessage, boolean fatal); ReplicationException(String errorMessage, Throwable cause, boolean fatal); boolean isFatal(); }### Answer: @Test public void testConstructor() { assertTrue...
### Question: DocumentSerializer extends StdScalarSerializer<Document> { @Override public void serialize(Document value, JsonGenerator gen, SerializerProvider provider) throws IOException { if (value != null) { Map<String, Object> map = fromDocument(value); gen.writeObject(map); } } protected DocumentSerializer(); @Ov...
### Question: FlowableWriteResult extends FlowableIterable<NitriteId> { Single<Integer> getAffectedCount() { return Single.fromCallable(() -> { WriteResult wrapped = ObjectHelper.requireNonNull(supplier.call(), "The supplier supplied is null"); return wrapped.getAffectedCount(); }); } FlowableWriteResult(Callable<Write...
### Question: KryoObjectFormatter implements ObjectFormatter { @Override public <T> byte[] encode(T object) { if (object == null) return DB_NULL; try(ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) { try (Output output = new Output(byteArrayOutputStream)) { synchronized (kryo) { kryo.writeObj...
### Question: RepositoryOperations { public Filter createUniqueFilter(Object object) { if (idField == null) { throw new NotIdentifiableException("update operation failed as no id value found for the object"); } idField.setAccessible(true); try { Object value = idField.get(object); if (value == null) { throw new Invalid...
### Question: RepositoryOperations { <T> Field getIdField(Class<T> type) { List<Field> fields; if (type.isAnnotationPresent(InheritIndices.class)) { fields = getFieldsUpto(type, Object.class); } else { fields = Arrays.asList(type.getDeclaredFields()); } boolean alreadyIdFound = false; Field idField = null; for (Field f...
### Question: KryoObjectFormatter implements ObjectFormatter { @Override @SuppressWarnings("unchecked") public <T> byte[] encodeKey(T object) { if (object == null) return DB_NULL; Class<?> clazz = object.getClass(); KryoKeySerializer<T> serializer = (KryoKeySerializer<T>) keySerializerRegistry.get(clazz); if (serialize...
### Question: RepositoryFactory { public RepositoryFactory(CollectionFactory collectionFactory) { this.collectionFactory = collectionFactory; this.repositoryMap = new HashMap<>(); this.lock = new ReentrantLock(); } RepositoryFactory(CollectionFactory collectionFactory); ObjectRepository<T> getRepository(NitriteConfig n...
### Question: RepositoryFactory { public <T> ObjectRepository<T> getRepository(NitriteConfig nitriteConfig, Class<T> type) { return getRepository(nitriteConfig, type, null); } RepositoryFactory(CollectionFactory collectionFactory); ObjectRepository<T> getRepository(NitriteConfig nitriteConfig, Class<T> type); @Suppress...
### Question: InMemoryStore extends AbstractNitriteStore<InMemoryConfig> { @Override public boolean isClosed() { return closed; } InMemoryStore(); @Override void openOrCreate(); @Override boolean isClosed(); @Override boolean hasUnsavedChanges(); @Override boolean isReadOnly(); @Override void commit(); @Override void c...
### Question: InMemoryStore extends AbstractNitriteStore<InMemoryConfig> { @Override public boolean hasUnsavedChanges() { return false; } InMemoryStore(); @Override void openOrCreate(); @Override boolean isClosed(); @Override boolean hasUnsavedChanges(); @Override boolean isReadOnly(); @Override void commit(); @Overrid...
### Question: InMemoryStore extends AbstractNitriteStore<InMemoryConfig> { @Override public boolean isReadOnly() { return false; } InMemoryStore(); @Override void openOrCreate(); @Override boolean isClosed(); @Override boolean hasUnsavedChanges(); @Override boolean isReadOnly(); @Override void commit(); @Override void ...
### Question: RocksDBModule implements StoreModule { public NitriteStore<?> getStore() { RocksDBStore store = new RocksDBStore(); store.setStoreConfig(storeConfig); return store; } RocksDBModule(String path); @Override Set<NitritePlugin> plugins(); static RocksDBModuleBuilder withConfig(); NitriteStore<?> getStore(); ...
### Question: InMemoryStore extends AbstractNitriteStore<InMemoryConfig> { @Override public void close() { closed = true; alert(StoreEvents.Closed); } InMemoryStore(); @Override void openOrCreate(); @Override boolean isClosed(); @Override boolean hasUnsavedChanges(); @Override boolean isReadOnly(); @Override void commi...
### Question: InMemoryStore extends AbstractNitriteStore<InMemoryConfig> { @Override public boolean hasMap(String mapName) { return nitriteMapRegistry.containsKey(mapName) || nitriteRTreeMapRegistry.containsKey(mapName); } InMemoryStore(); @Override void openOrCreate(); @Override boolean isClosed(); @Override boolean h...
### Question: InMemoryStore extends AbstractNitriteStore<InMemoryConfig> { @Override @SuppressWarnings("unchecked") public <Key, Value> NitriteMap<Key, Value> openMap(String mapName, Class<?> keyType, Class<?> valueType) { if (nitriteMapRegistry.containsKey(mapName)) { return (InMemoryMap<Key, Value>) nitriteMapRegistr...
### Question: InMemoryStore extends AbstractNitriteStore<InMemoryConfig> { @Override @SuppressWarnings("unchecked") public <Key extends BoundingBox, Value> NitriteRTree<Key, Value> openRTree(String rTreeName, Class<?> keyType, Class<?> valueType) { if (nitriteRTreeMapRegistry.containsKey(rTreeName)) { return (InMemoryR...
### Question: InMemoryStore extends AbstractNitriteStore<InMemoryConfig> { @Override public String getStoreVersion() { return "InMemory/" + NITRITE_VERSION; } InMemoryStore(); @Override void openOrCreate(); @Override boolean isClosed(); @Override boolean hasUnsavedChanges(); @Override boolean isReadOnly(); @Override vo...
### Question: InMemoryRTree implements NitriteRTree<Key, Value> { @Override public long size() { return backingMap.size(); } InMemoryRTree(); @Override void add(Key key, NitriteId nitriteId); @Override void remove(Key key, NitriteId nitriteId); @Override RecordStream<NitriteId> findIntersectingKeys(Key key); @Override ...
### Question: InMemoryConfig implements StoreConfig { @Override public final String filePath() { return null; } InMemoryConfig(); @Override final String filePath(); @Override Boolean isReadOnly(); @Override void addStoreEventListener(StoreEventListener listener); }### Answer: @Test public void testFilePath() { assertN...
### Question: InMemoryConfig implements StoreConfig { @Override public Boolean isReadOnly() { return false; } InMemoryConfig(); @Override final String filePath(); @Override Boolean isReadOnly(); @Override void addStoreEventListener(StoreEventListener listener); }### Answer: @Test public void testIsReadOnly() { assertF...
### Question: InMemoryMap implements NitriteMap<Key, Value> { @Override public boolean containsKey(Key key) { if (key == null) { return nullEntryMap.containsKey(NullEntry.getInstance()); } return backingMap.containsKey(key); } InMemoryMap(String mapName, NitriteStore<?> nitriteStore); @Override boolean containsKey(Key ...
### Question: RocksDBConfig implements StoreConfig { @Override public final boolean isInMemory() { return false; } RocksDBConfig(); @Override void addStoreEventListener(StoreEventListener listener); @Override final boolean isInMemory(); @Override final Boolean isReadOnly(); }### Answer: @Test public void testConstruct...
### Question: InMemoryMap implements NitriteMap<Key, Value> { @Override public Value get(Key key) { if (key == null) { return nullEntryMap.get(NullEntry.getInstance()); } return backingMap.get(key); } InMemoryMap(String mapName, NitriteStore<?> nitriteStore); @Override boolean containsKey(Key key); @Override Value get(...
### Question: InMemoryMap implements NitriteMap<Key, Value> { @Override public RecordStream<Value> values() { return RecordStream.fromCombined(backingMap.values(), nullEntryMap.values()); } InMemoryMap(String mapName, NitriteStore<?> nitriteStore); @Override boolean containsKey(Key key); @Override Value get(Key key); @...
### Question: InMemoryMap implements NitriteMap<Key, Value> { @Override public Value remove(Key key) { Value value; if (key == null) { value = nullEntryMap.remove(NullEntry.getInstance()); } else { value = backingMap.remove(key); } updateLastModifiedTime(); return value; } InMemoryMap(String mapName, NitriteStore<?> ni...
### Question: InMemoryMap implements NitriteMap<Key, Value> { @Override public RecordStream<Key> keySet() { return RecordStream.fromIterable(() -> new Iterator<Key>() { final Iterator<Key> keyIterator = backingMap.keySet().iterator(); final Iterator<NullEntry> nullEntryIterator = nullEntryMap.keySet().iterator(); @Over...
### Question: InMemoryMap implements NitriteMap<Key, Value> { @Override public void put(Key key, Value value) { notNull(value, "value cannot be null"); if (key == null) { nullEntryMap.put(NullEntry.getInstance(), value); } else { Map.Entry<Key, Value> firstEntry = backingMap.firstEntry(); if (firstEntry != null) { if (...
### Question: InMemoryMap implements NitriteMap<Key, Value> { @Override public long size() { return backingMap.size() + nullEntryMap.size(); } InMemoryMap(String mapName, NitriteStore<?> nitriteStore); @Override boolean containsKey(Key key); @Override Value get(Key key); @Override NitriteStore<?> getStore(); @Override ...
### Question: InMemoryMap implements NitriteMap<Key, Value> { @Override public Value putIfAbsent(Key key, Value value) { notNull(value, "value cannot be null"); Value v = get(key); if (v == null) { put(key, value); } updateLastModifiedTime(); return v; } InMemoryMap(String mapName, NitriteStore<?> nitriteStore); @Overr...
### Question: InMemoryMap implements NitriteMap<Key, Value> { @Override public RecordStream<Pair<Key, Value>> entries() { return RecordStream.fromIterable(() -> new Iterator<Pair<Key, Value>>() { private final Iterator<Map.Entry<Key, Value>> entryIterator = backingMap.entrySet().iterator(); private final Iterator<Map.E...
### Question: InMemoryMap implements NitriteMap<Key, Value> { @Override public Key higherKey(Key key) { if (key == null) { return null; } return backingMap.higherKey(key); } InMemoryMap(String mapName, NitriteStore<?> nitriteStore); @Override boolean containsKey(Key key); @Override Value get(Key key); @Override Nitrite...
### Question: InMemoryMap implements NitriteMap<Key, Value> { @Override public Key ceilingKey(Key key) { if (key == null) { return null; } return backingMap.ceilingKey(key); } InMemoryMap(String mapName, NitriteStore<?> nitriteStore); @Override boolean containsKey(Key key); @Override Value get(Key key); @Override Nitri...
### Question: InMemoryMap implements NitriteMap<Key, Value> { @Override public Key lowerKey(Key key) { if (key == null) { return null; } return backingMap.lowerKey(key); } InMemoryMap(String mapName, NitriteStore<?> nitriteStore); @Override boolean containsKey(Key key); @Override Value get(Key key); @Override NitriteSt...
### Question: InMemoryMap implements NitriteMap<Key, Value> { @Override public Key floorKey(Key key) { if (key == null) { return null; } return backingMap.floorKey(key); } InMemoryMap(String mapName, NitriteStore<?> nitriteStore); @Override boolean containsKey(Key key); @Override Value get(Key key); @Override NitriteSt...
### Question: InMemoryMap implements NitriteMap<Key, Value> { @Override public boolean isEmpty() { return backingMap.isEmpty() && nullEntryMap.isEmpty(); } InMemoryMap(String mapName, NitriteStore<?> nitriteStore); @Override boolean containsKey(Key key); @Override Value get(Key key); @Override NitriteStore<?> getStore(...