BrightSide Workbench Full Report + Source Code
org.turro.dossier.entity.WorthDefinition Class Reference
Inheritance diagram for org.turro.dossier.entity.WorthDefinition:
Collaboration diagram for org.turro.dossier.entity.WorthDefinition:

Public Member Functions

Long getId ()
 
void setId (Long id)
 
String getTitle ()
 
void setTitle (String title)
 
String getPossibleValues ()
 
void setPossibleValues (String possibleValues)
 
String getColors ()
 
void setColors (String colors)
 
String getGrouping ()
 
void setGrouping (String grouping)
 
String getDescription ()
 
void setDescription (String description)
 
Category getCategory ()
 
void setCategory (Category category)
 
Dossier getDossier ()
 
void setDossier (Dossier _dossier)
 
void assignDossier (Dossier dossier)
 
Dossier getAssignedDossier ()
 
double getWorthTotal ()
 
List< WorthValuegetWorthValues ()
 
Double getWorthAvg ()
 
WorthPair getRangeResult ()
 
Object entityId ()
 
boolean isEmpty ()
 
List< WorthPairgetPairValues ()
 
Set< WorthPairgetRangeValues ()
 
- Public Member Functions inherited from org.turro.jpa.entity.IDaoEntity
default boolean isNew ()
 
default void prepareSave ()
 
default void prepareDelete ()
 
default void removeEmpties ()
 
default Collection< Collection > collections ()
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 43 of file WorthDefinition.java.

Member Function Documentation

◆ assignDossier()

void org.turro.dossier.entity.WorthDefinition.assignDossier ( Dossier  dossier)

Definition at line 128 of file WorthDefinition.java.

128  {
129  _dossier = dossier;
130  }

◆ entityId()

Object org.turro.dossier.entity.WorthDefinition.entityId ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 183 of file WorthDefinition.java.

183  {
184  return id;
185  }

◆ getAssignedDossier()

Dossier org.turro.dossier.entity.WorthDefinition.getAssignedDossier ( )

Definition at line 132 of file WorthDefinition.java.

132  {
133  return _dossier;
134  }

◆ getCategory()

Category org.turro.dossier.entity.WorthDefinition.getCategory ( )

Definition at line 107 of file WorthDefinition.java.

107  {
108  return category;
109  }

◆ getColors()

String org.turro.dossier.entity.WorthDefinition.getColors ( )

Definition at line 83 of file WorthDefinition.java.

83  {
84  return colors;
85  }

◆ getDescription()

String org.turro.dossier.entity.WorthDefinition.getDescription ( )

Definition at line 99 of file WorthDefinition.java.

99  {
100  return description;
101  }

◆ getDossier()

Dossier org.turro.dossier.entity.WorthDefinition.getDossier ( )

Definition at line 115 of file WorthDefinition.java.

115  {
116  return _dossier;
117  }
Here is the caller graph for this function:

◆ getGrouping()

String org.turro.dossier.entity.WorthDefinition.getGrouping ( )

Definition at line 91 of file WorthDefinition.java.

91  {
92  return grouping;
93  }

◆ getId()

Long org.turro.dossier.entity.WorthDefinition.getId ( )

Definition at line 59 of file WorthDefinition.java.

59  {
60  return id;
61  }
Here is the caller graph for this function:

◆ getPairValues()

List<WorthPair> org.turro.dossier.entity.WorthDefinition.getPairValues ( )

Definition at line 194 of file WorthDefinition.java.

194  {
195  List<WorthPair> list = new ArrayList<>();
196  String[] sa = possibleValues.split(",");
197  String[] co = colors.split(",");
198  if(sa.length == co.length) {
199  for(int i = 0; i < sa.length; i++) {
200  list.add(new WorthPair((Double) ObjectString.parseString(sa[i], Double.class, true), co[i]));
201  }
202  }
203  return list;
204  }
Here is the caller graph for this function:

◆ getPossibleValues()

String org.turro.dossier.entity.WorthDefinition.getPossibleValues ( )

Definition at line 75 of file WorthDefinition.java.

75  {
76  return possibleValues;
77  }

◆ getRangeResult()

WorthPair org.turro.dossier.entity.WorthDefinition.getRangeResult ( )

Definition at line 167 of file WorthDefinition.java.

167  {
168  Double avg = getWorthAvg();
169  Set<WorthPair> set = getRangeValues();
170  if(set.size() > 0) {
171  for(WorthPair wp : set) {
172  if(wp.getValue() >= avg) {
173  return wp;
174  }
175  }
176  }
177  return null;
178  }
Here is the call graph for this function:

◆ getRangeValues()

Set<WorthPair> org.turro.dossier.entity.WorthDefinition.getRangeValues ( )

Definition at line 206 of file WorthDefinition.java.

