亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? transition.java

?? Rakiura JFern是一個非常輕型的帶有模擬器的Petri網絡框架
?? JAVA
字號:
// This is copyrighted source file, part of Rakiura JFern package.// See the file LICENSE for copyright information and the terms and conditions// for copying, distributing and modifications of Rakiura JFern package.// Copyright (C) 1999-2002 by Mariusz Nowostawski and others  [http://www.rakiura.org]package org.rakiura.cpn;/**/import java.util.ArrayList;import java.util.Iterator;import java.util.List;import java.util.Map;import org.rakiura.cpn.event.PlaceEvent;import org.rakiura.cpn.event.PlaceListener;import org.rakiura.cpn.event.TokensAddedEvent;import org.rakiura.cpn.event.TokensRemovedEvent;import org.rakiura.cpn.event.TransitionFinishedEvent;import org.rakiura.cpn.event.TransitionListener;import org.rakiura.cpn.event.TransitionStartedEvent;import org.rakiura.cpn.event.TransitionStateChangedEvent;/** * Represents a transition in JFern Petri net model. * This class implements a simple transition, and the behaviour * can be overwritten by custom subclasses.<br> * The input and output arcs are stored in HashSet containers. * *<br><br> * Transition.java<br> * Created: Mon Sep 25 19:45:05 2000<br> * *@author  <a href="mariusz@rakiura.org">Mariusz Nowostawski</a> *@version 2.1.0 $Revision: 1.13 $ *@since 1.0 */public class Transition extends Node implements PlaceListener {  /**/  private List listeners = new ArrayList();  /**/  private List inputs = new ArrayList(10);  /**/  private List outputs = new ArrayList(10);  /**/  private boolean enabled = false;  /**/  private boolean uptodate = false;  /**/  private CpnContext binding = null;  /**/  private CpnContext context = new CpnContext();  /** Default guard. */  private Guard guard = new Guard() {      public boolean evaluate() {        return true;      }    };  /** Default action. */  private Action action = new Action();  /**   * Creates a new <code>BasicTransition</code> instance.   */  public Transition() {  }  /**   * Creates a new <code>BasicTransition</code> instance.   *@param aName a <code>String</code> value   */  public Transition(final String aName) {    super(aName);  }  /**   * Creates a new <code>BasicTransition</code> instance.   *@param anInput an <code>InputArc</code> value   *@param anOutput an <code>OutputArc</code> value   */  public Transition(final InputArc anInput, final OutputArc anOutput) {    this();    addInput(anInput);    addOutput(anOutput);  }  /**   * Adds an input Arc. This method is not for the user to call   * directly, it is called by newly created arcs which plug   * themselves automatically to the appropriate transitions.   *@return this Transition.   */  public Transition addInput(final InputArc anArc){    this.inputs.add(anArc);    anArc.place().addPlaceListener(this);    anArc.setContext(new CpnContext(this.context));    return this;  }  /**   * Adds an output Arc. This method is not for the user to call   * directly, it is called by newly created arcs which plug   * themselves automatically to the appropriate transitions.   *@return this Transition.   */  public Transition addOutput(final OutputArc anArc){    this.outputs.add(anArc);    anArc.setContext(new CpnContext(this.context));    return this;  }  /**   * Returns list of all input arcs.   *@return set of all input arcs for this transition.   */  public List inputArcs(){ return this.inputs; }  /**   * Returns list of all output arcs.   *@return set of all output arcs for this transition.   */  public List outputArcs(){ return this.outputs; }  /**   * Sets the guard for this transition.   *@param aGuard a <code>Guard</code> value   *@return an old (previous)  <code>Guard</code> value   */  public Guard setGuard(final Guard aGuard) {    final Guard old = this.guard;    this.guard = aGuard;    return old;  }  /**   * Sets the action for this transition.   *@param anAction an <code>Action</code> value   *@return an old (previous) <code>Action</code> value   */  public Action setAction(final Action anAction) {    final Action old = this.action;    this.action = anAction;    return old;  }  /**   * Returns the action for this transition.   *@return current <code>Action</code> value   */  public Action action() {    return this.action;  }  /**   * Returns the current context for this node.   *@return CPN context for this node.   */  public CpnContext getContext() {    return this.context;  }  /**   * Sets the current context for this node.   *@param aContext current context for this node.   */  public void setContext(final CpnContext aContext) {    this.context = aContext;  }  /**   * Expression evaluation and unification.   * Executes the expressions and tries to perform   * unification procedure. If a binding in which this transition   * is enabled is found, this transition is enabled and this   * transition context (i.e. varPool inside context) keeps the   * valid binding.   */  private boolean unify() {    if (!this.uptodate) {      final boolean oldState = this.enabled;      for (int i = 0; i < this.inputs.size(); i++) {        final InputArc arc = ((InputArc) this.inputs.get(i));        final Multiset minput = arc.place().getTokens();        arc.getContext().setMultiset(minput);        arc.expression();      }      final List arcs = inputArcs();      this.enabled = findBinding(0, arcs);      this.uptodate = true;      if (oldState != this.enabled) {        fireTransitionStateChangedEvent();      }    }    return this.enabled;  }  /**   * Finds the first binding which enables this transition.   *@param index current index of the input arc which is   * being iterated through   */  private final boolean findBinding(final int index, final List arcs) {    final int newIndex = index+1;    final CpnContext c = ((Arc) arcs.get(index)).getContext();    final List allPossible = c.getPossibleBindings();    if (allPossible.size() == 0) {      return false;    }    final Iterator iter = allPossible.iterator();    final CpnContext currentContext = getContext();    while (iter.hasNext()) {      final Map binding = (Map) iter.next();      c.setBinding(binding);      currentContext.getVarPool().clear();      currentContext.getVarPool().putAll(binding);      if (!((InputArc) arcs.get(index)).guard()) continue;      if (newIndex == arcs.size()) {        if (this.guard.evaluate()) {          // first one best          return true;        }      } else {        return findBinding(newIndex, arcs);      }    }    return false;  }  /**   * Checks if this transition is enabled.   *@return a <code>boolean</code> value, <code>true</code> if this   * transition is enabled, <code>false</code>   * otherwise.   */  public boolean isEnabled() {    return unify();  }  /**   * Fire this transition. If this transition is enabled,   * the tokens will be taken from input places according   * to the current binding, action will be executed, and   * tokens will be placed into output places according to   * the binding.   *@return this <code>Transition</code>   */  public Transition fire() {    if (this.listeners.size() > 0) {      fireTransitionStartedEvent();    }    //remove all prepared tokens from input places    final Iterator iter = this.inputs.iterator();    while (iter.hasNext()) {      final InputArc arc = ((InputArc) iter.next());      arc.place().removeTokens(arc.getContext().getBinding().values());    }    //execute the action    getContext().setMultiset(new Multiset(getContext().getVarPool().values()));    this.action.execute();    //put the appropriate multisets into output places    final Iterator oter = this.outputs.iterator();    while (oter.hasNext()) {      final OutputArc arc = ((OutputArc) oter.next());      arc.getContext().setMultiset(new Multiset(getContext().getVarPool().values()));      arc.place().addTokens(arc.expression());    }    if (this.listeners.size() > 0) {      fireTransitionFinishedEvent();    }    return this;  }  /**   * Registers a given TransitionListener with this place.   *@param aListener a <code>TransitionListener</code> to   * be registered with this Transition.   *@since 2.0   */  public void addTransitionListener(final TransitionListener aListener) {    this.listeners.add(aListener);  }  /**   * Deregisters a given TransitionListener from this place.   *@param aListener a <code>TransitionListener</code> to   * be removed with this Transition.   *@since 2.0   */  public void removeTransitionListener(final TransitionListener aListener) {    this.listeners.remove(aListener);  }  /**   * Notifies all listeners just before this transition fire.   */  public void fireTransitionStartedEvent() {    final TransitionStartedEvent event = new TransitionStartedEvent(this);    final Iterator l = this.listeners.iterator();    while (l.hasNext()) {      ((TransitionListener) l.next()).notify(event);    }  }  /**   * Notifies all listeners just after the transition finished firing.   */  public void fireTransitionFinishedEvent() {    final TransitionFinishedEvent event = new TransitionFinishedEvent(this);    final Iterator l = this.listeners.iterator();    while (l.hasNext()) {      ((TransitionListener) l.next()).notify(event);    }  }  /**   * Notifies all listeners just after this transition state changed.   */  private void fireTransitionStateChangedEvent() {    final TransitionStateChangedEvent event = new TransitionStateChangedEvent(this);    final Iterator l = this.listeners.iterator();    while (l.hasNext()) {      ((TransitionListener) l.next()).notify(event);    }  }  public void notify(final PlaceEvent anEvent) {    // ignore  }  public void notify(final TokensRemovedEvent anEvent) {    // binding re-evaluation needed.    this.uptodate = false;  }  public void notify(final TokensAddedEvent anEvent) {    // binding re-evaluation needed.    this.uptodate = false;  }  /**   * Visitor pattern.   *@param aVisitor a <code>NetVisitor</code> value   *@return this <code>NetElement</code> value   */  public NetElement apply(final NetVisitor aVisitor) {    aVisitor.transition(this);    return this;  }  /**   * @return a <code>String</code> value   */  public String toString(){    return "(Transition " + getName() + ")";  }  /**   * Represents this transition guard.   */  public abstract class Guard implements Context {    /**     * Guard function.     *@return <code>true</code> if this guard evaluates     * to enabled transition/arc;     * <code>false</code> otherwise.     */    public abstract boolean evaluate();    public void var(final String aVariable) {      getContext().var(aVariable);    }    public void var(final int aNumber) {      getContext().var(aNumber);    }    public Object get(final String aVariable) {      return getContext().get(aVariable);    }    public Multiset getMultiset() {      return getContext().getMultiset();    }  }// Guard  /**   * Represents this transition action.   */  public class Action implements Context {    /**     * Transition action.     */    public void execute(){}    public void var(final String aVariable) {      getContext().var(aVariable);    }    public void var(final int aNumber) {      getContext().var(aNumber);    }    public Object get(final String aVariable) {      return getContext().get(aVariable);    }    public Multiset getMultiset() {      return getContext().getMultiset();    }  }// Action} // Transition//////////////////// end of file ////////////////////

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产一区二区不卡在线| 奇米精品一区二区三区在线观看一| 日本特黄久久久高潮| 欧美成人精品3d动漫h| 美女视频网站黄色亚洲| 国产精品免费av| 欧美精品久久天天躁| 国产精品一二三四五| 亚洲一区av在线| 久久这里都是精品| 欧美亚洲综合网| 国产精品一二一区| 不卡一卡二卡三乱码免费网站| 亚洲香蕉伊在人在线观| 欧美国产视频在线| 日韩三级在线观看| 欧美在线看片a免费观看| 成人性视频网站| 久热成人在线视频| 婷婷丁香久久五月婷婷| 亚洲乱码国产乱码精品精98午夜 | 午夜天堂影视香蕉久久| 丝袜亚洲另类丝袜在线| 国产精品久久久久三级| 精品免费国产一区二区三区四区| 亚洲精品一区二区三区影院 | 丝袜诱惑亚洲看片| 美女视频黄a大片欧美| 国产精品18久久久久久久久久久久| 国产.欧美.日韩| 麻豆成人综合网| 粗大黑人巨茎大战欧美成人| 91久久久免费一区二区| 91在线观看下载| 奇米影视在线99精品| 国产成人在线视频免费播放| 国产精一区二区三区| 91麻豆免费看片| 日韩欧美一级二级三级| 日韩一区国产二区欧美三区| 国产亚洲欧美日韩俺去了| 精品国产精品网麻豆系列| 国产精品人成在线观看免费 | 日韩一区二区麻豆国产| 国产精品久久久久久久第一福利| 亚洲一区二区欧美激情| 国产精品538一区二区在线| 欧美午夜一区二区| 中文字幕一区二区日韩精品绯色| 亚洲国产精品高清| 秋霞电影网一区二区| 91视频免费看| 国产色婷婷亚洲99精品小说| 天天综合网天天综合色| 91在线porny国产在线看| 久久先锋资源网| 精品一区二区在线视频| 国产精品影视网| 91精品麻豆日日躁夜夜躁| 欧美mv和日韩mv的网站| 亚洲成人av一区二区三区| 蜜桃视频一区二区| 欧美精选午夜久久久乱码6080| 亚洲图片激情小说| 日本不卡123| 精品污污网站免费看| 精品国产亚洲在线| 日本女人一区二区三区| 欧美老女人第四色| 亚洲国产欧美在线人成| 91年精品国产| 亚洲另类中文字| 91视频观看视频| 亚洲欧美一区二区三区久本道91 | 中文字幕一区二区三区乱码在线| 国产一区二区导航在线播放| 日韩精品一区二区在线| 日本最新不卡在线| 日韩视频免费直播| 麻豆91免费观看| 久久综合色播五月| 国产精品一区二区91| 国产日产精品一区| 日韩成人精品在线观看| 在线播放日韩导航| 久久97超碰色| 久久久99久久| 亚洲国产精品精华液网站| 色婷婷久久久久swag精品| 日韩免费视频一区| 狠狠色狠狠色合久久伊人| 欧美精品一二三四| 美女视频网站久久| 国产精品卡一卡二| 欧美性猛交xxxx黑人交| 奇米色777欧美一区二区| 欧美精品一区二区三区视频| 国产乱码精品一区二区三区忘忧草 | 色婷婷综合在线| 亚洲香蕉伊在人在线观| 欧美电视剧免费全集观看| 国产精品一线二线三线精华| 国产精品久久久久久久久晋中| 在线观看不卡视频| 国产在线不卡一卡二卡三卡四卡| 国产日韩影视精品| 在线观看视频一区二区 | 亚洲人成亚洲人成在线观看图片| 日本乱人伦aⅴ精品| 日韩av高清在线观看| 久久久综合激的五月天| 色老综合老女人久久久| 激情成人午夜视频| 一区二区三区在线观看视频| 成人国产精品免费网站| 亚洲444eee在线观看| 国产日本欧美一区二区| 欧美日韩国产首页| 日韩高清一级片| 中文字幕巨乱亚洲| 日韩一区二区三区免费观看| 99r精品视频| 国产乱码精品一区二区三区五月婷| 亚洲国产人成综合网站| 国产欧美日韩一区二区三区在线观看| 在线免费观看成人短视频| 经典三级一区二区| 视频一区在线播放| 亚洲激情第一区| 国产精品国产自产拍高清av| 欧美一区二区久久| 国产福利不卡视频| 免费观看在线色综合| 亚洲一本大道在线| 一区二区三区免费观看| 国产精品久久久久毛片软件| 2020日本不卡一区二区视频| 91精品国产综合久久婷婷香蕉| 99久久精品一区| 国产成人精品亚洲777人妖| 久久精品久久精品| 日韩高清在线观看| 日本午夜精品视频在线观看| 一区二区视频免费在线观看| 中文字幕一区二区三区在线不卡| 久久久亚洲精华液精华液精华液| 日韩欧美视频一区| 欧美一区二区大片| 精品人在线二区三区| 精品欧美久久久| 欧美成人国产一区二区| 日韩精品一区在线观看| 欧美v亚洲v综合ⅴ国产v| 欧美一级二级在线观看| 日韩欧美电影一二三| 日韩精品一区二区三区在线播放| 欧美一区二区大片| 久久亚洲精精品中文字幕早川悠里| 精品少妇一区二区三区日产乱码 | 国产成人夜色高潮福利影视| 国产自产v一区二区三区c| 精品一二三四区| 国产成人免费视频网站| 国产不卡视频一区| 91性感美女视频| 欧美色图免费看| 欧美一区二区三区爱爱| 日韩免费高清av| 中文子幕无线码一区tr| 亚洲日穴在线视频| 日韩精品乱码免费| 国模一区二区三区白浆| 国产精品99久久不卡二区| 99视频在线精品| 精品一区二区三区在线播放 | 亚洲国产成人91porn| 日产精品久久久久久久性色| 国产自产v一区二区三区c| 91网上在线视频| 欧美群妇大交群中文字幕| 精品日韩成人av| 亚洲色图制服诱惑| 美女脱光内衣内裤视频久久网站 | 精品一区二区av| 99麻豆久久久国产精品免费| 欧美日韩一级二级三级| 精品人在线二区三区| 亚洲精品成人a在线观看| 日本视频一区二区| 91免费版pro下载短视频| 制服丝袜国产精品| 国产精品白丝在线| 亚洲成人一区二区| 成人天堂资源www在线| 欧美精品乱码久久久久久| 亚洲国产精品v| 日韩激情一二三区| 91蜜桃视频在线| 久久久久久久久岛国免费| 午夜精品久久久久久不卡8050|