Class FeatureList
- java.lang.Object
-
- com.yahoo.searchlib.rankingexpression.FeatureList
-
- All Implemented Interfaces:
Iterable<ReferenceNode>
public class FeatureList extends Object implements Iterable<ReferenceNode>
Encapsulates the production rule 'featureList()' in the RankingExpressionParser.- Author:
- Simon Thoresen Hult
-
-
Constructor Summary
Constructors Constructor Description FeatureList(File file)
Creates a new feature list by reading the content of a file.FeatureList(Reader reader)
Creates a new feature list by consuming from a reader object.FeatureList(String list)
Creates a new feature list by parsing a string.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object obj)
ReferenceNode
get(int i)
Returns the feature at the given index.int
hashCode()
Iterator<ReferenceNode>
iterator()
int
size()
Returns the number of features in this list.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
FeatureList
public FeatureList(Reader reader) throws ParseException
Creates a new feature list by consuming from a reader object.- Parameters:
reader
- The reader that contains the string to parse.- Throws:
ParseException
- Thrown if the string could not be parsed.
-
FeatureList
public FeatureList(String list) throws ParseException
Creates a new feature list by parsing a string.- Parameters:
list
- The string to parse.- Throws:
ParseException
- Thrown if the string could not be parsed.
-
FeatureList
public FeatureList(File file) throws ParseException, FileNotFoundException
Creates a new feature list by reading the content of a file.- Parameters:
file
- The file whose content to parse.- Throws:
ParseException
- Thrown if the string could not be parsed.FileNotFoundException
- Thrown if the file specified could not be found.
-
-
Method Detail
-
size
public int size()
Returns the number of features in this list.- Returns:
- The size.
-
get
public ReferenceNode get(int i)
Returns the feature at the given index.- Parameters:
i
- the index of the feature to return.- Returns:
- the feature at the given index.
-
iterator
public Iterator<ReferenceNode> iterator()
- Specified by:
iterator
in interfaceIterable<ReferenceNode>
-
-