Class InterfaceQuery

java.lang.Object
mgui.interfaces.queries.InterfaceQuery
All Implemented Interfaces:
InterfaceObject, NamedObject, TreeObject, CleanableObject, IconObject
Direct Known Subclasses:
InterfaceShapeQuery

public abstract class InterfaceQuery
extends java.lang.Object
implements InterfaceObject, IconObject
Interface for a class which allows it to query a given InterfaceQueryObject. Queries are classes which obtain information about an object and store it as a set of QueryResults.
Since:
1.0
Version:
1.0
Author:
Andrew Reid
  • Field Details

  • Constructor Details

    • InterfaceQuery

      public InterfaceQuery()
  • Method Details

    • getObjectIcon

      public javax.swing.Icon getObjectIcon()
      Description copied from interface: IconObject
      Returns the Icon associated with this object.
      Specified by:
      getObjectIcon in interface IconObject
      Returns:
    • getName

      public java.lang.String getName()
      Description copied from interface: NamedObject
      Gets the name for this object.
      Specified by:
      getName in interface NamedObject
      Returns:
    • setName

      public void setName​(java.lang.String name)
      Description copied from interface: NamedObject
      Sets the name for this object.
      Specified by:
      setName in interface NamedObject
    • clean

      public void clean()
      Description copied from interface: CleanableObject
      Instructs this object to search its members for any object which has been destroyed, and release the pointer to it.
      Specified by:
      clean in interface CleanableObject
    • getResult

      public java.lang.Object getResult​(java.lang.String object)
      Returns the result associated with object, if it exists; returns null otherwise.
      Parameters:
      object -
      Returns:
    • getObjects

      public java.util.ArrayList<InterfaceQueryObject> getObjects()
      Returns a list of the objects for which this query has results, in the order they were added.
      Returns:
    • getResults

      public java.util.ArrayList<QueryResult> getResults()
      Returns the results stored in this query, in the order they were added.
      Returns:
    • clearResults

      public void clearResults()
      Clears the results currently stored in this query.
    • canQuery

      public abstract boolean canQuery​(InterfaceQueryObject object)
      Determines whether this query instance can query the given InterfaceQueryObject.
      Parameters:
      object -
      Returns:
    • query

      public abstract void query​(InterfaceQueryObject object) throws ObjectNotQueriableException
      Performs a query on the specified query object. Adds a new result to the result list.
      Parameters:
      object -
      Throws:
      ObjectNotQueriableException
    • addListener

      public void addListener​(QueryListener listener)
      Adds a query listener to this query.
      Parameters:
      listener -
    • removeListener

      public void removeListener​(QueryListener listener)
      Removes a query listener from this query.
      Parameters:
      listener -
    • getNewInstance

      public abstract InterfaceQuery getNewInstance​(java.lang.String name)
      Returns a new instance of this class of query.
      Parameters:
      name -
      Returns:
    • addResult

      protected void addResult​(QueryResult result)
      Adds a result to this query; if a result from this object already exists, it is replaced, and moved to the end of the list.
      Parameters:
      result -
    • getResultTreeNode

      public InterfaceTreeNode getResultTreeNode()
      Returns a set of tree nodes containing the results of this query.
      Returns:
    • getLastResult

      public QueryResult getLastResult()
      Returns the last query result.
      Returns:
    • fireListeners

      protected void fireListeners()
    • getTreeLabel

      public java.lang.String getTreeLabel()
      Description copied from interface: TreeObject
      Returns the label text to appear in a tree node.
      Specified by:
      getTreeLabel in interface TreeObject
      Returns:
    • issueTreeNode

      public InterfaceTreeNode issueTreeNode()
      Description copied from interface: TreeObject
      Issues a new InterfaceTreeNode for this object. The object is responsible for maintaining, updating, and destroying the tree nodes it issues, or notifying containers -- i.e., parent trees -- of changes which require the tree nodes to be modified or destroyed.
      Specified by:
      issueTreeNode in interface TreeObject
      Returns:
    • setTreeNode

      public void setTreeNode​(InterfaceTreeNode node)
      Description copied from interface: TreeObject
      Sets the children for this node's InterfaceTreeNode.
      Specified by:
      setTreeNode in interface TreeObject
    • destroy

      public void destroy()
      Description copied from interface: InterfaceObject
      Destroy this object (prepare it to be removed from memory)
      Specified by:
      destroy in interface InterfaceObject
    • isDestroyed

      public boolean isDestroyed()
      Description copied from interface: InterfaceObject
      Test whether this object has been destroyed
      Specified by:
      isDestroyed in interface InterfaceObject
      Returns: