001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017
018package org.apache.commons.math3.ode.sampling;
019
020/** {@link StepNormalizer Step normalizer} bounds settings. They influence
021 * whether the underlying fixed step size step handler is called for the first
022 * and last points. Note that if the last point coincides with a normalized
023 * point, then the underlying fixed step size step handler is always called,
024 * regardless of these settings.
025 * @see StepNormalizer
026 * @see StepNormalizerMode
027 * @since 3.0
028 */
029public enum StepNormalizerBounds {
030    /** Do not include the first and last points. */
031    NEITHER(false, false),
032
033    /** Include the first point, but not the last point. */
034    FIRST(true, false),
035
036    /** Include the last point, but not the first point. */
037    LAST(false, true),
038
039    /** Include both the first and last points. */
040    BOTH(true, true);
041
042    /** Whether the first point should be passed to the underlying fixed
043     * step size step handler.
044     */
045    private final boolean first;
046
047    /** Whether the last point should be passed to the underlying fixed
048     * step size step handler.
049     */
050    private final boolean last;
051
052    /**
053     * Simple constructor.
054     * @param first Whether the first point should be passed to the
055     * underlying fixed step size step handler.
056     * @param last Whether the last point should be passed to the
057     * underlying fixed step size step handler.
058     */
059    private StepNormalizerBounds(final boolean first, final boolean last) {
060        this.first = first;
061        this.last = last;
062    }
063
064    /**
065     * Returns a value indicating whether the first point should be passed
066     * to the underlying fixed step size step handler.
067     * @return value indicating whether the first point should be passed
068     * to the underlying fixed step size step handler.
069     */
070    public boolean firstIncluded() {
071        return first;
072    }
073
074    /**
075     * Returns a value indicating whether the last point should be passed
076     * to the underlying fixed step size step handler.
077     * @return value indicating whether the last point should be passed
078     * to the underlying fixed step size step handler.
079     */
080    public boolean lastIncluded() {
081        return last;
082    }
083}