BrightSide Workbench Full Report + Source Code
Data.java
Go to the documentation of this file.
1 /*
2  * TurrĂ³ i Cutiller Foundation. License notice.
3  * Copyright (C) 2015 Lluis TurrĂ³ Cutiller <http://www.turro.org/>
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU Affero General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Affero General Public License for more details.
14  *
15  * You should have received a copy of the GNU Affero General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.turro.charts;
20 
21 import java.util.ArrayList;
22 import java.util.List;
23 
28 public class Data {
29 
30  protected List<Object> values = new ArrayList<>();
31  protected String key, link;
32 
33  public String getKey() {
34  return key;
35  }
36 
37  public String getLink() {
38  return link;
39  }
40 
41  public void setLink(String link) {
42  this.link = link;
43  }
44 
45  public Object getValue() {
46  return getValue(null);
47  }
48 
49  public Object getValue(Object defaultValue) {
50  return values.isEmpty() ? defaultValue : values.get(0);
51  }
52 
53  public void setValue(Object value) {
54  if(!values.isEmpty()) {
55  values.set(0, value);
56  } else {
57  addValue(value);
58  }
59  }
60 
61  public void addValue(Object value) {
62  values.add(value);
63  }
64 
65  public Data(String key) {
66  this.key = key;
67  }
68 
69 }
void addValue(Object value)
Definition: Data.java:61
String getLink()
Definition: Data.java:37
Object getValue(Object defaultValue)
Definition: Data.java:49
List< Object > values
Definition: Data.java:30
void setValue(Object value)
Definition: Data.java:53
void setLink(String link)
Definition: Data.java:41
String getKey()
Definition: Data.java:33
Object getValue()
Definition: Data.java:45
Data(String key)
Definition: Data.java:65