public class DirectWriteMapDbIndicesStore extends DirectWriteMapDbStore
DirectWriteMapDbStore
that persists Collection
indices instead of serialized arrays.
Indices are persisted with dedicated FeatureKey
s containing the index of the element to
store. Using this approach avoid to deserialize entire Collection
s to retrieve a single
element, which can be an important bottleneck in terms of execution time and memory consumption
if the underlying model contains very large Collections
.
This class re-implements EStructuralFeature
accessors and mutators as well as Collection
operations such as size
, clear
, or indexOf
.
This store can be used as a base store that can be complemented by plugging decorator stores on top of it
(see AbstractPersistentStoreDecorator
subclasses) to provide additional features such as caching or logging.
DEFAULT_CACHE_SIZE, persistentObjectsCache
backend
NO_INDEX
Constructor and Description |
---|
DirectWriteMapDbIndicesStore(Resource.Internal resource,
MapDbPersistenceBackend backend)
Constructs a new
DirectWriteMapDbIndicesStore between the given resource and the
backend . |
Modifier and Type | Method and Description |
---|---|
void |
add(InternalEObject internalObject,
EStructuralFeature feature,
int index,
Object value)
Adds the value at the index in the
content of the object's feature. |
void |
clear(InternalEObject internalObject,
EStructuralFeature feature)
Removes all values form the
content of the object's feature |
protected Object |
getAttribute(PersistentEObject object,
EAttribute attribute,
int index)
Returns the value at the
index in the content of the attribute of the object . |
protected Object |
getReference(PersistentEObject object,
EReference reference,
int index)
Returns the value at the
index in the content of the reference of the object . |
int |
indexOf(InternalEObject internalObject,
EStructuralFeature feature,
Object value)
Returns the first index of the given value in the
content of the object's feature. |
int |
lastIndexOf(InternalEObject internalObject,
EStructuralFeature feature,
Object value)
Returns the last index of the given value in the
content of the object's feature. |
Object |
remove(InternalEObject internalObject,
EStructuralFeature feature,
int index)
Removes the value at the index in the
content of the object's feature. |
protected Object |
setAttribute(PersistentEObject object,
EAttribute attribute,
int index,
Object value)
Sets the value at the
index in the content of the attribute of the object . |
protected Object |
setReference(PersistentEObject object,
EReference reference,
int index,
PersistentEObject value)
Sets the value at the
index in the content of the reference of the object . |
int |
size(InternalEObject internalObject,
EStructuralFeature feature)
Returns the number of values in the
content of the object's feature. |
addAttribute, addReference, contains, eObject, getContainer, getContainingFeature, getFromMap, getFromMap, isSet, removeAttribute, removeReference, unset, updateContainment, updateInstanceOf
clearAttribute, clearReference, containsAttribute, containsReference, create, get, hashCode, indexOfAttribute, indexOfReference, isEmpty, isSetAttribute, isSetReference, lastIndexOfAttribute, lastIndexOfReference, move, parseProperty, resource, save, serializeToProperty, set, toArray, toArray, unsetAttribute, unsetReference
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getAllInstances
public DirectWriteMapDbIndicesStore(Resource.Internal resource, MapDbPersistenceBackend backend)
DirectWriteMapDbIndicesStore
between the given resource
and the
backend
.resource
- the resource to persist and accessbackend
- the persistence back-end used to store the modelpublic void add(InternalEObject internalObject, EStructuralFeature feature, int index, Object value)
AbstractDirectWriteStore
content
of the object's feature.
By default, calls the associated methods depending on the type of the feature
.
add
in interface InternalEObject.EStore
add
in class AbstractDirectWriteStore<MapDbPersistenceBackend>
internalObject
- the object in question.feature
- a many-valued
feature of the object.index
- an index within the content.value
- the value to add.AbstractDirectWriteStore.addAttribute(PersistentEObject, EAttribute, int, Object)
,
AbstractDirectWriteStore.addReference(PersistentEObject, EReference, int, PersistentEObject)
public Object remove(InternalEObject internalObject, EStructuralFeature feature, int index)
AbstractDirectWriteStore
content
of the object's feature.
By default, calls the associated methods depending on the type of the feature
.
remove
in interface InternalEObject.EStore
remove
in class AbstractDirectWriteStore<MapDbPersistenceBackend>
internalObject
- the object in question.feature
- a many-valued
feature of the object.index
- the index within the feature's content of the value to remove.AbstractDirectWriteStore.removeAttribute(PersistentEObject, EAttribute, int)
,
AbstractDirectWriteStore.removeReference(PersistentEObject, EReference, int)
public int indexOf(InternalEObject internalObject, EStructuralFeature feature, Object value)
AbstractDirectWriteStore
content
of the object's feature.
By default, calls the associated methods depending on the type of the feature
.
indexOf
in interface InternalEObject.EStore
indexOf
in class DirectWriteMapDbStore
internalObject
- the object in question.feature
- a many-valued
feature of the object.value
- the value in question.AbstractDirectWriteStore.indexOfAttribute(PersistentEObject, EAttribute, Object)
,
AbstractDirectWriteStore.indexOfReference(PersistentEObject, EReference, PersistentEObject)
public int lastIndexOf(InternalEObject internalObject, EStructuralFeature feature, Object value)
AbstractDirectWriteStore
content
of the object's feature.
By default, calls the associated methods depending on the type of the feature
.
lastIndexOf
in interface InternalEObject.EStore
lastIndexOf
in class DirectWriteMapDbStore
internalObject
- the object in question.feature
- a many-valued
feature of the object.value
- the value in question.AbstractDirectWriteStore.lastIndexOfAttribute(PersistentEObject, EAttribute, Object)
,
AbstractDirectWriteStore.lastIndexOfReference(PersistentEObject, EReference, PersistentEObject)
public void clear(InternalEObject internalObject, EStructuralFeature feature)
AbstractDirectWriteStore
content
of the object's feature
By default, calls the associated methods depending on the type of the feature
.
clear
in interface InternalEObject.EStore
clear
in class DirectWriteMapDbStore
internalObject
- the object in question.feature
- a many-valued
feature of the object.AbstractDirectWriteStore.clearAttribute(PersistentEObject, EAttribute)
,
AbstractDirectWriteStore.clearReference(PersistentEObject, EReference)
protected Object getAttribute(PersistentEObject object, EAttribute attribute, int index)
AbstractDirectWriteStore
index
in the content of the attribute
of the object
.getAttribute
in class DirectWriteMapDbStore
object
- the objectattribute
- an attribute of the object
index
- an index within the content or PersistentStore.NO_INDEX
AbstractDirectWriteStore.get(InternalEObject, EStructuralFeature, int)
protected Object getReference(PersistentEObject object, EReference reference, int index)
AbstractDirectWriteStore
index
in the content of the reference
of the object
.getReference
in class DirectWriteMapDbStore
object
- the objectreference
- a reference of the object
index
- an index within the content or PersistentStore.NO_INDEX
AbstractDirectWriteStore.get(InternalEObject, EStructuralFeature, int)
protected Object setAttribute(PersistentEObject object, EAttribute attribute, int index, Object value)
AbstractDirectWriteStore
index
in the content of the attribute
of the object
.setAttribute
in class DirectWriteMapDbStore
object
- the objectattribute
- an attribute of the object
index
- an index within the content or PersistentStore.NO_INDEX
value
- the new valueAbstractDirectWriteStore.set(InternalEObject, EStructuralFeature, int, Object)
protected Object setReference(PersistentEObject object, EReference reference, int index, PersistentEObject value)
AbstractDirectWriteStore
index
in the content of the reference
of the object
.setReference
in class DirectWriteMapDbStore
object
- the objectreference
- a reference of the object
index
- an index within the content or PersistentStore.NO_INDEX
value
- the new valueAbstractDirectWriteStore.set(InternalEObject, EStructuralFeature, int, Object)
public int size(InternalEObject internalObject, EStructuralFeature feature)
org.eclipse.emf.ecore.InternalEObject.EStore
content
of the object's feature.size
in interface InternalEObject.EStore
size
in class DirectWriteMapDbStore
internalObject
- the object in question.feature
- a many-valued
feature of the object.Copyright © 2013–2017 Atlanmod INRIA LINA Mines Nantes. All rights reserved.