|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--id3.CatGraph
CatGraph is a directed graph whose nodes have references to Categorizers. Edges are labelled with the category number they match. The CatGraph can be either complete or sparse. This is decided at the time of creation and cannot be changed thereafter.
For complete graphs:
Each node's first edge must be labelled either UNKNOWN_CATEGORY_VAL or FIRST_CATEGORY_VAL. Each additional edge must be labelled with the next category in ascending order.
For sparse graphs:
A node may have zero or more children. Detection of a child can be done using the get_child_if_exists() function, which returns a reference to the child node if it exists, and otherwise returns a NULL reference.
| Field Summary | |
protected CGraph |
cGraph
The CGraph object containing the graph used for this CatGraph. |
protected boolean |
defaultDistDisp
The default value for distribution display. |
protected java.lang.String |
distDispHelp
Distribution display help string. |
protected LogOptions |
logOptions
Logging options for this class. |
| Constructor Summary | |
CatGraph(boolean isGraphSparse)
Constructor. |
|
CatGraph(CGraph aGraph,
boolean isGraphSparse)
Constructor. |
|
| Method Summary | |
boolean |
check_node_in_graph(Node node,
boolean fatalOnFalse)
Checks if specified Node is in this NatGraph object. |
void |
connect(Node from,
Node to,
AugCategory edgeLabel)
Creates a directed Edge from Node "from" to Node "to". |
protected void |
convertToDotFormat(java.io.Writer stream,
DisplayPref pref,
boolean hasNodeLosses,
boolean hasLossMatrix)
Returns a representation of the graph to dot format. |
Node |
create_node(NodeCategorizer[] cat,
int level)
Creates a new Node. |
void |
display(boolean hasNodeLosses,
boolean hasLossMatrix,
java.io.Writer stream,
DisplayPref dp)
Prints a representation of the CatGraph to the specified stream, using the Categorizer descriptions to label the nodes. |
NodeCategorizer |
get_categorizer(Node nodePtr)
Returns the NodeCategorizer stored in the specified Node. |
CGraph |
get_graph()
Returns the CGraph stored in this CatGraph object. |
int |
get_log_level()
Returns the logging level for this object. |
LogOptions |
get_log_options()
Returns the LogOptions object for this object. |
java.io.Writer |
get_log_stream()
Returns the stream to which logs for this object are written. |
boolean |
is_sparse()
Checks if this CatGraph is sparsely populated. |
int |
num_attr(int maxAttr)
Returns the number of attributes stored in this CatGraph. |
int |
num_children(Node parent)
Returns the number of children the specified Node has. |
int |
num_leaves()
Returns the number of leaves in this CatGraph. |
int |
num_nodes()
Returns the number of Nodes in this CatGraph. |
protected void |
process_DotGraph_display(java.io.Writer stream,
DisplayPref dp,
boolean hasNodeLosses,
boolean hasLossMatrix)
Creates a postscript file of the receiving graph via a dot description. |
protected void |
process_DotPostscript_display(java.io.Writer stream,
DisplayPref dp,
boolean hasNodeLosses,
boolean hasLossMatrix)
Creates a postscript file of the receiving graph in a graphical form. |
void |
set_log_level(int level)
Sets the logging level for this object. |
void |
set_log_options(LogOptions opt)
Sets the LogOptions object for this object. |
void |
set_log_prefixes(java.lang.String file,
int line,
int lvl1,
int lvl2)
Sets the logging message prefix for this object. |
void |
set_log_stream(java.io.Writer strm)
Sets the stream to which logging options are displayed. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
protected CGraph cGraph
protected LogOptions logOptions
protected java.lang.String distDispHelp
protected boolean defaultDistDisp
| Constructor Detail |
public CatGraph(boolean isGraphSparse)
isGraphSparse - TRUE if this CatGraph is sparsely populated. FALSE
otherwise.
public CatGraph(CGraph aGraph,
boolean isGraphSparse)
aGraph - CGraph on which all operations will take place. It
should remain unchanged while a part of this
CatGraph object.isGraphSparse - TRUE if this CatGraph is sparsely populated. FALSE
otherwise.| Method Detail |
public void set_log_level(int level)
level - The new logging level.public int get_log_level()
public void set_log_stream(java.io.Writer strm)
strm - The stream to which logs will be written.public java.io.Writer get_log_stream()
public LogOptions get_log_options()
public void set_log_options(LogOptions opt)
opt - The new LogOptions object.
public void set_log_prefixes(java.lang.String file,
int line,
int lvl1,
int lvl2)
file - The file name to be displayed in the prefix of log messages.line - The line number to be displayed in the prefix of log messages.lvl1 - The log level of the statement being logged.lvl2 - The level of log messages being displayed.public boolean is_sparse()
public int num_nodes()
public int num_leaves()
public CGraph get_graph()
public int num_attr(int maxAttr)
maxAttr - The maximum number of attributes stored in the CatGraph.
public Node create_node(NodeCategorizer[] cat,
int level)
cat - The Categorizer to be stored in the new Node.level - The level for the new node placement.
public void connect(Node from,
Node to,
AugCategory edgeLabel)
For non-sparse graphs:
The category given must be the category following the category for
the previous Edge.
The first Edge must have label UNKNOWN_CATEGORY_VAL or
FIRST_CATEGORY_VAL.
from - The Node that is the source of the directed Edge.to - The Node that is the destination of the directed Edge.edgeLabel - The category to be assigned to the new Edge.public int num_children(Node parent)
parent - The specified Node.public NodeCategorizer get_categorizer(Node nodePtr)
nodePtr - The Node containing the NodeCategorizer.
public boolean check_node_in_graph(Node node,
boolean fatalOnFalse)
node - The Node to be looked for.fatalOnFalse - TRUE if an error message should be displayed if the
specified Node is not in the CatGraph, FALSE
otherwise.
protected void process_DotGraph_display(java.io.Writer stream,
DisplayPref dp,
boolean hasNodeLosses,
boolean hasLossMatrix)
stream - The stream to be written to.dp - The preferences for display.hasNodeLosses - TRUE if this Node contains loss values.hasLossMatrix - TRUE if this CatGraph has a loss matrix assigned to
it, FALSE otherwise.
protected void process_DotPostscript_display(java.io.Writer stream,
DisplayPref dp,
boolean hasNodeLosses,
boolean hasLossMatrix)
stream - The stream to be written to.dp - The preferences for display.hasNodeLosses - TRUE if this Node contains loss values.hasLossMatrix - TRUE if this CatGraph has a loss matrix assigned to
it, FALSE otherwise.
public void display(boolean hasNodeLosses,
boolean hasLossMatrix,
java.io.Writer stream,
DisplayPref dp)
hasNodeLosses - TRUE if this Node contains loss values.hasLossMatrix - TRUE if this CatGraph has a loss matrix assigned to
it, FALSE otherwise.stream - The stream to be written to.dp - The preferences for display.
protected void convertToDotFormat(java.io.Writer stream,
DisplayPref pref,
boolean hasNodeLosses,
boolean hasLossMatrix)
stream - The stream to be written to.pref - The preferences for display.hasNodeLosses - TRUE if this Node contains loss values.hasLossMatrix - TRUE if this CatGraph has a loss matrix assigned to
it, FALSE otherwise.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||