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
18 package org.apache.commons.math4.legacy.ode.sampling;
19
20 /** {@link StepNormalizer Step normalizer} bounds settings. They influence
21 * whether the underlying fixed step size step handler is called for the first
22 * and last points. Note that if the last point coincides with a normalized
23 * point, then the underlying fixed step size step handler is always called,
24 * regardless of these settings.
25 * @see FieldStepNormalizer
26 * @see StepNormalizer
27 * @see StepNormalizerMode
28 * @since 3.0
29 */
30 public enum StepNormalizerBounds {
31 /** Do not include the first and last points. */
32 NEITHER(false, false),
33
34 /** Include the first point, but not the last point. */
35 FIRST(true, false),
36
37 /** Include the last point, but not the first point. */
38 LAST(false, true),
39
40 /** Include both the first and last points. */
41 BOTH(true, true);
42
43 /** Whether the first point should be passed to the underlying fixed
44 * step size step handler.
45 */
46 private final boolean first;
47
48 /** Whether the last point should be passed to the underlying fixed
49 * step size step handler.
50 */
51 private final boolean last;
52
53 /**
54 * Simple constructor.
55 * @param first Whether the first point should be passed to the
56 * underlying fixed step size step handler.
57 * @param last Whether the last point should be passed to the
58 * underlying fixed step size step handler.
59 */
60 StepNormalizerBounds(final boolean first, final boolean last) {
61 this.first = first;
62 this.last = last;
63 }
64
65 /**
66 * Returns a value indicating whether the first point should be passed
67 * to the underlying fixed step size step handler.
68 * @return value indicating whether the first point should be passed
69 * to the underlying fixed step size step handler.
70 */
71 public boolean firstIncluded() {
72 return first;
73 }
74
75 /**
76 * Returns a value indicating whether the last point should be passed
77 * to the underlying fixed step size step handler.
78 * @return value indicating whether the last point should be passed
79 * to the underlying fixed step size step handler.
80 */
81 public boolean lastIncluded() {
82 return last;
83 }
84 }