S - The type of shape. Note that this may be just Shape
in the event that the shape changed classes.public final class ChangedShape<S extends Shape> extends java.lang.Object implements FromSourceLocation
| Constructor and Description |
|---|
ChangedShape(S oldShape,
S newShape) |
| Modifier and Type | Method and Description |
|---|---|
java.util.stream.Stream<Trait> |
addedTraits()
Gets a stream of added traits.
|
java.util.stream.Stream<Pair<Trait,Trait>> |
changedTraits()
Gets a stream of changed traits.
|
boolean |
equals(java.lang.Object o) |
<T extends Trait> |
getChangedTrait(java.lang.Class<T> traitType)
Gets a changed trait of a specific type.
|
S |
getNewShape()
Gets the new shape value.
|
S |
getOldShape()
Gets the old shape value.
|
ShapeId |
getShapeId()
Gets the shape ID of the changed shape.
|
SourceLocation |
getSourceLocation()
Gets the source location of a value.
|
java.util.Map<ShapeId,Pair<Trait,Trait>> |
getTraitDifferences()
Gets the trait differences between the old and new shape.
|
int |
hashCode() |
java.util.stream.Stream<Trait> |
removedTraits()
Gets a stream of removed traits.
|
public S getOldShape()
public S getNewShape()
public SourceLocation getSourceLocation()
FromSourceLocationgetSourceLocation in interface FromSourceLocationpublic ShapeId getShapeId()
public java.util.stream.Stream<Trait> addedTraits()
public java.util.stream.Stream<Trait> removedTraits()
public java.util.stream.Stream<Pair<Trait,Trait>> changedTraits()
public <T extends Trait> java.util.Optional<Pair<T,T>> getChangedTrait(java.lang.Class<T> traitType)
T - Type of trait to find.traitType - Type of trait to find.public java.util.Map<ShapeId,Pair<Trait,Trait>> getTraitDifferences()
The returned map is a mapping of a trait name to a pair in which the left side of the pair contains the nullable old trait value, and the right side of the pair contains the nullable new trait value. The left side will be null if the trait was added, the right side will be null if the trait was removed, and both traits will be present if the trait changed.
public boolean equals(java.lang.Object o)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object