org.jaitools.jiffle.parser
Class SymbolScope

java.lang.Object
  extended by org.jaitools.jiffle.parser.SymbolScope

public class SymbolScope
extends java.lang.Object

Stores symbols in a Jiffle script at a single scope level. Used during script compilation.

Since:
0.1
Version:
$Id: SymbolScope.java 1653 2011-06-16 10:23:02Z michael.bedward $
Author:
Michael Bedward

Constructor Summary
SymbolScope(java.lang.String name)
          Creates a new scope.
 
Method Summary
 void add(Symbol symbol)
          Adds a symbol to this scope.
 Symbol findSymbolNamed(java.lang.String name)
          Gets the symbol with the given name if one exists.
 java.lang.String getName()
          Gets the scope label.
 java.util.List<Symbol> getSymbols()
          Gets the list of symbols in this scope.
 boolean hasSymbolNamed(java.lang.String name)
          Tests if this scope contains a symbol with the given name.
 boolean isEmpty()
          Tests if this scope is empty.
 int size()
          Gets the number of symbols in this scope.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SymbolScope

public SymbolScope(java.lang.String name)
Creates a new scope.

Parameters:
name - a scope label
Method Detail

getName

public java.lang.String getName()
Gets the scope label.

Returns:
scope label

getSymbols

public java.util.List<Symbol> getSymbols()
Gets the list of symbols in this scope. The list is returned as an unmodifiable view.

Returns:
list of symbols

isEmpty

public boolean isEmpty()
Tests if this scope is empty.

Returns:
true if there are no symbols; false otherwise

size

public int size()
Gets the number of symbols in this scope.

Returns:
number of symbols

add

public void add(Symbol symbol)
Adds a symbol to this scope.

Parameters:
symbol - the symbol
Throws:
java.lang.IllegalArgumentException - if symbol is null

hasSymbolNamed

public boolean hasSymbolNamed(java.lang.String name)
Tests if this scope contains a symbol with the given name.

Parameters:
name - symbol name
Returns:
true if a symbol with this name is found; false otherwise

findSymbolNamed

public Symbol findSymbolNamed(java.lang.String name)
Gets the symbol with the given name if one exists.

Parameters:
name - symbol name
Returns:
the symbol or null if not match was found


Copyright © 2011. All Rights Reserved.