~tapaal-contributor/tapaal/disappearing-tokens-1940098

« back to all changes in this revision

Viewing changes to src/dk/aau/cs/model/tapn/IntBound.java

  • Committer: Kenneth Yrke Jørgensen
  • Date: 2011-04-12 09:50:16 UTC
  • mfrom: (329.1.188 tapaal-1.5)
  • Revision ID: mail@yrke.dk-20110412095016-e4hqdgab5596ja09
Merged with branch addning support for new 1.5 features

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package dk.aau.cs.model.tapn;
 
2
 
 
3
import dk.aau.cs.util.Require;
 
4
 
 
5
public class IntBound implements Bound {
 
6
        private int bound;
 
7
 
 
8
        public IntBound(int bound) {
 
9
                Require.that(bound >= 0, "Integer bounds must be non-negative.");
 
10
                this.bound = bound;
 
11
        }
 
12
 
 
13
        public IntBound(IntBound bound) {
 
14
                Require.that(bound != null, "Integer bound cannot be null");
 
15
 
 
16
                this.bound = bound.bound;
 
17
        }
 
18
 
 
19
        public int value() {
 
20
                return bound;
 
21
        }
 
22
 
 
23
 
 
24
        public IntBound copy() {
 
25
                return new IntBound(this);
 
26
        }
 
27
 
 
28
        @Override
 
29
        public String toString() {
 
30
                return Integer.toString(bound);
 
31
        }
 
32
 
 
33
        @Override
 
34
        public int hashCode() {
 
35
                final int prime = 31;
 
36
                int result = 1;
 
37
                result = prime * result + bound;
 
38
                return result;
 
39
        }
 
40
 
 
41
        @Override
 
42
        public boolean equals(Object obj) {
 
43
                if (this == obj)
 
44
                        return true;
 
45
                if (obj == null)
 
46
                        return false;
 
47
                if (!(obj instanceof IntBound))
 
48
                        return false;
 
49
                IntBound other = (IntBound) obj;
 
50
                if (bound != other.bound)
 
51
                        return false;
 
52
                return true;
 
53
        }
 
54
}