|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.indiana.iucbrf.feature.AbstractFeatureCollection
public abstract class AbstractFeatureCollection
This class makes some assumptions that are general enough to apply to most FeatureCollection implementations.
| Nested Class Summary | |
|---|---|
class |
AbstractFeatureCollection.FeatureCollectionPanel
|
class |
AbstractFeatureCollection.FeatureCollectionTableModel
|
static class |
AbstractFeatureCollection.Key_KeyText_EntryIterator
An iterator whose keys are FeatureKeys and whose values are the toString()s of those FeatureKeys. |
static interface |
AbstractFeatureCollection.KeyTextEntryIterator
The Object returned by next() is a Map.Entry with a FeatureKey key and a String value (some kind of description of that key). |
static class |
AbstractFeatureCollection.Ordered_Key_DescText_EntryIterator
An iterator over EntryImpl objects, whose keys are FeatureKeys and whose values are the textual descriptions of the features with those FeatureKeys. |
| Field Summary | |
|---|---|
protected int |
collectionType
|
protected boolean |
containsEstimates
True if this collection contains feature estimates. |
protected java.lang.String |
customTitle
The custom title, if set, overrules the standard title in the domain. |
static int |
DEFAULT_VARIABLE_TYPE
|
static javax.swing.border.Border |
INSETS_BORDER
|
protected boolean |
isReferenceSolution
|
protected java.util.HashMap |
keyToConf
Maps FeatureKey to the confidence (Double) in that feature value. |
protected java.util.ArrayList |
listeners
|
| Fields inherited from interface edu.indiana.iucbrf.feature.FeatureCollection |
|---|
PROBLEM_FEATURE_COLLECTION, SOLUTION_FEATURE_COLLECTION |
| Fields inherited from interface edu.indiana.util.swing.SwingRepresentable |
|---|
TITLE_FONT |
| Fields inherited from interface edu.indiana.iucbrf.feature.Feature |
|---|
DEFAULT_FEATURE_DIFFERENTIATORS_BY_VARTYPE, FEATURE_VALUE_FONT, INTERVAL_VARIABLE, LABEL_WIDTH, NOMINAL_VARIABLE, ORDINAL_VARIABLE, OTHER_VARIABLE |
| Fields inherited from interface edu.indiana.util.swing.SwingRepresentable |
|---|
TITLE_FONT |
| Constructor Summary | |
|---|---|
protected |
AbstractFeatureCollection()
Creates a new instance of AbstractFeatureCollection |
|
AbstractFeatureCollection(double[] featureValues,
Domain domain,
int collectionType)
Assumes featureValues are in the correct order, either all are known for this domain or there are fewer featureValues than feature slots, and the last feature slots will not be filled in. |
|
AbstractFeatureCollection(DoubleCollection someFeatureValues,
Domain domain,
int collectionType)
|
|
AbstractFeatureCollection(Feature[] features,
Domain domain,
int collectionType)
Assumes featureValues are in the correct order, either all are known for this domain or there are fewer featureValues than feature slots, and the last feature slots will not be filled in. |
|
AbstractFeatureCollection(FeatureKey[] keys,
Feature[] features,
int collectionType)
|
|
AbstractFeatureCollection(int collectionType)
|
|
AbstractFeatureCollection(int collectionType,
int initialCapacity)
|
| Method Summary | |
|---|---|
void |
addEstimatedFeature(FeatureKey featureKey,
Feature additional_feature,
double confidence,
Domain domain)
Add an estimated feature to this FeatureCollection. |
void |
addFeature(FeatureKey featureKey,
Feature additional_feature,
Domain domain)
Add a feature to this FeatureCollection. |
void |
addFeatureCollectionListener(FeatureCollectionListener cll)
|
protected abstract void |
addFeatureImpl(FeatureKey key,
Feature feature)
Add a feature to the collection. |
void |
adjust(double adjustAmount)
|
void |
clearAllEstimates()
Remove all estimated features from this collection. |
void |
clearEstimate(FeatureKey key)
Remove the given estimated feature from this collection. |
void |
clearFeatures()
Clear all features in this FeatureCollection. |
protected abstract void |
clearFeaturesImpl()
Clear all features in this FeatureCollection. |
java.lang.Object |
clone()
|
protected void |
commonInit(int collectionType,
int initialCapacity)
|
int |
compareTo(java.lang.Object other)
|
boolean |
containsEstimates()
|
boolean |
equals(java.lang.Object other)
|
protected void |
fireFeatureAdded(FeatureKey key)
|
protected void |
fireFeatureChange(FeatureKey key)
|
protected void |
fireFeatureRemoved(FeatureKey key)
|
protected void |
fireFeatureReplaced(FeatureKey key)
|
protected void |
fireFeaturesCleared()
|
int |
getCollectionType()
|
double |
getConfidence(FeatureKey key)
Get the confidence in the value of a feature. |
java.lang.String |
getCustomTitle()
Returns null if no custom title is set (in which case, the standard title defined in the domain should be used. |
int |
getDefaultVariableType()
Get the variable type (for example, Feature.NOMINAL_VARIABLE, Feature.ORDINAL_VARIABLE, Feature.INTERVAL_VARIABLE, or Feature.OTHER_VARIABLE). |
java.util.ArrayList |
getFeaturesMatching(java.lang.Class feature_class)
Get the features that are of the given class. |
boolean |
getIsReferenceSolution()
|
int |
getKnownFeatureCount()
Get the number of known features in this collection (not including estimated features). |
protected java.lang.String |
getTitle(Domain domain)
|
protected abstract void |
initializeCollection(int initialCapacity)
Override to construct needed object (may ignore initialCapacity if not applicable) |
boolean |
isDefinitelyKnown(FeatureKey key)
|
boolean |
isEstimated(FeatureKey key)
|
Feature |
midpoint(Feature other_feature)
|
Feature |
removeFeature(FeatureKey key)
Remove the feature at the given index. |
void |
removeFeatureCollectionListener(FeatureCollectionListener cll)
|
protected abstract Feature |
removeFeatureImpl(FeatureKey key)
Remove the feature at the given index from this FeatureCollection. |
Feature |
replaceFeature(FeatureKey key,
Feature replacement_feature,
Domain domain)
Replace the feature at the given index with another feature. |
protected abstract Feature |
replaceFeatureImpl(FeatureKey key,
Feature feature)
Set the feature at an index in the collection to the given feature. |
protected void |
setConfidence(FeatureKey key,
double confidence)
Set the confidence c in this feature. |
void |
setCustomTitle(java.lang.String customTitle)
Set a custom title to override the standard title (defined in the domain) for this FeatureCollection. |
void |
setIsReferenceSolution(boolean isReferenceSolution)
|
java.lang.String |
toString()
For an ordered display, call toString(Domain). |
java.lang.String |
toString(Domain domain)
|
java.lang.String |
toString(FeatureValueFormat formatter)
|
javax.swing.JComponent |
toSwing(Domain domain)
|
javax.swing.JComponent |
toSwing(FeatureValueFormat formatter)
|
javax.swing.JComponent |
toSwing(int detailLevel)
Does not print nice labels for the features: only prints the keys |
AbstractFeatureCollection.FeatureCollectionPanel |
toSwing(java.util.Iterator entryIter)
|
AbstractFeatureCollection.FeatureCollectionPanel |
toSwing(java.util.Iterator entryIter,
Domain domain)
If the domain is not known, null may be passed, but SwingRepresentableWithDomain Features may not display properly |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface edu.indiana.iucbrf.feature.FeatureCollection |
|---|
entryIterator, featureIterator, getFeature, getKeySet, getTotalFeatureCount, keyIterator |
| Methods inherited from interface edu.indiana.iucbrf.feature.Feature |
|---|
getValue, setValue |
| Field Detail |
|---|
public static final int DEFAULT_VARIABLE_TYPE
protected transient java.util.ArrayList listeners
protected int collectionType
protected boolean isReferenceSolution
protected java.lang.String customTitle
protected java.util.HashMap keyToConf
protected boolean containsEstimates
public static final javax.swing.border.Border INSETS_BORDER
| Constructor Detail |
|---|
protected AbstractFeatureCollection()
public AbstractFeatureCollection(int collectionType)
public AbstractFeatureCollection(int collectionType,
int initialCapacity)
public AbstractFeatureCollection(double[] featureValues,
Domain domain,
int collectionType)
public AbstractFeatureCollection(Feature[] features,
Domain domain,
int collectionType)
public AbstractFeatureCollection(FeatureKey[] keys,
Feature[] features,
int collectionType)
public AbstractFeatureCollection(DoubleCollection someFeatureValues,
Domain domain,
int collectionType)
| Method Detail |
|---|
protected void commonInit(int collectionType,
int initialCapacity)
protected abstract void initializeCollection(int initialCapacity)
public int getCollectionType()
getCollectionType in interface FeatureCollectionpublic int getDefaultVariableType()
Feature
getDefaultVariableType in interface Featurepublic void setIsReferenceSolution(boolean isReferenceSolution)
setIsReferenceSolution in interface FeatureCollectionpublic boolean getIsReferenceSolution()
getIsReferenceSolution in interface FeatureCollectionpublic java.lang.String getCustomTitle()
getCustomTitle in interface FeatureCollectionpublic void setCustomTitle(java.lang.String customTitle)
setCustomTitle in interface FeatureCollectionpublic double getConfidence(FeatureKey key)
getConfidence in interface FeatureCollection
protected void setConfidence(FeatureKey key,
double confidence)
public boolean isDefinitelyKnown(FeatureKey key)
isDefinitelyKnown in interface FeatureCollectionpublic boolean isEstimated(FeatureKey key)
isEstimated in interface FeatureCollectionpublic int getKnownFeatureCount()
FeatureCollection
getKnownFeatureCount in interface FeatureCollectionpublic void clearAllEstimates()
clearAllEstimates in interface FeatureCollectionpublic void clearEstimate(FeatureKey key)
clearEstimate in interface FeatureCollectionpublic boolean containsEstimates()
containsEstimates in interface FeatureCollectionpublic java.util.ArrayList getFeaturesMatching(java.lang.Class feature_class)
FeatureCollection
getFeaturesMatching in interface FeatureCollection
public void addEstimatedFeature(FeatureKey featureKey,
Feature additional_feature,
double confidence,
Domain domain)
FeatureCollection
addEstimatedFeature in interface FeatureCollectionadditional_feature - The feature to add.
public void addFeature(FeatureKey featureKey,
Feature additional_feature,
Domain domain)
FeatureCollection
addFeature in interface FeatureCollectionadditional_feature - The feature to add.
public Feature replaceFeature(FeatureKey key,
Feature replacement_feature,
Domain domain)
FeatureCollection
replaceFeature in interface FeatureCollectionreplacement_feature - The feature to replace the one at the index.public void clearFeatures()
FeatureCollection
clearFeatures in interface FeatureCollectionpublic Feature removeFeature(FeatureKey key)
FeatureCollection
removeFeature in interface FeatureCollectionkey - The key of the feature to remove.public boolean equals(java.lang.Object other)
equals in interface FeatureCollectionequals in class java.lang.Objectpublic int compareTo(java.lang.Object other)
compareTo in interface java.lang.Comparablepublic javax.swing.JComponent toSwing(Domain domain)
toSwing in interface SwingRepresentableWithDomainpublic java.lang.String toString(FeatureValueFormat formatter)
toString in interface Featurepublic javax.swing.JComponent toSwing(FeatureValueFormat formatter)
toSwing in interface Featurepublic javax.swing.JComponent toSwing(int detailLevel)
toSwing in interface SwingRepresentableprotected java.lang.String getTitle(Domain domain)
public AbstractFeatureCollection.FeatureCollectionPanel toSwing(java.util.Iterator entryIter,
Domain domain)
entryIter - should return entries with a FeatureKey key and a feature description (String) value.
public AbstractFeatureCollection.FeatureCollectionPanel toSwing(java.util.Iterator entryIter)
public java.lang.String toString(Domain domain)
toString in interface FeatureCollectionpublic java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.Object clone()
clone in interface Featureclone in class java.lang.Objectpublic Feature midpoint(Feature other_feature)
midpoint in interface Feature
public void adjust(double adjustAmount)
throws CouldNotAdjustException,
java.lang.UnsupportedOperationException
adjust in interface FeatureCouldNotAdjustException
java.lang.UnsupportedOperationExceptionpublic void addFeatureCollectionListener(FeatureCollectionListener cll)
addFeatureCollectionListener in interface FeatureCollectionpublic void removeFeatureCollectionListener(FeatureCollectionListener cll)
removeFeatureCollectionListener in interface FeatureCollectionprotected void fireFeatureChange(FeatureKey key)
protected void fireFeatureReplaced(FeatureKey key)
protected void fireFeaturesCleared()
protected void fireFeatureRemoved(FeatureKey key)
protected void fireFeatureAdded(FeatureKey key)
protected abstract void addFeatureImpl(FeatureKey key,
Feature feature)
feature - The feature to add
protected abstract Feature replaceFeatureImpl(FeatureKey key,
Feature feature)
protected abstract void clearFeaturesImpl()
protected abstract Feature removeFeatureImpl(FeatureKey key)
index - The index of the feature to be removed.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||