com.evolveum.midpoint.prism.delta
Class DeltaSetTriple<T>

java.lang.Object
  extended by com.evolveum.midpoint.prism.delta.DeltaSetTriple<T>
All Implemented Interfaces:
DebugDumpable, Dumpable, java.io.Serializable
Direct Known Subclasses:
PrismValueDeltaSetTriple

public class DeltaSetTriple<T>
extends java.lang.Object
implements Dumpable, DebugDumpable, java.io.Serializable

The triple of values (added, unchanged, deleted) that represents difference between two collections of values.

The DeltaSetTriple is used as a result of a "diff" operation or it is constructed to determine a ObjectDelta or PropertyDelta. It is a very useful structure in numerous situations when dealing with relative changes.

DeltaSetTriple (similarly to other parts of this system) deal only with unordered values.

Author:
Radovan Semancik
See Also:
Serialized Form

Field Summary
protected  java.util.Collection<T> minusSet
          Collection of values that were deleted.
protected  java.util.Collection<T> plusSet
          Collection of values that were added.
protected  java.util.Collection<T> zeroSet
          Collection of values that were not changed.
 
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
 
Constructor Summary
DeltaSetTriple()
           
DeltaSetTriple(java.util.Collection<T> zeroSet, java.util.Collection<T> plusSet, java.util.Collection<T> minusSet)
           
 
Method Summary
 void addAllToMinusSet(java.util.Collection<T> items)
           
 void addAllToPlusSet(java.util.Collection<T> items)
           
 void addAllToZeroSet(java.util.Collection<T> items)
           
 void addToMinusSet(T item)
           
 void addToPlusSet(T item)
           
 void addToZeroSet(T item)
           
 void clearMinusSet()
           
 void clearPlusSet()
           
 void clearZeroSet()
           
 DeltaSetTriple<T> clone(Cloner<T> cloner)
           
protected  void copyValues(DeltaSetTriple<T> clone, Cloner<T> cloner)
           
protected  java.util.Collection<T> createSet()
           
 java.lang.String debugDump()
          Show the content of the object intended for diagnostics by system administrator.
 java.lang.String debugDump(int indent)
           
protected  java.lang.String debugName()
           
static
<T> DeltaSetTriple<T>
diff(java.util.Collection<T> valuesOld, java.util.Collection<T> valuesNew)
          Compares two (unordered) collections and creates a triple describing the differences.
protected static
<T> void
diff(java.util.Collection<T> valuesOld, java.util.Collection<T> valuesNew, DeltaSetTriple<T> triple)
           
 java.lang.String dump()
          Show the content of the object intended for diagnostics by developer.
 java.util.Collection<T> getMinusSet()
           
 java.util.Collection<T> getNonNegativeValues()
           
 java.util.Collection<T> getNonPositiveValues()
           
 java.util.Collection<T> getPlusSet()
           
 java.util.Collection<T> getZeroSet()
           
 boolean hasMinusSet()
           
 boolean hasPlusSet()
           
 boolean hasZeroSet()
           
 boolean isEmpty()
           
 void merge(DeltaSetTriple<T> triple)
           
 boolean presentInMinusSet(T item)
           
 boolean presentInPlusSet(T item)
           
 boolean presentInZeroSet(T item)
           
 java.lang.String toString()
           
 java.util.Collection<T> union()
          Returns all values, regardless of the internal sets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

zeroSet

protected java.util.Collection<T> zeroSet
Collection of values that were not changed.


plusSet

protected java.util.Collection<T> plusSet
Collection of values that were added.


minusSet

protected java.util.Collection<T> minusSet
Collection of values that were deleted.

Constructor Detail

DeltaSetTriple

public DeltaSetTriple()

DeltaSetTriple

public DeltaSetTriple(java.util.Collection<T> zeroSet,
                      java.util.Collection<T> plusSet,
                      java.util.Collection<T> minusSet)
Method Detail

diff

public static <T> DeltaSetTriple<T> diff(java.util.Collection<T> valuesOld,
                                         java.util.Collection<T> valuesNew)
Compares two (unordered) collections and creates a triple describing the differences.


diff

protected static <T> void diff(java.util.Collection<T> valuesOld,
                               java.util.Collection<T> valuesNew,
                               DeltaSetTriple<T> triple)

createSet

protected java.util.Collection<T> createSet()

getZeroSet

public java.util.Collection<T> getZeroSet()

getPlusSet

public java.util.Collection<T> getPlusSet()

getMinusSet

public java.util.Collection<T> getMinusSet()

hasPlusSet

public boolean hasPlusSet()

hasZeroSet

public boolean hasZeroSet()

hasMinusSet

public boolean hasMinusSet()

addToPlusSet

public void addToPlusSet(T item)

addToMinusSet

public void addToMinusSet(T item)

addToZeroSet

public void addToZeroSet(T item)

addAllToPlusSet

public void addAllToPlusSet(java.util.Collection<T> items)

addAllToMinusSet

public void addAllToMinusSet(java.util.Collection<T> items)

addAllToZeroSet

public void addAllToZeroSet(java.util.Collection<T> items)

presentInPlusSet

public boolean presentInPlusSet(T item)

presentInMinusSet

public boolean presentInMinusSet(T item)

presentInZeroSet

public boolean presentInZeroSet(T item)

clearPlusSet

public void clearPlusSet()

clearMinusSet

public void clearMinusSet()

clearZeroSet

public void clearZeroSet()

union

public java.util.Collection<T> union()
Returns all values, regardless of the internal sets.


getNonNegativeValues

public java.util.Collection<T> getNonNegativeValues()

getNonPositiveValues

public java.util.Collection<T> getNonPositiveValues()

merge

public void merge(DeltaSetTriple<T> triple)

clone

public DeltaSetTriple<T> clone(Cloner<T> cloner)

copyValues

protected void copyValues(DeltaSetTriple<T> clone,
                          Cloner<T> cloner)

isEmpty

public boolean isEmpty()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

dump

public java.lang.String dump()
Description copied from interface: Dumpable
Show the content of the object intended for diagnostics by developer. The content may be multi-line, in case of hierarchical objects it may be intended. The use of this method may not be efficient. It is not supposed to be used in normal operation. However, it is very useful in tests or in case of dumping objects in severe error situations.

Specified by:
dump in interface Dumpable
Returns:
content of the object intended for diagnostics.

debugName

protected java.lang.String debugName()

debugDump

public java.lang.String debugDump()
Description copied from interface: DebugDumpable
Show the content of the object intended for diagnostics by system administrator. The out put should be suitable to use in system logs at "debug" level. It may be multi-line, but in that case it should be well indented and quite terse. As it is intended to be used by system administrator, it should not use any developer terms such as class names, exceptions or stack traces.

Specified by:
debugDump in interface DebugDumpable
Returns:
content of the object intended for diagnostics by system administrator.

debugDump

public java.lang.String debugDump(int indent)
Specified by:
debugDump in interface DebugDumpable


Copyright © 2012 evolveum. All Rights Reserved.