public abstract class AbstractMarking<F extends IFlow<N>,N extends INode,P extends IPlace,T extends ITransition> extends HashMap<P,Integer> implements IMarking<F,N,P,T>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Constructor and Description |
|---|
AbstractMarking() |
AbstractMarking(IPetriNet<F,N,P,T> net)
Construct a marking and associate it with a given net.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear this marking.
|
IMarking<F,N,P,T> |
clone()
Clone this marking.
|
IMarking<F,N,P,T> |
createMarking(IPetriNet<F,N,P,T> net)
Create fresh marking and associate it with a given net.
|
Set<Map.Entry<P,Integer>> |
entrySet()
Returns set of pairs where every pair specifies a marked place of the associated net and the number of tokens at the place.
|
boolean |
equals(Object o) |
boolean |
fire(T transition)
Fire a transition.
|
void |
fromMultiSet(Collection<P> places)
Construct this marking from the given multi-set of places.
|
Integer |
get(Object p)
Get number of tokens at a place.
|
Integer |
get(P place)
Get number of tokens at a place.
|
IPetriNet<F,N,P,T> |
getPetriNet()
Get Petri net which this marking is associated with.
|
int |
hashCode() |
boolean |
isBounded(int n)
Check if this marking is n-bounded, i.e., there are at most n tokens at every place.
|
boolean |
isEmpty()
Returns true if this marking does not mark any place.
|
boolean |
isMarked(P place)
Check if place is marked, i.e., contains at least one token.
|
boolean |
isSafe()
Check if this marking is safe, i.e., there is at most one token at every place.
|
Integer |
put(P p,
Integer tokens)
Put specified number of tokens at a given place of the associated net.
|
void |
putAll(Map<? extends P,? extends Integer> m)
Copies all of the marking from the specified map to this marking.
|
Integer |
remove(Object place)
Removes all tokens from a given place of the associated net.
|
Integer |
remove(P place)
Removes all tokens from a given place of the associated net.
|
void |
setPetriNet(IPetriNet<F,N,P,T> net)
Set net to associate this marking with.
|
int |
size()
Returns the number of marked places in the associated net.
|
Collection<P> |
toMultiSet()
Get marking as a multi-set of places.
|
containsKey, containsValue, keySet, valuestoStringfinalize, getClass, notify, notifyAll, wait, wait, waitcontainsKey, containsValue, keySet, valuespublic Integer put(P p, Integer tokens)
IMarkingput in interface Map<P extends IPlace,Integer>put in interface IMarking<F extends IFlow<N>,N extends INode,P extends IPlace,T extends ITransition>put in class HashMap<P extends IPlace,Integer>p - Place of the associated net.tokens - Number of tokens to put at the given place.public IPetriNet<F,N,P,T> getPetriNet()
IMarkingpublic boolean isMarked(P place)
IMarkingpublic Collection<P> toMultiSet()
IMarkingpublic void fromMultiSet(Collection<P> places)
IMarkingpublic Integer remove(P place)
IMarkingpublic Integer get(P place)
IMarkingpublic void clear()
IMarkingpublic boolean isEmpty()
IMarkingisEmpty in interface Map<P extends IPlace,Integer>isEmpty in interface IMarking<F extends IFlow<N>,N extends INode,P extends IPlace,T extends ITransition>isEmpty in class HashMap<P extends IPlace,Integer>public Integer remove(Object place)
public void putAll(Map<? extends P,? extends Integer> m)
public int size()
public Set<Map.Entry<P,Integer>> entrySet()
public boolean equals(Object o)
public int hashCode()
public IMarking<F,N,P,T> createMarking(IPetriNet<F,N,P,T> net)
IMarkingpublic void setPetriNet(IPetriNet<F,N,P,T> net)
IMarkingpublic boolean fire(T transition)
IMarkingpublic IMarking<F,N,P,T> clone()
IMarkingpublic boolean isBounded(int n)
IMarkingpublic boolean isSafe()
IMarkingCopyright © 2017. All rights reserved.