Package easysm.stores

Source Code of easysm.stores.StateObserver

package easysm.stores;

import easysm.Constants;
import easysm.datatypes.Expr;
import easysm.datatypes.information.StateObserverInfo;
import easysm.datatypes.visualization.StateObserverVis;

/**
* @author FourCheeses Software Solutions
*/
public class StateObserver extends Element
{
  /**
   * Required field to make serialization more robust. See documentation for
   * technical details.
   */
  private static final long serialVersionUID = 5323340233829373603L;

  private Type type;
  private Expr invariant;
  private StateObserverVis vis;
 
  public final static StateObserver FINAL;
 
  static {
    StateObserverInfo finalSoInfo = new StateObserverInfo(Constants.FINAL_NAME, Type.BOOLEAN, Expr.EMPTY);
    FINAL = new StateObserver(finalSoInfo);
  }

  public StateObserver(StateObserverInfo stateObserverInfo)
  {
    super(stateObserverInfo);
    changeType(stateObserverInfo.type());
    changeInvariant(stateObserverInfo.invariant());
    vis = new StateObserverVis(this);
  }

  /*
   *
   * Properties
   *
   */

  public Type type()
  {
    return type;
  }

  public void changeType(Type newType)
  {
    if (newType != null) {
      type = newType;
    }
  }

  public Expr invariant()
  {
    return invariant;
  }

  public void changeInvariant(Expr newInvariant)
  {
    invariant = (newInvariant != null) ? newInvariant : Expr.EMPTY;
  }
 
  public StateObserverVis vis()
  {
    return vis;
  }

  /*
   *
   * Public methods
   *
   */
 
  @Override
  public String toString()
  {
    return name() + " : " + type.name();
  }
}
TOP

Related Classes of easysm.stores.StateObserver

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.