Drools :: Core 6.1.0.Beta1

org.drools.core.util
Class AbstractBitwiseHierarchyImpl<H,J extends LatticeElement<H>>

java.lang.Object
  extended by org.drools.core.util.AbstractBitwiseHierarchyImpl<H,J>
All Implemented Interfaces:
Externalizable, Serializable, CodedHierarchy<H>
Direct Known Subclasses:
AbstractCodedHierarchyImpl, TypeHierarchy

public abstract class AbstractBitwiseHierarchyImpl<H,J extends LatticeElement<H>>
extends Object
implements Externalizable, CodedHierarchy<H>

See Also:
Serialized Form

Nested Class Summary
protected static class AbstractBitwiseHierarchyImpl.HierCodeComparator
           
 
Field Summary
protected  boolean fixedRoot
           
protected  SortedMap<BitSet,J> line
           
 
Constructor Summary
AbstractBitwiseHierarchyImpl()
           
 
Method Summary
protected  void add(J node)
           
 void clear()
           
protected  boolean contains(J node)
           
 BitSet getCode(H val)
           
 H getMember(BitSet key)
           
protected abstract  J getNode(H name)
           
protected  J getNodeByKey(BitSet key)
           
protected  Collection<J> getNodes()
           
 Map<H,BitSet> getSortedMap()
           
 List<H> getSortedMembers()
           
 boolean hasKey(BitSet key)
           
 Collection<H> immediateChildren(BitSet key)
          * Return the "ceiling" of the key's descendants, excluding the element whose code is key, if any
 Collection<H> 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<H> vals)
           
 Collection<H> lowerBorder(BitSet key)
          Return the "ceiling" of the key's descendants, up to and including the element whose code is key
 Collection<H> lowerDescendants(BitSet key)
          Returns all elements whose code is a descendant of key
 BitSet meetCode(Collection<BitSet> codes)
           
 BitSet metMembersCode(Collection<H> vals)
           
protected  int numBit(BitSet x)
           
 Collection<H> parents(BitSet x)
           
 Collection<H> parents(H x)
           
protected abstract  Collection<H> parentValues(J node)
           
 void readExternal(ObjectInput objectInput)
           
protected  void remove(J node)
           
 void removeMember(BitSet key)
           
 void removeMember(H val)
           
 int size()
           
static BitSet stringToBitSet(String s)
           
 int superset(BitSet n1, BitSet n2)
           
static boolean supersetOrEqualset(BitSet n1, BitSet n2)
           
protected  String toBinaryString(BitSet mask)
           
protected  String toBinaryString(BitSet mask, int len)
           
 Collection<H> upperAncestors(BitSet key)
          Returns all elements whose code is an ancestor of key
 Collection<H> 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
 
Methods inherited from interface org.drools.core.util.CodedHierarchy
addMember, ancestors, ancestors, children, children, descendants, descendants
 

Field Detail

line

protected SortedMap<BitSet,J extends LatticeElement<H>> line

fixedRoot

protected boolean fixedRoot
Constructor Detail

AbstractBitwiseHierarchyImpl

public AbstractBitwiseHierarchyImpl()
Method Detail

size

public int size()
Specified by:
size in interface CodedHierarchy<H>

getNodeByKey

protected J getNodeByKey(BitSet key)

getNode

protected abstract J getNode(H name)

remove

protected void remove(J node)

contains

protected boolean contains(J node)

getCode

public BitSet getCode(H val)
Specified by:
getCode in interface CodedHierarchy<H>

metMembersCode

public BitSet metMembersCode(Collection<H> vals)
Specified by:
metMembersCode in interface CodedHierarchy<H>

jointMembersCode

public BitSet jointMembersCode(Collection<H> vals)
Specified by:
jointMembersCode in interface CodedHierarchy<H>

meetCode

public BitSet meetCode(Collection<BitSet> codes)
Specified by:
meetCode in interface CodedHierarchy<H>

joinCode

public BitSet joinCode(Collection<BitSet> codes)
Specified by:
joinCode in interface CodedHierarchy<H>

getSortedMembers

public List<H> getSortedMembers()
Specified by:
getSortedMembers in interface CodedHierarchy<H>

upperAncestors

public Collection<H> upperAncestors(BitSet key)
Description copied from interface: CodedHierarchy
Returns all elements whose code is an ancestor of key

Specified by:
upperAncestors in interface CodedHierarchy<H>
Returns:

lowerBorder

public Collection<H> 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<H>
Parameters:
key - a key, possibly the meet of a number of member keys
Returns:

immediateChildren

public Collection<H> 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<H>
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)

superset

public int superset(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

stringToBitSet

public static BitSet stringToBitSet(String s)

removeMember

public void removeMember(H val)
Specified by:
removeMember in interface CodedHierarchy<H>

removeMember

public void removeMember(BitSet key)
Specified by:
removeMember in interface CodedHierarchy<H>

getSortedMap

public Map<H,BitSet> getSortedMap()
Specified by:
getSortedMap in interface CodedHierarchy<H>

hasKey

public boolean hasKey(BitSet key)
Specified by:
hasKey in interface CodedHierarchy<H>

lowerDescendants

public Collection<H> lowerDescendants(BitSet key)
Description copied from interface: CodedHierarchy
Returns all elements whose code is a descendant of key

Specified by:
lowerDescendants in interface CodedHierarchy<H>
Returns:

parentValues

protected abstract Collection<H> parentValues(J node)

parents

public Collection<H> parents(H x)
Specified by:
parents in interface CodedHierarchy<H>

parents

public Collection<H> parents(BitSet x)
Specified by:
parents in interface CodedHierarchy<H>

upperBorder

public Collection<H> 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<H>
Parameters:
key - a key, possibly the meet of a number of member keys
Returns:

immediateParents

public Collection<H> 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<H>
Parameters:
key - a key, possibly the meet of a number of member keys
Returns:

isEmpty

public boolean isEmpty()

clear

public void clear()

add

protected void add(J node)

getNodes

protected Collection<J> getNodes()

getMember

public H getMember(BitSet key)
Specified by:
getMember in interface CodedHierarchy<H>

Drools :: Core 6.1.0.Beta1

Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.