package edu.washington.escience.myria.api.encoding;

import java.util.Map;

import com.fasterxml.jackson.annotation.JsonProperty;

import edu.washington.escience.myria.api.encoding.QueryConstruct.ConstructArgs;
import edu.washington.escience.myria.operator.IDBController;
import edu.washington.escience.myria.operator.Operator;
import edu.washington.escience.myria.parallel.ExchangePairID;

public class IDBControllerEncoding extends OperatorEncoding<IDBController> {
  @JsonProperty
  @Required
  public Integer argSelfIdbId;
  @JsonProperty
  @Required
  public Integer argInitialInput;
  @JsonProperty
  @Required
  public Integer argIterationInput;
  @JsonProperty
  @Required
  public Integer argEosControllerInput;

  public boolean sync;

  private ExchangePairID realControllerOperatorId;
  public Integer realControllerWorkerId;

  @Required
  public StreamingStateEncoding<?> argState;

  @Override
  public IDBController construct(ConstructArgs args) {
    return new IDBController(argSelfIdbId, realControllerOperatorId, realControllerWorkerId, null, null, null, argState
        .construct(), sync);
  }

  @Override
  public void connect(Operator current, Map<Integer, Operator> operators) {
    current.setChildren(new Operator[] {
        operators.get(argInitialInput), operators.get(argIterationInput), operators.get(argEosControllerInput) });
  }

  protected void setRealControllerOperatorID(final ExchangePairID realControllerOperatorId) {
    this.realControllerOperatorId = realControllerOperatorId;
  }

  protected ExchangePairID getRealControllerOperatorID() {
    return realControllerOperatorId;
  }
}
@@ -122,16 +122,55 @@
 roperty;
+%0Aimport com.google.common.base.Objects;
 %0A%0Aimport
@@ -763,17 +763,17 @@
  public 
-b
+B
 oolean s
@@ -1138,20 +1138,57 @@
 ruct(), 
-sync
+Objects.firstNonNull(sync, Boolean.FALSE)
 );%0A  %7D%0A%0A

change boolean to Boolean