org.processmining.framework.models.petrinet
Class Marking

java.lang.Object
  extended by org.processmining.framework.models.petrinet.Marking
All Implemented Interfaces:
java.lang.Comparable

public class Marking
extends java.lang.Object
implements java.lang.Comparable

Title: Marking class

Description:

Copyright: Copyright (c) 2004

Company:

Version:
1.0
Author:
Eric Verbeek

Field Summary
static int OMEGA
           
 
Constructor Summary
Marking()
          Create a new marking.
 
Method Summary
 void add(Marking marking)
          Add a given marking
 void addPlace(Place place, int count)
          Adds a given number of tokens to a given place.
 void clear()
          Clear the marking.
 int compareTo(java.lang.Object object)
          Compare the marking with a given marking, using some total order.
 void delPlace(Place place, int count)
          Removes a given number of tokens from a given place.
 boolean equals(java.lang.Object marking)
          Checks whether two markings are identical.
 int getSize()
           
 int getTokenCount()
           
 int getTokens(Place place)
          Returns the number of tokens for a given place.
 boolean isLessOrEqual(Marking marking)
          Checks whether this marking is smaller than a given marking.
 java.util.Iterator iterator()
           
 void sub(Marking marking)
          Subtract a given marking
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OMEGA

public static final int OMEGA
See Also:
Constant Field Values
Constructor Detail

Marking

public Marking()
Create a new marking.

Method Detail

getTokenCount

public int getTokenCount()
Returns:
The number of tokens in the extended marking. OMEGA if infinite.

addPlace

public void addPlace(Place place,
                     int count)
Adds a given number of tokens to a given place.

Parameters:
place - The place to add the tokes to.
count - The number of tokens to add.

delPlace

public void delPlace(Place place,
                     int count)
Removes a given number of tokens from a given place.

Parameters:
place - The place to remove the tokens from.
count - The number of tokens to remove.

equals

public boolean equals(java.lang.Object marking)
Checks whether two markings are identical.

Overrides:
equals in class java.lang.Object
Parameters:
marking - The marking to check this marking against.
Returns:
True if identical, false otherwise.

iterator

public java.util.Iterator iterator()
Returns:
An iterator over the marked places.

isLessOrEqual

public boolean isLessOrEqual(Marking marking)
Checks whether this marking is smaller than a given marking.

Parameters:
marking - The given marking.
Returns:
True if smaller, false otherwise.

getSize

public int getSize()
Returns:
The number of places marked.

compareTo

public int compareTo(java.lang.Object object)
Compare the marking with a given marking, using some total order.

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
object - The marking given for comparison. object *must be* a marking..
Returns:
0 if identical, <0 if this marking considered smaller then given marking, >0 if considered greater.

getTokens

public int getTokens(Place place)
Returns the number of tokens for a given place. Could be OMEGA.

Parameters:
place - The given place.
Returns:
The number of tokens.

add

public void add(Marking marking)
Add a given marking

Parameters:
marking - The marking to add

sub

public void sub(Marking marking)
Subtract a given marking

Parameters:
marking - The marking to subtract

clear

public void clear()
Clear the marking.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
String representation for the marking.