From: <bo...@us...> - 2010-09-24 09:54:59
|
Revision: 483 http://xmlunit.svn.sourceforge.net/xmlunit/?rev=483&view=rev Author: bodewig Date: 2010-09-24 09:54:53 +0000 (Fri, 24 Sep 2010) Log Message: ----------- extract predicate from linqy Modified Paths: -------------- trunk/xmlunit/src/main/java-core/net/sf/xmlunit/diff/DOMDifferenceEngine.java.xml trunk/xmlunit/src/main/java-core/net/sf/xmlunit/util/Linqy.java trunk/xmlunit/src/main/java-legacy/org/custommonkey/xmlunit/NewDifferenceEngine.java trunk/xmlunit/src/main/net-core/util/Linqy.cs Added Paths: ----------- trunk/xmlunit/src/main/java-core/net/sf/xmlunit/util/Predicate.java trunk/xmlunit/src/main/net-core/util/Predicate.cs Modified: trunk/xmlunit/src/main/java-core/net/sf/xmlunit/diff/DOMDifferenceEngine.java.xml =================================================================== --- trunk/xmlunit/src/main/java-core/net/sf/xmlunit/diff/DOMDifferenceEngine.java.xml 2010-09-24 09:47:28 UTC (rev 482) +++ trunk/xmlunit/src/main/java-core/net/sf/xmlunit/diff/DOMDifferenceEngine.java.xml 2010-09-24 09:54:53 UTC (rev 483) @@ -30,6 +30,7 @@ <import reference="net.sf.xmlunit.util.IterableNodeList"/> <import reference="net.sf.xmlunit.util.Linqy"/> <import reference="net.sf.xmlunit.util.Nodes"/> + <import reference="net.sf.xmlunit.util.Predicate"/> <import reference="org.w3c.dom.Attr"/> <import reference="org.w3c.dom.CharacterData"/> <import reference="org.w3c.dom.Document"/> @@ -473,8 +474,8 @@ } }; - private static final Linqy.Predicate<Node> INTERESTING_NODES = - new Linqy.Predicate<Node>() { + private static final Predicate<Node> INTERESTING_NODES = + new Predicate<Node>() { public boolean matches(Node n) { return n.getNodeType() != Node.DOCUMENT_TYPE_NODE; } Modified: trunk/xmlunit/src/main/java-core/net/sf/xmlunit/util/Linqy.java =================================================================== --- trunk/xmlunit/src/main/java-core/net/sf/xmlunit/util/Linqy.java 2010-09-24 09:47:28 UTC (rev 482) +++ trunk/xmlunit/src/main/java-core/net/sf/xmlunit/util/Linqy.java 2010-09-24 09:54:53 UTC (rev 483) @@ -89,13 +89,6 @@ } /** - * A function that tests an object for a property. - */ - public interface Predicate<T> { - boolean matches(T toTest); - } - - /** * Count the number of elements in a sequence. */ public static int count(Iterable seq) { Added: trunk/xmlunit/src/main/java-core/net/sf/xmlunit/util/Predicate.java =================================================================== --- trunk/xmlunit/src/main/java-core/net/sf/xmlunit/util/Predicate.java (rev 0) +++ trunk/xmlunit/src/main/java-core/net/sf/xmlunit/util/Predicate.java 2010-09-24 09:54:53 UTC (rev 483) @@ -0,0 +1,21 @@ +/* + This file is licensed to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ +package net.sf.xmlunit.util; + +/** + * A function that tests an object for a property. + */ +public interface Predicate<T> { + boolean matches(T toTest); +} Property changes on: trunk/xmlunit/src/main/java-core/net/sf/xmlunit/util/Predicate.java ___________________________________________________________________ Added: svn:eol-style + native Modified: trunk/xmlunit/src/main/java-legacy/org/custommonkey/xmlunit/NewDifferenceEngine.java =================================================================== --- trunk/xmlunit/src/main/java-legacy/org/custommonkey/xmlunit/NewDifferenceEngine.java 2010-09-24 09:47:28 UTC (rev 482) +++ trunk/xmlunit/src/main/java-legacy/org/custommonkey/xmlunit/NewDifferenceEngine.java 2010-09-24 09:54:53 UTC (rev 483) @@ -60,6 +60,7 @@ import net.sf.xmlunit.input.WhitespaceNormalizedSource; import net.sf.xmlunit.input.WhitespaceStrippedSource; import net.sf.xmlunit.util.Linqy; +import net.sf.xmlunit.util.Predicate; import org.custommonkey.xmlunit.examples.RecursiveElementNameAndTextQualifier; import org.w3c.dom.CDATASection; @@ -531,7 +532,7 @@ result.add(new Entry(n, map.get(n))); } else { Iterable<Node> unmatchedTestElements = - Linqy.filter(testNodes, new Linqy.Predicate<Node>() { + Linqy.filter(testNodes, new Predicate<Node>() { public boolean matches(Node t) { return !map.containsValue(t); } Modified: trunk/xmlunit/src/main/net-core/util/Linqy.cs =================================================================== --- trunk/xmlunit/src/main/net-core/util/Linqy.cs 2010-09-24 09:47:28 UTC (rev 482) +++ trunk/xmlunit/src/main/net-core/util/Linqy.cs 2010-09-24 09:54:53 UTC (rev 483) @@ -67,11 +67,6 @@ } /// <summary> - /// A function that tests an object for a property. - /// </summary> - public delegate bool Predicate<T>(T toTest); - - /// <summary> /// Count the number of elements in a sequence. /// </summary> public static int Count(IEnumerable e) { Added: trunk/xmlunit/src/main/net-core/util/Predicate.cs =================================================================== --- trunk/xmlunit/src/main/net-core/util/Predicate.cs (rev 0) +++ trunk/xmlunit/src/main/net-core/util/Predicate.cs 2010-09-24 09:54:53 UTC (rev 483) @@ -0,0 +1,20 @@ +/* + This file is licensed to You under the Apache License, Version 2.0 + (the "License"); you may not use this file except in compliance with + the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +namespace net.sf.xmlunit.util { + /// <summary> + /// A function that tests an object for a property. + /// </summary> + public delegate bool Predicate<T>(T toTest); +} \ No newline at end of file Property changes on: trunk/xmlunit/src/main/net-core/util/Predicate.cs ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |