Simulation of TCPN consists on subtracting and adding tokens from and to the markings of Petri net places, therefore proper implementation of marking is crucial for efficiency of the simulator. The structure used for implementation of marking must enable efficient search and verification of existence of tokens of known values. In case of Jensen’s timed nets the structure should also enable efficient consideration of token times tamps. As stated in [8] the marking can be a composite structure consisting of more than one data structures holding tokens and of consistent interface allowing to operate on the marking as a whole and designed for Petri net simulator. The implementation corresponding to the above mentioned requirements is placed in Basic Marking class. During simulation of a timed net at the given moment only these tokens from a marking are important, that have times tamps not greater than current simulation time. Therefore, conforming to the solution described by Mortensen et al. in [8], we decided to divide tokens in a marking into two separate structures. The tokens, that can be used in current firing of a transition (i.e. with times tamps not greater than current simulation time) are stored in active Tokens field. The tokens
with times tamps indicating that they can be used later are placed in waiting Tokens field. These fields refer to objects of different classes, implementing different data structures. The active Tokens data structure is an implementation of hash table with support for storing multiple values for a single key. The hash function in this structure uses token values as keys. Thus tokens with given values can be found efficiently while firing a transition, this being a key of efficient TCPN simulation. When simulation clock is advanced selected tokens from wating Tokens in each place must be moved to the active Tokens structure. To perform this operation efficiently, the waiting Tokens structure is a priority queue sorted by tokens times tamps (Token Comparator class is responsible for proper comparison of the tokens in the queue). The Basic Marking class implements I Marking interface and the Basic Marking can be easily substituted by different implementation of marking implementing the same interface, which ensures all required methods are provided by the implementation. Each marking must implement get Distinct Tokens returning list of tokens from the marking used to generate bindings while simulation. Boolean method contains Token allows to verify if the given token exists in the marking. Method get Token removes from the marking a token holding given value and returns this token. Methods put Token and put Tokens enable adding tokens to the marking. During simulation get Next Time method is used to determine the least value of the clock that would release new tokens from waiting Tokens to active Tokens in this marking. Finally, set Time method is called while each change of simulation clock