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 * @version $Id: StepNormalizerBounds.java 1416643 2012-12-03 19:37:14Z tn $
028 * @since 3.0
029 */
030public enum StepNormalizerBounds {
031    /** Do not include the first and last points. */
032    NEITHER(false, false),
033
034    /** Include the first point, but not the last point. */
035    FIRST(true, false),
036
037    /** Include the last point, but not the first point. */
038    LAST(false, true),
039
040    /** Include both the first and last points. */
041    BOTH(true, true);
042
043    /** Whether the first point should be passed to the underlying fixed
044     * step size step handler.
045     */
046    private final boolean first;
047
048    /** Whether the last point should be passed to the underlying fixed
049     * step size step handler.
050     */
051    private final boolean last;
052
053    /**
054     * Simple constructor.
055     * @param first Whether the first point should be passed to the
056     * underlying fixed step size step handler.
057     * @param last Whether the last point should be passed to the
058     * underlying fixed step size step handler.
059     */
060    private StepNormalizerBounds(final boolean first, final boolean last) {
061        this.first = first;
062        this.last = last;
063    }
064
065    /**
066     * Returns a value indicating whether the first point should be passed
067     * to the underlying fixed step size step handler.
068     * @return value indicating whether the first point should be passed
069     * to the underlying fixed step size step handler.
070     */
071    public boolean firstIncluded() {
072        return first;
073    }
074
075    /**
076     * Returns a value indicating whether the last point should be passed
077     * to the underlying fixed step size step handler.
078     * @return value indicating whether the last point should be passed
079     * to the underlying fixed step size step handler.
080     */
081    public boolean lastIncluded() {
082        return last;
083    }
084}