Package org.anchoranalysis.feature.name
Class FeatureNameList
Object
org.anchoranalysis.feature.name.FeatureNameList
public class FeatureNameList extends Object implements Iterable<String>
A list of
Strings representing feature names.- Author:
- Owen Feehan
-
Constructor Summary
Constructors Constructor Description FeatureNameList()Create with no names (an empty list).FeatureNameList(List<String> list)FeatureNameList(Stream<String> stream)Create from a stream of names. -
Method Summary
Modifier and Type Method Description voidadd(String name)Adds a feature-name.List<String>asList()Exposes the underlying list of names.FeatureNameMapToIndexcreateMapToIndex()Creates a map from the feature-names to their indices in the list.FeatureNameListduplicateShallow()Shallow copy of the current instance.Stringget(int index)Gets a name corresponding to a particular position.voidinsertBeginning(String name)Inserts a new feature-name at the beginning of the list.voidinsertBeginning(String[] names)Inserts new feature-names at the beginning of the list.Iterator<String>iterator()intsize()The number of names in the list.StringtoString()
-
Constructor Details
-
FeatureNameList
public FeatureNameList()Create with no names (an empty list). -
FeatureNameList
Create from a stream of names.- Parameters:
stream- the stream.
-
FeatureNameList
-
-
Method Details
-
asList
Exposes the underlying list of names.- Returns:
- the underlying list, which if modified, will also modify this instance.
-
createMapToIndex
Creates a map from the feature-names to their indices in the list.- Returns:
- a newly created map.
-
duplicateShallow
Shallow copy of the current instance.- Returns:
- a shallow copy.
-
toString
-
add
Adds a feature-name.- Parameters:
name- the name to add.
-
insertBeginning
Inserts a new feature-name at the beginning of the list.- Parameters:
name- feature-name to insert.
-
insertBeginning
Inserts new feature-names at the beginning of the list.- Parameters:
names- the feature-names to insert.
-
iterator
-
get
Gets a name corresponding to a particular position.- Parameters:
index- the position of the name in the list (zero-indexed).- Returns:
- the corresponding name.
-
size
public int size()The number of names in the list.- Returns:
- the total number of names.
-