Search in sources :

Example 1 with WordComparator

use of org.vmmagic.unboxed.harness.WordComparator in project JikesRVM by JikesRVM.

the class HarnessOptionSet method parseWordSet.

private Word[] parseWordSet(String str) {
    TreeSet<Word> values = new TreeSet<Word>(new WordComparator());
    for (String element : str.split(",")) {
        Long value;
        if (element.startsWith("0x")) {
            value = Long.valueOf(element.substring(2), 16);
        } else {
            value = Long.valueOf(element);
        }
        values.add(Word.fromLong(value));
    }
    Word[] result = new Word[values.size()];
    for (int i = 0; i < result.length; i++) {
        result[i] = values.pollFirst();
    }
    return result;
}
Also used : Word(org.vmmagic.unboxed.Word) TreeSet(java.util.TreeSet) WordComparator(org.vmmagic.unboxed.harness.WordComparator)

Aggregations

TreeSet (java.util.TreeSet)1 Word (org.vmmagic.unboxed.Word)1 WordComparator (org.vmmagic.unboxed.harness.WordComparator)1