/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 4.0.2
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package org.opensim.modeling;

/**
 * A class for representing a StepFunction.<br>
 * <br>
 *          {   start_value,    t &lt;= start_time <br>
 * f(t) =   {   S-polynomial(t), start_time &lt; t &lt; end_time<br>
 *          {   end_value,      t &gt;= end_time<br>
 * <br>
 * This class inherits from Function and so can be used as input to<br>
 * any class requiring a Function as input.<br>
 * <br>
 * @author Ajay Seth<br>
 * @version 1.0
 */
public class StepFunction extends Function {
  private transient long swigCPtr;

  public StepFunction(long cPtr, boolean cMemoryOwn) {
    super(opensimCommonJNI.StepFunction_SWIGUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

  public static long getCPtr(StepFunction obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  @SuppressWarnings("deprecation")
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        opensimCommonJNI.delete_StepFunction(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public static StepFunction safeDownCast(OpenSimObject obj) {
    long cPtr = opensimCommonJNI.StepFunction_safeDownCast(OpenSimObject.getCPtr(obj), obj);
    return (cPtr == 0) ? null : new StepFunction(cPtr, false);
  }

  public void assign(OpenSimObject aObject) {
    opensimCommonJNI.StepFunction_assign(swigCPtr, this, OpenSimObject.getCPtr(aObject), aObject);
  }

  public static String getClassName() {
    return opensimCommonJNI.StepFunction_getClassName();
  }

  public OpenSimObject clone() {
    long cPtr = opensimCommonJNI.StepFunction_clone(swigCPtr, this);
    return (cPtr == 0) ? null : new StepFunction(cPtr, true);
  }

  public String getConcreteClassName() {
    return opensimCommonJNI.StepFunction_getConcreteClassName(swigCPtr, this);
  }

  public StepFunction() {
    this(opensimCommonJNI.new_StepFunction__SWIG_0(), true);
  }

  public StepFunction(double startTime, double endTime, double startValue, double endValue) {
    this(opensimCommonJNI.new_StepFunction__SWIG_1(startTime, endTime, startValue, endValue), true);
  }

  public StepFunction(double startTime, double endTime, double startValue) {
    this(opensimCommonJNI.new_StepFunction__SWIG_2(startTime, endTime, startValue), true);
  }

  public StepFunction(double startTime, double endTime) {
    this(opensimCommonJNI.new_StepFunction__SWIG_3(startTime, endTime), true);
  }

  public StepFunction(StepFunction aSpline) {
    this(opensimCommonJNI.new_StepFunction__SWIG_4(StepFunction.getCPtr(aSpline), aSpline), true);
  }

  /**
   *  %Set step transition start time 
   */
  public void setStartTime(double time) {
    opensimCommonJNI.StepFunction_setStartTime(swigCPtr, this, time);
  }

  /**
   *  Get step transition time 
   */
  public double getStartTime() {
    return opensimCommonJNI.StepFunction_getStartTime(swigCPtr, this);
  }

  /**
   *  %Set step transition end time 
   */
  public void setEndTime(double time) {
    opensimCommonJNI.StepFunction_setEndTime(swigCPtr, this, time);
  }

  /**
   *  Get step transition time 
   */
  public double getEndTime() {
    return opensimCommonJNI.StepFunction_getEndTime(swigCPtr, this);
  }

  /**
   *  %Set start value before step 
   */
  public void setStartValue(double start) {
    opensimCommonJNI.StepFunction_setStartValue(swigCPtr, this, start);
  }

  /**
   *  Get start value before step 
   */
  public double getStartValue() {
    return opensimCommonJNI.StepFunction_getStartValue(swigCPtr, this);
  }

  /**
   *  %Set end value before step 
   */
  public void setEndValue(double end) {
    opensimCommonJNI.StepFunction_setEndValue(swigCPtr, this, end);
  }

  /**
   *  Get end value before step 
   */
  public double getEndValue() {
    return opensimCommonJNI.StepFunction_getEndValue(swigCPtr, this);
  }

  public SWIGTYPE_p_SimTK__Function createSimTKFunction() {
    long cPtr = opensimCommonJNI.StepFunction_createSimTKFunction(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_SimTK__Function(cPtr, false);
  }

}
