/* ----------------------------------------------------------------------------
 * 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.quantlib;

public class FdmStepConditionComposite extends FdmStepCondition {
  private transient long swigCPtr;
  private transient boolean swigCMemOwnDerived;

  protected FdmStepConditionComposite(long cPtr, boolean cMemoryOwn) {
    super(QuantLibJNI.FdmStepConditionComposite_SWIGSmartPtrUpcast(cPtr), true);
    swigCMemOwnDerived = cMemoryOwn;
    swigCPtr = cPtr;
  }

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

  protected void swigSetCMemOwn(boolean own) {
    swigCMemOwnDerived = own;
    super.swigSetCMemOwn(own);
  }

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

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwnDerived) {
        swigCMemOwnDerived = false;
        QuantLibJNI.delete_FdmStepConditionComposite(swigCPtr);
      }
      swigCPtr = 0;
    }
    super.delete();
  }

  public FdmStepConditionComposite(DoubleVector stoppingTimes, FdmStepConditionVector conditions) {
    this(QuantLibJNI.new_FdmStepConditionComposite(DoubleVector.getCPtr(stoppingTimes), stoppingTimes, FdmStepConditionVector.getCPtr(conditions), conditions), true);
  }

  public DoubleVector stoppingTimes() {
    return new DoubleVector(QuantLibJNI.FdmStepConditionComposite_stoppingTimes(swigCPtr, this), false);
  }

  public FdmStepConditionVector conditions() {
    return new FdmStepConditionVector(QuantLibJNI.FdmStepConditionComposite_conditions(swigCPtr, this), false);
  }

  public static FdmStepConditionComposite joinConditions(FdmSnapshotCondition c1, FdmStepConditionComposite c2) {
    long cPtr = QuantLibJNI.FdmStepConditionComposite_joinConditions(FdmSnapshotCondition.getCPtr(c1), c1, FdmStepConditionComposite.getCPtr(c2), c2);
    return (cPtr == 0) ? null : new FdmStepConditionComposite(cPtr, true);
  }

  public static FdmStepConditionComposite vanillaComposite(DividendSchedule schedule, Exercise exercise, FdmMesher mesher, FdmInnerValueCalculator calculator, Date refDate, DayCounter dayCounter) {
    long cPtr = QuantLibJNI.FdmStepConditionComposite_vanillaComposite(DividendSchedule.getCPtr(schedule), schedule, Exercise.getCPtr(exercise), exercise, FdmMesher.getCPtr(mesher), mesher, FdmInnerValueCalculator.getCPtr(calculator), calculator, Date.getCPtr(refDate), refDate, DayCounter.getCPtr(dayCounter), dayCounter);
    return (cPtr == 0) ? null : new FdmStepConditionComposite(cPtr, true);
  }

}
