Package weka.classifiers.lazy.AM.data
Interface Supracontext
-
- All Known Implementing Classes:
BasicSupra,ClassifiedSupra,Concept,LinkedLatticeNode
public interface SupracontextA supracontext contains a set ofSubcontextswhich have certain commonalities in theirLabels. Classifying data sets with analogical modeling tends to create many supracontexts with the exact same set of subcontexts. To save time and space, duplicate supracontexts should be kept track of using the count instead of by saving separate Supracontext objects. The count is stored in aBigIntegerobject and starts out asoneand is never allowed to fall belowzero, which indicates that the object should be discarded.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidadd(Subcontext sub)Add a subcontext to this supracontext.Supracontextcopy()Return an exact, deep copy of the supracontext.booleanequals(java.lang.Object other)Two Supracontexts are equal if they are of the same class and contain the same subcontexts.default LabelgetContext()Retrieve the supracontextual context, represented with aLabelobject.java.math.BigIntegergetCount()java.util.Set<Subcontext>getData()inthashCode()The hashcode depends solely on the set of subcontexts contained in a supracontext.booleanisEmpty()voidsetCount(java.math.BigInteger count)Set the count of the supracontext.
-
-
-
Method Detail
-
copy
Supracontext copy()
Return an exact, deep copy of the supracontext. The new object should be an instance of the same class as the calling object.- Returns:
- a deep copy of this supracontext.
-
getData
java.util.Set<Subcontext> getData()
- Returns:
- an unmodifiable view of the set of subcontexts contained in this supracontext.
-
add
void add(Subcontext sub)
Add a subcontext to this supracontext.- Parameters:
sub- Subcontext to add to the supracontext.
-
isEmpty
boolean isEmpty()
- Returns:
- true if this supracontext contains no subcontexts; false otherwise.
-
getCount
java.math.BigInteger getCount()
- Returns:
- the number of copies of this supracontext contained in the lattice
-
setCount
void setCount(java.math.BigInteger count)
Set the count of the supracontext.- Parameters:
count- the count- Throws:
java.lang.IllegalArgumentException- if c is null or less thanBigInteger.ZERO
-
getContext
default Label getContext()
Retrieve the supracontextual context, represented with aLabelobject. Label mismatches should be interpreted as "contained subcontexts may or may not match for this attribute, while matches should be regarded as "all contained subcontexts matched for this attribute". The running time for this default implementation is linear in the number of contained subcontexts.- Returns:
- The context for this supracontext, or
nullif the subcontexts are empty
-
equals
boolean equals(java.lang.Object other)
Two Supracontexts are equal if they are of the same class and contain the same subcontexts.- Overrides:
equalsin classjava.lang.Object
-
hashCode
int hashCode()
The hashcode depends solely on the set of subcontexts contained in a supracontext.- Overrides:
hashCodein classjava.lang.Object
-
-