Class ORecordLazySet
java.lang.Object
java.util.AbstractCollection<OIdentifiable>
com.orientechnologies.orient.core.db.record.ORecordLazySet
- All Implemented Interfaces:
OSizeable,OAutoConvertToRecord,ODetachable,ORecordElement,ORecordLazyMultiValue,OTrackedMultiValue<OIdentifiable,,OIdentifiable> OIdentityChangeListener,Iterable<OIdentifiable>,Collection<OIdentifiable>,Set<OIdentifiable>
public class ORecordLazySet
extends AbstractCollection<OIdentifiable>
implements Set<OIdentifiable>, OTrackedMultiValue<OIdentifiable,OIdentifiable>, ORecordElement, ORecordLazyMultiValue, OIdentityChangeListener
Lazy implementation of Set. Can be bound to a source ORecord object to keep track of changes.
This avoid to call the makeDirty() by hand when the set is changed.
Internals:
- stores new records in a separate IdentityHashMap to keep underlying list (delegate) always ordered and minimizing sort operations
- Author:
- Luca Garulli (l.garulli--(at)--orientdb.com)
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.orientechnologies.orient.core.db.record.ORecordElement
ORecordElement.STATUS -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected static final Objectprotected Map<OIdentifiable, Object> protected final ORecordElement -
Constructor Summary
ConstructorsConstructorDescriptionORecordLazySet(ORecordElement iSourceRecord) ORecordLazySet(ORecordElement iSourceRecord, Collection<OIdentifiable> iOrigin) -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(OIdentifiable e) booleanaddAll(Collection<? extends OIdentifiable> c) protected voidaddEvent(OIdentifiable added) booleanprotected voidvoidclear()booleanbooleanvoidBrowse all the set to convert all the items into records.booleanBrowse all the set to convert all the items into links.booleandetach()Detaches the object.voiddisableTracking(ORecordElement document) voidenableTracking(ORecordElement parent) booleanClass<?> getOwner()inthashCode()booleanbooleanbooleaniterator()voidonAfterIdentityChange(ORecord record) called afer the change of the identity is made.voidonBeforeIdentityChange(ORecord record) Called before the change of the identity is made.booleanbooleanremoveAll(Collection<?> c) protected voidremoveEvent(OIdentifiable removed) voidreplace(OMultiValueChangeEvent<Object, Object> event, Object newValue) booleanretainAll(Collection<?> c) Reverts all operations that were performed on collection and return original collection state.voidsetAutoConvertToRecord(boolean convertToRecord) setDirty()Marks the instance as dirty.voidintsize()toString()voidMethods inherited from class java.util.AbstractCollection
containsAll, isEmpty, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
containsAll, isEmpty, spliterator, toArray, toArray
-
Field Details
-
autoConvertToRecord
protected boolean autoConvertToRecord -
sourceRecord
-
map
-
ENTRY_REMOVAL
-
-
Constructor Details
-
ORecordLazySet
-
ORecordLazySet
-
-
Method Details
-
getOwner
- Specified by:
getOwnerin interfaceORecordElement- Returns:
- Returns record element which contains given one.
-
addInternal
- Specified by:
addInternalin interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
contains
- Specified by:
containsin interfaceCollection<OIdentifiable>- Specified by:
containsin interfaceSet<OIdentifiable>- Overrides:
containsin classAbstractCollection<OIdentifiable>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<OIdentifiable>- Specified by:
clearin interfaceSet<OIdentifiable>- Overrides:
clearin classAbstractCollection<OIdentifiable>
-
removeAll
- Specified by:
removeAllin interfaceCollection<OIdentifiable>- Specified by:
removeAllin interfaceSet<OIdentifiable>- Overrides:
removeAllin classAbstractCollection<OIdentifiable>
-
addAll
- Specified by:
addAllin interfaceCollection<OIdentifiable>- Specified by:
addAllin interfaceSet<OIdentifiable>- Overrides:
addAllin classAbstractCollection<OIdentifiable>
-
retainAll
- Specified by:
retainAllin interfaceCollection<OIdentifiable>- Specified by:
retainAllin interfaceSet<OIdentifiable>- Overrides:
retainAllin classAbstractCollection<OIdentifiable>
-
size
public int size()- Specified by:
sizein interfaceCollection<OIdentifiable>- Specified by:
sizein interfaceOSizeable- Specified by:
sizein interfaceSet<OIdentifiable>- Specified by:
sizein classAbstractCollection<OIdentifiable>
-
setDirty
Description copied from interface:ORecordElementMarks the instance as dirty. The dirty status could be propagated up if the implementation supports ownership concept.- Specified by:
setDirtyin interfaceORecordElement- Returns:
- The object it self. Useful to call methods in chain.
-
setDirtyNoChanged
public void setDirtyNoChanged()- Specified by:
setDirtyNoChangedin interfaceORecordElement
-
returnOriginalState
public Set<OIdentifiable> returnOriginalState(List<OMultiValueChangeEvent<OIdentifiable, OIdentifiable>> events) Description copied from interface:OTrackedMultiValueReverts all operations that were performed on collection and return original collection state.- Specified by:
returnOriginalStatein interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable> - Parameters:
events- List of operations that were performed on collection.- Returns:
- Original collection state.
-
addOwnerToEmbeddedDoc
-
addEvent
-
removeEvent
-
getGenericClass
- Specified by:
getGenericClassin interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
replace
- Specified by:
replacein interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
enableTracking
- Specified by:
enableTrackingin interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
disableTracking
- Specified by:
disableTrackingin interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
transactionClear
public void transactionClear()- Specified by:
transactionClearin interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
isModified
public boolean isModified()- Specified by:
isModifiedin interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
isTransactionModified
public boolean isTransactionModified()- Specified by:
isTransactionModifiedin interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
getTimeLine
- Specified by:
getTimeLinein interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-
detach
public boolean detach()Description copied from interface:ODetachableDetaches the object.- Specified by:
detachin interfaceODetachable- Returns:
- true if the object has been fully detached, otherwise false
-
iterator
- Specified by:
iteratorin interfaceCollection<OIdentifiable>- Specified by:
iteratorin interfaceIterable<OIdentifiable>- Specified by:
iteratorin interfaceSet<OIdentifiable>- Specified by:
iteratorin classAbstractCollection<OIdentifiable>
-
rawIterator
- Specified by:
rawIteratorin interfaceORecordLazyMultiValue
-
add
- Specified by:
addin interfaceCollection<OIdentifiable>- Specified by:
addin interfaceSet<OIdentifiable>- Overrides:
addin classAbstractCollection<OIdentifiable>
-
convertLinks2Records
public void convertLinks2Records()Description copied from interface:ORecordLazyMultiValueBrowse all the set to convert all the items into records.It converts only items that already loaded into memory from storage. To convert records that will be fetched from disk later use
OAutoConvertToRecord.setAutoConvertToRecord(boolean)- Specified by:
convertLinks2Recordsin interfaceORecordLazyMultiValue
-
onAfterIdentityChange
Description copied from interface:OIdentityChangeListenercalled afer the change of the identity is made.- Specified by:
onAfterIdentityChangein interfaceOIdentityChangeListener- Parameters:
record-
-
onBeforeIdentityChange
Description copied from interface:OIdentityChangeListenerCalled before the change of the identity is made.- Specified by:
onBeforeIdentityChangein interfaceOIdentityChangeListener- Parameters:
record-
-
convertRecords2Links
public boolean convertRecords2Links()Description copied from interface:ORecordLazyMultiValueBrowse all the set to convert all the items into links.- Specified by:
convertRecords2Linksin interfaceORecordLazyMultiValue- Returns:
-
clearDeletedRecords
public boolean clearDeletedRecords() -
remove
- Specified by:
removein interfaceCollection<OIdentifiable>- Specified by:
removein interfaceSet<OIdentifiable>- Overrides:
removein classAbstractCollection<OIdentifiable>
-
isAutoConvertToRecord
public boolean isAutoConvertToRecord()- Specified by:
isAutoConvertToRecordin interfaceOAutoConvertToRecord
-
setAutoConvertToRecord
public void setAutoConvertToRecord(boolean convertToRecord) - Specified by:
setAutoConvertToRecordin interfaceOAutoConvertToRecord
-
equals
- Specified by:
equalsin interfaceCollection<OIdentifiable>- Specified by:
equalsin interfaceSet<OIdentifiable>- Overrides:
equalsin classObject
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<OIdentifiable>- Specified by:
hashCodein interfaceSet<OIdentifiable>- Overrides:
hashCodein classObject
-
toString
- Overrides:
toStringin classAbstractCollection<OIdentifiable>
-
getTransactionTimeLine
- Specified by:
getTransactionTimeLinein interfaceOTrackedMultiValue<OIdentifiable,OIdentifiable>
-