Mercurial > dive4elements > river
annotate flys-backend/src/main/java/de/intevation/flys/model/River.java @ 2364:efe19e669092
Added and registered a model Catchment for 'catchment' relation.
flys-backend/trunk@3202 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 09 Nov 2011 16:25:20 +0000 |
parents | 0acf28a3d28a |
children | 056b3a5aa181 |
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 |
465
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
5 import java.math.BigDecimal; |
768 | 6 import java.math.MathContext; |
465
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
7 |
168
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
8 import javax.persistence.Entity; |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
9 import javax.persistence.Id; |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
10 import javax.persistence.Table; |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
11 import javax.persistence.GeneratedValue; |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
12 import javax.persistence.Column; |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
13 import javax.persistence.SequenceGenerator; |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
14 import javax.persistence.OneToMany; |
2347
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
15 import javax.persistence.OneToOne; |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
16 import javax.persistence.JoinColumn; |
168
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
17 import javax.persistence.GenerationType; |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
18 |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
19 import java.util.List; |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
20 |
472
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
21 import org.hibernate.Session; |
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
22 import org.hibernate.Query; |
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
23 |
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
24 import de.intevation.flys.backend.SessionHolder; |
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
25 |
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
26 |
168
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
27 @Entity |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
28 @Table(name = "rivers") |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 public class River |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 implements Serializable |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 { |
768 | 32 public static final MathContext PRECISION = new MathContext(6); |
33 | |
168
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
34 private Integer id; |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 |
168
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
36 private String name; |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 |
505
ce9c6f05f464
Schema: Added a column which tells if a river counts its km up or downwards.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
488
diff
changeset
|
38 private boolean kmUp; |
ce9c6f05f464
Schema: Added a column which tells if a river counts its km up or downwards.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
488
diff
changeset
|
39 |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
40 private List<Gauge> gauges; |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
41 |
2347
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
42 private Unit wstUnit; |
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
43 |
168
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
44 @Id |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
45 @SequenceGenerator( |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
169
diff
changeset
|
46 name = "SEQUENCE_RIVERS_ID_SEQ", |
169
7929f4144d2f
Bound Apache Commons DBCP with Hibernate.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
47 sequenceName = "RIVERS_ID_SEQ", |
7929f4144d2f
Bound Apache Commons DBCP with Hibernate.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
48 allocationSize = 1) |
168
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
49 @GeneratedValue( |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
50 strategy = GenerationType.SEQUENCE, |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
169
diff
changeset
|
51 generator = "SEQUENCE_RIVERS_ID_SEQ") |
168
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
52 @Column(name = "id") |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
53 public Integer getId() { |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
54 return id; |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
55 } |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
56 |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
57 public void setId(Integer id) { |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 this.id = id; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 } |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 |
168
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
61 @Column(name = "name") |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
62 public String getName() { |
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
63 return name; |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 } |
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 public void setName(String name) { |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 this.name = name; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 } |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 |
505
ce9c6f05f464
Schema: Added a column which tells if a river counts its km up or downwards.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
488
diff
changeset
|
70 @Column(name = "km_up") |
ce9c6f05f464
Schema: Added a column which tells if a river counts its km up or downwards.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
488
diff
changeset
|
71 public boolean getKmUp() { |
ce9c6f05f464
Schema: Added a column which tells if a river counts its km up or downwards.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
488
diff
changeset
|
72 return kmUp; |
ce9c6f05f464
Schema: Added a column which tells if a river counts its km up or downwards.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
488
diff
changeset
|
73 } |
ce9c6f05f464
Schema: Added a column which tells if a river counts its km up or downwards.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
488
diff
changeset
|
74 |
ce9c6f05f464
Schema: Added a column which tells if a river counts its km up or downwards.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
488
diff
changeset
|
75 public void setKmUp(boolean kmUp) { |
ce9c6f05f464
Schema: Added a column which tells if a river counts its km up or downwards.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
488
diff
changeset
|
76 this.kmUp = kmUp; |
ce9c6f05f464
Schema: Added a column which tells if a river counts its km up or downwards.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
488
diff
changeset
|
77 } |
ce9c6f05f464
Schema: Added a column which tells if a river counts its km up or downwards.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
488
diff
changeset
|
78 |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 public River() { |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
80 } |
169
7929f4144d2f
Bound Apache Commons DBCP with Hibernate.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
81 |
2347
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
82 public River(String name, Unit wstUnit) { |
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
83 this.name = name; |
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
84 this.wstUnit = wstUnit; |
169
7929f4144d2f
Bound Apache Commons DBCP with Hibernate.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
85 } |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
86 |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
87 @OneToMany |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
88 @JoinColumn(name="river_id") |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
89 public List<Gauge> getGauges() { |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
90 return gauges; |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
91 } |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
92 |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
93 public void setGauges(List<Gauge> gauges) { |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
94 this.gauges = gauges; |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
95 } |
188
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
174
diff
changeset
|
96 |
2347
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
97 |
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
98 @OneToOne |
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
99 @JoinColumn(name = "wst_unit_id" ) |
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
100 public Unit getWstUnit() { |
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
101 return wstUnit; |
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
102 } |
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
103 |
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
104 public void setWstUnit(Unit wstUnit) { |
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
105 this.wstUnit = wstUnit; |
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
106 } |
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
107 |
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
108 |
0acf28a3d28a
Removed the Unit from Wsts - added a WstUnit column to rivers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2345
diff
changeset
|
109 |
188
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
174
diff
changeset
|
110 public String toString() { |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
174
diff
changeset
|
111 return name != null ? name : ""; |
003ac16812dd
Store annotations in backend.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
174
diff
changeset
|
112 } |
465
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
113 |
472
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
114 |
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
115 /** |
488
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
116 * This method returns the gauges that intersect with <i>a</i> and |
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
117 * <i>b</i>, |
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
118 * |
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
119 * @param a A start point. |
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
120 * @param b An end point. |
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
121 * |
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
122 * @return the intersecting gauges. |
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
123 */ |
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
124 public List<Gauge> determineGauges(double a, double b) { |
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
125 Session session = SessionHolder.HOLDER.get(); |
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
126 |
756
ca13926b8871
River: Make search for gauges independent of from/to order.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
127 if (a > b) { double t = a; a = b; b = t; } |
ca13926b8871
River: Make search for gauges independent of from/to order.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
505
diff
changeset
|
128 |
488
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
129 Query query = session.createQuery( |
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
130 "from Gauge where river=:river " + |
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
131 "and not (range.a > :b or range.b < :a) order by a"); |
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
132 query.setParameter("river", this); |
769
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
133 query.setParameter("a", new BigDecimal(a, PRECISION)); |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
134 query.setParameter("b", new BigDecimal(b, PRECISION)); |
488
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
135 |
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
136 return query.list(); |
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
137 } |
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
138 |
769
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
139 public Gauge maxOverlap(double a, double b) { |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
140 List<Gauge> gauges = determineGauges(a, b); |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
141 if (gauges == null) { |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
142 return null; |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
143 } |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
144 |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
145 if (a > b) { double t = a; a = b; b = t; } |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
146 |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
147 double max = -Double.MAX_VALUE; |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
148 |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
149 Gauge result = null; |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
150 |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
151 for (Gauge gauge: gauges) { |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
152 Range r = gauge.getRange(); |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
153 double c = r.getA().doubleValue(); |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
154 double d = r.getB().doubleValue(); |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
155 |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
156 double start = c >= a ? c : a; |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
157 double stop = d <= b ? d : b; |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
158 |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
159 double length = stop - start; |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
160 |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
161 if (length > max) { |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
162 max = length; |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
163 result = gauge; |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
164 } |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
165 } |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
166 |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
167 return result; |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
168 } |
321b9e480f72
Added a method to river to find the gauge with the max overlap with a given interval.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
768
diff
changeset
|
169 |
767
5572d051347e
River: Added method to find gauge by its name.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
764
diff
changeset
|
170 public Gauge determineGaugeByName(String name) { |
5572d051347e
River: Added method to find gauge by its name.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
764
diff
changeset
|
171 Session session = SessionHolder.HOLDER.get(); |
5572d051347e
River: Added method to find gauge by its name.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
764
diff
changeset
|
172 Query query = session.createQuery( |
5572d051347e
River: Added method to find gauge by its name.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
764
diff
changeset
|
173 "from Gauge where river=:river and name=:name"); |
5572d051347e
River: Added method to find gauge by its name.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
764
diff
changeset
|
174 query.setParameter("river", this); |
5572d051347e
River: Added method to find gauge by its name.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
764
diff
changeset
|
175 query.setParameter("name", name); |
5572d051347e
River: Added method to find gauge by its name.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
764
diff
changeset
|
176 List<Gauge> gauges = query.list(); |
5572d051347e
River: Added method to find gauge by its name.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
764
diff
changeset
|
177 return gauges.isEmpty() ? null : gauges.get(0); |
5572d051347e
River: Added method to find gauge by its name.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
764
diff
changeset
|
178 } |
5572d051347e
River: Added method to find gauge by its name.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
764
diff
changeset
|
179 |
764
e09f00ecb915
river model: Added method to find gauge by a position lying in its range.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
757
diff
changeset
|
180 public Gauge determineGaugeByPosition(double p) { |
e09f00ecb915
river model: Added method to find gauge by a position lying in its range.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
757
diff
changeset
|
181 Session session = SessionHolder.HOLDER.get(); |
e09f00ecb915
river model: Added method to find gauge by a position lying in its range.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
757
diff
changeset
|
182 Query query = session.createQuery( |
768 | 183 "from Gauge g where river=:river " + |
184 "and :p between g.range.a and g.range.b"); | |
764
e09f00ecb915
river model: Added method to find gauge by a position lying in its range.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
757
diff
changeset
|
185 query.setParameter("river", this); |
768 | 186 query.setParameter("p", new BigDecimal(p, PRECISION)); |
764
e09f00ecb915
river model: Added method to find gauge by a position lying in its range.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
757
diff
changeset
|
187 List<Gauge> gauges = query.list(); |
e09f00ecb915
river model: Added method to find gauge by a position lying in its range.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
757
diff
changeset
|
188 return gauges.isEmpty() ? null : gauges.get(0); |
e09f00ecb915
river model: Added method to find gauge by a position lying in its range.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
757
diff
changeset
|
189 } |
e09f00ecb915
river model: Added method to find gauge by a position lying in its range.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
757
diff
changeset
|
190 |
757
c19d4c643526
River: add method to find gauge by its station position.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
756
diff
changeset
|
191 public Gauge determineGaugeByStation(double a, double b) { |
c19d4c643526
River: add method to find gauge by its station position.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
756
diff
changeset
|
192 |
c19d4c643526
River: add method to find gauge by its station position.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
756
diff
changeset
|
193 if (a > b) { double t = a; a = b; b = t; } |
c19d4c643526
River: add method to find gauge by its station position.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
756
diff
changeset
|
194 |
c19d4c643526
River: add method to find gauge by its station position.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
756
diff
changeset
|
195 Session session = SessionHolder.HOLDER.get(); |
c19d4c643526
River: add method to find gauge by its station position.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
756
diff
changeset
|
196 |
c19d4c643526
River: add method to find gauge by its station position.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
756
diff
changeset
|
197 Query query = session.createQuery( |
c19d4c643526
River: add method to find gauge by its station position.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
756
diff
changeset
|
198 "from Gauge where river.id=:river " + |
c19d4c643526
River: add method to find gauge by its station position.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
756
diff
changeset
|
199 "and station between :a and :b"); |
c19d4c643526
River: add method to find gauge by its station position.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
756
diff
changeset
|
200 query.setParameter("river", getId()); |
c19d4c643526
River: add method to find gauge by its station position.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
756
diff
changeset
|
201 query.setParameter("a", new BigDecimal(a)); |
c19d4c643526
River: add method to find gauge by its station position.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
756
diff
changeset
|
202 query.setParameter("b", new BigDecimal(b)); |
c19d4c643526
River: add method to find gauge by its station position.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
756
diff
changeset
|
203 |
c19d4c643526
River: add method to find gauge by its station position.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
756
diff
changeset
|
204 List<Gauge> gauges = query.list(); |
c19d4c643526
River: add method to find gauge by its station position.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
756
diff
changeset
|
205 return gauges.isEmpty() ? null : gauges.get(0); |
c19d4c643526
River: add method to find gauge by its station position.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
756
diff
changeset
|
206 } |
c19d4c643526
River: add method to find gauge by its station position.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
756
diff
changeset
|
207 |
488
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
208 |
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
209 /** |
472
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
210 * This method returns the first gauge that is intersected by <i>a</i> and |
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
211 * <i>b</i>, |
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
212 * |
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
213 * @param a A start point. |
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
214 * @param b An end point. |
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
215 * |
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
216 * @return the first intersecting gauge. |
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
217 */ |
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
218 public Gauge determineGauge(double a, double b) { |
488
b316d2106598
River got a new method that returns all gauges intersected by a given start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
472
diff
changeset
|
219 List<Gauge> gauges = determineGauges(a, b); |
472
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
220 |
2345
c3ea91aee989
Bugfix: #333 Improved determination of reference gauge based on start km.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
769
diff
changeset
|
221 int idx = a < b ? 0 : gauges.size() - 1; |
c3ea91aee989
Bugfix: #333 Improved determination of reference gauge based on start km.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
769
diff
changeset
|
222 |
c3ea91aee989
Bugfix: #333 Improved determination of reference gauge based on start km.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
769
diff
changeset
|
223 return gauges.isEmpty() ? null : gauges.get(idx); |
472
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
224 } |
1e196c75563b
Added a new method to determine the selected gauge of a river based on a start and end point.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
465
diff
changeset
|
225 |
465
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
226 /** |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
227 * Returns the min and max distance of this river. The first position in the |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
228 * resulting array contains the min distance, the second position the max |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
229 * distance. |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
230 * |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
231 * @return the min and max distance of this river. |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
232 */ |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
233 public double[] determineMinMaxDistance() { |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
234 if (gauges == null) { |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
235 return null; |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
236 } |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
237 |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
238 double minmax[] = new double[] { Double.MAX_VALUE, Double.MIN_VALUE }; |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
239 |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
240 for (Gauge g: gauges) { |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
241 Range r = g.getRange(); |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
242 |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
243 double a = r.getA().doubleValue(); |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
244 minmax[0] = minmax[0] < a ? minmax[0] : a; |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
245 |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
246 BigDecimal bigB = r.getB(); |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
247 if (bigB != null) { |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
248 double b = bigB.doubleValue(); |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
249 minmax[1] = minmax[1] > b ? minmax[1] : b; |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
250 } |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
251 } |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
252 |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
253 return minmax; |
c2c3ad4fda58
Added a method to River that returns the min and max distance of the river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
188
diff
changeset
|
254 } |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
255 } |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
256 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |