ExportSink.java

/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.mklab.tool.control.system.sink;

import org.mklab.nfc.matrix.ComplexNumericalMatrix;
import org.mklab.nfc.matrix.RealNumericalMatrix;
import org.mklab.nfc.scalar.ComplexNumericalScalar;
import org.mklab.nfc.scalar.RealNumericalScalar;
import org.mklab.tool.control.system.parameter.Parameter;
import org.mklab.tool.control.system.parameter.ParameterUpdator;
import org.mklab.tool.control.system.parameter.StringExternalizable;


/**
 * 信号の出力先を表すクラスです。
 * 
 * @author Yuhi Ishikura
  * @param <RS> type of real scalar
 * @param <RM> type of real matrix
 * @param <CS> type of complex scalar
 * @param <CM> type of complex matrix
*/
public abstract class ExportSink<RS extends RealNumericalScalar<RS,RM,CS,CM>, RM extends RealNumericalMatrix<RS,RM,CS,CM>, CS extends ComplexNumericalScalar<RS,RM,CS,CM>, CM extends ComplexNumericalMatrix<RS,RM,CS,CM>> extends ContinuousSink<RS,RM,CS,CM> implements Exporter, ParameterUpdator, StringExternalizable {

  /** エキスポート可能ならばtrue */
  @Parameter(name = "exportable", description = "ExportSink.1", update = true, internationalization = true)
  private boolean exportable = true;

  /**
   * {@link ExportSink}オブジェクトを構築します。
   * @param sunit unit of scalar
   */
  public ExportSink(RS sunit) {
    super(sunit);
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public void setExportable(final boolean exportable) {
    this.exportable = exportable;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public boolean isExportable() {
    return this.exportable;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public String getString(String key) {
    return Messages.getString(key);
  }

  /**
   * {@inheritDoc}
   */
  @Override
  public boolean updateWith(String parameter) {
    if (parameter.equals("exportable")) { //$NON-NLS-1$
      setExportable(this.exportable);
      return true;
    }

    return false;
  }

}