node.java

来自「Rakiura JFern是一个非常轻型的带有模拟器的Petri网络框架」· Java 代码 · 共 91 行

JAVA
91
字号
// 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;/** * Basic abstract implementation of the NetElement. This is the most * primitive abstract building block of the Net.  *  *<br><br> * Node.java<br> * Created: Mon Sep 25 11:02:54 2000<br> * *@author  <a href="mariusz@rakiura.org">Mariusz Nowostawski</a> *@version 2.1.0 $Revision: 1.6 $ *@since 1.0 */public abstract class Node implements NetElement {    /**/  private static long newID;  /**/  private String id;  /**/  private String name;    /**   * Creates new node.   */  public Node() {    this.id = newUniqueID();    this.name = "_" + id;  }  /**   * Creates new node.   *@param aName this node name.   */  public Node(final String aName) {    this.id = newUniqueID();    this.name = aName;  }  /**   * Returns ID for this node.   *@return ID for this node.   */  public String getID(){     return this.id;   }  /**   * Sets the name of this node.   *@return previous name of this node. */  public String setName(String name){    final String old = this.name;    this.name = name;    return old;  }  /**    * Returns the name of this node.   *@return the name of this node. */  public String getName(){    return this.name;  }  /**   * Generates a new unique identifier for this node.   *@return new unique ID.   */  public static String newUniqueID() {    final long id = newID;    newID++;     checkMax();    return "id"+id;  }  private static void checkMax() {    if(newID == Long.MAX_VALUE) throw         new RuntimeException("Problem with the Unique Identifier. You have reached Long.MAX_VALUE limit. Congratulations!\n" +                             "Send your application description to: mariusz@rakiura.org and we will help.");  }    } // Node//////////////////// end of file ////////////////////

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?