@Override public int hashCode () { T value = get(); return (value == null) ? 0 : value.hashCode(); }
@Override public int hashCode () { T value = get(); return (value == null) ? 0 : value.hashCode(); }
@Override public String toString () { String cname = getClass().getName(); return cname.substring(cname.lastIndexOf(".")+1) + "(" + get() + ")"; }
@Override public String toString () { String cname = getClass().getName(); return cname.substring(cname.lastIndexOf(".")+1) + "(" + get() + ")"; }
@Override public M get () { return func.apply(outer.get()); } @Override public String toString () {
@Override public M get () { return func.apply(outer.get()); } @Override public String toString () {
@Override public RFuture<T> when (Function<? super T, Boolean> cond) { T current = get(); if (cond.apply(current)) return RFuture.success(current); else return changes().filter(cond).next(); }
@Override public Connection connectNotify (Listener<? super T> listener) { // connect before calling emit; if the listener changes the value in the body of onEmit, it // will expect to be notified of that change; however if onEmit throws a runtime exception, // we need to take care of disconnecting the listener because the returned connection // instance will never reach the caller Connection conn = connect(listener); try { listener.onChange(get(), null); return conn; } catch (RuntimeException re) { conn.close(); throw re; } catch (Error e) { conn.close(); throw e; } }
@Override public RFuture<T> when (Function<? super T, Boolean> cond) { T current = get(); if (cond.apply(current)) return RFuture.success(current); else return changes().filter(cond).next(); }
@Override public Connection connectNotify (Listener<? super T> listener) { // connect before calling emit; if the listener changes the value in the body of onEmit, it // will expect to be notified of that change; however if onEmit throws a runtime exception, // we need to take care of disconnecting the listener because the returned connection // instance will never reach the caller Connection conn = connect(listener); try { listener.onChange(get(), null); return conn; } catch (RuntimeException re) { conn.close(); throw re; } catch (Error e) { conn.close(); throw e; } }