File: Record.java

package info (click to toggle)
pilot-link 0.8.7-2
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 2,256 kB
  • ctags: 3,233
  • sloc: ansic: 24,039; java: 2,162; cpp: 1,641; sh: 1,585; makefile: 1,363; perl: 723; yacc: 660; python: 239; tcl: 14
file content (80 lines) | stat: -rw-r--r-- 2,313 bytes parent folder | download | duplicates (2)
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

package Pdapilot.appointment;

import java.io.*;

/** A representation of a datebook database record.
 */

public class Record extends Pdapilot.Record {

	public java.util.Date[] exceptions;
	public String description;
	public String note;
	public boolean alarm;
	public int advance;
	public time advanceUnits;
	public repeat repeatType;
	public java.util.Date repeatEnd;
	public int repeatFrequency;
	public boolean[] repeatWeekdays;
	public int repeatDay;
	public int repeatWeekStart;
	public java.util.Date begin, end;

		public Record() {
			super();
		}
		
		public Record(byte[] contents, Pdapilot.RecordID id, int index, int attr, int cat) {
			super(contents, id, index, attr, cat);
		}
		
		public native void unpack(byte[] data);
		public native byte[] pack();
        		
		public void fill() {
			exceptions = null;
			description = "";
			note = null;
			alarm = false;
			advance = 0;
			advanceUnits = time.Minutes;
			repeatType = repeat.None;
			repeatEnd = null;
			repeatFrequency = 1;
			repeatDay = 0;
			repeatWeekdays = new boolean[7];
			for (int i=0;i<7;i++)
				repeatWeekdays[i] = false;
			begin = new java.util.Date();
			end = new java.util.Date();
		}
		
        public String describe() {
        	StringBuffer c = new StringBuffer("start=");
        	c.append(begin.toString());
        	c.append(", end="+Pdapilot.Util.prettyPrint(end));
        	c.append(", note="+((note == null) ? "(null)" : note));
        	c.append(", description="+((description == null) ? "(null)" : description));
        	c.append(", exceptions=[");
        	if (exceptions != null) {
	        	for(int i=0;i<exceptions.length;i++) {
	        		if (i>0)
	        			c.append(",");
	        		c.append(exceptions[i].toString());
	        	}
	        }
        	c.append("], advance="+advance+", advanceUnits="+advanceUnits);
        	c.append(", repeatType="+repeatType+", repeatEnd="+((repeatEnd==null)?"(null)":repeatEnd.toString()));
        	c.append(", repeatFrequency="+repeatFrequency+", repeatWeekStart="+repeatWeekStart);
        	c.append(", repeatDay="+repeatDay+", repeatWeekdays=[");
        	for(int i=0;i<repeatWeekdays.length;i++) {
        		if (i>0)
        			c.append(",");
        		c.append(repeatWeekdays[i]);
        	}
        	c.append("]");
        	return "" + c;
        }
}