sav.z
Class Statement

java.lang.Object
  extended bysav.z.Statement
All Implemented Interfaces:
sav.outfit.Lexis

public class Statement
extends java.lang.Object
implements sav.outfit.Lexis

An object that represents a Zigzag statement of Script. Statement corresponds to some string fragment, usually separated by ";".

Below the code prints Statements of a Script and marks the failure Statements.

  Session ss = new Session();
  Script scr = new Script(text);
  ss.analyse(scr):
  Statement[] stmArray = scr.statements();
  if (ss.hasErrors()) {
    ...
  }
  Statement stm = null;
  try {
    ss.execute(scr);
  } catch (ZException exc) {
    stm = ss.curStatement();
  }
  System.out.println("EXECUTION TRACE");
  for (int i = 0; i < stmArray.length; ++i) {
    System.out.print(stmArray[i]);
    if (stmArray[i].hasFailures())
      System.out.println(" - FAILURE");
    else
      System.out.println();
    if (stmArray[i] == stm) {
      System.out.print("INTERRUPTION LINE: " + stm.getLineNumber());
      break;
    }
  }
 

See Also:
Script.statements()

Field Summary
 
Fields inherited from interface sav.outfit.Lexis
BASE, BRACE, BRACE_TERM, BRACKET, BRACKET_TERM, CATEGORY, COLON, COMMA, DECLARATION, DECLARED, DESCRIPTIVE, DEVS, DIVIDE, ELLIPSIS, EQUALITY, EXTRACTION, FILE, FILED, FUNCTION, INEQUALITY, INTERNAL, KEYS, LEFT_SLASH, MDERIVABLE, NONE, NUMBER, P1, P2, PARENTHESIS, PARENTHESIS_TERM, POINT, PROCEDURE, QUOTE, RANGE, REVERSE_SOLIDUS, SPACE, SPECIFICATION, STRING, TERMINATION, VARIABLE, VDERIVABLE, VERTICAL_LINE, WORD
 
Method Summary
 int begin()
          Returns begin position of a Statement in a text string.
 int end()
          Returns end position of a Statement in a text string.
 Error[] errors()
          Returns array of Errors produced by Script analysis.
 java.lang.String express()
          Returns string of a Statement expressions from expressBegin() to expressEnd() position.
 int expressBegin()
          Returns a begin position of a Statement expressions in a text string.
 int expressEnd()
          Returns end position of a Statement expressions in a text string.
 Failure[] failures()
          Returns array of Failures produced by Script execution.
 int getLineNumber()
          Returns line number of a Statement in a Script.
 boolean hasErrors()
          Tests to see if Statement has Errors.
 boolean hasFailures()
          Tests to see if Statement has Failures.
 boolean hasWarnings()
          Tests to see if Statement has Warnings.
 boolean isEmpty()
          Tests if a Statement is empty.
 java.lang.String rightExpression()
          Returns string of corrected Statement expression (without ";\n"), or returns "" empty string.
 java.lang.String toString()
          Returns string of a Statement.
 Warning[] warnings()
          Returns array of Warnings, namely Errors or Failures, produced by Script analysis or execution.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

isEmpty

public boolean isEmpty()
Tests if a Statement is empty.

Returns:
true, if Statement is formed by empty or error string

expressBegin

public int expressBegin()
Returns a begin position of a Statement expressions in a text string. Statement expressions begin after first Statement characters: blank, line, tab, comment.


expressEnd

public int expressEnd()
Returns end position of a Statement expressions in a text string. Statement expressions end on a last Statement character: semicolon, blank, line, tab, or comment.


express

public java.lang.String express()
Returns string of a Statement expressions from expressBegin() to expressEnd() position.


begin

public int begin()
Returns begin position of a Statement in a text string. Statement may begin from any characters.


end

public int end()
Returns end position of a Statement in a text string.


toString

public java.lang.String toString()
Returns string of a Statement.


getLineNumber

public int getLineNumber()
Returns line number of a Statement in a Script.


rightExpression

public java.lang.String rightExpression()
Returns string of corrected Statement expression (without ";\n"), or returns "" empty string.


hasWarnings

public boolean hasWarnings()
Tests to see if Statement has Warnings.

See Also:
warnings()

hasErrors

public boolean hasErrors()
Tests to see if Statement has Errors.

See Also:
errors()

hasFailures

public boolean hasFailures()
Tests to see if Statement has Failures.

See Also:
failures()

warnings

public Warning[] warnings()
Returns array of Warnings, namely Errors or Failures, produced by Script analysis or execution.

See Also:
hasWarnings()

errors

public Error[] errors()
Returns array of Errors produced by Script analysis.

See Also:
hasErrors()

failures

public Failure[] failures()
Returns array of Failures produced by Script execution.

See Also:
hasFailures()