org.jvoicexml.interpreter.scope
Class ScopedSet<E>

java.lang.Object
  extended by org.jvoicexml.interpreter.scope.ScopedSet<E>
Type Parameters:
E - Type of the elements in this set.
All Implemented Interfaces:
Iterable<E>, Collection<E>, Set<E>, ScopeSubscriber

public final class ScopedSet<E>
extends Object
implements ScopeSubscriber, Set<E>

A simple Set which is scope aware.

This enables the user to store in a set and retrieve these values without taking care about scope changes. The values are always scope aware.

Since:
0.7.2
Version:
$Revision: 2618 $
Author:
Dirk Schnelle-Walka

Constructor Summary
ScopedSet(ScopeObserver scopeObserver)
          Constructs a new object.
 
Method Summary
 boolean add(E e)
          
 boolean addAll(Collection<? extends E> c)
          
 void addScopedSetObserver(ScopedSetObserver<E> obs)
          Adds the given observer to the list of known observers.
 void clear()
          
 void close()
          Unsubscribe this scoped container from the ScopePublisher.
 boolean contains(Object o)
          
 boolean containsAll(Collection<?> c)
          
 void enterScope(Scope previous, Scope next)
          The application has entered the next scope and the previous scope is no more the current scope.
 void exitScope(Scope previous, Scope next)
          The application has left the previous scope and the next scope is valid.
 boolean isEmpty()
          
 Iterator<E> iterator()
          
 boolean remove(Object o)
          
 boolean removeAll(Collection<?> c)
          
 void removeScopedSetObserver(ScopedSetObserver<E> obs)
          Removes the given scope observer from the list of known observers.
 boolean retainAll(Collection<?> c)
          
 int size()
          
 Object[] toArray()
          
<T> T[]
toArray(T[] a)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Set
equals, hashCode
 

Constructor Detail

ScopedSet

public ScopedSet(ScopeObserver scopeObserver)
Constructs a new object.

Parameters:
scopeObserver - The current scope observer.
Method Detail

addScopedSetObserver

public void addScopedSetObserver(ScopedSetObserver<E> obs)
Adds the given observer to the list of known observers.

Parameters:
obs - the observer to add
Since:
0.7.3

removeScopedSetObserver

public void removeScopedSetObserver(ScopedSetObserver<E> obs)
Removes the given scope observer from the list of known observers.

Parameters:
obs - the observer to remove
Since:
0.7.3

close

public void close()
Unsubscribe this scoped container from the ScopePublisher.


enterScope

public void enterScope(Scope previous,
                       Scope next)
The application has entered the next scope and the previous scope is no more the current scope.

Specified by:
enterScope in interface ScopeSubscriber
Parameters:
previous - The old scope.
next - The new scope.

exitScope

public void exitScope(Scope previous,
                      Scope next)
The application has left the previous scope and the next scope is valid.

Specified by:
exitScope in interface ScopeSubscriber
Parameters:
previous - The old scope.
next - The new scope.

add

public boolean add(E e)

Specified by:
add in interface Collection<E>
Specified by:
add in interface Set<E>

addAll

public boolean addAll(Collection<? extends E> c)

Specified by:
addAll in interface Collection<E>
Specified by:
addAll in interface Set<E>

clear

public void clear()

Specified by:
clear in interface Collection<E>
Specified by:
clear in interface Set<E>

contains

public boolean contains(Object o)

Specified by:
contains in interface Collection<E>
Specified by:
contains in interface Set<E>

containsAll

public boolean containsAll(Collection<?> c)

Specified by:
containsAll in interface Collection<E>
Specified by:
containsAll in interface Set<E>

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface Collection<E>
Specified by:
isEmpty in interface Set<E>

iterator

public Iterator<E> iterator()

Specified by:
iterator in interface Iterable<E>
Specified by:
iterator in interface Collection<E>
Specified by:
iterator in interface Set<E>

remove

public boolean remove(Object o)

Specified by:
remove in interface Collection<E>
Specified by:
remove in interface Set<E>

removeAll

public boolean removeAll(Collection<?> c)

Specified by:
removeAll in interface Collection<E>
Specified by:
removeAll in interface Set<E>

retainAll

public boolean retainAll(Collection<?> c)

Specified by:
retainAll in interface Collection<E>
Specified by:
retainAll in interface Set<E>

size

public int size()

Specified by:
size in interface Collection<E>
Specified by:
size in interface Set<E>

toArray

public Object[] toArray()

Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface Set<E>

toArray

public <T> T[] toArray(T[] a)

Specified by:
toArray in interface Collection<E>
Specified by:
toArray in interface Set<E>


Copyright © 2005-2010JVoiceXML group.