T
- the feature-input type for all features in the store.public class NamedFeatureStore<T extends FeatureInput> extends Object implements Iterable<NamedBean<Feature<T>>>
Feature
s, each with an associated name, with list-like access and map-like access.
Each feature is stored in an ordered manner, and zero-indexed.
A map between the name of each feature, and the feature's index position is simultaneously maintained.
If the names of two or more Feature
s are identical, only a single Feature
will
be retrieved by name. The list-access remains unaffected.
Constructor and Description |
---|
NamedFeatureStore() |
Modifier and Type | Method and Description |
---|---|
void |
add(String name,
Feature<T> feature)
Adds a named-feature to the store.
|
NamedFeatureStore<T> |
duplicate()
Deep-copies the store, including duplicating each feature.
|
FeatureNameList |
featureNames()
The names of all
Feature s in the store, in identical order to the store. |
FeatureList<T> |
features()
All
Feature s in the store, in identical order. |
NamedBean<Feature<T>> |
get(int index)
Gets a feature at a particular position.
|
NamedBean<Feature<T>> |
get(String name)
Gets a feature corresponding to a particular name.
|
Iterator<NamedBean<Feature<T>>> |
iterator() |
int |
size()
The total number of
Feature s in the store. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public void add(String name, Feature<T> feature)
name
- name of the feature.feature
- the feature to add (whose customName will be overridden with the name).public NamedBean<Feature<T>> get(int index)
index
- the position to retrieve (zero-indexed).NamedBean
that contains it.public NamedBean<Feature<T>> get(String name)
name
- the name of the feature.NamedBean
that contains it.public FeatureList<T> features()
Feature
s in the store, in identical order.Feature
instances.public FeatureNameList featureNames()
Feature
s in the store, in identical order to the store.FeatureNameList
corresponding to the names of the features.public int size()
Feature
s in the store.public NamedFeatureStore<T> duplicate()
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.