EMMA Coverage Report (generated Wed Feb 13 07:49:24 ICT 2008)
[all classes][net.sourceforge.hiveboard]

COVERAGE SUMMARY FOR SOURCE FILE [Account.java]

nameclass, %method, %block, %line, %
Account.java100% (1/1)100% (27/27)98%  (184/187)98%  (57.9/59)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Account100% (1/1)100% (27/27)98%  (184/187)98%  (57.9/59)
equals (Object): boolean 100% (1/1)82%  (14/17)73%  (2.9/4)
Account (): void 100% (1/1)100% (3/3)100% (1/1)
copy (): Account 100% (1/1)100% (50/50)100% (13/13)
getDiscriminator (): int 100% (1/1)100% (3/3)100% (1/1)
getEmail (): String 100% (1/1)100% (3/3)100% (1/1)
getId (): int 100% (1/1)100% (3/3)100% (1/1)
getName (): String 100% (1/1)100% (3/3)100% (1/1)
getPassword (): String 100% (1/1)100% (3/3)100% (1/1)
getRole (): AccountRole 100% (1/1)100% (3/3)100% (1/1)
getVersion (): int 100% (1/1)100% (3/3)100% (1/1)
getVisa (): String 100% (1/1)100% (3/3)100% (1/1)
hashCode (): int 100% (1/1)100% (7/7)100% (1/1)
isAdmin (): boolean 100% (1/1)100% (3/3)100% (1/1)
isConnected (): boolean 100% (1/1)100% (3/3)100% (1/1)
isValid (): boolean 100% (1/1)100% (3/3)100% (1/1)
setAdmin (boolean): void 100% (1/1)100% (4/4)100% (2/2)
setConnected (boolean): void 100% (1/1)100% (4/4)100% (2/2)
setDiscriminator (int): void 100% (1/1)100% (4/4)100% (2/2)
setEmail (String): void 100% (1/1)100% (4/4)100% (2/2)
setId (int): void 100% (1/1)100% (4/4)100% (2/2)
setName (String): void 100% (1/1)100% (4/4)100% (2/2)
setPassword (String): void 100% (1/1)100% (4/4)100% (2/2)
setRole (AccountRole): void 100% (1/1)100% (4/4)100% (2/2)
setValid (boolean): void 100% (1/1)100% (4/4)100% (2/2)
setVersion (int): void 100% (1/1)100% (4/4)100% (2/2)
setVisa (String): void 100% (1/1)100% (4/4)100% (2/2)
toString (): String 100% (1/1)100% (33/33)100% (7/7)

1//  Copyright 2004-2007 Jean-Francois Poilpret
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14 
15package net.sourceforge.hiveboard;
16 
17import org.apache.hivemind.util.ToStringBuilder;
18 
19public class Account
20{
21        public Account        copy()
22        {
23                Account clone = new Account();
24                clone._id                                = _id;
25                clone._visa                                = _visa;
26                clone._discriminator        = _discriminator;
27                clone._password                        = _password;
28                clone._name                                = _name;
29                clone._email                        = _email;
30                clone._valid                        = _valid;
31                clone._connected                = _connected;
32                clone._role                                = _role;
33                clone._admin                        = _admin;
34                clone._version                        = _version;
35                return clone;
36        }
37        
38        public void                setId(int id)
39        {
40                _id = id;
41        }
42        public int                getId()
43        {
44                return _id;
45        }
46        
47        public void                setVisa(String visa)
48        {
49                _visa = visa;
50        }
51        public String         getVisa()
52        {
53                return _visa;
54        }
55 
56        /**
57         * Discriminator is used to enable several accounts with the same visa but 
58         * only one in valid state.
59         * For a valid account, it is always 0; when an account is deactivated, this
60         * value will be set to <code>select max(discriminator) + 1 from accounts</code>.
61         */        
62        public void                setDiscriminator(int discriminator)
63        {
64                _discriminator = discriminator;
65        }
66        public int                 getDiscriminator()
67        {
68                return _discriminator;
69        }
70        
71        public void                setName(String name)
72        {
73                _name = name;
74        }
75        public String         getName()
76        {
77                return _name;
78        }
79        
80        public void                setPassword(String password)
81        {
82                _password = password;
83        }
84        public String        getPassword()
85        {
86                return _password;
87        }
88        
89        public void                setEmail(String email)
90        {
91                _email = email;
92        }
93        public String         getEmail()
94        {
95                return _email;
96        }
97        
98        public void                setValid(boolean valid)
99        {
100                _valid = valid;
101        }
102        public boolean        isValid()
103        {
104                return _valid;
105        }
106        
107        public void                setConnected(boolean connected)
108        {
109                _connected = connected;
110        }
111        public boolean        isConnected()
112        {
113                return _connected;
114        }
115        
116        public void                setRole(AccountRole role)
117        {
118                _role = role;
119        }
120        public AccountRole        getRole()
121        {
122                return _role;
123        }
124        
125        public void                setAdmin(boolean admin)
126        {
127                _admin = admin;
128        }
129        public boolean        isAdmin()
130        {
131                return _admin;
132        }
133        
134        public void                setVersion(int version)
135        {
136                _version = version;
137        }
138        public int                getVersion()
139        {
140                return _version;
141        }
142 
143        // CSOFF: MagicNumberCheck
144        @Override public int                hashCode()
145        {
146                return _id * 45621 + 5631;
147        }
148        // CSON: MagicNumberCheck
149        
150        @Override public boolean        equals(Object o)
151        {
152                if (!(o instanceof Account))
153                {
154                        return false;
155                }
156                Account that = (Account) o;
157                return (this.getId() == that.getId());
158        }
159        
160        @Override public String        toString()
161        {
162                ToStringBuilder builder = new ToStringBuilder(this);
163                builder.append("id", _id);
164                builder.append("visa", _visa);
165                builder.append("name", _name);
166                builder.append("role", _role);
167                builder.append("connected", _connected);
168                return builder.toString();
169        }
170 
171        private int                        _id;
172        private String                _visa;
173        private int                        _discriminator;
174        private String                _password;
175        private String                _name;
176        private String                _email;
177        private boolean                _valid;
178        private boolean                _connected;
179        private AccountRole        _role;
180        private boolean                _admin;
181        private int                        _version;
182}

[all classes][net.sourceforge.hiveboard]
EMMA 2.0.5312 (C) Vladimir Roubtsov