001 /**
002 * Jetrix TetriNET Server
003 * Copyright (C) 2001-2003 Emmanuel Bourg
004 *
005 * This program is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU General Public License
007 * as published by the Free Software Foundation; either version 2
008 * of the License, or (at your option) any later version.
009 *
010 * This program is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013 * GNU General Public License for more details.
014 *
015 * You should have received a copy of the GNU General Public License
016 * along with this program; if not, write to the Free Software
017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
018 */
019
020 package net.jetrix.winlist;
021
022 /**
023 * The score of a player or team in a winlist.
024 *
025 * @author Emmanuel Bourg
026 * @version $Revision: 794 $, $Date: 2009-02-17 20:08:39 +0100 (Tue, 17 Feb 2009) $
027 */
028 public class Score
029 {
030 private String name;
031 private int type;
032 private long score;
033
034 public static final int TYPE_PLAYER = 0;
035 public static final int TYPE_TEAM = 1;
036
037 public Score()
038 {
039 }
040
041 public Score(String name, int type, long score)
042 {
043 this.name = name;
044 this.type = type;
045 this.score = score;
046 }
047
048 public String getName()
049 {
050 return name;
051 }
052
053 public void setName(String name)
054 {
055 this.name = name;
056 }
057
058 public int getType()
059 {
060 return type;
061 }
062
063 public void setType(int type)
064 {
065 this.type = type;
066 }
067
068 public long getScore()
069 {
070 return score;
071 }
072
073 public void setScore(long score)
074 {
075 this.score = score;
076 }
077
078 public boolean equals(Object o)
079 {
080 if (this == o) return true;
081 if (!(o instanceof Score)) return false;
082
083 final Score score = (Score) o;
084
085 if (type != score.type) return false;
086 if (!name.equals(score.name)) return false;
087
088 return true;
089 }
090
091 public int hashCode()
092 {
093 int result;
094 result = name.hashCode();
095 result = 29 * result + type;
096 return result;
097 }
098
099 public String toString()
100 {
101 return "[Score name=" + name + " value=" + score + " type=" + type + "]";
102 }
103 }