|
Pep 0.4 API Documentation | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.osu.ling.pep.Chart
public class Chart
A chart produced by an Earley parser
.
Charts contain sets of edges
mapped to the string indices where
they originate. Since the edge sets are sets
, an edge can only
be added at a given index once (as sets do not permit duplicate members).
Edge sets are not guaranteed to maintain edges in their order of insertion.
Constructor Summary | |
---|---|
Chart()
Creates a new chart, initializing its internal data structure. |
|
Chart(Chart chart)
Creates a new chart based on the specified chart. |
Method Summary | |
---|---|
boolean |
addEdge(Integer index,
Edge edge)
Adds an edge to this chart at the given index. |
void |
clear()
Removes all edges from this map at all indices (if any are present). |
boolean |
contains(Edge edge)
Tests whether this chart contains the specified edge. |
boolean |
containsEdges(Integer index)
Tests whether this chart contains any edges at a given string index. |
int |
countEdges()
Counts the total number of edges contained in this chart, at any index. |
boolean |
equals(Object obj)
Tests whether this chart is equal to another by comparing their internal data structures. |
Integer |
firstIndex()
Gets the first index in this chart that contains edges. |
Set<Edge> |
getEdges(Integer index)
Gets the edges in this chart at a given index. |
int |
hashCode()
Computes a hash code for this chart based on its internal data structure. |
Chart |
headChart(Integer to)
Gets a head chart of this chart (a chart containing only the indices from 0 to to ). |
Integer |
indexOf(Edge edge)
Gets the index of the specified edge in this
chart. |
Set<Integer> |
indices()
Gets the set of indices at which this chart contains edges. |
boolean |
isEmpty()
Tests whether this chart contains any edges at any index. |
Integer |
lastIndex()
Gets the last index in this chart that contains edges. |
Chart |
subChart(Integer from,
Integer to)
Gets a sub chart of this chart. |
Chart |
tailChart(Integer from)
Gets a tail chart of this chart (a chart containing only the indices from from to the size of its indices() ). |
String |
toString()
Gets a string representation of this chart. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Chart()
public Chart(Chart chart)
chart
- The chart to base the newly created chart upon.Method Detail |
---|
public boolean addEdge(Integer index, Edge edge)
index
- The index for edge
.edge
- The edge to add.
true
iff this chart did not already contain
edge
at the given index.
IndexOutOfBoundsException
- If index < 0
.
NullPointerException
- If index
or
edge
is null
.public void clear()
public boolean contains(Edge edge)
edge
- The edge to test whether this chart contains.
indexOf(Edge)
public boolean containsEdges(Integer index)
index
- The string index to check for edges.
true
iff this chart contains an edge set at
index
.public int countEdges()
public boolean equals(Object obj)
equals
in class Object
true
iff the specified object is an instance of
Chart
and it contains the same edges at the same indices
as this chart.public Integer firstIndex()
indices()
. In most cases, this
will return 0
(unless this chart is a
subchart
of another chart).public Set<Edge> getEdges(Integer index)
index
- The index to return edges for.
set
of edges
this chart contains
at index
, or null
if no edge set exists in
this chart for the given index. The edge set returned by this
method is not guaranteed to contain the edges in the order in
which they were added
. This method
returns a set of edges that is not modifiable.
NullPointerException
- If index
is null
.Collections.unmodifiableSet(Set)
public int hashCode()
hashCode
in class Object
public Chart headChart(Integer to)
0
to to
).
to
- The high endpoint (exclusive) of the new chart.
to
.SortedMap.headMap(Object)
public Integer indexOf(Edge edge)
index
of the specified edge in this
chart.
edge
- The edge to find the index of.
-1
if the
specified edge is null
or is not contained in this chart.public Set<Integer> indices()
getEdges(Integer)
will return a non-empty
set of edges.
0 ... n
).public boolean isEmpty()
true
if an edge is present at some index,
false
otherwise.public Integer lastIndex()
indices()
.public Chart subChart(Integer from, Integer to)
from
- The low endpoint (inclusive) of the sub chart.to
- The high endpoint (exclusive) of the subchart.
from <= index < to
.
NullPointerException
- If either from
or
to
is null
.SortedMap.subMap(Object, Object)
public Chart tailChart(Integer from)
from
to the size of its indices()
).
from
- The low endpoint (inclusive) of the new chart.
from
.SortedMap.tailMap(Object)
public String toString()
toString
in class Object
|
Pep: Pep is an Earley parser | ||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the overview file.