mascoptLib.io.graph
Class MGLReader

java.lang.Object
  extended bymascoptLib.io.graph.MGLReader
All Implemented Interfaces:
ReaderInterface

public class MGLReader
extends Object
implements ReaderInterface

Read an MGL file. Developper's note: I (Yann Verhoeven) am perfectly conscient that a whole bunch of code of this class could have been factorized BUT, doing that, I would have been obliged to introduce a lot of "if" in that code. And I feel that maintaining such code is painful. If you don't think so please feel free to recode the class.

Version:
Fri Feb 15 10:11:15 2002
Author:
bbongiov@bing.inria.fr, rewritten by yann.verhoeven@inria.fr

Constructor Summary
MGLReader(String streamname)
          Creates a reader on an MGL file.
MGLReader(String streamname, boolean validate)
          Creates a reader on an MGL stream validating the DTD or not.
MGLReader(String streamname, boolean validate, MGLNodeFilter customnodefilter)
          Creates a reader on an MGL stream validating the DTD or not.
 
Method Summary
 Iterator getAbstractChains()
          Deprecated. Please now use getAbstractPaths()
 Iterator getAbstractEdges()
          Returns an iterator on the AbstractEdgescontained in the file.
 Iterator getAbstractEdgeSets()
          Returns an iterator on the AbstractEdgeSets contained in the file.
 Iterator getAbstractGraphs()
          Returns an iterator on the AbstractGraphscontained in the file.
 Iterator getAbstractPaths()
          Returns an iterator on the AbstractPathcontained in the file.
 Iterator getAbstractVertexSets()
          Returns an iterator on the AbstractVertexSetscontained in the file.
 Iterator getAbstractVertices()
          Returns an iterator on the AbstractVertexcontained in the file.
 Iterator getAllObjects()
          Returns an iterator on all the objects contained in the file.
 int getNumberOfGraphs()
          Get the number of graphs parsed by the MGLReader.
 void parse()
          Parse the MGL file and create in memory all objects contained in it.
 void setValidating(boolean validation)
          Turn off/on the validation with Relax NG.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MGLReader

public MGLReader(String streamname)
          throws FileNotFoundException,
                 SecurityException
Creates a reader on an MGL file.

Parameters:
streamname - - the stream to be read.
Throws:
FileNotFoundException - If the specified stream is a file and this file is not found.
SecurityException - Indicates a security violation

MGLReader

public MGLReader(String streamname,
                 boolean validate)
          throws FileNotFoundException,
                 SecurityException
Creates a reader on an MGL stream validating the DTD or not. The stream must be correctly specified. For a file the stream must be of the form : "file:/path/to/file". At this time the following streams are recognized, - files.

Parameters:
streamname - - the stream to be read.
validate - - if true the DTD is validated.
Throws:
FileNotFoundException - If the specified stream is a file and this file is not found.
SecurityException - Indicates a security violation

MGLReader

public MGLReader(String streamname,
                 boolean validate,
                 MGLNodeFilter customnodefilter)
          throws FileNotFoundException,
                 SecurityException
Creates a reader on an MGL stream validating the DTD or not. The stream must be correctly specified. For a file the stream must be of the form : "file:/path/to/file". At this time the following streams are recognized, - files.

Parameters:
streamname - - the name of the stream to be read.
validate - - if true the DTD is validated.
customnodefilter - - the MGLNodeFilterto be used.
Throws:
FileNotFoundException - If the specified stream is a file and this file is not found.
SecurityException - Indicates a security violation
Method Detail

parse

public void parse()
           throws Exception
Parse the MGL file and create in memory all objects contained in it. Then you can use all the access method to get objects.

Throws:
Exception

getAbstractPaths

public Iterator getAbstractPaths()
Returns an iterator on the AbstractPathcontained in the file.

Specified by:
getAbstractPaths in interface ReaderInterface
Returns:
an iterator over the list of AbstractPath contained in the file.

getAbstractChains

public Iterator getAbstractChains()
Deprecated. Please now use getAbstractPaths()

See Also:
getAbstractPaths()

getAbstractEdges

public Iterator getAbstractEdges()
Returns an iterator on the AbstractEdgescontained in the file.

Specified by:
getAbstractEdges in interface ReaderInterface
Returns:
an iterator over the list of AbstractEdges contained in the file.

getAbstractEdgeSets

public Iterator getAbstractEdgeSets()
Returns an iterator on the AbstractEdgeSets contained in the file.

Specified by:
getAbstractEdgeSets in interface ReaderInterface
Returns:
an iterator over the list of AbstractEdgeSets contained in the file.

getAbstractGraphs

public Iterator getAbstractGraphs()
Returns an iterator on the AbstractGraphscontained in the file.

Specified by:
getAbstractGraphs in interface ReaderInterface
Returns:
an iterator over the list of AbstractGraphs contained in the file.

getAbstractVertices

public Iterator getAbstractVertices()
Returns an iterator on the AbstractVertexcontained in the file.

Specified by:
getAbstractVertices in interface ReaderInterface
Returns:
an iterator over the list of AbstractVertex contained in the file.

getAbstractVertexSets

public Iterator getAbstractVertexSets()
Returns an iterator on the AbstractVertexSetscontained in the file.

Specified by:
getAbstractVertexSets in interface ReaderInterface
Returns:
an iterator over the list of AbstractVertexSets contained in the file.

getAllObjects

public Iterator getAllObjects()
Returns an iterator on all the objects contained in the file.

Specified by:
getAllObjects in interface ReaderInterface
Returns:
an iterator over the list of objects contained in the file.

getNumberOfGraphs

public int getNumberOfGraphs()
Get the number of graphs parsed by the MGLReader.

Returns:
the number of graphs parsed by the MGLReader in the file.

setValidating

public void setValidating(boolean validation)
Turn off/on the validation with Relax NG.

Parameters:
validation - a boolean.