Top Description Fields Constructors Methods
com.sun.tools.xjc.reader.gbind

public abstract Class Element

extends Expression
implements ElementSet
Class Inheritance
All Implemented Interfaces
com.sun.tools.xjc.reader.gbind.ElementSet, java.lang.Iterable
Known Direct Subclasses
com.sun.tools.xjc.reader.gbind.SinkNode, com.sun.tools.xjc.reader.gbind.SourceNode, com.sun.tools.xjc.reader.xmlschema.GElement
Imports
java.util.ArrayList, .Collections, .Iterator, .LinkedHashSet, .List, .Set

Expression that represents an alphabet of a regular language.

Since this package is about a regular expression over element declarations, this represents an XML element declaration (hence the name.) Element needs to be interned, meaning one Element per one tag name.

Implements ElementSet to represent a self.

Author
Kohsuke Kawaguchi

Field Summary

Modifier and TypeField and Description
pack-priv final Set<Element>
private ConnectedComponent
cc

ConnectedComponent to which this element belongs.

pack-priv final Set<Element>
foreEdges

Once we build a graph from Expression, we represent an edge e1 -> e2 by e1.foreEdges.contains(e2) and e2.backEdges.contains(e1).

pack-priv Element
prevPostOrder

Previous element in the DFS post-order traversal of the element graph.

Inherited from com.sun.tools.xjc.reader.gbind.Expression:
EPSILON

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public void
addNext(Element element)

Implements com.sun.tools.xjc.reader.gbind.ElementSet.addNext.

For each element in this set, adds an edge to the given element.

pack-priv Element
assignDfsPostOrder(Element prev)

Traverses the graph with DFS and set prevPostOrder.

private boolean
pack-priv void
buildDAG(ElementSet incoming)

Implements abstract com.sun.tools.xjc.reader.gbind.Expression.buildDAG.

Builds up a DAG among Elements in this expression.

public void
buildStronglyConnectedComponents(List<ConnectedComponent> ccs)

Builds a set of strongly connected components and puts them all into the given set.

pack-priv final boolean

Returns:

true if it is indeed a cut-set. false if not.
checkCutSet
(ConnectedComponent cc, Set<Element>
Used to keep track of visited nodes.
visited
)

Checks if the given ConnectedComponent forms a cut-set of a graph.

public boolean
contains(ElementSet rhs)

Implements com.sun.tools.xjc.reader.gbind.ElementSet.contains.

Doesn't have to be strict (it's OK for this method to return false when it's actually true) since this is used just for optimization.

private void
formConnectedComponent(ConnectedComponent group)

Forms a strongly connected component by doing a reverse DFS.

public boolean
pack-priv boolean
isNullable()

Implements abstract com.sun.tools.xjc.reader.gbind.Expression.isNullable.

True of \epsilon \in L(exp)

pack-priv boolean
isSink()

True if this is SinkNode.

pack-priv boolean
isSource()

True if this is SourceNode.

public Iterator<Element>
iterator()

Implements java.lang.Iterable.iterator.

Deprecated if you statically call this method, there's something wrong.

Just to satisfy the ElementSet contract.

pack-priv ElementSet
lastSet()

Implements abstract com.sun.tools.xjc.reader.gbind.Expression.lastSet.

Computes LAST(exp)

Field Detail

backEdgesback to summary
pack-priv final Set<Element> backEdges
ccback to summary
private ConnectedComponent cc

ConnectedComponent to which this element belongs. Set in buildStronglyConnectedComponents(List)

foreEdgesback to summary
pack-priv final Set<Element> foreEdges

Once we build a graph from Expression, we represent an edge e1 -> e2 by e1.foreEdges.contains(e2) and e2.backEdges.contains(e1).

prevPostOrderback to summary
pack-priv Element prevPostOrder

Previous element in the DFS post-order traversal of the element graph.

We use prevPostOrder==null as a check if the element is visted in DFS, so this chain terminates by a self-reference, not by having null. Set in assignDfsPostOrder(Element)

Constructor Detail

Elementback to summary
protected Element()

Method Detail

addNextback to summary
public void addNext(Element element)

Implements com.sun.tools.xjc.reader.gbind.ElementSet.addNext.

Doc from com.sun.tools.xjc.reader.gbind.ElementSet.addNext.

For each element in this set, adds an edge to the given element.

Annotations
@Override
assignDfsPostOrderback to summary
pack-priv Element assignDfsPostOrder(Element prev)

Traverses the graph with DFS and set prevPostOrder. Should be first invoked on the source node of the graph.

belongsToSCCback to summary
private boolean belongsToSCC()
buildDAGback to summary
pack-priv void buildDAG(ElementSet incoming)

Implements abstract com.sun.tools.xjc.reader.gbind.Expression.buildDAG.

Doc from com.sun.tools.xjc.reader.gbind.Expression.buildDAG.

Builds up a DAG among Elements in this expression.

Annotations
@Override
buildStronglyConnectedComponentsback to summary
public void buildStronglyConnectedComponents(List<ConnectedComponent> ccs)

Builds a set of strongly connected components and puts them all into the given set.

checkCutSetback to summary
pack-priv final boolean checkCutSet(ConnectedComponent cc, Set<Element> visited)

Checks if the given ConnectedComponent forms a cut-set of a graph.

Parameters
visited:Set<Element>

Used to keep track of visited nodes.

Returns:boolean

true if it is indeed a cut-set. false if not.

containsback to summary
public boolean contains(ElementSet rhs)

Implements com.sun.tools.xjc.reader.gbind.ElementSet.contains.

Doc from com.sun.tools.xjc.reader.gbind.ElementSet.contains.

Doesn't have to be strict (it's OK for this method to return false when it's actually true) since this is used just for optimization. (Erring on the other side is NG)

Annotations
@Override
formConnectedComponentback to summary
private void formConnectedComponent(ConnectedComponent group)

Forms a strongly connected component by doing a reverse DFS.

hasSelfLoopback to summary
public boolean hasSelfLoop()
isNullableback to summary
pack-priv boolean isNullable()

Implements abstract com.sun.tools.xjc.reader.gbind.Expression.isNullable.

Doc from com.sun.tools.xjc.reader.gbind.Expression.isNullable.

True of \epsilon \in L(exp)

Annotations
@Override
isSinkback to summary
pack-priv boolean isSink()

True if this is SinkNode.

isSourceback to summary
pack-priv boolean isSource()

True if this is SourceNode.

iteratorback to summary
public Iterator<Element> iterator()

Implements java.lang.Iterable.iterator.

Deprecated

if you statically call this method, there's something wrong.

Just to satisfy the ElementSet contract.

Annotations
@Deprecated
@Override
lastSetback to summary
pack-priv ElementSet lastSet()

Implements abstract com.sun.tools.xjc.reader.gbind.Expression.lastSet.

Doc from com.sun.tools.xjc.reader.gbind.Expression.lastSet.

Computes LAST(exp)

Annotations
@Override