Package org.jacop.jasat.utils
Class CnfParser
java.lang.Object
org.jacop.jasat.utils.CnfParser
CNF file format (low-level) parser.
- Version:
- 4.10
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final class
exception occurring during parse -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate int
private boolean
private IntVec
int
int
private MemoryPool
private InputStream
-
Constructor Summary
ConstructorsConstructorDescriptionCnfParser
(MemoryPool pool, InputStream stream) creates an instance of the parser for some input stream -
Method Summary
Modifier and TypeMethodDescriptionboolean
hasNext()
iterator()
to be called only once!next()
private int
parseInt()
reads an int from the streamprivate void
parses the next clause from the streamprivate void
reads number of clauses and number of varsvoid
remove()
private void
skips comment lines from the current positionprivate void
skipLine()
skip the rest of the line (\n included)private void
skips white spaces and carriage returnsMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
numClauses
public int numClauses -
numVars
public int numVars -
stream
-
pool
-
c
private int c -
nextClause
-
hasGivenIterator
private boolean hasGivenIterator
-
-
Constructor Details
-
CnfParser
creates an instance of the parser for some input stream- Parameters:
pool
- the memory pool to usestream
- the stream from which to read clauses- Throws:
CnfParser.ParseException
- excpetion when parsing fails
-
-
Method Details
-
parseInt
reads an int from the stream- Returns:
- the parsed int
- Throws:
IOException
-
skipComments
skips comment lines from the current position- Throws:
IOException
-
skipLine
skip the rest of the line (\n included)- Throws:
IOException
-
skipSpaces
skips white spaces and carriage returns- Throws:
IOException
-
readProblemDef
reads number of clauses and number of vars- Throws:
IOException
-
parseNextClause
private void parseNextClause()parses the next clause from the stream -
hasNext
public boolean hasNext() -
next
-
remove
public void remove() -
iterator
to be called only once!
-