206  {
207  TreeSet<WorthPair> set = new TreeSet<>();
208  List<WorthPair> pairs = getPairValues();
209  Double diff = null;
210  WorthPair prev = null;
211  for(WorthPair wp : pairs) {
212  if(prev != null) {
213  diff = diff == null ? wp.getValue() - prev.getValue() : Math.min(wp.getValue() - prev.getValue(), diff);
214  }
215  prev = wp;
216  }
217  for(WorthPair wp : pairs) {
218  set.add(new WorthPair(wp.getValue() + (diff / 2.0), wp.getColor()));
219  }
220 
221 // if(pairs.size() > 1) {
222 // WorthPair prev = pairs.get(0);
223 // WorthPair last = pairs.get(pairs.size() - 1);
224 // for(int i = 1; i < pairs.size(); i++) {
225 // WorthPair current = pairs.get(i);
226 // Double diff = current.getValue() - prev.getValue();
227 // set.add(new WorthPair((diff / 3.0) + prev.getValue(), prev.getColor()));
228 // prev = current;
229 // }
230 // set.add(new WorthPair(last.getValue(), last.getColor()));
231 // }
232  return set;
233  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getTitle()

String org.turro.dossier.entity.WorthDefinition.getTitle ( )

Definition at line 67 of file WorthDefinition.java.

67  {
68  return title;
69  }

◆ getWorthAvg()

Double org.turro.dossier.entity.WorthDefinition.getWorthAvg ( )

Definition at line 156 of file WorthDefinition.java.

156  {
157  if(getWorthValues().size() > 0) {
158  Double total = 0.0;
159  for(WorthValue v : getWorthValues()) {
160  total += v.getValue();
161  }
162  return total / getWorthValues().size();
163  }
164  return 0.0;
165  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getWorthTotal()

double org.turro.dossier.entity.WorthDefinition.getWorthTotal ( )

Definition at line 136 of file WorthDefinition.java.

136  {
137  double total = 0.0;
138  for(WorthValue v : getWorthValues()) {
139  total += v.getValue();
140  }
141  return total;
142  }
Here is the call graph for this function:

◆ getWorthValues()

List<WorthValue> org.turro.dossier.entity.WorthDefinition.getWorthValues ( )

Definition at line 144 of file WorthDefinition.java.

144  {
145  if(_values == null) {
146  _values = new ArrayList<>();
147  for(WorthValue v : _dossier.getWorths()) {
148  if(Objects.equals(v.getWorthDefinition().getId(), id)) {
149  _values.add(v);
150  }
151  }
152  }
153  return _values;
154  }
Set< WorthValue > getWorths()
Definition: Dossier.java:243
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isEmpty()

boolean org.turro.dossier.entity.WorthDefinition.isEmpty ( )

Implements org.turro.jpa.entity.IDaoEntity.

Definition at line 188 of file WorthDefinition.java.

188  {
189  return Strings.isBlank(title) || Strings.isBlank(possibleValues);
190  }
Here is the caller graph for this function:

◆ setCategory()

void org.turro.dossier.entity.WorthDefinition.setCategory ( Category  category)

Definition at line 111 of file WorthDefinition.java.

111  {
112  this.category = category;
113  }
Here is the caller graph for this function:

◆ setColors()

void org.turro.dossier.entity.WorthDefinition.setColors ( String  colors)

Definition at line 87 of file WorthDefinition.java.

87  {
88  this.colors = colors;
89  }

◆ setDescription()

void org.turro.dossier.entity.WorthDefinition.setDescription ( String  description)

Definition at line 103 of file WorthDefinition.java.

103  {
104  this.description = description;
105  }

◆ setDossier()

void org.turro.dossier.entity.WorthDefinition.setDossier ( Dossier  _dossier)

Definition at line 119 of file WorthDefinition.java.

119  {
120  this._dossier = _dossier;
121  }

◆ setGrouping()

void org.turro.dossier.entity.WorthDefinition.setGrouping ( String  grouping)

Definition at line 95 of file WorthDefinition.java.

95  {
96  this.grouping = grouping;
97  }

◆ setId()

void org.turro.dossier.entity.WorthDefinition.setId ( Long  id)

Definition at line 63 of file WorthDefinition.java.

63  {
64  this.id = id;
65  }

◆ setPossibleValues()

void org.turro.dossier.entity.WorthDefinition.setPossibleValues ( String  possibleValues)

Definition at line 79 of file WorthDefinition.java.

79  {
80  this.possibleValues = possibleValues;
81  }

◆ setTitle()

void org.turro.dossier.entity.WorthDefinition.setTitle ( String  title)

Definition at line 71 of file WorthDefinition.java.

71  {
72  this.title = title;
73  }

The documentation for this class was generated from the following file: