⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 structureelement.java

📁 一个关于java 的常用工具包
💻 JAVA
字号:
package org.jutil.structure;/** * <p><b>DEPRECATED</b>A class of "components" for inplementing a 1-n binding. * This class is the n side of the binding (the side where the "n" * is in a UML diagram).</p> * * <p>This is actually a lightweight version of the APSet-APElement combination * of the <a href="http://www.beedra.org">Beedra</a> framework of Jan Dockx.</p> *  * <p>This class is typically using in the following way. * See class StructureElement for class B.</p> * <pre><code>public class B {  public B() {    $a = new StructureElement(this);  }  public A getA() {    return (A)$a.getOtherEnd();  }  StructureElement getALink() {    return $a;  }  private StructureElement $a;} * </code></pre> * * <p>The binding is controlled in class A. Of course you can add a setA(A a) method to class B.</p> * @path    $Source: /cvsroot/org-jutil/jutil.org/src/org/jutil/structure/StructureElement.java,v $ * @version $Revision: 1.6 $ * @date    $Date: 2002/07/21 10:30:35 $ * @state   $State: Exp $ * @author  Marko van Dooren * @release $Name:  $ * * @deprecated */public class StructureElement { 	/* The revision of this class */	public final static String CVS_REVISION ="$Revision: 1.6 $";/*@    @ public invariant getStructureSet() != null ==>   @                  getStructureSet().contains(this);   @*/    /**   * Initialize a new StructureElement for the given object.   * The new StructureElement will be unconnected.   *   * @param object   *        The object at the n side of the 1-n binding.   */ /*@   @ public behavior   @   @ pre object != null;   @   @ post getObject() == object;   @ post getStructureSet() == null;   @*/  public StructureElement(Object object) {    _object = object;  }  /**   * Initialize a new StructureElement for the given object,   * connected to the given StructureSet.   *   * @param object   *        The object at the n side of the 1-n binding.   */ /*@   @ public behavior   @   @ pre object != null;   @   @ post getObject() == object;   @ post getStructureSet() == structureSet;   @ post structureSet != null ==> structureSet.contains(this);   @*/  public StructureElement(Object object, StructureSet structureSet) {    _object = object;    connectTo(structureSet);  }      /**   * Return the Object at the other end of this double binding.   */ /*@   @ public behavior   @   @ post getStructureSet() == null ==> \result == null;   @ post getStructureSet() != null ==> \result == getStructureSet().getObject();   @*/  public Object getOtherEnd() {    if (getStructureSet() == null) {        return null;    }    return getStructureSet().getObject();  }  /**   * Set the 1 side of this 10n binding.   *   * @param set   *        The new StructureSet this StructureElement will be connected to.   */ /*@   @ public behavior   @   @ post getStructureSet() == structureSet;   @ // If this StructureElement was connected before, and will now be   @ // connected to another StructureSet, it will be removed from the first one.   @ post \old(getStructureSet()) != null && \old(getStructureSet()) != structureSet ==>   @      ! \old(getStructureSet()).contains(this);   @ post structureSet != null ==> structureSet.contains(this);   @*/  public void connectTo(StructureSet structureSet) {    if (structureSet != _structureSet) {      if(_structureSet != null) {          _structureSet.unregister(this);      }      _structureSet=structureSet;      if (structureSet != null) {          structureSet.register(this);      }    }  }  /**   * Return the object on the n side of the 1-n binding represented by   * this StructureElement   */ /*@   @ public behavior   @   @ post \result != null;   @*/  public Object getObject() {    return _object;   }    /**   * return the structureSet this StructureElement belongs to   */  public StructureSet getStructureSet() {    return _structureSet;  }    /**   * The structureSet this StructureElement belongs to   */  private StructureSet _structureSet;    /**   * The object on the n side of the 1-n binding.   */  private Object _object;}/*<copyright>Copyright (C) 1997-2001. This software is copyrighted by the people and entities mentioned after the "@author" tags above, on behalf of the JUTIL.ORG Project. The copyright is dated by the dates after the "@date" tags above. All rights reserved.This software is published under the terms of the JUTIL.ORG SoftwareLicense version 1.1 or later, a copy of which has been included withthis distribution in the LICENSE file, which can also be found athttp://org-jutil.sourceforge.net/LICENSE. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the JUTIL.ORG Software License for more details.For more information, please see http://org-jutil.sourceforge.net/</copyright>*/

⌨️ 快捷键说明

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