You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ce...@apache.org on 2011/09/14 09:44:00 UTC
svn commit: r1170462 - in
/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util:
IterationEvent.java IterationListener.java IterationManager.java
Author: celestin
Date: Wed Sep 14 07:44:00 2011
New Revision: 1170462
URL: http://svn.apache.org/viewvc?rev=1170462&view=rev
Log:
svn:eol-style set to 'native'
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationEvent.java (contents, props changed)
commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationListener.java (contents, props changed)
commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationManager.java (contents, props changed)
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationEvent.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationEvent.java?rev=1170462&r1=1170461&r2=1170462&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationEvent.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationEvent.java Wed Sep 14 07:44:00 2011
@@ -1,40 +1,40 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math.util;
-
-import java.util.EventObject;
-
-/**
- * The root class from which all events occurring while running an
- * {@link IterationManager} should be derived.
- *
- * @version $Id$
- */
-public class IterationEvent extends EventObject {
- /** */
- private static final long serialVersionUID = -1405936936084001482L;
-
- /**
- * Creates a new instance of this class.
- *
- * @param source The iterative algorithm on which the event initially
- * occurred.
- */
- public IterationEvent(final Object source) {
- super(source);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math.util;
+
+import java.util.EventObject;
+
+/**
+ * The root class from which all events occurring while running an
+ * {@link IterationManager} should be derived.
+ *
+ * @version $Id$
+ */
+public class IterationEvent extends EventObject {
+ /** */
+ private static final long serialVersionUID = -1405936936084001482L;
+
+ /**
+ * Creates a new instance of this class.
+ *
+ * @param source The iterative algorithm on which the event initially
+ * occurred.
+ */
+ public IterationEvent(final Object source) {
+ super(source);
+ }
+}
Propchange: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationEvent.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationListener.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationListener.java?rev=1170462&r1=1170461&r2=1170462&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationListener.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationListener.java Wed Sep 14 07:44:00 2011
@@ -1,58 +1,58 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math.util;
-
-import java.util.EventListener;
-
-/**
- * The listener interface for receiving events occurring in an iterative
- * algorithm.
- *
- * @version $Id$
- */
-public interface IterationListener extends EventListener {
- /**
- * Invoked after completion of the initial phase of the iterative algorithm
- * (prior to the main iteration loop).
- *
- * @param e The {@link IterationEvent} object.
- */
- void initializationPerformed(IterationEvent e);
-
- /**
- * Invoked each time an iteration is completed (in the main iteration loop).
- *
- * @param e The {@link IterationEvent} object.
- */
- void iterationPerformed(IterationEvent e);
-
- /**
- * Invoked each time a new iteration is completed (in the main iteration
- * loop).
- *
- * @param e The {@link IterationEvent} object.
- */
- void iterationStarted(IterationEvent e);
-
- /**
- * Invoked after completion of the operations which occur after breaking out
- * of the main iteration loop.
- *
- * @param e The {@link IterationEvent} object.
- */
- void terminationPerformed(IterationEvent e);
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math.util;
+
+import java.util.EventListener;
+
+/**
+ * The listener interface for receiving events occurring in an iterative
+ * algorithm.
+ *
+ * @version $Id$
+ */
+public interface IterationListener extends EventListener {
+ /**
+ * Invoked after completion of the initial phase of the iterative algorithm
+ * (prior to the main iteration loop).
+ *
+ * @param e The {@link IterationEvent} object.
+ */
+ void initializationPerformed(IterationEvent e);
+
+ /**
+ * Invoked each time an iteration is completed (in the main iteration loop).
+ *
+ * @param e The {@link IterationEvent} object.
+ */
+ void iterationPerformed(IterationEvent e);
+
+ /**
+ * Invoked each time a new iteration is completed (in the main iteration
+ * loop).
+ *
+ * @param e The {@link IterationEvent} object.
+ */
+ void iterationStarted(IterationEvent e);
+
+ /**
+ * Invoked after completion of the operations which occur after breaking out
+ * of the main iteration loop.
+ *
+ * @param e The {@link IterationEvent} object.
+ */
+ void terminationPerformed(IterationEvent e);
+}
Propchange: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationManager.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationManager.java?rev=1170462&r1=1170461&r2=1170462&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationManager.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationManager.java Wed Sep 14 07:44:00 2011
@@ -1,155 +1,155 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math.util;
-
-import java.util.Collection;
-import java.util.concurrent.CopyOnWriteArrayList;
-
-/**
- * This abstract class provides a general framework for managing iterative
- * algorithms. The maximum number of iterations can be set, and methods are
- * provided to monitor the current iteration count. A lightweight event
- * framework is also provided.
- *
- * @version $Id$
- */
-public class IterationManager {
- /** Keeps a count of the number of iterations. */
- private final Incrementor iterations;
-
- /** The collection of all listeners attached to this iterative algorithm. */
- private final Collection<IterationListener> listeners;
-
- /**
- * Creates a new instance of this class.
- *
- * @param maxIterations Maximum number of iterations.
- */
- public IterationManager(final int maxIterations) {
- this.iterations = new Incrementor();
- this.iterations.setMaximalCount(maxIterations);
- this.listeners = new CopyOnWriteArrayList<IterationListener>();
- }
-
- /**
- * Attaches a listener to this manager.
- *
- * @param listener A {@code IterationListener} object.
- */
- public void addIterationListener(final IterationListener listener) {
- listeners.add(listener);
- }
-
- /**
- * Informs all registered listeners that the initial phase (prior to the
- * main iteration loop) has been completed.
- *
- * @param e The {@link IterationEvent} object.
- */
- public void fireInitializationEvent(final IterationEvent e) {
- for (IterationListener l : listeners) {
- l.initializationPerformed(e);
- }
- }
-
- /**
- * Informs all registered listeners that a new iteration (in the main
- * iteration loop) has been performed.
- *
- * @param e The {@link IterationEvent} object.
- */
- public void fireIterationPerformedEvent(final IterationEvent e) {
- for (IterationListener l : listeners) {
- l.iterationPerformed(e);
- }
- }
-
- /**
- * Informs all registered listeners that a new iteration (in the main
- * iteration loop) has been started.
- *
- * @param e The {@link IterationEvent} object.
- */
- public void fireIterationStartedEvent(final IterationEvent e) {
- for (IterationListener l : listeners) {
- l.iterationStarted(e);
- }
- }
-
- /**
- * Informs all registered listeners that the final phase (post-iterations)
- * has been completed.
- *
- * @param e The {@link IterationEvent} object.
- */
- public void fireTerminationEvent(final IterationEvent e) {
- for (IterationListener l : listeners) {
- l.terminationPerformed(e);
- }
- }
-
- /**
- * Returns the number of iterations of this solver, 0 if no iterations has
- * been performed yet.
- *
- * @return the number of iterations.
- */
- public int getIterations() {
- return iterations.getCount();
- }
-
- /**
- * Returns the maximum number of iterations.
- *
- * @return the maximum number of iterations.
- */
- public int getMaxIterations() {
- return iterations.getMaximalCount();
- }
-
- /**
- * Increments the iteration count by one, and throws an exception if the
- * maximum number of iterations is reached. This method should be called at
- * the beginning of a new iteration.
- *
- * @throws MaxCountExceededException if the maximum number of iterations
- * is reached.
- */
- public void incrementIterationCount() {
- iterations.incrementCount();
- }
-
- /**
- * Removes the specified iteration listener from the list of listeners
- * currently attached to {@code this} object. Attempting to remove a
- * listener which was <em>not</em> previously registered does not cause any
- * error.
- *
- * @param listener The {@link IterationListener} to be removed.
- */
- public void removeIterationListener(final IterationListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * Sets the iteration count to 0. This method must be called during the
- * initial phase.
- */
- public void resetIterationCount() {
- iterations.resetCount();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.math.util;
+
+import java.util.Collection;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+/**
+ * This abstract class provides a general framework for managing iterative
+ * algorithms. The maximum number of iterations can be set, and methods are
+ * provided to monitor the current iteration count. A lightweight event
+ * framework is also provided.
+ *
+ * @version $Id$
+ */
+public class IterationManager {
+ /** Keeps a count of the number of iterations. */
+ private final Incrementor iterations;
+
+ /** The collection of all listeners attached to this iterative algorithm. */
+ private final Collection<IterationListener> listeners;
+
+ /**
+ * Creates a new instance of this class.
+ *
+ * @param maxIterations Maximum number of iterations.
+ */
+ public IterationManager(final int maxIterations) {
+ this.iterations = new Incrementor();
+ this.iterations.setMaximalCount(maxIterations);
+ this.listeners = new CopyOnWriteArrayList<IterationListener>();
+ }
+
+ /**
+ * Attaches a listener to this manager.
+ *
+ * @param listener A {@code IterationListener} object.
+ */
+ public void addIterationListener(final IterationListener listener) {
+ listeners.add(listener);
+ }
+
+ /**
+ * Informs all registered listeners that the initial phase (prior to the
+ * main iteration loop) has been completed.
+ *
+ * @param e The {@link IterationEvent} object.
+ */
+ public void fireInitializationEvent(final IterationEvent e) {
+ for (IterationListener l : listeners) {
+ l.initializationPerformed(e);
+ }
+ }
+
+ /**
+ * Informs all registered listeners that a new iteration (in the main
+ * iteration loop) has been performed.
+ *
+ * @param e The {@link IterationEvent} object.
+ */
+ public void fireIterationPerformedEvent(final IterationEvent e) {
+ for (IterationListener l : listeners) {
+ l.iterationPerformed(e);
+ }
+ }
+
+ /**
+ * Informs all registered listeners that a new iteration (in the main
+ * iteration loop) has been started.
+ *
+ * @param e The {@link IterationEvent} object.
+ */
+ public void fireIterationStartedEvent(final IterationEvent e) {
+ for (IterationListener l : listeners) {
+ l.iterationStarted(e);
+ }
+ }
+
+ /**
+ * Informs all registered listeners that the final phase (post-iterations)
+ * has been completed.
+ *
+ * @param e The {@link IterationEvent} object.
+ */
+ public void fireTerminationEvent(final IterationEvent e) {
+ for (IterationListener l : listeners) {
+ l.terminationPerformed(e);
+ }
+ }
+
+ /**
+ * Returns the number of iterations of this solver, 0 if no iterations has
+ * been performed yet.
+ *
+ * @return the number of iterations.
+ */
+ public int getIterations() {
+ return iterations.getCount();
+ }
+
+ /**
+ * Returns the maximum number of iterations.
+ *
+ * @return the maximum number of iterations.
+ */
+ public int getMaxIterations() {
+ return iterations.getMaximalCount();
+ }
+
+ /**
+ * Increments the iteration count by one, and throws an exception if the
+ * maximum number of iterations is reached. This method should be called at
+ * the beginning of a new iteration.
+ *
+ * @throws MaxCountExceededException if the maximum number of iterations
+ * is reached.
+ */
+ public void incrementIterationCount() {
+ iterations.incrementCount();
+ }
+
+ /**
+ * Removes the specified iteration listener from the list of listeners
+ * currently attached to {@code this} object. Attempting to remove a
+ * listener which was <em>not</em> previously registered does not cause any
+ * error.
+ *
+ * @param listener The {@link IterationListener} to be removed.
+ */
+ public void removeIterationListener(final IterationListener listener) {
+ listeners.remove(listener);
+ }
+
+ /**
+ * Sets the iteration count to 0. This method must be called during the
+ * initial phase.
+ */
+ public void resetIterationCount() {
+ iterations.resetCount();
+ }
+}
Propchange: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/IterationManager.java
------------------------------------------------------------------------------
svn:eol-style = native