|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.AbstractCollection<T>
repast.simphony.context.AbstractContext<T>
public abstract class AbstractContext<T>
Abstract base class implementation of the Context interface.
| Field Summary | |
|---|---|
protected Map<Object,Context<? extends T>> |
subContexts
|
| Fields inherited from interface repast.simphony.context.Context |
|---|
SYN_CONTEXT_PREFIX |
| Constructor Summary | |
|---|---|
AbstractContext()
|
|
| Method Summary | ||
|---|---|---|
boolean |
add(T o)
|
|
void |
addContextListener(ContextListener<T> listener)
|
|
protected abstract boolean |
addInternal(T o)
|
|
void |
addProjection(Projection<? super T> projection)
Adds the specified Projection to this Context. |
|
void |
addSubContext(Context<? extends T> context)
|
|
void |
addValueLayer(ValueLayer valueLayer)
Adds the specified ValueLayer to this Context. |
|
void |
clear()
|
|
boolean |
contains(Object o)
|
|
protected abstract boolean |
containsInternal(Object o)
|
|
void |
eventOccured(ContextEvent ev)
Listener method for context events. |
|
Context |
findContext(Object id)
This searches the specified context and its descendants for the context with the specified id. |
|
Context |
findParent(Object o)
Retrieves the context of the specified object starting with the specified Context. |
|
protected void |
fireAddContextEvent(T o)
|
|
protected void |
fireRemoveEvent(Object o)
|
|
protected void |
fireSubContextAdded(Context<? extends T> context)
|
|
protected void |
fireSubContextRemoved(Context<? extends T> context)
|
|
Iterable<T> |
getAgentLayer(Class<T> agentType)
|
|
Iterable<Class> |
getAgentTypes()
|
|
Collection<ContextListener<T>> |
getContextListeners()
|
|
Object |
getId()
|
|
|
getProjection(Class<X> projection,
String name)
Gets the named projection. |
|
Projection<?> |
getProjection(String name)
Gets the named projection. |
|
Collection<Projection<?>> |
getProjections()
Gets an iterable over all the projections contained by this Context. |
|
|
getProjections(Class<X> clazz)
Gets all the projections in this Context of the specified type. |
|
Context<? extends T> |
getSubContext(Object id)
|
|
Iterable<Context<? extends T>> |
getSubContexts()
|
|
Object |
getTypeID()
Gets an id that indentifies the user-defined type of this context. |
|
ValueLayer |
getValueLayer(String name)
Gets the named ValueLayer. |
|
Collection<ValueLayer> |
getValueLayers()
Gets an iterable over the ValueLayer-s contained by this Context. |
|
protected boolean |
handleRemove(Object o)
|
|
boolean |
hasSubContext()
Method to check if subcontext(s) are present in the context |
|
Iterator<T> |
iterator()
By default the iterator returns in the contents in this context in the order entered then it returns the contents of the subcontexts in the order the subcontexts were added. |
|
protected abstract Iterator<T> |
iteratorInternal()
|
|
Iterable<T> |
query(org.apache.commons.collections15.Predicate query)
|
|
boolean |
remove(Object o)
|
|
void |
removeContextListener(ContextListener<T> listener)
|
|
protected abstract boolean |
removeInternal(Object o)
|
|
Projection<? super T> |
removeProjection(String projectionName)
Removes the named projection from this Context. |
|
void |
removeSubContext(Context<? extends T> context)
|
|
ValueLayer |
removeValueLayer(String name)
Removes the named ValueLayer from this Context. |
|
void |
setId(Object id)
|
|
void |
setTypeID(Object id)
Sets an id that indentifies the user-defined type of this context. |
|
int |
size()
|
|
protected abstract int |
sizeInternal()
|
|
| Methods inherited from class java.util.AbstractCollection |
|---|
addAll, containsAll, isEmpty, removeAll, retainAll, toArray, toArray, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface repast.simphony.context.Context |
|---|
getObjects, getRandomObject, getRandomObjects |
| Methods inherited from interface java.util.Collection |
|---|
addAll, containsAll, equals, hashCode, isEmpty, removeAll, retainAll, toArray, toArray |
| Field Detail |
|---|
protected Map<Object,Context<? extends T>> subContexts
| Constructor Detail |
|---|
public AbstractContext()
| Method Detail |
|---|
public Object getId()
getId in interface RepastElementpublic void setId(Object id)
setId in interface RepastElementpublic Object getTypeID()
getTypeID in interface Context<T>public void setTypeID(Object id)
setTypeID in interface Context<T>id - the type idpublic void addContextListener(ContextListener<T> listener)
addContextListener in interface Context<T>public Collection<ContextListener<T>> getContextListeners()
getContextListeners in interface Context<T>public Iterable<T> query(org.apache.commons.collections15.Predicate query)
query in interface Context<T>public void removeContextListener(ContextListener<T> listener)
removeContextListener in interface Context<T>public final boolean add(T o)
add in interface Collection<T>add in class AbstractCollection<T>protected void fireAddContextEvent(T o)
o - protected abstract boolean addInternal(T o)
protected abstract boolean containsInternal(Object o)
public boolean contains(Object o)
contains in interface Collection<T>contains in class AbstractCollection<T>public Iterator<T> iterator()
iterator in interface Iterable<T>iterator in interface Collection<T>iterator in class AbstractCollection<T>protected abstract Iterator<T> iteratorInternal()
public void eventOccured(ContextEvent ev)
eventOccured in interface ContextListenerev - public void addSubContext(Context<? extends T> context)
addSubContext in interface Context<T>public boolean hasSubContext()
Context
hasSubContext in interface Context<T>public Iterable<Context<? extends T>> getSubContexts()
getSubContexts in interface Context<T>public void removeSubContext(Context<? extends T> context)
removeSubContext in interface Context<T>public final boolean remove(Object o)
remove in interface Collection<T>remove in class AbstractCollection<T>public void clear()
clear in interface Collection<T>clear in class AbstractCollection<T>protected boolean handleRemove(Object o)
protected void fireRemoveEvent(Object o)
protected void fireSubContextAdded(Context<? extends T> context)
protected void fireSubContextRemoved(Context<? extends T> context)
protected abstract boolean removeInternal(Object o)
public int size()
size in interface Collection<T>size in class AbstractCollection<T>protected abstract int sizeInternal()
public Context<? extends T> getSubContext(Object id)
getSubContext in interface Context<T>public Context findParent(Object o)
findParent in interface Context<T>o - an object to find in the contexts
public Context findContext(Object id)
findContext in interface Context<T>id - the id of the context to search for
public Iterable<Class> getAgentTypes()
getAgentTypes in interface Context<T>public Iterable<T> getAgentLayer(Class<T> agentType)
getAgentLayer in interface Context<T>
public <X extends Projection<?>> X getProjection(Class<X> projection,
String name)
Context
getProjection in interface Context<T>projection - the type of the projectionname - the name of the projection to get
public <X extends Projection<?>> Iterable<X> getProjections(Class<X> clazz)
Context
getProjections in interface Context<T>clazz - the type of projections to get
public Projection<?> getProjection(String name)
Context
getProjection in interface Context<T>name - the name of the projection to get
public void addProjection(Projection<? super T> projection)
Context
addProjection in interface Context<T>projection - the projection to addpublic Projection<? super T> removeProjection(String projectionName)
removeProjection in interface Context<T>projectionName - the name projection to remove
public Collection<Projection<?>> getProjections()
getProjections in interface Context<T>public void addValueLayer(ValueLayer valueLayer)
addValueLayer in interface Context<T>valueLayer - the ValueLayer to addpublic ValueLayer removeValueLayer(String name)
removeValueLayer in interface Context<T>name - the name of the ValueLayer to remove.
public Collection<ValueLayer> getValueLayers()
getValueLayers in interface Context<T>public ValueLayer getValueLayer(String name)
getValueLayer in interface Context<T>name - the name of the ValueLayer to get
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||