nus-yam/ex-repair huggingface dataset:
Program: 4473
Project: 4473
Buggy source:
/** 
 * Returns a flag indicating that at least one   {@link Generator} hasa matching key for the current "smallest" key generated.
 * @return a flag indicating that at least one {@link Generator} hasa matching key for the current "smallest" key generated.
 */
@Override public boolean hasNext(){
  if (generatorList == null) {
    reset();
  }
  return IntStream.range(0,numEntries).filter(i -> advanceList[i] && generatorList.get(i).hasNext()).mapToObj(i -> Optional.of(generatorList.get(i).peek())).anyMatch(i -> i.isPresent());
}

Fixed version (ground truth):
/** 
 * Returns a flag indicating that at least one   {@link Generator} hasa matching key for the current "smallest" key generated.
 * @return a flag indicating that at least one {@link Generator} hasa matching key for the current "smallest" key generated.
 */
@Override public boolean hasNext(){
  if (generatorList == null) {
    reset();
  }
  advanceSequences();
  return nextMinKey();
}
Program: 4474
Project: 4474
Buggy source:
/** 
 * Returns the next smallest generated key.
 * @return  the next smallest generated key.
 */
private R nextMinKey(){
  return Arrays.stream(nextList).filter(opt -> opt.isPresent()).map(opt -> opt.get().getValue()).min((k,k2) -> k.compareTo(k2)).get();
}

Fixed version (ground truth):
/** 
 * Returns the next smallest generated key.
 * @return  the next smallest generated key.
 */
private boolean nextMinKey(){
  return Arrays.stream(nextList).filter(opt -> opt.isPresent()).map(opt -> opt.get().getValue()).min((k,k2) -> k.compareTo(k2)).map(k -> {
    minKeyVal=k;
    return k;
  }
).isPresent();
}
Program: 4476
Project: 4476
Buggy source:
/** 
 * Return the inference value from one input sample. The actual learning happens in compute().
 * @param patternNZ int[] of the active indices from the output below
 * @param classification {@link Map} of the classification information:<p>&emsp;"bucketIdx" - index of the encoder bucket <p>&emsp;"actValue" -  actual value doing into the encoder
 * @return {@link Classification} containing inference results. The Classificationcontains the computed probability distribution (relative likelihood for each bucketIdx starting from bucketIdx 0) for each step in  {@code steps}. The Classification also contains the average actual value for each bucket.
 */
private <T>Classification<T> infer(int[] patternNZ,Map<String,Object> classification){
  Classification<T> retVal=new Classification<T>();
  Object defaultValue=null;
  if (steps.get(0) == 0 || classification == null) {
    defaultValue=0;
  }
 else {
    defaultValue=classification.get("String_Node_Str");
  }
  T[] actValues=(T[])new Object[this.actualValues.size()];
  for (int i=0; i < actualValues.size(); i++) {
    actValues[i]=(T)(actValues[i] == null ? defaultValue : actualValues.get(i));
  }
  retVal.setActualValues(actValues);
  for (  int nSteps : steps.toArray()) {
    double[] predictDist=inferSingleStep(patternNZ,weightMatrix.get(nSteps));
    retVal.setStats(nSteps,predictDist);
  }
  return retVal;
}

Fixed version (ground truth):
/** 
 * Return the inference value from one input sample. The actual learning happens in compute().
 * @param patternNZ int[] of the active indices from the output below
 * @param classification {@link Map} of the classification information:<p>&emsp;"bucketIdx" - index of the encoder bucket <p>&emsp;"actValue" -  actual value doing into the encoder
 * @return {@link Classification} containing inference results. The Classificationcontains the computed probability distribution (relative likelihood for each bucketIdx starting from bucketIdx 0) for each step in  {@code steps}. The Classification also contains the average actual value for each bucket.
 */
private <T>Classification<T> infer(int[] patternNZ,Map<String,Object> classification){
  Classification<T> retVal=new Classification<T>();
  Object defaultValue=null;
  if (steps.get(0) == 0 || classification == null) {
    defaultValue=0;
  }
 else {
    defaultValue=classification.get("String_Node_Str");
  }
  T[] actValues=(T[])new Object[this.actualValues.size()];
  for (int i=0; i < actualValues.size(); i++) {
    actValues[i]=(T)(actualValues.get(i) == null ? defaultValue : actualValues.get(i));
  }
  retVal.setActualValues(actValues);
  for (  int nSteps : steps.toArray()) {
    double[] predictDist=inferSingleStep(patternNZ,weightMatrix.get(nSteps));
    retVal.setStats(nSteps,predictDist);
  }
  return retVal;
}
Program: 4477
Project: 4477
Buggy source:
/** 
 * Perform inference for a single step. Given an SDR input and a weight matrix, return a predicted distribution.
 * @param patternNZ int[] of the active indices from the output below
 * @param weightMatrix FlexCompColMatrix weight matrix
 * @return double[] of the predicted class label distribution
 */
private double[] inferSingleStep(int[] patternNZ,FlexCompRowMatrix weightMatrix){
  double[] outputActivation=new double[maxBucketIdx + 1];
  for (int row=0; row <= maxBucketIdx; row++) {
    for (    int bit : patternNZ) {
      outputActivation[row]+=weightMatrix.get(row,bit);
    }
  }
  double[] expOutputActivation=new double[outputActivation.length];
  for (int i=0; i < expOutputActivation.length; i++) {
    expOutputActivation[i]=Math.exp(outputActivation[i]);
  }
  double[] predictDist=new double[outputActivation.length];
  for (int i=0; i < predictDist.length; i++) {
    predictDist[i]=outputActivation[i] / ArrayUtils.sum(expOutputActivation);
  }
  return predictDist;
}

Fixed version (ground truth):
/** 
 * Perform inference for a single step. Given an SDR input and a weight matrix, return a predicted distribution.
 * @param patternNZ int[] of the active indices from the output below
 * @param weightMatrix FlexCompColMatrix weight matrix
 * @return double[] of the predicted class label distribution
 */
