src/org/sonews/feed/Subscription.java
author František Kučera <franta-hg@frantovo.cz>
Mon, 17 Oct 2011 19:50:23 +0200
changeset 91 70286a6cf338
parent 37 74139325d305
permissions -rwxr-xr-x
Drupal: text/plain – podpora obrázků a dalších vnořených elementů uvnitř odkazů.
chris@1
     1
/*
chris@1
     2
 *   SONEWS News Server
chris@1
     3
 *   see AUTHORS for the list of contributors
chris@1
     4
 *
chris@1
     5
 *   This program is free software: you can redistribute it and/or modify
chris@1
     6
 *   it under the terms of the GNU General Public License as published by
chris@1
     7
 *   the Free Software Foundation, either version 3 of the License, or
chris@1
     8
 *   (at your option) any later version.
chris@1
     9
 *
chris@1
    10
 *   This program is distributed in the hope that it will be useful,
chris@1
    11
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
chris@1
    12
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
chris@1
    13
 *   GNU General Public License for more details.
chris@1
    14
 *
chris@1
    15
 *   You should have received a copy of the GNU General Public License
chris@1
    16
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
chris@1
    17
 */
chris@1
    18
chris@1
    19
package org.sonews.feed;
chris@1
    20
chris@1
    21
/**
chris@1
    22
 * For every group that is synchronized with or from a remote newsserver 
chris@1
    23
 * a Subscription instance exists.
chris@1
    24
 * @author Christian Lins
chris@1
    25
 * @since sonews/0.5.0
chris@1
    26
 */
cli@37
    27
public class Subscription
chris@1
    28
{
chris@1
    29
cli@37
    30
	private String host;
cli@37
    31
	private int port;
cli@37
    32
	private int feedtype;
cli@37
    33
	private String group;
chris@1
    34
cli@37
    35
	public Subscription(String host, int port, int feedtype, String group)
cli@37
    36
	{
cli@37
    37
		this.host = host;
cli@37
    38
		this.port = port;
cli@37
    39
		this.feedtype = feedtype;
cli@37
    40
		this.group = group;
cli@37
    41
	}
cli@22
    42
cli@37
    43
	@Override
cli@37
    44
	public boolean equals(Object obj)
cli@37
    45
	{
cli@37
    46
		if (obj instanceof Subscription) {
cli@37
    47
			Subscription sub = (Subscription) obj;
cli@37
    48
			return sub.host.equals(host) && sub.group.equals(group)
cli@37
    49
				&& sub.port == port && sub.feedtype == feedtype;
cli@37
    50
		} else {
cli@37
    51
			return false;
cli@37
    52
		}
cli@37
    53
	}
cli@22
    54
cli@37
    55
	@Override
cli@37
    56
	public int hashCode()
cli@37
    57
	{
cli@37
    58
		return host.hashCode() + port + feedtype + group.hashCode();
cli@37
    59
	}
chris@1
    60
cli@37
    61
	public int getFeedtype()
cli@37
    62
	{
cli@37
    63
		return feedtype;
cli@37
    64
	}
chris@1
    65
cli@37
    66
	public String getGroup()
cli@37
    67
	{
cli@37
    68
		return group;
cli@37
    69
	}
chris@1
    70
cli@37
    71
	public String getHost()
cli@37
    72
	{
cli@37
    73
		return host;
cli@37
    74
	}
cli@37
    75
cli@37
    76
	public int getPort()
cli@37
    77
	{
cli@37
    78
		return port;
cli@37
    79
	}
chris@1
    80
}