Package org.drools.traits.core.util
Class AbstractBitwiseHierarchyImpl<H,J extends LatticeElement<H>>
- java.lang.Object
-
- org.drools.traits.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
Nested Classes Modifier and Type Class Description protected static classAbstractBitwiseHierarchyImpl.HierCodeComparator
-
Constructor Summary
Constructors Constructor Description AbstractBitwiseHierarchyImpl()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidadd(J node)voidclear()protected booleancontains(J node)BitSetgetCode(H val)HgetMember(BitSet key)protected abstract JgetNode(H name)protected JgetNodeByKey(BitSet key)protected Collection<J>getNodes()Map<H,BitSet>getSortedMap()List<H>getSortedMembers()booleanhasKey(BitSet key)Collection<H>immediateChildren(BitSet key)* Return the "ceiling" of the key's descendants, excluding the element whose code is key, if anyCollection<H>immediateParents(BitSet key)Return the "floor" of the key's ancetsors, down to and excluding the element whose code is keybooleanisEmpty()BitSetjoinCode(Collection<BitSet> codes)BitSetjointMembersCode(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 keyCollection<H>lowerDescendants(BitSet key)Returns all elements whose code is a descendant of keyBitSetmeetCode(Collection<BitSet> codes)BitSetmetMembersCode(Collection<H> vals)protected intnumBit(BitSet x)Collection<H>parents(H x)Collection<H>parents(BitSet x)protected abstract Collection<H>parentValues(J node)voidreadExternal(ObjectInput objectInput)protected voidremove(J node)voidremoveMember(H val)voidremoveMember(BitSet key)intsize()static BitSetstringToBitSet(String s)intsuperset(BitSet n1, BitSet n2)protected StringtoBinaryString(BitSet mask)protected StringtoBinaryString(BitSet mask, int len)Collection<H>upperAncestors(BitSet key)Returns all elements whose code is an ancestor of keyCollection<H>upperBorder(BitSet key)Return the "floor" of the key's ancestors, down to and including the element whose code is key, if anyvoidwriteExternal(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.traits.core.factmodel.CodedHierarchy
addMember, ancestors, ancestors, children, children, descendants, descendants
-
-
-
-
Field Detail
-
line
protected SortedMap<BitSet,J extends LatticeElement<H>> line
-
fixedRoot
protected boolean fixedRoot
-
-
Method Detail
-
size
public int size()
- Specified by:
sizein interfaceCodedHierarchy<H>
-
remove
protected void remove(J node)
-
contains
protected boolean contains(J node)
-
getCode
public BitSet getCode(H val)
- Specified by:
getCodein interfaceCodedHierarchy<H>
-
metMembersCode
public BitSet metMembersCode(Collection<H> vals)
- Specified by:
metMembersCodein interfaceCodedHierarchy<H>
-
jointMembersCode
public BitSet jointMembersCode(Collection<H> vals)
- Specified by:
jointMembersCodein interfaceCodedHierarchy<H>
-
meetCode
public BitSet meetCode(Collection<BitSet> codes)
- Specified by:
meetCodein interfaceCodedHierarchy<H>
-
joinCode
public BitSet joinCode(Collection<BitSet> codes)
- Specified by:
joinCodein interfaceCodedHierarchy<H>
-
getSortedMembers
public List<H> getSortedMembers()
- Specified by:
getSortedMembersin interfaceCodedHierarchy<H>
-
upperAncestors
public Collection<H> upperAncestors(BitSet key)
Description copied from interface:CodedHierarchyReturns all elements whose code is an ancestor of key- Specified by:
upperAncestorsin interfaceCodedHierarchy<H>- Returns:
-
lowerBorder
public Collection<H> lowerBorder(BitSet key)
Description copied from interface:CodedHierarchyReturn the "ceiling" of the key's descendants, up to and including the element whose code is key- Specified by:
lowerBorderin interfaceCodedHierarchy<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:
immediateChildrenin interfaceCodedHierarchy<H>- Parameters:
key- a key, possibly the meet of a number of member keys- Returns:
-
numBit
protected int numBit(BitSet x)
-
writeExternal
public void writeExternal(ObjectOutput objectOutput) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
readExternal
public void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
removeMember
public void removeMember(H val)
- Specified by:
removeMemberin interfaceCodedHierarchy<H>
-
removeMember
public void removeMember(BitSet key)
- Specified by:
removeMemberin interfaceCodedHierarchy<H>
-
getSortedMap
public Map<H,BitSet> getSortedMap()
- Specified by:
getSortedMapin interfaceCodedHierarchy<H>
-
hasKey
public boolean hasKey(BitSet key)
- Specified by:
hasKeyin interfaceCodedHierarchy<H>
-
lowerDescendants
public Collection<H> lowerDescendants(BitSet key)
Description copied from interface:CodedHierarchyReturns all elements whose code is a descendant of key- Specified by:
lowerDescendantsin interfaceCodedHierarchy<H>- Returns:
-
parentValues
protected abstract Collection<H> parentValues(J node)
-
parents
public Collection<H> parents(H x)
- Specified by:
parentsin interfaceCodedHierarchy<H>
-
parents
public Collection<H> parents(BitSet x)
- Specified by:
parentsin interfaceCodedHierarchy<H>
-
upperBorder
public Collection<H> upperBorder(BitSet key)
Description copied from interface:CodedHierarchyReturn the "floor" of the key's ancestors, down to and including the element whose code is key, if any- Specified by:
upperBorderin interfaceCodedHierarchy<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:CodedHierarchyReturn the "floor" of the key's ancetsors, down to and excluding the element whose code is key- Specified by:
immediateParentsin interfaceCodedHierarchy<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:
getMemberin interfaceCodedHierarchy<H>
-
-