File: CategoryAppBlock.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 (54 lines) | stat: -rw-r--r-- 1,208 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

package Pdapilot;

import java.io.*;

public class CategoryAppBlock extends AppBlock {
	public boolean[] categoryRenamed;
	public int categoryLastUniqueID;
	public String[] categoryName;
	public int[] categoryID;
		
	public CategoryAppBlock() {
		super();
	}

	public native void unpack(byte[] data);
	public native byte[] pack();
	
	public void fill() {
		categoryRenamed = new boolean[16];
		categoryLastUniqueID = 0;
		categoryName = new String[16];
		categoryID = new int[16];
	}
		
	public CategoryAppBlock(byte[] contents) {
		super(contents);
	}
		
	public String describe() {
		StringBuffer c;
		if ((categoryName == null) || (categoryID == null) || (categoryRenamed == null)) {
			c = new StringBuffer("no categories");
		} else {
			c = new StringBuffer("name             id\trenamed\n");
			for (int i=0;i<categoryName.length;i++) {
				if (categoryName[i].length() > 0) {
					c.append(categoryName[i]);
					for(int j=16;j>categoryName[i].length();j--)
						c.append(" ");
					c.append(" ");
					c.append(categoryID[i]);
					c.append("\t");
					c.append(categoryRenamed[i]);
					c.append("\n");
				}
			}
		}
		return "categoryLastUniqueID="+categoryLastUniqueID+
				"\n" + c;
	}
}