Class DlgpParser
java.lang.Object
fr.inria.rules.integraal.util.stream.AbstractCloseableIterator<Object>
fr.inria.rules.integraal.io.dlgp.DlgpParser
- All Implemented Interfaces:
Parser<Object>, CloseableIterator<Object>, Closeable, AutoCloseable
Main access point of the DLGP parser.
- Author:
- Florent Tornil
-
Constructor Summary
ConstructorsConstructorDescriptionConstructor for parsing from the standard input.DlgpParser(File file, IntegraalEnvironment env) DlgpParser(File file, IntegraalEnvironment env, DLGPParserUtils utils) Constructor for parsing from the given file.DlgpParser(InputStream in, IntegraalEnvironment env) Constructor for parsing the given InputStream.DlgpParser(Reader reader, IntegraalEnvironment env) DlgpParser(Reader reader, IntegraalEnvironment env, DLGPParserUtils utils) Constructor for parsing from the given reader.DlgpParser(String s, IntegraalEnvironment env) Constructor for parsing the content of the string s as DLGP content. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes the stream and releases any system resources associated with it.protected voidfinalize()fr.inria.rules.dlgpereader.builder.api.IBuilderEnvironmentbooleanhasNext()Indicates whether another element can be read from the iterator.next()Returns the next element from the iterator.static ParserResultparseDLGPString(String dlgpString, IntegraalEnvironment env) static ParserResultparseDLGPString(String dlgpString, IntegraalEnvironment env, DLGPParserUtils utils) Parses the DLGP passed as string using the supplied environment.static ParserResultparseFile(String filepath, IntegraalEnvironment env) Parses the file located at the given path using the supplied environment.static ParserResultparseFile(String filepath, IntegraalEnvironment env, DLGPParserUtils utils) static ParserResultparseFiles(Collection<String> filepaths) Parses the files located at a given collection of paths
Collects all the file in a single object and return only after reading the whole file.static ParserResultparseFiles(Collection<String> filepaths, IntegraalEnvironment env) Parses the files located at a given collection of paths using the supplied environment.Methods inherited from class Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Parser
parse, streamParsedObjects
-
Constructor Details
-
DlgpParser
Constructor for parsing from the given reader.- Parameters:
reader- the java reader used to retrieve data
-
DlgpParser
-
DlgpParser
Constructor for parsing from the standard input. -
DlgpParser
public DlgpParser(File file, IntegraalEnvironment env, DLGPParserUtils utils) throws FileNotFoundException Constructor for parsing from the given file.- Parameters:
file- java file object to read from- Throws:
FileNotFoundException- if the given file does not exist
-
DlgpParser
- Throws:
FileNotFoundException
-
DlgpParser
Constructor for parsing the content of the string s as DLGP content.- Parameters:
s- a DLGP input as String
-
DlgpParser
Constructor for parsing the given InputStream.- Parameters:
in- java InputStream to read from
-
-
Method Details
-
finalize
- Overrides:
finalizein classAbstractCloseableIterator<Object>- Throws:
Throwable
-
hasNext
public boolean hasNext()Description copied from interface:CloseableIteratorIndicates whether another element can be read from the iterator. -
next
Description copied from interface:CloseableIteratorReturns the next element from the iterator.- Specified by:
nextin interfaceCloseableIterator<Object>- Specified by:
nextin interfaceParser<Object>- Returns:
- the next element
- Throws:
ParseException
-
getInteGraalEnvironment
public fr.inria.rules.dlgpereader.builder.api.IBuilderEnvironment getInteGraalEnvironment()- Specified by:
getInteGraalEnvironmentin interfaceParser<Object>
-
getDLGPParserUtils
- Specified by:
getDLGPParserUtilsin interfaceParser<Object>
-
close
public void close()Closes the stream and releases any system resources associated with it. Closing a previously closed parser has no effect.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceCloseableIterator<Object>
-
parseFile
Parses the file located at the given path using the supplied environment.
Collects all the content of the file in a single object and return only after reading the whole file.- Parameters:
filepath- path of the file to parseAllenv- the parsing environment- Returns:
- an object wrapping the dlgp
-
parseFile
public static ParserResult parseFile(String filepath, IntegraalEnvironment env, DLGPParserUtils utils) -
parseFiles
Parses the files located at a given collection of paths
Collects all the file in a single object and return only after reading the whole file.- Parameters:
filepaths- path of the file to parseAll- Returns:
- an object wrapping the dlgp
-
parseFiles
Parses the files located at a given collection of paths using the supplied environment.
Collects all the file in a single object and return only after reading the whole file.- Parameters:
filepaths- path of the file to parseAllenv- the parsing environment- Returns:
- an object wrapping the dlgp
-
parseDLGPString
public static ParserResult parseDLGPString(String dlgpString, IntegraalEnvironment env, DLGPParserUtils utils) Parses the DLGP passed as string using the supplied environment.- Parameters:
dlgpString- string corresponding to the DLGP to parseAllenv- the parsing environment- Returns:
- an object wrapping the dlgp
-
parseDLGPString
-