-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathZone.java
More file actions
136 lines (122 loc) · 2.85 KB
/
Copy pathZone.java
File metadata and controls
136 lines (122 loc) · 2.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package InsightLT;
import com.sun.squawk.util.Arrays;
import java.util.Vector;
/**
*
* @author Wave
*/
public class Zone {
Zone(int line, int position, int length, int numOfLines, int scrollTime)
{
m_scrollTimer = System.currentTimeMillis();
m_displayTime = scrollTime;
m_zoneLine = line;
m_zonePosition = position;
m_zoneLength = length;
m_twoLines = false;
m_infoItems = new Vector();
if(numOfLines > 1)
{
m_twoLines = true;
}
}
void setTime(int time)
{
m_displayTime = time;
}
void registerData(DisplayData data)
{
m_infoItems.addElement(data);
}
void advanceZoneUp()
{
m_scrollPosition++;
if(m_scrollPosition == (int)m_infoItems.size())
{
m_scrollPosition = 0;
}
}
void advanceZoneDown()
{
if(m_scrollPosition == 0)
{
m_scrollPosition = m_infoItems.size() - 1;
if(m_scrollPosition < 0)
{
m_scrollPosition = 0;
}
}
else
{
m_scrollPosition--;
}
}
int getLine()
{
return m_zoneLine;
}
int getPosition()
{
return m_zonePosition;
}
String getLineOne()
{
byte[] tmp = new byte[m_zoneLength];
Arrays.fill(tmp, (byte)'-');
String tmpString = new String(tmp);
if(!m_infoItems.isEmpty())
{
if(m_scrollPosition >= (int)m_infoItems.size())
{
m_scrollPosition = 0;
}
tmpString = ((DisplayData)m_infoItems.elementAt(m_scrollPosition)).getFormattedString(m_zoneLength);
}
return tmpString;
}
String getLineTwo()
{
byte[] tmp = new byte[m_zoneLength];
Arrays.fill(tmp, (byte)'-');
String tmpString = new String(tmp);
if(m_infoItems.size() > 1)
{
if(m_scrollPosition + 1 >= (int)m_infoItems.size())
{
tmpString = ((DisplayData)m_infoItems.elementAt(0)).getFormattedString(m_zoneLength);
}
else
{
tmpString = ((DisplayData)m_infoItems.elementAt(m_scrollPosition + 1)).getFormattedString(m_zoneLength);
}
}
return tmpString;
}
boolean isTwoLines()
{
return m_twoLines;
}
void update()
{
if(System.currentTimeMillis() > m_scrollTimer)
{
m_scrollTimer += m_displayTime;
advanceZoneDown();
}
}
private int m_zoneLine;
private int m_zonePosition;
private int m_zoneLength;
private boolean m_twoLines;
private boolean m_rotate;
private int m_scrollPosition;
private long m_scrollTimer;
// lenght of time each information item is displayed
private int m_displayTime;
// container for information items
private Vector m_infoItems;
}