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
ReadableASCII
readASCII
in interface ReadableASCII
in
- source to read from.IOException
- an error reading inputpublic String asciiHeader()
ReadableASCII
asciiHeader
in interface ReadableASCII
asciiHeader
in interface WriteableASCII
public void readBinary(DataInput in) throws IOException
ReadableBinary
readBinary
in interface ReadableBinary
in
- source to read from.IOException
- an error reading inputpublic byte[] binaryHeader()
ReadableBinary
binaryHeader
in interface ReadableBinary
binaryHeader
in interface WriteableBinary
public void writeASCII(PrintWriter out) throws IOException
WriteableASCII
writeASCII
in interface WriteableASCII
out
- sink to write toIOException
- an error writing to outpublic void writeBinary(DataOutput out) throws IOException
WriteableBinary
writeBinary
in interface WriteableBinary
out
- sink to write toIOException
- an error writing to outpublic Number getOrdinate(int dimension)
Coordinate
getOrdinate
in interface Coordinate
dimension
- The index of the dimension we are interested inpublic int getDimensions()
getDimensions
in interface Coordinate
public 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)
Coordinate
setOrdinate
in interface Coordinate
dimension
- The index of the dimension we are interested invalue
- The value of the ordinate of the given dimension.