Class Selection<L extends Language<L>>
java.lang.Object
io.github.vecbricks.jegg.Selection<L>
- Type Parameters:
L- the language
One node chosen per class, for the classes some roots reach: the result of extraction over
several roots at once, where a subterm two roots share is one choice paid once. Reading it
back as terms gives a DAG, one
Extracted object per class.
Held as a sorted array of class ids beside the chosen nodes, no map and no boxed id; the
map view nodes() is built when asked for.
-
Method Summary
Modifier and TypeMethodDescriptiondoublecost()The sum of the chosen nodes' own costs, each class once.node(int eclass) The node chosen for this class; the class must be one the roots reach.nodes()The classes the selection covers, in id order, with their nodes, read-only.roots()The roots the selection was made for, as root ids.intsize()How many classes the selection covers.terms()The selection's terms, one per root, sharing subterm objects where the roots share classes.toString()
-
Method Details
-
roots
The roots the selection was made for, as root ids.- Returns:
- the canonical ids of the roots, in the order given to the extractor
-
node
The node chosen for this class; the class must be one the roots reach.- Parameters:
eclass- the canonical id of a class in the selection- Returns:
- the node chosen for the class
- Throws:
IllegalArgumentException- if the class is not in the selection
-
nodes
-
cost
public double cost()The sum of the chosen nodes' own costs, each class once.- Returns:
- the selection's cost, finite and non-negative
-
size
public int size()How many classes the selection covers.- Returns:
- the number of classes, which is also the number of chosen nodes
-
terms
-
toString
-