com.sas.dataselectors.filters.tree
Class SimpleFilterLogicTreeAdapter

com.sas.dataselectors.filters.tree.SimpleFilterLogicTreeAdapter
All Implemented Interfaces:
SimpleFilterLogicTreeInterface, com.sas.dataselectors.filters.tree.ExtendedNegationLogicInterface

public class SimpleFilterLogicTreeAdapter
implements SimpleFilterLogicTreeInterface, com.sas.dataselectors.filters.tree.ExtendedNegationLogicInterface

TODO Supply JavaDoc for class


Field Summary
 
Fields inherited from interface com.sas.dataselectors.filters.SimpleFilterLogicTreeInterface
AND, OR
 
Constructor Summary
SimpleFilterLogicTreeAdapter(SimpleFilterLogicTree logic)
           
SimpleFilterLogicTreeAdapter(SimpleFilterLogicTree logic, com.sas.util.transforms.TransformInterface inTransform, com.sas.util.transforms.TransformInterface outTransform)
           
 
Method Summary
 void add(FilterLogicBaseNodeInterface rootNode)
          Appends the given logic tree structure to this one.
 void add(SimpleFilterLogicTreeInterface tree)
          Appends the given logic tree to this one.
 void addLeafAt(int index, FilterLogicTestNodeInterface leaf)
          Add a new test node at the given index in the list of understood test nodes.
 boolean areAllNodesUnderstood()
          Returns TRUE if all leaf nodes in the tree have been marked as "understood", FALSE otherwise.
 void cancel(java.lang.Object initialFilter)
          Returns the filter model to the state specified by the given filter object.
 boolean canGroupLeaves(int firstIndex, int lastIndex)
          Returns TRUE if the leaves (or the groups they're members of) at the given indices can be grouped together.
 void clear()
          Removes all leaves from the tree and collapses any remaining support structure.
 boolean commitTree()
          Commits any changes in the tree to the underlying native filter model.
 SimpleFilterLogicTreeInterface copy()
          Constructs and returns a copy of this tree.
 SimpleFilterLogicTreeInterface copy(boolean copyTestNodes)
          Copies the tree and optionally makes duplicates of the test nodes within it.
 FilterItemInterface findMatchingFilterItem(java.lang.Object itemObject)
          Attempts to locate and return the filter model object that matches the specified search item from the native model.
 int getFirstLeafInGroup(int memberIndex)
          Returns the index of the first leaf in the group that includes the leaf at the given index.
 com.sas.util.transforms.TransformInterface getInputTransform()
           
 int getLastLeafInGroup(int memberIndex)
          Returns the index of the last leaf in the group that includes the leaf at the given index.
 FilterLogicTestNodeInterface getLeafAt(int index)
          Returns the test node at the given index.
 java.lang.String getLeafConditionalRelationType(int index)
          Returns the conditional relation type (AND/OR) between the leaf at the given index and the leaf at the next index.
 SimpleFilterLogicTree getLogicTree()
           
 com.sas.util.transforms.TransformInterface getOutputTransform()
           
 FilterLogicBaseNodeInterface getRoot()
          Returns the root node of the logic tree.
 java.lang.Object getRootFilterItem()
          Returns the root native filter object.
 java.util.List getUnderstoodTestNodeList()
          Returns the list of understood nodes in the tree.
 void groupLeaves(int startIndex, int endIndex)
          Groups the leaves (including any groups they are members of) at the specified locations together (along with any nodes in between them).
 boolean isLeafGrouped(int index)
          Returns TRUE if the leaf at the given index is part of a group.
 boolean isLeafNegated(int index)
          Returns TRUE if the leaf at the given index or group that leaf is a member of is negated, FALSE otherwise.
 void moveLeafDown(int index)
          Moves the leaf at the given index down one.
 void moveLeafUp(int index)
          Moves the leaf at the given index up one.
 void refreshNodeList()
          Refreshes the list of leaf nodes in the tree.
 FilterLogicTestNodeInterface removeLeafAt(int index)
          Removes the test node at the given index.
 void setFilterObject(java.lang.Object filterObject)
           
 void setInputTransform(com.sas.util.transforms.TransformInterface inTransform)
           
 FilterLogicTestNodeInterface setLeafAt(int index, FilterLogicTestNodeInterface leaf)
          Sets the test node at the given index in the list of understood test nodes.
 void setLeafConditionalRelationType(int index, java.lang.String value)
          Sets the logical relationship between the leaf at the given index and the leaf at the next index.
 void setLeafNegated(int index, boolean value)
          Sets whether the leaf at the given index or group that leaf is a member of is negated.
 void setLogicTree(SimpleFilterLogicTree logicTree)
           
 void setOutputTransform(com.sas.util.transforms.TransformInterface outTransform)
           
 FilterLogicBaseNodeInterface setRoot(FilterLogicBaseNodeInterface root)
          Sets the root tree node for this tree.
 void splitGroup(int indexOfMember)
          Splits the inner-most group containing the member at the specified index.
 

Constructor Detail

SimpleFilterLogicTreeAdapter

public SimpleFilterLogicTreeAdapter(SimpleFilterLogicTree logic)

SimpleFilterLogicTreeAdapter

public SimpleFilterLogicTreeAdapter(SimpleFilterLogicTree logic,
                                    com.sas.util.transforms.TransformInterface inTransform,
                                    com.sas.util.transforms.TransformInterface outTransform)
Method Detail

addLeafAt

public void addLeafAt(int index,
                      FilterLogicTestNodeInterface leaf)
Description copied from interface: SimpleFilterLogicTreeInterface
Add a new test node at the given index in the list of understood test nodes. The new node will be inserted at the new index.

Specified by:
addLeafAt in interface SimpleFilterLogicTreeInterface
Parameters:
index - the index in the list at which the new node will be inserted
leaf - the new node to add

setLeafAt

public FilterLogicTestNodeInterface setLeafAt(int index,
                                              FilterLogicTestNodeInterface leaf)
Description copied from interface: SimpleFilterLogicTreeInterface
Sets the test node at the given index in the list of understood test nodes.

Specified by:
setLeafAt in interface SimpleFilterLogicTreeInterface
Parameters:
index - the index in the list at which the new node will be set
leaf - the new node to put at the given index
Returns:
the old test node

removeLeafAt

public FilterLogicTestNodeInterface removeLeafAt(int index)
Description copied from interface: SimpleFilterLogicTreeInterface
Removes the test node at the given index.

Specified by:
removeLeafAt in interface SimpleFilterLogicTreeInterface
Parameters:
index - the index of the test node, in the list of understood nodes, to be removed
Returns:
the removed node

getLeafAt

public FilterLogicTestNodeInterface getLeafAt(int index)
Description copied from interface: SimpleFilterLogicTreeInterface
Returns the test node at the given index.

Specified by:
getLeafAt in interface SimpleFilterLogicTreeInterface
Parameters:
index - the index of the desired test node
Returns:
the test node at the specified index

refreshNodeList

public void refreshNodeList()
Description copied from interface: SimpleFilterLogicTreeInterface
Refreshes the list of leaf nodes in the tree.

Specified by:
refreshNodeList in interface SimpleFilterLogicTreeInterface

areAllNodesUnderstood

public boolean areAllNodesUnderstood()
Description copied from interface: SimpleFilterLogicTreeInterface
Returns TRUE if all leaf nodes in the tree have been marked as "understood", FALSE otherwise.

Specified by:
areAllNodesUnderstood in interface SimpleFilterLogicTreeInterface
Returns:
true if all nodes are understood

getUnderstoodTestNodeList

public java.util.List getUnderstoodTestNodeList()
Description copied from interface: SimpleFilterLogicTreeInterface
Returns the list of understood nodes in the tree. This list can be used to present the structure of the filter logic in a simple, flat list.

Specified by:
getUnderstoodTestNodeList in interface SimpleFilterLogicTreeInterface
Returns:
the list of understood nodes

getRootFilterItem

public java.lang.Object getRootFilterItem()
Description copied from interface: SimpleFilterLogicTreeInterface
Returns the root native filter object.

Specified by:
getRootFilterItem in interface SimpleFilterLogicTreeInterface
Returns:
the root native filter object

isLeafNegated

public boolean isLeafNegated(int index)
Description copied from interface: SimpleFilterLogicTreeInterface
Returns TRUE if the leaf at the given index or group that leaf is a member of is negated, FALSE otherwise.

Specified by:
isLeafNegated in interface SimpleFilterLogicTreeInterface
Specified by:
isLeafNegated in interface com.sas.dataselectors.filters.tree.ExtendedNegationLogicInterface
Returns:
TRUE if the leaf is negated, FALSE otherwise

setLeafNegated

public void setLeafNegated(int index,
                           boolean value)
Description copied from interface: SimpleFilterLogicTreeInterface
Sets whether the leaf at the given index or group that leaf is a member of is negated.

Specified by:
setLeafNegated in interface SimpleFilterLogicTreeInterface
Specified by:
setLeafNegated in interface com.sas.dataselectors.filters.tree.ExtendedNegationLogicInterface
value - the new negation value

getLeafConditionalRelationType

public java.lang.String getLeafConditionalRelationType(int index)
Description copied from interface: SimpleFilterLogicTreeInterface
Returns the conditional relation type (AND/OR) between the leaf at the given index and the leaf at the next index.

Specified by:
getLeafConditionalRelationType in interface SimpleFilterLogicTreeInterface
Returns:
the logical relationship between the leaf at the given index and the leaf at the next index

setLeafConditionalRelationType

public void setLeafConditionalRelationType(int index,
                                           java.lang.String value)
Description copied from interface: SimpleFilterLogicTreeInterface
Sets the logical relationship between the leaf at the given index and the leaf at the next index. Valid values are "AND" and "OR".

Specified by:
setLeafConditionalRelationType in interface SimpleFilterLogicTreeInterface
Parameters:
index - the index of the first leaf in the pair
value - the logical condition

splitGroup

public void splitGroup(int indexOfMember)
Description copied from interface: SimpleFilterLogicTreeInterface
Splits the inner-most group containing the member at the specified index.

Specified by:
splitGroup in interface SimpleFilterLogicTreeInterface
Parameters:
indexOfMember - the index of the member of the group to split

groupLeaves

public void groupLeaves(int startIndex,
                        int endIndex)
Description copied from interface: SimpleFilterLogicTreeInterface
Groups the leaves (including any groups they are members of) at the specified locations together (along with any nodes in between them).

Specified by:
groupLeaves in interface SimpleFilterLogicTreeInterface
Parameters:
startIndex - the start of the new group
endIndex - the end of the new group

moveLeafUp

public void moveLeafUp(int index)
Description copied from interface: SimpleFilterLogicTreeInterface
Moves the leaf at the given index up one. If the leaf is the first member of a group, the entire group will move up.

Specified by:
moveLeafUp in interface SimpleFilterLogicTreeInterface
Parameters:
index - the index of the leaf to move

moveLeafDown

public void moveLeafDown(int index)
Description copied from interface: SimpleFilterLogicTreeInterface
Moves the leaf at the given index down one. If the leaf is the last member of a group, the entire group will move down.

Specified by:
moveLeafDown in interface SimpleFilterLogicTreeInterface
Parameters:
index - the index of the leaf to move

isLeafGrouped

public boolean isLeafGrouped(int index)
Description copied from interface: SimpleFilterLogicTreeInterface
Returns TRUE if the leaf at the given index is part of a group.

Specified by:
isLeafGrouped in interface SimpleFilterLogicTreeInterface
Parameters:
index - the index in the list of understood nodes of the leaf to check
Returns:
boolean TRUE if the leaf is part of a group, FALSE otherwise.

canGroupLeaves

public boolean canGroupLeaves(int firstIndex,
                              int lastIndex)
Description copied from interface: SimpleFilterLogicTreeInterface
Returns TRUE if the leaves (or the groups they're members of) at the given indices can be grouped together.

Specified by:
canGroupLeaves in interface SimpleFilterLogicTreeInterface
Parameters:
firstIndex - the index of the first leaf selected
lastIndex - the index of the last leaf selected
Returns:
TRUE if the leaves (or the groups they're members of) at the given indices can be grouped together.

clear

public void clear()
Description copied from interface: SimpleFilterLogicTreeInterface
Removes all leaves from the tree and collapses any remaining support structure.

Specified by:
clear in interface SimpleFilterLogicTreeInterface

commitTree

public boolean commitTree()
Description copied from interface: SimpleFilterLogicTreeInterface
Commits any changes in the tree to the underlying native filter model.

Specified by:
commitTree in interface SimpleFilterLogicTreeInterface
Returns:
TRUE if the native filter model was updated successfully, FALSE otherwise

cancel

public void cancel(java.lang.Object initialFilter)
Description copied from interface: SimpleFilterLogicTreeInterface
Returns the filter model to the state specified by the given filter object.

Specified by:
cancel in interface SimpleFilterLogicTreeInterface
Parameters:
initialFilter - the initial filter state to return to

setFilterObject

public void setFilterObject(java.lang.Object filterObject)

copy

public SimpleFilterLogicTreeInterface copy()
Description copied from interface: SimpleFilterLogicTreeInterface
Constructs and returns a copy of this tree.

Specified by:
copy in interface SimpleFilterLogicTreeInterface
Returns:
the duplicate logic tree

copy

public SimpleFilterLogicTreeInterface copy(boolean copyTestNodes)
Description copied from interface: SimpleFilterLogicTreeInterface
Copies the tree and optionally makes duplicates of the test nodes within it.

Specified by:
copy in interface SimpleFilterLogicTreeInterface
Parameters:
copyTestNodes - TRUE if the test nodes in this tree should be duplicated
Returns:
A new tree

getRoot

public FilterLogicBaseNodeInterface getRoot()
Description copied from interface: SimpleFilterLogicTreeInterface
Returns the root node of the logic tree.

Specified by:
getRoot in interface SimpleFilterLogicTreeInterface
Returns:
the root node of the tree

setRoot

public FilterLogicBaseNodeInterface setRoot(FilterLogicBaseNodeInterface root)
Description copied from interface: SimpleFilterLogicTreeInterface
Sets the root tree node for this tree.

Specified by:
setRoot in interface SimpleFilterLogicTreeInterface
Parameters:
root - the new root node of the tree
Returns:
the old root node or null if none existed

findMatchingFilterItem

public FilterItemInterface findMatchingFilterItem(java.lang.Object itemObject)
Description copied from interface: SimpleFilterLogicTreeInterface
Attempts to locate and return the filter model object that matches the specified search item from the native model.

Specified by:
findMatchingFilterItem in interface SimpleFilterLogicTreeInterface
Parameters:
itemObject - the search item
Returns:
the matching filter item or null if none was found

getFirstLeafInGroup

public int getFirstLeafInGroup(int memberIndex)
Description copied from interface: SimpleFilterLogicTreeInterface
Returns the index of the first leaf in the group that includes the leaf at the given index.

Specified by:
getFirstLeafInGroup in interface SimpleFilterLogicTreeInterface
Parameters:
memberIndex - the index of the node that is a member of the group to return the index of its first leaf
Returns:
-1 if ungrouped, otherwise the index of the first leaf in the specified group

getLastLeafInGroup

public int getLastLeafInGroup(int memberIndex)
Description copied from interface: SimpleFilterLogicTreeInterface
Returns the index of the last leaf in the group that includes the leaf at the given index.

Specified by:
getLastLeafInGroup in interface SimpleFilterLogicTreeInterface
Parameters:
memberIndex - the index of the node that is a member of the group to return the index of its last leaf
Returns:
-1 if ungrouped, otherwise the index of the last leaf in the specified group

getInputTransform

public com.sas.util.transforms.TransformInterface getInputTransform()
Returns:
Returns the inTransform.

setInputTransform

public void setInputTransform(com.sas.util.transforms.TransformInterface inTransform)
Parameters:
inTransform - The inTransform to set.

getOutputTransform

public com.sas.util.transforms.TransformInterface getOutputTransform()
Returns:
Returns the outTransform.

setOutputTransform

public void setOutputTransform(com.sas.util.transforms.TransformInterface outTransform)
Parameters:
outTransform - The outTransform to set.

getLogicTree

public SimpleFilterLogicTree getLogicTree()
Returns:
Returns the logicTree.

setLogicTree

public void setLogicTree(SimpleFilterLogicTree logicTree)
Parameters:
logicTree - The logicTree to set.

add

public void add(SimpleFilterLogicTreeInterface tree)
Description copied from interface: SimpleFilterLogicTreeInterface
Appends the given logic tree to this one.

Specified by:
add in interface SimpleFilterLogicTreeInterface
Parameters:
tree - the tree to add

add

public void add(FilterLogicBaseNodeInterface rootNode)
Description copied from interface: SimpleFilterLogicTreeInterface
Appends the given logic tree structure to this one.

Specified by:
add in interface SimpleFilterLogicTreeInterface



Copyright © 2009 SAS Institute Inc. All Rights Reserved.