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 TypeMethodDescriptionvoidaccept(IModelObjectDeltaVisitor visitor) Accepts the given visitor.voidaddChildDelta(IModelObjectDelta childDelta) Adds the child delta to this delta and sets this delta's kindOfChange accordingly.voidcheckPropertyChange(String property, boolean value1, boolean value2, IDeltaComputationOptions options) voidcheckPropertyChange(String property, char value1, char value2, IDeltaComputationOptions options) voidcheckPropertyChange(String property, double value1, double value2, IDeltaComputationOptions options) voidcheckPropertyChange(String property, float value1, float value2, IDeltaComputationOptions options) voidcheckPropertyChange(String property, int value1, int value2, IDeltaComputationOptions options) voidcheckPropertyChange(String property, Object value1, Object value2, IDeltaComputationOptions options) static final voidcreateAssociatedChildDeltas(ModelObjectDelta delta, List<? extends IModelObject> originals, List<? extends IModelObject> refObjects, String association, IDeltaComputationOptions options) static final voidcreateAssociatedChildDeltas(ModelObjectDelta delta, IModelObject original, IModelObject refObject, String association, IDeltaComputationOptions options) static final voidcreateChildDeltas(ModelObjectDelta delta, List<? extends IModelObject> originals, List<? extends IModelObject> refObjects, String association, IDeltaComputationOptions options) static final voidcreateChildDeltas(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.intgetKind()Returns the kind of change.intIf 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.booleanisAdded()Returnstrueif this model object has been added to its parent,falseotherwise.booleanReturnstrueif this model object has been changed.booleanReturnstrueif at least one model object's children has been changed.booleanReturnstrueif the model object's Java class has "changed".booleanReturnstrueif a different model object is at a position, otherwisefalse.booleanisEmpty()Returnstrueif the delta is empty, the two objects are the same, otherwisefalse.booleanisMoved()Returnstrueif this model object has changed its position in the ordered association.booleanReturnstrueif at least one the model object's properties has changed, otherwisefalse.booleanisPropertyChanged(String propertyName) Returnstrueif the model object contains a different value for the given property than the reference model object.booleanReturnstrueif this model object has been removed from its parent,falseotherwise.booleanReturnstrueif this model object's structure has changed.voidMarks the delta as one where the object has changed its position.voidmarkPropertyChanged(String property) Marks the given property as having a different value in the model object and the reference model object.static final ModelObjectDeltanewAddDelta(IModelObject addedObject, String association, IDeltaComputationOptions options) Deprecated.since 19.12.static final ModelObjectDeltanewAddDelta(IModelObject addedObject, String association, AssociationKind associationKind, IDeltaComputationOptions options) static final ModelObjectDeltanewChangeDelta(IModelObject original, IModelObject refObject, int kindOfChange) static final ModelObjectDeltanewDelta(IModelObject object, IModelObject refObject, IDeltaComputationOptions options) static final ModelObjectDeltanewDifferentObjectAtPositionChangedDelta(IModelObject original, IModelObject refObject, String association) Deprecated.since 19.12.static final ModelObjectDeltanewDifferentObjectAtPositionChangedDelta(IModelObject original, IModelObject refObject, String association, AssociationKind associationKind) static final ModelObjectDeltanewEmptyDelta(IModelObject object, IModelObject refObject) static final ModelObjectDeltanewRemoveDelta(IModelObject removedObject, String association, IDeltaComputationOptions options) Deprecated.since 19.12.static final ModelObjectDeltanewRemoveDelta(IModelObject removedObject, String association, AssociationKind associationKind, IDeltaComputationOptions options) voidsetAssociation(String association) voidsetAssociationKind(AssociationKind associationKind) toString()voidtoString(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
nullor empty!!! -
getOriginalObject
Description copied from interface:IModelObjectDeltaThe 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:
getOriginalObjectin interfaceIModelObjectDelta
-
getReferenceObject
Description copied from interface:IModelObjectDeltaThe 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:
getReferenceObjectin interfaceIModelObjectDelta
-
getKind
public int getKind()Description copied from interface:IModelObjectDeltaReturns 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:IModelObjectDeltaIf 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:
getKindOfChangein interfaceIModelObjectDelta- See Also:
-
getAssociation
Description copied from interface:IModelObjectDeltaThe name of the association in which the object has been added, removed or changed. The association name is alwaysnullfor the root of the delta.- Specified by:
getAssociationin interfaceIModelObjectDelta
-
setAssociation
-
getAssociationKind
Description copied from interface:IModelObjectDeltaReturns 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:
getAssociationKindin interfaceIModelObjectDelta- Returns:
- the
AssociationKindornullif 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:IModelObjectDeltaReturnstrueif the model object's Java class has "changed". (Technically its of course just an instance of another class). Returnsfalseotherwise.- Specified by:
isClassChangedin interfaceIModelObjectDelta
-
isPropertyChanged
public boolean isPropertyChanged()Description copied from interface:IModelObjectDeltaReturnstrueif at least one the model object's properties has changed, otherwisefalse.- Specified by:
isPropertyChangedin interfaceIModelObjectDelta
-
getChangedProperties
Description copied from interface:IModelObjectDeltaReturns 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:
getChangedPropertiesin interfaceIModelObjectDelta
-
isPropertyChanged
Description copied from interface:IModelObjectDeltaReturnstrueif the model object contains a different value for the given property than the reference model object. Returnsfalseotherwise. Returnsfalseif propertyName isnull.- Specified by:
isPropertyChangedin 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:IModelObjectDeltaReturnstrueif 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:
isMovedin interfaceIModelObjectDelta
-
isDifferentObjectAtPosition
public boolean isDifferentObjectAtPosition()Description copied from interface:IModelObjectDeltaReturnstrueif 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:
isDifferentObjectAtPositionin interfaceIModelObjectDelta
-
isAdded
public boolean isAdded()Description copied from interface:IModelObjectDeltaReturnstrueif this model object has been added to its parent,falseotherwise.- Specified by:
isAddedin interfaceIModelObjectDelta
-
isChanged
public boolean isChanged()Description copied from interface:IModelObjectDeltaReturnstrueif this model object has been changed.- Specified by:
isChangedin interfaceIModelObjectDelta
-
isChildChanged
public boolean isChildChanged()Description copied from interface:IModelObjectDeltaReturnstrueif at least one model object's children has been changed.- Specified by:
isChildChangedin interfaceIModelObjectDelta
-
isEmpty
public boolean isEmpty()Description copied from interface:IModelObjectDeltaReturnstrueif the delta is empty, the two objects are the same, otherwisefalse.- Specified by:
isEmptyin interfaceIModelObjectDelta
-
isRemoved
public boolean isRemoved()Description copied from interface:IModelObjectDeltaReturnstrueif this model object has been removed from its parent,falseotherwise.- Specified by:
isRemovedin interfaceIModelObjectDelta
-
isStructureChanged
public boolean isStructureChanged()Description copied from interface:IModelObjectDeltaReturnstrueif 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:
isStructureChangedin interfaceIModelObjectDelta
-
getChildDeltas
Description copied from interface:IModelObjectDeltaReturns 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:
getChildDeltasin interfaceIModelObjectDelta
-
getChildDeltas
Description copied from interface:IModelObjectDeltaReturns deltas for all children of this model object whose kind is included in the given mask. Kind masks are formed by the bitwise or ofIModelObjectDeltakind constants. Returns an empty array if there are no affected children.- Specified by:
getChildDeltasin interfaceIModelObjectDelta
-
accept
Description copied from interface:IModelObjectDeltaAccepts the given visitor.The visitor's
visitmethod is called. If the visitor returnstrue, the delta's children are also visited.- Specified by:
acceptin interfaceIModelObjectDelta- Parameters:
visitor- the visitor- See Also:
-
toString
-
toString
-