edu.ksu.cis.bnj.bbn.converter.net
Class NetParser

java.lang.Object
  extended byedu.ksu.cis.bnj.bbn.converter.net.NetParser
All Implemented Interfaces:
Converter, NetParserConstants, NetParserTreeConstants

public class NetParser
extends java.lang.Object
implements NetParserTreeConstants, Converter, NetParserConstants


Field Summary
protected  java.util.Hashtable edgeCache
           
static int FORMAT_DEFAULT
           
static int FORMATv5_7
           
static int FORMATv6_0
           
 Token jj_nt
           
protected  edu.ksu.cis.bnj.bbn.converter.net.JJTNetParserState jjtree
           
protected static java.lang.String ln
           
 boolean lookingAhead
           
protected  java.util.Hashtable nodeCache
           
static int saveFormat
           
 Token token
           
 NetParserTokenManager token_source
           
protected  java.util.Hashtable valueCache
           
 
Fields inherited from interface edu.ksu.cis.bnj.bbn.converter.net.NetParserTreeConstants
jjtNodeName, JJTVOID
 
Fields inherited from interface edu.ksu.cis.bnj.bbn.converter.net.NetParserConstants
ANDASSIGN, ASG_OPR, ASSIGN, BANG, BIT_AND, BIT_OR, BIT_XOR, CHAR_LIT, CHAR_LIT_CLOSE, CHARACTER_LITERAL, CLASS, COLON, COMMA, CONTINUOUS, DATA, DECIMAL_LITERAL, DECISION, DECR, DEFAULT, DIGIT, DISCRETE, DOT, EOF, EQ, ESCAPE_OCTAL, ESCAPE_SEQ, ESCAPE_UNICODE, ESCAPED_CHAR_LIT, EXPONENT, FLOATING_POINT_LITERAL, GE, GT, HEX_LITERAL, HOOK, IDENTIFIER, IN_SINGLE_LINE_COMMENT, INCR, INPUTS, INTEGER_LITERAL, LABEL, LBRACE, LBRACKET, LE, LETTER, LPAREN, LSHIFT, LSHIFTASSIGN, LT, MINUS, MINUSASSIGN, NE, NET, NODE, NODE_SIZE, NON_ESCAPED_LITERAL, NORMAL, OCTAL_LITERAL, ORASSIGN, OUTPUTS, PLUS, PLUSASSIGN, POSITION, POTENTIAL, RBRACE, RBRACKET, REMASSIGN, RPAREN, RSIGNEDSHIFT, RSIGNEDSHIFTASSIGN, RUNSIGNEDSHIFT, RUNSIGNEDSHIFTASSIGN, SC_AND, SC_OR, SC_XOR, SEMICOLON, SINGLE_LINE_COMMENT, SLASH, SLASHASSIGN, STAR, STARASSIGN, STATES, STRING_LITERAL, SUBTYPE, TILDE, tokenImage, TOWARD, UTILITY, XORASSIGN
 
Constructor Summary
NetParser()
           
NetParser(java.io.InputStream stream)
           
NetParser(NetParserTokenManager tm)
           
NetParser(java.io.Reader stream)
           
 
Method Summary
 BBNGraph CompilationUnit()
          THE HUGIN NET LANGUAGE GRAMMAR STARTS HERE *
 void disable_tracing()
           
 void Edge()
           
 void enable_tracing()
           
 ASTExpr Expr()
           
protected  java.util.Hashtable formatCPF(java.util.LinkedList valueList, java.util.LinkedList data, java.util.Hashtable queryValue, java.util.Hashtable input)
          Reformat the list of lists into CPF
 BBNGraph Formatv5_7()
           
 BBNGraph Formatv6_0()
           
 ParseException generateParseException()
           
protected  java.lang.String getFiller(int n)
           
 Token getNextToken()
           
 Token getToken(int index)
           
 java.util.Hashtable GraphProperties()
           
static void help()
           
 void initialize()
           
 BBNGraph load(java.io.InputStream r)
           
static void main(java.lang.String[] args)
           
 ASTExpr MulDivExpr()
           
 java.util.LinkedList NestedNumberList()
           
 void Node()
           
 java.util.LinkedList NumberList()
           
 java.lang.Double NumberLiteral()
           
 java.util.LinkedList NumberOrFuncList()
           
 ASTExpr PowExpr()
           
protected  BBNGraph processGraph(BBNGraph g)
           
 void ReInit(java.io.InputStream stream)
           
 void ReInit(NetParserTokenManager tm)
           
 void ReInit(java.io.Reader stream)
           
protected  void resetCache()
          This is to reset cache.
 void save(java.io.OutputStream os, BBNGraph graph)
           
protected  java.lang.String saveCPT(java.util.Hashtable valueListTable, java.util.Hashtable cpf, java.util.LinkedList nodes, java.util.Hashtable curQuery, java.lang.StringBuffer buf, java.lang.String filler)
          Encode the flat-encoded CPF back into its nested String form.
protected  java.lang.String saveProperty(java.util.Hashtable property, int filler)
           
 java.util.LinkedList StringList()
           
 java.lang.String StringLiteral()
           
 ASTExpr UnaryExpr()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jjtree

