View Javadoc

1   /*--------------------------------------------------------------------------
2    *  Copyright 2009 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-core Project
18  //
19  // Locus.java
20  // Since: 2009/02/17
21  //
22  // $URL$ 
23  // $Author$
24  //--------------------------------------
25  package org.utgenome.gwt.utgb.client.bio;
26  
27  import java.io.Serializable;
28  import java.util.ArrayList;
29  import java.util.HashMap;
30  
31  /**
32   * wig format data
33   * 
34   * @author yoshimura
35   * 
36   */
37  public class WigGraphData implements Serializable {
38  	/**
39  	 * 
40  	 */
41  	private static final long serialVersionUID = 1L;
42  	/**
43  	 * 
44  	 */
45  	int trackId = -1;
46  	float maxValue = Float.MIN_VALUE;
47  	float minValue = Float.MAX_VALUE;
48  
49  	ArrayList<String> browser = null;
50  	HashMap<String, String> track = null;
51  	HashMap<Integer, Float> data = null;
52  
53  	public int getTrack_id() {
54  		return trackId;
55  	}
56  
57  	public void setTrack_id(int track_id) {
58  		this.trackId = track_id;
59  	}
60  
61  	public float getMinValue() {
62  		return minValue;
63  	}
64  
65  	public void setMinValue(float minValue) {
66  		this.minValue = minValue;
67  	}
68  
69  	public float getMaxValue() {
70  		return maxValue;
71  	}
72  
73  	public void setMaxValue(float maxValue) {
74  		this.maxValue = maxValue;
75  	}
76  
77  	public ArrayList<String> getBrowser() {
78  		return browser;
79  	}
80  
81  	public void setBrowser(ArrayList<String> browser) {
82  		this.browser = browser;
83  	}
84  
85  	public HashMap<String, String> getTrack() {
86  		return track;
87  	}
88  
89  	public void setTrack(HashMap<String, String> track) {
90  		this.track = track;
91  	}
92  
93  	public HashMap<Integer, Float> getData() {
94  		return data;
95  	}
96  
97  	public void setData(HashMap<Integer, Float> data) {
98  		this.data = data;
99  	}
100 
101 	public String toString() {
102 		StringBuilder sb = new StringBuilder();
103 
104 		if (track.isEmpty())
105 			return null;
106 
107 		sb.append("TrackID:" + trackId + "(");
108 		if (!browser.isEmpty()) {
109 			for (String s : browser) {
110 				sb.append(s + ", ");
111 			}
112 			sb.delete(sb.lastIndexOf(","), sb.length()).append("), (");
113 		}
114 
115 		if (!track.isEmpty()) {
116 			for (String s : track.keySet()) {
117 				sb.append(s + "=" + track.get(s) + ", ");
118 			}
119 			sb.delete(sb.lastIndexOf(","), sb.length()).append("), (");
120 		}
121 		if (!data.isEmpty()) {
122 			for (int l : data.keySet()) {
123 				sb.append(l + ":" + data.get(l) + ", ");
124 			}
125 		}
126 		if (!sb.equals(""))
127 			sb.delete(sb.lastIndexOf(","), sb.length()).append(")");
128 
129 		return sb.toString();
130 	}
131 }