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.math.ode; 19 20 import java.io.Serializable; 21 22 /** 23 * This class is a step handler that do nothing. 24 25 * <p>This class is provided as a convenience for users who are only 26 * interested in the final state of an integration and not in the 27 * intermediate steps. Its handleStep method does nothing.</p> 28 * 29 * <p>Since this class has no internal state, it is implemented using 30 * the Singleton design pattern. This means that only one instance is 31 * ever created, which can be retrieved using the getInstance 32 * method. This explains why there is no public constructor.</p> 33 * 34 * @see StepHandler 35 * @version $Revision: 620312 $ $Date: 2008-02-10 12:28:59 -0700 (Sun, 10 Feb 2008) $ 36 * @since 1.2 37 */ 38 39 public class DummyStepHandler 40 implements StepHandler, Serializable { 41 42 /** Private constructor. 43 * The constructor is private to prevent users from creating 44 * instances (Singleton design-pattern). 45 */ 46 private DummyStepHandler() { 47 } 48 49 /** Get the only instance. 50 * @return the only instance 51 */ 52 public static DummyStepHandler getInstance() { 53 return instance; 54 } 55 56 /** Determines whether this handler needs dense output. 57 * Since this handler does nothing, it does not require dense output. 58 * @return always false 59 */ 60 public boolean requiresDenseOutput() { 61 return false; 62 } 63 64 /** Reset the step handler. 65 * Initialize the internal data as required before the first step is 66 * handled. 67 */ 68 public void reset() { 69 } 70 71 /** 72 * Handle the last accepted step. 73 * This method does nothing in this class. 74 * @param interpolator interpolator for the last accepted step. For 75 * efficiency purposes, the various integrators reuse the same 76 * object on each call, so if the instance wants to keep it across 77 * all calls (for example to provide at the end of the integration a 78 * continuous model valid throughout the integration range), it 79 * should build a local copy using the clone method and store this 80 * copy. 81 * @param isLast true if the step is the last one 82 */ 83 public void handleStep(StepInterpolator interpolator, boolean isLast) { 84 } 85 86 /** The only instance. */ 87 private static DummyStepHandler instance = new DummyStepHandler(); 88 89 /** Serializable version identifier */ 90 private static final long serialVersionUID = 2731635121223090252L; 91 92 }