/*
 * JaamSim Discrete Event Simulation
 * Copyright (C) 2013 Ausenco Engineering Canada Inc.
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */
package com.jaamsim.CalculationObjects;

import com.jaamsim.input.Keyword;
import com.jaamsim.input.ValueInput;
import com.jaamsim.units.DimensionlessUnit;
import com.sandwell.JavaSimulation.EntityInput;
import com.sandwell.JavaSimulation.InputErrorException;
import com.sandwell.JavaSimulation3D.DisplayEntity;

/**
 * CalculationEntity is the super-class for all Calculation Objects.
 * @author Harry King
 *
 */
public abstract class CalculationEntity extends DisplayEntity {

	@Keyword(description = "The Controller that controls the updating of the calculation.",
	         example = "Calculation1 Controller { PLC1 }")
	private final EntityInput<Controller> controllerInput;

	@Keyword(description = "The sequence number used by the Controller to determine the order in which calculations are performed." +
			"  A calculation with a lower value is executed before the ones with higher values.",
	         example = "Calculation1 SequenceNumber { 2.1 }")
	private final ValueInput sequenceNumberInput;

	{
		controllerInput = new EntityInput<Controller>( Controller.class, "Controller", "Key Inputs", null);
		this.addInput( controllerInput, true);

		sequenceNumberInput = new ValueInput( "SequenceNumber", "Key Inputs", 0.0);
		sequenceNumberInput.setValidRange(0.0d, Double.POSITIVE_INFINITY);
		sequenceNumberInput.setUnitType(DimensionlessUnit.class);
		this.addInput( sequenceNumberInput, true);
	}

	@Override
	public void validate() {
		super.validate();

		// Confirm that controller has been specified
		if( controllerInput.getValue() == null ) {
			throw new InputErrorException( "The keyword Controller must be set." );
		}
	}

	public double getSequenceNumber() {
		return sequenceNumberInput.getValue();
	}

	/*
	 * Calculate the current value for this object.
	 */
	public abstract void update(double simTime);

	public Controller getController() {
		return controllerInput.getValue();
	}
}

@@ -1269,21 +1269,16 @@
 ntroller
-Input
 ;%0A%0A%09@Key
@@ -1591,21 +1591,16 @@
 ceNumber
-Input
 ;%0A%0A%09%7B%0A%09%09
@@ -1609,21 +1609,16 @@
 ntroller
-Input
  = new E
@@ -1721,21 +1721,16 @@
 ntroller
-Input
 , true);
@@ -1747,21 +1747,16 @@
 ceNumber
-Input
  = new V
@@ -1816,29 +1816,24 @@
 quenceNumber
-Input
 .setValidRan
@@ -1884,21 +1884,16 @@
 ceNumber
-Input
 .setUnit
@@ -1954,21 +1954,16 @@
 ceNumber
-Input
 , true);
@@ -2081,37 +2081,32 @@
 %09%09if( controller
-Input
 .getValue() == n
@@ -2256,21 +2256,16 @@
 ceNumber
-Input
 .getValu
@@ -2434,21 +2434,16 @@
 ntroller
-Input
 .getValu

Rename input objects for CalculationEntity