?? outputarc.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;/** * Represents an output Arc in Petri Net. * *<br><br> * OutputArc.java<br> * Created: Mon Sep 25 11:49:12 2000<br> * *@author <a href="mailto:mariusz@rakiura.org">Mariusz Nowostawski</a> *@version 2.1.0 $Revision: 1.7 $ *@since 1.0 */public class OutputArc extends AbstractArc { /** * Default expression. */ private Expression expr = new Expression(); /** * Creates a new <code>OutputArcAdapter</code> instance. */ protected OutputArc() { } /** * Creates a new <code>OutputArcAdapter</code> instance. * @param aFrom a <code>Transition</code> value * @param aTo a <code>Place</code> value */ public OutputArc(final Transition aFrom, final Place aTo){ super(aFrom, aTo); aFrom.addOutput(this); aTo.addOutput(this); } /** * Returns a multiset of tokens expressed by the inscription. * In JFern the inscription language is Java. * @return a <code>Multiset</code> value */ public Multiset expression() { return this.expr.evaluate(); } /** * Sets the expression for this arc. *@param anExpr an <code>Expression</code> value */ public void setExpression(final Expression anExpr) { this.expr = anExpr; } /** * Visitor pattern. * @param aVisitor a <code>NetVisitor</code> value * @return a <code>NetElement</code> value */ public NetElement apply(final NetVisitor aVisitor) { aVisitor.outputArc(this); return this; } /** * Represents an expression for the output arc. * *<br><br> * OutputArcExpression.java<br> * Created: Tue Apr 23 23:34:20 2002<br> * *@author <a href="mariusz@rakiura.org">Mariusz</a> *@version $Revision: 1.7 $ $Date: 2002/04/26 06:23:18 $ *@since 2.0 */ public class Expression implements Context { /** * Evaluates this expression. * Expression returns single multiset. This method * implements the actual expression on the output arc. * This implementation returns an empty multiset, which * is equivalent to an empty arc inscription. User * needs to overwrite this method to provide some output * arc functionality, token generation, and the like. *@return a single multiset. */ public Multiset evaluate(){ return new Multiset(); } 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(); } } // OutputArcExpression} // OutputArc//////////////////// end of file ////////////////////
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -