/**
 * @license
 * Copyright 2017 The FOAM Authors. All Rights Reserved.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

package foam.core;

public class SingletonFactory implements XFactory {
  XFactory delegate_;
  Object instance_;

  public SingletonFactory(XFactory delegate) {
    delegate_ = delegate;
  }
  
  public Object create(X x) {
    if ( delegate_ ) {
      instance_ = delegate_.create(x);
      delegate_ = null;
    }
  
    return instance_;
  }
}

@@ -209,16 +209,23 @@
 elegate_
+ = null
 ;%0A  Obje
@@ -367,16 +367,24 @@
 elegate_
+ != null
  ) %7B%0A   

Fix foam.core.XFactory cannot be converted to boolean