protected edu.ksu.cis.bnj.bbn.converter.net.JJTNetParserState jjtree

nodeCache

protected java.util.Hashtable nodeCache

edgeCache

protected java.util.Hashtable edgeCache

valueCache

protected java.util.Hashtable valueCache

FORMATv6_0

public static final int FORMATv6_0
See Also:
Constant Field Values

FORMATv5_7

public static final int FORMATv5_7
See Also:
Constant Field Values

FORMAT_DEFAULT

public static final int FORMAT_DEFAULT
See Also:
Constant Field Values

saveFormat

public static int saveFormat

ln

protected static java.lang.String ln

token_source

public NetParserTokenManager token_source

token

public Token token

jj_nt

public Token jj_nt

lookingAhead

public boolean lookingAhead
Constructor Detail

NetParser

public NetParser()

NetParser

public NetParser(java.io.InputStream stream)

NetParser

public NetParser(java.io.Reader stream)

NetParser

public NetParser(NetParserTokenManager tm)
Method Detail

load

public BBNGraph load(java.io.InputStream r)
              throws ParseException
Specified by:
load in interface Converter
Throws:
ParseException

save

public void save(java.io.OutputStream os,
                 BBNGraph graph)
Specified by:
save in interface Converter

saveCPT

protected java.lang.String saveCPT(java.util.Hashtable valueListTable,
                                   java.util.Hashtable cpf,
                                   java.util.LinkedList nodes,
                                   java.util.Hashtable curQuery,
                                   java.lang.StringBuffer buf,
                                   java.lang.String filler)
Encode the flat-encoded CPF back into its nested String form. Dunno about the continuous chance node... It will break

Parameters:
valueListTable - A table of node name -> its value. If get method returns null, then it has no value (possibly a utility node).
cpf - The flat CPF we want to encode
nodes - The list of node names that has a role in the CPF encoding
curQuery - It is the Hashtable to form the query
buf - The string buffer for the output
filler - The string to pad the output (to beautify it)
Returns:
String The encoded string

saveProperty

protected java.lang.String saveProperty(java.util.Hashtable property,
                                        int filler)

getFiller

protected java.lang.String getFiller(int n)

initialize

public void initialize()
Specified by:
initialize in interface Converter

processGraph

protected BBNGraph processGraph(BBNGraph g)

formatCPF

protected java.util.Hashtable formatCPF(java.util.LinkedList valueList,
                                        java.util.LinkedList data,
                                        java.util.Hashtable queryValue,
                                        java.util.Hashtable input)
Reformat the list of lists into CPF

Parameters:
valueList - Basically list of node name and its value list
data - The data in multiply nested lists
queryValue - BBNQuery entry to be inputted
input - the resulting CPF, passed recursively while building
Returns:
Hashtable the CPF

resetCache

protected void resetCache()
This is to reset cache. Useful later if we decided to support OOBN.


help

public static void help()

main

public static void main(java.lang.String[] args)

CompilationUnit

public final BBNGraph CompilationUnit()
                               throws ParseException
THE HUGIN NET LANGUAGE GRAMMAR STARTS HERE *

Throws:
ParseException

Formatv6_0

public final BBNGraph Formatv6_0()
                          throws ParseException
Throws:
ParseException

Formatv5_7

public final BBNGraph Formatv5_7()
                          throws ParseException
Throws:
ParseException

GraphProperties

public final java.util.Hashtable GraphProperties()
                                          throws ParseException
Throws:
ParseException

Node

public final void Node()
                throws ParseException
Throws:
ParseException

Edge

public final void Edge()
                throws ParseException
Throws:
ParseException

NestedNumberList

public final java.util.LinkedList NestedNumberList()
                                            throws ParseException
Throws:
ParseException

Expr

public final ASTExpr Expr()
                   throws ParseException
Throws:
ParseException

MulDivExpr

public final ASTExpr MulDivExpr()
                         throws ParseException
Throws:
ParseException

PowExpr

public final ASTExpr PowExpr()
                      throws ParseException
Throws:
ParseException

UnaryExpr

public final ASTExpr UnaryExpr()
                        throws ParseException
Throws:
ParseException

StringLiteral

public final java.lang.String StringLiteral()
                                     throws ParseException
Throws:
ParseException

StringList

public final java.util.LinkedList StringList()
                                      throws ParseException
Throws:
ParseException

NumberLiteral

public final java.lang.Double NumberLiteral()
                                     throws ParseException
Throws:
ParseException

NumberOrFuncList

public final java.util.LinkedList NumberOrFuncList()
                                            throws ParseException
Throws:
ParseException

NumberList

public final java.util.LinkedList NumberList()
                                      throws ParseException
Throws:
ParseException

ReInit

public void ReInit(java.io.InputStream stream)

ReInit

public void ReInit(java.io.Reader stream)

ReInit

public void ReInit(NetParserTokenManager tm)

getNextToken

public final Token getNextToken()

getToken

public final Token getToken(int index)

generateParseException

public final ParseException generateParseException()

enable_tracing

public final void enable_tracing()

disable_tracing

public final void disable_tracing()