Revision: 1.1.1.1 - (view) (download) (as text)
1 : | ktanaka | 1.1 | public final class Element { |
2 : | static String[] elementNames={ | ||
3 : | "ten","tate","yoko","migiue","hidari","tatehidari","migi","kozato", | ||
4 : | "tatehane","tsukurihane","sanzui","kokoro","tasuki","magaritate", | ||
5 : | "kagi","shin-nyuu","hira-long","hira-circle","outline" | ||
6 : | }; | ||
7 : | static final int ten=0; | ||
8 : | static final int tate=1; | ||
9 : | static final int yoko=2; | ||
10 : | static final int migiue=3; | ||
11 : | static final int hidari=4; | ||
12 : | static final int tatehidari=5; | ||
13 : | static final int migi=6; | ||
14 : | static final int kozato=7; | ||
15 : | static final int tatehane=8; | ||
16 : | static final int tsukurihane=9; | ||
17 : | static final int sanzui=10; | ||
18 : | static final int kokoro=11; | ||
19 : | static final int tasuki=12; | ||
20 : | static final int magaritate=13; | ||
21 : | static final int kagi=14; | ||
22 : | static final int shin_nyuu=15; | ||
23 : | static final int hira_long=16; | ||
24 : | static final int hira_circle=17; | ||
25 : | static final int outline=18; | ||
26 : | int type; | ||
27 : | int[] points; | ||
28 : | int[] links; | ||
29 : | ElementAnnotation[] annotations; | ||
30 : | Element(int type,int[] points,int[] links,ElementAnnotation[] annotations){ | ||
31 : | this.type=type; | ||
32 : | this.points=points; | ||
33 : | this.links=links; | ||
34 : | this.annotations=annotations; | ||
35 : | } | ||
36 : | static int stringToType(String name){ | ||
37 : | int i,len=elementNames.length; | ||
38 : | for(i=0;i<len;i++) | ||
39 : | if(name.equals(elementNames[i])) | ||
40 : | break; | ||
41 : | if(i==len){ | ||
42 : | System.err.println("Illegal element tag("+name+")"); | ||
43 : | return -1; | ||
44 : | } | ||
45 : | return i; | ||
46 : | } | ||
47 : | int[] getPoints(){ return points; } | ||
48 : | public String toString(){ | ||
49 : | String ret=elementNames[type]+"(points("; | ||
50 : | int i,len=points.length; | ||
51 : | for(i=0;i<len;i++) | ||
52 : | ret+=points[i]+","; | ||
53 : | ret+=")"; | ||
54 : | if(links!=null){ | ||
55 : | len=links.length; | ||
56 : | ret+=",links("; | ||
57 : | for(i=0;i<len;i++) | ||
58 : | ret+=links[i]+","; | ||
59 : | ret+=")"; | ||
60 : | } | ||
61 : | return ret+")"; | ||
62 : | } | ||
63 : | } |
ktanaka Powered by ViewCVS 1.0-dev |
ViewCVS and CVS Help |