task_type
stringclasses
4 values
code_task
stringclasses
15 values
start_line
int64
4
1.79k
end_line
int64
4
1.8k
before
stringlengths
79
76.1k
between
stringlengths
17
806
after
stringlengths
2
72.6k
reason_categories_output
stringlengths
2
2.24k
horizon_categories_output
stringlengths
83
3.99k
reason_freq_analysis
stringclasses
150 values
horizon_freq_analysis
stringlengths
23
185
infilling_java
RNGTester
174
176
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' super(mySeed);', ' params = myParams;', ' }']
[' ', ' public Multinomial (IPRNG prng, MultinomialParam myParams) {', ' super(prng);', ' params = myParams;', ' }', '', ' /**', ' * Generate another random object', ' */', ' public IDoubleVector getNext () {', ' ', " // get an array of doubles; we'll put one random number in each slot", ' Doubl...
[]
Variable 'mySeed' used at line 174 is defined at line 173 and has a Short-Range dependency. Variable 'myParams' used at line 175 is defined at line 173 and has a Short-Range dependency. Global_Variable 'params' used at line 175 is defined at line 171 and has a Short-Range dependency.
{}
{'Variable Short-Range': 2, 'Global_Variable Short-Range': 1}
infilling_java
RNGTester
179
181
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' super(prng);', ' params = myParams;', ' }']
['', ' /**', ' * Generate another random object', ' */', ' public IDoubleVector getNext () {', ' ', " // get an array of doubles; we'll put one random number in each slot", ' Double [] myArray = new Double[params.getNumTrials ()];', ' for (int i = 0; i < params.getNumTrials (); i++) {', ' myArray...
[]
Variable 'prng' used at line 179 is defined at line 178 and has a Short-Range dependency. Variable 'myParams' used at line 180 is defined at line 178 and has a Short-Range dependency. Global_Variable 'params' used at line 180 is defined at line 171 and has a Short-Range dependency.
{}
{'Variable Short-Range': 2, 'Global_Variable Short-Range': 1}
infilling_java
RNGTester
191
192
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' myArray[i] = genUniform (0, 1.0); ', ' }']
[' ', ' // now sort them', ' Arrays.sort (myArray);', ' ', ' // get the output result', ' SparseDoubleVector returnVal = new SparseDoubleVector (params.getProbs ().getLength (), 0.0);', ' ', ' try {', ' // now loop through the probs and the observed doubles, and do a merge', ' int curP...
[{'reason_category': 'Loop Body', 'usage_line': 191}, {'reason_category': 'Loop Body', 'usage_line': 192}]
Function 'genUniform' used at line 191 is defined at line 531 and has a Long-Range dependency. Variable 'myArray' used at line 191 is defined at line 189 and has a Short-Range dependency. Variable 'i' used at line 191 is defined at line 190 and has a Short-Range dependency.
{'Loop Body': 2}
{'Function Long-Range': 1, 'Variable Short-Range': 2}
infilling_java
RNGTester
206
208
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' curPosInProbs++;', ' totProbSoFar += params.getProbs ().getItem (curPosInProbs);', ' }']
[' returnVal.setItem (curPosInProbs, returnVal.getItem (curPosInProbs) + 1.0);', ' }', ' return returnVal;', ' } catch (OutOfBoundsException e) {', ' System.err.println ("Somehow, within the multinomial sampler, I went out of bounds as I was contructing the output array");', ' return null;...
[{'reason_category': 'Loop Body', 'usage_line': 206}, {'reason_category': 'Loop Body', 'usage_line': 207}, {'reason_category': 'Loop Body', 'usage_line': 208}]
Variable 'curPosInProbs' used at line 206 is defined at line 202 and has a Short-Range dependency. Global_Variable 'params' used at line 207 is defined at line 171 and has a Long-Range dependency. Function 'getItem' used at line 207 is defined at line 47 and has a Long-Range dependency. Variable 'curPosInProbs' used at...
{'Loop Body': 3}
{'Variable Short-Range': 3, 'Global_Variable Long-Range': 1, 'Function Long-Range': 1}
infilling_java
RNGTester
205
210
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' while (myArray[i] > totProbSoFar) {', ' curPosInProbs++;', ' totProbSoFar += params.getProbs ().getItem (curPosInProbs);', ' }', ' returnVal.setItem (curPosInProbs, returnVal.getItem (curPosInProbs) + 1.0);', ' }']
[' return returnVal;', ' } catch (OutOfBoundsException e) {', ' System.err.println ("Somehow, within the multinomial sampler, I went out of bounds as I was contructing the output array");', ' return null;', ' }', ' }', ' ', '}', '', '/**', ' * This holds a parameterization for the multinomial dis...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 205}, {'reason_category': 'Loop Body', 'usage_line': 205}, {'reason_category': 'Loop Body', 'usage_line': 206}, {'reason_category': 'Loop Body', 'usage_line': 207}, {'reason_category': 'Loop Body', 'usage_line': 208}, {'reason_category': 'Loop Body', 'usage_lin...
Variable 'myArray' used at line 205 is defined at line 189 and has a Medium-Range dependency. Variable 'i' used at line 205 is defined at line 204 and has a Short-Range dependency. Variable 'totProbSoFar' used at line 205 is defined at line 203 and has a Short-Range dependency. Variable 'curPosInProbs' used at line 206...
{'Define Stop Criteria': 1, 'Loop Body': 6}
{'Variable Medium-Range': 2, 'Variable Short-Range': 6, 'Global_Variable Long-Range': 1, 'Function Long-Range': 1}
infilling_java
RNGTester
229
231
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' numTrials = numTrialsIn;', ' probs = probsIn;', ' }']
[' ', ' public int getNumTrials () {', ' return numTrials;', ' }', ' ', ' public IDoubleVector getProbs () {', ' return probs;', ' }', '}', '', '', '/*', ' * This holds a parameterization for the gamma distribution', ' */', 'class GammaParam {', ' ', ' private double shape, scale, leftmostStep;', ' privat...
[]
Variable 'numTrialsIn' used at line 229 is defined at line 228 and has a Short-Range dependency. Global_Variable 'numTrials' used at line 229 is defined at line 225 and has a Short-Range dependency. Variable 'probsIn' used at line 230 is defined at line 228 and has a Short-Range dependency. Global_Variable 'probs' used...
{}
{'Variable Short-Range': 2, 'Global_Variable Short-Range': 2}
infilling_java
RNGTester
234
235
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' return numTrials;', ' }']
[' ', ' public IDoubleVector getProbs () {', ' return probs;', ' }', '}', '', '', '/*', ' * This holds a parameterization for the gamma distribution', ' */', 'class GammaParam {', ' ', ' private double shape, scale, leftmostStep;', ' private int numSteps;', ' ', ' public GammaParam (double shapeIn, double sca...
[]
Global_Variable 'numTrials' used at line 234 is defined at line 225 and has a Short-Range dependency.
{}
{'Global_Variable Short-Range': 1}
infilling_java
RNGTester
238
239
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' return probs;', ' }']
['}', '', '', '/*', ' * This holds a parameterization for the gamma distribution', ' */', 'class GammaParam {', ' ', ' private double shape, scale, leftmostStep;', ' private int numSteps;', ' ', ' public GammaParam (double shapeIn, double scaleIn, double leftmostStepIn, int numStepsIn) {', ' shape = shapeIn;', '...
[]
Global_Variable 'probs' used at line 238 is defined at line 226 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 1}
infilling_java
RNGTester
252
256
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' shape = shapeIn;', ' scale = scaleIn;', ' leftmostStep = leftmostStepIn;', ' numSteps = numStepsIn; ', ' }']
[' ', ' public double getShape () {', ' return shape;', ' }', ' ', ' public double getScale () {', ' return scale;', ' }', ' ', ' public double getLeftmostStep () {', ' return leftmostStep;', ' }', ' ', ' public int getNumSteps () {', ' return numSteps;', ' }', '}', '', '', 'class Gamma extends ...
[]
Variable 'shapeIn' used at line 252 is defined at line 251 and has a Short-Range dependency. Global_Variable 'shape' used at line 252 is defined at line 248 and has a Short-Range dependency. Variable 'scaleIn' used at line 253 is defined at line 251 and has a Short-Range dependency. Global_Variable 'scale' used at line...
{}
{'Variable Short-Range': 4, 'Global_Variable Short-Range': 4}
infilling_java
RNGTester
259
260
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' return shape;', ' }']
[' ', ' public double getScale () {', ' return scale;', ' }', ' ', ' public double getLeftmostStep () {', ' return leftmostStep;', ' }', ' ', ' public int getNumSteps () {', ' return numSteps;', ' }', '}', '', '', 'class Gamma extends ARandomGenerationAlgorithm <Double> {', '', ' /**', ' * Paramete...
[]
Global_Variable 'shape' used at line 259 is defined at line 248 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 1}
infilling_java
RNGTester
263
264
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' return scale;', ' }']
[' ', ' public double getLeftmostStep () {', ' return leftmostStep;', ' }', ' ', ' public int getNumSteps () {', ' return numSteps;', ' }', '}', '', '', 'class Gamma extends ARandomGenerationAlgorithm <Double> {', '', ' /**', ' * Parameters', ' */', ' private GammaParam params;', '', ' long numShapeO...
[]
Global_Variable 'scale' used at line 263 is defined at line 248 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 1}
infilling_java
RNGTester
267
268
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' return leftmostStep;', ' }']
[' ', ' public int getNumSteps () {', ' return numSteps;', ' }', '}', '', '', 'class Gamma extends ARandomGenerationAlgorithm <Double> {', '', ' /**', ' * Parameters', ' */', ' private GammaParam params;', '', ' long numShapeOnesToUse;', ' private UnitGamma gammaShapeOne;', ' private UnitGamma gammaShape...
[]
Global_Variable 'leftmostStep' used at line 267 is defined at line 248 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 1}
infilling_java
RNGTester
271
272
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' return numSteps;', ' }']
['}', '', '', 'class Gamma extends ARandomGenerationAlgorithm <Double> {', '', ' /**', ' * Parameters', ' */', ' private GammaParam params;', '', ' long numShapeOnesToUse;', ' private UnitGamma gammaShapeOne;', ' private UnitGamma gammaShapeLessThanOne;', '', ' public Gamma(IPRNG prng, GammaParam myParams) {'...
[]
Global_Variable 'numSteps' used at line 271 is defined at line 249 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 1}
infilling_java
RNGTester
288
291
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' super (prng);', ' params = myParams;', ' setup ();', ' }']
[' ', ' public Gamma(long mySeed, GammaParam myParams) {', ' super (mySeed);', ' params = myParams;', ' setup ();', ' }', ' ', ' private void setup () {', ' ', ' numShapeOnesToUse = (long) Math.floor(params.getShape());', ' if (numShapeOnesToUse >= 1) {', ' gammaShapeOne = new UnitGamma(getP...
[]
Variable 'prng' used at line 288 is defined at line 287 and has a Short-Range dependency. Variable 'myParams' used at line 289 is defined at line 287 and has a Short-Range dependency. Global_Variable 'params' used at line 289 is defined at line 281 and has a Short-Range dependency. Function 'setup' used at line 290 is ...
{}
{'Variable Short-Range': 2, 'Global_Variable Short-Range': 1, 'Function Short-Range': 1}
infilling_java
RNGTester
294
297
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' super (mySeed);', ' params = myParams;', ' setup ();', ' }']
[' ', ' private void setup () {', ' ', ' numShapeOnesToUse = (long) Math.floor(params.getShape());', ' if (numShapeOnesToUse >= 1) {', ' gammaShapeOne = new UnitGamma(getPRNG(), new GammaParam(1.0, 1.0,', ' params.getLeftmostStep(), ', ' ...
[]
Variable 'mySeed' used at line 294 is defined at line 293 and has a Short-Range dependency. Variable 'myParams' used at line 295 is defined at line 293 and has a Short-Range dependency. Global_Variable 'params' used at line 295 is defined at line 281 and has a Medium-Range dependency. Function 'setup' used at line 296 ...
{}
{'Variable Short-Range': 2, 'Global_Variable Medium-Range': 1, 'Function Short-Range': 1}
infilling_java
RNGTester
303
306
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' gammaShapeOne = new UnitGamma(getPRNG(), new GammaParam(1.0, 1.0,', ' params.getLeftmostStep(), ', ' params.getNumSteps()));', ' }']
[' double leftover = params.getShape() - (double) numShapeOnesToUse;', ' if (leftover > 0.0) {', ' gammaShapeLessThanOne = new UnitGamma(getPRNG(), new GammaParam(leftover, 1.0,', ' params.getLeftmostStep(), ', ' ...
[{'reason_category': 'If Body', 'usage_line': 303}, {'reason_category': 'If Body', 'usage_line': 304}, {'reason_category': 'If Body', 'usage_line': 305}, {'reason_category': 'If Body', 'usage_line': 306}]
Class 'UnitGamma' used at line 303 is defined at line 588 and has a Long-Range dependency. Function 'getPRNG' used at line 303 is defined at line 508 and has a Long-Range dependency. Class 'GammaParam' used at line 303 is defined at line 246 and has a Long-Range dependency. Global_Variable 'gammaShapeOne' used at line ...
{'If Body': 4}
{'Class Long-Range': 2, 'Function Long-Range': 1, 'Global_Variable Medium-Range': 3}
infilling_java
RNGTester
309
312
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' gammaShapeLessThanOne = new UnitGamma(getPRNG(), new GammaParam(leftover, 1.0,', ' params.getLeftmostStep(), ', ' params.getNumSteps()));', ' }']
[' }', '', ' /**', ' * Generate another random object', ' */', ' public Double getNext () {', ' Double value = 0.0;', ' for (int i = 0; i < numShapeOnesToUse; i++) {', ' value += gammaShapeOne.getNext();', ' }', ' if (gammaShapeLessThanOne != null)', ' value += gammaShapeLessThanOne.getNext...
[{'reason_category': 'If Body', 'usage_line': 309}, {'reason_category': 'If Body', 'usage_line': 310}, {'reason_category': 'If Body', 'usage_line': 311}, {'reason_category': 'If Body', 'usage_line': 312}]
Class 'UnitGamma' used at line 309 is defined at line 588 and has a Long-Range dependency. Function 'getPRNG' used at line 309 is defined at line 508 and has a Long-Range dependency. Class 'GammaParam' used at line 309 is defined at line 246 and has a Long-Range dependency. Variable 'leftover' used at line 309 is defin...
{'If Body': 4}
{'Class Long-Range': 2, 'Function Long-Range': 1, 'Variable Short-Range': 1, 'Global_Variable Medium-Range': 3}
infilling_java
RNGTester
321
322
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' value += gammaShapeOne.getNext();', ' }']
[' if (gammaShapeLessThanOne != null)', ' value += gammaShapeLessThanOne.getNext ();', ' ', ' return value * params.getScale ();', ' }', '', '}', '', '/*', ' * This holds a parameterization for the Dirichlet distribution', ' */', 'class DirichletParam {', ' ', ' private IDoubleVector shapes;', ' privat...
[{'reason_category': 'Loop Body', 'usage_line': 321}, {'reason_category': 'Loop Body', 'usage_line': 322}]
Global_Variable 'gammaShapeOne' used at line 321 is defined at line 284 and has a Long-Range dependency. Variable 'value' used at line 321 is defined at line 319 and has a Short-Range dependency.
{'Loop Body': 2}
{'Global_Variable Long-Range': 1, 'Variable Short-Range': 1}
infilling_java
RNGTester
324
324
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' value += gammaShapeLessThanOne.getNext ();']
[' ', ' return value * params.getScale ();', ' }', '', '}', '', '/*', ' * This holds a parameterization for the Dirichlet distribution', ' */', 'class DirichletParam {', ' ', ' private IDoubleVector shapes;', ' private double leftmostStep;', ' private int numSteps;', ' ', ' public DirichletParam (IDoubleVec...
[{'reason_category': 'If Body', 'usage_line': 324}]
Global_Variable 'gammaShapeLessThanOne' used at line 324 is defined at line 285 and has a Long-Range dependency. Variable 'value' used at line 324 is defined at line 319 and has a Short-Range dependency.
{'If Body': 1}
{'Global_Variable Long-Range': 1, 'Variable Short-Range': 1}
infilling_java
RNGTester
341
344
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' shapes = shapesIn;', ' leftmostStep = leftmostStepIn;', ' numSteps = numStepsIn;', ' }']
[' ', ' public IDoubleVector getShapes () {', ' return shapes;', ' }', ' ', ' public double getLeftmostStep () {', ' return leftmostStep;', ' }', ' ', ' public int getNumSteps () {', ' return numSteps;', ' }', '}', '', '', 'class Dirichlet extends ARandomGenerationAlgorithm <IDoubleVector> {', '', ' ...
[]
Variable 'shapesIn' used at line 341 is defined at line 340 and has a Short-Range dependency. Global_Variable 'shapes' used at line 341 is defined at line 336 and has a Short-Range dependency. Variable 'leftmostStepIn' used at line 342 is defined at line 340 and has a Short-Range dependency. Global_Variable 'leftmostSt...
{}
{'Variable Short-Range': 3, 'Global_Variable Short-Range': 3}
infilling_java
RNGTester
347
348
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' return shapes;', ' }']
[' ', ' public double getLeftmostStep () {', ' return leftmostStep;', ' }', ' ', ' public int getNumSteps () {', ' return numSteps;', ' }', '}', '', '', 'class Dirichlet extends ARandomGenerationAlgorithm <IDoubleVector> {', '', ' /**', ' * Parameters', ' */', ' private DirichletParam params;', '', ' ...
[]
Global_Variable 'shapes' used at line 347 is defined at line 336 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 1}
infilling_java
RNGTester
351
352
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' return leftmostStep;', ' }']
[' ', ' public int getNumSteps () {', ' return numSteps;', ' }', '}', '', '', 'class Dirichlet extends ARandomGenerationAlgorithm <IDoubleVector> {', '', ' /**', ' * Parameters', ' */', ' private DirichletParam params;', '', ' public Dirichlet (long mySeed, DirichletParam myParams) {', ' super (mySeed);...
[]
Global_Variable 'leftmostStep' used at line 351 is defined at line 337 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 1}
infilling_java
RNGTester
355
356
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' return numSteps;', ' }']
['}', '', '', 'class Dirichlet extends ARandomGenerationAlgorithm <IDoubleVector> {', '', ' /**', ' * Parameters', ' */', ' private DirichletParam params;', '', ' public Dirichlet (long mySeed, DirichletParam myParams) {', ' super (mySeed);', ' params = myParams;', ' setup ();', ' }', ' ', ' public D...
[]
Global_Variable 'numSteps' used at line 355 is defined at line 338 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 1}
infilling_java
RNGTester
368
371
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' super (mySeed);', ' params = myParams;', ' setup ();', ' }']
[' ', ' public Dirichlet (IPRNG prng, DirichletParam myParams) {', ' super (prng);', ' params = myParams;', ' setup ();', ' }', ' ', ' /**', ' * List of gammas that compose the Dirichlet', ' */', ' private ArrayList<Gamma> gammas = new ArrayList<Gamma>();', '', ' public void setup () {', '', ' ID...
[]
Variable 'mySeed' used at line 368 is defined at line 367 and has a Short-Range dependency. Variable 'myParams' used at line 369 is defined at line 367 and has a Short-Range dependency. Global_Variable 'params' used at line 369 is defined at line 365 and has a Short-Range dependency. Function 'setup' used at line 370 i...
{}
{'Variable Short-Range': 2, 'Global_Variable Short-Range': 1, 'Function Long-Range': 1}
infilling_java
RNGTester
374
377
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' super (prng);', ' params = myParams;', ' setup ();', ' }']
[' ', ' /**', ' * List of gammas that compose the Dirichlet', ' */', ' private ArrayList<Gamma> gammas = new ArrayList<Gamma>();', '', ' public void setup () {', '', ' IDoubleVector shapes = params.getShapes();', ' int i = 0;', '', ' try {', ' for (; i<shapes.getLength(); i++) {', ' Double ...
[]
Variable 'prng' used at line 374 is defined at line 373 and has a Short-Range dependency. Variable 'myParams' used at line 375 is defined at line 373 and has a Short-Range dependency. Global_Variable 'params' used at line 375 is defined at line 365 and has a Short-Range dependency. Function 'setup' used at line 376 is ...
{}
{'Variable Short-Range': 2, 'Global_Variable Short-Range': 1, 'Function Long-Range': 1}
infilling_java
RNGTester
391
395
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' Double d = shapes.getItem(i);', ' gammas.add(new Gamma(getPRNG(), new GammaParam(d, 1.0, ', ' params.getLeftmostStep(),', ' params.getNumSteps())));', ' }']
[' } catch (OutOfBoundsException e) {', ' System.err.format("Dirichlet constructor Error: out of bounds access (%d) to shapes\\n", i);', ' params = null;', ' gammas = null;', ' return;', ' }', ' }', '', ' /**', ' * Generate another random object', ' */', ' public IDoubleVector getNext (...
[{'reason_category': 'Loop Body', 'usage_line': 391}, {'reason_category': 'Loop Body', 'usage_line': 392}, {'reason_category': 'Loop Body', 'usage_line': 393}, {'reason_category': 'Loop Body', 'usage_line': 394}, {'reason_category': 'Loop Body', 'usage_line': 395}]
Variable 'shapes' used at line 391 is defined at line 386 and has a Short-Range dependency. Variable 'i' used at line 391 is defined at line 387 and has a Short-Range dependency. Global_Variable 'gammas' used at line 392 is defined at line 382 and has a Short-Range dependency. Class 'Gamma' used at line 392 is defined ...
{'Loop Body': 5}
{'Variable Short-Range': 3, 'Global_Variable Short-Range': 1, 'Class Long-Range': 2, 'Function Long-Range': 1, 'Global_Variable Medium-Range': 2}
infilling_java
RNGTester
415
416
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' v.setItem(i++, g.getNext());', ' }']
[' } catch (OutOfBoundsException e) {', ' System.err.format("Dirichlet getNext Error: out of bounds access (%d) to result vector\\n", i);', ' return null;', ' }', '', ' v.normalize();', '', ' return v;', ' }', '', '}', '', '/**', ' * Wrap the Java random number generator.', ' */', '', 'class Chri...
[{'reason_category': 'Loop Body', 'usage_line': 415}, {'reason_category': 'Loop Body', 'usage_line': 416}]
Variable 'v' used at line 415 is defined at line 409 and has a Short-Range dependency. Variable 'i' used at line 415 is defined at line 411 and has a Short-Range dependency. Variable 'g' used at line 415 is defined at line 414 and has a Short-Range dependency.
{'Loop Body': 2}
{'Variable Short-Range': 3}
infilling_java
RNGTester
449
451
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' seedValue = mySeed;', ' X = new BigInteger (seedValue + "");', ' }']
[' ', ' /**', ' * Return the next double value between 0.0 and 1.0', ' */', ' public double next() {', ' X = X.multiply (a).add (c).mod (m);', ' return X.shiftRight (32).intValue () / max + 0.5;', ' }', ' ', ' /**', ' * Reset the PRNG to the original seed', ' */', ' public void startOver() {', ' ...
[]
Variable 'mySeed' used at line 449 is defined at line 448 and has a Short-Range dependency. Global_Variable 'seedValue' used at line 449 is defined at line 438 and has a Medium-Range dependency. Library 'BigInteger' used at line 450 is defined at line 2 and has a Long-Range dependency. Global_Variable 'seedValue' used ...
{}
{'Variable Short-Range': 1, 'Global_Variable Medium-Range': 1, 'Library Long-Range': 1, 'Global_Variable Short-Range': 2}
infilling_java
RNGTester
457
459
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' X = X.multiply (a).add (c).mod (m);', ' return X.shiftRight (32).intValue () / max + 0.5;', ' }']
[' ', ' /**', ' * Reset the PRNG to the original seed', ' */', ' public void startOver() {', ' X = new BigInteger (seedValue + "");', ' }', '}', '', 'class Main {', '', ' public static void main (String [] args) {', ' IPRNG foo = new ChrisPRNG (0);', ' for (int i = 0; i < 10; i++) {', ' ...
[]
Global_Variable 'X' used at line 457 is defined at line 442 and has a Medium-Range dependency. Global_Variable 'a' used at line 457 is defined at line 439 and has a Medium-Range dependency. Global_Variable 'c' used at line 457 is defined at line 440 and has a Medium-Range dependency. Global_Variable 'm' used at line 45...
{}
{'Global_Variable Medium-Range': 5, 'Global_Variable Short-Range': 1}
infilling_java
RNGTester
465
466
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' X = new BigInteger (seedValue + "");', ' }']
['}', '', 'class Main {', '', ' public static void main (String [] args) {', ' IPRNG foo = new ChrisPRNG (0);', ' for (int i = 0; i < 10; i++) {', ' System.out.println (foo.next ());', ' }', ' }', '}', '', '/** ', ' * Encapsulates the idea of a random object generation algorithm. ...
[]
Library 'BigInteger' used at line 465 is defined at line 2 and has a Long-Range dependency. Global_Variable 'seedValue' used at line 465 is defined at line 438 and has a Medium-Range dependency. Global_Variable 'X' used at line 465 is defined at line 442 and has a Medium-Range dependency.
{}
{'Library Long-Range': 1, 'Global_Variable Medium-Range': 2}
infilling_java
RNGTester
472
476
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' IPRNG foo = new ChrisPRNG (0);', ' for (int i = 0; i < 10; i++) {', ' System.out.println (foo.next ());', ' }', ' }']
['}', '', '/** ', ' * Encapsulates the idea of a random object generation algorithm. The random', ' * variable that the algorithm simulates is parameterized using an object of', ' * type InputType. Every concrete class that implements this interface should', ' * have a constructor of the form:', ' * ', ' * ConcreteCl...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 473}, {'reason_category': 'Loop Body', 'usage_line': 474}, {'reason_category': 'Loop Body', 'usage_line': 475}]
Class 'ChrisPRNG' used at line 472 is defined at line 433 and has a Long-Range dependency. Variable 'i' used at line 473 is defined at line 473 and has a Short-Range dependency. Function 'ChrisPRNG.next' used at line 474 is defined at line 456 and has a Medium-Range dependency.
{'Define Stop Criteria': 1, 'Loop Body': 2}
{'Class Long-Range': 1, 'Variable Short-Range': 1, 'Function Medium-Range': 1}
infilling_java
RNGTester
474
475
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' System.out.println (foo.next ());', ' }']
[' }', '}', '', '/** ', ' * Encapsulates the idea of a random object generation algorithm. The random', ' * variable that the algorithm simulates is parameterized using an object of', ' * type InputType. Every concrete class that implements this interface should', ' * have a constructor of the form:', ' * ', ' * C...
[{'reason_category': 'Loop Body', 'usage_line': 474}, {'reason_category': 'Loop Body', 'usage_line': 475}]
Function 'ChrisPRNG.next' used at line 474 is defined at line 456 and has a Medium-Range dependency.
{'Loop Body': 2}
{'Function Medium-Range': 1}
infilling_java
RNGTester
500
501
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' prng = new ChrisPRNG(mySeed); ', ' }']
[' ', ' // this one is called when we want a ARandomGenerationAlgorithm who uses someone elses rng', ' protected ARandomGenerationAlgorithm(IPRNG useMe) {', ' prng = useMe;', ' }', '', ' protected IPRNG getPRNG() {', ' return prng;', ' }', ' ', ' /**', ' * Generate another random object', ' */', ' ab...
[]
Class 'ChrisPRNG' used at line 500 is defined at line 433 and has a Long-Range dependency. Variable 'mySeed' used at line 500 is defined at line 499 and has a Short-Range dependency. Global_Variable 'prng' used at line 500 is defined at line 496 and has a Short-Range dependency.
{}
{'Class Long-Range': 1, 'Variable Short-Range': 1, 'Global_Variable Short-Range': 1}
infilling_java
RNGTester
505
506
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' prng = useMe;', ' }']
['', ' protected IPRNG getPRNG() {', ' return prng;', ' }', ' ', ' /**', ' * Generate another random object', ' */', ' abstract public OutputType getNext ();', ' ', ' /**', ' * Resets the sequence of random objects that are created. The net effect', ' * is that if we create the IRandomGenerationAlgor...
[]
Variable 'useMe' used at line 505 is defined at line 504 and has a Short-Range dependency. Global_Variable 'prng' used at line 505 is defined at line 496 and has a Short-Range dependency.
{}
{'Variable Short-Range': 1, 'Global_Variable Short-Range': 1}
infilling_java
RNGTester
509
510
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' return prng;', ' }']
[' ', ' /**', ' * Generate another random object', ' */', ' abstract public OutputType getNext ();', ' ', ' /**', ' * Resets the sequence of random objects that are created. The net effect', ' * is that if we create the IRandomGenerationAlgorithm object, ', ' * then call getNext a bunch of times, and th...
[]
Global_Variable 'prng' used at line 509 is defined at line 496 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 1}
infilling_java
RNGTester
525
526
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' prng.startOver();', ' }']
['', ' /**', ' * Generate a random number uniformly between low and high', ' */', ' protected double genUniform(double low, double high) {', ' double r = prng.next();', ' r *= high - low;', ' r += low;', ' return r;', ' }', '', '}', '', '', 'class Uniform extends ARandomGenerationAlgorithm <Double> {...
[]
Global_Variable 'prng' used at line 525 is defined at line 496 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 1}
infilling_java
RNGTester
532
536
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' double r = prng.next();', ' r *= high - low;', ' r += low;', ' return r;', ' }']
['', '}', '', '', 'class Uniform extends ARandomGenerationAlgorithm <Double> {', ' ', ' /**', ' * Parameters', ' */', ' private UniformParam params;', '', ' public Uniform(long mySeed, UniformParam myParams) {', ' super(mySeed);', ' params = myParams;', ' }', ' ', ' public Uniform(IPRNG prng, UniformPa...
[]
Global_Variable 'prng' used at line 532 is defined at line 496 and has a Long-Range dependency. Variable 'high' used at line 533 is defined at line 531 and has a Short-Range dependency. Variable 'low' used at line 533 is defined at line 531 and has a Short-Range dependency. Variable 'r' used at line 533 is defined at l...
{}
{'Global_Variable Long-Range': 1, 'Variable Short-Range': 6}
infilling_java
RNGTester
562
563
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' return genUniform(params.getLow(), params.getHigh());', ' }']
[' ', '}', '', '/**', ' * This holds a parameterization for the uniform distribution', ' */', 'class UniformParam {', ' ', ' double low, high;', ' ', ' public UniformParam (double lowIn, double highIn) {', ' low = lowIn;', ' high = highIn;', ' }', ' ', ' public double getLow () {', ' return low;', ' }'...
[]
Function 'genUniform' used at line 562 is defined at line 531 and has a Long-Range dependency. Global_Variable 'params' used at line 562 is defined at line 546 and has a Medium-Range dependency.
{}
{'Function Long-Range': 1, 'Global_Variable Medium-Range': 1}
infilling_java
RNGTester
572
586
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' double low, high;', ' ', ' public UniformParam (double lowIn, double highIn) {', ' low = lowIn;', ' high = highIn;', ' }', ' ', ' public double getLow () {', ' return low;', ' }', ' ', ' public double getHigh () {', ' return high;', ' }', '}']
['', 'class UnitGamma extends ARandomGenerationAlgorithm <Double> {', '', ' /**', ' * Parameters', ' */', ' private GammaParam params;', '', ' private class RejectionSampler {', ' private UniformParam xRegion;', ' private UniformParam yRegion;', ' private double area;', '', ' protected RejectionSampl...
[]
Variable 'lowIn' used at line 575 is defined at line 574 and has a Short-Range dependency. Global_Variable 'low' used at line 575 is defined at line 572 and has a Short-Range dependency. Variable 'highIn' used at line 576 is defined at line 574 and has a Short-Range dependency. Global_Variable 'high' used at line 576 i...
{}
{'Variable Short-Range': 2, 'Global_Variable Short-Range': 3, 'Global_Variable Medium-Range': 1}
infilling_java
RNGTester
575
577
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' low = lowIn;', ' high = highIn;', ' }']
[' ', ' public double getLow () {', ' return low;', ' }', ' ', ' public double getHigh () {', ' return high;', ' }', '}', '', 'class UnitGamma extends ARandomGenerationAlgorithm <Double> {', '', ' /**', ' * Parameters', ' */', ' private GammaParam params;', '', ' private class RejectionSampler {', ' ...
[]
Variable 'lowIn' used at line 575 is defined at line 574 and has a Short-Range dependency. Global_Variable 'low' used at line 575 is defined at line 572 and has a Short-Range dependency. Variable 'highIn' used at line 576 is defined at line 574 and has a Short-Range dependency. Global_Variable 'high' used at line 576 i...
{}
{'Variable Short-Range': 2, 'Global_Variable Short-Range': 2}
infilling_java
RNGTester
580
581
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' return low;', ' }']
[' ', ' public double getHigh () {', ' return high;', ' }', '}', '', 'class UnitGamma extends ARandomGenerationAlgorithm <Double> {', '', ' /**', ' * Parameters', ' */', ' private GammaParam params;', '', ' private class RejectionSampler {', ' private UniformParam xRegion;', ' private UniformParam yR...
[]
Global_Variable 'low' used at line 580 is defined at line 572 and has a Short-Range dependency.
{}
{'Global_Variable Short-Range': 1}
infilling_java
RNGTester
584
585
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' return high;', ' }']
['}', '', 'class UnitGamma extends ARandomGenerationAlgorithm <Double> {', '', ' /**', ' * Parameters', ' */', ' private GammaParam params;', '', ' private class RejectionSampler {', ' private UniformParam xRegion;', ' private UniformParam yRegion;', ' private double area;', '', ' protected Rejection...
[]
Global_Variable 'high' used at line 584 is defined at line 572 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 1}
infilling_java
RNGTester
602
605
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' xRegion = new UniformParam(xmin, xmax);', ' yRegion = new UniformParam(ymin, ymax);', ' area = (xmax - xmin) * (ymax - ymin);', ' }']
['', ' protected Double tryNext() {', ' Double x = genUniform (xRegion.getLow (), xRegion.getHigh ());', ' Double y = genUniform (yRegion.getLow (), yRegion.getHigh ());', ' ', ' if (y <= fofx(x)) {', ' return x;', ' } else {', ' return null;', ' }', ' }', '', ' ...
[]
Class 'UniformParam' used at line 602 is defined at line 570 and has a Long-Range dependency. Variable 'xmin' used at line 602 is defined at line 600 and has a Short-Range dependency. Variable 'xmax' used at line 602 is defined at line 600 and has a Short-Range dependency. Global_Variable 'xRegion' used at line 602 is ...
{}
{'Class Long-Range': 2, 'Variable Short-Range': 8, 'Global_Variable Short-Range': 3}
infilling_java
RNGTester
612
612
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' return x;']
[' } else {', ' return null;', ' }', ' }', '', ' protected double getArea() {', ' return area;', ' }', ' }', ' ', ' /**', ' * Uniform generators', ' */', ' // Samplers for each step', ' private ArrayList<RejectionSampler> samplers = new ArrayList<RejectionSampler>();', '', ' /...
[{'reason_category': 'If Body', 'usage_line': 612}]
Variable 'x' used at line 612 is defined at line 608 and has a Short-Range dependency.
{'If Body': 1}
{'Variable Short-Range': 1}
infilling_java
RNGTester
614
615
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' return null;', ' }']
[' }', '', ' protected double getArea() {', ' return area;', ' }', ' }', ' ', ' /**', ' * Uniform generators', ' */', ' // Samplers for each step', ' private ArrayList<RejectionSampler> samplers = new ArrayList<RejectionSampler>();', '', ' // Total area of all envelopes', ' private double total...
[{'reason_category': 'Else Reasoning', 'usage_line': 614}]
null
{'Else Reasoning': 1}
null
infilling_java
RNGTester
633
635
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' double k = params.getShape();', ' return Math.pow(x, k-1) * Math.exp(-x);', ' }']
['', ' private void setup () {', ' if (params.getShape() > 1.0 || params.getScale () > 1.0000000001 || params.getScale () < .999999999 ) {', ' System.err.println("UnitGamma must have shape <= 1.0 and a scale of one");', ' params = null;', ' samplers = null;', ' return;', ' }', '', ' totalA...
[]
Global_Variable 'params' used at line 633 is defined at line 593 and has a Long-Range dependency. Variable 'x' used at line 634 is defined at line 632 and has a Short-Range dependency. Variable 'k' used at line 634 is defined at line 633 and has a Short-Range dependency.
{}
{'Global_Variable Long-Range': 1, 'Variable Short-Range': 2}
infilling_java
RNGTester
657
660
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' super(prng);', ' params = myParams;', ' setup ();', ' } ']
[' ', ' public UnitGamma(long mySeed, GammaParam myParams) {', ' super(mySeed);', ' params = myParams;', ' setup ();', ' }', '', ' /**', ' * Generate another random object', ' */', ' public Double getNext () {', ' while (true) {', ' double step = genUniform(0.0, totalArea);', ' double are...
[]
Variable 'prng' used at line 657 is defined at line 656 and has a Short-Range dependency. Variable 'myParams' used at line 658 is defined at line 656 and has a Short-Range dependency. Global_Variable 'params' used at line 658 is defined at line 593 and has a Long-Range dependency. Function 'setup' used at line 659 is d...
{}
{'Variable Short-Range': 2, 'Global_Variable Long-Range': 1, 'Function Medium-Range': 1}
infilling_java
RNGTester
676
685
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' area += s.getArea();', ' if (area >= step) {', ' // Found the right sampler', ' Double x = s.tryNext();', ' if (x != null) {', ' return x;', ' }', ' break;', ' }', ' }']
[' }', ' }', '}', '', '', '/**', ' * A JUnit test case class.', ' * Every method starting with the word "test" will be called when running', ' * the test with JUnit.', ' */', 'public class RNGTester extends TestCase {', ' ', ' ', ' // checks to see if two values are close enough', ' private void checkCloseEnoug...
[{'reason_category': 'Loop Body', 'usage_line': 676}, {'reason_category': 'If Condition', 'usage_line': 677}, {'reason_category': 'Loop Body', 'usage_line': 677}, {'reason_category': 'Loop Body', 'usage_line': 678}, {'reason_category': 'If Body', 'usage_line': 678}, {'reason_category': 'Loop Body', 'usage_line': 679}, ...
Variable 's' used at line 676 is defined at line 675 and has a Short-Range dependency. Variable 'area' used at line 676 is defined at line 674 and has a Short-Range dependency. Variable 'area' used at line 677 is defined at line 676 and has a Short-Range dependency. Variable 'step' used at line 677 is defined at line 6...
{'Loop Body': 10, 'If Condition': 2, 'If Body': 6}
{'Variable Short-Range': 7}
infilling_java
RNGTester
679
684
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' Double x = s.tryNext();', ' if (x != null) {', ' return x;', ' }', ' break;', ' }']
[' }', ' }', ' }', '}', '', '', '/**', ' * A JUnit test case class.', ' * Every method starting with the word "test" will be called when running', ' * the test with JUnit.', ' */', 'public class RNGTester extends TestCase {', ' ', ' ', ' // checks to see if two values are close enough', ' private void chec...
[{'reason_category': 'Loop Body', 'usage_line': 679}, {'reason_category': 'If Body', 'usage_line': 679}, {'reason_category': 'If Condition', 'usage_line': 680}, {'reason_category': 'Loop Body', 'usage_line': 680}, {'reason_category': 'If Body', 'usage_line': 680}, {'reason_category': 'If Body', 'usage_line': 681}, {'re...
Variable 's' used at line 679 is defined at line 675 and has a Short-Range dependency. Variable 'x' used at line 680 is defined at line 679 and has a Short-Range dependency. Variable 'x' used at line 681 is defined at line 679 and has a Short-Range dependency.
{'Loop Body': 6, 'If Body': 5, 'If Condition': 1}
{'Variable Short-Range': 3}
infilling_java
RNGTester
681
681
['import junit.framework.TestCase;', 'import java.math.BigInteger;', 'import java.util.ArrayList;', 'import java.util.Arrays;', 'import java.util.Random;', 'import java.util.ArrayList;', '', '/**', ' * Interface to a pseudo random number generator that generates', ' * numbers between 0.0 and 1.0 and can start over to r...
[' return x;']
[' }', ' break;', ' }', ' }', ' }', ' }', '}', '', '', '/**', ' * A JUnit test case class.', ' * Every method starting with the word "test" will be called when running', ' * the test with JUnit.', ' */', 'public class RNGTester extends TestCase {', ' ', ' ', ' // checks to see if tw...
[{'reason_category': 'If Body', 'usage_line': 681}, {'reason_category': 'Loop Body', 'usage_line': 681}]
Variable 'x' used at line 681 is defined at line 679 and has a Short-Range dependency.
{'If Body': 1, 'Loop Body': 1}
{'Variable Short-Range': 1}
infilling_java
TopKTester
167
169
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' return (!(left.getHeight () - right.getHeight () >= 2 ||', ' left.getHeight () - right.getHeight () <= -2));', ' }']
[' ', ' Data <T> getVal () {', ' return val; ', ' }', ' ', ' AVLNode <T> removeBig () {', ' AVLNode <T> newRight = right.removeBig ();', ' if (newRight == null) {', ' return left; ', ' } else {', ' right = newRight;', ' setHeight ();', ' ', ' // if we are not balanced, the RHS...
[]
Global_Variable 'left' used at line 167 is defined at line 136 and has a Long-Range dependency. Global_Variable 'right' used at line 167 is defined at line 137 and has a Medium-Range dependency. Global_Variable 'left' used at line 168 is defined at line 136 and has a Long-Range dependency. Global_Variable 'right' used ...
{}
{'Global_Variable Long-Range': 3, 'Global_Variable Medium-Range': 1}
infilling_java
TopKTester
190
196
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' AVLNode <T> oldLeft = left;', ' AVLNode <T> oldRight = right;', ' left = oldLeft.getLeft ();', ' right = new Occupied <T> (val, oldLeft.getRight (), right);', ' val = oldLeft.getVal ();', ' setHeight ();', ' }']
[' ', ' return this;', ' }', ' }', ' ', ' AVLNode <T> getLeft () {', ' return left;', ' }', ' ', ' AVLNode <T> getRight () {', ' return right;', ' }', ' ', ' void setHeight () {', ' ', ' int one = left.getHeight ();', ' int other = right.getHeight ();', ' if (one > other)', ' ...
[{'reason_category': 'Else Reasoning', 'usage_line': 190}, {'reason_category': 'If Body', 'usage_line': 190}, {'reason_category': 'Else Reasoning', 'usage_line': 191}, {'reason_category': 'If Body', 'usage_line': 191}, {'reason_category': 'Else Reasoning', 'usage_line': 192}, {'reason_category': 'If Body', 'usage_line'...
Class 'AVLNode' used at line 190 is defined at line 28 and has a Long-Range dependency. Global_Variable 'left' used at line 190 is defined at line 136 and has a Long-Range dependency. Class 'AVLNode' used at line 191 is defined at line 28 and has a Long-Range dependency. Global_Variable 'right' used at line 191 is defi...
{'Else Reasoning': 7, 'If Body': 7}
{'Class Long-Range': 3, 'Global_Variable Long-Range': 4, 'Global_Variable Medium-Range': 2, 'Variable Short-Range': 3, 'Function Long-Range': 1}
infilling_java
TopKTester
215
215
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' height = one;']
[' else', ' height = other;', ' height++;', ' }', ' ', ' int getHeight () {', ' return height; ', ' }', ' ', ' void raiseLeft () {', ' ', ' // make sure we are left deep first', ' left.makeLeftDeep ();', ' ', ' // and then balance the thing', ' AVLNode <T> oldLeft = left;', ' AVL...
[{'reason_category': 'If Body', 'usage_line': 215}]
Variable 'one' used at line 215 is defined at line 212 and has a Short-Range dependency. Global_Variable 'height' used at line 215 is defined at line 139 and has a Long-Range dependency.
{'If Body': 1}
{'Variable Short-Range': 1, 'Global_Variable Long-Range': 1}
infilling_java
TopKTester
217
217
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' height = other;']
[' height++;', ' }', ' ', ' int getHeight () {', ' return height; ', ' }', ' ', ' void raiseLeft () {', ' ', ' // make sure we are left deep first', ' left.makeLeftDeep ();', ' ', ' // and then balance the thing', ' AVLNode <T> oldLeft = left;', ' AVLNode <T> oldRight = right;', ' lef...
[{'reason_category': 'Else Reasoning', 'usage_line': 217}]
Variable 'other' used at line 217 is defined at line 213 and has a Short-Range dependency. Global_Variable 'height' used at line 217 is defined at line 215 and has a Short-Range dependency.
{'Else Reasoning': 1}
{'Variable Short-Range': 1, 'Global_Variable Short-Range': 1}
infilling_java
TopKTester
212
219
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' int one = left.getHeight ();', ' int other = right.getHeight ();', ' if (one > other)', ' height = one;', ' else', ' height = other;', ' height++;', ' }']
[' ', ' int getHeight () {', ' return height; ', ' }', ' ', ' void raiseLeft () {', ' ', ' // make sure we are left deep first', ' left.makeLeftDeep ();', ' ', ' // and then balance the thing', ' AVLNode <T> oldLeft = left;', ' AVLNode <T> oldRight = right;', ' left = oldLeft.getLeft ();'...
[{'reason_category': 'If Condition', 'usage_line': 214}, {'reason_category': 'If Body', 'usage_line': 215}, {'reason_category': 'Else Reasoning', 'usage_line': 216}, {'reason_category': 'Else Reasoning', 'usage_line': 217}]
Global_Variable 'left' used at line 212 is defined at line 136 and has a Long-Range dependency. Global_Variable 'right' used at line 213 is defined at line 137 and has a Long-Range dependency. Variable 'one' used at line 214 is defined at line 212 and has a Short-Range dependency. Variable 'other' used at line 214 is d...
{'If Condition': 1, 'If Body': 1, 'Else Reasoning': 2}
{'Global_Variable Long-Range': 3, 'Variable Short-Range': 4, 'Global_Variable Short-Range': 2}
infilling_java
TopKTester
233
237
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' left = oldLeft.getLeft ();', ' right = new Occupied <T> (val, oldLeft.getRight (), right);', ' val = oldLeft.getVal ();', ' setHeight ();', ' }']
[' ', ' void raiseRight () {', ' ', ' // make sure we are right deep first', ' right.makeRightDeep ();', ' ', ' // and then balance the thing', ' AVLNode <T> oldLeft = left;', ' AVLNode <T> oldRight = right;', ' left = new Occupied <T> (val, oldLeft, oldRight.getLeft ());', ' right = oldRig...
[]
Variable 'oldLeft' used at line 233 is defined at line 231 and has a Short-Range dependency. Global_Variable 'left' used at line 233 is defined at line 136 and has a Long-Range dependency. Class 'Occupied' used at line 234 is defined at line 134 and has a Long-Range dependency. Global_Variable 'val' used at line 234 is...
{}
{'Variable Short-Range': 3, 'Global_Variable Long-Range': 4, 'Class Long-Range': 1, 'Function Medium-Range': 1}
infilling_java
TopKTester
235
237
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' val = oldLeft.getVal ();', ' setHeight ();', ' }']
[' ', ' void raiseRight () {', ' ', ' // make sure we are right deep first', ' right.makeRightDeep ();', ' ', ' // and then balance the thing', ' AVLNode <T> oldLeft = left;', ' AVLNode <T> oldRight = right;', ' left = new Occupied <T> (val, oldLeft, oldRight.getLeft ());', ' right = oldRig...
[]
Variable 'oldLeft' used at line 235 is defined at line 231 and has a Short-Range dependency. Global_Variable 'val' used at line 235 is defined at line 138 and has a Long-Range dependency. Function 'setHeight' used at line 236 is defined at line 210 and has a Medium-Range dependency.
{}
{'Variable Short-Range': 1, 'Global_Variable Long-Range': 1, 'Function Medium-Range': 1}
infilling_java
TopKTester
247
251
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' left = new Occupied <T> (val, oldLeft, oldRight.getLeft ());', ' right = oldRight.getRight ();', ' val = oldRight.getVal ();', ' setHeight ();', ' }']
[' ', ' void makeLeftDeep () {', ' ', ' if (left.getHeight () >= right.getHeight ())', ' return;', ' ', ' AVLNode <T> oldLeft = left;', ' AVLNode <T> oldRight = right;', ' left = new Occupied <T> (val, oldLeft, oldRight.getLeft ());', ' right = oldRight.getRight ();', ' val = oldRight.get...
[]
Class 'Occupied' used at line 247 is defined at line 134 and has a Long-Range dependency. Global_Variable 'val' used at line 247 is defined at line 138 and has a Long-Range dependency. Variable 'oldLeft' used at line 247 is defined at line 245 and has a Short-Range dependency. Variable 'oldRight' used at line 247 is de...
{}
{'Class Long-Range': 1, 'Global_Variable Long-Range': 4, 'Variable Short-Range': 4, 'Function Long-Range': 1}
infilling_java
TopKTester
271
277
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' AVLNode <T> oldLeft = left;', ' AVLNode <T> oldRight = right;', ' left = oldLeft.getLeft ();', ' right = new Occupied <T> (val, oldLeft.getRight (), oldRight);', ' val = oldLeft.getVal ();', ' setHeight ();', ' }']
[' ', ' ', ' Occupied (Data <T> valIn, AVLNode <T> leftIn, AVLNode <T> rightIn) {', ' val = valIn;', ' left = leftIn;', ' right = rightIn;', ' setHeight ();', ' }', ' ', ' AVLNode <T> insert (double myKey, T myVal) {', ' ', ' if (myKey <= val.getScore ()) {', ' left = left.insert (myKey, m...
[]
Class 'AVLNode' used at line 271 is defined at line 28 and has a Long-Range dependency. Global_Variable 'left' used at line 271 is defined at line 136 and has a Long-Range dependency. Class 'AVLNode' used at line 272 is defined at line 28 and has a Long-Range dependency. Global_Variable 'right' used at line 272 is defi...
{}
{'Class Long-Range': 3, 'Global_Variable Long-Range': 6, 'Variable Short-Range': 4, 'Function Long-Range': 1}
infilling_java
TopKTester
281
285
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' val = valIn;', ' left = leftIn;', ' right = rightIn;', ' setHeight ();', ' }']
[' ', ' AVLNode <T> insert (double myKey, T myVal) {', ' ', ' if (myKey <= val.getScore ()) {', ' left = left.insert (myKey, myVal); ', ' } else {', ' right = right.insert (myKey, myVal); ', ' }', ' ', ' if (left.getHeight () - right.getHeight () > 1)', ' raiseLeft ();', ' else if...
[]
Variable 'valIn' used at line 281 is defined at line 280 and has a Short-Range dependency. Global_Variable 'val' used at line 281 is defined at line 138 and has a Long-Range dependency. Variable 'leftIn' used at line 282 is defined at line 280 and has a Short-Range dependency. Global_Variable 'left' used at line 282 is...
{}
{'Variable Short-Range': 3, 'Global_Variable Long-Range': 3, 'Function Long-Range': 1}
infilling_java
TopKTester
290
290
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' left = left.insert (myKey, myVal); ']
[' } else {', ' right = right.insert (myKey, myVal); ', ' }', ' ', ' if (left.getHeight () - right.getHeight () > 1)', ' raiseLeft ();', ' else if (right.getHeight () - left.getHeight () > 1)', ' raiseRight ();', ' ', ' setHeight ();', ' return this;', ' }', '}', '', 'class Chris...
[{'reason_category': 'If Body', 'usage_line': 290}]
Global_Variable 'left' used at line 290 is defined at line 136 and has a Long-Range dependency. Variable 'myKey' used at line 290 is defined at line 287 and has a Short-Range dependency. Variable 'myVal' used at line 290 is defined at line 287 and has a Short-Range dependency.
{'If Body': 1}
{'Global_Variable Long-Range': 1, 'Variable Short-Range': 2}
infilling_java
TopKTester
292
293
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' right = right.insert (myKey, myVal); ', ' }']
[' ', ' if (left.getHeight () - right.getHeight () > 1)', ' raiseLeft ();', ' else if (right.getHeight () - left.getHeight () > 1)', ' raiseRight ();', ' ', ' setHeight ();', ' return this;', ' }', '}', '', 'class ChrisAVLTree <T> {', '', ' AVLNode <T> root = new EmptyNode <T> ();', ' ', ...
[{'reason_category': 'Else Reasoning', 'usage_line': 292}, {'reason_category': 'Else Reasoning', 'usage_line': 293}]
Global_Variable 'right' used at line 292 is defined at line 137 and has a Long-Range dependency. Variable 'myKey' used at line 292 is defined at line 287 and has a Short-Range dependency. Variable 'myVal' used at line 292 is defined at line 287 and has a Short-Range dependency.
{'Else Reasoning': 2}
{'Global_Variable Long-Range': 1, 'Variable Short-Range': 2}
infilling_java
TopKTester
296
296
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' raiseLeft ();']
[' else if (right.getHeight () - left.getHeight () > 1)', ' raiseRight ();', ' ', ' setHeight ();', ' return this;', ' }', '}', '', 'class ChrisAVLTree <T> {', '', ' AVLNode <T> root = new EmptyNode <T> ();', ' ', ' void insert (double val, T insertMe) {', ' root = root.insert (val, insertMe);',...
[{'reason_category': 'If Body', 'usage_line': 296}]
Function 'raiseLeft' used at line 296 is defined at line 225 and has a Long-Range dependency.
{'If Body': 1}
{'Function Long-Range': 1}
infilling_java
TopKTester
298
298
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' raiseRight ();']
[' ', ' setHeight ();', ' return this;', ' }', '}', '', 'class ChrisAVLTree <T> {', '', ' AVLNode <T> root = new EmptyNode <T> ();', ' ', ' void insert (double val, T insertMe) {', ' root = root.insert (val, insertMe);', ' }', ' ', ' public ArrayList <T> toList () {', ' ArrayList <T> temp = new Ar...
[{'reason_category': 'Elif Body', 'usage_line': 298}]
Function 'raiseRight' used at line 298 is defined at line 239 and has a Long-Range dependency.
{'Elif Body': 1}
{'Function Long-Range': 1}
infilling_java
TopKTester
300
302
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' setHeight ();', ' return this;', ' }']
['}', '', 'class ChrisAVLTree <T> {', '', ' AVLNode <T> root = new EmptyNode <T> ();', ' ', ' void insert (double val, T insertMe) {', ' root = root.insert (val, insertMe);', ' }', ' ', ' public ArrayList <T> toList () {', ' ArrayList <T> temp = new ArrayList <T> ();', ' root.toList (temp);', ' return...
[]
Function 'setHeight' used at line 300 is defined at line 210 and has a Long-Range dependency.
{}
{'Function Long-Range': 1}
infilling_java
TopKTester
314
317
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' ArrayList <T> temp = new ArrayList <T> ();', ' root.toList (temp);', ' return temp;', ' }']
[' ', ' void removeBig () {', ' root = root.removeBig ();', ' }', ' ', ' public double getBig () {', ' return root.getBig (); ', ' }', ' ', ' String print () {', ' return root.print ();', ' }', ' ', ' void checkBalanced () {', ' root.checkBalanced ();', ' }', '} ', '', '', '// this little class...
[]
Global_Variable 'root' used at line 315 is defined at line 307 and has a Short-Range dependency. Variable 'temp' used at line 315 is defined at line 314 and has a Short-Range dependency. Variable 'temp' used at line 316 is defined at line 314 and has a Short-Range dependency.
{}
{'Global_Variable Short-Range': 1, 'Variable Short-Range': 2}
infilling_java
TopKTester
320
321
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' root = root.removeBig ();', ' }']
[' ', ' public double getBig () {', ' return root.getBig (); ', ' }', ' ', ' String print () {', ' return root.print ();', ' }', ' ', ' void checkBalanced () {', ' root.checkBalanced ();', ' }', '} ', '', '', '// this little class processes a printed version of a BST to see if it is balanced', '// en...
[]
Global_Variable 'root' used at line 320 is defined at line 307 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 1}
infilling_java
TopKTester
353
353
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' startPos++;']
[' ', ' // this is the depth at the left', ' int leftDepth = -1;', ' ', ' // and the depth at the right', ' int rightDepth = -1;', ' ', ' // now, find where the number of parens on each side is equal', ' int lParens = 0;', ' int rParens = 0;', ' for (int i = startPos + 1; i < checkMe.le...
[{'reason_category': 'Loop Body', 'usage_line': 353}]
Variable 'startPos' used at line 353 is defined at line 351 and has a Short-Range dependency.
{'Loop Body': 1}
{'Variable Short-Range': 1}
infilling_java
TopKTester
368
368
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' lParens++;']
[" else if (checkMe.charAt (i) == ')')", ' rParens++;', ' ', ' // if the number of ) and ( are equal', ' if (lParens == rParens && lParens > 0) {', ' ', ' // in this case, we just completed the left tree', ' if (leftDepth == -1) {', ' leftDepth = checkHeight (che...
[{'reason_category': 'If Body', 'usage_line': 368}, {'reason_category': 'Loop Body', 'usage_line': 368}]
Variable 'lParens' used at line 368 is defined at line 362 and has a Short-Range dependency.
{'If Body': 1, 'Loop Body': 1}
{'Variable Short-Range': 1}
infilling_java
TopKTester
370
370
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' rParens++;']
[' ', ' // if the number of ) and ( are equal', ' if (lParens == rParens && lParens > 0) {', ' ', ' // in this case, we just completed the left tree', ' if (leftDepth == -1) {', ' leftDepth = checkHeight (checkMe.substring (startPos + 1, i + 1));', ' startPos = i + ...
[{'reason_category': 'Loop Body', 'usage_line': 370}, {'reason_category': 'Elif Body', 'usage_line': 370}]
Variable 'rParens' used at line 370 is defined at line 363 and has a Short-Range dependency.
{'Loop Body': 1, 'Elif Body': 1}
{'Variable Short-Range': 1}
infilling_java
TopKTester
377
380
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' leftDepth = checkHeight (checkMe.substring (startPos + 1, i + 1));', ' startPos = i + 1;', ' lParens = 0;', ' rParens = 0;']
[' ', ' // in this case, we just completed the right tree', ' } else {', ' rightDepth = checkHeight (checkMe.substring (startPos + 1, i + 1));', ' startPos = i + 1;', ' break;', ' }', ' }', ' }', ' ', ' // check to see if this is not a valid AVL tre...
[{'reason_category': 'Loop Body', 'usage_line': 377}, {'reason_category': 'If Body', 'usage_line': 377}, {'reason_category': 'Loop Body', 'usage_line': 378}, {'reason_category': 'If Body', 'usage_line': 378}, {'reason_category': 'Loop Body', 'usage_line': 379}, {'reason_category': 'If Body', 'usage_line': 379}, {'reaso...
Function 'checkHeight' used at line 377 is defined at line 348 and has a Medium-Range dependency. Variable 'checkMe' used at line 377 is defined at line 348 and has a Medium-Range dependency. Variable 'startPos' used at line 377 is defined at line 351 and has a Medium-Range dependency. Variable 'i' used at line 377 is ...
{'Loop Body': 4, 'If Body': 4}
{'Function Medium-Range': 1, 'Variable Medium-Range': 8}
infilling_java
TopKTester
384
387
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' rightDepth = checkHeight (checkMe.substring (startPos + 1, i + 1));', ' startPos = i + 1;', ' break;', ' }']
[' }', ' }', ' ', ' // check to see if this is not a valid AVL tree', ' if (leftDepth - rightDepth >= 2 || leftDepth - rightDepth <= -2)', ' throw new RuntimeException ("this tree is not balanced! Left: " + leftDepth + " Right: " + rightDepth);', ' ', ' // search for the closing )', " whi...
[{'reason_category': 'Loop Body', 'usage_line': 384}, {'reason_category': 'Else Reasoning', 'usage_line': 384}, {'reason_category': 'Loop Body', 'usage_line': 385}, {'reason_category': 'Else Reasoning', 'usage_line': 385}, {'reason_category': 'Loop Body', 'usage_line': 386}, {'reason_category': 'Else Reasoning', 'usage...
Function 'checkHeight' used at line 384 is defined at line 348 and has a Long-Range dependency. Variable 'checkMe' used at line 384 is defined at line 348 and has a Long-Range dependency. Variable 'startPos' used at line 384 is defined at line 378 and has a Short-Range dependency. Variable 'i' used at line 384 is defin...
{'Loop Body': 4, 'Else Reasoning': 4}
{'Function Long-Range': 1, 'Variable Long-Range': 1, 'Variable Short-Range': 2, 'Variable Medium-Range': 3}
infilling_java
TopKTester
376
388
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' if (leftDepth == -1) {', ' leftDepth = checkHeight (checkMe.substring (startPos + 1, i + 1));', ' startPos = i + 1;', ' lParens = 0;', ' rParens = 0;', ' ', ' // in this case, we just completed the right tree', ' } else {', ' rightDepth = che...
[' }', ' ', ' // check to see if this is not a valid AVL tree', ' if (leftDepth - rightDepth >= 2 || leftDepth - rightDepth <= -2)', ' throw new RuntimeException ("this tree is not balanced! Left: " + leftDepth + " Right: " + rightDepth);', ' ', ' // search for the closing )', " while (checkMe...
[{'reason_category': 'Loop Body', 'usage_line': 376}, {'reason_category': 'If Body', 'usage_line': 376}, {'reason_category': 'If Condition', 'usage_line': 376}, {'reason_category': 'Loop Body', 'usage_line': 377}, {'reason_category': 'If Body', 'usage_line': 377}, {'reason_category': 'Loop Body', 'usage_line': 378}, {'...
Variable 'leftDepth' used at line 376 is defined at line 356 and has a Medium-Range dependency. Function 'checkHeight' used at line 377 is defined at line 348 and has a Medium-Range dependency. Variable 'checkMe' used at line 377 is defined at line 348 and has a Medium-Range dependency. Variable 'startPos' used at line...
{'Loop Body': 13, 'If Body': 5, 'If Condition': 1, 'Else Reasoning': 5}
{'Variable Medium-Range': 12, 'Function Medium-Range': 1, 'Function Long-Range': 1, 'Variable Long-Range': 1, 'Variable Short-Range': 2}
infilling_java
TopKTester
397
397
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' startPos++;']
[' ', ' // and we are outta here', ' if (leftDepth > rightDepth)', ' return leftDepth + 1;', ' else', ' return rightDepth + 1;', ' ', ' }', ' ', ' ', '}', '', 'class AVLTopKMachine <T> implements ITopKMachine <T> {', ' ', ' private int spaceLeft;', ' private ChrisAVLTree <T> myTree = new C...
[{'reason_category': 'Loop Body', 'usage_line': 397}]
Variable 'startPos' used at line 397 is defined at line 351 and has a Long-Range dependency.
{'Loop Body': 1}
{'Variable Long-Range': 1}
infilling_java
TopKTester
401
401
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' return leftDepth + 1;']
[' else', ' return rightDepth + 1;', ' ', ' }', ' ', ' ', '}', '', 'class AVLTopKMachine <T> implements ITopKMachine <T> {', ' ', ' private int spaceLeft;', ' private ChrisAVLTree <T> myTree = new ChrisAVLTree <T> ();', ' private double cutoff = Double.POSITIVE_INFINITY;', ' ', ' public AVLTopKMachin...
[{'reason_category': 'If Body', 'usage_line': 401}]
Variable 'leftDepth' used at line 401 is defined at line 356 and has a Long-Range dependency.
{'If Body': 1}
{'Variable Long-Range': 1}
infilling_java
TopKTester
403
403
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' return rightDepth + 1;']
[' ', ' }', ' ', ' ', '}', '', 'class AVLTopKMachine <T> implements ITopKMachine <T> {', ' ', ' private int spaceLeft;', ' private ChrisAVLTree <T> myTree = new ChrisAVLTree <T> ();', ' private double cutoff = Double.POSITIVE_INFINITY;', ' ', ' public AVLTopKMachine (int kIn) {', ' if (kIn < 0)', ' t...
[{'reason_category': 'Else Reasoning', 'usage_line': 403}]
Variable 'rightDepth' used at line 403 is defined at line 359 and has a Long-Range dependency.
{'Else Reasoning': 1}
{'Variable Long-Range': 1}
infilling_java
TopKTester
426
430
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' myTree.insert (score, value);', ' spaceLeft--;', ' if (spaceLeft == 0)', ' cutoff = myTree.getBig ();', ' }']
[' ', ' if (spaceLeft < 0) {', ' myTree.removeBig ();', ' cutoff = myTree.getBig ();', ' spaceLeft++;', ' }', ' ', ' ', ' }', ' ', ' public double getCurrentCutoff () {', ' return cutoff; ', ' }', ' ', ' public String toString () {', ' return myTree.print (); ', ' }', ' ', ...
[{'reason_category': 'If Body', 'usage_line': 426}, {'reason_category': 'If Body', 'usage_line': 427}, {'reason_category': 'If Condition', 'usage_line': 428}, {'reason_category': 'If Body', 'usage_line': 428}, {'reason_category': 'If Body', 'usage_line': 429}, {'reason_category': 'If Body', 'usage_line': 430}]
Global_Variable 'myTree' used at line 426 is defined at line 413 and has a Medium-Range dependency. Variable 'score' used at line 426 is defined at line 424 and has a Short-Range dependency. Variable 'value' used at line 426 is defined at line 424 and has a Short-Range dependency. Global_Variable 'spaceLeft' used at li...
{'If Body': 5, 'If Condition': 1}
{'Global_Variable Medium-Range': 5, 'Variable Short-Range': 2}
infilling_java
TopKTester
429
429
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' cutoff = myTree.getBig ();']
[' }', ' ', ' if (spaceLeft < 0) {', ' myTree.removeBig ();', ' cutoff = myTree.getBig ();', ' spaceLeft++;', ' }', ' ', ' ', ' }', ' ', ' public double getCurrentCutoff () {', ' return cutoff; ', ' }', ' ', ' public String toString () {', ' return myTree.print (); ', ' }...
[{'reason_category': 'If Body', 'usage_line': 429}]
Global_Variable 'myTree' used at line 429 is defined at line 413 and has a Medium-Range dependency. Global_Variable 'cutoff' used at line 429 is defined at line 414 and has a Medium-Range dependency.
{'If Body': 1}
{'Global_Variable Medium-Range': 2}
infilling_java
TopKTester
433
436
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' myTree.removeBig ();', ' cutoff = myTree.getBig ();', ' spaceLeft++;', ' }']
[' ', ' ', ' }', ' ', ' public double getCurrentCutoff () {', ' return cutoff; ', ' }', ' ', ' public String toString () {', ' return myTree.print (); ', ' }', ' ', ' public ArrayList <T> getTopK () {', ' return myTree.toList (); ', ' }', ' ', ' ', '}', '', '', '/**', ' * A JUnit test case ...
[{'reason_category': 'If Body', 'usage_line': 433}, {'reason_category': 'If Body', 'usage_line': 434}, {'reason_category': 'If Body', 'usage_line': 435}, {'reason_category': 'If Body', 'usage_line': 436}]
Global_Variable 'myTree' used at line 433 is defined at line 413 and has a Medium-Range dependency. Global_Variable 'myTree' used at line 434 is defined at line 413 and has a Medium-Range dependency. Global_Variable 'cutoff' used at line 434 is defined at line 429 and has a Short-Range dependency. Global_Variable 'spac...
{'If Body': 4}
{'Global_Variable Medium-Range': 3, 'Global_Variable Short-Range': 1}
infilling_java
TopKTester
442
443
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' return cutoff; ', ' }']
[' ', ' public String toString () {', ' return myTree.print (); ', ' }', ' ', ' public ArrayList <T> getTopK () {', ' return myTree.toList (); ', ' }', ' ', ' ', '}', '', '', '/**', ' * A JUnit test case class.', ' * Every method starting with the word "test" will be called when running', ' * the test wi...
[]
Global_Variable 'cutoff' used at line 442 is defined at line 414 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 1}
infilling_java
TopKTester
450
451
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' return myTree.toList (); ', ' }']
[' ', ' ', '}', '', '', '/**', ' * A JUnit test case class.', ' * Every method starting with the word "test" will be called when running', ' * the test with JUnit.', ' */', 'public class TopKTester extends TestCase {', ' ', ' // this simple method randomly shuffles the items in an array', ' Random shuffler = new R...
[]
Global_Variable 'myTree' used at line 450 is defined at line 413 and has a Long-Range dependency.
{}
{'Global_Variable Long-Range': 1}
infilling_java
TopKTester
468
472
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' Integer pos = i + shuffler.nextInt (list.length - i);', ' Integer temp = list[i];', ' list[i] = list[pos];', ' list[pos] = temp;', ' }']
[' }', ' ', ' // the first param is the number of inserts to try. The second is k. If the third param is true, ', ' // then we do a random order of inserts. If the third param is false, then we do inserts in order,', ' // and the method expects a fourth boolean param that tells us whether we do reverse or forwar...
[{'reason_category': 'Loop Body', 'usage_line': 468}, {'reason_category': 'Loop Body', 'usage_line': 469}, {'reason_category': 'Loop Body', 'usage_line': 470}, {'reason_category': 'Loop Body', 'usage_line': 471}, {'reason_category': 'Loop Body', 'usage_line': 472}]
Variable 'i' used at line 468 is defined at line 467 and has a Short-Range dependency. Global_Variable 'shuffler' used at line 468 is defined at line 465 and has a Short-Range dependency. Variable 'list' used at line 468 is defined at line 466 and has a Short-Range dependency. Variable 'list' used at line 469 is define...
{'Loop Body': 5}
{'Variable Short-Range': 10, 'Global_Variable Short-Range': 1}
infilling_java
TopKTester
487
487
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' reverseOrNot = controlTest[1];']
[' ', ' // create a list of random ints', ' ITopKMachine <Integer> testMe = new AVLTopKMachine <Integer> (k);', ' Integer [] list = new Integer [numInserts];', ' for (int i = 0; i < numInserts; i++) {', ' if (reverseOrNot)', ' list[i] = numInserts - 1 - i;', ' else', ' list[i] = i...
[{'reason_category': 'If Body', 'usage_line': 487}]
Variable 'controlTest' used at line 487 is defined at line 481 and has a Short-Range dependency. Variable 'reverseOrNot' used at line 487 is defined at line 484 and has a Short-Range dependency.
{'If Body': 1}
{'Variable Short-Range': 2}
infilling_java
TopKTester
494
494
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' list[i] = numInserts - 1 - i;']
[' else', ' list[i] = i; ', ' }', ' ', ' // if we are looking for randomness, shuffle the list', ' if (randomOrNot)', ' shuffle (list);', ' ', ' // now add the ints', ' for (int j = 0; j < list.length; j++) {', ' ', ' Integer i = list[j];', ' testMe.insert (i * 1.343...
[{'reason_category': 'If Body', 'usage_line': 494}, {'reason_category': 'Loop Body', 'usage_line': 494}]
Variable 'numInserts' used at line 494 is defined at line 481 and has a Medium-Range dependency. Variable 'i' used at line 494 is defined at line 492 and has a Short-Range dependency. Variable 'list' used at line 494 is defined at line 491 and has a Short-Range dependency.
{'If Body': 1, 'Loop Body': 1}
{'Variable Medium-Range': 1, 'Variable Short-Range': 2}
infilling_java
TopKTester
501
501
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' shuffle (list);']
[' ', ' // now add the ints', ' for (int j = 0; j < list.length; j++) {', ' ', ' Integer i = list[j];', ' testMe.insert (i * 1.343432, i);', ' ', ' // if we are not random, check to see that the cutoff is correct', ' if (!randomOrNot) {', ' ', ' double score = testMe...
[{'reason_category': 'If Body', 'usage_line': 501}]
Function 'shuffle' used at line 501 is defined at line 466 and has a Long-Range dependency. Variable 'list' used at line 501 is defined at line 491 and has a Short-Range dependency.
{'If Body': 1}
{'Function Long-Range': 1, 'Variable Short-Range': 1}
infilling_java
TopKTester
541
541
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' k = numInserts;']
[' ', ' // make sure the list is the right size', ' assertEquals (retVal.size (), k);', ' ', ' // and check its contents', ' for (int i = 0; i < k; i++) {', ' assertEquals ("when checking values returned getting top k", i, (int) retVal.get (i));', ' }', ' }', ' ', ' // this checks for balan...
[{'reason_category': 'If Body', 'usage_line': 541}]
Variable 'numInserts' used at line 541 is defined at line 481 and has a Long-Range dependency. Variable 'k' used at line 541 is defined at line 481 and has a Long-Range dependency.
{'If Body': 1}
{'Variable Long-Range': 2}
infilling_java
TopKTester
559
559
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' reverseOrNot = controlTest[1];']
[' ', ' // create a list of random ints', ' ITopKMachine <Integer> testMe = new AVLTopKMachine <Integer> (k);', ' Integer [] list = new Integer [numInserts];', ' for (int i = 0; i < numInserts; i++) {', ' if (reverseOrNot)', ' list[i] = numInserts - 1 - i;', ' else', ' list[i] = i...
[{'reason_category': 'If Body', 'usage_line': 559}]
Variable 'controlTest' used at line 559 is defined at line 553 and has a Short-Range dependency. Variable 'reverseOrNot' used at line 559 is defined at line 556 and has a Short-Range dependency.
{'If Body': 1}
{'Variable Short-Range': 2}
infilling_java
TopKTester
566
566
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' list[i] = numInserts - 1 - i;']
[' else', ' list[i] = i; ', ' }', ' ', ' // if we are looking for randomness, shuffle the list', ' if (randomOrNot)', ' shuffle (list);', ' ', ' // now add the ints', ' for (int j = 0; j < list.length; j++) { ', ' Integer i = list[j];', ' testMe.insert (i * 1.343432, i);'...
[{'reason_category': 'Loop Body', 'usage_line': 566}, {'reason_category': 'If Body', 'usage_line': 566}]
Variable 'numInserts' used at line 566 is defined at line 553 and has a Medium-Range dependency. Variable 'i' used at line 566 is defined at line 564 and has a Short-Range dependency. Variable 'list' used at line 566 is defined at line 563 and has a Short-Range dependency.
{'Loop Body': 1, 'If Body': 1}
{'Variable Medium-Range': 1, 'Variable Short-Range': 2}
infilling_java
TopKTester
568
568
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' list[i] = i; ']
[' }', ' ', ' // if we are looking for randomness, shuffle the list', ' if (randomOrNot)', ' shuffle (list);', ' ', ' // now add the ints', ' for (int j = 0; j < list.length; j++) { ', ' Integer i = list[j];', ' testMe.insert (i * 1.343432, i);', ' ', ' // and check for bal...
[{'reason_category': 'Else Reasoning', 'usage_line': 568}, {'reason_category': 'Loop Body', 'usage_line': 568}]
Variable 'i' used at line 568 is defined at line 564 and has a Short-Range dependency. Variable 'list' used at line 568 is defined at line 566 and has a Short-Range dependency.
{'Else Reasoning': 1, 'Loop Body': 1}
{'Variable Short-Range': 2}
infilling_java
TopKTester
573
573
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.Collections;', 'import java.util.ArrayList;', '', '// This simple interface allows us to get the top K objects out of a large set', '// (that is, the K objects that are inserted having the **lowest** score vales)', '// The idea is that y...
[' shuffle (list);']
[' ', ' // now add the ints', ' for (int j = 0; j < list.length; j++) { ', ' Integer i = list[j];', ' testMe.insert (i * 1.343432, i);', ' ', ' // and check for balance', ' if (j % 10 == 0) {', ' IsBalanced temp = new IsBalanced ();', ' try {', ' temp.checkHeight...
[{'reason_category': 'If Loop', 'usage_line': 573}]
Function 'shuffle' used at line 573 is defined at line 466 and has a Long-Range dependency. Variable 'list' used at line 573 is defined at line 563 and has a Short-Range dependency.
{}
{'Function Long-Range': 1, 'Variable Short-Range': 1}
infilling_java
SparseArrayTester
58
62
['import junit.framework.TestCase;', 'import java.util.Calendar;', 'import java.util.*;', '', '', '/**', ' * An interface to an indexed element with an integer index into its', ' * enclosing container and data of parameterized type T.', ' */', 'interface IIndexedData<T> {', ' /**', ' * Get index of this item.', ' ...
[' this.curIdx = -1;', ' this.numElements = numElements;', ' this.indices = indices;', ' this.data = data;', ' }']
['', ' public boolean hasNext() {', ' return (curIdx+1) < numElements;', ' }', '', ' public IndexedData<T> next() {', ' curIdx++;', ' return new IndexedData<T> (indices[curIdx], data.get(curIdx));', ' }', ' ', ' public void remove() throws UnsupportedOperationException {', ' ...
[]
Global_Variable 'curIdx' used at line 58 is defined at line 52 and has a Short-Range dependency. Variable 'numElements' used at line 59 is defined at line 57 and has a Short-Range dependency. Global_Variable 'numElements' used at line 59 is defined at line 53 and has a Short-Range dependency. Variable 'indices' used at...
{}
{'Global_Variable Short-Range': 4, 'Variable Short-Range': 3}
infilling_java
SparseArrayTester
65
66
['import junit.framework.TestCase;', 'import java.util.Calendar;', 'import java.util.*;', '', '', '/**', ' * An interface to an indexed element with an integer index into its', ' * enclosing container and data of parameterized type T.', ' */', 'interface IIndexedData<T> {', ' /**', ' * Get index of this item.', ' ...
[' return (curIdx+1) < numElements;', ' }']
['', ' public IndexedData<T> next() {', ' curIdx++;', ' return new IndexedData<T> (indices[curIdx], data.get(curIdx));', ' }', ' ', ' public void remove() throws UnsupportedOperationException {', ' throw new UnsupportedOperationException();', ' }', '}', '', 'class LinearSparseArray<T...
[]
Global_Variable 'curIdx' used at line 65 is defined at line 52 and has a Medium-Range dependency. Global_Variable 'numElements' used at line 65 is defined at line 53 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 2}
infilling_java
SparseArrayTester
69
71
['import junit.framework.TestCase;', 'import java.util.Calendar;', 'import java.util.*;', '', '', '/**', ' * An interface to an indexed element with an integer index into its', ' * enclosing container and data of parameterized type T.', ' */', 'interface IIndexedData<T> {', ' /**', ' * Get index of this item.', ' ...
[' curIdx++;', ' return new IndexedData<T> (indices[curIdx], data.get(curIdx));', ' }']
[' ', ' public void remove() throws UnsupportedOperationException {', ' throw new UnsupportedOperationException();', ' }', '}', '', 'class LinearSparseArray<T> implements ISparseArray<T> {', ' private int [] indices;', ' private Vector <T> data;', ' private int numElements;', ' private int lastSlot;...
[]
Global_Variable 'curIdx' used at line 69 is defined at line 52 and has a Medium-Range dependency. Global_Variable 'indices' used at line 70 is defined at line 54 and has a Medium-Range dependency. Global_Variable 'curIdx' used at line 70 is defined at line 69 and has a Short-Range dependency. Global_Variable 'data' use...
{}
{'Global_Variable Medium-Range': 3, 'Global_Variable Short-Range': 1}
infilling_java
SparseArrayTester
74
75
['import junit.framework.TestCase;', 'import java.util.Calendar;', 'import java.util.*;', '', '', '/**', ' * An interface to an indexed element with an integer index into its', ' * enclosing container and data of parameterized type T.', ' */', 'interface IIndexedData<T> {', ' /**', ' * Get index of this item.', ' ...
[' throw new UnsupportedOperationException();', ' }']
['}', '', 'class LinearSparseArray<T> implements ISparseArray<T> {', ' private int [] indices;', ' private Vector <T> data;', ' private int numElements;', ' private int lastSlot;', ' private int lastSlotReturned;', '', ' private void doubleCapacity () {', ' data.ensureCapacity (lastSlot * 2);', ' int [] temp ...
[]
null
{}
null
infilling_java
SparseArrayTester
89
90
['import junit.framework.TestCase;', 'import java.util.Calendar;', 'import java.util.*;', '', '', '/**', ' * An interface to an indexed element with an integer index into its', ' * enclosing container and data of parameterized type T.', ' */', 'interface IIndexedData<T> {', ' /**', ' * Get index of this item.', ' ...
[' temp[i] = indices[i]; ', ' }']
[' indices = temp;', ' lastSlot *= 2;', ' }', ' ', ' public LinearIndexedIterator<T> iterator () {', ' return new LinearIndexedIterator<T> (indices, data, numElements);', ' }', ' ', ' public LinearSparseArray(int initialSize) {', ' indices = new int[initialSize];', ' data = new Vector<T> (init...
[{'reason_category': 'Loop Body', 'usage_line': 89}, {'reason_category': 'Loop Body', 'usage_line': 90}]
Global_Variable 'indices' used at line 89 is defined at line 79 and has a Short-Range dependency. Variable 'i' used at line 89 is defined at line 88 and has a Short-Range dependency. Variable 'temp' used at line 89 is defined at line 87 and has a Short-Range dependency.
{'Loop Body': 2}
{'Global_Variable Short-Range': 1, 'Variable Short-Range': 2}
infilling_java
SparseArrayTester
86
93
['import junit.framework.TestCase;', 'import java.util.Calendar;', 'import java.util.*;', '', '', '/**', ' * An interface to an indexed element with an integer index into its', ' * enclosing container and data of parameterized type T.', ' */', 'interface IIndexedData<T> {', ' /**', ' * Get index of this item.', ' ...
[' data.ensureCapacity (lastSlot * 2);', ' int [] temp = new int [lastSlot * 2];', ' for (int i = 0; i < numElements; i++) {', ' temp[i] = indices[i]; ', ' }', ' indices = temp;', ' lastSlot *= 2;', ' }']
[' ', ' public LinearIndexedIterator<T> iterator () {', ' return new LinearIndexedIterator<T> (indices, data, numElements);', ' }', ' ', ' public LinearSparseArray(int initialSize) {', ' indices = new int[initialSize];', ' data = new Vector<T> (initialSize);', ' numElements = 0;', ' lastS...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 88}, {'reason_category': 'Loop Body', 'usage_line': 89}, {'reason_category': 'Loop Body', 'usage_line': 90}]
Global_Variable 'data' used at line 86 is defined at line 80 and has a Short-Range dependency. Global_Variable 'lastSlot' used at line 86 is defined at line 82 and has a Short-Range dependency. Global_Variable 'lastSlot' used at line 87 is defined at line 82 and has a Short-Range dependency. Variable 'i' used at line 8...
{'Define Stop Criteria': 1, 'Loop Body': 2}
{'Global_Variable Short-Range': 6, 'Variable Short-Range': 4, 'Global_Variable Medium-Range': 1}
infilling_java
SparseArrayTester
111
113
['import junit.framework.TestCase;', 'import java.util.Calendar;', 'import java.util.*;', '', '', '/**', ' * An interface to an indexed element with an integer index into its', ' * enclosing container and data of parameterized type T.', ' */', 'interface IIndexedData<T> {', ' /**', ' * Get index of this item.', ' ...
[' data.add (element);', ' indices[numElements] = position;', ' ']
[" // if the one ew are adding is not the largest, can't just append", ' } else {', '', ' // first check to see if we have data at that position', ' for (int i = 0; i < numElements; i++) {', ' if (indices[i] == position) {', ' data.setElementAt (element, i);', ' return;', ' ...
[{'reason_category': 'If Body', 'usage_line': 111}, {'reason_category': 'If Body', 'usage_line': 112}, {'reason_category': 'If Body', 'usage_line': 113}]
Global_Variable 'data' used at line 111 is defined at line 80 and has a Long-Range dependency. Variable 'element' used at line 111 is defined at line 107 and has a Short-Range dependency. Variable 'position' used at line 112 is defined at line 107 and has a Short-Range dependency. Global_Variable 'indices' used at line...
{'If Body': 3}
{'Global_Variable Long-Range': 3, 'Variable Short-Range': 2}
infilling_java
SparseArrayTester
120
122
['import junit.framework.TestCase;', 'import java.util.Calendar;', 'import java.util.*;', '', '', '/**', ' * An interface to an indexed element with an integer index into its', ' * enclosing container and data of parameterized type T.', ' */', 'interface IIndexedData<T> {', ' /**', ' * Get index of this item.', ' ...
[' data.setElementAt (element, i);', ' return;', ' }']
[' }', ' ', ' // if we made it here, there is no data at the position', ' int pos;', ' for (pos = numElements; pos > 0 && indices[pos - 1] > position; pos--) {', ' indices[pos] = indices[pos - 1];', ' }', ' indices[pos] = position;', ' data.add (pos, element);', ' }', '...
[{'reason_category': 'Else Reasoning', 'usage_line': 120}, {'reason_category': 'Loop Body', 'usage_line': 120}, {'reason_category': 'If Body', 'usage_line': 120}, {'reason_category': 'Else Reasoning', 'usage_line': 121}, {'reason_category': 'Loop Body', 'usage_line': 121}, {'reason_category': 'If Body', 'usage_line': 1...
Global_Variable 'data' used at line 120 is defined at line 80 and has a Long-Range dependency. Variable 'element' used at line 120 is defined at line 107 and has a Medium-Range dependency. Variable 'i' used at line 120 is defined at line 118 and has a Short-Range dependency.
{'Else Reasoning': 3, 'Loop Body': 3, 'If Body': 3}
{'Global_Variable Long-Range': 1, 'Variable Medium-Range': 1, 'Variable Short-Range': 1}
infilling_java
SparseArrayTester
128
129
['import junit.framework.TestCase;', 'import java.util.Calendar;', 'import java.util.*;', '', '', '/**', ' * An interface to an indexed element with an integer index into its', ' * enclosing container and data of parameterized type T.', ' */', 'interface IIndexedData<T> {', ' /**', ' * Get index of this item.', ' ...
[' indices[pos] = indices[pos - 1];', ' }']
[' indices[pos] = position;', ' data.add (pos, element);', ' }', ' ', ' numElements++;', ' if (numElements == lastSlot) ', ' doubleCapacity ();', ' }', '', ' public T get (int position) {', '', ' // first we find an index value that is less than or equal to the position we want', ' fo...
[{'reason_category': 'Else Reasoning', 'usage_line': 128}, {'reason_category': 'Loop Body', 'usage_line': 128}, {'reason_category': 'Else Reasoning', 'usage_line': 129}, {'reason_category': 'Loop Body', 'usage_line': 129}]
Global_Variable 'indices' used at line 128 is defined at line 112 and has a Medium-Range dependency. Variable 'pos' used at line 128 is defined at line 127 and has a Short-Range dependency.
{'Else Reasoning': 2, 'Loop Body': 2}
{'Global_Variable Medium-Range': 1, 'Variable Short-Range': 1}
infilling_java
SparseArrayTester
136
137
['import junit.framework.TestCase;', 'import java.util.Calendar;', 'import java.util.*;', '', '', '/**', ' * An interface to an indexed element with an integer index into its', ' * enclosing container and data of parameterized type T.', ' */', 'interface IIndexedData<T> {', ' /**', ' * Get index of this item.', ' ...
[' doubleCapacity ();', ' }']
['', ' public T get (int position) {', '', ' // first we find an index value that is less than or equal to the position we want', ' for (; lastSlotReturned >= 0 && indices[lastSlotReturned] >= position; lastSlotReturned--);', ' ', ' // now we go up, and find the first one that is bigger than what we want', '...
[{'reason_category': 'If Body', 'usage_line': 136}]
Function 'doubleCapacity' used at line 136 is defined at line 85 and has a Long-Range dependency.
{'If Body': 1}
{'Function Long-Range': 1}