chris@1: /* chris@1: * SONEWS News Server chris@1: * see AUTHORS for the list of contributors chris@1: * chris@1: * This program is free software: you can redistribute it and/or modify chris@1: * it under the terms of the GNU General Public License as published by chris@1: * the Free Software Foundation, either version 3 of the License, or chris@1: * (at your option) any later version. chris@1: * chris@1: * This program is distributed in the hope that it will be useful, chris@1: * but WITHOUT ANY WARRANTY; without even the implied warranty of chris@1: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the chris@1: * GNU General Public License for more details. chris@1: * chris@1: * You should have received a copy of the GNU General Public License chris@1: * along with this program. If not, see . chris@1: */ chris@1: chris@1: package org.sonews.feed; chris@1: chris@1: /** chris@1: * For every group that is synchronized with or from a remote newsserver chris@1: * a Subscription instance exists. chris@1: * @author Christian Lins chris@1: * @since sonews/0.5.0 chris@1: */ chris@1: public class Subscription chris@1: { chris@1: chris@1: private String host; chris@1: private int port; chris@1: private int feedtype; chris@1: private String group; chris@1: chris@1: public Subscription(String host, int port, int feedtype, String group) chris@1: { chris@1: this.host = host; chris@1: this.port = port; chris@1: this.feedtype = feedtype; chris@1: this.group = group; chris@1: } chris@1: cli@22: @Override cli@22: public boolean equals(Object obj) cli@22: { cli@22: if(obj instanceof Subscription) cli@22: { cli@22: Subscription sub = (Subscription)obj; cli@22: return sub.host.equals(host) && sub.group.equals(group) cli@22: && sub.port == port && sub.feedtype == feedtype; cli@22: } cli@22: else cli@22: { cli@22: return false; cli@22: } cli@22: } cli@22: cli@22: @Override cli@22: public int hashCode() cli@22: { cli@22: return host.hashCode() + port + feedtype + group.hashCode(); cli@22: } cli@22: chris@1: public int getFeedtype() chris@1: { chris@1: return feedtype; chris@1: } chris@1: chris@1: public String getGroup() chris@1: { chris@1: return group; chris@1: } chris@1: chris@1: public String getHost() chris@1: { chris@1: return host; chris@1: } chris@1: chris@1: public int getPort() chris@1: { chris@1: return port; chris@1: } chris@1: chris@1: }