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.math3.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 StepNormalizer
  24.  * @see StepNormalizerMode
  25.  * @since 3.0
  26.  */
  27. public enum StepNormalizerBounds {
  28.     /** Do not include the first and last points. */
  29.     NEITHER(false, false),

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

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

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

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

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

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

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

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