// Normalize the Values in the following format:
// initialLength, initial, numberofany, anyLength1, any1,
// anyLength2, any2, ..., anyLengthn, anyn, finalLength,
// final
CollationKey key = null;
List<Integer> normalizedList = new ArrayList<Integer>();
if (subInitial == null)
{
normalizedList.add(0);
}
else
{
key = collator.getCollationKey(subInitial);
byte[] initialBytes = key.toByteArray();
// Last 4 bytes are 0s with PRIMARY strength.
int length = initialBytes.length - 4;
normalizedList.add(length);
for (int i = 0; i < length; i++)
{
normalizedList.add((int) initialBytes[i]);
}
}
List<String> subAny = assertion.getAny();
if (subAny.size() == 0)
{
normalizedList.add(0);
}
else
{
normalizedList.add(subAny.size());
for (String any : subAny)
{
key = collator.getCollationKey(any);
byte[] anyBytes = key.toByteArray();
int length = anyBytes.length - 4;
normalizedList.add(length);
for (int i = 0; i < length; i++)
{
normalizedList.add((int) anyBytes[i]);
}
}
}
String subFinal = assertion.getFinal();
if (subFinal == null)
{
normalizedList.add(0);
}
else
{
key = collator.getCollationKey(subFinal);
byte[] subFinalBytes = key.toByteArray();
int length = subFinalBytes.length - 4;
normalizedList.add(length);
for (int i = 0; i < length; i++)
{
normalizedList.add((int) subFinalBytes[i]);