if (t == typeof (string)) {
return (CompareFunc) strcmp;
} else if (t.is_a (typeof (Comparable))) {
- return (CompareFunc) comparable_compare;
+ return (CompareFunc) Comparable.compare_to;
} else {
return (CompareFunc) direct_compare;
}
}
}
- internal static int comparable_compare (void* a, void* b) {
- return ((Comparable) a).compare_to ((Comparable) b);
- }
-
/**
* Compares two arbitrary elements together.
*
fix_up (ref node);
}
- private bool remove_from_node (ref Node<G>? node, G item, out weak Node<G>? prev = null, out weak Node<G>? next = null) {
+ private bool remove_from_node (ref Node<G>? node, G item, out unowned Node<G>? prev = null, out unowned Node<G>? next = null) {
#if DEBUG
stdout.printf ("Removing %s from %s\n", (string)item, node != null ? (string)node.key : null);
#endif
return new SubSet<G> (this, after, before);
}
- private inline weak Node<G>? find_node (G item) {
+ private inline unowned Node<G>? find_node (G item) {
weak Node<G>? cur = root;
while (cur != null) {
int res = compare_func (item, cur.key);
return node != null ? new Iterator<G>.pointing (this, node) : null;
}
- private inline weak Node<G>? find_nearest (G item) {
+ private inline unowned Node<G>? find_nearest (G item) {
weak Node<G>? cur = root;
while (cur != null) {
int res = compare_func (item, cur.key);
return null;
}
- private inline weak Node<G>? find_lower (G item) {
+ private inline unowned Node<G>? find_lower (G item) {
weak Node<G>? node = find_nearest (item);
if (node == null)
return null;
return compare_func (item, node.key) <= 0 ? node.prev : node;
}
- private inline weak Node<G>? find_higher (G item) {
+ private inline unowned Node<G>? find_higher (G item) {
weak Node<G>? node = find_nearest (item);
if (node == null)
return null;
return compare_func (item, node.key) >= 0 ? node.next : node;
}
- private inline weak Node<G>? find_floor (G item) {
+ private inline unowned Node<G>? find_floor (G item) {
weak Node<G>? node = find_nearest (item);
if (node == null)
return null;
return compare_func (item, node.key) < 0 ? node.prev : node;
}
- private inline weak Node<G>? find_ceil (G item) {
+ private inline unowned Node<G>? find_ceil (G item) {
weak Node<G>? node = find_nearest (item);
if (node == null)
return null;
}
}
- public weak Node<G>? first () {
+ public unowned Node<G>? first () {
switch (type) {
case RangeType.EMPTY:
return null;
}
}
- public weak Node<G>? last () {
+ public unowned Node<G>? last () {
switch (type) {
case RangeType.EMPTY:
return null;
assert (ro_collection == another_ro_collection);
ro_collection.set_data ("marker", new Object ());
- assert (another_ro_collection.get_data ("marker") != null);
+ assert (another_ro_collection.get_data<Object> ("marker") != null);
another_ro_collection = null;
ro_collection = null;
another_ro_collection = get_ro_view (test_collection);
- assert (another_ro_collection.get_data ("marker") == null);
+ assert (another_ro_collection.get_data<Object> ("marker") == null);
// Check that the read-only view of the view is itself
assert (another_ro_collection == get_ro_view (another_ro_collection));
assert (ro_map == another_ro_map);
ro_map.set_data ("marker", new Object ());
- assert (another_ro_map.get_data ("marker") != null);
+ assert (another_ro_map.get_data<Object> ("marker") != null);
another_ro_map = null;
ro_map = null;
another_ro_map = test_map.read_only_view;
- assert (another_ro_map.get_data ("marker") == null);
+ assert (another_ro_map.get_data<Object> ("marker") == null);
// Check that the read-only view of the view is itself
assert (another_ro_map == another_ro_map.read_only_view);