source: src/main/java/agents/anac/y2019/harddealer/math3/ode/sampling/DummyStepHandler.java

Last change on this file was 200, checked in by Katsuhide Fujita, 5 years ago

Add ANAC 2019 agents

  • Property svn:executable set to *
File size: 3.1 KB
Line 
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
18package agents.anac.y2019.harddealer.math3.ode.sampling;
19
20/**
21 * This class is a step handler that does nothing.
22
23 * <p>This class is provided as a convenience for users who are only
24 * interested in the final state of an integration and not in the
25 * intermediate steps. Its handleStep method does nothing.</p>
26 *
27 * <p>Since this class has no internal state, it is implemented using
28 * the Singleton design pattern. This means that only one instance is
29 * ever created, which can be retrieved using the getInstance
30 * method. This explains why there is no public constructor.</p>
31 *
32 * @see StepHandler
33 * @since 1.2
34 */
35
36public class DummyStepHandler implements StepHandler {
37
38 /** Private constructor.
39 * The constructor is private to prevent users from creating
40 * instances (Singleton design-pattern).
41 */
42 private DummyStepHandler() {
43 }
44
45 /** Get the only instance.
46 * @return the only instance
47 */
48 public static DummyStepHandler getInstance() {
49 return LazyHolder.INSTANCE;
50 }
51
52 /** {@inheritDoc} */
53 public void init(double t0, double[] y0, double t) {
54 }
55
56 /**
57 * Handle the last accepted step.
58 * This method does nothing in this class.
59 * @param interpolator interpolator for the last accepted step. For
60 * efficiency purposes, the various integrators reuse the same
61 * object on each call, so if the instance wants to keep it across
62 * all calls (for example to provide at the end of the integration a
63 * continuous model valid throughout the integration range), it
64 * should build a local copy using the clone method and store this
65 * copy.
66 * @param isLast true if the step is the last one
67 */
68 public void handleStep(final StepInterpolator interpolator, final boolean isLast) {
69 }
70
71 // CHECKSTYLE: stop HideUtilityClassConstructor
72 /** Holder for the instance.
73 * <p>We use here the Initialization On Demand Holder Idiom.</p>
74 */
75 private static class LazyHolder {
76 /** Cached field instance. */
77 private static final DummyStepHandler INSTANCE = new DummyStepHandler();
78 }
79 // CHECKSTYLE: resume HideUtilityClassConstructor
80
81 /** Handle deserialization of the singleton.
82 * @return the singleton instance
83 */
84 private Object readResolve() {
85 // return the singleton instance
86 return LazyHolder.INSTANCE;
87 }
88
89}
Note: See TracBrowser for help on using the repository browser.