T - Type of underlying coordinateO - Type of payload datapublic class PayloadCoordinate<T extends Coordinate,O> extends Object implements Coordinate
Coordinate that has an associated
payload.| Constructor and Description |
|---|
PayloadCoordinate(T coord,
O payload)
Construct with coordinate and payload.
|
| Modifier and Type | Method and Description |
|---|---|
String |
asciiHeader()
Header for ascii input.
|
byte[] |
binaryHeader()
Header for binary input.
|
int |
getDimensions() |
Number |
getOrdinate(int dimension)
Get the ordinate value for a specific dimension.
|
O |
getPayload() |
static <T extends Coordinate,O> |
payload(T coord,
O payload)
Create a
PayloadCoordinate. |
void |
readASCII(Scanner in)
Read internal state from in.
|
void |
readBinary(DataInput in)
Read internal state from in.
|
void |
setOrdinate(int dimension,
Number value)
Set the ordinate value for a specific dimension.
|
void |
setPayload(O payload)
Set the payload.
|
void |
writeASCII(PrintWriter out)
Write the content of this as ascii to out.
|
void |
writeBinary(DataOutput out)
Write the content of this as binary to out.
|
public PayloadCoordinate(T coord, O payload)
coord - The coordinate.payload - The payload.public void readASCII(Scanner in) throws IOException
ReadableASCIIreadASCII in interface ReadableASCIIin - source to read from.IOException - an error reading inputpublic String asciiHeader()
ReadableASCIIasciiHeader in interface ReadableASCIIasciiHeader in interface WriteableASCIIpublic void readBinary(DataInput in) throws IOException
ReadableBinaryreadBinary in interface ReadableBinaryin - source to read from.IOException - an error reading inputpublic byte[] binaryHeader()
ReadableBinarybinaryHeader in interface ReadableBinarybinaryHeader in interface WriteableBinarypublic void writeASCII(PrintWriter out) throws IOException
WriteableASCIIwriteASCII in interface WriteableASCIIout - sink to write toIOException - an error writing to outpublic void writeBinary(DataOutput out) throws IOException
WriteableBinarywriteBinary in interface WriteableBinaryout - sink to write toIOException - an error writing to outpublic Number getOrdinate(int dimension)
CoordinategetOrdinate in interface Coordinatedimension - The index of the dimension we are interested inpublic int getDimensions()
getDimensions in interface Coordinatepublic void setPayload(O payload)
payload - The payloadpublic O getPayload()
public static <T extends Coordinate,O> PayloadCoordinate<T,O> payload(T coord, O payload)
PayloadCoordinate.T - The coordinate type.O - The payload type.coord - The coordinate.payload - The payload.PayloadCoordinate.public void setOrdinate(int dimension, Number value)
CoordinatesetOrdinate in interface Coordinatedimension - The index of the dimension we are interested invalue - The value of the ordinate of the given dimension.