petri_jfern
Class PNJFern

java.lang.Object
  extended by petri_jfern.PNJFern
All Implemented Interfaces:
java.util.EventListener, SimulatorListener, Library, PetriNetListener, TransitionListener

public class PNJFern
extends java.lang.Object
implements org.rakiura.cpn.event.TransitionListener, PetriNetListener, SimulatorListener, TransitionListener, Library

The Class PNJFern parses a VANTED Petri net into a rakiura Petri net, performs all simulation operations and writes the marking for each simulation step into a file (if enabled).

Author:
Kevin Pucknat

Constructor Summary
PNJFern()
           
 
Method Summary
 void colorEnabledTransitions(boolean color)
          Color enabled transitions.
 Library createLibI(PetriNet petriNet)
          Creates the library.
 void fire(Transition transition)
          Fire.
 void fireTransition(Transition transition)
          Fire transition.
 void fireTransitions(java.util.List<Transition> transitions)
          Fire transitions.
static int getCountIntegerToken(org.rakiura.cpn.Multiset multiset)
          Gets the number of discrete tokens.
 double[] getMarking()
          Gets the marking.
 Marking getMarking2()
          Gets the marking2.
 Simulator getSimulator()
          Gets the simulator.
 void highlightEnabledTransitionsDelay(int ms)
          Highlight enabled transitions delay.
 boolean isEnabled(Transition transition)
          Checks if is enabled.
 void notify(org.rakiura.cpn.event.TransitionEvent arg0)
           
 void notify(org.rakiura.cpn.event.TransitionFinishedEvent arg0)
           
 void notify(org.rakiura.cpn.event.TransitionStartedEvent arg0)
           
 void notify(org.rakiura.cpn.event.TransitionStateChangedEvent arg0)
           
 Library parse2Lib(PetriNet pn)
          Parse to library.
 org.rakiura.cpn.Net parsePN2JFERN(PetriNet pn)
          Parses the VANTED Petri net into a rakiura Petri net.
 void run()
          Run.
 void run(int steps)
          Run.
 void setEnabledTransitionColor(java.awt.Color enabledTransitionColor)
          Sets the enabled transition color.
 void showTokenFlow(boolean show)
          Show token flow.
 void step(boolean finished)
          Step.
 void stop()
          Stop.
 void write2File(boolean write)
          Write2 file.
 void writeBackNewMarkingToPetriNet(boolean finished)
          Write new marking from rakiura Petri net to VANTED Petri net.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PNJFern

public PNJFern()
Method Detail

parsePN2JFERN

public org.rakiura.cpn.Net parsePN2JFERN(PetriNet pn)
Parses the VANTED Petri net into a rakiura Petri net.

Parameters:
pn - the pn (vanted)
Returns:
the net (rakiura)

writeBackNewMarkingToPetriNet

public void writeBackNewMarkingToPetriNet(boolean finished)
Write new marking from rakiura Petri net to VANTED Petri net.

Parameters:
finished, - false writes only token to changed places; true writes token to all places

getMarking

public double[] getMarking()
Description copied from interface: Library
Gets the marking.

Specified by:
getMarking in interface Library
Returns:
the marking

getCountIntegerToken

public static int getCountIntegerToken(org.rakiura.cpn.Multiset multiset)
Gets the number of discrete tokens.

Parameters:
multiset - the multiset
Returns:
the number of discrete tokens

notify

public void notify(org.rakiura.cpn.event.TransitionStateChangedEvent arg0)

notify

public void notify(org.rakiura.cpn.event.TransitionFinishedEvent arg0)

notify

public void notify(org.rakiura.cpn.event.TransitionStartedEvent arg0)

notify

public void notify(org.rakiura.cpn.event.TransitionEvent arg0)

run

public void run()
Description copied from interface: PetriNetListener
Run.

Specified by:
run in interface PetriNetListener

run

public void run(int steps)
Description copied from interface: PetriNetListener
Run.

Specified by:
run in interface PetriNetListener
Parameters:
steps - the steps

stop

public void stop()
Description copied from interface: PetriNetListener
Stop.

Specified by:
stop in interface PetriNetListener

step

public void step(boolean finished)
Description copied from interface: SimulatorListener
Step.

Specified by:
step in interface SimulatorListener
Parameters:
finished - the last step

fire

public void fire(Transition transition)
Description copied from interface: TransitionListener
Fire.

Specified by:
fire in interface TransitionListener
Parameters:
transition - the transition

fireTransitions

public void fireTransitions(java.util.List<Transition> transitions)
Description copied from interface: Library
Fire transitions.

Specified by:
fireTransitions in interface Library
Parameters:
transitions - the transitions

isEnabled

public boolean isEnabled(Transition transition)
Description copied from interface: TransitionListener
Checks if is enabled.

Specified by:
isEnabled in interface TransitionListener
Parameters:
transition - the transition
Returns:
true, if is enabled

parse2Lib

public Library parse2Lib(PetriNet pn)
Description copied from interface: Library
Parse to library.

Specified by:
parse2Lib in interface Library
Parameters:
pn - the petri net
Returns:
the library

getMarking2

public Marking getMarking2()
Description copied from interface: Library
Gets the marking2.

Specified by:
getMarking2 in interface Library
Returns:
the marking2

fireTransition

public void fireTransition(Transition transition)
Description copied from interface: Library
Fire transition.

Specified by:
fireTransition in interface Library
Parameters:
transition - the transition

getSimulator

public Simulator getSimulator()
Description copied from interface: Library
Gets the simulator.

Specified by:
getSimulator in interface Library
Returns:
the simulator

createLibI

public Library createLibI(PetriNet petriNet)
Creates the library.

Parameters:
petriNet - the petri net
Returns:
the library

highlightEnabledTransitionsDelay

public void highlightEnabledTransitionsDelay(int ms)
Description copied from interface: Library
Highlight enabled transitions delay.

Specified by:
highlightEnabledTransitionsDelay in interface Library
Parameters:
ms - the ms

showTokenFlow

public void showTokenFlow(boolean show)
Description copied from interface: Library
Show token flow.

Specified by:
showTokenFlow in interface Library
Parameters:
show - the show

write2File

public void write2File(boolean write)
Description copied from interface: Library
Write2 file.

Specified by:
write2File in interface Library
Parameters:
write - the write

setEnabledTransitionColor

public void setEnabledTransitionColor(java.awt.Color enabledTransitionColor)
Description copied from interface: Library
Sets the enabled transition color.

Specified by:
setEnabledTransitionColor in interface Library
Parameters:
enabledTransitionColor - the new enabled transition color

colorEnabledTransitions

public void colorEnabledTransitions(boolean color)
Description copied from interface: Library
Color enabled transitions.

Specified by:
colorEnabledTransitions in interface Library
Parameters:
color - the color