DoubleBaseSampledDataStaticSystem.java

/*
 * $Id: BaseSampledDataStaticSystem.java,v 1.6 2008/07/16 03:51:36 koga Exp $
 *
 * Copyright (C) 2004-2005 Koga Laboratory. All rights reserved.
 */

package org.mklab.tool.control.system.sampled;

import org.mklab.nfc.matrix.DoubleMatrix;
import org.mklab.nfc.ode.SolverStopException;
import org.mklab.tool.control.system.DoubleSystemOperator;


/**
 * サンプル値静的システムを表わすクラスです。
 * 
 * @author koga
 * @version $Revision: 1.6 $
 */
public abstract class DoubleBaseSampledDataStaticSystem extends DoubleSystemOperator implements DoubleSampledDataStaticSystem {

  /** サンプリング点ならばtrue */
  private boolean atSamplingPoint;

  /**
   * 新しく生成された<code>AbstractSampledDataStaticSystem</code>オブジェクトを初期化します。
   * 
   * @param inputSize 入力の数
   * @param outputSize 出力の数
   */
  public DoubleBaseSampledDataStaticSystem(final int inputSize, final int outputSize) {
    super();
    setInputSize(inputSize);
    setOutputSize(outputSize);
    setDynamic(false);
    if (inputSize == 0) {
      setForcedSystem(false);
    }
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#initialize()
   */
  @Override
  public void initialize() {
    this.atSamplingPoint = false;
  }

  /**
   * {@inheritDoc}
   */
  public DoubleMatrix outputEquation( final double t) throws SolverStopException {
    throw new SolverStopException(Messages.getString("BaseSampledDataStaticSystem.0")); //$NON-NLS-1$
  }

  /**
   * {@inheritDoc}
   */
  public DoubleMatrix outputEquation( final double t,  final DoubleMatrix input) throws SolverStopException {
    throw new SolverStopException(Messages.getString("BaseSampledDataStaticSystem.1")); //$NON-NLS-1$
  }

  /**
   * @see org.mklab.nfc.ode.Sampling#isAtSamplingPoint()
   */
  public boolean isAtSamplingPoint() {
    return this.atSamplingPoint;
  }

  /**
   * @see org.mklab.nfc.ode.Sampling#setAtSamplingPoint(boolean)
   */
  public void setAtSamplingPoint(final boolean samplingPoint) {
    this.atSamplingPoint = samplingPoint;
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#equals(java.lang.Object)
   */
  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (!super.equals(o)) {
      return false;
    }
    if (o == null) {
      return false;
    }
    if (o.getClass() != getClass()) {
      return false;
    }
    DoubleBaseSampledDataStaticSystem castedObj = (DoubleBaseSampledDataStaticSystem)o;
    return ((this.atSamplingPoint == castedObj.atSamplingPoint));
  }

  /**
   * @see org.mklab.tool.control.system.SystemOperator#hashCode()
   */
  @Override
  public int hashCode() {
    int hashCode = super.hashCode();
    hashCode = 31 * hashCode + (this.atSamplingPoint ? 1231 : 1237);
    return hashCode;
  }
}