/******************************************************************************* * 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.sql.Timestamp; import java.util.ArrayList; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.joda.time.DateTime; public class Station implements Node{ private String netCode; private String staCode; private DateTime creationDate; private Network network; private List epochs = new ArrayList(); public Station(String netCode, String staCode) { super(); this.netCode = netCode; this.staCode = staCode; } public String getNetCode() { return netCode; } public void setNetCode(String netCode) { this.netCode = netCode; } public String getStaCode() { return staCode; } public void setStaCode(String staCode) { this.staCode = staCode; } public DateTime getCreationDate() { return creationDate; } public void setCreationDate(DateTime creationDate) { this.creationDate = creationDate; } public List getEpochs(){ return this.epochs; } public void add(StationEpoch e){ e.setStation(this); if(epochs.isEmpty()){ this.creationDate = e.getStarted(); }else{ } this.epochs.add(e); } public Network getNetwork() { return network; } public void setNetwork(Network network) { this.network = network; } @Override public String toString() { return "Station [netCode=" + netCode + ", staCode=" + staCode + "]"; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((netCode == null) ? 0 : netCode.hashCode()); result = prime * result + ((staCode == null) ? 0 : staCode.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Station other = (Station) obj; if (netCode == null) { if (other.netCode != null) return false; } else if (!netCode.equals(other.netCode)) return false; if (staCode == null) { if (other.staCode != null) return false; } else if (!staCode.equals(other.staCode)) return false; return true; } }