public class TupleMask
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
int[] |
indices
indices[i] specifies the index of the substitution in the original tuple that occupies the i-th place in the
masked signature.
|
int[] |
indicesSorted
indicesSorted is indices, sorted in ascending order.
|
int |
sourceWidth
the size of the tuple this mask is applied to
|
Constructor and Description |
---|
TupleMask(boolean[] keep)
Creates a TupleMask instance that discards positions where keep is true
|
TupleMask(int[] indices,
int sourceWidth)
Creates a TupleMask instance with the given indices array
|
Modifier and Type | Method and Description |
---|---|
static TupleMask |
append(TupleMask left,
TupleMask right)
Creates a TupleMask instance that selects whatever is selected by left, and appends whatever is selected by
right.
|
Tuple |
combine(Tuple unmasked,
Tuple masked,
boolean useInheritance,
boolean asComplementer)
Combines two substitutions.
|
static TupleMask |
displace(int from,
int to,
int sourceWidth)
Creates a TupleMask instance that moves an element from one index to other, shifting the others if neccessary.
|
static TupleMask |
empty(int sourceWidth)
Creates a TupleMask instance of the given size that does not emit output.
|
boolean |
equals(java.lang.Object obj) |
int |
hashCode() |
static TupleMask |
identity(int size)
Creates a TupleMask instance of the given size that maps every single element intact
|
static TupleMask |
linear(int size,
int sourceWidth)
Creates a TupleMask instance of the given size that maps the first 'size' elements intact
|
static TupleMask |
omit(int omission,
int sourceWidth)
Creates a TupleMask instance that maps the tuple intact save for a single element at the specified index which is
omitted
|
static TupleMask |
selectSingle(int selected,
int sourceWidth)
Creates a TupleMask instance that selects a single element of the tuple.
|
void |
sort()
Generates indicesSorted from indices
|
java.lang.String |
toString() |
<T> java.util.List<T> |
transform(java.util.List<T> original)
Generates a masked view of the original tuple.
|
Tuple |
transform(Tuple original)
Generates a masked view of the original tuple.
|
TupleMask |
transform(TupleMask mask)
Transforms a given mask directly, instead of transforming tuples that were transformed by the other mask.
|
public final int[] indices
public int[] indicesSorted
public int sourceWidth
public TupleMask(int[] indices, int sourceWidth)
public TupleMask(boolean[] keep)
public static TupleMask linear(int size, int sourceWidth)
public static TupleMask identity(int size)
public static TupleMask empty(int sourceWidth)
public static TupleMask omit(int omission, int sourceWidth)
public static TupleMask displace(int from, int to, int sourceWidth)
public static TupleMask selectSingle(int selected, int sourceWidth)
public static TupleMask append(TupleMask left, TupleMask right)
public void sort()
public <T> java.util.List<T> transform(java.util.List<T> original)
public TupleMask transform(TupleMask mask)
public Tuple combine(Tuple unmasked, Tuple masked, boolean useInheritance, boolean asComplementer)
unmasked
- primary pattern substitution that is left intact.masked
- secondary pattern substitution that is transformed to the end of the result.useInheritance
- whether to use inheritance or copy umasked into result instead.asComplementer
- whether this mask maps from the masked Tuple to the tail of the result or to the unmasked one.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object