sav.z
Class Script

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

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

Can be executed many times for different Z databases or Zigzag variables of a Session. Represents many of Zigzag Statements formed after text analyzing. If Zigzag Scripts are executed a few times, database connection may be opened by modifyBase()/exploreBase() before and closed by closeBase() after.

The example sequentially prints information about each user.

  String names[] = { "Ann", "Daniel" };
  String text =
    "$user = User/(Name:$name);"
  ;
  Script scr = new Script(text);
  ss.analyse(scr);
  if (!scr.hasErrors()) {
    ss.exploreBase("Users");
    for (int i = 0; i < names.length; ++i) {
      ss.var("$name").set(names[i]);
      ss.execute(scr);
      String users[] = ss.var("$user").array();
      System.out.println((i + 1) + ": Name: " + names[i] + ", User: " + users[0]);
    }
    ss.closeBase("Users");
  }
 

See Also:
Session.analyse(sav.z.Script), Session.execute(sav.z.Script), Statement

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
 
Constructor Summary
Script(java.lang.String text)
          Constructs a new Script.
 
Method Summary
 int countStatements()
          Counts Statements of analyzed Script.
 java.lang.String getText()
          Returns address of full text string, a Script was created by means of which.
 boolean hasErrors()
          Tests to see if Script has Errors.
 boolean hasFailures()
          Tests to see if Script has Failures.
 boolean hasStatements()
          Returns true if Script was analyzed and has a Zigzag Statement.
 boolean hasWarnings()
          Tests to see if Script has Warnings.
 Statement[] statements()
          Returns array of Script's Statements.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Script

public Script(java.lang.String text)
Constructs a new Script.

Parameters:
text - string, whose address is passed, no contents
Method Detail

getText

public java.lang.String getText()
Returns address of full text string, a Script was created by means of which.


statements

public Statement[] statements()
Returns array of Script's Statements.

Returns:
null if Script was not analyzed

hasStatements

public boolean hasStatements()
Returns true if Script was analyzed and has a Zigzag Statement.


countStatements

public int countStatements()
Counts Statements of analyzed Script. Returns 0 if Script is not analyzed or empty.


hasWarnings

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


hasErrors

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

See Also:
Session.analyse(sav.z.Script)

hasFailures

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

See Also:
Session.execute(sav.z.Script)