Mercurial > dive4elements > river
annotate flys-backend/src/main/java/de/intevation/flys/model/Range.java @ 5441:7c1dd9c3f6bd
remove unit from sediment density and depths (always t/m3 respectively cm, otherwise a typo)
author | Tom Gottfried <tom.gottfried@intevation.de> |
---|---|
date | Tue, 26 Mar 2013 19:29:39 +0100 |
parents | 697d1faa8217 |
children | 7b1c5fe4ebf3 |
rev | line source |
---|---|
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.model; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import java.io.Serializable; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 import java.math.BigDecimal; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
7 import javax.persistence.Entity; |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
8 import javax.persistence.Id; |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
9 import javax.persistence.Table; |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
10 import javax.persistence.GeneratedValue; |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
11 import javax.persistence.Column; |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
12 import javax.persistence.SequenceGenerator; |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
13 import javax.persistence.GenerationType; |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
14 import javax.persistence.JoinColumn; |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
15 import javax.persistence.OneToOne; |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
16 |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
17 @Entity |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
18 @Table(name = "ranges") |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 public class Range |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 implements Serializable |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 { |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
22 private Integer id; |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 private BigDecimal a; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 private BigDecimal b; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 private River river; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 public Range() { |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 } |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 |
204
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
31 public Range(double a, double b, River river) { |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
32 this(new BigDecimal(a), new BigDecimal(b), river); |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
33 } |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
34 |
201
3169b559ca3c
Build models for wsts, wst columns and q ranges and store them in the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
189
diff
changeset
|
35 public Range(BigDecimal a, BigDecimal b, River river) { |
3169b559ca3c
Build models for wsts, wst columns and q ranges and store them in the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
189
diff
changeset
|
36 this.a = a; |
3169b559ca3c
Build models for wsts, wst columns and q ranges and store them in the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
189
diff
changeset
|
37 this.b = b; |
3169b559ca3c
Build models for wsts, wst columns and q ranges and store them in the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
189
diff
changeset
|
38 this.river = river; |
3169b559ca3c
Build models for wsts, wst columns and q ranges and store them in the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
189
diff
changeset
|
39 } |
3169b559ca3c
Build models for wsts, wst columns and q ranges and store them in the backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
189
diff
changeset
|
40 |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
41 @Id |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
42 @SequenceGenerator( |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
43 name = "SEQUENCE_RANGES_ID_SEQ", |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
44 sequenceName = "RANGES_ID_SEQ", |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
45 allocationSize = 1) |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
46 @GeneratedValue( |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
47 strategy = GenerationType.SEQUENCE, |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
48 generator = "SEQUENCE_RANGES_ID_SEQ") |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
49 @Column(name = "id") |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
50 public Integer getId() { |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
51 return id; |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
52 } |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
53 |
168
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
54 public void setId(Integer id) { |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 this.id = id; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 } |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 |
172
605320b7df94
Added column annotations for simple fields. TODO: foreign keys.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
58 @Column(name = "a") // FIXME: type mapping needed? |
605320b7df94
Added column annotations for simple fields. TODO: foreign keys.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
59 public BigDecimal getA() { |
605320b7df94
Added column annotations for simple fields. TODO: foreign keys.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
60 return a; |
605320b7df94
Added column annotations for simple fields. TODO: foreign keys.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
61 } |
605320b7df94
Added column annotations for simple fields. TODO: foreign keys.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
62 |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 public void setA(BigDecimal a) { |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 this.a = a; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 } |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 |
172
605320b7df94
Added column annotations for simple fields. TODO: foreign keys.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
67 @Column(name = "b") // FIXME: type mapping needed? |
605320b7df94
Added column annotations for simple fields. TODO: foreign keys.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
68 public BigDecimal getB() { |
605320b7df94
Added column annotations for simple fields. TODO: foreign keys.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
69 return b; |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 } |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 public void setB(BigDecimal b) { |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 this.b = b; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 } |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 |
188
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
174
diff
changeset
|
76 @OneToOne |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
174
diff
changeset
|
77 @JoinColumn(name = "river_id") |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
174
diff
changeset
|
78 public River getRiver() { |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
174
diff
changeset
|
79 return river; |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
174
diff
changeset
|
80 } |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
174
diff
changeset
|
81 |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
82 public void setRiver(River river) { |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 this.river = river; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 } |
204
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
85 |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
86 public int code() { |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
87 int code = 0; |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
88 if (a != null) code = 1; |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
89 if (b != null) code |= 2; |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
90 return code; |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
91 } |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
92 |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
93 public boolean intersects(BigDecimal c) { |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
94 return !(a.compareTo(c) > 0 || b.compareTo(c) < 0); |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
95 } |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
96 |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
97 public boolean intersects(Range other) { |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
98 |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
99 int code = code(); |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
100 int ocode = other.code(); |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
101 |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
102 if (code == 0 || ocode == 0) { |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
103 return false; |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
104 } |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
105 |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
106 switch (code) { |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
107 case 1: // has a |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
108 switch (ocode) { |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
109 case 1: // has a |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
110 return a.compareTo(other.a) == 0; |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
111 case 2: // has b |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
112 return a.compareTo(other.b) == 0; |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
113 case 3: // has range |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
114 return other.intersects(a); |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
115 } |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
116 break; |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
117 case 2: // has b |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
118 switch (ocode) { |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
119 case 1: // has a |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
120 return b.compareTo(other.a) == 0; |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
121 case 2: // has b |
205
697d1faa8217
Forgot to save the last change before commit.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
204
diff
changeset
|
122 return b.compareTo(other.b) == 0; |
204
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
123 case 3: // has range |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
124 return other.intersects(b); |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
125 } |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
126 break; |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
127 case 3: // has range |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
128 switch (ocode) { |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
129 case 1: // has a |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
130 return intersects(other.a); |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
131 case 2: // has b |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
132 return intersects(other.b); |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
133 case 3: // has range |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
134 return !(other.b.compareTo(a) < 0 |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
135 ||other.a.compareTo(b) > 0); |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
136 } |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
137 break; |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
138 |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
139 } |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
140 |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
141 return false; |
764835268e2b
Added methods to find out if two ranges intersects.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
201
diff
changeset
|
142 } |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
143 } |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
144 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |