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

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

public class DeltaSetTriple<T>
extends Object
implements Dumpable, DebugDumpable, Serializable, SimpleVisitable<T>

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  Collection<T> minusSet
          Collection of values that were deleted.
protected  Collection<T> plusSet
          Collection of values that were added.
protected  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(Collection<T> zeroSet, Collection<T> plusSet, Collection<T> minusSet)
           
 
Method Summary
 void accept(SimpleVisitor<T> visitor)
           
 void addAllToMinusSet(Collection<T> items)
           
 void addAllToPlusSet(Collection<T> items)
           
 void addAllToZeroSet(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  Collection<T> createSet()
           
 String debugDump()
          Show the content of the object intended for diagnostics by system administrator.
 String debugDump(int indent)
           
protected  String debugName()
           
static
<T> DeltaSetTriple<T>
diff(Collection<T> valuesOld, Collection<T> valuesNew)
          Compares two (unordered) collections and creates a triple describing the differences.
protected static
<T> void
diff(Collection<T> valuesOld, Collection<T> valuesNew, DeltaSetTriple<T> triple)
           
 String dump()
          Show the content of the object intended for diagnostics by developer.
 Collection<T> getAllValues()
           
 Collection<T> getMinusSet()
           
 Collection<T> getNonNegativeValues()
           
 Collection<T> getNonPositiveValues()
           
 Collection<T> getPlusSet()
           
 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)
           
 int size()
           
 String toString()
           
 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 Collection<T> zeroSet
Collection of values that were not changed.


plusSet

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


minusSet

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

Constructor Detail

DeltaSetTriple

public DeltaSetTriple()

DeltaSetTriple

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

diff

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


diff

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

createSet

protected Collection<T> createSet()

getZeroSet

public Collection<T> getZeroSet()

getPlusSet

public Collection<T> getPlusSet()

getMinusSet

public 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(Collection<T> items)

addAllToMinusSet

public void addAllToMinusSet(Collection<T> items)

addAllToZeroSet

public void addAllToZeroSet(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()

size

public int size()

union

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


getAllValues

public Collection<T> getAllValues()

getNonNegativeValues

public Collection<T> getNonNegativeValues()

getNonPositiveValues

public 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()

accept

public void accept(SimpleVisitor<T> visitor)
Specified by:
accept in interface SimpleVisitable<T>

toString

public String toString()
Overrides:
toString in class Object

dump

public 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 String debugName()

debugDump

public 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 String debugDump(int indent)
Specified by:
debugDump in interface DebugDumpable


Copyright © 2013 evolveum. All Rights Reserved.