diff options
Diffstat (limited to 'spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java')
-rw-r--r-- | spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java new file mode 100644 index 000000000..f483b1831 --- /dev/null +++ b/spss/server/serverlib/src/main/java/at/gv/egovernment/moa/spss/server/iaik/xml/XPath2TransformationImpl.java @@ -0,0 +1,106 @@ +/* + * Copyright 2003 Federal Chancellery Austria + * MOA-SPSS has been developed in a cooperation between BRZ, the Federal + * Chancellery Austria - ICT staff unit, and Graz University of Technology. + * + * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by + * the European Commission - subsequent versions of the EUPL (the "Licence"); + * You may not use this work except in compliance with the Licence. + * You may obtain a copy of the Licence at: + * http://www.osor.eu/eupl/ + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the Licence is distributed on an "AS IS" basis, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Licence for the specific language governing permissions and + * limitations under the Licence. + * + * This product combines work with different licenses. See the "NOTICE" text + * file for details on the various modules and licenses. + * The "NOTICE" text file is part of the distribution. Any derivative works + * that you distribute must include a readable copy of the "NOTICE" text file. + */ + + +package at.gv.egovernment.moa.spss.server.iaik.xml; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import iaik.server.modules.xml.XPath2Transformation; + +/** + * An object encapsulating a <code>Transformation</code> containing several + * XPath-Filter2 expressions. + * + * @author Patrick Peck + * @version $Id$ + */ +public class XPath2TransformationImpl + extends TransformationImpl + implements XPath2Transformation { + + /** The filters contained in this <code>XPath2Transformation</code> */ + private List xPathFilters = new ArrayList(); + + /** + * Create a new <code>XPath2TransformationImpl</code>. + * + * The list of XPath-Filter2 expression is initially empty. + */ + public XPath2TransformationImpl() { + setAlgorithmURI(XPath2Transformation.XPATH2); + } + + /** + * @see iaik.server.modules.xml.XPath2Transformation#getXPathFilters() + */ + public List getXPathFilters() { + return xPathFilters; + } + + /** + * Add an XPath-Filter2 expression to the list of filters. + * + * @param filter The filter to add. + */ + public void addXPathFilter(XPath2Filter filter) { + xPathFilters.add(filter); + } + + /** + * Compare this <code>XPath2Transformation</code> to another. + * + * @param other The object to compare this + * <code>XPath2Transformation</code> to. + * @return <code>true</code>, if <code>other</code> is an + * <code>XPath2Transformation</code> and <code>getXPathFilters()</code> equals + * <code>other.getXPathFilters()</code>. Otherwise <code>false</code> is + * returned. + * @see java.lang.Object#equals(Object) + */ + public boolean equals(Object other) { + if (other instanceof XPath2Transformation) { + XPath2Transformation transform = (XPath2Transformation) other; + + return getXPathFilters().equals(transform.getXPathFilters()); + } + return false; + } + + /** + * @see java.lang.Object#hashCode() + */ + public int hashCode() { + Iterator iter = getXPathFilters().iterator(); + int hashCode = 0; + + while (iter.hasNext()) { + hashCode ^= iter.next().hashCode(); + } + + return hashCode; + } + +} |