Author: luc
Date: Sun Jan  4 04:06:44 2009
New Revision: 731230

URL: http://svn.apache.org/viewvc?rev=731230&view=rev
Log:
added default implementations of the matrix visitors interfaces

Added:
    
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DefaultRealMatrixChangingVisitor.java
   (with props)
    
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.java
   (with props)
Modified:
    
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java
    
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixPreservingVisitor.java

Added: 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DefaultRealMatrixChangingVisitor.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DefaultRealMatrixChangingVisitor.java?rev=731230&view=auto
==============================================================================
--- 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DefaultRealMatrixChangingVisitor.java
 (added)
+++ 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DefaultRealMatrixChangingVisitor.java
 Sun Jan  4 04:06:44 2009
@@ -0,0 +1,51 @@
+/*
+ * 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.linear;
+
+/**
+ * Default implementation of the {...@link RealMatrixChangingVisitor} 
interface.
+ * <p>
+ * This class is a convenience to create custom visitors without defining all
+ * methods. This class provides default implementations that do nothing.
+ * </p>
+ * 
+ * @version $Revision$ $Date$
+ * @since 2.0
+ */
+public class DefaultRealMatrixChangingVisitor implements 
RealMatrixChangingVisitor {
+
+    /** Serializable version identifier. */
+    private static final long serialVersionUID = 892744666836410796L;
+
+    /** {...@inheritdoc} */
+    public void start(int rows, int columns,
+                      int startRow, int endRow, int startColumn, int 
endColumn) {
+    }
+
+    /** {...@inheritdoc} */
+    public double visit(int row, int column, double value)
+        throws MatrixVisitorException {
+        return value;
+    }
+
+    /** {...@inheritdoc} */
+    public double end() {
+        return 0;
+    }
+
+}

Propchange: 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DefaultRealMatrixChangingVisitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DefaultRealMatrixChangingVisitor.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.java?rev=731230&view=auto
==============================================================================
--- 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.java
 (added)
+++ 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.java
 Sun Jan  4 04:06:44 2009
@@ -0,0 +1,50 @@
+/*
+ * 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.linear;
+
+/**
+ * Default implementation of the {...@link RealMatrixPreservingVisitor} 
interface.
+ * <p>
+ * This class is a convenience to create custom visitors without defining all
+ * methods. This class provides default implementations that do nothing.
+ * </p>
+ * 
+ * @version $Revision$ $Date$
+ * @since 2.0
+ */
+public class DefaultRealMatrixPreservingVisitor implements 
RealMatrixPreservingVisitor {
+
+    /** Serializable version identifier. */
+    private static final long serialVersionUID = -7608224814444142788L;
+
+    /** {...@inheritdoc} */
+    public void start(int rows, int columns,
+                      int startRow, int endRow, int startColumn, int 
endColumn) {
+    }
+
+    /** {...@inheritdoc} */
+    public void visit(int row, int column, double value)
+        throws MatrixVisitorException {
+    }
+
+    /** {...@inheritdoc} */
+    public double end() {
+        return 0;
+    }
+
+}

Propchange: 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/DefaultRealMatrixPreservingVisitor.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java?rev=731230&r1=731229&r2=731230&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java
 (original)
+++ 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixChangingVisitor.java
 Sun Jan  4 04:06:44 2009
@@ -22,6 +22,7 @@
 /**
  * Interface defining a visitor for matrix entries.
  * 
+ * @see DefaultRealMatrixChangingVisitor
  * @version $Revision$ $Date$
  * @since 2.0
  */

Modified: 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixPreservingVisitor.java
URL: 
http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixPreservingVisitor.java?rev=731230&r1=731229&r2=731230&view=diff
==============================================================================
--- 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixPreservingVisitor.java
 (original)
+++ 
commons/proper/math/trunk/src/java/org/apache/commons/math/linear/RealMatrixPreservingVisitor.java
 Sun Jan  4 04:06:44 2009
@@ -22,6 +22,7 @@
 /**
  * Interface defining a visitor for matrix entries.
  * 
+ * @see DefaultRealMatrixPreservingVisitor
  * @version $Revision$ $Date$
  * @since 2.0
  */


Reply via email to