StepNormalizerBounds.java

  1. /*
  2.  * Licensed to the Apache Software Foundation (ASF) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * The ASF licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *      http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */

  17. package org.apache.commons.math4.legacy.ode.sampling;

  18. /** {@link StepNormalizer Step normalizer} bounds settings. They influence
  19.  * whether the underlying fixed step size step handler is called for the first
  20.  * and last points. Note that if the last point coincides with a normalized
  21.  * point, then the underlying fixed step size step handler is always called,
  22.  * regardless of these settings.
  23.  * @see FieldStepNormalizer
  24.  * @see StepNormalizer
  25.  * @see StepNormalizerMode
  26.  * @since 3.0
  27.  */
  28. public enum StepNormalizerBounds {
  29.     /** Do not include the first and last points. */
  30.     NEITHER(false, false),

  31.     /** Include the first point, but not the last point. */
  32.     FIRST(true, false),

  33.     /** Include the last point, but not the first point. */
  34.     LAST(false, true),

  35.     /** Include both the first and last points. */
  36.     BOTH(true, true);

  37.     /** Whether the first point should be passed to the underlying fixed
  38.      * step size step handler.
  39.      */
  40.     private final boolean first;

  41.     /** Whether the last point should be passed to the underlying fixed
  42.      * step size step handler.
  43.      */
  44.     private final boolean last;

  45.     /**
  46.      * Simple constructor.
  47.      * @param first Whether the first point should be passed to the
  48.      * underlying fixed step size step handler.
  49.      * @param last Whether the last point should be passed to the
  50.      * underlying fixed step size step handler.
  51.      */
  52.     StepNormalizerBounds(final boolean first, final boolean last) {
  53.         this.first = first;
  54.         this.last = last;
  55.     }

  56.     /**
  57.      * Returns a value indicating whether the first point should be passed
  58.      * to the underlying fixed step size step handler.
  59.      * @return value indicating whether the first point should be passed
  60.      * to the underlying fixed step size step handler.
  61.      */
  62.     public boolean firstIncluded() {
  63.         return first;
  64.     }

  65.     /**
  66.      * Returns a value indicating whether the last point should be passed
  67.      * to the underlying fixed step size step handler.
  68.      * @return value indicating whether the last point should be passed
  69.      * to the underlying fixed step size step handler.
  70.      */
  71.     public boolean lastIncluded() {
  72.         return last;
  73.     }
  74. }