Search in sources :

Example 1 with ArraySequence

use of kodkod.util.ints.ArraySequence in project org.alloytools.alloy by AlloyTools.

the class SparseSequenceTest method testClone.

// public void testFirstLast() {
// for(int i = 0; i < 10; i++)
// s0.put(i, 0);
// IndexedEntry<Integer> e0 = s0.first();
// while (e0 != null) {
// System.out.println(e0);
// e0 = s0.successor(e0.index());
// }
// }
public void testClone() {
    final IntSet s = Ints.bestSet(3);
    s.add(1);
    s.add(2);
    s0 = new ArraySequence<Integer>(s);
    s0.put(1, 0);
    s0.put(2, 0);
    try {
        SparseSequence<Integer> s1 = s0.clone();
        assertTrue(s1.equals(s0));
        assertNotSame(s1, s0);
        SparseSequence<Integer> s2 = new ArraySequence<Integer>(s);
        s2.putAll(s0);
        s1.remove(1);
        assertTrue(s2.equals(s0));
        assertFalse(s1.equals(s0));
    } catch (CloneNotSupportedException e) {
        assert false;
    }
}
Also used : ArraySequence(kodkod.util.ints.ArraySequence) IntSet(kodkod.util.ints.IntSet)

Aggregations

ArraySequence (kodkod.util.ints.ArraySequence)1 IntSet (kodkod.util.ints.IntSet)1