]> gitweb.fperrin.net Git - Dictionary.git/blob - jars/icu4j-4_4_2-src/tools/misc/src/com/ibm/icu/dev/tool/layout/Feature.java
go
[Dictionary.git] / jars / icu4j-4_4_2-src / tools / misc / src / com / ibm / icu / dev / tool / layout / Feature.java
1 /*\r
2  *******************************************************************************\r
3  * Copyright (C) 2002-2004, International Business Machines Corporation and    *\r
4  * others. All Rights Reserved.                                                *\r
5  *******************************************************************************\r
6  */\r
7 \r
8 package com.ibm.icu.dev.tool.layout;\r
9 \r
10 \r
11 class Feature extends TaggedRecord\r
12 {\r
13     private int[] lookupIndices;\r
14     private int lookupCount;\r
15     private int featureIndex;\r
16     \r
17     public Feature(String theFeatureTag)\r
18     {\r
19         super(theFeatureTag);\r
20         \r
21         lookupIndices = new int[10];\r
22         lookupCount = 0;\r
23         featureIndex = -1;\r
24     }\r
25     \r
26     public void addLookup(int theLookupIndex)\r
27     {\r
28         if (lookupCount >= lookupIndices.length) {\r
29             int[] newLookupIndices = new int[lookupIndices.length + 5];\r
30             \r
31             System.arraycopy(lookupIndices, 0, newLookupIndices, 0, lookupIndices.length);\r
32             lookupIndices = newLookupIndices;\r
33         }\r
34         \r
35         lookupIndices[lookupCount] = theLookupIndex;\r
36         lookupCount += 1;\r
37     }\r
38     \r
39     public void writeFeature(OpenTypeTableWriter writer)\r
40     {\r
41         writer.writeData(0);      // featureParams (must be NULL)\r
42         \r
43         writer.writeData(lookupCount);\r
44         \r
45         for (int i = 0; i < lookupCount; i += 1) {\r
46             writer.writeData(lookupIndices[i]);\r
47         }\r
48     }\r
49     \r
50     public int getFeatureIndex()\r
51     {\r
52         return featureIndex;\r
53     }\r
54     \r
55     public void setFeatureIndex(int index)\r
56     {\r
57         featureIndex = index;\r
58     }\r
59 }