Skip to content

InscoperAPI/Build/Java/com.inscoper.api/com/inscoper/api/RecipeElement.java

Packages

Name
com.inscoper.api

Classes

Name
class com.inscoper.api.RecipeElement
RecipeElement class is the abstract base class for all recipe elements.

Source code

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

package com.inscoper.api;
import com.inscoper.api.logging.*;

public class RecipeElement {
  private transient long swigCPtr;
  private transient boolean swigCMemOwn;

  protected RecipeElement(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

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

  protected void swigSetCMemOwn(boolean own) {
    swigCMemOwn = own;
  }

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

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        InscoperJNI.delete_RecipeElement(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public static RecipeElement createProxy(long cPtr, boolean cMemoryOwn) {
    if (cPtr == 0) return null;
    RecipeElement tmp = new RecipeElement(cPtr, false);
    int type = tmp.getRealType();
    switch(type) {
         case 1: return new RecipeElementSimple(cPtr, cMemoryOwn);   case 2: return new RecipeElementEvent(cPtr, cMemoryOwn);   case 3: return new RecipeElementGroup(cPtr, cMemoryOwn); 
        default: return new RecipeElement(cPtr, cMemoryOwn);
    }
  }

  { }

  public void fromXML(XMLNode xml) throws com.inscoper.api.InscoperException {
    InscoperJNI.RecipeElement_fromXML(swigCPtr, this, XMLNode.getCPtr(xml), xml);
  }

  public void toXML(XMLNode xmlParent) throws com.inscoper.api.InscoperException {
    InscoperJNI.RecipeElement_toXML(swigCPtr, this, XMLNode.getCPtr(xmlParent), xmlParent);
  }

  public ERecipeElementType getType() {
    return ERecipeElementType.swigToEnum(InscoperJNI.RecipeElement_getType(swigCPtr, this));
  }

  public static RecipeElementSimple castToRecipeElementSimple(RecipeElement recipeElement) {
    long cPtr = InscoperJNI.RecipeElement_castToRecipeElementSimple(RecipeElement.getCPtr(recipeElement), recipeElement);
    return (cPtr == 0) ? null : new RecipeElementSimple(cPtr, true);
  }

  public static RecipeElementGroup castToRecipeElementGroup(RecipeElement recipeElement) {
    long cPtr = InscoperJNI.RecipeElement_castToRecipeElementGroup(RecipeElement.getCPtr(recipeElement), recipeElement);
    return (cPtr == 0) ? null : new RecipeElementGroup(cPtr, true);
  }

  public static RecipeElementEvent castToRecipeElementEvent(RecipeElement recipeElement) {
    long cPtr = InscoperJNI.RecipeElement_castToRecipeElementEvent(RecipeElement.getCPtr(recipeElement), recipeElement);
    return (cPtr == 0) ? null : new RecipeElementEvent(cPtr, true);
  }

  public int getRealType() {
    return InscoperJNI.RecipeElement_getRealType(swigCPtr, this);
  }

}

Updated on 2026-09-03 at 12:14:19 +0200