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