|
|||||||||
| Home >> All >> cgsuite >> [ extras overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
cgsuite.extras
Class UnrootedTree

java.lang.Objectcgsuite.AbstractShortGame
cgsuite.extras.CherryTreePosition
cgsuite.extras.UnrootedTree
- All Implemented Interfaces:
- java.lang.Comparable, cgsuite.Game, java.io.Serializable
- class UnrootedTree
- extends CherryTreePosition
An unrooted cherrytree is still stored as a tree, but the root may be different to that designated in the constructor. The tree will be centred, which can move the root but will not change the topology.
| Field Summary | |
private RootedTree |
centre
|
private RootedTree |
secondCentre
|
| Fields inherited from class cgsuite.extras.CherryTreePosition |
BLACK, empty, GREEN, RED |
| Fields inherited from class cgsuite.AbstractShortGame |
|
| Fields inherited from interface cgsuite.Game |
SIMPLIFY_COOL, SIMPLIFY_FREEZE, SIMPLIFY_HEAT, SIMPLIFY_ORDINAL_SUM_G, SIMPLIFY_ORDINAL_SUM_H, SIMPLIFY_OVERHEAT, SIMPLIFY_PRODUCT_G, SIMPLIFY_PRODUCT_U, SIMPLIFY_SUM |
| Constructor Summary | |
private |
UnrootedTree()
Default constructor does not set anything. |
private |
UnrootedTree(RootedTree centre)
|
private |
UnrootedTree(RootedTree centre1,
RootedTree centre2)
|
| Method Summary | |
int |
compareTo(java.lang.Object o)
Compares this object with another, and returns a numerical result based on the comparison. |
boolean |
equals(java.lang.Object o)
Determine whether this Object is semantically equal to another Object. |
cgsuite.Game |
getInverse()
Gets the inverse of this game. |
(package private) java.util.TreeSet |
getOptions(boolean left)
|
(package private) static UnrootedTree |
getPosition(java.lang.String src)
|
(package private) static UnrootedTree |
makePosition(java.lang.String src)
|
private void |
setCentre(RootedTree centre)
|
private void |
setCentres(RootedTree centre1,
RootedTree centre2)
|
java.lang.String |
toString()
Convert this Object to a human-readable String. |
private static UnrootedTree |
unRootTree(RootedTree base)
|
| Methods inherited from class cgsuite.extras.CherryTreePosition |
charToColour, colourToChar, getLeftOptions, getRightOptions, getRootedInverse, getRootedTree, getUnrootedTree, hashCode, isEmpty, treeStringOnly |
| Methods inherited from class cgsuite.AbstractShortGame |
canonicalize, isShortGame, simplify, simplifyExpression |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
centre
private RootedTree centre
secondCentre
private RootedTree secondCentre
| Constructor Detail |
UnrootedTree
private UnrootedTree()
- Default constructor does not set anything. The result is an
empty tree.
UnrootedTree
private UnrootedTree(RootedTree centre)
UnrootedTree
private UnrootedTree(RootedTree centre1, RootedTree centre2)
| Method Detail |
setCentre
private void setCentre(RootedTree centre)
setCentres
private void setCentres(RootedTree centre1, RootedTree centre2)
getPosition
static UnrootedTree getPosition(java.lang.String src) throws cgsuite.plugin.MethodInvocationException
makePosition
static UnrootedTree makePosition(java.lang.String src) throws cgsuite.plugin.MethodInvocationException
unRootTree
private static UnrootedTree unRootTree(RootedTree base)
getOptions
java.util.TreeSet getOptions(boolean left)
- Specified by:
getOptionsin classCherryTreePosition
getInverse
public cgsuite.Game getInverse()
- Description copied from interface:
cgsuite.Game - Gets the inverse of this game.
- Specified by:
getInversein interfacecgsuite.Game- Specified by:
getInversein classCherryTreePosition
toString
public java.lang.String toString()
- Description copied from class:
java.lang.Object - Convert this Object to a human-readable String.
There are no limits placed on how long this String
should be or what it should contain. We suggest you
make it as intuitive as possible to be able to place
it into System.out.println() 55
and such.
It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.
This method will be called when performing string concatenation with this object. If the result is
null, string concatenation will instead use"null".The default implementation returns
getClass().getName() + "@" + Integer.toHexString(hashCode()).
compareTo
public int compareTo(java.lang.Object o)
- Description copied from interface:
java.lang.Comparable - Compares this object with another, and returns a numerical result based
on the comparison. If the result is negative, this object sorts less
than the other; if 0, the two are equal, and if positive, this object
sorts greater than the other. To translate this into boolean, simply
perform
o1.compareTo(o2) <op> 0, where op is one of <, <=, =, !=, >, or >=.You must make sure that the comparison is mutual, ie.
sgn(x.compareTo(y)) == -sgn(y.compareTo(x))(where sgn() is defined as -1, 0, or 1 based on the sign). This includes throwing an exception in either direction if the two are not comparable; hence,compareTo(null)should always throw an Exception.You should also ensure transitivity, in two forms:
x.compareTo(y) > 0 && y.compareTo(z) > 0impliesx.compareTo(z) > 0; andx.compareTo(y) == 0impliesx.compareTo(z) == y.compareTo(z).
equals
public boolean equals(java.lang.Object o)
- Description copied from class:
java.lang.Object - Determine whether this Object is semantically equal
to another Object.
There are some fairly strict requirements on this method which subclasses must follow:
- It must be transitive. If
a.equals(b)andb.equals(c), thena.equals(c)must be true as well. - It must be symmetric.
a.equals(b)andb.equals(a)must have the same value. - It must be reflexive.
a.equals(a)must always be true. - It must be consistent. Whichever value a.equals(b) returns on the first invocation must be the value returned on all later invocations.
a.equals(null)must be false.- It must be consistent with hashCode(). That is,
a.equals(b)must implya.hashCode() == b.hashCode(). The reverse is not true; two objects that are not equal may have the same hashcode, but that has the potential to harm hashing performance.
This is typically overridden to throw a java.lang.ClassCastException if the argument is not comparable to the class performing the comparison, but that is not a requirement. It is legal for
a.equals(b)to be true even thougha.getClass() != b.getClass(). Also, it is typical to never cause a java.lang.NullPointerException.In general, the Collections API (
java.util) use theequalsmethod rather than the==operator to compare objects. However, java.util.IdentityHashMap is an exception to this rule, for its own good reasons.The default implementation returns
this == o. - It must be transitive. If
|
|||||||||
| Home >> All >> cgsuite >> [ extras overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC