You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by ju...@apache.org on 2002/02/20 23:12:14 UTC
cvs commit: jakarta-turbine-maven/src/java/org/apache/maven/jrcs/util ToString.java
juanco 02/02/20 14:12:14
Modified: src/java/org/apache/maven/jrcs/diff AddDelta.java
ChangeDelta.java Chunk.java DeleteDelta.java
Delta.java Diff.java DiffException.java
DifferentiationFailedException.java
PatchFailedException.java Range.java Revision.java
src/java/org/apache/maven/jrcs/util ToString.java
Log:
removed extra carriage return at the end of each line
Revision Changes Path
1.2 +95 -95 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/AddDelta.java
Index: AddDelta.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/AddDelta.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AddDelta.java 20 Feb 2002 16:20:02 -0000 1.1
+++ AddDelta.java 20 Feb 2002 22:12:14 -0000 1.2
@@ -1,95 +1,95 @@
-package org.apache.maven.jrcs.diff;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Maven" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Maven", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-import java.util.List;
-
-public class AddDelta extends Delta {
- AddDelta() {
- super();
- }
-
- public AddDelta(int origpos, Chunk rev) {
- init(new Chunk(origpos, 0), rev);
- }
-
- public void verify(List target) throws PatchFailedException {
- if (original.first() > target.size())
- throw new PatchFailedException("original.first() > target.size()");
- }
-
- public void applyTo(List target) {
- revised.applyAdd(original.first(), target);
- }
-
- public void toString(StringBuffer s) {
- s.append(original.anchor());
- s.append("a");
- s.append(revised.range());
- s.append(Diff.NL);
- revised.toString(s, "> ", Diff.NL);
- }
-
- public void toRCSString(StringBuffer s, String EOL) {
- s.append("a");
- s.append(original.anchor());
- s.append(" ");
- s.append(revised.range().length());
- s.append(EOL);
- revised.toString(s, "", EOL);
- }
-}
-
-
+package org.apache.maven.jrcs.diff;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+import java.util.List;
+
+public class AddDelta extends Delta {
+ AddDelta() {
+ super();
+ }
+
+ public AddDelta(int origpos, Chunk rev) {
+ init(new Chunk(origpos, 0), rev);
+ }
+
+ public void verify(List target) throws PatchFailedException {
+ if (original.first() > target.size())
+ throw new PatchFailedException("original.first() > target.size()");
+ }
+
+ public void applyTo(List target) {
+ revised.applyAdd(original.first(), target);
+ }
+
+ public void toString(StringBuffer s) {
+ s.append(original.anchor());
+ s.append("a");
+ s.append(revised.range());
+ s.append(Diff.NL);
+ revised.toString(s, "> ", Diff.NL);
+ }
+
+ public void toRCSString(StringBuffer s, String EOL) {
+ s.append("a");
+ s.append(original.anchor());
+ s.append(" ");
+ s.append(revised.range().length());
+ s.append(EOL);
+ revised.toString(s, "", EOL);
+ }
+}
+
+
1.2 +104 -104 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/ChangeDelta.java
Index: ChangeDelta.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/ChangeDelta.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ChangeDelta.java 20 Feb 2002 16:20:02 -0000 1.1
+++ ChangeDelta.java 20 Feb 2002 22:12:14 -0000 1.2
@@ -1,104 +1,104 @@
-package org.apache.maven.jrcs.diff;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Maven" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Maven", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-import java.util.List;
-
-public class ChangeDelta extends Delta {
- ChangeDelta() {
- super();
- }
-
- public ChangeDelta(Chunk orig, Chunk rev) {
- init(orig, rev);
- }
-
- public void verify(List target) throws PatchFailedException {
- if (!original.verify(target))
- throw new PatchFailedException();
- if (original.first() > target.size())
- throw new PatchFailedException("original.first() > target.size()");
- }
-
- public void applyTo(List target) {
- original.applyDelete(target);
- revised.applyAdd(original.first(), target);
- }
-
- public void toString(StringBuffer s) {
- original.range().toString(s);
- s.append("c");
- revised.range().toString(s);
- s.append(Diff.NL);
- original.toString(s, "< ", "\n");
- s.append("---");
- s.append(Diff.NL);
- revised.toString(s, "> ", "\n");
- }
-
- public void toRCSString(StringBuffer s, String EOL) {
- s.append("d");
- s.append(original.extfrom());
- s.append(" ");
- s.append(original.range().length());
- s.append(EOL);
- s.append("a");
- s.append(original.extfrom());
- s.append(" ");
- s.append(revised.range().length());
- s.append(EOL);
- revised.toString(s, "", EOL);
- }
-}
+package org.apache.maven.jrcs.diff;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+import java.util.List;
+
+public class ChangeDelta extends Delta {
+ ChangeDelta() {
+ super();
+ }
+
+ public ChangeDelta(Chunk orig, Chunk rev) {
+ init(orig, rev);
+ }
+
+ public void verify(List target) throws PatchFailedException {
+ if (!original.verify(target))
+ throw new PatchFailedException();
+ if (original.first() > target.size())
+ throw new PatchFailedException("original.first() > target.size()");
+ }
+
+ public void applyTo(List target) {
+ original.applyDelete(target);
+ revised.applyAdd(original.first(), target);
+ }
+
+ public void toString(StringBuffer s) {
+ original.range().toString(s);
+ s.append("c");
+ revised.range().toString(s);
+ s.append(Diff.NL);
+ original.toString(s, "< ", "\n");
+ s.append("---");
+ s.append(Diff.NL);
+ revised.toString(s, "> ", "\n");
+ }
+
+ public void toRCSString(StringBuffer s, String EOL) {
+ s.append("d");
+ s.append(original.extfrom());
+ s.append(" ");
+ s.append(original.range().length());
+ s.append(EOL);
+ s.append("a");
+ s.append(original.extfrom());
+ s.append(" ");
+ s.append(revised.range().length());
+ s.append(EOL);
+ revised.toString(s, "", EOL);
+ }
+}
1.2 +180 -180 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/Chunk.java
Index: Chunk.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/Chunk.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Chunk.java 20 Feb 2002 16:20:02 -0000 1.1
+++ Chunk.java 20 Feb 2002 22:12:14 -0000 1.2
@@ -1,180 +1,180 @@
-package org.apache.maven.jrcs.diff;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Maven" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Maven", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-import java.util.*;
-
-/**
- * Produces the "Chunk" differences between two sequences
- *
- * @version $Revision: 1.1 $
- * @author Juancarlo A�ez
- * @see org.apache.maven.jrcs.diff.Diff
- */
-public class Chunk
-extends org.apache.maven.jrcs.util.ToString
-{
- protected int _anchor;
- protected int _count;
- protected List _chunk;
-
- public Chunk(int pos, int count) {
- this._anchor = pos;
- this._count = (count >= 0 ? count : 0);
- }
-
- public Chunk(Object[] iseq, int pos, int count) {
- this(pos, count);
- _chunk = slice(iseq, pos, count);
- }
-
- public Chunk(Object[] iseq, int pos, int count, int offset) {
- this(offset, count);
- _chunk = slice(iseq, pos, count);
- }
-
- public Chunk(List iseq, int pos, int count) {
- this(pos, count);
- _chunk = slice(iseq, pos, count);
- }
-
- public Chunk(List iseq, int pos, int count, int offset) {
- this(offset, count);
- _chunk = slice(iseq, pos, count);
- }
-
- public int anchor() {
- return _anchor;
- }
-
- public int size() {
- return _count;
- }
-
- public int first() {
- return anchor();
- }
-
- public int last() {
- return anchor() + size() - 1;
- }
-
- public int extfrom() {
- return _anchor + 1;
- }
-
- public int extto() {
- return _anchor + _count;
- }
-
- public Range range() {
- return new Range(first(), last());
- }
-
- public List chunk() {
- return _chunk;
- }
-
- public boolean verify(List target) {
- if (_chunk == null)
- return true;
- if (last() > target.size())
- return false;
- for(int i = 0; i < _count; i++) {
- if (!target.get(_anchor+i).equals(_chunk.get(i)))
- return false;
- }
- return true;
- }
-
- public void applyDelete(List target) {
- for(int i = last(); i >= first(); i--)
- target.remove(i);
- }
-
- public void applyAdd(int start, List target) {
- Iterator i = _chunk.iterator();
- while (i.hasNext())
- target.add(start++, i.next());
- }
-
- public void toString(StringBuffer s) {
- toString(s, "", "");
- }
-
- public StringBuffer toString(StringBuffer s, String prefix, String postfix) {
- if (_chunk != null) {
- Iterator i = _chunk.iterator();
- while(i.hasNext()) {
- s.append(prefix);
- s.append(i.next());
- s.append(postfix);
- }
- }
- return s;
- }
-
- public static List slice(List seq, int pos, int count) {
- if (count <= 0)
- return new ArrayList(seq.subList(pos,pos));
- else
- return new ArrayList(seq.subList(pos, pos+count));
- }
-
- public static List slice(Object[] seq, int pos, int count) {
- return slice(Arrays.asList(seq), pos, count);
- }
-
-}
+package org.apache.maven.jrcs.diff;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+import java.util.*;
+
+/**
+ * Produces the "Chunk" differences between two sequences
+ *
+ * @version $Revision: 1.2 $
+ * @author Juancarlo A�ez
+ * @see org.apache.maven.jrcs.diff.Diff
+ */
+public class Chunk
+extends org.apache.maven.jrcs.util.ToString
+{
+ protected int _anchor;
+ protected int _count;
+ protected List _chunk;
+
+ public Chunk(int pos, int count) {
+ this._anchor = pos;
+ this._count = (count >= 0 ? count : 0);
+ }
+
+ public Chunk(Object[] iseq, int pos, int count) {
+ this(pos, count);
+ _chunk = slice(iseq, pos, count);
+ }
+
+ public Chunk(Object[] iseq, int pos, int count, int offset) {
+ this(offset, count);
+ _chunk = slice(iseq, pos, count);
+ }
+
+ public Chunk(List iseq, int pos, int count) {
+ this(pos, count);
+ _chunk = slice(iseq, pos, count);
+ }
+
+ public Chunk(List iseq, int pos, int count, int offset) {
+ this(offset, count);
+ _chunk = slice(iseq, pos, count);
+ }
+
+ public int anchor() {
+ return _anchor;
+ }
+
+ public int size() {
+ return _count;
+ }
+
+ public int first() {
+ return anchor();
+ }
+
+ public int last() {
+ return anchor() + size() - 1;
+ }
+
+ public int extfrom() {
+ return _anchor + 1;
+ }
+
+ public int extto() {
+ return _anchor + _count;
+ }
+
+ public Range range() {
+ return new Range(first(), last());
+ }
+
+ public List chunk() {
+ return _chunk;
+ }
+
+ public boolean verify(List target) {
+ if (_chunk == null)
+ return true;
+ if (last() > target.size())
+ return false;
+ for(int i = 0; i < _count; i++) {
+ if (!target.get(_anchor+i).equals(_chunk.get(i)))
+ return false;
+ }
+ return true;
+ }
+
+ public void applyDelete(List target) {
+ for(int i = last(); i >= first(); i--)
+ target.remove(i);
+ }
+
+ public void applyAdd(int start, List target) {
+ Iterator i = _chunk.iterator();
+ while (i.hasNext())
+ target.add(start++, i.next());
+ }
+
+ public void toString(StringBuffer s) {
+ toString(s, "", "");
+ }
+
+ public StringBuffer toString(StringBuffer s, String prefix, String postfix) {
+ if (_chunk != null) {
+ Iterator i = _chunk.iterator();
+ while(i.hasNext()) {
+ s.append(prefix);
+ s.append(i.next());
+ s.append(postfix);
+ }
+ }
+ return s;
+ }
+
+ public static List slice(List seq, int pos, int count) {
+ if (count <= 0)
+ return new ArrayList(seq.subList(pos,pos));
+ else
+ return new ArrayList(seq.subList(pos, pos+count));
+ }
+
+ public static List slice(Object[] seq, int pos, int count) {
+ return slice(Arrays.asList(seq), pos, count);
+ }
+
+}
1.2 +94 -94 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/DeleteDelta.java
Index: DeleteDelta.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/DeleteDelta.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DeleteDelta.java 20 Feb 2002 16:20:02 -0000 1.1
+++ DeleteDelta.java 20 Feb 2002 22:12:14 -0000 1.2
@@ -1,94 +1,94 @@
-package org.apache.maven.jrcs.diff;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Maven" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Maven", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-import java.util.List;
-
-public class DeleteDelta extends Delta {
-
- DeleteDelta() {
- super();
- }
-
- public DeleteDelta(Chunk orig) {
- init(orig, null);
- }
-
- public void verify(List target) throws PatchFailedException {
- if (!original.verify(target))
- throw new PatchFailedException();
- }
-
- public void applyTo(List target) {
- original.applyDelete(target);
- }
-
- public void toString(StringBuffer s) {
- s.append(original.range());
- s.append("d");
- s.append(revised.extto());
- s.append(Diff.NL);
- original.toString(s, "< ", Diff.NL);
- }
-
- public void toRCSString(StringBuffer s, String EOL) {
- s.append("d");
- s.append(original.extfrom());
- s.append(" ");
- s.append(original.range().length());
- s.append(EOL);
- }
-}
-
+package org.apache.maven.jrcs.diff;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+import java.util.List;
+
+public class DeleteDelta extends Delta {
+
+ DeleteDelta() {
+ super();
+ }
+
+ public DeleteDelta(Chunk orig) {
+ init(orig, null);
+ }
+
+ public void verify(List target) throws PatchFailedException {
+ if (!original.verify(target))
+ throw new PatchFailedException();
+ }
+
+ public void applyTo(List target) {
+ original.applyDelete(target);
+ }
+
+ public void toString(StringBuffer s) {
+ s.append(original.range());
+ s.append("d");
+ s.append(revised.extto());
+ s.append(Diff.NL);
+ original.toString(s, "< ", Diff.NL);
+ }
+
+ public void toRCSString(StringBuffer s, String EOL) {
+ s.append("d");
+ s.append(original.extfrom());
+ s.append(" ");
+ s.append(original.range().length());
+ s.append(EOL);
+ }
+}
+
1.2 +146 -146 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/Delta.java
Index: Delta.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/Delta.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Delta.java 20 Feb 2002 16:20:02 -0000 1.1
+++ Delta.java 20 Feb 2002 22:12:14 -0000 1.2
@@ -1,146 +1,146 @@
-package org.apache.maven.jrcs.diff;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Maven" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Maven", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-import java.util.*;
-
-/**
- * Produces the "delta" differences between two sequences
- *
- * @version 0.1 96/11/07
- * @author Juancarlo A�ez
- * @see org.apache.maven.jrcs.diff.Diff
- */
-public abstract class Delta
-extends org.apache.maven.jrcs.util.ToString
-{
- protected Chunk original;
- protected Chunk revised;
-
- static Class[][] DeltaClass;
-
- static {
- DeltaClass = new Class[2][2];
- try {
- DeltaClass[0][0] = org.apache.maven.jrcs.diff.ChangeDelta.class;
- DeltaClass[0][1] = org.apache.maven.jrcs.diff.AddDelta.class;
- DeltaClass[1][0] = org.apache.maven.jrcs.diff.DeleteDelta.class;
- DeltaClass[1][1] = org.apache.maven.jrcs.diff.ChangeDelta.class;
- }
- catch(Throwable o) {
- }
- }
-
- public static Delta newDelta(Chunk orig, Chunk rev) {
- Class c = DeltaClass[ orig.size() > 0 ? 1 : 0]
- [ rev.size() > 0 ? 1 : 0];
- Delta result;
- try {
- result = (Delta) c.newInstance();
- } catch(Throwable e) {
- System.err.println(e);
- return null;
- }
- result.init(orig, rev);
- return result;
- }
-
-
- protected Delta() {
- }
-
- protected Delta(Chunk orig, Chunk rev) {
- init(orig, rev);
- }
-
- protected void init(Chunk orig, Chunk rev) {
- original = orig;
- revised = rev;
- }
-
- public abstract void verify(List target) throws PatchFailedException;
-
- public final void patch(List target) throws PatchFailedException {
- verify(target);
- try {
- applyTo(target);
- }
- catch(Exception e) {
- throw new PatchFailedException(e.getMessage());
- }
- }
-
- public abstract void applyTo(List target);
-
- public void toString(StringBuffer s) {
- original.range().toString(s);
- s.append("x");
- revised.range().toString(s);
- s.append(Diff.NL);
- original.toString(s, "> ", "\n");
- s.append("---");
- s.append(Diff.NL);
- revised.toString(s, "< ", "\n");
- }
-
- public abstract void toRCSString(StringBuffer s, String EOL);
-
- public String toRCSString(String EOL) {
- StringBuffer s = new StringBuffer();
- toRCSString(s, EOL);
- return s.toString();
- }
-}
-
+package org.apache.maven.jrcs.diff;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+import java.util.*;
+
+/**
+ * Produces the "delta" differences between two sequences
+ *
+ * @version 0.1 96/11/07
+ * @author Juancarlo A�ez
+ * @see org.apache.maven.jrcs.diff.Diff
+ */
+public abstract class Delta
+extends org.apache.maven.jrcs.util.ToString
+{
+ protected Chunk original;
+ protected Chunk revised;
+
+ static Class[][] DeltaClass;
+
+ static {
+ DeltaClass = new Class[2][2];
+ try {
+ DeltaClass[0][0] = org.apache.maven.jrcs.diff.ChangeDelta.class;
+ DeltaClass[0][1] = org.apache.maven.jrcs.diff.AddDelta.class;
+ DeltaClass[1][0] = org.apache.maven.jrcs.diff.DeleteDelta.class;
+ DeltaClass[1][1] = org.apache.maven.jrcs.diff.ChangeDelta.class;
+ }
+ catch(Throwable o) {
+ }
+ }
+
+ public static Delta newDelta(Chunk orig, Chunk rev) {
+ Class c = DeltaClass[ orig.size() > 0 ? 1 : 0]
+ [ rev.size() > 0 ? 1 : 0];
+ Delta result;
+ try {
+ result = (Delta) c.newInstance();
+ } catch(Throwable e) {
+ System.err.println(e);
+ return null;
+ }
+ result.init(orig, rev);
+ return result;
+ }
+
+
+ protected Delta() {
+ }
+
+ protected Delta(Chunk orig, Chunk rev) {
+ init(orig, rev);
+ }
+
+ protected void init(Chunk orig, Chunk rev) {
+ original = orig;
+ revised = rev;
+ }
+
+ public abstract void verify(List target) throws PatchFailedException;
+
+ public final void patch(List target) throws PatchFailedException {
+ verify(target);
+ try {
+ applyTo(target);
+ }
+ catch(Exception e) {
+ throw new PatchFailedException(e.getMessage());
+ }
+ }
+
+ public abstract void applyTo(List target);
+
+ public void toString(StringBuffer s) {
+ original.range().toString(s);
+ s.append("x");
+ revised.range().toString(s);
+ s.append(Diff.NL);
+ original.toString(s, "> ", "\n");
+ s.append("---");
+ s.append(Diff.NL);
+ revised.toString(s, "< ", "\n");
+ }
+
+ public abstract void toRCSString(StringBuffer s, String EOL);
+
+ public String toRCSString(String EOL) {
+ StringBuffer s = new StringBuffer();
+ toRCSString(s, EOL);
+ return s.toString();
+ }
+}
+
1.2 +261 -261 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/Diff.java
Index: Diff.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/Diff.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Diff.java 20 Feb 2002 16:20:02 -0000 1.1
+++ Diff.java 20 Feb 2002 22:12:14 -0000 1.2
@@ -1,261 +1,261 @@
-package org.apache.maven.jrcs.diff;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Maven" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Maven", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-import java.util.List;
-import java.util.Arrays;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.HashMap;
-
-import java.io.BufferedReader;
-import java.io.StringReader;
-
-import java.util.Random;
-
-/**
- * Produces the "delta" differences between two sequences
- *
- * @version $Revision: 1.1 $ $Date: 2002/02/20 16:20:02 $
- * @author Juancarlo A�ez
- * @see org.apache.maven.jrcs.diff.Delta
- */
-public class Diff {
- public static final String NL = "\n";
-
- static final int NOT_FOUND_i = -2;
- static final int NOT_FOUND_j = -1;
- static final int EOS = Integer.MAX_VALUE;
-
- Object[] orig;
-
-
- public Diff(Object[] o) {
- if (o == null)
- throw new IllegalArgumentException();
- orig = o;
- }
-
- public static Revision diff(Object[] orig, Object[] rev)
- throws DifferentiationFailedException
- {
- if (orig == null || rev == null)
- throw new IllegalArgumentException();
-
- return new Diff(orig).diff(rev);
- }
-
- public static boolean compare(Object[] orig, Object[] rev) {
- if (orig.length != rev.length)
- return false;
- else {
- for(int i = 0; i < orig.length; i++)
- if (! orig[i].equals(rev[i]))
- return false;
- return true;
- }
- }
-
- protected int scan(int[] ndx, int i, int target) {
- while(ndx[i] < target)
- i++;
- return i;
- }
-
- public Revision diff(Object[] rev) throws DifferentiationFailedException {
- Map eqs = buildEqSet(orig, rev);
- int[] indx = buildIndex(eqs, orig, NOT_FOUND_i);
- int[] jndx = buildIndex(eqs, rev, NOT_FOUND_j);
- eqs = null; // let gc know we're done with this
-
- Revision deltas = new Revision(); //!!! new Revision()
- int i = 0;
- int j = 0;
-
- // skip matching
- for(;indx[i] != EOS && indx[i] == jndx[j]; i++, j++)
- {/* void */}
-
- while (indx[i] != jndx[j]) { // only equal if both == EOS
- // they are different
- int ia = i;
- int ja = j;
-
- // size of this delta
- do {
- while(jndx[j] < 0 || jndx[j] < indx[i]) j++;
- while(indx[i] < 0 || indx[i] < jndx[j]) i++;
- } while(indx[i] != jndx[j]);
-
- // they are equal, reverse any exedent matches
- while(i > ia && j > ja && indx[i-1] == jndx[j-1]) {
- --i; --j;
- //System.err.println("************* reversing "+ i);
- }
-
- deltas.addDelta( Delta.newDelta( new Chunk(orig, ia, i-ia),
- new Chunk(rev, ja, j-ja)));
- // skip matching
- for(;indx[i] != EOS && indx[i] == jndx[j]; i++, j++)
- {/* void */}
- }
- try {
- if (!compare(deltas.patch(orig), rev))
- throw new DifferentiationFailedException();
- }
- catch(DiffException e) {
- throw new DifferentiationFailedException(e.getMessage());
- }
- return deltas;
- }
-
- protected Map buildEqSet(Object[] orig, Object[] rev) {
- Set items = new HashSet(Arrays.asList(orig));
- items.retainAll(Arrays.asList(rev));
-
- Map eqs = new HashMap();
- for(int i = 0; i < orig.length; i++) {
- if (items.contains(orig[i])) {
- eqs.put(orig[i], new Integer(i));
- items.remove(orig[i]);
- }
- }
- return eqs;
- }
-
- protected int[] buildIndex(Map eqs, Object[] seq, int NF) {
- int[] result = new int[seq.length+1];
-
- for(int i = 0; i < seq.length; i++) {
- Integer value = (Integer) eqs.get(seq[i]);
- if (value == null || value.intValue() < 0)
- result[i] = NF;
- else
- result[i] = value.intValue();
- }
- result[seq.length] = EOS;
- return result;
- }
-
- public static Object[] stringToArray(String value) {
- BufferedReader reader = new BufferedReader(new StringReader(value));
- List l = new LinkedList();
- String s;
- try {
- while ((s = reader.readLine()) != null)
- l.add(s);
- }
- catch(java.io.IOException e)
- {}
- return l.toArray();
- }
-
- public static String arrayToString(Object[] o) {
- return arrayToString(o, Diff.NL);
- }
-
- public static String arrayToString(Object[] o, String EOL) {
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < o.length-1; i++) {
- buf.append(o[i]);
- buf.append(EOL);
- }
- buf.append(o[o.length-1]);
- return buf.toString();
- }
-
- public static Object[] randomEdit(Object [] text) {
- return randomEdit(text, text.length);
- }
-
- public static Object[] randomEdit(Object [] text, long seed) {
- List result = new ArrayList(Arrays.asList(text));
- Random r = new Random(seed);
- int nops = r.nextInt(10);
- for (int i = 0; i < nops; i++) {
- boolean del = r.nextBoolean();
- int pos = r.nextInt(result.size()+1);
- int len = Math.min(result.size() - pos, 1+r.nextInt(4));
- if (del && result.size() > 0) // delete
- result.subList(pos, pos + len).clear();
- else
- for (int k = 0; k < len; k++, pos++)
- result.add(pos, "["+i+"] random edit[" + i + "][" + i + "]");
- }
- return result.toArray();
- }
-
- public static Object[] shuffle(Object [] text) {
- return randomEdit(text, text.length);
- }
-
- public static Object[] shuffle(Object [] text, long seed) {
- List result = new ArrayList(Arrays.asList(text));
- Random r = new Random(seed);
- int nops = r.nextInt(10);
- for (int i = 0; i < nops; i++) {
- int p1 = r.nextInt(result.size());
- int p2 = r.nextInt(result.size());
- Object tmp = result.get(p1);
- result.set(p1, result.get(p2));
- result.set(p2, tmp);
- }
- return result.toArray();
- }
-}
-
+package org.apache.maven.jrcs.diff;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+import java.util.List;
+import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.HashMap;
+
+import java.io.BufferedReader;
+import java.io.StringReader;
+
+import java.util.Random;
+
+/**
+ * Produces the "delta" differences between two sequences
+ *
+ * @version $Revision: 1.2 $ $Date: 2002/02/20 22:12:14 $
+ * @author Juancarlo A�ez
+ * @see org.apache.maven.jrcs.diff.Delta
+ */
+public class Diff {
+ public static final String NL = "\n";
+
+ static final int NOT_FOUND_i = -2;
+ static final int NOT_FOUND_j = -1;
+ static final int EOS = Integer.MAX_VALUE;
+
+ Object[] orig;
+
+
+ public Diff(Object[] o) {
+ if (o == null)
+ throw new IllegalArgumentException();
+ orig = o;
+ }
+
+ public static Revision diff(Object[] orig, Object[] rev)
+ throws DifferentiationFailedException
+ {
+ if (orig == null || rev == null)
+ throw new IllegalArgumentException();
+
+ return new Diff(orig).diff(rev);
+ }
+
+ public static boolean compare(Object[] orig, Object[] rev) {
+ if (orig.length != rev.length)
+ return false;
+ else {
+ for(int i = 0; i < orig.length; i++)
+ if (! orig[i].equals(rev[i]))
+ return false;
+ return true;
+ }
+ }
+
+ protected int scan(int[] ndx, int i, int target) {
+ while(ndx[i] < target)
+ i++;
+ return i;
+ }
+
+ public Revision diff(Object[] rev) throws DifferentiationFailedException {
+ Map eqs = buildEqSet(orig, rev);
+ int[] indx = buildIndex(eqs, orig, NOT_FOUND_i);
+ int[] jndx = buildIndex(eqs, rev, NOT_FOUND_j);
+ eqs = null; // let gc know we're done with this
+
+ Revision deltas = new Revision(); //!!! new Revision()
+ int i = 0;
+ int j = 0;
+
+ // skip matching
+ for(;indx[i] != EOS && indx[i] == jndx[j]; i++, j++)
+ {/* void */}
+
+ while (indx[i] != jndx[j]) { // only equal if both == EOS
+ // they are different
+ int ia = i;
+ int ja = j;
+
+ // size of this delta
+ do {
+ while(jndx[j] < 0 || jndx[j] < indx[i]) j++;
+ while(indx[i] < 0 || indx[i] < jndx[j]) i++;
+ } while(indx[i] != jndx[j]);
+
+ // they are equal, reverse any exedent matches
+ while(i > ia && j > ja && indx[i-1] == jndx[j-1]) {
+ --i; --j;
+ //System.err.println("************* reversing "+ i);
+ }
+
+ deltas.addDelta( Delta.newDelta( new Chunk(orig, ia, i-ia),
+ new Chunk(rev, ja, j-ja)));
+ // skip matching
+ for(;indx[i] != EOS && indx[i] == jndx[j]; i++, j++)
+ {/* void */}
+ }
+ try {
+ if (!compare(deltas.patch(orig), rev))
+ throw new DifferentiationFailedException();
+ }
+ catch(DiffException e) {
+ throw new DifferentiationFailedException(e.getMessage());
+ }
+ return deltas;
+ }
+
+ protected Map buildEqSet(Object[] orig, Object[] rev) {
+ Set items = new HashSet(Arrays.asList(orig));
+ items.retainAll(Arrays.asList(rev));
+
+ Map eqs = new HashMap();
+ for(int i = 0; i < orig.length; i++) {
+ if (items.contains(orig[i])) {
+ eqs.put(orig[i], new Integer(i));
+ items.remove(orig[i]);
+ }
+ }
+ return eqs;
+ }
+
+ protected int[] buildIndex(Map eqs, Object[] seq, int NF) {
+ int[] result = new int[seq.length+1];
+
+ for(int i = 0; i < seq.length; i++) {
+ Integer value = (Integer) eqs.get(seq[i]);
+ if (value == null || value.intValue() < 0)
+ result[i] = NF;
+ else
+ result[i] = value.intValue();
+ }
+ result[seq.length] = EOS;
+ return result;
+ }
+
+ public static Object[] stringToArray(String value) {
+ BufferedReader reader = new BufferedReader(new StringReader(value));
+ List l = new LinkedList();
+ String s;
+ try {
+ while ((s = reader.readLine()) != null)
+ l.add(s);
+ }
+ catch(java.io.IOException e)
+ {}
+ return l.toArray();
+ }
+
+ public static String arrayToString(Object[] o) {
+ return arrayToString(o, Diff.NL);
+ }
+
+ public static String arrayToString(Object[] o, String EOL) {
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < o.length-1; i++) {
+ buf.append(o[i]);
+ buf.append(EOL);
+ }
+ buf.append(o[o.length-1]);
+ return buf.toString();
+ }
+
+ public static Object[] randomEdit(Object [] text) {
+ return randomEdit(text, text.length);
+ }
+
+ public static Object[] randomEdit(Object [] text, long seed) {
+ List result = new ArrayList(Arrays.asList(text));
+ Random r = new Random(seed);
+ int nops = r.nextInt(10);
+ for (int i = 0; i < nops; i++) {
+ boolean del = r.nextBoolean();
+ int pos = r.nextInt(result.size()+1);
+ int len = Math.min(result.size() - pos, 1+r.nextInt(4));
+ if (del && result.size() > 0) // delete
+ result.subList(pos, pos + len).clear();
+ else
+ for (int k = 0; k < len; k++, pos++)
+ result.add(pos, "["+i+"] random edit[" + i + "][" + i + "]");
+ }
+ return result.toArray();
+ }
+
+ public static Object[] shuffle(Object [] text) {
+ return randomEdit(text, text.length);
+ }
+
+ public static Object[] shuffle(Object [] text, long seed) {
+ List result = new ArrayList(Arrays.asList(text));
+ Random r = new Random(seed);
+ int nops = r.nextInt(10);
+ for (int i = 0; i < nops; i++) {
+ int p1 = r.nextInt(result.size());
+ int p2 = r.nextInt(result.size());
+ Object tmp = result.get(p1);
+ result.set(p1, result.get(p2));
+ result.set(p2, tmp);
+ }
+ return result.toArray();
+ }
+}
+
1.2 +65 -65 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/DiffException.java
Index: DiffException.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/DiffException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DiffException.java 20 Feb 2002 16:20:02 -0000 1.1
+++ DiffException.java 20 Feb 2002 22:12:14 -0000 1.2
@@ -1,65 +1,65 @@
-package org.apache.maven.jrcs.diff;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Maven" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Maven", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-public class DiffException extends Exception {
-
- public DiffException() {
- }
-
- public DiffException(String msg) {
- super(msg);
- }
-}
+package org.apache.maven.jrcs.diff;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+public class DiffException extends Exception {
+
+ public DiffException() {
+ }
+
+ public DiffException(String msg) {
+ super(msg);
+ }
+}
1.2 +64 -64 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/DifferentiationFailedException.java
Index: DifferentiationFailedException.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/DifferentiationFailedException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DifferentiationFailedException.java 20 Feb 2002 16:20:02 -0000 1.1
+++ DifferentiationFailedException.java 20 Feb 2002 22:12:14 -0000 1.2
@@ -1,64 +1,64 @@
-package org.apache.maven.jrcs.diff;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Maven" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Maven", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-public class DifferentiationFailedException extends DiffException {
- public DifferentiationFailedException() {
- }
-
- public DifferentiationFailedException(String msg) {
- super(msg);
- }
-}
+package org.apache.maven.jrcs.diff;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+public class DifferentiationFailedException extends DiffException {
+ public DifferentiationFailedException() {
+ }
+
+ public DifferentiationFailedException(String msg) {
+ super(msg);
+ }
+}
1.2 +66 -66 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/PatchFailedException.java
Index: PatchFailedException.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/PatchFailedException.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- PatchFailedException.java 20 Feb 2002 16:20:02 -0000 1.1
+++ PatchFailedException.java 20 Feb 2002 22:12:14 -0000 1.2
@@ -1,66 +1,66 @@
-package org.apache.maven.jrcs.diff;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Maven" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Maven", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-public class PatchFailedException extends DiffException
-{
- public PatchFailedException() {
- }
-
- public PatchFailedException(String msg) {
- super(msg);
- }
-}
-
+package org.apache.maven.jrcs.diff;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+public class PatchFailedException extends DiffException
+{
+ public PatchFailedException() {
+ }
+
+ public PatchFailedException(String msg) {
+ super(msg);
+ }
+}
+
1.2 +100 -100 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/Range.java
Index: Range.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/Range.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Range.java 20 Feb 2002 16:20:02 -0000 1.1
+++ Range.java 20 Feb 2002 22:12:14 -0000 1.2
@@ -1,100 +1,100 @@
-package org.apache.maven.jrcs.diff;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Maven" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Maven", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-/**
- * Produces the "Range" differences between two sequences
- *
- * @version 0.1 96/11/07
- * @author Juancarlo A�ez
- * @see org.apache.maven.jrcs.diff.Diff
- */
-public class Range
-extends org.apache.maven.jrcs.util.ToString
-{
- int _from;
- int _to;
-
- public Range(int from, int to) {
- _from = from;
- _to = to;
- }
-
- public int from() {
- return _from;
- }
-
- public int to() {
- return _to;
- }
-
- public int length() {
- return 1+_to-_from;
- }
-
- public void toString(StringBuffer s, String separ) {
- if (_from == _to)
- s.append(Integer.toString(1+_from));
- else {
- s.append(Integer.toString(1+_from));
- s.append(separ);
- s.append(Integer.toString(1+_to));
- }
- }
-
- public void toString(StringBuffer s) {
- toString(s, ",");
- }
-}
+package org.apache.maven.jrcs.diff;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+/**
+ * Produces the "Range" differences between two sequences
+ *
+ * @version 0.1 96/11/07
+ * @author Juancarlo A�ez
+ * @see org.apache.maven.jrcs.diff.Diff
+ */
+public class Range
+extends org.apache.maven.jrcs.util.ToString
+{
+ int _from;
+ int _to;
+
+ public Range(int from, int to) {
+ _from = from;
+ _to = to;
+ }
+
+ public int from() {
+ return _from;
+ }
+
+ public int to() {
+ return _to;
+ }
+
+ public int length() {
+ return 1+_to-_from;
+ }
+
+ public void toString(StringBuffer s, String separ) {
+ if (_from == _to)
+ s.append(Integer.toString(1+_from));
+ else {
+ s.append(Integer.toString(1+_from));
+ s.append(separ);
+ s.append(Integer.toString(1+_to));
+ }
+ }
+
+ public void toString(StringBuffer s) {
+ toString(s, ",");
+ }
+}
1.2 +134 -134 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/Revision.java
Index: Revision.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/diff/Revision.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Revision.java 20 Feb 2002 16:20:02 -0000 1.1
+++ Revision.java 20 Feb 2002 22:12:14 -0000 1.2
@@ -1,134 +1,134 @@
-package org.apache.maven.jrcs.diff;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Maven" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Maven", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-import java.util.*;
-
-public class Revision
-extends org.apache.maven.jrcs.util.ToString
-{
- List deltas_ = new LinkedList();
-
- public Revision() {
- }
-
- public synchronized void addDelta(Delta delta) {
- if (delta == null)
- throw new IllegalArgumentException("new delta is null");
- if (deltas_.size() > 0) {
- Delta prev = (Delta) deltas_.get(deltas_.size()-1);
-
- /*!!!
- if (prev.original != null && delta.original != null
- && (prev.original.from() > delta.original.from()))
- throw new IllegalArgumentException("original.from > new.from");
-
- if (prev.revised != null && delta.revised != null
- && (prev.revised.from() > delta.revised.from()))
- throw new IllegalArgumentException("revised.from > revised.to");
- */
- }
- deltas_.add(delta);
- }
-
- public Delta getDelta(int i) {
- return (Delta) deltas_.get(i);
- }
-
- public int size() {
- return deltas_.size();
- }
-
- public Object[] patch(Object[] src) throws PatchFailedException {
- List target = new ArrayList(Arrays.asList(src));
- applyTo(target);
- return target.toArray();
- }
-
- public synchronized void applyTo(List target) throws PatchFailedException {
- ListIterator i = deltas_.listIterator(deltas_.size());
- while (i.hasPrevious()) {
- Delta delta = (Delta) i.previous();
- delta.patch(target);
- }
- }
-
- public synchronized void toString(StringBuffer s){
- Iterator i = deltas_.iterator();
- while (i.hasNext())
- ((Delta)i.next()).toString(s);
- }
-
- public synchronized void toRCSString(StringBuffer s, String EOL){
- Iterator i = deltas_.iterator();
- while (i.hasNext())
- ((Delta) i.next()).toRCSString(s, EOL);
- }
-
- public void toRCSString(StringBuffer s){
- toRCSString(s, Diff.NL);
- }
-
- public String toRCSString(String EOL) {
- StringBuffer s = new StringBuffer();
- toRCSString(s, EOL);
- return s.toString();
- }
-
- public String toRCSString() {
- return toRCSString(Diff.NL);
- }
-}
-
+package org.apache.maven.jrcs.diff;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+import java.util.*;
+
+public class Revision
+extends org.apache.maven.jrcs.util.ToString
+{
+ List deltas_ = new LinkedList();
+
+ public Revision() {
+ }
+
+ public synchronized void addDelta(Delta delta) {
+ if (delta == null)
+ throw new IllegalArgumentException("new delta is null");
+ if (deltas_.size() > 0) {
+ Delta prev = (Delta) deltas_.get(deltas_.size()-1);
+
+ /*!!!
+ if (prev.original != null && delta.original != null
+ && (prev.original.from() > delta.original.from()))
+ throw new IllegalArgumentException("original.from > new.from");
+
+ if (prev.revised != null && delta.revised != null
+ && (prev.revised.from() > delta.revised.from()))
+ throw new IllegalArgumentException("revised.from > revised.to");
+ */
+ }
+ deltas_.add(delta);
+ }
+
+ public Delta getDelta(int i) {
+ return (Delta) deltas_.get(i);
+ }
+
+ public int size() {
+ return deltas_.size();
+ }
+
+ public Object[] patch(Object[] src) throws PatchFailedException {
+ List target = new ArrayList(Arrays.asList(src));
+ applyTo(target);
+ return target.toArray();
+ }
+
+ public synchronized void applyTo(List target) throws PatchFailedException {
+ ListIterator i = deltas_.listIterator(deltas_.size());
+ while (i.hasPrevious()) {
+ Delta delta = (Delta) i.previous();
+ delta.patch(target);
+ }
+ }
+
+ public synchronized void toString(StringBuffer s){
+ Iterator i = deltas_.iterator();
+ while (i.hasNext())
+ ((Delta)i.next()).toString(s);
+ }
+
+ public synchronized void toRCSString(StringBuffer s, String EOL){
+ Iterator i = deltas_.iterator();
+ while (i.hasNext())
+ ((Delta) i.next()).toRCSString(s, EOL);
+ }
+
+ public void toRCSString(StringBuffer s){
+ toRCSString(s, Diff.NL);
+ }
+
+ public String toRCSString(String EOL) {
+ StringBuffer s = new StringBuffer();
+ toRCSString(s, EOL);
+ return s.toString();
+ }
+
+ public String toRCSString() {
+ return toRCSString(Diff.NL);
+ }
+}
+
1.2 +72 -72 jakarta-turbine-maven/src/java/org/apache/maven/jrcs/util/ToString.java
Index: ToString.java
===================================================================
RCS file: /home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/jrcs/util/ToString.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ToString.java 20 Feb 2002 16:20:03 -0000 1.1
+++ ToString.java 20 Feb 2002 22:12:14 -0000 1.2
@@ -1,72 +1,72 @@
-package org.apache.maven.jrcs.util;
-
-/* ====================================================================
- * The Apache Software License, Version 1.1
- *
- * Copyright (c) 2001 The Apache Software Foundation. All rights
- * reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * 3. The end-user documentation included with the redistribution,
- * if any, must include the following acknowledgment:
- * "This product includes software developed by the
- * Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowledgment may appear in the software itself,
- * if and wherever such third-party acknowledgments normally appear.
- *
- * 4. The names "Apache" and "Apache Software Foundation" and
- * "Apache Maven" must not be used to endorse or promote products
- * derived from this software without prior written permission. For
- * written permission, please contact apache@apache.org.
- *
- * 5. Products derived from this software may not be called "Apache",
- * "Apache Maven", nor may "Apache" appear in their name, without
- * prior written permission of the Apache Software Foundation.
- *
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * <http://www.apache.org/>.
- */
-
-/**
- * This class delegates handling of the to a StringBuffer based version.
- */
-public abstract class ToString {
-
- public ToString() {
- }
-
- public String toString() {
- StringBuffer s = new StringBuffer();
- toString(s);
- return s.toString();
- }
-
- public abstract void toString(StringBuffer s);
-}
+package org.apache.maven.jrcs.util;
+
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in
+ * the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
+ * "This product includes software developed by the
+ * Apache Software Foundation (http://www.apache.org/)."
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
+ *
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation. For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
+ */
+
+/**
+ * This class delegates handling of the to a StringBuffer based version.
+ */
+public abstract class ToString {
+
+ public ToString() {
+ }
+
+ public String toString() {
+ StringBuffer s = new StringBuffer();
+ toString(s);
+ return s.toString();
+ }
+
+ public abstract void toString(StringBuffer s);
+}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>