|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.threerings.tudey.util.Coord
public class Coord
Represents a pair of 2D integer coordinates.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.threerings.io.Streamable |
|---|
com.threerings.io.Streamable.Closure |
| Field Summary | |
|---|---|
static int |
EMPTY
A value used to signify an empty coordinate. |
int |
x
The coordinates. |
int |
y
The coordinates. |
| Constructor Summary | |
|---|---|
Coord()
Creates a zero coord. |
|
Coord(Coord other)
Copy constructor. |
|
Coord(int pair)
Creates a coord from the supplied encoded coordinate pair. |
|
Coord(int[] values)
Creates a coord from an array of values. |
|
Coord(int x,
int y)
Creates a coord from two components. |
|
| Method Summary | |
|---|---|
Coord |
clone()
|
void |
decodeFromStream(DataInputStream in)
Initializes this object with data read from the specified stream. |
void |
decodeFromString(String string)
Initializes this object with the contents of the specified string. |
static int |
decodeX(int pair)
Extracts the x component from the specified encoded coordinate pair. |
static int |
decodeY(int pair)
Extracts the y component from the specified encoded coordinate pair. |
int |
encode()
Returns an encoded version of this coord. |
static int |
encode(int x,
int y)
Encodes the supplied coordinates (presumed to be in [-32768, +32767]) into a single integer. |
void |
encodeToStream(DataOutputStream out)
Encodes this object to the specified stream. |
String |
encodeToString()
Returns a string representation of this object. |
boolean |
equals(Object other)
|
int |
hashCode()
|
Coord |
set(Coord other)
Copies the elements of another coord. |
Coord |
set(int pair)
Sets the fields of the coord to those contained in the supplied encoded coordinate pair. |
Coord |
set(int[] values)
Copies the elements of an array. |
Coord |
set(int x,
int y)
Sets the fields of the coord. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int EMPTY
public int x
public int y
| Constructor Detail |
|---|
public Coord(int x,
int y)
public Coord(int pair)
public Coord(int[] values)
public Coord(Coord other)
public Coord()
| Method Detail |
|---|
public static int encode(int x,
int y)
public static int decodeX(int pair)
public static int decodeY(int pair)
public Coord set(Coord other)
public Coord set(int[] values)
public Coord set(int pair)
public Coord set(int x,
int y)
public int encode()
public String encodeToString()
Encodable
encodeToString in interface Encodable
public void decodeFromString(String string)
throws Exception
Encodable
decodeFromString in interface EncodableException
public void encodeToStream(DataOutputStream out)
throws IOException
Encodable
encodeToStream in interface EncodableIOException
public void decodeFromStream(DataInputStream in)
throws IOException
Encodable
decodeFromStream in interface EncodableIOExceptionpublic String toString()
toString in class Objectpublic Coord clone()
clone in class Objectpublic int hashCode()
hashCode in class Objectpublic boolean equals(Object other)
equals in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||