|
SandMark version 2.0 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sandmark.util.graph.codec.GraphCodec
Base-class for watermark encoders/decoders (codecs). Each class in this package should implement sandmark.util.graph.codec.GraphCodec. This entails implementing the encode and decode methods.
To encode an integer into a graph, use the package like this:
java.math.BigInteger value = ... sandmark.util.graph.codec.GraphCodec E = new sandmark.util.graph.codec.RadixGraph(value); sandmark.util.graph.Graph graph = E.graph;
To decode a graph into an integer, use the package like this:
sandmark.util.graph.Graph graph = ...; sandmark.util.graph.Node root = ...; int[] kidMap = {1,2}; sandmark.util.graph.codec.GraphCodec E = new sandmark.util.graph.codec.RadixGraph(graph,root,kidMap); sandmark.util.graph.Graph graph = E.graph;
Field Summary | |
static java.lang.Class[] |
codecs
|
java.lang.String |
fullName
|
Graph |
graph
|
protected int[] |
kidMap
|
(package private) static java.util.Random |
random
Return a random codec. |
protected Node |
root
|
java.lang.String |
shortName
|
java.math.BigInteger |
value
|
Constructor Summary | |
GraphCodec()
|
|
GraphCodec(java.math.BigInteger value)
Constructor to be used when encoding an integer into a graph. |
|
GraphCodec(Graph graph,
int[] kidMap)
Constructor to be used when decoding a graph to an integer. |
Method Summary | |
static java.lang.Class |
codecByName(java.lang.String name)
Return the codec whose name is 'name'. |
(package private) abstract void |
decode()
Codecs should implement this method to convert the 'graph' into 'value'. |
(package private) abstract void |
encode()
Codecs should implement this method to convert the 'value' into 'graph'. |
(package private) Node |
getKid(Node node,
int edgeNumber)
Use the kidMap to get the edgeNumber:th child of the node. |
static java.lang.Class |
randomCodec()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public java.math.BigInteger value
public Graph graph
protected Node root
protected int[] kidMap
public java.lang.String fullName
public java.lang.String shortName
public static java.lang.Class[] codecs
static java.util.Random random
Constructor Detail |
public GraphCodec()
public GraphCodec(java.math.BigInteger value)
value
- The value to be encoded.public GraphCodec(Graph graph, int[] kidMap) throws DecodeFailure
graph
- The graph to be decoded.kidMap
- An array of ints describing which field
should represent the first child, the
second child, etc.Method Detail |
abstract void encode()
abstract void decode() throws DecodeFailure
DecodeFailure
public static java.lang.Class codecByName(java.lang.String name) throws java.lang.Exception
name
- The short name of the codec.
A java.util.NoSuchElementException is thrown if a codec
by this name does not exist.
java.lang.Exception
public static java.lang.Class randomCodec() throws java.lang.Exception
java.lang.Exception
Node getKid(Node node, int edgeNumber)
node
- Look up this nodeedgeNumber
- The edge number to look up
|
SandMark version 2.0 Mon Jun 17 12:30:47 MST 2002 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |