com.tensegrity.generic.constraint
Class Scanner

java.lang.Object
  extended bycom.tensegrity.generic.constraint.Scanner

public class Scanner
extends java.lang.Object

This class provides methods for doing a lexical analysis on a String. This functionalities are used by the ConstraintParser.

Version:
$Id: Scanner.java,v 1.23 2006/06/08 12:12:30 MichaelKegel Exp $
Author:
S. Rutz
See Also:
Constraint, ConstraintParser

Constructor Summary
Scanner(java.lang.String input)
          Constructs a scanner instance with the given String input.
 
Method Summary
 double dval()
          Gets the double that was parsed most recently.
 java.lang.String getInput()
          Returns the input this scanner is parsing
 int ival()
          Gets the integer that was parsed most recently.
 MetricExpression mexp_val()
          Returns the MetricExpression that was parsed most recently.
 int nextToken()
          Advances the scanner and returns the next token as a symbol identifier.
 java.lang.String sval()
          Gets the string that was parsed most recently.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scanner

public Scanner(java.lang.String input)
Constructs a scanner instance with the given String input.

Parameters:
input - a String providing the data to scan, the value may not be null.
Method Detail

ival

public final int ival()
Gets the integer that was parsed most recently. If no int value was scanned by this instance, then 0 is returned.

Returns:
the last recently parsed integer value.

dval

public final double dval()
Gets the double that was parsed most recently. If no double value was scanned by this instance, then 0.0 is returned.

Returns:
the last recently parsed double value.

sval

public final java.lang.String sval()
Gets the string that was parsed most recently. If no String value was scanned by this instance, then null is returned.

Returns:
the last recently parsed string (can be keyword or string literal).

mexp_val

public final MetricExpression mexp_val()
Returns the MetricExpression that was parsed most recently. If no MetricExpression value was scanned null is returned.

Returns:
MetricExpression the rencently parsed MetricExpression value

nextToken

public int nextToken()
Advances the scanner and returns the next token as a symbol identifier.

Returns:
the symbol constant that belongs to the next token in the input stream.

getInput

public java.lang.String getInput()
Returns the input this scanner is parsing

Returns:
The input this scanner is parsing


Copyright © 2005 Tensegrity Software GmbH. All Rights Reserved. Date of creation: 09.06.2006.