Class DeltaSetTripleImpl<T>
- java.lang.Object
-
- com.evolveum.midpoint.prism.impl.delta.DeltaSetTripleImpl<T>
-
- All Implemented Interfaces:
DeltaSetTriple<T>,SimpleVisitable<T>,DebugDumpable,Foreachable<T>,ShortDumpable,Serializable
- Direct Known Subclasses:
PrismValueDeltaSetTripleImpl
public class DeltaSetTripleImpl<T> extends Object implements DeltaSetTriple<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
-
Fields inherited from interface com.evolveum.midpoint.util.DebugDumpable
INDENT_STRING
-
-
Constructor Summary
Constructors Constructor Description DeltaSetTripleImpl()DeltaSetTripleImpl(@NotNull Collection<T> zeroSet, @NotNull Collection<T> plusSet, @NotNull Collection<T> minusSet)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddAllToMinusSet(Collection<T> items)voidaddAllToPlusSet(Collection<T> items)voidaddAllToSet(PlusMinusZero destination, Collection<T> items)voidaddAllToZeroSet(Collection<T> items)voidaddToMinusSet(T item)voidaddToPlusSet(T item)voidaddToSet(PlusMinusZero destination, T item)voidaddToZeroSet(T item)voidclearMinusSet()voidclearPlusSet()voidclearZeroSet()DeltaSetTriple<T>clone(Cloner<T> cloner)protected voidcopyValues(DeltaSetTripleImpl<T> clone, Cloner<T> cloner)StringdebugDump(int indent)voiddebugDumpSets(StringBuilder sb, Consumer<T> dumper, int indent)protected StringdebugName()static <T> DeltaSetTriple<T>diff(Collection<T> valuesOld, Collection<T> valuesNew)Compares two (unordered) collections and creates a triple describing the differences.voidforeach(Processor<T> processor)Process each element of every set.Collection<T>getAllValues()TgetAnyValue()@NotNull Collection<T>getMinusSet()@NotNull Collection<T>getNonNegativeValues()@NotNull Collection<T>getNonPositiveValues()@NotNull Collection<T>getPlusSet()Collection<T>getSet(PlusMinusZero whichSet)@NotNull Collection<T>getZeroSet()booleanhasMinusSet()booleanhasPlusSet()booleanhasZeroSet()booleanisEmpty()booleanisZeroOnly()voidmerge(DeltaSetTriple<T> triple)booleanpresentInMinusSet(T item)booleanpresentInPlusSet(T item)protected booleanpresentInSet(Collection<T> set, T item)booleanpresentInZeroSet(T item)voidshortDump(StringBuilder sb)Show the content of the object intended for diagnostics.voidsimpleAccept(SimpleVisitor<T> visitor)intsize()Stream<T>stream()StringtoHumanReadableString()protected voidtoHumanReadableString(StringBuilder sb, T item)StringtoString()<X> voidtransform(DeltaSetTriple<X> transformTarget, Transformer<T,X> transformer)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
-
Methods inherited from interface com.evolveum.midpoint.util.DebugDumpable
debugDump, debugDumpLazily, debugDumpLazily
-
Methods inherited from interface com.evolveum.midpoint.prism.delta.DeltaSetTriple
clear
-
Methods inherited from interface com.evolveum.midpoint.util.ShortDumpable
shortDump, shortDumpLazily
-
-
-
-
Constructor Detail
-
DeltaSetTripleImpl
public DeltaSetTripleImpl()
-
DeltaSetTripleImpl
public DeltaSetTripleImpl(@NotNull @NotNull Collection<T> zeroSet, @NotNull @NotNull Collection<T> plusSet, @NotNull @NotNull 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.
-
getZeroSet
@NotNull public @NotNull Collection<T> getZeroSet()
- Specified by:
getZeroSetin interfaceDeltaSetTriple<T>
-
getPlusSet
@NotNull public @NotNull Collection<T> getPlusSet()
- Specified by:
getPlusSetin interfaceDeltaSetTriple<T>
-
getMinusSet
@NotNull public @NotNull Collection<T> getMinusSet()
- Specified by:
getMinusSetin interfaceDeltaSetTriple<T>
-
hasPlusSet
public boolean hasPlusSet()
- Specified by:
hasPlusSetin interfaceDeltaSetTriple<T>
-
hasZeroSet
public boolean hasZeroSet()
- Specified by:
hasZeroSetin interfaceDeltaSetTriple<T>
-
hasMinusSet
public boolean hasMinusSet()
- Specified by:
hasMinusSetin interfaceDeltaSetTriple<T>
-
isZeroOnly
public boolean isZeroOnly()
- Specified by:
isZeroOnlyin interfaceDeltaSetTriple<T>
-
addToPlusSet
public void addToPlusSet(T item)
- Specified by:
addToPlusSetin interfaceDeltaSetTriple<T>
-
addToMinusSet
public void addToMinusSet(T item)
- Specified by:
addToMinusSetin interfaceDeltaSetTriple<T>
-
addToZeroSet
public void addToZeroSet(T item)
- Specified by:
addToZeroSetin interfaceDeltaSetTriple<T>
-
addAllToPlusSet
public void addAllToPlusSet(Collection<T> items)
- Specified by:
addAllToPlusSetin interfaceDeltaSetTriple<T>
-
addAllToMinusSet
public void addAllToMinusSet(Collection<T> items)
- Specified by:
addAllToMinusSetin interfaceDeltaSetTriple<T>
-
addAllToZeroSet
public void addAllToZeroSet(Collection<T> items)
- Specified by:
addAllToZeroSetin interfaceDeltaSetTriple<T>
-
getSet
public Collection<T> getSet(PlusMinusZero whichSet)
- Specified by:
getSetin interfaceDeltaSetTriple<T>
-
addAllToSet
public void addAllToSet(PlusMinusZero destination, Collection<T> items)
- Specified by:
addAllToSetin interfaceDeltaSetTriple<T>
-
addToSet
public void addToSet(PlusMinusZero destination, T item)
- Specified by:
addToSetin interfaceDeltaSetTriple<T>
-
presentInPlusSet
public boolean presentInPlusSet(T item)
- Specified by:
presentInPlusSetin interfaceDeltaSetTriple<T>
-
presentInMinusSet
public boolean presentInMinusSet(T item)
- Specified by:
presentInMinusSetin interfaceDeltaSetTriple<T>
-
presentInZeroSet
public boolean presentInZeroSet(T item)
- Specified by:
presentInZeroSetin interfaceDeltaSetTriple<T>
-
presentInSet
protected boolean presentInSet(Collection<T> set, T item)
-
clearPlusSet
public void clearPlusSet()
- Specified by:
clearPlusSetin interfaceDeltaSetTriple<T>
-
clearMinusSet
public void clearMinusSet()
- Specified by:
clearMinusSetin interfaceDeltaSetTriple<T>
-
clearZeroSet
public void clearZeroSet()
- Specified by:
clearZeroSetin interfaceDeltaSetTriple<T>
-
size
public int size()
- Specified by:
sizein interfaceDeltaSetTriple<T>
-
union
public Collection<T> union()
Returns all values, regardless of the internal sets.- Specified by:
unionin interfaceDeltaSetTriple<T>
-
getAnyValue
public T getAnyValue()
- Specified by:
getAnyValuein interfaceDeltaSetTriple<T>
-
getAllValues
public Collection<T> getAllValues()
- Specified by:
getAllValuesin interfaceDeltaSetTriple<T>
-
stream
public Stream<T> stream()
- Specified by:
streamin interfaceDeltaSetTriple<T>
-
getNonNegativeValues
@NotNull public @NotNull Collection<T> getNonNegativeValues()
- Specified by:
getNonNegativeValuesin interfaceDeltaSetTriple<T>
-
getNonPositiveValues
@NotNull public @NotNull Collection<T> getNonPositiveValues()
- Specified by:
getNonPositiveValuesin interfaceDeltaSetTriple<T>
-
merge
public void merge(DeltaSetTriple<T> triple)
- Specified by:
mergein interfaceDeltaSetTriple<T>
-
clone
public DeltaSetTriple<T> clone(Cloner<T> cloner)
- Specified by:
clonein interfaceDeltaSetTriple<T>
-
copyValues
protected void copyValues(DeltaSetTripleImpl<T> clone, Cloner<T> cloner)
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceDeltaSetTriple<T>
-
foreach
public void foreach(Processor<T> processor)
Process each element of every set. This is different from the visitor. Visitor will go deep inside, foreach will remain on the surface.- Specified by:
foreachin interfaceDeltaSetTriple<T>- Specified by:
foreachin interfaceForeachable<T>
-
simpleAccept
public void simpleAccept(SimpleVisitor<T> visitor)
- Specified by:
simpleAcceptin interfaceDeltaSetTriple<T>- Specified by:
simpleAcceptin interfaceSimpleVisitable<T>
-
transform
public <X> void transform(DeltaSetTriple<X> transformTarget, Transformer<T,X> transformer)
- Specified by:
transformin interfaceDeltaSetTriple<T>
-
debugName
protected String debugName()
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDumpin interfaceDebugDumpable
-
debugDumpSets
public void debugDumpSets(StringBuilder sb, Consumer<T> dumper, int indent)
- Specified by:
debugDumpSetsin interfaceDeltaSetTriple<T>
-
shortDump
public void shortDump(StringBuilder sb)
Description copied from interface:ShortDumpableShow the content of the object intended for diagnostics. This method is supposed to append a compact, human-readable output in a single line. Unlike toString() method, there is no requirement to identify the actual class or type of the object. It is assumed that the class/type will be obvious from the context in which the output is used.- Specified by:
shortDumpin interfaceShortDumpable- Parameters:
sb- StringBuilder to which to a compact one-line content of the object intended for diagnostics by system administrator should be appended.
-
toHumanReadableString
public String toHumanReadableString()
- Specified by:
toHumanReadableStringin interfaceDeltaSetTriple<T>
-
toHumanReadableString
protected void toHumanReadableString(StringBuilder sb, T item)
-
-