Class FSTreeModel

  • All Implemented Interfaces:
    javax.swing.tree.TreeModel

    public class FSTreeModel
    extends java.lang.Object
    implements javax.swing.tree.TreeModel
    Swing Tree Model for Feature Structures.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private CASImpl cas
      The cas.
      private static java.lang.String defaultRootString
      The Constant defaultRootString.
      private java.util.List<FSNode> fss
      The fss.
      private FSTreeNode root
      The root.
      private java.lang.String rootString
      The root string.
      private java.util.List<javax.swing.event.TreeModelListener> treeModelListeners
      The tree model listeners.
    • Constructor Summary

      Constructors 
      Constructor Description
      FSTreeModel()
      Constructor for FSTreeModel.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addTreeModelListener​(javax.swing.event.TreeModelListener arg0)
      Adds the tree model listener.
      (package private) static java.util.List<FSTreeNode> createArrayChildren​(int start, int end, java.util.List<FSNode> array, FSTreeModel model)
      Creates the array children.
      (package private) CASImpl getCas()
      Gets the cas.
      java.lang.Object getChild​(java.lang.Object parent, int index)
      Gets the child.
      int getChildCount​(java.lang.Object parent)
      Gets the child count.
      java.util.List<FSNode> getFSs()
      Gets the f ss.
      int getIndexOfChild​(java.lang.Object parent, java.lang.Object child)
      Gets the index of child.
      (package private) int getNodeType​(Type type)
      Gets the node type.
      private void getPathToNode​(int n, java.util.List<FSTreeNode> dtrs, java.util.List<FSTreeNode> path)
      Gets the path to node.
      java.lang.Object getRoot()
      Gets the root.
      (package private) java.lang.String getRootString()
      Gets the root string.
      boolean isLeaf​(java.lang.Object node)
      Checks if is leaf.
      javax.swing.tree.TreePath pathToNode​(int fsNum)
      Path to node.
      void removeTreeModelListener​(javax.swing.event.TreeModelListener arg0)
      Removes the tree model listener.
      void reset()
      Reset.
      void update​(java.lang.String indexName, FSIndex index, CAS cas1)
      Update.
      void valueForPathChanged​(javax.swing.tree.TreePath path, java.lang.Object newValue)
      Value for path changed.
      • Methods inherited from class java.lang.Object

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

      • cas

        private CASImpl cas
        The cas.
      • treeModelListeners

        private java.util.List<javax.swing.event.TreeModelListener> treeModelListeners
        The tree model listeners.
      • fss

        private java.util.List<FSNode> fss
        The fss.
      • defaultRootString

        private static final java.lang.String defaultRootString
        The Constant defaultRootString.
        See Also:
        Constant Field Values
      • rootString

        private java.lang.String rootString
        The root string.
    • Constructor Detail

      • FSTreeModel

        public FSTreeModel()
        Constructor for FSTreeModel.
    • Method Detail

      • update

        public void update​(java.lang.String indexName,
                           FSIndex index,
                           CAS cas1)
        Update.
        Parameters:
        indexName - the index name
        index - the index
        cas1 - the cas 1
      • reset

        public void reset()
        Reset.
      • getFSs

        public java.util.List<FSNode> getFSs()
        Gets the f ss.
        Returns:
        the f ss
      • getRoot

        public java.lang.Object getRoot()
        Gets the root.
        Specified by:
        getRoot in interface javax.swing.tree.TreeModel
        Returns:
        the root
        See Also:
        TreeModel.getRoot()
      • getChild

        public java.lang.Object getChild​(java.lang.Object parent,
                                         int index)
        Gets the child.
        Specified by:
        getChild in interface javax.swing.tree.TreeModel
        Parameters:
        parent - the parent
        index - the index
        Returns:
        the child
        See Also:
        TreeModel.getChild(java.lang.Object, int)
      • getNodeType

        int getNodeType​(Type type)
        Gets the node type.
        Parameters:
        type - the type
        Returns:
        the node type
      • getChildCount

        public int getChildCount​(java.lang.Object parent)
        Gets the child count.
        Specified by:
        getChildCount in interface javax.swing.tree.TreeModel
        Parameters:
        parent - the parent
        Returns:
        the child count
        See Also:
        TreeModel.getChildCount(java.lang.Object)
      • isLeaf

        public boolean isLeaf​(java.lang.Object node)
        Checks if is leaf.
        Specified by:
        isLeaf in interface javax.swing.tree.TreeModel
        Parameters:
        node - the node
        Returns:
        true, if is leaf
        See Also:
        TreeModel.isLeaf(java.lang.Object)
      • valueForPathChanged

        public void valueForPathChanged​(javax.swing.tree.TreePath path,
                                        java.lang.Object newValue)
        Value for path changed.
        Specified by:
        valueForPathChanged in interface javax.swing.tree.TreeModel
        Parameters:
        path - the path
        newValue - the new value
        See Also:
        TreeModel.valueForPathChanged(javax.swing.tree.TreePath, java.lang.Object)
      • getIndexOfChild

        public int getIndexOfChild​(java.lang.Object parent,
                                   java.lang.Object child)
        Gets the index of child.
        Specified by:
        getIndexOfChild in interface javax.swing.tree.TreeModel
        Parameters:
        parent - the parent
        child - the child
        Returns:
        the index of child
        See Also:
        TreeModel.getIndexOfChild(java.lang.Object, java.lang.Object)
      • addTreeModelListener

        public void addTreeModelListener​(javax.swing.event.TreeModelListener arg0)
        Adds the tree model listener.
        Specified by:
        addTreeModelListener in interface javax.swing.tree.TreeModel
        Parameters:
        arg0 - the arg 0
        See Also:
        TreeModel.addTreeModelListener(javax.swing.event.TreeModelListener)
      • removeTreeModelListener

        public void removeTreeModelListener​(javax.swing.event.TreeModelListener arg0)
        Removes the tree model listener.
        Specified by:
        removeTreeModelListener in interface javax.swing.tree.TreeModel
        Parameters:
        arg0 - the arg 0
        See Also:
        TreeModel.removeTreeModelListener(javax.swing.event.TreeModelListener)
      • getCas

        CASImpl getCas()
        Gets the cas.
        Returns:
        CASImpl
      • getRootString

        java.lang.String getRootString()
        Gets the root string.
        Returns:
        String
      • createArrayChildren

        static java.util.List<FSTreeNode> createArrayChildren​(int start,
                                                              int end,
                                                              java.util.List<FSNode> array,
                                                              FSTreeModel model)
        Creates the array children.
        Parameters:
        start - the start
        end - the end
        array - the array
        model - the model
        Returns:
        the list
      • pathToNode

        public javax.swing.tree.TreePath pathToNode​(int fsNum)
        Path to node.
        Parameters:
        fsNum - the fs num
        Returns:
        the tree path
      • getPathToNode

        private void getPathToNode​(int n,
                                   java.util.List<FSTreeNode> dtrs,
                                   java.util.List<FSTreeNode> path)
        Gets the path to node.
        Parameters:
        n - the n
        dtrs - the dtrs
        path - the path