コード例 #1
0
 /** Track {@code other} as derived on us, so we'll forward changed/changing events to it. */
 public <P1 extends Property<?>> P1 addDerived(final P1 other) {
   if (!downstream.contains(other)) {
     downstream.add(other);
     if (touched) {
       other.setTouched(touched);
     }
   }
   return other;
 }
コード例 #2
0
 public void msg(String m) {
   System.out.println(P1.age() + getName() + " :" + m);
 }
コード例 #3
0
ファイル: Tree.java プロジェクト: jbgi/functionaljava
 /**
  * Provides a stream of the elements of the tree at each level, in level order.
  *
  * @return The elements of the tree at each level.
  */
 public Stream<Stream<A>> levels() {
   final F<Stream<Tree<A>>, Stream<Tree<A>>> flatSubForests =
       Stream.<Tree<A>, Tree<A>>bind_().f(compose(P1.__1(), Tree.subForest_()));
   final F<Stream<Tree<A>>, Stream<A>> roots = Stream.<Tree<A>, A>map_().f(Tree.root_());
   return iterateWhile(flatSubForests, Stream.isNotEmpty_(), single(this)).map(roots);
 }
コード例 #4
0
ファイル: Either.java プロジェクト: prange/julespesial
 /**
  * If the condition satisfies, return the given A in left, otherwise, return the given B in right.
  *
  * @param c The condition to test.
  * @param right The right value to use if the condition satisfies.
  * @param left The left value to use if the condition does not satisfy.
  * @return A constructed either based on the given condition.
  */
 public static <A, B> Either<A, B> iif(final boolean c, final P1<B> right, final P1<A> left) {
   return c ? new Right<A, B>(right._1()) : new Left<A, B>(left._1());
 }
コード例 #5
0
ファイル: Either.java プロジェクト: prange/julespesial
 /**
  * The value of this projection or the given argument.
  *
  * @param b The value to return if this projection has no value.
  * @return The value of this projection or the given argument.
  */
 public B orValue(final P1<B> b) {
   return isRight() ? value() : b._1();
 }
コード例 #6
0
ファイル: Either.java プロジェクト: prange/julespesial
 /**
  * Returns the value of this projection or fails with the given error message.
  *
  * @param err The error message to fail with.
  * @return The value of this projection
  */
 public B valueE(final P1<String> err) {
   if (e.isRight())
     //noinspection CastToConcreteClass
     return ((Right<A, B>) e).b;
   else throw error(err._1());
 }
コード例 #7
0
ファイル: Either.java プロジェクト: prange/julespesial
 /**
  * The value of this projection or the given argument.
  *
  * @param a The value to return if this projection has no value.
  * @return The value of this projection or the given argument.
  */
 public A orValue(final P1<A> a) {
   return isLeft() ? value() : a._1();
 }
コード例 #8
0
ファイル: Either.java プロジェクト: prange/julespesial
 /**
  * Returns the value of this projection or fails with the given error message.
  *
  * @param err The error message to fail with.
  * @return The value of this projection
  */
 public A valueE(final P1<String> err) {
   if (e.isLeft())
     //noinspection CastToConcreteClass
     return ((Left<A, B>) e).a;
   else throw error(err._1());
 }
コード例 #9
0
 public BlankBuilderSpec<Value$builder> key$asBlank() {
   BlankBuilderSpec<Value$builder> result =
       new BlankBuilderSpec<Value$builder>(new Value$builder(null));
   result.$$$parentBuilder.key = result;
   return result;
 }
コード例 #10
0
 public static void main(String[] args) {
   P1 obj = new P1();
   obj.show();
   obj.print();
 }