Class ParseTreeTablePresentation


  • public class ParseTreeTablePresentation
    extends java.lang.Object
    The model that backs the parse tree in the GUI.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object getChild​(java.lang.Object parent, int index)
      Returns the child of parent at index.
      int getChildCount​(java.lang.Object parent)
      Returns the number of children of parent.
      java.lang.Class<?> getColumnClass​(int column)
      Returns type of specified column number.
      int getColumnCount()
      Returns number of available columns.
      java.lang.String getColumnName​(int column)
      Returns name for specified column number.
      int getIndexOfChild​(java.lang.Object parent, java.lang.Object child)
      Return the index of child in parent.
      java.lang.Object getRoot()
      Returns value of root.
      java.lang.Object getValueAt​(java.lang.Object node, int column)
      Returns the value to be displayed for node at column number.
      boolean isCellEditable​(int column)
      Indicates whether the the value for node node, at column number column is editable.
      boolean isLeaf​(java.lang.Object node)
      Whether the node is a leaf.
      protected void setParseMode​(MainFrameModel.ParseMode mode)
      Set parse mode.
      protected void setParseTree​(DetailAST parseTree)
      Set parse tree.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ParseTreeTablePresentation

        public ParseTreeTablePresentation​(DetailAST parseTree)
        Constructor initialise root node.
        Parameters:
        parseTree - DetailAST parse tree.
    • Method Detail

      • setParseTree

        protected final void setParseTree​(DetailAST parseTree)
        Set parse tree.
        Parameters:
        parseTree - DetailAST parse tree.
      • setParseMode

        protected void setParseMode​(MainFrameModel.ParseMode mode)
        Set parse mode.
        Parameters:
        mode - ParseMode enum
      • getColumnCount

        public int getColumnCount()
        Returns number of available columns.
        Returns:
        the number of available columns.
      • getColumnName

        public java.lang.String getColumnName​(int column)
        Returns name for specified column number.
        Parameters:
        column - the column number
        Returns:
        the name for column number column.
      • getColumnClass

        public java.lang.Class<?> getColumnClass​(int column)
        Returns type of specified column number.
        Parameters:
        column - the column number
        Returns:
        the type for column number column.
      • getValueAt

        public java.lang.Object getValueAt​(java.lang.Object node,
                                           int column)
        Returns the value to be displayed for node at column number.
        Parameters:
        node - the node
        column - the column number
        Returns:
        the value to be displayed for node node, at column number column.
      • getChild

        public java.lang.Object getChild​(java.lang.Object parent,
                                         int index)
        Returns the child of parent at index.
        Parameters:
        parent - the node to get a child from.
        index - the index of a child.
        Returns:
        the child of parent at index.
      • getChildCount

        public int getChildCount​(java.lang.Object parent)
        Returns the number of children of parent.
        Parameters:
        parent - the node to count children for.
        Returns:
        the number of children of the node parent.
      • getRoot

        public java.lang.Object getRoot()
        Returns value of root.
        Returns:
        the root.
      • isLeaf

        public boolean isLeaf​(java.lang.Object node)
        Whether the node is a leaf.
        Parameters:
        node - the node to check.
        Returns:
        true if the node is a leaf.
      • getIndexOfChild

        public int getIndexOfChild​(java.lang.Object parent,
                                   java.lang.Object child)
        Return the index of child in parent. If either parent or child is null, returns -1. If either parent or child don't belong to this tree model, returns -1.
        Parameters:
        parent - a node in the tree, obtained from this data source.
        child - the node we are interested in.
        Returns:
        the index of the child in the parent, or -1 if either child or parent are null or don't belong to this tree model.
      • isCellEditable

        public boolean isCellEditable​(int column)
        Indicates whether the the value for node node, at column number column is editable.
        Parameters:
        column - the column number
        Returns:
        true if editable