Package org.faktorips.runtime.internal
Class ModelObjectDelta
java.lang.Object
org.faktorips.runtime.internal.ModelObjectDelta
- All Implemented Interfaces:
IModelObjectDelta
IModelObjectDelta implementation.
- Author:
- Jan Ortmann
-
Field Summary
Fields inherited from interface org.faktorips.runtime.IModelObjectDelta
ADDED, CHANGED, CHILD_CHANGED, CLASS_CHANGED, DIFFERENT_OBJECT_AT_POSITION, EMPTY, MOVED, PROPERTY_CHANGED, REMOVED, STRUCTURE_CHANGED
-
Method Summary
Modifier and TypeMethodDescriptionvoid
accept
(IModelObjectDeltaVisitor visitor) Accepts the given visitor.void
addChildDelta
(IModelObjectDelta childDelta) Adds the child delta to this delta and sets this delta's kindOfChange accordingly.void
checkPropertyChange
(String property, boolean value1, boolean value2, IDeltaComputationOptions options) void
checkPropertyChange
(String property, char value1, char value2, IDeltaComputationOptions options) void
checkPropertyChange
(String property, double value1, double value2, IDeltaComputationOptions options) void
checkPropertyChange
(String property, float value1, float value2, IDeltaComputationOptions options) void
checkPropertyChange
(String property, int value1, int value2, IDeltaComputationOptions options) void
checkPropertyChange
(String property, Object value1, Object value2, IDeltaComputationOptions options) static final void
createAssociatedChildDeltas
(ModelObjectDelta delta, List<? extends IModelObject> originals, List<? extends IModelObject> refObjects, String association, IDeltaComputationOptions options) static final void
createAssociatedChildDeltas
(ModelObjectDelta delta, IModelObject original, IModelObject refObject, String association, IDeltaComputationOptions options) static final void
createChildDeltas
(ModelObjectDelta delta, List<? extends IModelObject> originals, List<? extends IModelObject> refObjects, String association, IDeltaComputationOptions options) static final void
createChildDeltas
(ModelObjectDelta delta, IModelObject original, IModelObject refObject, String association, IDeltaComputationOptions options) The name of the association in which the object has been added, removed or changed.Returns the kind of association if this delta has any incoming association, that means it is part of a composite or the object is associated from another object.Returns the properties that have a different value in the model object and the reference model object.Returns deltas for all children of the model object which were added, removed, or changed.getChildDeltas
(int kind) Returns deltas for all children of this model object whose kind is included in the given mask.int
getKind()
Returns the kind of change.int
If delta's kind isIModelObjectDelta.CHANGED
, this method returns the kind of changed defined by the constant listed below.The model object this delta is computed for.The model object that is taken as a reference to which the orginal model object is compared to.boolean
isAdded()
Returnstrue
if this model object has been added to its parent,false
otherwise.boolean
Returnstrue
if this model object has been changed.boolean
Returnstrue
if at least one model object's children has been changed.boolean
Returnstrue
if the model object's Java class has "changed".boolean
Returnstrue
if a different model object is at a position, otherwisefalse
.boolean
isEmpty()
Returnstrue
if the delta is empty, the two objects are the same, otherwisefalse
.boolean
isMoved()
Returnstrue
if this model object has changed its position in the ordered association.boolean
Returnstrue
if at least one the model object's properties has changed, otherwisefalse
.boolean
isPropertyChanged
(String propertyName) Returnstrue
if the model object contains a different value for the given property than the reference model object.boolean
Returnstrue
if this model object has been removed from its parent,false
otherwise.boolean
Returnstrue
if this model object's structure has changed.void
Marks the delta as one where the object has changed its position.void
markPropertyChanged
(String property) Marks the given property as having a different value in the model object and the reference model object.static final ModelObjectDelta
newAddDelta
(IModelObject addedObject, String association, IDeltaComputationOptions options) Deprecated.since 19.12.static final ModelObjectDelta
newAddDelta
(IModelObject addedObject, String association, AssociationKind associationKind, IDeltaComputationOptions options) static final ModelObjectDelta
newChangeDelta
(IModelObject original, IModelObject refObject, int kindOfChange) static final ModelObjectDelta
newDelta
(IModelObject object, IModelObject refObject, IDeltaComputationOptions options) static final ModelObjectDelta
newDifferentObjectAtPositionChangedDelta
(IModelObject original, IModelObject refObject, String association) Deprecated.since 19.12.static final ModelObjectDelta
newDifferentObjectAtPositionChangedDelta
(IModelObject original, IModelObject refObject, String association, AssociationKind associationKind) static final ModelObjectDelta
newEmptyDelta
(IModelObject object, IModelObject refObject) static final ModelObjectDelta
newRemoveDelta
(IModelObject removedObject, String association, IDeltaComputationOptions options) Deprecated.since 19.12.static final ModelObjectDelta
newRemoveDelta
(IModelObject removedObject, String association, AssociationKind associationKind, IDeltaComputationOptions options) void
setAssociation
(String association) void
setAssociationKind
(AssociationKind associationKind) toString()
void
toString
(StringBuilder builder, String indentation)
-
Method Details
-
newDelta
public static final ModelObjectDelta newDelta(IModelObject object, IModelObject refObject, IDeltaComputationOptions options) -
newEmptyDelta
-
createChildDeltas
public static final void createChildDeltas(ModelObjectDelta delta, IModelObject original, IModelObject refObject, String association, IDeltaComputationOptions options) -
createAssociatedChildDeltas
public static final void createAssociatedChildDeltas(ModelObjectDelta delta, IModelObject original, IModelObject refObject, String association, IDeltaComputationOptions options) -
createChildDeltas
public static final void createChildDeltas(ModelObjectDelta delta, List<? extends IModelObject> originals, List<? extends IModelObject> refObjects, String association, IDeltaComputationOptions options) -
createAssociatedChildDeltas
public static final void createAssociatedChildDeltas(ModelObjectDelta delta, List<? extends IModelObject> originals, List<? extends IModelObject> refObjects, String association, IDeltaComputationOptions options) -
newAddDelta
@Deprecated public static final ModelObjectDelta newAddDelta(IModelObject addedObject, String association, IDeltaComputationOptions options) Deprecated.since 19.12. UsenewAddDelta(IModelObject, String, AssociationKind, IDeltaComputationOptions)
instead. -
newAddDelta
public static final ModelObjectDelta newAddDelta(IModelObject addedObject, String association, AssociationKind associationKind, IDeltaComputationOptions options) -
newRemoveDelta
@Deprecated public static final ModelObjectDelta newRemoveDelta(IModelObject removedObject, String association, IDeltaComputationOptions options) Deprecated.since 19.12. UsenewRemoveDelta(IModelObject, String, AssociationKind, IDeltaComputationOptions)
instead. -
newRemoveDelta
public static final ModelObjectDelta newRemoveDelta(IModelObject removedObject, String association, AssociationKind associationKind, IDeltaComputationOptions options) -
newDifferentObjectAtPositionChangedDelta
@Deprecated public static final ModelObjectDelta newDifferentObjectAtPositionChangedDelta(IModelObject original, IModelObject refObject, String association) Deprecated.since 19.12. UsenewDifferentObjectAtPositionChangedDelta(IModelObject, IModelObject, String, AssociationKind)
instead. -
newDifferentObjectAtPositionChangedDelta
public static final ModelObjectDelta newDifferentObjectAtPositionChangedDelta(IModelObject original, IModelObject refObject, String association, AssociationKind associationKind) -
newChangeDelta
public static final ModelObjectDelta newChangeDelta(IModelObject original, IModelObject refObject, int kindOfChange) -
addChildDelta
Adds the child delta to this delta and sets this delta's kindOfChange accordingly. E.g. if the child delta is of kind ADD, this delta's kind of change is marked as structure changed.Note this method ignores the childDelta if it is
null
or empty!!! -
getOriginalObject
Description copied from interface:IModelObjectDelta
The model object this delta is computed for. If this is a delta for a a child that was added to the new object, the method returnsnull
.- Specified by:
getOriginalObject
in interfaceIModelObjectDelta
-
getReferenceObject
Description copied from interface:IModelObjectDelta
The model object that is taken as a reference to which the orginal model object is compared to.If this is a delta for a a child that was removed from the orginial model object, the method returns
null
.- Specified by:
getReferenceObject
in interfaceIModelObjectDelta
-
getKind
public int getKind()Description copied from interface:IModelObjectDelta
Returns the kind of change. Note that an object can be moved and changed! To allow this type of information to be returned, a bit mask is used! -
getKindOfChange
public int getKindOfChange()Description copied from interface:IModelObjectDelta
If delta's kind isIModelObjectDelta.CHANGED
, this method returns the kind of changed defined by the constant listed below. Not that the kind of changes are not mututally excluded, so the returned kinds are bit masked. The method returns 0, if the delta's kind is notIModelObjectDelta.CHANGED
.- Specified by:
getKindOfChange
in interfaceIModelObjectDelta
- See Also:
-
getAssociation
Description copied from interface:IModelObjectDelta
The name of the association in which the object has been added, removed or changed. The association name is alwaysnull
for the root of the delta.- Specified by:
getAssociation
in interfaceIModelObjectDelta
-
setAssociation
-
getAssociationKind
Description copied from interface:IModelObjectDelta
Returns the kind of association if this delta has any incoming association, that means it is part of a composite or the object is associated from another object.- Specified by:
getAssociationKind
in interfaceIModelObjectDelta
- Returns:
- the
AssociationKind
ornull
if this is the root
-
setAssociationKind
-
checkPropertyChange
public void checkPropertyChange(String property, Object value1, Object value2, IDeltaComputationOptions options) -
checkPropertyChange
public void checkPropertyChange(String property, int value1, int value2, IDeltaComputationOptions options) -
checkPropertyChange
public void checkPropertyChange(String property, boolean value1, boolean value2, IDeltaComputationOptions options) -
checkPropertyChange
public void checkPropertyChange(String property, double value1, double value2, IDeltaComputationOptions options) -
checkPropertyChange
public void checkPropertyChange(String property, float value1, float value2, IDeltaComputationOptions options) -
checkPropertyChange
public void checkPropertyChange(String property, char value1, char value2, IDeltaComputationOptions options) -
markPropertyChanged
Marks the given property as having a different value in the model object and the reference model object. -
isClassChanged
public boolean isClassChanged()Description copied from interface:IModelObjectDelta
Returnstrue
if the model object's Java class has "changed". (Technically its of course just an instance of another class). Returnsfalse
otherwise.- Specified by:
isClassChanged
in interfaceIModelObjectDelta
-
isPropertyChanged
public boolean isPropertyChanged()Description copied from interface:IModelObjectDelta
Returnstrue
if at least one the model object's properties has changed, otherwisefalse
.- Specified by:
isPropertyChanged
in interfaceIModelObjectDelta
-
getChangedProperties
Description copied from interface:IModelObjectDelta
Returns the properties that have a different value in the model object and the reference model object. Returns an empty list if no such property exists.The order of properties in the list corresponds to the
order defined in the model type
. Properties not manually defined in the model type, such as theproduct component
, are placed before manually defined attributes.- Specified by:
getChangedProperties
in interfaceIModelObjectDelta
-
isPropertyChanged
Description copied from interface:IModelObjectDelta
Returnstrue
if the model object contains a different value for the given property than the reference model object. Returnsfalse
otherwise. Returnsfalse
if propertyName isnull
.- Specified by:
isPropertyChanged
in interfaceIModelObjectDelta
-
markMoved
public void markMoved()Marks the delta as one where the object has changed its position. -
isMoved
public boolean isMoved()Description copied from interface:IModelObjectDelta
Returnstrue
if this model object has changed its position in the ordered association. This type of delta is only returned if the computation method isIDeltaComputationOptions.ComputationMethod.BY_OBJECT
.- Specified by:
isMoved
in interfaceIModelObjectDelta
-
isDifferentObjectAtPosition
public boolean isDifferentObjectAtPosition()Description copied from interface:IModelObjectDelta
Returnstrue
if a different model object is at a position, otherwisefalse
. This type of delta is only returned if the computation method isIDeltaComputationOptions.ComputationMethod.BY_POSITION
.- Specified by:
isDifferentObjectAtPosition
in interfaceIModelObjectDelta
-
isAdded
public boolean isAdded()Description copied from interface:IModelObjectDelta
Returnstrue
if this model object has been added to its parent,false
otherwise.- Specified by:
isAdded
in interfaceIModelObjectDelta
-
isChanged
public boolean isChanged()Description copied from interface:IModelObjectDelta
Returnstrue
if this model object has been changed.- Specified by:
isChanged
in interfaceIModelObjectDelta
-
isChildChanged
public boolean isChildChanged()Description copied from interface:IModelObjectDelta
Returnstrue
if at least one model object's children has been changed.- Specified by:
isChildChanged
in interfaceIModelObjectDelta
-
isEmpty
public boolean isEmpty()Description copied from interface:IModelObjectDelta
Returnstrue
if the delta is empty, the two objects are the same, otherwisefalse
.- Specified by:
isEmpty
in interfaceIModelObjectDelta
-
isRemoved
public boolean isRemoved()Description copied from interface:IModelObjectDelta
Returnstrue
if this model object has been removed from its parent,false
otherwise.- Specified by:
isRemoved
in interfaceIModelObjectDelta
-
isStructureChanged
public boolean isStructureChanged()Description copied from interface:IModelObjectDelta
Returnstrue
if this model object's structure has changed. That means either a child has been added or removed or a child has been been moved.- Specified by:
isStructureChanged
in interfaceIModelObjectDelta
-
getChildDeltas
Description copied from interface:IModelObjectDelta
Returns deltas for all children of the model object which were added, removed, or changed. Returns an empty array if there are no affected children.- Specified by:
getChildDeltas
in interfaceIModelObjectDelta
-
getChildDeltas
Description copied from interface:IModelObjectDelta
Returns deltas for all children of this model object whose kind is included in the given mask. Kind masks are formed by the bitwise or ofIModelObjectDelta
kind constants. Returns an empty array if there are no affected children.- Specified by:
getChildDeltas
in interfaceIModelObjectDelta
-
accept
Description copied from interface:IModelObjectDelta
Accepts the given visitor.The visitor's
visit
method is called. If the visitor returnstrue
, the delta's children are also visited.- Specified by:
accept
in interfaceIModelObjectDelta
- Parameters:
visitor
- the visitor- See Also:
-
toString
-
toString
-