edu.wisc.cs.util
Class WatermarkGraph

java.lang.Object
  |
  +--edu.wisc.cs.util.WatermarkGraph

public class WatermarkGraph
extends java.lang.Object

A graph representation to be used for communicating the structure of a watermark graph between the Encoder and CodeEditor implementations. This Represenataion will support any graph which can also be represented by objects with named pointer fields, including features such as self-loops, and multiple fields pointing to the same adjacent vertex. This class is designed for use with the GenericCodeEditor class for easy implementation of dynamic watermarking schemes.

See Also:
edu.cs.wisc.stego.Encoder, edu.cs.wisc.stego.CodeEditor, edu.cs.wisc.stego.modules.GenericCodeEditor

Field Summary
static int NULL_POINTER
          The integer value used by this class to represnt a null pointer.
 
Constructor Summary
WatermarkGraph(java.util.SortedSet fields, int size)
          Constructs a new WatermarkGraph with a specified set of edge fields names and initial size.
 
Method Summary
 int getEdge(int vertex, java.lang.String field)
          Returns the index of the vertex pointed to by a specified vertex and field.
 java.util.Iterator getEdges(int vertex)
          Returns the values in all of the pointer fields for a specified node.
 java.util.Iterator getFieldNames()
          Returns an iterator containing the field names for the graph edges.
 int getNFields()
          Returns the number of pointer fields in each node of the watermark graph.
 void setEdge(int vertex, java.lang.String field, int target)
          Assigns a value to a pointer field in a specified vertex of the graph.
 int size()
          Returns the number of nodes in the graph represented by this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_POINTER

public static final int NULL_POINTER
The integer value used by this class to represnt a null pointer. Zero cannot be used because it is a valid index into the array of vertices.
Constructor Detail

WatermarkGraph

public WatermarkGraph(java.util.SortedSet fields,
                      int size)
Constructs a new WatermarkGraph with a specified set of edge fields names and initial size. The set of fields is sorted because each time the set is examined, the each name must be encountered in the same order.
Parameters:
fields - a set of Strings which will be the edge fields.
size - the number of vertices in this graph.
Method Detail

setEdge

public void setEdge(int vertex,
                    java.lang.String field,
                    int target)
Assigns a value to a pointer field in a specified vertex of the graph.
Parameters:
vertex - the index of the vertex to modify.
field - the pointer field to assign a new value to.
target - the index of the vertex to assign to the specified field.

getEdge

public int getEdge(int vertex,
                   java.lang.String field)
Returns the index of the vertex pointed to by a specified vertex and field.
Parameters:
vertex - the index of the vertex to examine.
field - the pointer field to return the value of.
Returns:
the index of the node pointed to by the specified field.

getEdges

public java.util.Iterator getEdges(int vertex)
Returns the values in all of the pointer fields for a specified node.
Parameters:
vertex - the index of the vertex whose edge fields will be returned.
Returns:
an interator containing Integer objects which are the indices of the adjacent vertices.

size

public int size()
Returns the number of nodes in the graph represented by this object.
Returns:
the number of nodes in the graph represented by this object.

getFieldNames

public java.util.Iterator getFieldNames()
Returns an iterator containing the field names for the graph edges. This iterator is guaranteed to return the field name in the same order each time.
Returns:
an iterator containing the field names for the graph edges.

getNFields

public int getNFields()
Returns the number of pointer fields in each node of the watermark graph.
Returns:
the number of pointer fields in each node of the watermark graph.