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(Collection<T> zeroSet, Collection<T> plusSet, Collection<T> minusSet)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAllToMinusSet(Collection<T> items)
void
addAllToPlusSet(Collection<T> items)
void
addAllToSet(PlusMinusZero destination, Collection<T> items)
void
addAllToZeroSet(Collection<T> items)
void
addToMinusSet(T item)
void
addToPlusSet(T item)
void
addToSet(PlusMinusZero destination, T item)
void
addToZeroSet(T item)
void
clearMinusSet()
void
clearPlusSet()
void
clearZeroSet()
DeltaSetTriple<T>
clone(Cloner<T> cloner)
protected void
copyValues(DeltaSetTripleImpl<T> clone, Cloner<T> cloner)
String
debugDump()
Show the content of the object intended for diagnostics by system administrator.String
debugDump(int indent)
void
debugDumpSets(StringBuilder sb, Consumer<T> dumper, 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.void
foreach(Processor<T> processor)
Process each element of every set.Collection<T>
getAllValues()
T
getAnyValue()
Collection<T>
getMinusSet()
Collection<T>
getNonNegativeValues()
Collection<T>
getNonPositiveValues()
Collection<T>
getPlusSet()
Collection<T>
getSet(PlusMinusZero whichSet)
Collection<T>
getZeroSet()
boolean
hasMinusSet()
boolean
hasPlusSet()
boolean
hasZeroSet()
boolean
isEmpty()
boolean
isZeroOnly()
void
merge(DeltaSetTriple<T> triple)
boolean
presentInMinusSet(T item)
boolean
presentInPlusSet(T item)
protected boolean
presentInSet(Collection<T> set, T item)
boolean
presentInZeroSet(T item)
void
shortDump(StringBuilder sb)
Show the content of the object intended for diagnostics.void
simpleAccept(SimpleVisitor<T> visitor)
int
size()
Stream<T>
stream()
String
toHumanReadableString()
protected void
toHumanReadableString(StringBuilder sb, T item)
String
toString()
<X> void
transform(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
debugDumpLazily, debugDumpLazily
-
Methods inherited from interface com.evolveum.midpoint.util.ShortDumpable
shortDump, shortDumpLazily
-
-
-
-
Constructor Detail
-
DeltaSetTripleImpl
public DeltaSetTripleImpl()
-
DeltaSetTripleImpl
public DeltaSetTripleImpl(@NotNull Collection<T> zeroSet, @NotNull Collection<T> plusSet, @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 Collection<T> getZeroSet()
- Specified by:
getZeroSet
in interfaceDeltaSetTriple<T>
-
getPlusSet
@NotNull public Collection<T> getPlusSet()
- Specified by:
getPlusSet
in interfaceDeltaSetTriple<T>
-
getMinusSet
@NotNull public Collection<T> getMinusSet()
- Specified by:
getMinusSet
in interfaceDeltaSetTriple<T>
-
hasPlusSet
public boolean hasPlusSet()
- Specified by:
hasPlusSet
in interfaceDeltaSetTriple<T>
-
hasZeroSet
public boolean hasZeroSet()
- Specified by:
hasZeroSet
in interfaceDeltaSetTriple<T>
-
hasMinusSet
public boolean hasMinusSet()
- Specified by:
hasMinusSet
in interfaceDeltaSetTriple<T>
-
isZeroOnly
public boolean isZeroOnly()
- Specified by:
isZeroOnly
in interfaceDeltaSetTriple<T>
-
addToPlusSet
public void addToPlusSet(T item)
- Specified by:
addToPlusSet
in interfaceDeltaSetTriple<T>
-
addToMinusSet
public void addToMinusSet(T item)
- Specified by:
addToMinusSet
in interfaceDeltaSetTriple<T>
-
addToZeroSet
public void addToZeroSet(T item)
- Specified by:
addToZeroSet
in interfaceDeltaSetTriple<T>
-
addAllToPlusSet
public void addAllToPlusSet(Collection<T> items)
- Specified by:
addAllToPlusSet
in interfaceDeltaSetTriple<T>
-
addAllToMinusSet
public void addAllToMinusSet(Collection<T> items)
- Specified by:
addAllToMinusSet
in interfaceDeltaSetTriple<T>
-
addAllToZeroSet
public void addAllToZeroSet(Collection<T> items)
- Specified by:
addAllToZeroSet
in interfaceDeltaSetTriple<T>
-
getSet
public Collection<T> getSet(PlusMinusZero whichSet)
- Specified by:
getSet
in interfaceDeltaSetTriple<T>
-
addAllToSet
public void addAllToSet(PlusMinusZero destination, Collection<T> items)
- Specified by:
addAllToSet
in interfaceDeltaSetTriple<T>
-
addToSet
public void addToSet(PlusMinusZero destination, T item)
- Specified by:
addToSet
in interfaceDeltaSetTriple<T>
-
presentInPlusSet
public boolean presentInPlusSet(T item)
- Specified by:
presentInPlusSet
in interfaceDeltaSetTriple<T>
-
presentInMinusSet
public boolean presentInMinusSet(T item)
- Specified by:
presentInMinusSet
in interfaceDeltaSetTriple<T>
-
presentInZeroSet
public boolean presentInZeroSet(T item)
- Specified by:
presentInZeroSet
in interfaceDeltaSetTriple<T>
-
presentInSet
protected boolean presentInSet(Collection<T> set, T item)
-
clearPlusSet
public void clearPlusSet()
- Specified by:
clearPlusSet
in interfaceDeltaSetTriple<T>
-
clearMinusSet
public void clearMinusSet()
- Specified by:
clearMinusSet
in interfaceDeltaSetTriple<T>
-
clearZeroSet
public void clearZeroSet()
- Specified by:
clearZeroSet
in interfaceDeltaSetTriple<T>
-
size
public int size()
- Specified by:
size
in interfaceDeltaSetTriple<T>
-
union
public Collection<T> union()
Returns all values, regardless of the internal sets.- Specified by:
union
in interfaceDeltaSetTriple<T>
-
getAnyValue
public T getAnyValue()
- Specified by:
getAnyValue
in interfaceDeltaSetTriple<T>
-
getAllValues
public Collection<T> getAllValues()
- Specified by:
getAllValues
in interfaceDeltaSetTriple<T>
-
stream
public Stream<T> stream()
- Specified by:
stream
in interfaceDeltaSetTriple<T>
-
getNonNegativeValues
@NotNull public Collection<T> getNonNegativeValues()
- Specified by:
getNonNegativeValues
in interfaceDeltaSetTriple<T>
-
getNonPositiveValues
@NotNull public Collection<T> getNonPositiveValues()
- Specified by:
getNonPositiveValues
in interfaceDeltaSetTriple<T>
-
merge
public void merge(DeltaSetTriple<T> triple)
- Specified by:
merge
in interfaceDeltaSetTriple<T>
-
clone
public DeltaSetTriple<T> clone(Cloner<T> cloner)
- Specified by:
clone
in interfaceDeltaSetTriple<T>
-
copyValues
protected void copyValues(DeltaSetTripleImpl<T> clone, Cloner<T> cloner)
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in 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:
foreach
in interfaceDeltaSetTriple<T>
- Specified by:
foreach
in interfaceForeachable<T>
-
simpleAccept
public void simpleAccept(SimpleVisitor<T> visitor)
- Specified by:
simpleAccept
in interfaceDeltaSetTriple<T>
- Specified by:
simpleAccept
in interfaceSimpleVisitable<T>
-
transform
public <X> void transform(DeltaSetTriple<X> transformTarget, Transformer<T,X> transformer)
- Specified by:
transform
in interfaceDeltaSetTriple<T>
-
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 interfaceDebugDumpable
- Returns:
- content of the object intended for diagnostics by system administrator.
-
debugDump
public String debugDump(int indent)
- Specified by:
debugDump
in interfaceDebugDumpable
-
debugDumpSets
public void debugDumpSets(StringBuilder sb, Consumer<T> dumper, int indent)
- Specified by:
debugDumpSets
in interfaceDeltaSetTriple<T>
-
shortDump
public void shortDump(StringBuilder sb)
Description copied from interface:ShortDumpable
Show 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:
shortDump
in 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:
toHumanReadableString
in interfaceDeltaSetTriple<T>
-
toHumanReadableString
protected void toHumanReadableString(StringBuilder sb, T item)
-
-