source: other-projects/tipple-android/trunk/src/org/greenstone/android/tipple/TipLocation.java@ 23977

Last change on this file since 23977 was 23977, checked in by davidb, 13 years ago

Initial set of files for the Tipple project, to be run on an Android device

File size: 1.9 KB
Line 
1package org.greenstone.android.tipple;
2
3import java.util.List;
4import java.util.HashMap;
5//import java.util.ArrayList;
6
7public class TipLocation
8{
9
10 // Text and/or Audio associated with (Latitude,Longitude) location with radius
11
12 private double latitude_;
13 private double longitude_;
14
15 private double radiusInKM_;
16 //private double avgRadLatLong_;
17
18 private String title_;
19 private String text_;
20 private String tts_text_;
21
22
23 private String audioFilename_;
24 private List<String> audioPaths_;
25
26 protected String id_;
27
28 public TipLocation(HashMap<String,String> hashmap)
29 {
30 latitude_ = Double.parseDouble(hashmap.get("latitude"));
31 longitude_ = Double.parseDouble(hashmap.get("longitude"));
32 radiusInKM_ = Double.parseDouble(hashmap.get("radius"));
33
34 title_ = hashmap.get("title");
35 text_ = hashmap.get("text");
36 tts_text_ = (hashmap.containsKey("tts")) ? hashmap.get("tts") : null;
37
38 audioFilename_ = hashmap.get("audio");
39
40 // Consolidate whitespace
41 title_ = title_.replaceAll("^\\s+", "");
42 title_ = title_.replaceAll("\\s+$", "");
43 title_ = title_.replaceAll("\\s+", " ");
44
45 if (text_ != null) {
46 text_ = text_.replaceAll("^\\s+", "");
47 text_ = text_.replaceAll("\\s+$", "");
48 text_ = text_.replaceAll("\\s+", " ");
49 }
50
51 id_ = title_.replaceAll("/\\s+/", "-");
52 }
53
54
55 public double getLatitude()
56 {
57 return latitude_;
58 }
59
60 public double getLongitude()
61 {
62 return longitude_;
63 }
64
65 public double getRadiusKM()
66 {
67 return radiusInKM_;
68 }
69
70 public String getText()
71 {
72 return text_;
73 }
74
75 public String getTTSText()
76 {
77 return (tts_text_ != null) ? tts_text_ : text_;
78 }
79 public String getTitle()
80 {
81 return title_;
82 }
83
84 public String getID()
85 {
86 return id_;
87 }
88
89 public List<String> getAudio()
90 {
91 return audioPaths_;
92 }
93
94 public String getAudioFilename()
95 {
96 return audioFilename_;
97 }
98
99}
Note: See TracBrowser for help on using the repository browser.