org.drools.util
Class AbstractCodedHierarchyImpl<T>
java.lang.Object
org.drools.util.AbstractCodedHierarchyImpl<T>
- All Implemented Interfaces:
- Externalizable, Serializable, CodedHierarchy<T>
- Direct Known Subclasses:
- CodedHierarchyImpl, TypeHierarchy
public abstract class AbstractCodedHierarchyImpl<T>
- extends Object
- implements CodedHierarchy<T>, Externalizable
- See Also:
- Serialized Form
|
Method Summary |
protected void |
add(AbstractCodedHierarchyImpl.HierNode<T> node)
|
void |
addMember(T val,
BitSet key)
|
protected Set<AbstractCodedHierarchyImpl.HierNode<T>> |
ancestorNodes(AbstractCodedHierarchyImpl.HierNode<T> x)
|
Collection<T> |
ancestors(BitSet key)
|
Collection<T> |
ancestors(T x)
|
protected Collection<T> |
ancestorValues(AbstractCodedHierarchyImpl.HierNode<T> node)
|
Collection<T> |
children(BitSet key)
|
Collection<T> |
children(T x)
|
protected Collection<T> |
childrenValues(AbstractCodedHierarchyImpl.HierNode<T> node)
|
void |
clear()
|
protected boolean |
contains(AbstractCodedHierarchyImpl.HierNode<T> node)
|
protected Set<AbstractCodedHierarchyImpl.HierNode<T>> |
descendantNodes(AbstractCodedHierarchyImpl.HierNode<T> y)
|
Collection<T> |
descendants(BitSet key)
|
Collection<T> |
descendants(T y)
|
protected Collection<T> |
descendantValues(AbstractCodedHierarchyImpl.HierNode<T> node)
|
BitSet |
getCode(T val)
|
T |
getMember(BitSet key)
|
protected abstract AbstractCodedHierarchyImpl.HierNode<T> |
getNode(T name)
|
protected AbstractCodedHierarchyImpl.HierNode<T> |
getNodeByKey(BitSet key)
|
protected Collection<AbstractCodedHierarchyImpl.HierNode<T>> |
getNodes()
|
Map<T,BitSet> |
getSortedMap()
|
List<T> |
getSortedMembers()
|
boolean |
hasKey(BitSet key)
|
Collection<T> |
immediateChildren(BitSet key)
* Return the "ceiling" of the key's descendants, excluding the element whose code is key, if any |
Collection<T> |
immediateParents(BitSet key)
Return the "floor" of the key's ancetsors, down to and excluding the element whose code is key |
boolean |
isEmpty()
|
BitSet |
joinCode(Collection<BitSet> codes)
|
BitSet |
jointMembersCode(Collection<T> vals)
|
Collection<T> |
lowerBorder(BitSet key)
Return the "ceiling" of the key's descendants, up to and including the element whose code is key |
Collection<T> |
lowerDescendants(BitSet key)
Returns all elements whose code is a descendant of key |
BitSet |
meetCode(Collection<BitSet> codes)
|
BitSet |
metMembersCode(Collection<T> vals)
|
protected int |
numBit(BitSet x)
|
Collection<T> |
parents(BitSet x)
|
Collection<T> |
parents(T x)
|
protected Collection<T> |
parentValues(AbstractCodedHierarchyImpl.HierNode<T> node)
|
void |
readExternal(ObjectInput objectInput)
|
protected void |
remove(AbstractCodedHierarchyImpl.HierNode<T> node)
|
void |
removeMember(BitSet key)
|
void |
removeMember(T val)
|
int |
size()
|
static BitSet |
stringToBitSet(String s)
|
static boolean |
supersetOrEqualset(BitSet n1,
BitSet n2)
|
protected String |
toBinaryString(BitSet mask)
|
protected String |
toBinaryString(BitSet mask,
int len)
|
Collection<T> |
upperAncestors(BitSet key)
Returns all elements whose code is an ancestor of key |
Collection<T> |
upperBorder(BitSet key)
Return the "floor" of the key's ancestors, down to and including the element whose code is key, if any |
void |
writeExternal(ObjectOutput objectOutput)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
line
protected SortedMap<BitSet,AbstractCodedHierarchyImpl.HierNode<T>> line
fixedRoot
protected boolean fixedRoot
AbstractCodedHierarchyImpl
public AbstractCodedHierarchyImpl()
size
public int size()
- Specified by:
size in interface CodedHierarchy<T>
hasKey
public boolean hasKey(BitSet key)
- Specified by:
hasKey in interface CodedHierarchy<T>
getNodeByKey
protected AbstractCodedHierarchyImpl.HierNode<T> getNodeByKey(BitSet key)
getNode
protected abstract AbstractCodedHierarchyImpl.HierNode<T> getNode(T name)
add
protected void add(AbstractCodedHierarchyImpl.HierNode<T> node)
remove
protected void remove(AbstractCodedHierarchyImpl.HierNode<T> node)
contains
protected boolean contains(AbstractCodedHierarchyImpl.HierNode<T> node)
getNodes
protected Collection<AbstractCodedHierarchyImpl.HierNode<T>> getNodes()
getCode
public BitSet getCode(T val)
- Specified by:
getCode in interface CodedHierarchy<T>
metMembersCode
public BitSet metMembersCode(Collection<T> vals)
- Specified by:
metMembersCode in interface CodedHierarchy<T>
jointMembersCode
public BitSet jointMembersCode(Collection<T> vals)
- Specified by:
jointMembersCode in interface CodedHierarchy<T>
meetCode
public BitSet meetCode(Collection<BitSet> codes)
- Specified by:
meetCode in interface CodedHierarchy<T>
joinCode
public BitSet joinCode(Collection<BitSet> codes)
- Specified by:
joinCode in interface CodedHierarchy<T>
getSortedMembers
public List<T> getSortedMembers()
- Specified by:
getSortedMembers in interface CodedHierarchy<T>
getSortedMap
public Map<T,BitSet> getSortedMap()
- Specified by:
getSortedMap in interface CodedHierarchy<T>
getMember
public T getMember(BitSet key)
- Specified by:
getMember in interface CodedHierarchy<T>
addMember
public void addMember(T val,
BitSet key)
- Specified by:
addMember in interface CodedHierarchy<T>
removeMember
public void removeMember(T val)
- Specified by:
removeMember in interface CodedHierarchy<T>
removeMember
public void removeMember(BitSet key)
- Specified by:
removeMember in interface CodedHierarchy<T>
parentValues
protected Collection<T> parentValues(AbstractCodedHierarchyImpl.HierNode<T> node)
parents
public Collection<T> parents(T x)
- Specified by:
parents in interface CodedHierarchy<T>
parents
public Collection<T> parents(BitSet x)
- Specified by:
parents in interface CodedHierarchy<T>
ancestors
public Collection<T> ancestors(T x)
- Specified by:
ancestors in interface CodedHierarchy<T>
ancestors
public Collection<T> ancestors(BitSet key)
- Specified by:
ancestors in interface CodedHierarchy<T>
ancestorValues
protected Collection<T> ancestorValues(AbstractCodedHierarchyImpl.HierNode<T> node)
ancestorNodes
protected Set<AbstractCodedHierarchyImpl.HierNode<T>> ancestorNodes(AbstractCodedHierarchyImpl.HierNode<T> x)
upperAncestors
public Collection<T> upperAncestors(BitSet key)
- Description copied from interface:
CodedHierarchy
- Returns all elements whose code is an ancestor of key
- Specified by:
upperAncestors in interface CodedHierarchy<T>
- Returns:
childrenValues
protected Collection<T> childrenValues(AbstractCodedHierarchyImpl.HierNode<T> node)
children
public Collection<T> children(T x)
- Specified by:
children in interface CodedHierarchy<T>
children
public Collection<T> children(BitSet key)
- Specified by:
children in interface CodedHierarchy<T>
descendantValues
protected Collection<T> descendantValues(AbstractCodedHierarchyImpl.HierNode<T> node)
descendants
public Collection<T> descendants(T y)
- Specified by:
descendants in interface CodedHierarchy<T>
descendants
public Collection<T> descendants(BitSet key)
- Specified by:
descendants in interface CodedHierarchy<T>
descendantNodes
protected Set<AbstractCodedHierarchyImpl.HierNode<T>> descendantNodes(AbstractCodedHierarchyImpl.HierNode<T> y)
lowerDescendants
public Collection<T> lowerDescendants(BitSet key)
- Description copied from interface:
CodedHierarchy
- Returns all elements whose code is a descendant of key
- Specified by:
lowerDescendants in interface CodedHierarchy<T>
- Returns:
lowerBorder
public Collection<T> lowerBorder(BitSet key)
- Description copied from interface:
CodedHierarchy
- Return the "ceiling" of the key's descendants, up to and including the element whose code is key
- Specified by:
lowerBorder in interface CodedHierarchy<T>
- Parameters:
key - a key, possibly the meet of a number of member keys
- Returns:
immediateChildren
public Collection<T> immediateChildren(BitSet key)
- Description copied from interface:
CodedHierarchy
- * Return the "ceiling" of the key's descendants, excluding the element whose code is key, if any
- Specified by:
immediateChildren in interface CodedHierarchy<T>
- Parameters:
key - a key, possibly the meet of a number of member keys
- Returns:
upperBorder
public Collection<T> upperBorder(BitSet key)
- Description copied from interface:
CodedHierarchy
- Return the "floor" of the key's ancestors, down to and including the element whose code is key, if any
- Specified by:
upperBorder in interface CodedHierarchy<T>
- Parameters:
key - a key, possibly the meet of a number of member keys
- Returns:
immediateParents
public Collection<T> immediateParents(BitSet key)
- Description copied from interface:
CodedHierarchy
- Return the "floor" of the key's ancetsors, down to and excluding the element whose code is key
- Specified by:
immediateParents in interface CodedHierarchy<T>
- Parameters:
key - a key, possibly the meet of a number of member keys
- Returns:
toBinaryString
protected String toBinaryString(BitSet mask)
toBinaryString
protected String toBinaryString(BitSet mask,
int len)
supersetOrEqualset
public static boolean supersetOrEqualset(BitSet n1,
BitSet n2)
numBit
protected int numBit(BitSet x)
writeExternal
public void writeExternal(ObjectOutput objectOutput)
throws IOException
- Specified by:
writeExternal in interface Externalizable
- Throws:
IOException
readExternal
public void readExternal(ObjectInput objectInput)
throws IOException,
ClassNotFoundException
- Specified by:
readExternal in interface Externalizable
- Throws:
IOException
ClassNotFoundException
clear
public void clear()
isEmpty
public boolean isEmpty()
stringToBitSet
public static BitSet stringToBitSet(String s)
Copyright © 2001-2013 JBoss by Red Hat. All Rights Reserved.