/* * 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 Transformation containing several * XPath-Filter2 expressions. * * @author Patrick Peck * @version $Id$ */ public class XPath2TransformationImpl extends TransformationImpl implements XPath2Transformation { /** The filters contained in this XPath2Transformation */ private List xPathFilters = new ArrayList(); /** * Create a new XPath2TransformationImpl. * * 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 XPath2Transformation to another. * * @param other The object to compare this * XPath2Transformation to. * @return true, if other is an * XPath2Transformation and getXPathFilters() equals * other.getXPathFilters(). Otherwise false 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; } }