private double[] inferSingleStep(int[] patternNZ,FlexCompRowMatrix weightMatrix){
  double[] outputActivation=new double[maxBucketIdx + 1];
  for (int row=0; row <= maxBucketIdx; row++) {
    for (    int bit : patternNZ) {
      outputActivation[row]+=weightMatrix.get(row,bit);
    }
  }
  double[] expOutputActivation=new double[outputActivation.length];
  for (int i=0; i < expOutputActivation.length; i++) {
    expOutputActivation[i]=Math.exp(outputActivation[i]);
  }
  double[] predictDist=new double[outputActivation.length];
  for (int i=0; i < predictDist.length; i++) {
    predictDist[i]=expOutputActivation[i] / ArrayUtils.sum(expOutputActivation);
  }
  return predictDist;
}
Program: 4478
Project: 4478
Buggy source:
/** 
 * Called internally to invoke the   {@link SpatialPooler}
 * @param input
 * @return
 */
protected int[] spatialInput(int[] input){
  if (input == null) {
    LOGGER.info("String_Node_Str".concat(getName()).concat("String_Node_Str"));
  }
 else   if (input.length < 1) {
    LOGGER.info("String_Node_Str".concat(getName()).concat("String_Node_Str"));
    return input;
  }
  spatialPooler.compute(connections,input,feedForwardActiveColumns,sensor == null || sensor.getMetaInfo().isLearn(),isLearn);
  return feedForwardActiveColumns;
}

Fixed version (ground truth):
/** 
 * Called internally to invoke the   {@link SpatialPooler}
 * @param input
 * @return
 */
protected int[] spatialInput(int[] input){
  if (input == null) {
    LOGGER.info("String_Node_Str".concat(getName()).concat("String_Node_Str"));
  }
 else   if (input.length < 1) {
    LOGGER.info("String_Node_Str".concat(getName()).concat("String_Node_Str"));
    return input;
  }
  int[] activeColumns=new int[feedForwardActiveColumns.length];
  spatialPooler.compute(connections,input,activeColumns,sensor == null || sensor.getMetaInfo().isLearn(),isLearn);
  return feedForwardActiveColumns=activeColumns;
}
Program: 4480
Project: 4480
Buggy source:
/** 
 * Given an input field width and Spatial Pooler dimensionality; this method will return an array of dimension sizes whose number is equal to the number of column dimensions. The sum of the returned dimensions will be equal to the flat input field width specified. This method should be called when a disparity in dimensionality between the input field and the number of column dimensions is detected. Otherwise if the input field dimensionality is correctly specified, this method should <b>not</b> be used.
 * @param inputWidth        the flat input width of an {@link Encoder}'s output or the vector used as input to the   {@link SpatialPooler}
 * @param numColumnDims     a number specifying the number of column dimensions thatshould be returned.
 * @return
 */
public int[] inferInputDimensions(int inputWidth,int numColumnDims){
  double flatSize=inputWidth;
  double numColDims=numColumnDims;
  double sliceArrangement=Math.pow(flatSize,1 / numColDims);
  double remainder=sliceArrangement % (int)sliceArrangement;
  int[] retVal=new int[(int)numColDims];
  if (remainder > 0) {
    for (int i=0; i < numColDims - 1; i++)     retVal[i]=1;
    retVal[(int)numColDims - 1]=(int)flatSize;
  }
 else {
    for (int i=0; i < numColDims; i++)     retVal[i]=(int)sliceArrangement;
  }
  return retVal;
}

Fixed version (ground truth):
/** 
 * Given an input field width and Spatial Pooler dimensionality; this method will return an array of dimension sizes whose number is equal to the number of column dimensions. The sum of the returned dimensions will be equal to the flat input field width specified. This method should be called when a disparity in dimensionality between the input field and the number of column dimensions is detected. Otherwise if the input field dimensionality is correctly specified, this method should <b>not</b> be used.
 * @param inputWidth        the flat input width of an {@link Encoder}'s output or the vector used as input to the   {@link SpatialPooler}
 * @param numDims           a number specifying the number of dimensions thatshould be returned.
 * @return
 */
public int[] inferInputDimensions(int inputWidth,int numDims){
  double flatSize=inputWidth;
  double numColDims=numDims;
  int[] retVal=new int[(int)numColDims];
  BigDecimal log=new BigDecimal(Math.log10(flatSize));
  BigDecimal dimensions=new BigDecimal(numColDims);
  double sliceArrangement=new BigDecimal(Math.pow(10,log.divide(dimensions).doubleValue()),MathContext.DECIMAL32).doubleValue();
  double remainder=sliceArrangement % (int)sliceArrangement;
  if (remainder > 0) {
    for (int i=0; i < numColDims - 1; i++)     retVal[i]=1;
    retVal[(int)numColDims - 1]=(int)flatSize;
  }
 else {
    for (int i=0; i < numColDims; i++)     retVal[i]=(int)sliceArrangement;
  }
  return retVal;
}
Program: 4481
Project: 4481
Buggy source:
/** 
 * Temporary test to test basic sequence mechanisms
 */
