pl.edu.pjwstk.yaod.yaql.engine
Class EnvironmentalStack

java.lang.Object
  |
  +--pl.edu.pjwstk.yaod.yaql.engine.EnvironmentalStack

public class EnvironmentalStack
extends java.lang.Object

The EnvironmentalStack class represents the environmental stack. Its sections (activation records) consist of binders. The environmental stack has a link to the object store.

Author:
Jakub Trzetrzelewski, jakub_trzetrzelewski@yahoo.com
See Also:
ActivationRecord, BinderValue

Constructor Summary
EnvironmentalStack(ObjectManager om)
          Creates a new environmental stack, with specified om which is an object manager (a link to data store objects).
 
Method Summary
 void addAtBottom(BinderValue b)
          Adds a new binder to the lowest section of the environmental stack.
 void addAtTop(BinderValue b)
          Adds a new binder to the highest section of the environmental stack.
 BagValue bind(java.lang.String name)
          Returns a set (BagValue) of object identifiers which were positively binded.
 void deleteAll()
          Deletes all elements on environmental stack.
 void deleteAtBottom(BinderValue b)
          Deletes a specified binder from the lowest section of environmental stack.
 void deleteAtTop()
          Deletes all binders from the highest section of environmental stack.
 void deleteAtTop(BinderValue b)
          Deletes a specified binder from the highest section of environmental stack.
 void deleteElement(BinderValue b)
          Deletes a specified binder (b) from environmental stack.
 boolean empty()
          Tests whether or not the stack is empty.
 ActivationRecord getElementAt(int i)
          Returns (without removal) the i-th element from the environmental stack.
 ActivationRecord getFirstElement()
          Returns (without removal) the first element from the environmental stack.
 ActivationRecord getLastElement()
          Returns (without removal) the last element from the environmental stack.
 int getSize()
          Returns the number of elements in the environmental stack.
 ActivationRecord pop()
          Returns (and removes) the last element from the environmental stack.
 void push(ActivationRecord ar)
          Puts new element onto query result stack.
 void renameElement(BinderValue b, java.lang.String name)
          Sets a specified binder (b) a new name (name).
 void show()
          Shows all the elements of environmental stack.
 ActivationRecord top()
          Returns (without removal) the last element from the environmental stack.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EnvironmentalStack

public EnvironmentalStack(ObjectManager om)
Creates a new environmental stack, with specified om which is an object manager (a link to data store objects).
Parameters:
om - object manager - a link to data store objects.
See Also:
ObjectManager
Method Detail

empty

public boolean empty()
Tests whether or not the stack is empty.
Returns:
true if stack is empty, false otherwise.

push

public void push(ActivationRecord ar)
Puts new element onto query result stack.
See Also:
ActivationRecord

pop

public ActivationRecord pop()
                     throws EmptyStackException
Returns (and removes) the last element from the environmental stack.
Returns:
the last section of environmental stack.
Throws:
EmptyStackException - if stack is empty.
See Also:
ActivationRecord

top

public ActivationRecord top()
                     throws EmptyStackException
Returns (without removal) the last element from the environmental stack.
Returns:
the last section of environmental stack.
Throws:
EmptyStackException - if stack is empty.
See Also:
ActivationRecord

getSize

public int getSize()
Returns the number of elements in the environmental stack.
Returns:
the number of elements in the environmental stack.

getElementAt

public ActivationRecord getElementAt(int i)
Returns (without removal) the i-th element from the environmental stack.
Parameters:
i - the index of element to be returned.
Returns:
the i-th element of environmental stack.
See Also:
ActivationRecord

getFirstElement

public ActivationRecord getFirstElement()
Returns (without removal) the first element from the environmental stack.
Returns:
the first section of environmental stack.
See Also:
ActivationRecord

getLastElement

public ActivationRecord getLastElement()
Returns (without removal) the last element from the environmental stack.
Returns:
the last section of environmental stack.
See Also:
ActivationRecord

show

public void show()
Shows all the elements of environmental stack.

deleteAll

public void deleteAll()
Deletes all elements on environmental stack.

deleteElement

public void deleteElement(BinderValue b)
                   throws TypeMismatchException
Deletes a specified binder (b) from environmental stack.
Parameters:
b - binder which is to be deleted.
Throws:
TypeMismatchException - if comparison of elements fails.
See Also:
BinderValue

renameElement

public void renameElement(BinderValue b,
                          java.lang.String name)
                   throws TypeMismatchException
Sets a specified binder (b) a new name (name).
Parameters:
b - binder which name is to be changed.
name - a new name for the binder
Throws:
TypeMismatchException - if comparison of elements fails.
See Also:
BinderValue

addAtBottom

public void addAtBottom(BinderValue b)
Adds a new binder to the lowest section of the environmental stack.
Parameters:
b - a binder to be added.
See Also:
BinderValue, ActivationRecord

addAtTop

public void addAtTop(BinderValue b)
Adds a new binder to the highest section of the environmental stack.
Parameters:
b - a binder to be added.
See Also:
BinderValue, ActivationRecord

deleteAtBottom

public void deleteAtBottom(BinderValue b)
                    throws TypeMismatchException
Deletes a specified binder from the lowest section of environmental stack.
Parameters:
b - a binder to be deleted.
Throws:
TypeMismatchException - if comparison of elements fails.
See Also:
BinderValue, ActivationRecord

deleteAtTop

public void deleteAtTop(BinderValue b)
                 throws TypeMismatchException
Deletes a specified binder from the highest section of environmental stack.
Parameters:
b - a binder to be deleted.
Throws:
TypeMismatchException - if comparison of elements fails.
See Also:
BinderValue, ActivationRecord

deleteAtTop

public void deleteAtTop()
Deletes all binders from the highest section of environmental stack.
Parameters:
b - a binder to be deleted.
See Also:
BinderValue, ActivationRecord

bind

public BagValue bind(java.lang.String name)
Returns a set (BagValue) of object identifiers which were positively binded. If nothing was binded, empty set is returned.
Parameters:
name - a name to be binded.
Returns:
a set of object identifiers.
See Also:
BagValue, BinderValue