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

/** 
 *  
 * @internal
 */

public class MathFilter extends ElementFilter {
   private long swigCPtr;

   protected MathFilter(long cPtr, boolean cMemoryOwn)
   {
     super(libsbmlJNI.MathFilter_SWIGUpcast(cPtr), cMemoryOwn);
     swigCPtr = cPtr;
   }

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

   protected static long getCPtrAndDisown (MathFilter obj)
   {
     long ptr = 0;

     if (obj != null)
     {
       ptr             = obj.swigCPtr;
       obj.swigCMemOwn = false;
     }

     return ptr;
   }

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

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

  protected void swigDirectorDisconnect() {
    swigCMemOwn = false;
    delete();
  }

  public void swigReleaseOwnership() {
    swigCMemOwn = false;
    libsbmlJNI.MathFilter_change_ownership(this, swigCPtr, false);
  }

  public void swigTakeOwnership() {
    swigCMemOwn = true;
    libsbmlJNI.MathFilter_change_ownership(this, swigCPtr, true);
  }

  public MathFilter() {
    this(libsbmlJNI.new_MathFilter(), true);
    libsbmlJNI.MathFilter_director_connect(this, swigCPtr, true, true);
  }

  
/**
   * Predicate to test elements.
   <p>
   * This is the central predicate of the {@link ElementFilter} class.  In subclasses
   * of {@link ElementFilter}, callers should implement this method such that it
   * returns <code>true</code> for <code>element</code> arguments that are 'desirable' and
   * <code>false</code> for those that are 'undesirable' in whatever filtering context the
   * {@link ElementFilter} subclass is designed to be used.
   <p>
   * @param element the element to be tested.
   <p>
   * @return <code>true</code> if the <code>element</code> is desirable or should be kept,
   * <code>false</code> otherwise.
   */ public
 boolean filter(SBase element) {
    return (getClass() == MathFilter.class) ? libsbmlJNI.MathFilter_filter(swigCPtr, this, SBase.getCPtr(element), element) : libsbmlJNI.MathFilter_filterSwigExplicitMathFilter(swigCPtr, this, SBase.getCPtr(element), element);
  }

}
