1 /*--------------------------------------------------------------------------
2 * Copyright 2007 utgenome.org
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *--------------------------------------------------------------------------*/
16 //--------------------------------------
17 // UTGB Common Project
18 //
19 // ValueDomain.java
20 // Since: 2007/04/03
21 //
22 // $Date$
23 // $URL$
24 // $Author$
25 //--------------------------------------
26 package org.utgenome.gwt.utgb.client.db;
27
28 import java.util.ArrayList;
29 import java.util.List;
30
31 import com.google.gwt.user.client.rpc.IsSerializable;
32
33 /**
34 * A ValueDomain shows a set of possible values that can be used within a DataType in a Relation.
35 *
36 * @author leo
37 *
38 */
39 public class ValueDomain implements IsSerializable {
40 /**
41 * The following line specifies the element type of the List, that is, org.utgenome.gwt.web.client.db.Value. This
42 * information is requried in the GWT compiler.
43 *
44 */
45 List<Value> valueList = new ArrayList<Value>();
46
47 public ValueDomain() {
48 }
49
50 public ValueDomain(List<Value> valueList) {
51 this.valueList = valueList;
52 }
53
54 public List<Value> getValueList() {
55 return valueList;
56 }
57
58 public void setValueList(List<Value> valueList) {
59 this.valueList = valueList;
60 }
61
62 public void addValueList(Value value) {
63 valueList.add(value);
64 }
65
66 public static ValueDomain createNewValueDomain(String[] value) {
67 ValueDomain vd = new ValueDomain();
68 if (value == null)
69 return vd;
70 for (String each : value) {
71 vd.addValueList(new Value(each));
72 }
73 return vd;
74 }
75
76 }