Sav.Z
Class Script

java.lang.Object
  |
  +--Sav.Z.Script
All Implemented Interfaces:
Sav.Z.Lexis

public class Script
extends java.lang.Object
implements Sav.Z.Lexis

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

The example sequentially prints information about each user.

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

See Also:
Session.z(java.lang.String), Session.analyse(Sav.Z.Script), Session.execute(Sav.Z.Script), Statement

Field Summary
static int BASE
           
static int BRACE
           
static int BRACE_TERM
           
static int BRACKET
           
static int BRACKET_TERM
           
static int CATEGORY
           
static int COLON
           
static int COMMA
           
static int CONJUNCTIVE
           
static int DECLARATION
           
static int DECLARED
           
static int DELIVERED
           
static int DESCRIPTIVE
           
static int DIVIDE
           
static int ELLIPSIS
           
static int EQUALITY
           
static int EXTRACTION
           
static int FILE
           
static int INEQUALITY
           
static java.lang.String KEYS
           
static int LEFT_SLASH
           
static int MULTITUDE
           
static int NONE
           
static int NUMBER
           
static int P1
           
static int P2
           
static int PARENTHESIS
           
static int PARENTHESIS_TERM
           
static int PROCEDURE
           
static int RANGE
           
static int RIGHT_SLASH
           
static int SPACE
           
static int SPECIFICATION
           
static int STRING
           
static int TERMINATION
           
static int 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 Z 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEYS

public static final java.lang.String KEYS

NONE

public static final int NONE

CATEGORY

public static final int CATEGORY

PROCEDURE

public static final int PROCEDURE

MULTITUDE

public static final int MULTITUDE

FILE

public static final int FILE

BASE

public static final int BASE

SPECIFICATION

public static final int SPECIFICATION

ELLIPSIS

public static final int ELLIPSIS

NUMBER

public static final int NUMBER

STRING

public static final int STRING

WORD

public static final int WORD

SPACE

public static final int SPACE

BRACE

public static final int BRACE

BRACKET

public static final int BRACKET

PARENTHESIS

public static final int PARENTHESIS

BRACE_TERM

public static final int BRACE_TERM

BRACKET_TERM

public static final int BRACKET_TERM

PARENTHESIS_TERM

public static final int PARENTHESIS_TERM

RANGE

public static final int RANGE

COLON

public static final int COLON

DIVIDE

public static final int DIVIDE

LEFT_SLASH

public static final int LEFT_SLASH

RIGHT_SLASH

public static final int RIGHT_SLASH

EXTRACTION

public static final int EXTRACTION

INEQUALITY

public static final int INEQUALITY

EQUALITY

public static final int EQUALITY

DECLARATION

public static final int DECLARATION

COMMA

public static final int COMMA

TERMINATION

public static final int TERMINATION

P1

public static final int P1

DESCRIPTIVE

public static final int DESCRIPTIVE

CONJUNCTIVE

public static final int CONJUNCTIVE

P2

public static final int P2

DELIVERED

public static final int DELIVERED

DECLARED

public static final int DECLARED
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 Z 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)