Commit 2ef89303 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter
Browse files

mark types as nullable where appropriate

2008-04-14  Juerg Billeter  <j@bitron.ch>

	* gee/arraylist.vala, gee/hashmap.vala, gee/hashset.vala,
	  gee/iterator.vala, gee/list.vala, gee/map.vala,
	  gee/readonlycollection.vala, gee/readonlylist.vala,
	  gee/readonlymap.vala, gee/readonlyset.vala: mark types as
	  nullable where appropriate

svn path=/trunk/; revision=29
parent 82072b0f
2008-04-14 Jürg Billeter <j@bitron.ch>
* gee/arraylist.vala, gee/hashmap.vala, gee/hashset.vala,
gee/iterator.vala, gee/list.vala, gee/map.vala,
gee/readonlycollection.vala, gee/readonlylist.vala,
gee/readonlymap.vala, gee/readonlyset.vala: mark types as
nullable where appropriate
2008-04-13 Jürg Billeter <j@bitron.ch>
* gee/arraylist.vala, gee/hashmap.vala, gee/hashset.vala,
......
......@@ -68,7 +68,7 @@ public class Gee.ArrayList<G> : Object, Iterable<G>, Collection<G>, List<G> {
return -1;
}
public G get (int index) {
public G? get (int index) {
assert (index >= 0 && index < _size);
return _items[index];
......@@ -178,7 +178,7 @@ public class Gee.ArrayList<G> : Object, Iterable<G>, Collection<G>, List<G> {
return (_index < _list._size);
}
public G get () {
public G? get () {
assert (_stamp == _list._stamp);
if (_index < 0 || _index >= _list._size) {
......
......@@ -91,7 +91,7 @@ public class Gee.HashMap<K,V> : Object, Map<K,V> {
return (*node != null);
}
public V get (K key) {
public V? get (K key) {
Node<K,V>* node = (*lookup_node (key));
if (node != null) {
return node->value;
......@@ -251,7 +251,7 @@ public class Gee.HashMap<K,V> : Object, Map<K,V> {
return (_node != null);
}
public K get () {
public K? get () {
assert (_stamp == _map._stamp);
assert (_node != null);
return _node.key;
......@@ -334,7 +334,7 @@ public class Gee.HashMap<K,V> : Object, Map<K,V> {
return (_node != null);
}
public V get () {
public V? get () {
assert (_stamp == _map._stamp);
assert (_node != null);
return _node.value;
......
......@@ -193,7 +193,7 @@ public class Gee.HashSet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
return (_node != null);
}
public G get () {
public G? get () {
assert (_stamp == _set._stamp);
assert (_node != null);
return _node.key;
......
/* iterator.vala
*
* Copyright (C) 2007 Jürg Billeter
* Copyright (C) 2007-2008 Jürg Billeter
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -37,6 +37,6 @@ public interface Gee.Iterator<G> : GLib.Object {
*
* @return the current element in the iteration
*/
public abstract G get ();
public abstract G? get ();
}
......@@ -31,7 +31,7 @@ public interface Gee.List<G> : Collection<G> {
*
* @return the item at the specified index in the list
*/
public abstract G get (int index);
public abstract G? get (int index);
/**
* Sets the item at the specified index in this list.
......
......@@ -60,7 +60,7 @@ public interface Gee.Map<K,V> : GLib.Object {
* @return the value associated with the key, or null if the key
* couldn't be found
*/
public abstract V get (K key);
public abstract V? get (K key);
/**
* Inserts a new key and value into this map.
......
......@@ -36,7 +36,7 @@ public class Gee.ReadOnlyCollection<G> : Object, Iterable<G>, Collection<G> {
private Collection<G> _collection;
public ReadOnlyCollection (Collection<G> collection = null) {
public ReadOnlyCollection (Collection<G>? collection = null) {
this.collection = collection;
}
......@@ -77,7 +77,7 @@ public class Gee.ReadOnlyCollection<G> : Object, Iterable<G>, Collection<G> {
return false;
}
public G get () {
public G? get () {
return null;
}
}
......
......@@ -36,7 +36,7 @@ public class Gee.ReadOnlyList<G> : Object, Iterable<G>, Collection<G>, List<G> {
private List<G> _list;
public ReadOnlyList (List<G> list = null) {
public ReadOnlyList (List<G>? list = null) {
this.list = list;
}
......@@ -84,7 +84,7 @@ public class Gee.ReadOnlyList<G> : Object, Iterable<G>, Collection<G>, List<G> {
assert_not_reached ();
}
public G get (int index) {
public G? get (int index) {
if (_list == null) {
return null;
}
......@@ -105,7 +105,7 @@ public class Gee.ReadOnlyList<G> : Object, Iterable<G>, Collection<G>, List<G> {
return false;
}
public G get () {
public G? get () {
return null;
}
}
......
......@@ -36,7 +36,7 @@ public class Gee.ReadOnlyMap<K,V> : Object, Map<K,V> {
private Map<K,V> _map;
public ReadOnlyMap (Map<K,V> map = null) {
public ReadOnlyMap (Map<K,V>? map = null) {
this.map = map;
}
......@@ -64,7 +64,7 @@ public class Gee.ReadOnlyMap<K,V> : Object, Map<K,V> {
return _map.contains (key);
}
public V get (K key) {
public V? get (K key) {
if (_map == null) {
return null;
}
......
......@@ -36,7 +36,7 @@ public class Gee.ReadOnlySet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
private Set<G> _set;
public ReadOnlySet (Set<G> set = null) {
public ReadOnlySet (Set<G>? set = null) {
this.set = set;
}
......@@ -77,7 +77,7 @@ public class Gee.ReadOnlySet<G> : Object, Iterable<G>, Collection<G>, Set<G> {
return false;
}
public G get () {
public G? get () {
return null;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment