comparison flys-client/src/main/java/de/intevation/flys/client/client/ui/RecommendationPairRecord.java @ 1299:f4f30d758550

Cosmetics (docs). flys-client/trunk@2923 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Mon, 10 Oct 2011 10:46:04 +0000
parents b0ed67cb5197
children 18b0414bde44
comparison
equal deleted inserted replaced
1298:b0ed67cb5197 1299:f4f30d758550
13 /** First attribute-name for StringPairRecord. */ 13 /** First attribute-name for StringPairRecord. */
14 protected static final String ATTRIBUTE_FIRST = "first"; 14 protected static final String ATTRIBUTE_FIRST = "first";
15 15
16 /** Second attribute-name for StringPairRecord. */ 16 /** Second attribute-name for StringPairRecord. */
17 protected static final String ATTRIBUTE_SECOND = "second"; 17 protected static final String ATTRIBUTE_SECOND = "second";
18 18
19 /** The "first" recommendation (typically the minuend). */
19 Recommendation first; 20 Recommendation first;
21
22 /** The "second" recommendation (typically the subtrahend). */
20 Recommendation second; 23 Recommendation second;
24
25 /** Human-readable short information about the "first" recommendation. */
21 String firstName; 26 String firstName;
27
28 /** Human-readable short information about the "second" recommendation. */
22 String secondName; 29 String secondName;
23 30
24 31
25 public RecommendationPairRecord() { 32 public RecommendationPairRecord() {
26 } 33 }
27 34
28 35
29 public RecommendationPairRecord(String firstName, 36 /**
37 * Create a new RecommendationPairRecord.
38 *
39 * @param firstName Name for the first recommendation (typical minuend).
40 * @param first The first recommendation (typically the minuend).
41 * @param secondName Name for the second recommendation (subtrahend).
42 * @param first The second recommendation (typically the subtrahend).
43 */
44 public RecommendationPairRecord(
45 String firstName,
30 Recommendation first, 46 Recommendation first,
31 String secondName, 47 String secondName,
32 Recommendation second) 48 Recommendation second)
33 { 49 {
34 setFirst(first, firstName); 50 setFirst(first, firstName);
35 setSecond(second, secondName); 51 setSecond(second, secondName);
36 } 52 }
37 53
38 54
55 /**
56 * Sets the first recommendation with info (minuend).
57 */
39 public void setFirst(Recommendation first, String name) { 58 public void setFirst(Recommendation first, String name) {
40 this.first = first; 59 this.first = first;
41 this.firstName = name; 60 this.firstName = name;
42 setAttribute(ATTRIBUTE_FIRST, name); 61 setAttribute(ATTRIBUTE_FIRST, name);
43 } 62 }
44 63
45 64
65 /**
66 * Sets the second recommendation with info (subtrahend).
67 */
46 public void setSecond(Recommendation second, String name) { 68 public void setSecond(Recommendation second, String name) {
47 this.second = second; 69 this.second = second;
48 this.secondName = name; 70 this.secondName = name;
49 setAttribute(ATTRIBUTE_SECOND, name); 71 setAttribute(ATTRIBUTE_SECOND, name);
50 } 72 }
51 73
52 74
75 /**
76 * Get first recommendation (typically the minuend).
77 * @return first recommendation (typically the minuend).
78 */
53 public Recommendation getFirst() { 79 public Recommendation getFirst() {
54 return first; 80 return first;
55 } 81 }
56 82
57 83
84 /**
85 * Get second recommendation (typically the subtrahend).
86 * @return second recommendation (typically the subtrahend).
87 */
58 public Recommendation getSecond() { 88 public Recommendation getSecond() {
59 return second; 89 return second;
60 } 90 }
61 91
62 92
93 /**
94 * Get name of first recommendation (typically the minuend).
95 * @return name of first recommendation (typically the minuend).
96 */
63 public String getFirstName() { 97 public String getFirstName() {
64 return firstName; 98 return firstName;
65 } 99 }
66 100
67 101
102 /**
103 * Get name of second recommendation (typically the subtrahend).
104 * @return name of second recommendation (typically the subtrahend).
105 */
68 public String getSecondName() { 106 public String getSecondName() {
69 return secondName; 107 return secondName;
70 } 108 }
71
72 /*
73 * public static Recommmendation recommendationfromString(String from,
74 String factory, String masterArtifactId)
75 {
76 String parts = StringUtil.unbracket(from).split(";");
77 // TODO proper filter instead of null.
78 Recommendation r = new Recommendation(factory, parts[0],
79 masterArtifactId, null);
80 return r;
81 }
82
83 public static RecommendationPairRecord[] fromString(String from,
84 String masterArtifactId)
85 {
86 if (from == null) {
87 return new RecommendationPairRecord[] {};
88 }
89
90 //List<RecommendationPairRecord>
91 String recs = from.split("#");
92 for (int i = 0; i < recs.length; i+=2) {
93 Recommendation minuend = recommendationfromString(recs[i+0], "waterlevel", masterArtifactId);
94 Recommendation subtrahend = recommendationfromString(recs[i+0], "waterlevel", masterArtifactId);
95 }
96 return new RecommendationPairRecord[] {};
97 }*/
98 } 109 }

http://dive4elements.wald.intevation.org