internal static void EncodeSequence(int size, byte[] seqs, char cid, ArrayList planes) {
--size;
int nextPlane = 0;
char[] plane;
for (int idx = 0; idx < size; ++idx) {
plane = (char[])planes[nextPlane];
int one = (int)seqs[idx] & 0xff;
char c = plane[one];
if (c != 0 && (c & 0x8000) == 0)
throw new Exception("Inconsistent mapping.");
if (c == 0) {
planes.Add(new char[256]);
c = (char)((planes.Count - 1) | 0x8000);
plane[one] = c;
}
nextPlane = c & 0x7fff;
}
plane = (char[])planes[nextPlane];
int ones = (int)seqs[size] & 0xff;
char cc = plane[ones];
if ((cc & 0x8000) != 0)
throw new Exception("Inconsistent mapping.");
plane[ones] = cid;
}