From 5f3fb9afece2125cbeba79d61a8d88460b7878d7 Mon Sep 17 00:00:00 2001 From: Joshua Rahm Date: Tue, 27 Jan 2015 18:40:32 -0700 Subject: initial commit --- .../modulus/dataread/expressions/Statement.java | 105 +++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 project/JavaCommon/src/com/modulus/dataread/expressions/Statement.java (limited to 'project/JavaCommon/src/com/modulus/dataread/expressions/Statement.java') diff --git a/project/JavaCommon/src/com/modulus/dataread/expressions/Statement.java b/project/JavaCommon/src/com/modulus/dataread/expressions/Statement.java new file mode 100644 index 0000000..27df480 --- /dev/null +++ b/project/JavaCommon/src/com/modulus/dataread/expressions/Statement.java @@ -0,0 +1,105 @@ +package com.modulus.dataread.expressions; + +/** + * This interface is used to store interpreted + * information from a text file in a way that + * most represents a tree. for easy parsing + * for an interpreter or compiler. + * + * @author jrahm + * + */ +public interface Statement { + + /** + * Returns the child statements of this class + * + * @return the child statements of this class + */ + Statement[] getChildren(); + + /** + * Adds a child statement to this Statement + * + * @param child the child statement to add + */ + void addChild(Statement child); + + /** + * Removes a child statement from this Statement object + * + * @param child this child to remove from this statement + */ + void removeChild(Statement child); + + /** + * Sets the header for this statement object + * + * @param header the header for this statement. + */ + void setHeader(String header); + + /** + * returns the header for this statement object + * @return + */ + String getHeader(); + + /** + * side effect method to get nicely formatted printouts + * of the statement class. + * @param recur + * @return + */ + String toString( int recur ); + + /** + * Returns the child of this Statement that has + * the header header. If there is no + * child with that header, then the method should + * then return null. If there are multiple + * children with the same header, then the first one should + * be returned. If all children with that header should be + * returned, then use the getChildrenByHeader method. + * + * @param header the header of the child to return + * @return a child with the header header + */ + Statement getChildByHeader(String header); + + /** + * Returns an array of children of this Statement that have + * the header header. If no children have that header, + * then an empty array is returned. + * + * @param header the header of the children to return. + * @return an array of children that have the header header + */ + Statement[] getChildrenByHeader(String header); + + /** + * Returns the line number that this statement starts on. + * @return the line number that this statement starts on. + */ + int getLineNumber(); + + /** + * Sets the line number that this statement + * starts on. + * + * @param line the line this statement starts on. + */ + void setLineNumber(int line); + + /** + * Returns true if this statement has children, false otherwise. + * + * @return true if this statement has children. + */ + boolean hasChildren(); + + /** + * Deletes all children from this statement + */ + void clearChildren(); +} \ No newline at end of file -- cgit