@Test public void testBasicSetup_SpatialPooler_AUTO_MODE(){
  Sensor<File> sensor=Sensor.create(FileSensor::create,SensorParams.create(Keys::path,"String_Node_Str",ResourceLocator.path("String_Node_Str")));
  Parameters p=NetworkTestHarness.getParameters().copy();
  p=p.union(NetworkTestHarness.getDayDemoTestEncoderParams());
  p.setParameterByKey(KEY.RANDOM,new MersenneTwister(42));
  p.setParameterByKey(KEY.AUTO_CLASSIFY,Boolean.TRUE);
  HTMSensor<File> htmSensor=(HTMSensor<File>)sensor;
  Network n=Network.create("String_Node_Str",p);
  Layer<int[]> l=new PALayer<>(n);
  l.add(htmSensor).add(new PASpatialPooler());
  final int[] expected0=new int[]{0,1,0,0,0,1,0,1,0,0,0,1,1,0,0,0,1,0,0,0};
  final int[] expected1=new int[]{0,1,0,0,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0};
  l.subscribe(new Observer<Inference>(){
    int test=0;
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
      e.printStackTrace();
    }
    @Override public void onNext(    Inference spatialPoolerOutput){
      if (test == 0) {
        assertTrue(Arrays.equals(expected0,spatialPoolerOutput.getSDR()));
      }
      if (test == 1) {
        assertTrue(Arrays.equals(expected1,spatialPoolerOutput.getSDR()));
      }
      ++test;
    }
  }
);
  l.start();
  try {
    l.getLayerThread().join();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
/** 
 * Temporary test to test basic sequence mechanisms
 */
@Test public void testBasicSetup_SpatialPooler_AUTO_MODE(){
  Sensor<File> sensor=Sensor.create(FileSensor::create,SensorParams.create(Keys::path,"String_Node_Str",ResourceLocator.path("String_Node_Str")));
  Parameters p=NetworkTestHarness.getParameters().copy();
  p=p.union(NetworkTestHarness.getDayDemoTestEncoderParams());
  p.setParameterByKey(KEY.RANDOM,new MersenneTwister(42));
  p.setParameterByKey(KEY.AUTO_CLASSIFY,Boolean.TRUE);
  HTMSensor<File> htmSensor=(HTMSensor<File>)sensor;
  Network n=Network.create("String_Node_Str",p);
  Layer<int[]> l=new PALayer<>(n);
  l.add(htmSensor).add(new PASpatialPooler());
  final int[] expected0=new int[]{0,1,0,0,0,1,0,1,0,0,0,1,1,0,0,0,1,0,0,0};
  final int[] expected1=new int[]{0,1,0,0,0,1,0,0,0,0,0,1,1,1,0,0,1,0,0,0};
  l.subscribe(new Observer<Inference>(){
    int test=0;
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
      e.printStackTrace();
    }
    @Override public void onNext(    Inference spatialPoolerOutput){
      if (test == 0) {
        assertTrue(Arrays.equals(expected0,spatialPoolerOutput.getSDR()));
      }
      if (test == 1) {
        assertTrue(Arrays.equals(expected1,spatialPoolerOutput.getSDR()));
      }
      ++test;
    }
  }
);
  l.start();
  try {
    l.getLayerThread().join();
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
Program: 4483
Project: 4483
Buggy source:
/** 
 * Temporary test to test basic sequence mechanisms
 */
@Test public void testBasicSetup_SpatialPooler_MANUAL_MODE(){
  Parameters p=NetworkTestHarness.getParameters().copy();
  p.setParameterByKey(KEY.RANDOM,new MersenneTwister(42));
  int[][] inputs=new int[7][8];
  inputs[0]=new int[]{1,1,0,0,0,0,0,1};
  inputs[1]=new int[]{1,1,1,0,0,0,0,0};
  inputs[2]=new int[]{0,1,1,1,0,0,0,0};
  inputs[3]=new int[]{0,0,1,1,1,0,0,0};
  inputs[4]=new int[]{0,0,0,1,1,1,0,0};
  inputs[5]=new int[]{0,0,0,0,1,1,1,0};
  inputs[6]=new int[]{0,0,0,0,0,1,1,1};
  final int[] expected0=new int[]{0,1,0,0,0,1,0,1,0,0,0,1,1,0,0,0,1,0,0,0};
  final int[] expected1=new int[]{0,1,0,0,0,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0};
  Layer<int[]> l=new PALayer<>(p,null,new PASpatialPooler(),null,null,null);
  l.subscribe(new Observer<Inference>(){
    int test=0;
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
      e.printStackTrace();
    }
    @Override public void onNext(    Inference spatialPoolerOutput){
      if (test == 0) {
        assertTrue(Arrays.equals(expected0,spatialPoolerOutput.getSDR()));
      }
      if (test == 1) {
        assertTrue(Arrays.equals(expected1,spatialPoolerOutput.getSDR()));
      }
      ++test;
    }
  }
);
  l.compute(inputs[0]);
  l.compute(inputs[1]);
}

Fixed version (ground truth):
/** 
 * Temporary test to test basic sequence mechanisms
 */
@Test public void testBasicSetup_SpatialPooler_MANUAL_MODE(){
  Parameters p=NetworkTestHarness.getParameters().copy();
  p.setParameterByKey(KEY.RANDOM,new MersenneTwister(42));
  int[][] inputs=new int[7][8];
  inputs[0]=new int[]{1,1,0,0,0,0,0,1};
  inputs[1]=new int[]{1,1,1,0,0,0,0,0};
  inputs[2]=new int[]{0,1,1,1,0,0,0,0};
  inputs[3]=new int[]{0,0,1,1,1,0,0,0};
  inputs[4]=new int[]{0,0,0,1,1,1,0,0};
  inputs[5]=new int[]{0,0,0,0,1,1,1,0};
  inputs[6]=new int[]{0,0,0,0,0,1,1,1};
  final int[] expected0=new int[]{0,1,0,0,0,1,0,1,0,0,0,1,1,0,0,0,1,0,0,0};
  final int[] expected1=new int[]{0,1,0,0,0,1,0,0,0,0,0,1,1,1,0,0,1,0,0,0};
  Layer<int[]> l=new PALayer<>(p,null,new PASpatialPooler(),null,null,null);
  l.subscribe(new Observer<Inference>(){
    int test=0;
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
      e.printStackTrace();
    }
    @Override public void onNext(    Inference spatialPoolerOutput){
      if (test == 0) {
        assertTrue(Arrays.equals(expected0,spatialPoolerOutput.getSDR()));
      }
      if (test == 1) {
        assertTrue(Arrays.equals(expected1,spatialPoolerOutput.getSDR()));
      }
      ++test;
    }
  }
);
  l.compute(inputs[0]);
  l.compute(inputs[1]);
}
Program: 4485
Project: 4485
Buggy source:
/** 
 * Checks the anomaly score against a known threshold which indicates that the TM predictions have been "warmed up". When there have been enough occurrences within the threshold, we conclude that the algorithms have been adequately stabilized.
 * @param l                 the {@link PALayer} in question
 * @param anomalyScore      the current anomaly score
 * @return
 */
