/******************************************************************************* * Copyright (c) 2011 IRIS/DMC. * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License v2.1 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html * * Contributors: * IRIS/DMC- initial API and implementation * * ACKNOWLEDGEMENT * This software was developed as part of a project supported by * Cooperative Agreement Number G10AC00533 from the United States * Geological Survey. Its contents are solely the responsibility of * the authors and the USGS is not responsible for the efficacy, * safety, or suitability of this software. ******************************************************************************/ import java.io.IOException; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; public class Network { private String code; private List stations = new ArrayList(); public Network(String code){ this.code = code; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public List getStations() { return stations; } public void add(Station station){ station.setNetwork(this); stations.add(station); } public void writeXml(XMLWriter out, Query query) throws IOException{ boolean print = false; if(query.getNetworks() == null){ print = true; }else{ for(String net:query.getNetworks()){ if(this.code.equalsIgnoreCase(net)){ print = true; break; } } } if(!print){ return; } out.flush(); } @Override public String toString() { return "Network [code=" + code + "]"; } }