public T value() { Bomb.unless(isAlive(), () => "tried to access GC'd value of a weakReference"); return((T)reference.Target); }
public static T penultimate <T>(IList <T> ts) { Bomb.unless(ts.Count >= 2, () => "no penultimate in " + toShortString(ts)); return(ts[ts.Count - 2]); }
public static T the <T>(IList <T> ts) { Bomb.unless(ts.Count == 1, () => "ts does not have exactly 1 element. has: " + ts.Count + " elements.\n" + toShortString(ts)); return(ts[0]); }
static void requireNonEmpty <T>(IList <T> ts) { Bomb.when(Bomb.ifNull(ts, () => "null ts!").Count < 1, () => "empty list passed to requireNonEmpty"); }
long bytesUsed() { Bomb.when(started, () => "eek! in the middle of an operation"); return(totalMemoryUsed); }
public static long bytesUsed(string s) { Bomb.unless(memory, () => "can't ask for bytes used, not recording memory data."); return(get(s).bytesUsed()); }