public class Triple extends java.lang.Object implements Hex, java.io.Serializable
Yarns that all intesect each other.
Any one of these Yarns intersects the other two consecutively, with no other Yarn
intersections (Joins) between.
This corresponds to a trio of rhombs, all of which share a common point and any two
of which share a common edge. The union of three such rhombs is a hexagon, and that
hexagon can be flipped by reversing the order of all pairs of Yarn intersections.
We do not check for these properties on construction; we merely assume that they
are satisfied.| Modifier and Type | Field and Description |
|---|---|
Join[] |
j
The three Joins.
|
static long |
serialVersionUID
For serialization.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Rhomb jj)
Determine if this contains a given Rhomb.
|
boolean |
contains(Yarn yy)
Determine if this contains a given Yarn.
|
boolean |
contains(Yarn yy,
Yarn z)
Determine if this contains a given pair of Yarns (order doesn't matter).
|
SimpleHex |
createSimpleHex(java.util.List<Rhomb> allJoins,
java.util.List<Rhomb> newJoins)
Pass in a list of Joins that contains the three Joins in this Triple.
|
static Triple |
createTriple(Yarn[] yy)
Public static factory method.
|
static Triple |
createTriple(Yarn y0,
Yarn y1,
Yarn y2)
Public static factory method.
|
boolean |
doubleOverlap(Triple t)
Determine if this contains two Yarns in common with another Triple.
|
boolean |
equals(java.lang.Object obj)
Two Triples are equal if they contain the same three Yarns.
|
java.util.List<Hex> |
flip()
Flip the Yarns in this Triple.
|
SimplePolygon2D |
getHex()
Getter method.
|
Rhomb[] |
getJoins()
Getter method.
|
Yarn[] |
getYarns()
Getter method.
|
java.util.List<Triple> |
newTriples()
Suppose this Triple has just been flipped.
|
boolean |
valid()
Determine if this represents a hexagon--i.e., if the three Yarns still satisfy the adjacency conditions.
|
public static final long serialVersionUID
public Join[] j
public static Triple createTriple(Yarn y0, Yarn y1, Yarn y2)
y0 - The first Yarn.y1 - The second Yarn.y2 - The third Yarn.public static Triple createTriple(Yarn[] yy)
yy - The array of three Yarns from which we build a Triple.public Rhomb[] getJoins()
public Yarn[] getYarns()
public SimplePolygon2D getHex()
public boolean valid()
public boolean contains(Rhomb jj)
public boolean contains(Yarn yy)
yy - The Yarn we're looking for.public boolean contains(Yarn yy, Yarn z)
yy - The first Yarn we're looking for.z - The second Yarn we're looking for.public boolean doubleOverlap(Triple t)
t - The other Triple.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic SimpleHex createSimpleHex(java.util.List<Rhomb> allJoins, java.util.List<Rhomb> newJoins)
createSimpleHex in interface HexallJoins - A list of joins that contains the three Joins that constitute this hex.newJoins - A list of SimpleRhombs that correspond to the Joins in allJoins.public java.util.List<Triple> newTriples()
public java.util.List<Hex> flip()