|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object smithers.twisty.SquareOne
public class SquareOne
Represents the twisty puzzle
Constructor Summary | |
---|---|
SquareOne()
Constructs a new Square One puzzle. |
Method Summary | |
---|---|
void |
advanceAnimation(double time)
Advances the animation by a certain amount of time. |
int |
getColor(int index)
Gets the colour of the specified sticker. |
Twist |
getFlip(int which)
|
Polygon3D |
getPolygon(int index)
Gets the 3-d polygon associated with the specified sticker. |
double |
getScale()
Returns the absolute scale of the 3-d model of the puzzle. |
Twist |
getTurn(int top,
int bottom)
|
Twist |
getTwist(int index,
int dir)
Gets the twist instance determined by the sticker clicked on, and the directon to twist. |
boolean |
isAnimating()
Returns true iff the puzzle is partway through a twist. |
boolean |
isSolved()
Works out whether this puzzle is in the solved state. |
void |
scramble()
Scrambles the puzzle. |
int |
stickerCount()
Gets the number of stickers on the puzzle. |
void |
twist(Twist twist)
Applies a twist. |
void |
twist(Twist twist,
double time)
Twists the puzzle over a specified amount of time. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SquareOne()
Method Detail |
---|
public int stickerCount()
stickerCount
in interface TwistyPuzzle
public int getColor(int index)
getColor
in interface TwistyPuzzle
index
- the sticker index
public double getScale()
getScale
in interface TwistyPuzzle
public Polygon3D getPolygon(int index)
getPolygon
in interface TwistyPuzzle
index
- the sticker index
public Twist getTurn(int top, int bottom)
public Twist getFlip(int which)
public Twist getTwist(int index, int dir)
TwistyPuzzle.twist(smithers.twisty.Twist)
(i.e. will not throw
ClassCastException
, although the move may not be possible). The
dir
argument should be: 0 for anticlockwise, 1 for clockwise or
2 for a half twist.
getTwist
in interface TwistyPuzzle
index
- the sticker which was clicked ondir
- the directon
public void twist(Twist twist)
twist
in interface TwistyPuzzle
twist
- the twistpublic void twist(Twist twist, double time)
twist
in interface AnimatedTwistyPuzzle
twist
- the twist to maketime
- the time to takepublic boolean isAnimating()
TwistyPuzzle
may fail with an
AnimatingException
.
isAnimating
in interface AnimatedTwistyPuzzle
true
iff the puzzle is animating a twistpublic void advanceAnimation(double time)
advanceAnimation
in interface AnimatedTwistyPuzzle
time
- the amount of time to advancepublic void scramble()
scramble
in interface TwistyPuzzle
public boolean isSolved()
isSolved
in interface TwistyPuzzle
true
iff the puzzle is solved
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |