data
Class Score

java.lang.Object
  extended by data.Score
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Score>

public class Score
extends java.lang.Object
implements java.io.Serializable, java.lang.Comparable<Score>

Author:
Tansel
See Also:
Serialized Form

Field Summary
private  java.lang.String name
           
private  int score
           
private static long serialVersionUID
           
 
Constructor Summary
Score(int score, java.lang.String name)
          This is a Serializable class to save the score.
 
Method Summary
 int compareTo(Score score)
          This method is a simple override for comparing objects to each other.
 java.lang.String getName()
           
 int getScore()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

score

private int score

name

private java.lang.String name
Constructor Detail

Score

public Score(int score,
             java.lang.String name)
This is a Serializable class to save the score.

Parameters:
score -
name -
Method Detail

getScore

public int getScore()
Returns:
Integer value of Score object, which is the score that had been made by players.

getName

public java.lang.String getName()
Returns:
String value of Score object, which is the name of the player who made the score.

compareTo

public int compareTo(Score score)
This method is a simple override for comparing objects to each other. We are using Comparable interface to sort an arraylist.

Specified by:
compareTo in interface java.lang.Comparable<Score>
Parameters:
score - Another Score object to compare.
Returns:
Comparison.