private boolean isWarmedUp(Layer<Map<String,Object>> l,double anomalyScore){
  if (anomalyScore >= 0 && anomalyScore <= 0.1) {
    ++timesWithinThreshold;
  }
 else {
    timesWithinThreshold=0;
  }
  if (timesWithinThreshold > 50) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks the anomaly score against a known threshold which indicates that the TM predictions have been "warmed up". When there have been enough occurrences within the threshold, we conclude that the algorithms have been adequately stabilized.
 * @param l                 the {@link PALayer} in question
 * @param anomalyScore      the current anomaly score
 * @return
 */
private boolean isWarmedUp(Layer<Map<String,Object>> l,double anomalyScore){
  if (anomalyScore <= 0.1) {
    ++timesWithinThreshold;
  }
 else {
    timesWithinThreshold=0;
  }
  if (timesWithinThreshold > 50) {
    return true;
  }
  return false;
}
Program: 4486
Project: 4486
Buggy source:
/** 
 * Constructs a new   {@code Synapse}
 * @param c             the connections state of the temporal memory
 * @param sourceCell    the {@link Cell} which will activate this {@code Synapse}; Null if this Synapse is proximal
 * @param segment       the owning dendritic segment
 * @param pool		    this {@link Pool} of which this synapse is a member
 * @param index         this {@code Synapse}'s index
 * @param inputIndex	the index of this {@link Synapse}'s input; be it a Cell or InputVector bit.
 */
public Synapse(Connections c,Cell sourceCell,Segment segment,Pool pool,int index,int inputIndex){
  this.sourceCell=sourceCell;
  this.segment=segment;
  this.pool=pool;
  this.synapseIndex=index;
  this.inputIndex=inputIndex;
  hashcode=hashCode();
  if (sourceCell != null) {
    sourceCell.addReceptorSynapse(c,this);
  }
}

Fixed version (ground truth):
/** 
 * Constructs a new   {@code Synapse}
 * @param c             the connections state of the temporal memory
 * @param sourceCell    the {@link Cell} which will activate this {@code Synapse}; Null if this Synapse is proximal
 * @param segment       the owning dendritic segment
 * @param pool		    this {@link Pool} of which this synapse is a member
 * @param index         this {@code Synapse}'s index
 * @param inputIndex	the index of this {@link Synapse}'s input; be it a Cell or InputVector bit.
 */
public Synapse(Connections c,Cell sourceCell,Segment segment,Pool pool,int index,int inputIndex){
  this.sourceCell=sourceCell;
  this.segment=segment;
  this.pool=pool;
  this.synapseIndex=index;
  this.inputIndex=inputIndex;
  if (sourceCell != null) {
    sourceCell.addReceptorSynapse(c,this);
  }
}
Program: 4487
Project: 4487
Buggy source:
/** 
 * Connects the first observable which does the transformation of input  types, to the rest of the sequence - then clears the helper map and sets it to null.
 * @param t
 */
private void completeDispatch(T t){
  Observable<ManualInput> sequence=resolveObservableSequence(t);
  sequence=mapEncoderBuckets(sequence);
  sequence=fillInSequence(sequence);
  subscribers.add(0,getDelegateObserver());
  subscription=sequence.subscribe(getDelegateSubscriber());
  observableDispatch.clear();
  observableDispatch=null;
  if (sensor == null) {
    sensor=parentNetwork == null ? null : parentNetwork.getSensor();
  }
 else   if (parentNetwork != null) {
    parentNetwork.setSensor(sensor);
  }
}

Fixed version (ground truth):
/** 
 * Connects the first observable which does the transformation of input  types, to the rest of the sequence - then clears the helper map and sets it to null.
 * @param t
 */
private void completeDispatch(T t){
  Observable<ManualInput> sequence=resolveObservableSequence(t);
  sequence=mapEncoderBuckets(sequence);
  sequence=fillInSequence(sequence);
  subscribers.add(getDelegateObserver());
  subscription=sequence.subscribe(getDelegateSubscriber());
  observableDispatch.clear();
  observableDispatch=null;
  if (sensor == null) {
    sensor=parentNetwork == null ? null : parentNetwork.getSensor();
  }
 else   if (parentNetwork != null) {
    parentNetwork.setSensor(sensor);
  }
}
Program: 4492
Project: 4492
Buggy source:
/** 
 * Checks the anomaly score against a known threshold which indicates that the TM predictions have been "warmed up". When there have been enough occurrences within the threshold, we conclude that the algorithms have been adequately  stabilized.
 * @param l                 the {@link Layer} in question
 * @param anomalyScore      the current anomaly score
 * @return
 */
private boolean isWarmedUp(Layer<Map<String,Object>> l,double anomalyScore){
  if (anomalyScore >= 0 && anomalyScore <= 0.1) {
    ++timesWithinThreshold;
  }
 else {
    timesWithinThreshold=0;
  }
  if (timesWithinThreshold > 13) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks the anomaly score against a known threshold which indicates that the TM predictions have been "warmed up". When there have been enough occurrences within the threshold, we conclude that the algorithms have been adequately  stabilized.
 * @param l                 the {@link Layer} in question
 * @param anomalyScore      the current anomaly score
 * @return
 */
private boolean isWarmedUp(Layer<Map<String,Object>> l,double anomalyScore){
  if (anomalyScore >= 0 && anomalyScore <= 0.1) {
    ++timesWithinThreshold;
  }
 else {
    timesWithinThreshold=0;
  }
  if (timesWithinThreshold > 20) {
    return true;
  }
  return false;
}
Program: 4493
Project: 4493
Buggy source:
/** 
 * Returns the configured global inhibition flag
 * @return  the configured global inhibition flag
 * @see {@link #setGlobalInhibition(boolean)}
 */
public boolean getGlobalInhibition(){
  return globalInhibition;
}

Fixed version (ground truth):
/** 
 * Returns the configured global inhibition flag
 * @return  the configured global inhibition flag
 * @see setGlobalInhibition
 */
public boolean getGlobalInhibition(){
  return globalInhibition;
}
Program: 4494
Project: 4494
Buggy source:
/** 
 * Returns the configured local area density
 * @return  the configured local area density
 * @see {@link #setLocalAreaDensity(double)}
 */
public double getLocalAreaDensity(){
  return localAreaDensity;
}

Fixed version (ground truth):
/** 
 * Returns the configured local area density
 * @return  the configured local area density
 * @see setLocalAreaDensity
 */
public double getLocalAreaDensity(){
  return localAreaDensity;
}
Program: 4495
Project: 4495
Buggy source:
/** 
 * Returns the minPctActiveDutyCycle
 * @return  the minPctActiveDutyCycle
 * @see {@link #setMinPctActiveDutyCycle(double)}
 */
public double getMinPctActiveDutyCycles(){
  return minPctActiveDutyCycles;
}

Fixed version (ground truth):
/** 
 * Returns the minPctActiveDutyCycle see   {@link #setMinPctActiveDutyCycles(double)}
 * @return  the minPctActiveDutyCycle
 */
public double getMinPctActiveDutyCycles(){
  return minPctActiveDutyCycles;
}
Program: 4496
Project: 4496
Buggy source:
/** 
 * Returns the stimulus threshold
 * @return  the stimulus threshold
 * @see {@link #setStimulusThreshold(double)}
 */
public double getStimulusThreshold(){
  return stimulusThreshold;
}

Fixed version (ground truth):
/** 
 * Returns the stimulus threshold
 * @return  the stimulus threshold
 * @see setStimulusThreshold
 */
public double getStimulusThreshold(){
  return stimulusThreshold;
}
Program: 4497
Project: 4497
Buggy source:
/** 
 * Amount by which permanences of synapses are incremented during learning.
 * @param permanenceIncrement
 */
public double getPermanenceIncrement(){
  return this.permanenceIncrement;
}

Fixed version (ground truth):
/** 
 * Amount by which permanences of synapses are incremented during learning.
 */
public double getPermanenceIncrement(){
  return this.permanenceIncrement;
}
Program: 4498
Project: 4498
Buggy source:
/** 
 * Returns the synaptic permanence inactive decrement.
 * @return  the synaptic permanence inactive decrement.
 * @see {@link #setSynPermInactiveDec(double)}
 */
public double getSynPermInactiveDec(){
  return synPermInactiveDec;
}

Fixed version (ground truth):
/** 
 * Returns the synaptic permanence inactive decrement.
 * @return  the synaptic permanence inactive decrement.
 * @see setSynPermInactiveDec
 */
public double getSynPermInactiveDec(){
  return synPermInactiveDec;
}
Program: 4499
Project: 4499
Buggy source:
/** 
 * Sets the connected count   {@link SparseBinaryMatrix}
 * @param columnIndex
 * @param count
 */
public void setConnectedMatrix(SparseBinaryMatrix matrix){
  this.connectedCounts=matrix;
}

Fixed version (ground truth):
/** 
 * Sets the connected count   {@link SparseBinaryMatrix}
 * @param matrix
 */
public void setConnectedMatrix(SparseBinaryMatrix matrix){
  this.connectedCounts=matrix;
}
Program: 4500
Project: 4500
Buggy source:
/** 
 * Returns the configured number of active columns per inhibition area.
 * @return  the configured number of active columns perinhibition area.
 * @see {@link #setNumActiveColumnsPerInhArea(double)}
 */
public double getNumActiveColumnsPerInhArea(){
  return numActiveColumnsPerInhArea;
}

Fixed version (ground truth):
/** 
 * Returns the configured number of active columns per inhibition area.
 * @return  the configured number of active columns perinhibition area.
 * @see setNumActiveColumnsPerInhArea
 */
public double getNumActiveColumnsPerInhArea(){
  return numActiveColumnsPerInhArea;
}
Program: 4501
Project: 4501
Buggy source:
/** 
 * Returns the configured input dimensions
 * @return the configured input dimensions
 * @see {@link #setInputDimensions(int[])}
 */
public int[] getInputDimensions(){
  return inputDimensions;
}

Fixed version (ground truth):
/** 
 * Returns the configured input dimensions see   {@link #setInputDimensions(int[])}
 * @return the configured input dimensions
 */
public int[] getInputDimensions(){
  return inputDimensions;
}
Program: 4502
Project: 4502
Buggy source:
/** 
 * Returns the configured active permanence increment
 * @return the configured active permanence increment
 * @see {@link #setSynPermActiveInc(double)}
 */
public double getSynPermActiveInc(){
  return synPermActiveInc;
}

Fixed version (ground truth):
/** 
 * Returns the configured active permanence increment
 * @return the configured active permanence increment
 * @see setSynPermActiveInc
 */
public double getSynPermActiveInc(){
  return synPermActiveInc;
}
Program: 4503
Project: 4503
Buggy source:
/** 
 * The maximum overlap boost factor. Each column's overlap gets multiplied by a boost factor before it gets considered for inhibition. The actual boost factor for a column is number between 1.0 and maxBoost. A boost factor of 1.0 is used if the duty cycle is >= minOverlapDutyCycle, maxBoost is used if the duty cycle is 0, and any duty cycle in between is linearly extrapolated from these 2 end points.
 * @param maxBoost
 */
public void setMaxBoost(double maxBoost){
  this.maxBoost=maxBoost;
}

Fixed version (ground truth):
/** 
 * The maximum overlap boost factor. Each column's overlap gets multiplied by a boost factor before it gets considered for inhibition. The actual boost factor for a column is number between 1.0 and maxBoost. A boost factor of 1.0 is used if the duty cycle is &gt;= minOverlapDutyCycle, maxBoost is used if the duty cycle is 0, and any duty cycle in between is linearly extrapolated from these 2 end points.
 * @param maxBoost
 */
public void setMaxBoost(double maxBoost){
  this.maxBoost=maxBoost;
}
Program: 4504
Project: 4504
Buggy source:
/** 
 * {@see #setMinPctOverlapDutyCycles(double)}
 * @return
 */
public double getMinPctOverlapDutyCycles(){
  return minPctOverlapDutyCycles;
}

Fixed version (ground truth):
/** 
 * see   {@link #setMinPctOverlapDutyCycles(double)}
 * @return
 */
public double getMinPctOverlapDutyCycles(){
  return minPctOverlapDutyCycles;
}
Program: 4505
Project: 4505
Buggy source:
/** 
 * Sets the current   {@link Set} of winner {@link Cells}s
 * @param cells
 */
public void setWinnerCells(Set<Cell> cells){
  this.winnerCells=cells;
}

Fixed version (ground truth):
/** 
 * Sets the current   {@link Set} of winner {@link Cell}s
 * @param cells
 */
public void setWinnerCells(Set<Cell> cells){
  this.winnerCells=cells;
}
Program: 4506
Project: 4506
Buggy source:
/** 
 * Returns the max boost
 * @return  the max boost
 * @see {@link #setMaxBoost(double)}
 */
public double getMaxBoost(){
  return maxBoost;
}

Fixed version (ground truth):
/** 
 * Returns the max boost see   {@link #setMaxBoost(double)}
 * @return  the max boost
 */
public double getMaxBoost(){
  return maxBoost;
}
Program: 4507
Project: 4507
Buggy source:
/** 
 * Amount by which permanences of synapses are decremented during learning.
 * @param permanenceDecrement
 */
public double getPermanenceDecrement(){
  return this.permanenceDecrement;
}

Fixed version (ground truth):
/** 
 * Amount by which permanences of synapses are decremented during learning.
 */
public double getPermanenceDecrement(){
  return this.permanenceDecrement;
}
Program: 4508
Project: 4508
Buggy source:
/** 
 * Returns the configured potential radius
 * @return  the configured potential radius
 * @see {@link #setPotentialRadius(int)}
 */
public int getPotentialRadius(){
  return Math.min(numInputs,potentialRadius);
}

Fixed version (ground truth):
/** 
 * Returns the configured potential radius
 * @return  the configured potential radius
 * @see setPotentialRadius
 */
public int getPotentialRadius(){
  return Math.min(numInputs,potentialRadius);
}
Program: 4509
Project: 4509
Buggy source:
/** 
 * Gets the number of   {@link Cells} per {@link Column}.
 * @return cellsPerColumn
 */
public int getCellsPerColumn(){
  return this.cellsPerColumn;
}

Fixed version (ground truth):
/** 
 * Gets the number of   {@link Cell}s per   {@link Column}.
 * @return cellsPerColumn
 */
public int getCellsPerColumn(){
  return this.cellsPerColumn;
}
Program: 4510
Project: 4510
Buggy source:
/** 
 * Initial permanence of a new synapse 
 * @param   
 */
public void setInitialPermanence(double initialPermanence){
  this.initialPermanence=initialPermanence;
}

Fixed version (ground truth):
/** 
 * Initial permanence of a new synapse 
 * @param initialPermanence
 */
public void setInitialPermanence(double initialPermanence){
  this.initialPermanence=initialPermanence;
}
Program: 4511
Project: 4511
Buggy source:
/** 
 * Converts a   {@link Collection} of {@link Columns}s to a list of column indexes.
 * @param columns
 * @return
 */
public static List<Integer> asColumnIndexes(Collection<Column> columns){
  List<Integer> ints=new ArrayList<Integer>();
  for (  Column col : columns) {
    ints.add(col.getIndex());
  }
  return ints;
}

Fixed version (ground truth):
/** 
 * Converts a   {@link Collection} of {@link Column}s to a list of column indexes.
 * @param columns
 * @return
 */
public static List<Integer> asColumnIndexes(Collection<Column> columns){
  List<Integer> ints=new ArrayList<Integer>();
  for (  Column col : columns) {
    ints.add(col.getIndex());
  }
  return ints;
}
Program: 4512
Project: 4512
Buggy source:
/** 
 * Returns the configured duty cycle period
 * @return  the configured duty cycle period
 * @see {@link #setDutyCyclePeriod(double)}
 */
public int getDutyCyclePeriod(){
  return dutyCyclePeriod;
}

Fixed version (ground truth):
/** 
 * Returns the configured duty cycle period see   {@link #setDutyCyclePeriod(double)}
 * @return  the configured duty cycle period
 */
public int getDutyCyclePeriod(){
  return dutyCyclePeriod;
}
Program: 4513
Project: 4513
Buggy source:
/** 
 * Returns the configured potential pct
 * @return the configured potential pct
 * @see {@link #setPotentialPct(double)}
 */
public double getPotentialPct(){
  return potentialPct;
}

Fixed version (ground truth):
/** 
 * Returns the configured potential pct
 * @return the configured potential pct
 * @see setPotentialPct
 */
public double getPotentialPct(){
  return potentialPct;
}
Program: 4514
Project: 4514
Buggy source:
/** 
 * Returns the verbosity setting.
 * @return  the verbosity setting.
 * @see {@link #setSpVerbosity(int)}
 */
public int getSpVerbosity(){
  return spVerbosity;
}

Fixed version (ground truth):
/** 
 * Returns the verbosity setting. see   {@link #setSpVerbosity(int)}
 * @return  the verbosity setting.
 */
public int getSpVerbosity(){
  return spVerbosity;
}
Program: 4515
Project: 4515
Buggy source:
/** 
 * Returns the synapse permanence connected threshold
 * @return the synapse permanence connected threshold
 * @see {@link #setSynPermConnected(double)}
 */
public double getSynPermConnected(){
  return synPermConnected;
}

Fixed version (ground truth):
/** 
 * Returns the synapse permanence connected threshold
 * @return the synapse permanence connected threshold
 * @see setSynPermConnected
 */
public double getSynPermConnected(){
  return synPermConnected;
}
Program: 4516
Project: 4516
Buggy source:
/** 
 * The default connected threshold. Any synapse whose permanence value is above the connected threshold is a "connected synapse", meaning it can contribute to the cell's firing.
 * @param minPctOverlapDutyCycle
 */
public void setSynPermConnected(double synPermConnected){
  this.synPermConnected=synPermConnected;
}

Fixed version (ground truth):
/** 
 * The default connected threshold. Any synapse whose permanence value is above the connected threshold is a "connected synapse", meaning it can contribute to the cell's firing.
 * @param synPermConnected
 */
public void setSynPermConnected(double synPermConnected){
  this.synPermConnected=synPermConnected;
}
Program: 4517
Project: 4517
Buggy source:
/** 
 * Sets the activation threshold. <p/> If the number of active connected synapses on a segment is at least this threshold, the segment is said to be active.
 * @param activationThreshold
 */
public void setActivationThreshold(int activationThreshold){
  paramMap.put(KEY.ACTIVATION_THRESHOLD,activationThreshold);
}

Fixed version (ground truth):
/** 
 * <p> Sets the activation threshold. </p> If the number of active connected synapses on a segment is at least this threshold, the segment is said to be active.
 * @param activationThreshold
 */
public void setActivationThreshold(int activationThreshold){
  paramMap.put(KEY.ACTIVATION_THRESHOLD,activationThreshold);
}
Program: 4518
Project: 4518
Buggy source:
/** 
 * Initial permanence of a new synapse
 * @param
 */
public void setInitialPermanence(double initialPermanence){
  paramMap.put(KEY.INITIAL_PERMANENCE,initialPermanence);
}

Fixed version (ground truth):
/** 
 * Initial permanence of a new synapse
 * @param initialPermanence
 */
public void setInitialPermanence(double initialPermanence){
  paramMap.put(KEY.INITIAL_PERMANENCE,initialPermanence);
}
Program: 4519
Project: 4519
Buggy source:
/** 
 * The maximum overlap boost factor. Each column's overlap gets multiplied by a boost factor before it gets considered for inhibition. The actual boost factor for a column is number between 1.0 and maxBoost. A boost factor of 1.0 is used if the duty cycle is >= minOverlapDutyCycle, maxBoost is used if the duty cycle is 0, and any duty cycle in between is linearly extrapolated from these 2 end points.
 * @param maxBoost
 */
public void setMaxBoost(double maxBoost){
  paramMap.put(KEY.MAX_BOOST,maxBoost);
}

Fixed version (ground truth):
/** 
 * The maximum overlap boost factor. Each column's overlap gets multiplied by a boost factor before it gets considered for inhibition. The actual boost factor for a column is number between 1.0 and maxBoost. A boost factor of 1.0 is used if the duty cycle is &gt;= minOverlapDutyCycle, maxBoost is used if the duty cycle is 0, and any duty cycle in between is linearly extrapolated from these 2 end points.
 * @param maxBoost
 */
public void setMaxBoost(double maxBoost){
  paramMap.put(KEY.MAX_BOOST,maxBoost);
}
Program: 4520
Project: 4520
Buggy source:
/** 
 * @param n   Number of available bits in pattern
 * @param w   Number of on bits in pattern
 * @param num Number of available patternsConstructs a new  {@code PatternMachine}
 */
public PatternMachine(int n,int w,int seed){
  this.n=n;
  this.w=w;
  random=new MersenneTwister(new int[]{seed});
  patterns=new LinkedHashMap<Integer,LinkedHashSet<Integer>>();
  generate();
}

Fixed version (ground truth):
/** 
 * @param n   Number of available bits in pattern
 * @param w   Number of on bits in pattern
 * @param seed Random seedConstructs a new  {@code PatternMachine}
 */
public PatternMachine(int n,int w,int seed){
  this.n=n;
  this.w=w;
  random=new MersenneTwister(new int[]{seed});
  patterns=new LinkedHashMap<Integer,LinkedHashSet<Integer>>();
  generate();
}
Program: 4521
Project: 4521
Buggy source:
/** 
 * Returns the synapses on a segment that are active due to lateral input from active cells.
 * @param activeSynapsesForSegment      Set of this {@code Segment}'s active   {@code Synapse}s
 * @param permanenceThreshold           Threshold at which a {@Synapse} is considered connected.
 * @return                              Set of connected Synapses
 */
public Set<Synapse> getConnectedActiveSynapses(Map<DistalDendrite,Set<Synapse>> activeSynapsesForSegment,double permanenceThreshold){
  Set<Synapse> connectedSynapses=null;
  if (!activeSynapsesForSegment.containsKey(this)) {
    return EMPTY_SYNAPSE_SET;
  }
  for (  Synapse s : activeSynapsesForSegment.get(this)) {
    if (s.getPermanence() >= permanenceThreshold) {
      if (connectedSynapses == null) {
        connectedSynapses=new LinkedHashSet<Synapse>();
      }
      connectedSynapses.add(s);
    }
  }
  return connectedSynapses == null ? EMPTY_SYNAPSE_SET : connectedSynapses;
}

Fixed version (ground truth):
/** 
 * Returns the synapses on a segment that are active due to lateral input from active cells.
 * @param activeSynapsesForSegment      Set of this {@link Segment}'s active   {@link Synapse}s
 * @param permanenceThreshold           Threshold at which a {@link Synapse} is considered connected.
 * @return                              Set of connected Synapses
 */
public Set<Synapse> getConnectedActiveSynapses(Map<DistalDendrite,Set<Synapse>> activeSynapsesForSegment,double permanenceThreshold){
  Set<Synapse> connectedSynapses=null;
  if (!activeSynapsesForSegment.containsKey(this)) {
    return EMPTY_SYNAPSE_SET;
  }
  for (  Synapse s : activeSynapsesForSegment.get(this)) {
    if (s.getPermanence() >= permanenceThreshold) {
      if (connectedSynapses == null) {
        connectedSynapses=new LinkedHashSet<Synapse>();
      }
      connectedSynapses.add(s);
    }
  }
  return connectedSynapses == null ? EMPTY_SYNAPSE_SET : connectedSynapses;
}
Program: 4522
Project: 4522
Buggy source:
/** 
 * Sets the input vector synapse indexes which are connected (>= synPermConnected)
 * @param c
 * @param connectedIndexes
 */
public void setConnectedSynapsesForTest(Connections c,int[] connectedIndexes){
  Pool pool=createPool(c,connectedIndexes);
  c.getPotentialPools().set(index,pool);
}

Fixed version (ground truth):
/** 
 * Sets the input vector synapse indexes which are connected (&gt;= synPermConnected)
 * @param c
 * @param connectedIndexes
 */
public void setConnectedSynapsesForTest(Connections c,int[] connectedIndexes){
  Pool pool=createPool(c,connectedIndexes);
  c.getPotentialPools().set(index,pool);
}
Program: 4523
Project: 4523
Buggy source:
/** 
 * Resets the   {@link TemporalMemory} if it exists.
 * @return
 */
public void reset(){
  if (temporalMemory == null) {
    LOGGER.debug("String_Node_Str" + getName() + "String_Node_Str");
  }
 else {
    temporalMemory.reset(connections);
    resetRecordNum();
  }
}

Fixed version (ground truth):
/** 
 * Resets the   {@link TemporalMemory} if it exists.
 */
public void reset(){
  if (temporalMemory == null) {
    LOGGER.debug("String_Node_Str" + getName() + "String_Node_Str");
  }
 else {
    temporalMemory.reset(connections);
    resetRecordNum();
  }
}
Program: 4524
Project: 4524
Buggy source:
/** 
 * Used to manually input data into a   {@link Region}, the other way  being the call to   {@link Region#start()} for a Region that containsa  {@link Layer} which in turn contains a {@link Sensor} <em>-OR-</em>subscribing a receiving Region to this Region's output Observable.
 * @param input One of (int[], String[], {@link ManualInput}, or Map<String, Object>)
 */
@SuppressWarnings("String_Node_Str") public <T>void compute(T input){
  if (!assemblyClosed) {
    close();
  }
  this.input=input;
  ((Layer<T>)tail).compute(input);
}

Fixed version (ground truth):
/** 
 * Used to manually input data into a   {@link Region}, the other way  being the call to   {@link Region#start()} for a Region that containsa  {@link Layer} which in turn contains a {@link Sensor} <em>-OR-</em>subscribing a receiving Region to this Region's output Observable.
 * @param input One of (int[], String[], {@link ManualInput}, or Map&lt;String, Object&gt;)
 */
@SuppressWarnings("String_Node_Str") public <T>void compute(T input){
  if (!assemblyClosed) {
    close();
  }
  this.input=input;
  ((Layer<T>)tail).compute(input);
}
Program: 4525
Project: 4525
Buggy source:
/** 
 * Searches through the specified   {@link MultiEncoder}'s previously configured  encoders to find and return one that is of type   {@link ScalarEncoder},  {@link RandomDistributedScalarEncoder},   {@link AdaptiveScalarEncoder},  {@link LogEncoder} or {@link DeltaEncoder}.
 * @param enc   the containing {@code MultiEncoder}
 * @return
 */
private Optional<Encoder<?>> getNumberEncoder(MultiEncoder enc){
  for (  EncoderTuple t : enc.getEncoders(enc)) {
    if ((t.getEncoder() instanceof RandomDistributedScalarEncoder) || (t.getEncoder() instanceof ScalarEncoder) || (t.getEncoder() instanceof AdaptiveScalarEncoder)|| (t.getEncoder() instanceof LogEncoder)|| (t.getEncoder() instanceof DeltaEncoder)) {
      return Optional.of(t.getEncoder());
    }
  }
  return Optional.of(null);
}

Fixed version (ground truth):
/** 
 * Searches through the specified   {@link MultiEncoder}'s previously configured  encoders to find and return one that is of type   {@link ScalarEncoder},  {@link RandomDistributedScalarEncoder},   {@link AdaptiveScalarEncoder},  {@link LogEncoder} or {@link DeltaEncoder}.
 * @param enc   the containing {@code MultiEncoder}
 * @return
 */
private Optional<Encoder<?>> getNumberEncoder(MultiEncoder enc){
  for (  EncoderTuple t : enc.getEncoders(enc)) {
    if ((t.getEncoder() instanceof RandomDistributedScalarEncoder) || (t.getEncoder() instanceof ScalarEncoder) || (t.getEncoder() instanceof AdaptiveScalarEncoder)|| (t.getEncoder() instanceof LogEncoder)|| (t.getEncoder() instanceof DeltaEncoder)) {
      return Optional.of(t.getEncoder());
    }
  }
  return Optional.empty();
}
Program: 4526
Project: 4526
Buggy source:
/** 
 * Searches through the specified   {@link MultiEncoder}'s previously configured  encoders to find and return one that is of type   {@link DateEncoder}
 * @param enc   the containing {@code MultiEncoder}
 * @return
 */
private Optional<DateEncoder> getDateEncoder(MultiEncoder enc){
  for (  EncoderTuple t : enc.getEncoders(enc)) {
    if (t.getEncoder() instanceof DateEncoder) {
      return Optional.of((DateEncoder)t.getEncoder());
    }
  }
  return Optional.of(null);
}

Fixed version (ground truth):
/** 
 * Searches through the specified   {@link MultiEncoder}'s previously configured  encoders to find and return one that is of type   {@link DateEncoder}
 * @param enc   the containing {@code MultiEncoder}
 * @return
 */
private Optional<DateEncoder> getDateEncoder(MultiEncoder enc){
  for (  EncoderTuple t : enc.getEncoders(enc)) {
    if (t.getEncoder() instanceof DateEncoder) {
      return Optional.of((DateEncoder)t.getEncoder());
    }
  }
  return Optional.empty();
}
Program: 4527
Project: 4527
Buggy source:
/** 
 * Searches through the specified   {@link MultiEncoder}'s previously configured  encoders to find and return one that is of type   {@link CategoryEncoder} or{@link SDRCategoryEncoder}
 * @param enc   the containing {@code MultiEncoder}
 * @return
 */
private Optional<Encoder<?>> getCategoryEncoder(MultiEncoder enc){
  for (  EncoderTuple t : enc.getEncoders(enc)) {
    if ((t.getEncoder() instanceof CategoryEncoder) || (t.getEncoder() instanceof SDRCategoryEncoder)) {
      return Optional.of(t.getEncoder());
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Searches through the specified   {@link MultiEncoder}'s previously configured  encoders to find and return one that is of type   {@link CategoryEncoder} or{@link SDRCategoryEncoder}
 * @param enc   the containing {@code MultiEncoder}
 * @return
 */
private Optional<Encoder<?>> getCategoryEncoder(MultiEncoder enc){
  for (  EncoderTuple t : enc.getEncoders(enc)) {
    if ((t.getEncoder() instanceof CategoryEncoder) || (t.getEncoder() instanceof SDRCategoryEncoder)) {
      return Optional.of(t.getEncoder());
    }
  }
  return Optional.empty();
}
Program: 4528
Project: 4528
Buggy source:
/** 
 * Searches through the specified   {@link MultiEncoder}'s previously configured  encoders to find and return one that is of type   {@link CoordinateEncoder} or{@link GeospatialCoordinateEncoder}
 * @param enc   the containing {@code MultiEncoder}
 * @return
 */
private Optional<Encoder<?>> getCoordinateEncoder(MultiEncoder enc){
  for (  EncoderTuple t : enc.getEncoders(enc)) {
    if ((t.getEncoder() instanceof CoordinateEncoder) || (t.getEncoder() instanceof GeospatialCoordinateEncoder)) {
      return Optional.of(t.getEncoder());
    }
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Searches through the specified   {@link MultiEncoder}'s previously configured  encoders to find and return one that is of type   {@link CoordinateEncoder} or{@link GeospatialCoordinateEncoder}
 * @param enc   the containing {@code MultiEncoder}
 * @return
 */
private Optional<Encoder<?>> getCoordinateEncoder(MultiEncoder enc){
  for (  EncoderTuple t : enc.getEncoders(enc)) {
    if ((t.getEncoder() instanceof CoordinateEncoder) || (t.getEncoder() instanceof GeospatialCoordinateEncoder)) {
      return Optional.of(t.getEncoder());
    }
  }
  return Optional.empty();
}