annotate Limits/AbstractLimit.cs @ 71:40c09e57d213

Fixes #31: Break out Translations for language to own class * Make Translation class use new extracted class objects
author IBBoard <dev@ibboard.co.uk>
date Tue, 06 Apr 2010 18:08:43 +0000
parents 44bc5bd5c2f3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 // This file (AbstractLimit.cs) is a part of the IBBoard project and is copyright 2009 IBBoard
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 //
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license.
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 using System;
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6
56
1e5080813ac5 Re #24: Add limit objects
IBBoard <dev@ibboard.co.uk>
parents: 51
diff changeset
7 namespace IBBoard.Limits
49
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 {
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 /// <summary>
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 /// The abstract base class for all limits
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11 /// </summary>
57
44bc5bd5c2f3 Re #24: Add limit objects
IBBoard <dev@ibboard.co.uk>
parents: 56
diff changeset
12 public abstract class AbstractLimit : ILimit
49
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 {
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 private double limit;
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
15
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
16 public AbstractLimit (double limitNum)
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
17 {
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 limit = limitNum;
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 }
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
20
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
21 protected double Limit
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
22 {
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 get
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
24 {
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
25 return limit;
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
26 }
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
27 }
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
28
51
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
29 public override int GetHashCode ()
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
30 {
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
31 int hash = GetType().GetHashCode();
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
32 hash+= Limit.GetHashCode();
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
33 return hash;
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
34 }
57
44bc5bd5c2f3 Re #24: Add limit objects
IBBoard <dev@ibboard.co.uk>
parents: 56
diff changeset
35
44bc5bd5c2f3 Re #24: Add limit objects
IBBoard <dev@ibboard.co.uk>
parents: 56
diff changeset
36 public abstract int GetLimit(int size);
51
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
37
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
38 public override bool Equals (object obj)
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
39 {
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
40 bool equal = false;
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
41
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
42 if (obj != null && GetType().Equals(obj.GetType()))
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
43 {
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
44 equal = (Limit == ((AbstractLimit)obj).Limit);
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
45 }
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
46
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
47 return equal;
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
48 }
c3b217a708f4 Re #24: Add limits
IBBoard <dev@ibboard.co.uk>
parents: 49
diff changeset
49
49
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
50 }
a177a3750acd Re #24: Add "limit" objects that can be used for numeric limits
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
51 }