View Javadoc

1   /***
2    * Jetrix TetriNET Server
3    * Copyright (C) 2003-2004  Emmanuel Bourg
4    *
5    * This program is free software; you can redistribute it and/or
6    * modify it under the terms of the GNU General Public License
7    * as published by the Free Software Foundation; either version 2
8    * of the License, or (at your option) any later version.
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   * GNU General Public License for more details.
14   *
15   * You should have received a copy of the GNU General Public License
16   * along with this program; if not, write to the Free Software
17   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18   */
19  
20  package net.jetrix.winlist;
21  
22  import java.util.*;
23  
24  import net.jetrix.config.*;
25  
26  /***
27   * A winlist ranking players and teams.
28   *
29   * @since 0.1.2
30   *
31   * @author Emmanuel Bourg
32   * @version $Revision: 794 $, $Date: 2009-02-17 20:08:39 +0100 (Tue, 17 Feb 2009) $
33   */
34  public interface Winlist
35  {
36      /***
37       * Return the id for this winlist.
38       */
39      String getId();
40  
41      /***
42       * Set the id for this winlist.
43       */
44      void setId(String id);
45  
46      /***
47       * Initialize the winlist.
48       *
49       * @param config the winlist configuration
50       */
51      void init(WinlistConfig config);
52  
53      /***
54       * Return the configuration necessary to create the same winlist
55       *
56       * @since 0.2
57       */
58      WinlistConfig getConfig();
59  
60      /***
61       * Return the score of the specified player or team
62       *
63       * @param name the name of the player or team
64       * @param type the score type (0: player, 1: team)
65       */
66      Score getScore(String name, int type);
67  
68      /***
69       * Return the score list in the specified range.
70       *
71       * @param offset the beginning of the range
72       * @param length the length of the range
73       */
74      List<Score> getScores(long offset, long length);
75  
76      /***
77       * Update the winlist with the specified game result.
78       */
79      void saveGameResult(GameResult result);
80  
81      /***
82       * Remove all entries in the winlist
83       *
84       * @since 0.2
85       */
86      void clear();
87  
88      /***
89       * Return the number of entries in the winlist
90       *
91       * @since 0.2
92       */
93      int size();
94  
95  }