context.arch.discoverer.querySystem
Class AbstractQueryItem

java.lang.Object
  extended bycontext.arch.discoverer.querySystem.AbstractQueryItem
Direct Known Subclasses:
AbstractBooleanQueryItem, QueryItem

public abstract class AbstractQueryItem
extends java.lang.Object

Design pattern : Composite An AbstractQueryItem is the abstract element to create queries. A query may contain QueryItem or AbstractBooleanQueryItem. A QueryItem specifies the type of element searched, the value searched and a type of comparison. For example : type of element = type value = widget comparison = equal Another example : type of element = attribute value = username comparison = equal A AbstractBooleanQueryItem is just a node that contains 1 or 2 other AbstractQueryItem objects. A query is a tree. To process a query, the leaves of this tree returns an array that contains for all existing components in the data model, if each components suits the query or not (0 or 1). Example of query : QueryItem q1 = new QueryItem(new IdElement("PersonNamePresence2_rigatoni_1655")); // by default Equal() // IdElement implements IndexTableIF QueryItem q2 = new QueryItem(new PortElement("1520"),new GreaterEqual()); ANDQueryItem and = new ANDQueryItem(q1, q2); result = and.process(abstractDataModel); // abstractDataModel gets access to all IndexTableIF objects. There are 2 ways of processing a query : - when the query is processed for all existing objects in the AbstractDataModel - when the query is processed only for one object (to handle the notification) ------------------------------------------ | AbstractQueryItem | ------------------------------------------ | process(AbstractDataModel) : Object | | process(Object) : boolean | ------------------------------------------ /\ /\ | | -------------------------------------- | | QueryItem | | -------------------------------------- | |comparison : AbstractComparison | | |elToMatch : AbstractDescriptionElement| ------------------------------- -------------------------------------- | AbstractBooleanQueryItem | |process(AbstractDataModel) : Object | ------------------------------- |process(Object) : boolean | |son : AbstractQueryItem | -------------------------------------- |brother : AbstractQueryItem | ------------------------------- /\ | ___________________________________________|________________________________________ | | | -------------------------------------- -------------------------------------- -------------------------------------- | ANDQueryItem | | ORQueryItem | | NOTQueryItem | -------------------------------------- -------------------------------------- -------------------------------------- |process(AbstractDataModel) : Object | |process(AbstractDataModel) : Object | |process(AbstractDataModel) : Object | |process(Object) : boolean | |process(Object) : boolean | |process(Object) : boolean | ------------------------------------- ------------------------------------- --------------------------------------

Author:
Agathe
See Also:
context.arch.discoverer.dataModel

Field Summary
static java.lang.String ABSTRACT_QUERY_ITEM
           
 
Constructor Summary
AbstractQueryItem()
           
 
Method Summary
static java.lang.String arrayToString(java.lang.Object table)
          Returns a string displaying a complex object
static AbstractQueryItem fromDataObject(DataObject data)
          Convert an DataObject into an AbstractQueryItem object
abstract  java.lang.Object process(AbstractDataModel dataModel)
          This method allows to process an 2D array that contains in the first column the index of the component stored in the data model, and in the second column a integer value : 0 or 1 for false or true.
abstract  boolean process(java.lang.Object component)
          Returns true if a component fits this query
abstract  DataObject toDataObject()
          Returns a DataObject version of this object
abstract  java.lang.String toString()
          Returns a printable version of this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ABSTRACT_QUERY_ITEM

public static final java.lang.String ABSTRACT_QUERY_ITEM
See Also:
Constant Field Values
Constructor Detail

AbstractQueryItem

public AbstractQueryItem()
Method Detail

process

public abstract java.lang.Object process(AbstractDataModel dataModel)
This method allows to process an 2D array that contains in the first column the index of the component stored in the data model, and in the second column a integer value : 0 or 1 for false or true.

Parameters:
dataModel -
Returns:
Object

process

public abstract boolean process(java.lang.Object component)
Returns true if a component fits this query

Parameters:
component -
Returns:
boolean

toString

public abstract java.lang.String toString()
Returns a printable version of this object

Returns:
String

arrayToString

public static java.lang.String arrayToString(java.lang.Object table)
Returns a string displaying a complex object

Parameters:
table -
Returns:
String

fromDataObject

public static AbstractQueryItem fromDataObject(DataObject data)
Convert an DataObject into an AbstractQueryItem object

Parameters:
data -
Returns:
AbstractQueryItem

toDataObject

public abstract DataObject toDataObject()
Returns a DataObject version of this object

Returns:
DataObject