Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: jcsq/player/Player.java


1   package jcsq.player;
2   
3   import jcsq.util.Converter;
4   
5   /**
6    * Container for the info of each player.
7    */
8   public class Player{
9   
10          private int id;
11    private int frags;
12    private String name;
13    private byte[] nameBytes = new byte[256];
14    private byte[] timeBytes = new byte[4];
15  
16    public Player(int id){
17      this.id = id;
18    }
19    public Player(){}
20  
21    public void setName(String name){
22      this.name = name;
23    }
24    public void setFrags(int frags){
25      this.frags = frags;
26    }
27    public void setId(int id){
28      this.id = id;
29    }
30    public void addNameByte(int pos,byte b){
31      this.nameBytes[pos] = b;
32    }
33    public String getName(){
34      return new String(this.nameBytes,0,this.nameBytes.length).trim();
35    }
36    public byte[] getNameBytes(){
37      return this.nameBytes;
38    }
39    public int getId(){
40      return this.id;
41    }
42    public int getFrags(){
43      return this.frags;
44    }
45    public void setTimeByte(int index, byte b){
46      this.timeBytes[index] = b;
47    }
48    public float getTime(){
49      return Converter.bytesToFloat(this.timeBytes);
50    }
51    public byte[] getTimeBytes(){
52      return this.timeBytes;
53    }
54  
55  
56  
57  
58  
59  
60  }