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
SparseArrayTester
142
142
['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.', ' ...
[' for (; lastSlotReturned >= 0 && indices[lastSlotReturned] >= position; lastSlotReturned--);']
[' ', ' // now we go up, and find the first one that is bigger than what we want', ' for (; lastSlotReturned + 1 < numElements && indices[lastSlotReturned + 1] <= position; lastSlotReturned++);', ' ', ' // now there are three cases... if we are at position -1, then we have a very small guy', ' if (lastSlo...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 142}]
Global_Variable 'lastSlotReturned' used at line 142 is defined at line 83 and has a Long-Range dependency. Global_Variable 'indices' used at line 142 is defined at line 79 and has a Long-Range dependency. Variable 'position' used at line 142 is defined at line 139 and has a Short-Range dependency.
{'Define Stop Criteria': 1}
{'Global_Variable Long-Range': 2, 'Variable Short-Range': 1}
infilling_java
SparseArrayTester
145
145
['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.', ' ...
[' for (; lastSlotReturned + 1 < numElements && indices[lastSlotReturned + 1] <= position; lastSlotReturned++);']
[' ', ' // now there are three cases... if we are at position -1, then we have a very small guy', ' if (lastSlotReturned == -1)', ' return null;', ' ', " // if the guy where we are is less than what we want, we didn't find it", ' if (indices[lastSlotReturned] != position)', ' return null;', ' '...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 145}]
Global_Variable 'lastSlotReturned' used at line 145 is defined at line 83 and has a Long-Range dependency. Global_Variable 'numElements' used at line 145 is defined at line 81 and has a Long-Range dependency. Global_Variable 'indices' used at line 145 is defined at line 79 and has a Long-Range dependency. Variable 'pos...
{'Define Stop Criteria': 1}
{'Global_Variable Long-Range': 3, 'Variable Short-Range': 1}
infilling_java
SparseArrayTester
149
149
['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 null;']
[' ', " // if the guy where we are is less than what we want, we didn't find it", ' if (indices[lastSlotReturned] != position)', ' return null;', ' ', ' // otherwise, we got it!', ' return data.get(lastSlotReturned);', ' }', '}', '', 'class TreeSparseArray<T> implements ISparseArray<T> {', ' privat...
[{'reason_category': 'If Body', 'usage_line': 149}]
null
{'If Body': 1}
null
infilling_java
SparseArrayTester
153
153
['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 null;']
[' ', ' // otherwise, we got it!', ' return data.get(lastSlotReturned);', ' }', '}', '', 'class TreeSparseArray<T> implements ISparseArray<T> {', ' private TreeMap<Integer, T> array;', '', ' public TreeSparseArray() {', ' array = new TreeMap<Integer, T>();', ' }', '', ' public void put (int position, T...
[{'reason_category': 'If Body', 'usage_line': 153}]
null
{'If Body': 1}
null
infilling_java
SparseArrayTester
152
153
['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.', ' ...
[' if (indices[lastSlotReturned] != position)', ' return null;']
[' ', ' // otherwise, we got it!', ' return data.get(lastSlotReturned);', ' }', '}', '', 'class TreeSparseArray<T> implements ISparseArray<T> {', ' private TreeMap<Integer, T> array;', '', ' public TreeSparseArray() {', ' array = new TreeMap<Integer, T>();', ' }', '', ' public void put (int position, T...
[{'reason_category': 'If Condition', 'usage_line': 152}, {'reason_category': 'If Body', 'usage_line': 153}]
Global_Variable 'indices' used at line 152 is defined at line 79 and has a Long-Range dependency. Global_Variable 'lastSlotReturned' used at line 152 is defined at line 83 and has a Long-Range dependency. Variable 'position' used at line 152 is defined at line 139 and has a Medium-Range dependency.
{'If Condition': 1, 'If Body': 1}
{'Global_Variable Long-Range': 2, 'Variable Medium-Range': 1}
infilling_java
SparseArrayTester
164
165
['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.', ' ...
[' array = new TreeMap<Integer, T>();', ' }']
['', ' public void put (int position, T element) {', ' array.put(position, element);', ' }', '', ' public T get (int position) {', ' return array.get(position);', ' }', '', ' public IndexedIterator<T> iterator () {', ' return new IndexedIterator<T> (array);', ' }', '}', '', '/**', ' * A JUnit test ...
[]
Global_Variable 'array' used at line 164 is defined at line 161 and has a Short-Range dependency.
{}
{'Global_Variable Short-Range': 1}
infilling_java
SparseArrayTester
168
169
['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.', ' ...
[' array.put(position, element);', ' }']
['', ' public T get (int position) {', ' return array.get(position);', ' }', '', ' public IndexedIterator<T> iterator () {', ' return new IndexedIterator<T> (array);', ' }', '}', '', '/**', ' * A JUnit test case class.', ' * Every method starting with the word "test" will be called when running', ' * the ...
[]
Global_Variable 'array' used at line 168 is defined at line 161 and has a Short-Range dependency. Variable 'position' used at line 168 is defined at line 167 and has a Short-Range dependency. Variable 'element' used at line 168 is defined at line 167 and has a Short-Range dependency.
{}
{'Global_Variable Short-Range': 1, 'Variable Short-Range': 2}
infilling_java
SparseArrayTester
172
173
['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 array.get(position);', ' }']
['', ' public IndexedIterator<T> iterator () {', ' return new IndexedIterator<T> (array);', ' }', '}', '', '/**', ' * A JUnit test case class.', ' * Every method starting with the word "test" will be called when running', ' * the test with JUnit.', ' */', 'public class SparseArrayTester extends TestCase {', ' '...
[]
Global_Variable 'array' used at line 172 is defined at line 161 and has a Medium-Range dependency. Variable 'position' used at line 172 is defined at line 171 and has a Short-Range dependency.
{}
{'Global_Variable Medium-Range': 1, 'Variable Short-Range': 1}
infilling_java
SparseArrayTester
176
177
['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 new IndexedIterator<T> (array);', ' }']
['}', '', '/**', ' * A JUnit test case class.', ' * Every method starting with the word "test" will be called when running', ' * the test with JUnit.', ' */', 'public class SparseArrayTester extends TestCase {', ' ', ' /**', ' * Checks to see if an observed value is close enough to the expected value', ' */', ' ...
[]
Global_Variable 'array' used at line 176 is defined at line 161 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 1}
infilling_java
DoubleMatrixTester
258
262
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' IDoubleVector myRow = myData.get (row);', ' if (myRow != null) {', ' returnVal.setItem (row, myRow.getItem (i));', ' }', ' }']
[' return returnVal;', ' }', ' ', ' protected void setRowABS (int j, IDoubleVector setToMe) throws OutOfBoundsException {', ' if (j >= numRows || j < 0 || setToMe.getLength () != numCols)', ' throw new OutOfBoundsException ("row out of bounds in setRowABS");', ' myData.put (j, setToMe);', ' }', ' ', ...
[{'reason_category': 'Loop Body', 'usage_line': 258}, {'reason_category': 'If Condition', 'usage_line': 259}, {'reason_category': 'Loop Body', 'usage_line': 259}, {'reason_category': 'If Body', 'usage_line': 260}, {'reason_category': 'Loop Body', 'usage_line': 260}, {'reason_category': 'If Body', 'usage_line': 261}, {'...
Global_Variable 'myData' used at line 258 is defined at line 226 and has a Long-Range dependency. Variable 'row' used at line 258 is defined at line 257 and has a Short-Range dependency. Variable 'myRow' used at line 259 is defined at line 258 and has a Short-Range dependency. Variable 'returnVal' used at line 260 is d...
{'Loop Body': 5, 'If Condition': 1, 'If Body': 2}
{'Global_Variable Long-Range': 1, 'Variable Short-Range': 6}
infilling_java
DoubleMatrixTester
260
261
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' returnVal.setItem (row, myRow.getItem (i));', ' }']
[' }', ' return returnVal;', ' }', ' ', ' protected void setRowABS (int j, IDoubleVector setToMe) throws OutOfBoundsException {', ' if (j >= numRows || j < 0 || setToMe.getLength () != numCols)', ' throw new OutOfBoundsException ("row out of bounds in setRowABS");', ' myData.put (j, setToMe);', ' }...
[{'reason_category': 'If Body', 'usage_line': 260}, {'reason_category': 'Loop Body', 'usage_line': 260}, {'reason_category': 'If Body', 'usage_line': 261}, {'reason_category': 'Loop Body', 'usage_line': 261}]
Variable 'returnVal' used at line 260 is defined at line 255 and has a Short-Range dependency. Variable 'row' used at line 260 is defined at line 257 and has a Short-Range dependency. Variable 'myRow' used at line 260 is defined at line 258 and has a Short-Range dependency. Variable 'i' used at line 260 is defined at l...
{'If Body': 2, 'Loop Body': 2}
{'Variable Short-Range': 4}
infilling_java
DoubleMatrixTester
277
283
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' IDoubleVector myRow = myData.get (row);', ' if (myRow == null) {', ' myRow = new SparseDoubleVector (numCols, backValue);', ' myData.put (row, myRow);', ' }', ' myRow.setItem (i, setToMe.getItem (row));', ' } ']
[' }', ' ', ' protected double getEntryABS (int j, int i) throws OutOfBoundsException {', ' if (j >= numRows || j < 0)', ' throw new OutOfBoundsException ("row out of bounds in getEntryABS");', ' if (i >= numCols || i < 0)', ' throw new OutOfBoundsException ("col out of bounds in getEntryABS");', ' ...
[{'reason_category': 'Loop Body', 'usage_line': 277}, {'reason_category': 'Loop Body', 'usage_line': 278}, {'reason_category': 'If Condition', 'usage_line': 278}, {'reason_category': 'Loop Body', 'usage_line': 279}, {'reason_category': 'If Body', 'usage_line': 279}, {'reason_category': 'If Body', 'usage_line': 280}, {'...
Global_Variable 'myData' used at line 277 is defined at line 226 and has a Long-Range dependency. Variable 'row' used at line 277 is defined at line 276 and has a Short-Range dependency. Variable 'myRow' used at line 278 is defined at line 277 and has a Short-Range dependency. Global_Variable 'numCols' used at line 279...
{'Loop Body': 7, 'If Condition': 1, 'If Body': 3}
{'Global_Variable Long-Range': 4, 'Variable Short-Range': 9}
infilling_java
DoubleMatrixTester
279
281
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' myRow = new SparseDoubleVector (numCols, backValue);', ' myData.put (row, myRow);', ' }']
[' myRow.setItem (i, setToMe.getItem (row));', ' } ', ' }', ' ', ' protected double getEntryABS (int j, int i) throws OutOfBoundsException {', ' if (j >= numRows || j < 0)', ' throw new OutOfBoundsException ("row out of bounds in getEntryABS");', ' if (i >= numCols || i < 0)', ' throw new Out...
[{'reason_category': 'Loop Body', 'usage_line': 279}, {'reason_category': 'If Body', 'usage_line': 279}, {'reason_category': 'If Body', 'usage_line': 280}, {'reason_category': 'Loop Body', 'usage_line': 280}, {'reason_category': 'If Body', 'usage_line': 281}, {'reason_category': 'Loop Body', 'usage_line': 281}]
Global_Variable 'numCols' used at line 279 is defined at line 227 and has a Long-Range dependency. Global_Variable 'backValue' used at line 279 is defined at line 229 and has a Long-Range dependency. Variable 'myRow' used at line 279 is defined at line 277 and has a Short-Range dependency. Global_Variable 'myData' used...
{'Loop Body': 3, 'If Body': 3}
{'Global_Variable Long-Range': 3, 'Variable Short-Range': 3}
infilling_java
DoubleMatrixTester
293
294
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' return backValue; ', ' }']
[' return myRow.getItem (i);', ' }', ' ', ' public IDoubleVector sumRows () {', ' IDoubleVector sum = new DenseDoubleVector (getNumColumns (), 0.0);', ' for (int i = 0; i < getNumRows (); i++) {', ' try {', ' IDoubleVector curRow = getRow (i);', ' curRow.addMyselfToHim (sum);', ' } c...
[{'reason_category': 'If Body', 'usage_line': 293}, {'reason_category': 'If Body', 'usage_line': 294}]
Global_Variable 'backValue' used at line 293 is defined at line 229 and has a Long-Range dependency.
{'If Body': 2}
{'Global_Variable Long-Range': 1}
infilling_java
DoubleMatrixTester
292
296
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' if (myRow == null) {', ' return backValue; ', ' }', ' return myRow.getItem (i);', ' }']
[' ', ' public IDoubleVector sumRows () {', ' IDoubleVector sum = new DenseDoubleVector (getNumColumns (), 0.0);', ' for (int i = 0; i < getNumRows (); i++) {', ' try {', ' IDoubleVector curRow = getRow (i);', ' curRow.addMyselfToHim (sum);', ' } catch (OutOfBoundsException e) {throw new...
[{'reason_category': 'If Condition', 'usage_line': 292}, {'reason_category': 'If Body', 'usage_line': 293}, {'reason_category': 'If Body', 'usage_line': 294}]
Variable 'myRow' used at line 292 is defined at line 291 and has a Short-Range dependency. Global_Variable 'backValue' used at line 293 is defined at line 229 and has a Long-Range dependency. Variable 'myRow' used at line 295 is defined at line 291 and has a Short-Range dependency. Variable 'i' used at line 295 is defi...
{'If Condition': 1, 'If Body': 2}
{'Variable Short-Range': 3, 'Global_Variable Long-Range': 1}
infilling_java
DoubleMatrixTester
327
329
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' myRow = new SparseDoubleVector (numCols, backValue);', ' myData.put (j, myRow);', ' }']
[' myRow.setItem (i, setToMe);', ' }', ' ', ' protected int getNumRowsABS () {', ' return numRows;', ' }', ' ', ' protected int getNumColumnsABS () {', ' return numCols;', ' }', ' ', ' /**', ' * Theare are the various operations that will be implemented in the concrete classes', ' */', ' abstract...
[{'reason_category': 'If Body', 'usage_line': 327}, {'reason_category': 'If Body', 'usage_line': 328}, {'reason_category': 'If Body', 'usage_line': 329}]
Global_Variable 'numCols' used at line 327 is defined at line 227 and has a Long-Range dependency. Global_Variable 'backValue' used at line 327 is defined at line 229 and has a Long-Range dependency. Variable 'myRow' used at line 327 is defined at line 325 and has a Short-Range dependency. Global_Variable 'myData' used...
{'If Body': 3}
{'Global_Variable Long-Range': 3, 'Variable Short-Range': 3}
infilling_java
DoubleMatrixTester
326
331
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' if (myRow == null) {', ' myRow = new SparseDoubleVector (numCols, backValue);', ' myData.put (j, myRow);', ' }', ' myRow.setItem (i, setToMe);', ' }']
[' ', ' protected int getNumRowsABS () {', ' return numRows;', ' }', ' ', ' protected int getNumColumnsABS () {', ' return numCols;', ' }', ' ', ' /**', ' * Theare are the various operations that will be implemented in the concrete classes', ' */', ' abstract public IDoubleVector getRow (int j) throw...
[{'reason_category': 'If Condition', 'usage_line': 326}, {'reason_category': 'If Body', 'usage_line': 327}, {'reason_category': 'If Body', 'usage_line': 328}, {'reason_category': 'If Body', 'usage_line': 329}]
Variable 'myRow' used at line 326 is defined at line 325 and has a Short-Range dependency. Global_Variable 'numCols' used at line 327 is defined at line 227 and has a Long-Range dependency. Global_Variable 'backValue' used at line 327 is defined at line 229 and has a Long-Range dependency. Variable 'myRow' used at line...
{'If Condition': 1, 'If Body': 3}
{'Variable Short-Range': 7, 'Global_Variable Long-Range': 3}
infilling_java
DoubleMatrixTester
334
335
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' return numRows;', ' }']
[' ', ' protected int getNumColumnsABS () {', ' return numCols;', ' }', ' ', ' /**', ' * Theare are the various operations that will be implemented in the concrete classes', ' */', ' abstract public IDoubleVector getRow (int j) throws OutOfBoundsException;', ' abstract public IDoubleVector getColumn (int ...
[]
Global_Variable 'numRows' used at line 334 is defined at line 228 and has a Long-Range dependency.
{}
{'Global_Variable Long-Range': 1}
infilling_java
DoubleMatrixTester
338
339
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' return numCols;', ' }']
[' ', ' /**', ' * Theare are the various operations that will be implemented in the concrete classes', ' */', ' abstract public IDoubleVector getRow (int j) throws OutOfBoundsException;', ' abstract public IDoubleVector getColumn (int i) throws OutOfBoundsException;', ' abstract public void setRow (int j, IDou...
[]
Global_Variable 'numCols' used at line 338 is defined at line 227 and has a Long-Range dependency.
{}
{'Global_Variable Long-Range': 1}
infilling_java
DoubleMatrixTester
358
359
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' super (numCols, numRows, defaultVal); ', ' }']
[' ', ' public IDoubleVector getRow (int j) throws OutOfBoundsException {', ' return getColumnABS (j); ', ' }', ' ', ' public IDoubleVector getColumn (int i) throws OutOfBoundsException {', ' return getRowABS (i); ', ' }', ' ', ' public void setRow (int j, IDoubleVector setToMe) throws OutOfBoundsExcept...
[]
Variable 'numCols' used at line 358 is defined at line 357 and has a Short-Range dependency. Variable 'numRows' used at line 358 is defined at line 357 and has a Short-Range dependency. Variable 'defaultVal' used at line 358 is defined at line 357 and has a Short-Range dependency.
{}
{'Variable Short-Range': 3}
infilling_java
DoubleMatrixTester
362
363
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' return getColumnABS (j); ', ' }']
[' ', ' public IDoubleVector getColumn (int i) throws OutOfBoundsException {', ' return getRowABS (i); ', ' }', ' ', ' public void setRow (int j, IDoubleVector setToMe) throws OutOfBoundsException {', ' setColumnABS (j, setToMe); ', ' }', ' ', ' public void addMyselfToHim (IDoubleMatrix toMe) throws Out...
[]
Function 'getColumnABS' used at line 362 is defined at line 251 and has a Long-Range dependency. Variable 'j' used at line 362 is defined at line 361 and has a Short-Range dependency.
{}
{'Function Long-Range': 1, 'Variable Short-Range': 1}
infilling_java
DoubleMatrixTester
366
367
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' return getRowABS (i); ', ' }']
[' ', ' public void setRow (int j, IDoubleVector setToMe) throws OutOfBoundsException {', ' setColumnABS (j, setToMe); ', ' }', ' ', ' public void addMyselfToHim (IDoubleMatrix toMe) throws OutOfBoundsException {', ' int numCols = getNumColumns ();', ' for (int i = 0; i < numCols; i++) {', ' IDouble...
[]
Function 'getRowABS' used at line 366 is defined at line 240 and has a Long-Range dependency. Variable 'i' used at line 366 is defined at line 365 and has a Short-Range dependency.
{}
{'Function Long-Range': 1, 'Variable Short-Range': 1}
infilling_java
DoubleMatrixTester
370
371
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' setColumnABS (j, setToMe); ', ' }']
[' ', ' public void addMyselfToHim (IDoubleMatrix toMe) throws OutOfBoundsException {', ' int numCols = getNumColumns ();', ' for (int i = 0; i < numCols; i++) {', ' IDoubleVector curCol = getColumn (i);', ' IDoubleVector hisCol = toMe.getColumn (i);', ' curCol.addMyselfToHim (hisCol);', ' t...
[]
Function 'setColumnABS' used at line 370 is defined at line 272 and has a Long-Range dependency. Variable 'j' used at line 370 is defined at line 369 and has a Short-Range dependency. Variable 'setToMe' used at line 370 is defined at line 369 and has a Short-Range dependency.
{}
{'Function Long-Range': 1, 'Variable Short-Range': 2}
infilling_java
DoubleMatrixTester
376
380
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' IDoubleVector curCol = getColumn (i);', ' IDoubleVector hisCol = toMe.getColumn (i);', ' curCol.addMyselfToHim (hisCol);', ' toMe.setColumn (i, hisCol);', ' }']
[' }', ' ', ' public void setColumn (int i, IDoubleVector setToMe) throws OutOfBoundsException {', ' setRowABS (i, setToMe); ', ' }', ' ', ' public double getEntry (int i, int j) throws OutOfBoundsException {', ' return getEntryABS (j, i); ', ' }', ' ', ' public void setEntry (int i, int j, double se...
[{'reason_category': 'Loop Body', 'usage_line': 376}, {'reason_category': 'Loop Body', 'usage_line': 377}, {'reason_category': 'Loop Body', 'usage_line': 378}, {'reason_category': 'Loop Body', 'usage_line': 379}, {'reason_category': 'Loop Body', 'usage_line': 380}]
Function 'getColumn' used at line 376 is defined at line 365 and has a Medium-Range dependency. Variable 'i' used at line 376 is defined at line 375 and has a Short-Range dependency. Variable 'toMe' used at line 377 is defined at line 373 and has a Short-Range dependency. Variable 'i' used at line 377 is defined at lin...
{'Loop Body': 5}
{'Function Medium-Range': 1, 'Variable Short-Range': 8}
infilling_java
DoubleMatrixTester
375
381
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' for (int i = 0; i < numCols; i++) {', ' IDoubleVector curCol = getColumn (i);', ' IDoubleVector hisCol = toMe.getColumn (i);', ' curCol.addMyselfToHim (hisCol);', ' toMe.setColumn (i, hisCol);', ' }', ' }']
[' ', ' public void setColumn (int i, IDoubleVector setToMe) throws OutOfBoundsException {', ' setRowABS (i, setToMe); ', ' }', ' ', ' public double getEntry (int i, int j) throws OutOfBoundsException {', ' return getEntryABS (j, i); ', ' }', ' ', ' public void setEntry (int i, int j, double setToMe) ...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 375}, {'reason_category': 'Loop Body', 'usage_line': 376}, {'reason_category': 'Loop Body', 'usage_line': 377}, {'reason_category': 'Loop Body', 'usage_line': 378}, {'reason_category': 'Loop Body', 'usage_line': 379}, {'reason_category': 'Loop Body', 'usage_lin...
Variable 'i' used at line 375 is defined at line 375 and has a Short-Range dependency. Variable 'numCols' used at line 375 is defined at line 374 and has a Short-Range dependency. Function 'getColumn' used at line 376 is defined at line 365 and has a Medium-Range dependency. Variable 'i' used at line 376 is defined at ...
{'Define Stop Criteria': 1, 'Loop Body': 5}
{'Variable Short-Range': 10, 'Function Medium-Range': 1}
infilling_java
DoubleMatrixTester
384
385
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' setRowABS (i, setToMe); ', ' }']
[' ', ' public double getEntry (int i, int j) throws OutOfBoundsException {', ' return getEntryABS (j, i); ', ' }', ' ', ' public void setEntry (int i, int j, double setToMe) throws OutOfBoundsException {', ' setEntryABS (j, i, setToMe);', ' }', ' ', ' public int getNumRows () {', ' return getNumColum...
[]
Function 'setRowABS' used at line 384 is defined at line 266 and has a Long-Range dependency. Variable 'i' used at line 384 is defined at line 383 and has a Short-Range dependency. Variable 'setToMe' used at line 384 is defined at line 383 and has a Short-Range dependency.
{}
{'Function Long-Range': 1, 'Variable Short-Range': 2}
infilling_java
DoubleMatrixTester
388
389
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' return getEntryABS (j, i); ', ' }']
[' ', ' public void setEntry (int i, int j, double setToMe) throws OutOfBoundsException {', ' setEntryABS (j, i, setToMe);', ' }', ' ', ' public int getNumRows () {', ' return getNumColumnsABS (); ', ' }', ' ', ' public int getNumColumns () {', ' return getNumRowsABS ();', ' }', '}', '', '', 'class R...
[]
Function 'getEntryABS' used at line 388 is defined at line 286 and has a Long-Range dependency. Variable 'j' used at line 388 is defined at line 387 and has a Short-Range dependency. Variable 'i' used at line 388 is defined at line 387 and has a Short-Range dependency.
{}
{'Function Long-Range': 1, 'Variable Short-Range': 2}
infilling_java
DoubleMatrixTester
392
393
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' setEntryABS (j, i, setToMe);', ' }']
[' ', ' public int getNumRows () {', ' return getNumColumnsABS (); ', ' }', ' ', ' public int getNumColumns () {', ' return getNumRowsABS ();', ' }', '}', '', '', 'class RowMajorDoubleMatrix extends ADoubleMatrix {', ' ', ' public RowMajorDoubleMatrix (int numRows, int numCols, double defaultVal) {', ' ...
[]
Function 'setEntryABS' used at line 392 is defined at line 320 and has a Long-Range dependency. Variable 'j' used at line 392 is defined at line 391 and has a Short-Range dependency. Variable 'i' used at line 392 is defined at line 391 and has a Short-Range dependency. Variable 'setToMe' used at line 392 is defined at ...
{}
{'Function Long-Range': 1, 'Variable Short-Range': 3}
infilling_java
DoubleMatrixTester
396
397
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' return getNumColumnsABS (); ', ' }']
[' ', ' public int getNumColumns () {', ' return getNumRowsABS ();', ' }', '}', '', '', 'class RowMajorDoubleMatrix extends ADoubleMatrix {', ' ', ' public RowMajorDoubleMatrix (int numRows, int numCols, double defaultVal) {', ' super (numRows, numCols, defaultVal); ', ' }', ' ', ' public IDoubleVector...
[]
Function 'getNumColumnsABS' used at line 396 is defined at line 337 and has a Long-Range dependency.
{}
{'Function Long-Range': 1}
infilling_java
DoubleMatrixTester
400
401
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' return getNumRowsABS ();', ' }']
['}', '', '', 'class RowMajorDoubleMatrix extends ADoubleMatrix {', ' ', ' public RowMajorDoubleMatrix (int numRows, int numCols, double defaultVal) {', ' super (numRows, numCols, defaultVal); ', ' }', ' ', ' public IDoubleVector getRow (int j) throws OutOfBoundsException {', ' return getRowABS (j); ', '...
[]
Function 'getNumRowsABS' used at line 400 is defined at line 333 and has a Long-Range dependency.
{}
{'Function Long-Range': 1}
infilling_java
DoubleMatrixTester
408
409
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' super (numRows, numCols, defaultVal); ', ' }']
[' ', ' public IDoubleVector getRow (int j) throws OutOfBoundsException {', ' return getRowABS (j); ', ' }', ' ', ' public IDoubleVector getColumn (int i) throws OutOfBoundsException {', ' return getColumnABS (i); ', ' }', ' ', ' public void setRow (int j, IDoubleVector setToMe) throws OutOfBoundsExce...
[]
Variable 'numRows' used at line 408 is defined at line 407 and has a Short-Range dependency. Variable 'numCols' used at line 408 is defined at line 407 and has a Short-Range dependency. Variable 'defaultVal' used at line 408 is defined at line 407 and has a Short-Range dependency.
{}
{'Variable Short-Range': 3}
infilling_java
DoubleMatrixTester
412
413
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' return getRowABS (j); ', ' }']
[' ', ' public IDoubleVector getColumn (int i) throws OutOfBoundsException {', ' return getColumnABS (i); ', ' }', ' ', ' public void setRow (int j, IDoubleVector setToMe) throws OutOfBoundsException {', ' setRowABS (j, setToMe); ', ' }', ' ', ' public void addMyselfToHim (IDoubleMatrix toMe) throws Out...
[]
Function 'getRowABS' used at line 412 is defined at line 240 and has a Long-Range dependency. Variable 'j' used at line 412 is defined at line 411 and has a Short-Range dependency.
{}
{'Function Long-Range': 1, 'Variable Short-Range': 1}
infilling_java
DoubleMatrixTester
416
417
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' return getColumnABS (i); ', ' }']
[' ', ' public void setRow (int j, IDoubleVector setToMe) throws OutOfBoundsException {', ' setRowABS (j, setToMe); ', ' }', ' ', ' public void addMyselfToHim (IDoubleMatrix toMe) throws OutOfBoundsException {', ' int numRows = getNumRows ();', ' for (int i = 0; i < numRows; i++) {', ' IDoubleVector...
[]
Function 'getColumnABS' used at line 416 is defined at line 251 and has a Long-Range dependency. Variable 'i' used at line 416 is defined at line 415 and has a Short-Range dependency.
{}
{'Function Long-Range': 1, 'Variable Short-Range': 1}
infilling_java
DoubleMatrixTester
420
421
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' setRowABS (j, setToMe); ', ' }']
[' ', ' public void addMyselfToHim (IDoubleMatrix toMe) throws OutOfBoundsException {', ' int numRows = getNumRows ();', ' for (int i = 0; i < numRows; i++) {', ' IDoubleVector curRow = getRow (i);', ' IDoubleVector hisRow = toMe.getRow (i);', ' curRow.addMyselfToHim (hisRow);', ' toMe.setRo...
[]
Function 'setRowABS' used at line 420 is defined at line 266 and has a Long-Range dependency. Variable 'j' used at line 420 is defined at line 419 and has a Short-Range dependency. Variable 'setToMe' used at line 420 is defined at line 419 and has a Short-Range dependency.
{}
{'Function Long-Range': 1, 'Variable Short-Range': 2}
infilling_java
DoubleMatrixTester
426
430
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' IDoubleVector curRow = getRow (i);', ' IDoubleVector hisRow = toMe.getRow (i);', ' curRow.addMyselfToHim (hisRow);', ' toMe.setRow (i, hisRow);', ' }']
[' }', ' ', ' public void setColumn (int i, IDoubleVector setToMe) throws OutOfBoundsException {', ' setColumnABS (i, setToMe); ', ' }', ' ', ' public double getEntry (int i, int j) throws OutOfBoundsException {', ' return getEntryABS (i, j); ', ' }', ' ', ' public void setEntry (int i, int j, double...
[{'reason_category': 'Loop Body', 'usage_line': 426}, {'reason_category': 'Loop Body', 'usage_line': 427}, {'reason_category': 'Loop Body', 'usage_line': 428}, {'reason_category': 'Loop Body', 'usage_line': 429}, {'reason_category': 'Loop Body', 'usage_line': 430}]
Function 'getRow' used at line 426 is defined at line 411 and has a Medium-Range dependency. Variable 'i' used at line 426 is defined at line 425 and has a Short-Range dependency. Variable 'toMe' used at line 427 is defined at line 423 and has a Short-Range dependency. Variable 'i' used at line 427 is defined at line 4...
{'Loop Body': 5}
{'Function Medium-Range': 1, 'Variable Short-Range': 8}
infilling_java
DoubleMatrixTester
425
431
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' for (int i = 0; i < numRows; i++) {', ' IDoubleVector curRow = getRow (i);', ' IDoubleVector hisRow = toMe.getRow (i);', ' curRow.addMyselfToHim (hisRow);', ' toMe.setRow (i, hisRow);', ' }', ' }']
[' ', ' public void setColumn (int i, IDoubleVector setToMe) throws OutOfBoundsException {', ' setColumnABS (i, setToMe); ', ' }', ' ', ' public double getEntry (int i, int j) throws OutOfBoundsException {', ' return getEntryABS (i, j); ', ' }', ' ', ' public void setEntry (int i, int j, double setToM...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 425}, {'reason_category': 'Loop Body', 'usage_line': 426}, {'reason_category': 'Loop Body', 'usage_line': 427}, {'reason_category': 'Loop Body', 'usage_line': 428}, {'reason_category': 'Loop Body', 'usage_line': 429}, {'reason_category': 'Loop Body', 'usage_lin...
Variable 'i' used at line 425 is defined at line 425 and has a Short-Range dependency. Variable 'numRows' used at line 425 is defined at line 424 and has a Short-Range dependency. Function 'getRow' used at line 426 is defined at line 411 and has a Medium-Range dependency. Variable 'i' used at line 426 is defined at lin...
{'Define Stop Criteria': 1, 'Loop Body': 5}
{'Variable Short-Range': 10, 'Function Medium-Range': 1}
infilling_java
DoubleMatrixTester
434
435
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' setColumnABS (i, setToMe); ', ' }']
[' ', ' public double getEntry (int i, int j) throws OutOfBoundsException {', ' return getEntryABS (i, j); ', ' }', ' ', ' public void setEntry (int i, int j, double setToMe) throws OutOfBoundsException {', ' setEntryABS (i, j, setToMe);', ' }', ' ', ' public int getNumRows () {', ' return getNumRowsA...
[]
Function 'setColumnABS' used at line 434 is defined at line 272 and has a Long-Range dependency. Variable 'i' used at line 434 is defined at line 433 and has a Short-Range dependency. Variable 'setToMe' used at line 434 is defined at line 433 and has a Short-Range dependency.
{}
{'Function Long-Range': 1, 'Variable Short-Range': 2}
infilling_java
DoubleMatrixTester
438
439
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' return getEntryABS (i, j); ', ' }']
[' ', ' public void setEntry (int i, int j, double setToMe) throws OutOfBoundsException {', ' setEntryABS (i, j, setToMe);', ' }', ' ', ' public int getNumRows () {', ' return getNumRowsABS (); ', ' }', ' ', ' public int getNumColumns () {', ' return getNumColumnsABS ();', ' }', '}', '/**', ' * A JUn...
[]
Function 'getEntryABS' used at line 438 is defined at line 286 and has a Long-Range dependency. Variable 'i' used at line 438 is defined at line 437 and has a Short-Range dependency. Variable 'j' used at line 438 is defined at line 437 and has a Short-Range dependency.
{}
{'Function Long-Range': 1, 'Variable Short-Range': 2}
infilling_java
DoubleMatrixTester
442
443
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' setEntryABS (i, j, setToMe);', ' }']
[' ', ' public int getNumRows () {', ' return getNumRowsABS (); ', ' }', ' ', ' public int getNumColumns () {', ' return getNumColumnsABS ();', ' }', '}', '/**', ' * A JUnit test case class for testing an implementation of an IDoubleMatrix. Every method starting with the word "test" will be called when run...
[]
Function 'setEntryABS' used at line 442 is defined at line 320 and has a Long-Range dependency. Variable 'i' used at line 442 is defined at line 441 and has a Short-Range dependency. Variable 'j' used at line 442 is defined at line 441 and has a Short-Range dependency. Variable 'setToMe' used at line 442 is defined at ...
{}
{'Function Long-Range': 1, 'Variable Short-Range': 3}
infilling_java
DoubleMatrixTester
446
447
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' return getNumRowsABS (); ', ' }']
[' ', ' public int getNumColumns () {', ' return getNumColumnsABS ();', ' }', '}', '/**', ' * A JUnit test case class for testing an implementation of an IDoubleMatrix. Every method starting with the word "test" will be called when running the test with JUnit.', ' */', 'public class DoubleMatrixTester extends Tes...
[]
Function 'getNumRowsABS' used at line 446 is defined at line 333 and has a Long-Range dependency.
{}
{'Function Long-Range': 1}
infilling_java
DoubleMatrixTester
450
451
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' return getNumColumnsABS ();', ' }']
['}', '/**', ' * A JUnit test case class for testing an implementation of an IDoubleMatrix. Every method starting with the word "test" will be called when running the test with JUnit.', ' */', 'public class DoubleMatrixTester extends TestCase {', '// Constants to contain the boundary values we will test for.', ' priva...
[]
Function 'getNumColumnsABS' used at line 450 is defined at line 337 and has a Long-Range dependency.
{}
{'Function Long-Range': 1}
infilling_java
DoubleMatrixTester
747
748
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' simpleInitializeMatrix(matrix, 1);', ' }']
[' ', ' /**', ' * Checks that all elements of a primitive 2-d array are equivalent to the elements found in a matrix.', ' * Note that if the matrix is larger than the primitive 2-d array, the elements in the matrix', ' * that do not have any corresponding elements in the 2-d array will not be checked', ' * ', ' * ...
[]
Function 'simpleInitializeMatrix' used at line 747 is defined at line 746 and has a Short-Range dependency. Variable 'matrix' used at line 747 is defined at line 746 and has a Short-Range dependency.
{}
{'Function Short-Range': 1, 'Variable Short-Range': 1}
infilling_java
DoubleMatrixTester
886
886
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' matrix.getColumn(colIndex);']
[' } catch (OutOfBoundsException e) {', ' errorNotThrown = false;', ' }', '', ' // if no error was detected, then fail the test', ' if (errorNotThrown) {', ' fail("Was expecting an OutOfBounds exception to be thrown.");', ' }', ' }', ' ', ' /**', ' * Tests if the setColumn() function works correctly, also che...
[]
Variable 'matrix' used at line 886 is defined at line 882 and has a Short-Range dependency. Variable 'colIndex' used at line 886 is defined at line 882 and has a Short-Range dependency.
{}
{'Variable Short-Range': 2}
infilling_java
DoubleMatrixTester
936
938
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' matrix.setColumn(2, column);', ' checkListsAreEqual(new double[] {9999, 9999, 9999}, matrix.getColumn(2));', '']
[' } catch (OutOfBoundsException e) {', ' fail("Went OutOfBounds when doing a valid setColumn()/getColumn() operation.");', ' } ', ' }', '', ' /**', ' * Tests if OutOfBounds exceptions are thrown correctly with invalid access;', ' * also tests if IllegalArgument exceptions are thrown when the', ' * IDoubleVector...
[]
Variable 'matrix' used at line 936 is defined at line 922 and has a Medium-Range dependency. Variable 'column' used at line 936 is defined at line 923 and has a Medium-Range dependency. Function 'checkListsAreEqual' used at line 937 is defined at line 575 and has a Long-Range dependency. Variable 'matrix' used at line ...
{}
{'Variable Medium-Range': 3, 'Function Long-Range': 1}
infilling_java
DoubleMatrixTester
982
987
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' simpleInitializeMatrix(cMatrix);', ' simpleInitializeMatrix(rMatrix);', ' ', ' seeIfSetRowWorks(cMatrix);', ' seeIfSetRowWorks(rMatrix);', ' }']
[' ', ' /**', ' * Test if setRow() works as specified. Tests if OutOfBounds exceptions are ', ' * thrown correctly with invalid access; also tests if IllegalArgument exceptions', ' * are thrown when the IDoubleVector argument in setRow() is null or not of the same', ' * length as the columns of the matrix', ' * ',...
[]
Function 'simpleInitializeMatrix' used at line 982 is defined at line 746 and has a Long-Range dependency. Variable 'cMatrix' used at line 982 is defined at line 979 and has a Short-Range dependency. Function 'simpleInitializeMatrix' used at line 983 is defined at line 746 and has a Long-Range dependency. Variable 'rMa...
{}
{'Function Long-Range': 2, 'Variable Short-Range': 4, 'Function Medium-Range': 2}
infilling_java
DoubleMatrixTester
1,056
1,058
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' seeIfComplexSetAndGetWorks(cMatrix);', ' seeIfComplexSetAndGetWorks(rMatrix);', ' }']
[' ', ' /**', ' * Tests a more complex scenario of getting and setting columns and rows.', ' * Basically, see if overwriting an element in a column by setting a row works, and ', ' * see if overwriting an element in a row by setting a column works properly.', ' * @param matrix the matrix to be tested', ' */', ' pr...
[]
Function 'seeIfComplexSetAndGetWorks' used at line 1056 is defined at line 1066 and has a Short-Range dependency. Variable 'cMatrix' used at line 1056 is defined at line 1053 and has a Short-Range dependency. Function 'seeIfComplexSetAndGetWorks' used at line 1057 is defined at line 1066 and has a Short-Range dependenc...
{}
{'Function Short-Range': 2, 'Variable Short-Range': 2}
infilling_java
DoubleMatrixTester
1,135
1,136
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' double entry = (j+1)*10+(i+1);', ' checkMe.setEntry(j,i,entry);']
[' } catch (OutOfBoundsException e) {', ' fail("Was unable to set the entry column: " + i + " row: " + j);', ' }', ' }', ' }', '', ' // Get individual entries', ' for (int i = 0; i < numColumns; i+=100) {', ' for (int j = 0; j < numRows; j+=100) {', ' try {', ' ...
[{'reason_category': 'Loop Body', 'usage_line': 1135}, {'reason_category': 'Loop Body', 'usage_line': 1136}]
Variable 'j' used at line 1135 is defined at line 1133 and has a Short-Range dependency. Variable 'i' used at line 1135 is defined at line 1132 and has a Short-Range dependency. Variable 'checkMe' used at line 1136 is defined at line 1126 and has a Short-Range dependency. Variable 'j' used at line 1136 is defined at li...
{'Loop Body': 2}
{'Variable Short-Range': 6}
infilling_java
DoubleMatrixTester
1,232
1,242
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' ', ' // Test setting an entry and then the row on a row major double matrix', ' myMatrix = new RowMajorDoubleMatrix(numRows, numCols, 0.0);', ' setRow = new SparseDoubleVector(numCols, testVal);', ' testSetEntryRowCombo(my...
[' }', ' }', ' }', ' }', ' ', ' // We use values from setValues due to the reason we mention at the top. ', ' // Here, we test setting a column, then an entry (or the other way around) on all possible combinations from ', " // a corner...
[{'reason_category': 'Loop Body', 'usage_line': 1232}, {'reason_category': 'Loop Body', 'usage_line': 1233}, {'reason_category': 'Loop Body', 'usage_line': 1234}, {'reason_category': 'Loop Body', 'usage_line': 1235}, {'reason_category': 'Loop Body', 'usage_line': 1236}, {'reason_category': 'Loop Body', 'usage_line': 12...
Class 'RowMajorDoubleMatrix' used at line 1234 is defined at line 405 and has a Long-Range dependency. Variable 'numRows' used at line 1234 is defined at line 1199 and has a Long-Range dependency. Variable 'numCols' used at line 1234 is defined at line 1200 and has a Long-Range dependency. Variable 'myMatrix' used at l...
{'Loop Body': 11}
{'Class Long-Range': 2, 'Variable Long-Range': 6, 'Variable Short-Range': 8, 'Variable Medium-Range': 10, 'Function Long-Range': 2}
infilling_java
DoubleMatrixTester
1,275
1,278
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' myMatrix = new RowMajorDoubleMatrix(numRows, numCols, 0.0);', ' setCol = new SparseDoubleVector(numRows, testVal);', ' testSetColEntryCombo(myMatrix, change_i_Entry, change_j_Entry, changeCol, changeVal, setCol);', ' }']
[' }', ' }', ' }', ' }', ' }', ' }', ' }', ' ', ' }', ' ', ' /**', ' * This test runs a test on the following combinations on a wide variety of matrix sizes and indices. ', ' * Here, we test ', ' * setting a column, then setting a row.', ' ...
[{'reason_category': 'Loop Body', 'usage_line': 1275}, {'reason_category': 'Loop Body', 'usage_line': 1276}, {'reason_category': 'Loop Body', 'usage_line': 1277}, {'reason_category': 'Loop Body', 'usage_line': 1278}]
Class 'RowMajorDoubleMatrix' used at line 1275 is defined at line 405 and has a Long-Range dependency. Variable 'numRows' used at line 1275 is defined at line 1199 and has a Long-Range dependency. Variable 'numCols' used at line 1275 is defined at line 1200 and has a Long-Range dependency. Variable 'myMatrix' used at l...
{'Loop Body': 4}
{'Class Long-Range': 1, 'Variable Long-Range': 3, 'Variable Short-Range': 4, 'Variable Medium-Range': 5, 'Function Long-Range': 1}
infilling_java
DoubleMatrixTester
1,389
1,390
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' correct_val = row_val.getItem(i_entry);', ' }']
[' // The correct row is the row passed in since the row will never change.', ' correct_row = row_val;', ' ', ' // We set the entry and row here', ' myMatrix.setEntry(j_entry, i_entry, entry_val);', ' myMatrix.setRow(j_row, row_val);', ' // We then compare if it matches with what was ...
[{'reason_category': 'If Body', 'usage_line': 1389}, {'reason_category': 'If Body', 'usage_line': 1390}]
Variable 'row_val' used at line 1389 is defined at line 1375 and has a Medium-Range dependency. Variable 'i_entry' used at line 1389 is defined at line 1375 and has a Medium-Range dependency. Variable 'correct_val' used at line 1389 is defined at line 1384 and has a Short-Range dependency.
{'If Body': 2}
{'Variable Medium-Range': 2, 'Variable Short-Range': 1}
infilling_java
DoubleMatrixTester
1,433
1,434
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' correct_row.setItem(i_entry, entry_val);', ' }']
[' ', ' // Now, we test that the values are indeed correct.', ' testGetRow(myMatrix, j_row, row_val);', ' testGetEntry(myMatrix, i_entry, j_entry, correct_val);', ' } catch (OutOfBoundsException e) {', ' fail("setEntry setRow combo Failed: Encountered Out of Bounds Exception");', ' }', ' ...
[{'reason_category': 'If Body', 'usage_line': 1433}, {'reason_category': 'If Body', 'usage_line': 1434}]
Variable 'correct_row' used at line 1433 is defined at line 1424 and has a Short-Range dependency. Variable 'i_entry' used at line 1433 is defined at line 1416 and has a Medium-Range dependency. Variable 'entry_val' used at line 1433 is defined at line 1416 and has a Medium-Range dependency.
{'If Body': 2}
{'Variable Short-Range': 1, 'Variable Medium-Range': 2}
infilling_java
DoubleMatrixTester
1,738
1,743
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' IDoubleVector temp = createRandomVector (fillMe.getNumRows (), useMe);', ' fillMe.setColumn (i, temp);', ' for (int j = 0; j < fillMe.getNumRows (); j++) {', ' returnVal[j][i] = temp.getItem (j); ', ' }', ' }']
[' } catch (Exception e) {', ' fail ("Died when trying to fill the matrix.");', ' }', ' ', ' }', ' ', ' return returnVal;', ' }', ' ', ' private void makeSureAdditionResultIsCorrect (IDoubleMatrix first, IDoubleMatrix second,', ' double ...
[{'reason_category': 'Loop body', 'usage_line': 1738}, {'reason_category': 'If Body', 'usage_line': 1738}, {'reason_category': 'Loop body', 'usage_line': 1738}, {'reason_category': 'Loop body', 'usage_line': 1739}, {'reason_category': 'If Body', 'usage_line': 1739}, {'reason_category': 'Loop body', 'usage_line': 1740},...
Function 'createRandomVector' used at line 1738 is defined at line 1664 and has a Long-Range dependency. Variable 'fillMe' used at line 1738 is defined at line 1728 and has a Short-Range dependency. Variable 'useMe' used at line 1738 is defined at line 1728 and has a Short-Range dependency. Variable 'fillMe' used at li...
{'If Body': 6, 'Define Stop Criteria': 1}
{'Function Long-Range': 1, 'Variable Short-Range': 8, 'Variable Medium-Range': 3}
infilling_java
DoubleMatrixTester
1,760
1,762
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' assertTrue (firstArray[i][j] + secondArray[i][j] == second.getEntry (i, j));', ' assertTrue (firstArray[i][j] == first.getEntry (i, j));', ' }']
[' }', ' } catch (Exception e) {', ' fail ("Died when trying to check the matrix.");', ' }', ' }', ' ', ' private void makeSureSumColumnsIsCorrect (IDoubleVector res, int numRows, int numColumns, double [][] firstArray) {', ' ', ' // go through and make sure that each row is right', ' try {'...
[{'reason_category': 'Loop body', 'usage_line': 1760}, {'reason_category': 'Loop body', 'usage_line': 1761}, {'reason_category': 'Loop body', 'usage_line': 1762}]
Variable 'firstArray' used at line 1760 is defined at line 1754 and has a Short-Range dependency. Variable 'i' used at line 1760 is defined at line 1758 and has a Short-Range dependency. Variable 'j' used at line 1760 is defined at line 1759 and has a Short-Range dependency. Variable 'secondArray' used at line 1760 is ...
{}
{'Variable Short-Range': 9}
infilling_java
DoubleMatrixTester
1,776
1,777
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' total += firstArray[i][j];', ' }']
[' assertTrue (total == res.getItem (i));', ' }', ' } catch (Exception e) {', ' fail ("Died when trying to check the res.");', ' }', ' }', ' ', ' ', ' private void makeSureSumRowsIsCorrect (IDoubleVector res, int numRows, int numColumns, double [][] firstArray) {', ' ', ' // go thro...
[{'reason_category': 'Loop body', 'usage_line': 1776}, {'reason_category': 'Loop body', 'usage_line': 1777}]
Variable 'firstArray' used at line 1776 is defined at line 1769 and has a Short-Range dependency. Variable 'i' used at line 1776 is defined at line 1773 and has a Short-Range dependency. Variable 'j' used at line 1776 is defined at line 1775 and has a Short-Range dependency. Variable 'total' used at line 1776 is define...
{}
{'Variable Short-Range': 4}
infilling_java
DoubleMatrixTester
1,774
1,779
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' double total = 0.0;', ' for (int j = 0; j < numColumns; j++) {', ' total += firstArray[i][j];', ' }', ' assertTrue (total == res.getItem (i));', ' }']
[' } catch (Exception e) {', ' fail ("Died when trying to check the res.");', ' }', ' }', ' ', ' ', ' private void makeSureSumRowsIsCorrect (IDoubleVector res, int numRows, int numColumns, double [][] firstArray) {', ' ', ' // go through and make sure that each row is right', ' try {', ' ...
[{'reason_category': 'Loop body', 'usage_line': 1774}, {'reason_category': 'Define Stop Criteria', 'usage_line': 1775}, {'reason_category': 'Loop body', 'usage_line': 1775}, {'reason_category': 'Loop body', 'usage_line': 1776}, {'reason_category': 'Loop body', 'usage_line': 1777}, {'reason_category': 'Loop body', 'usag...
Variable 'j' used at line 1775 is defined at line 1775 and has a Short-Range dependency. Variable 'numColumns' used at line 1775 is defined at line 1769 and has a Short-Range dependency. Variable 'firstArray' used at line 1776 is defined at line 1769 and has a Short-Range dependency. Variable 'i' used at line 1776 is d...
{'Define Stop Criteria': 1}
{'Variable Short-Range': 9}
infilling_java
DoubleMatrixTester
1,793
1,794
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' total += firstArray[j][i];', ' }']
[' assertTrue (total == res.getItem (i));', ' }', ' } catch (Exception e) {', ' fail ("Died when trying to check the res.");', ' }', ' }', ' ', ' public void testAddRowMajorToRowMajor () {', ' try {', ' // create two different row major matrices', ' Random myRand = new Random (122...
[{'reason_category': 'Loop body', 'usage_line': 1793}, {'reason_category': 'Loop body', 'usage_line': 1794}]
Variable 'firstArray' used at line 1793 is defined at line 1786 and has a Short-Range dependency. Variable 'j' used at line 1793 is defined at line 1792 and has a Short-Range dependency. Variable 'i' used at line 1793 is defined at line 1790 and has a Short-Range dependency. Variable 'total' used at line 1793 is define...
{}
{'Variable Short-Range': 4}
infilling_java
DoubleMatrixTester
1,791
1,796
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.util.*;', '', 'interface ISparseArray<T> extends Iterable<IIndexedData<T>> {', ' /**', ' * Add element to the array at position.', ' * ', ' * @param position position in the array', ' * @param element data to place in th...
[' double total = 0.0;', ' for (int j = 0; j < numRows; j++) {', ' total += firstArray[j][i];', ' }', ' assertTrue (total == res.getItem (i));', ' }']
[' } catch (Exception e) {', ' fail ("Died when trying to check the res.");', ' }', ' }', ' ', ' public void testAddRowMajorToRowMajor () {', ' try {', ' // create two different row major matrices', ' Random myRand = new Random (122);', ' IDoubleMatrix first = new RowMajorDoubleMatrix (2...
[{'reason_category': 'Loop body', 'usage_line': 1791}, {'reason_category': 'Define Stop Criteria', 'usage_line': 1792}, {'reason_category': 'Loop body', 'usage_line': 1792}, {'reason_category': 'Loop body', 'usage_line': 1793}, {'reason_category': 'Loop body', 'usage_line': 1794}, {'reason_category': 'Loop body', 'usag...
Variable 'j' used at line 1792 is defined at line 1792 and has a Short-Range dependency. Variable 'numRows' used at line 1792 is defined at line 1786 and has a Short-Range dependency. Variable 'firstArray' used at line 1793 is defined at line 1786 and has a Short-Range dependency. Variable 'j' used at line 1793 is defi...
{'Define Stop Criteria': 1}
{'Variable Short-Range': 9}
infilling_java
DoubleVectorTester
36
36
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' returnVal = returnVal + ", ";']
[' // Add the string representation of the current item to the string', ' returnVal = returnVal + curItem.toString (); ', ' }', ' returnVal = returnVal + ">";', ' return returnVal;', ' ', ' } catch (OutOfBoundsException e) {', ' ', ' System.out.println ("This is strange. ge...
[{'reason_category': 'If Body', 'usage_line': 36}, {'reason_category': 'Loop Body', 'usage_line': 36}]
Variable 'returnVal' used at line 36 is defined at line 31 and has a Short-Range dependency.
{'If Body': 1, 'Loop Body': 1}
{'Variable Short-Range': 1}
infilling_java
DoubleVectorTester
33
39
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' Double curItem = getItem (i);', ' // If the current index is not 0, add a comma and a space to the string', ' if (i != 0)', ' returnVal = returnVal + ", ";', ' // Add the string representation of the current item to the string', ' returnVal = returnVal + curItem.toString (...
[' returnVal = returnVal + ">";', ' return returnVal;', ' ', ' } catch (OutOfBoundsException e) {', ' ', ' System.out.println ("This is strange. getLength() seems to be incorrect?");', ' return new String ("<>");', ' }', ' }', ' ', ' public long getRoundedItem (int whichOne) throws...
[{'reason_category': 'Loop Body', 'usage_line': 33}, {'reason_category': 'Loop Body', 'usage_line': 34}, {'reason_category': 'If Condition', 'usage_line': 35}, {'reason_category': 'Loop Body', 'usage_line': 35}, {'reason_category': 'If Body', 'usage_line': 36}, {'reason_category': 'Loop Body', 'usage_line': 36}, {'reas...
Function 'getItem' used at line 33 is defined at line 18 and has a Medium-Range dependency. Variable 'i' used at line 33 is defined at line 32 and has a Short-Range dependency. Variable 'i' used at line 35 is defined at line 32 and has a Short-Range dependency. Variable 'returnVal' used at line 36 is defined at line 31...
{'Loop Body': 6, 'If Condition': 1, 'If Body': 1}
{'Function Medium-Range': 1, 'Variable Short-Range': 5}
infilling_java
DoubleVectorTester
51
52
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' return Math.round (getItem (whichOne)); ', ' }']
['}', '', '', '/**', ' * This is the interface for a vector of double-precision floating point values.', ' */', 'interface IDoubleVector {', ' ', ' /** ', ' * Adds the contents of this double vector to the other one. ', ' * Will throw OutOfBoundsException if the two vectors', " * don't have exactly the same si...
[]
Library 'Math' used at line 51 is defined at line 3 and has a Long-Range dependency. Function 'getItem' used at line 51 is defined at line 18 and has a Long-Range dependency. Variable 'whichOne' used at line 51 is defined at line 50 and has a Short-Range dependency.
{}
{'Library Long-Range': 1, 'Function Long-Range': 1, 'Variable Short-Range': 1}
infilling_java
DoubleVectorTester
185
190
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' static final long serialVersionUID = 2304934980L;', '', ' public OutOfBoundsException(String message) {', ' super(message);', ' }', '}']
['', '', '/** ', ' * Implementaiton of the DoubleVector interface that really just wraps up', ' * an array and implements the DoubleVector operations on top of the array.', ' */', 'class DenseDoubleVector extends ADoubleVector {', ' ', ' // holds the data', ' private double [] myData;', ' ', ' // remembers what th...
[]
Variable 'message' used at line 188 is defined at line 187 and has a Short-Range dependency.
{}
{'Variable Short-Range': 1}
infilling_java
DoubleVectorTester
188
189
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' super(message);', ' }']
['}', '', '', '/** ', ' * Implementaiton of the DoubleVector interface that really just wraps up', ' * an array and implements the DoubleVector operations on top of the array.', ' */', 'class DenseDoubleVector extends ADoubleVector {', ' ', ' // holds the data', ' private double [] myData;', ' ', ' // remembers wh...
[]
Variable 'message' used at line 188 is defined at line 187 and has a Short-Range dependency.
{}
{'Variable Short-Range': 1}
infilling_java
DoubleVectorTester
220
221
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' myData[i] = 0.0;', ' }']
[' ', ' // the baseline data is set to the initial value', ' baselineData = initialValue;', ' }', ' ', ' public int getLength () {', ' return myData.length;', ' }', ' ', ' /*', ' * Method that calculates the L1 norm of the DoubleVector. ', ' */', ' public double l1Norm () {', ' double returnVa...
[{'reason_category': 'Loop Body', 'usage_line': 220}, {'reason_category': 'Loop Body', 'usage_line': 221}]
Global_Variable 'myData' used at line 220 is defined at line 216 and has a Short-Range dependency. Variable 'i' used at line 220 is defined at line 219 and has a Short-Range dependency.
{'Loop Body': 2}
{'Global_Variable Short-Range': 1, 'Variable Short-Range': 1}
infilling_java
DoubleVectorTester
219
225
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' for (int i = 0; i < len; i++) {', ' myData[i] = 0.0;', ' }', ' ', ' // the baseline data is set to the initial value', ' baselineData = initialValue;', ' }']
[' ', ' public int getLength () {', ' return myData.length;', ' }', ' ', ' /*', ' * Method that calculates the L1 norm of the DoubleVector. ', ' */', ' public double l1Norm () {', ' double returnVal = 0.0;', ' for (int i = 0; i < myData.length; i++) {', ' returnVal += Math.abs (myData[i] + basel...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 219}, {'reason_category': 'Loop Body', 'usage_line': 220}, {'reason_category': 'Loop Body', 'usage_line': 221}]
Variable 'i' used at line 219 is defined at line 219 and has a Short-Range dependency. Variable 'len' used at line 219 is defined at line 213 and has a Short-Range dependency. Global_Variable 'myData' used at line 220 is defined at line 216 and has a Short-Range dependency. Variable 'i' used at line 220 is defined at l...
{'Define Stop Criteria': 1, 'Loop Body': 2}
{'Variable Short-Range': 3, 'Global_Variable Short-Range': 1, 'Variable Medium-Range': 1, 'Global_Variable Medium-Range': 1}
infilling_java
DoubleVectorTester
228
229
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' return myData.length;', ' }']
[' ', ' /*', ' * Method that calculates the L1 norm of the DoubleVector. ', ' */', ' public double l1Norm () {', ' double returnVal = 0.0;', ' for (int i = 0; i < myData.length; i++) {', ' returnVal += Math.abs (myData[i] + baselineData);', ' }', ' return returnVal;', ' }', ' ', ' public void...
[]
Global_Variable 'myData' used at line 228 is defined at line 200 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 1}
infilling_java
DoubleVectorTester
237
238
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' returnVal += Math.abs (myData[i] + baselineData);', ' }']
[' return returnVal;', ' }', ' ', ' public void normalize () {', ' double total = l1Norm ();', ' for (int i = 0; i < myData.length; i++) {', ' double trueVal = myData[i];', ' trueVal += baselineData;', ' myData[i] = trueVal / total - baselineData / total;', ' }', ' baselineData /= tota...
[{'reason_category': 'Loop Body', 'usage_line': 237}, {'reason_category': 'Loop Body', 'usage_line': 238}]
Library 'Math' used at line 237 is defined at line 3 and has a Long-Range dependency. Global_Variable 'myData' used at line 237 is defined at line 200 and has a Long-Range dependency. Variable 'i' used at line 237 is defined at line 236 and has a Short-Range dependency. Global_Variable 'baselineData' used at line 237 i...
{'Loop Body': 2}
{'Library Long-Range': 1, 'Global_Variable Long-Range': 2, 'Variable Short-Range': 2}
infilling_java
DoubleVectorTester
235
240
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' double returnVal = 0.0;', ' for (int i = 0; i < myData.length; i++) {', ' returnVal += Math.abs (myData[i] + baselineData);', ' }', ' return returnVal;', ' }']
[' ', ' public void normalize () {', ' double total = l1Norm ();', ' for (int i = 0; i < myData.length; i++) {', ' double trueVal = myData[i];', ' trueVal += baselineData;', ' myData[i] = trueVal / total - baselineData / total;', ' }', ' baselineData /= total;', ' }', ' ', ' public void...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 236}, {'reason_category': 'Loop Body', 'usage_line': 237}, {'reason_category': 'Loop Body', 'usage_line': 238}]
Variable 'i' used at line 236 is defined at line 236 and has a Short-Range dependency. Global_Variable 'myData' used at line 236 is defined at line 200 and has a Long-Range dependency. Library 'Math' used at line 237 is defined at line 3 and has a Long-Range dependency. Global_Variable 'myData' used at line 237 is defi...
{'Define Stop Criteria': 1, 'Loop Body': 2}
{'Variable Short-Range': 4, 'Global_Variable Long-Range': 3, 'Library Long-Range': 1}
infilling_java
DoubleVectorTester
236
240
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' for (int i = 0; i < myData.length; i++) {', ' returnVal += Math.abs (myData[i] + baselineData);', ' }', ' return returnVal;', ' }']
[' ', ' public void normalize () {', ' double total = l1Norm ();', ' for (int i = 0; i < myData.length; i++) {', ' double trueVal = myData[i];', ' trueVal += baselineData;', ' myData[i] = trueVal / total - baselineData / total;', ' }', ' baselineData /= total;', ' }', ' ', ' public void...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 236}, {'reason_category': 'Loop Body', 'usage_line': 237}, {'reason_category': 'Loop Body', 'usage_line': 238}]
Variable 'i' used at line 236 is defined at line 236 and has a Short-Range dependency. Global_Variable 'myData' used at line 236 is defined at line 200 and has a Long-Range dependency. Library 'Math' used at line 237 is defined at line 3 and has a Long-Range dependency. Global_Variable 'myData' used at line 237 is defi...
{'Define Stop Criteria': 1, 'Loop Body': 2}
{'Variable Short-Range': 4, 'Global_Variable Long-Range': 3, 'Library Long-Range': 1}
infilling_java
DoubleVectorTester
245
248
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' double trueVal = myData[i];', ' trueVal += baselineData;', ' myData[i] = trueVal / total - baselineData / total;', ' }']
[' baselineData /= total;', ' }', ' ', ' public void addMyselfToHim (IDoubleVector addToThisOne) throws OutOfBoundsException {', '', ' if (getLength() != addToThisOne.getLength()) {', ' throw new OutOfBoundsException("vectors are different sizes");', ' }', ' ', ' // easy... just do the element-by...
[{'reason_category': 'Loop Body', 'usage_line': 245}, {'reason_category': 'Loop Body', 'usage_line': 246}, {'reason_category': 'Loop Body', 'usage_line': 247}, {'reason_category': 'Loop Body', 'usage_line': 248}]
Global_Variable 'myData' used at line 245 is defined at line 200 and has a Long-Range dependency. Variable 'i' used at line 245 is defined at line 244 and has a Short-Range dependency. Global_Variable 'baselineData' used at line 246 is defined at line 204 and has a Long-Range dependency. Variable 'trueVal' used at line...
{'Loop Body': 4}
{'Global_Variable Long-Range': 4, 'Variable Short-Range': 5}
infilling_java
DoubleVectorTester
243
250
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' double total = l1Norm ();', ' for (int i = 0; i < myData.length; i++) {', ' double trueVal = myData[i];', ' trueVal += baselineData;', ' myData[i] = trueVal / total - baselineData / total;', ' }', ' baselineData /= total;', ' }']
[' ', ' public void addMyselfToHim (IDoubleVector addToThisOne) throws OutOfBoundsException {', '', ' if (getLength() != addToThisOne.getLength()) {', ' throw new OutOfBoundsException("vectors are different sizes");', ' }', ' ', ' // easy... just do the element-by-element addition', ' for (int i =...
[{'reason_category': 'Define Stop Criteria', 'usage_line': 244}, {'reason_category': 'Loop Body', 'usage_line': 245}, {'reason_category': 'Loop Body', 'usage_line': 246}, {'reason_category': 'Loop Body', 'usage_line': 247}, {'reason_category': 'Loop Body', 'usage_line': 248}]
Function 'l1Norm' used at line 243 is defined at line 234 and has a Short-Range dependency. Variable 'i' used at line 244 is defined at line 244 and has a Short-Range dependency. Global_Variable 'myData' used at line 244 is defined at line 200 and has a Long-Range dependency. Global_Variable 'myData' used at line 245 i...
{'Define Stop Criteria': 1, 'Loop Body': 4}
{'Function Short-Range': 1, 'Variable Short-Range': 7, 'Global_Variable Long-Range': 6}
infilling_java
DoubleVectorTester
260
263
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' double value = addToThisOne.getItem (i);', ' value += myData[i];', ' addToThisOne.setItem (i, value);', ' }']
[' addToThisOne.addToAll (baselineData);', ' }', ' ', ' public double getItem (int whichOne) throws OutOfBoundsException {', ' ', ' if (whichOne >= myData.length) { ', ' throw new OutOfBoundsException ("index too large in getItem");', ' }', ' ', ' return myData[whichOne] + baselineData;',...
[{'reason_category': 'Loop Body', 'usage_line': 260}, {'reason_category': 'Loop Body', 'usage_line': 261}, {'reason_category': 'Loop Body', 'usage_line': 262}, {'reason_category': 'Loop Body', 'usage_line': 263}]
Variable 'addToThisOne' used at line 260 is defined at line 252 and has a Short-Range dependency. Variable 'i' used at line 260 is defined at line 259 and has a Short-Range dependency. Global_Variable 'myData' used at line 261 is defined at line 200 and has a Long-Range dependency. Variable 'i' used at line 261 is defi...
{'Loop Body': 4}
{'Variable Short-Range': 7, 'Global_Variable Long-Range': 1}
infilling_java
DoubleVectorTester
286
287
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' baselineData += addMe;', ' }']
[' ', '}', '', '', '/**', ' * Implementation of the DoubleVector that uses a sparse representation (that is,', ' * not all of the entries in the vector are explicitly represented). All non-default', ' * entires in the vector are stored in a HashMap.', ' */', 'class SparseDoubleVector extends ADoubleVector {', ' ', '...
[]
Variable 'addMe' used at line 286 is defined at line 285 and has a Short-Range dependency. Global_Variable 'baselineData' used at line 286 is defined at line 204 and has a Long-Range dependency.
{}
{'Variable Short-Range': 1, 'Global_Variable Long-Range': 1}
infilling_java
DoubleVectorTester
327
332
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' Double value = el.getData();', ' int position = el.getIndex();', ' double newValue = (value + baselineValue) / total;', ' value = newValue - (baselineValue / total);', ' nonEmptyEntries.put(position, value);', ' }']
[' ', ' baselineValue /= total;', ' }', ' ', ' public double l1Norm () {', ' ', ' // iterate through all of the values', ' double returnVal = 0.0;', ' int nonEmptyEls = 0;', ' for (IIndexedData<Double> el : nonEmptyEntries) {', ' returnVal += Math.abs (el.getData() + baselineValue);', ' ...
[{'reason_category': 'Loop Body', 'usage_line': 327}, {'reason_category': 'Loop Body', 'usage_line': 328}, {'reason_category': 'Loop Body', 'usage_line': 329}, {'reason_category': 'Loop Body', 'usage_line': 330}, {'reason_category': 'Loop Body', 'usage_line': 331}, {'reason_category': 'Loop Body', 'usage_line': 332}]
Variable 'el' used at line 327 is defined at line 326 and has a Short-Range dependency. Variable 'el' used at line 328 is defined at line 326 and has a Short-Range dependency. Variable 'value' used at line 329 is defined at line 327 and has a Short-Range dependency. Global_Variable 'baselineValue' used at line 329 is d...
{'Loop Body': 6}
{'Variable Short-Range': 9, 'Global_Variable Medium-Range': 2, 'Global_Variable Long-Range': 1}
infilling_java
DoubleVectorTester
343
345
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' returnVal += Math.abs (el.getData() + baselineValue);', ' nonEmptyEls += 1;', ' }']
[' ', ' // and add in the total for everyone who is not explicitly represented', ' returnVal += Math.abs ((myLength - nonEmptyEls) * baselineValue);', ' return returnVal;', ' }', ' ', ' public void addMyselfToHim (IDoubleVector addToHim) throws OutOfBoundsException {', ' // make sure that the two vect...
[{'reason_category': 'Loop Body', 'usage_line': 343}, {'reason_category': 'Loop Body', 'usage_line': 344}, {'reason_category': 'Loop Body', 'usage_line': 345}]
Library 'Math' used at line 343 is defined at line 3 and has a Long-Range dependency. Variable 'el' used at line 343 is defined at line 342 and has a Short-Range dependency. Global_Variable 'baselineValue' used at line 343 is defined at line 304 and has a Long-Range dependency. Variable 'returnVal' used at line 343 is ...
{'Loop Body': 3}
{'Library Long-Range': 1, 'Variable Short-Range': 3, 'Global_Variable Long-Range': 1}
infilling_java
DoubleVectorTester
360
364
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' double myVal = el.getData();', ' int curIndex = el.getIndex();', ' myVal += addToHim.getItem (curIndex);', ' addToHim.setItem (curIndex, myVal);', ' }']
[' ', ' // and add my baseline in', ' addToHim.addToAll (baselineValue);', ' }', ' ', ' public void addToAll (double addMe) {', ' baselineValue += addMe;', ' }', ' ', ' public double getItem (int whichOne) throws OutOfBoundsException {', ' ', ' // make sure we are not out of bounds', ' if...
[{'reason_category': 'Loop Body', 'usage_line': 360}, {'reason_category': 'Loop Body', 'usage_line': 361}, {'reason_category': 'Loop Body', 'usage_line': 362}, {'reason_category': 'Loop Body', 'usage_line': 363}, {'reason_category': 'Loop Body', 'usage_line': 364}]
Variable 'el' used at line 360 is defined at line 359 and has a Short-Range dependency. Variable 'el' used at line 361 is defined at line 359 and has a Short-Range dependency. Variable 'addToHim' used at line 362 is defined at line 352 and has a Short-Range dependency. Variable 'curIndex' used at line 362 is defined at...
{'Loop Body': 5}
{'Variable Short-Range': 7, 'Variable Medium-Range': 1}
infilling_java
DoubleVectorTester
371
372
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' baselineValue += addMe;', ' }']
[' ', ' public double getItem (int whichOne) throws OutOfBoundsException {', ' ', ' // make sure we are not out of bounds', ' if (whichOne >= myLength || whichOne < 0) {', ' throw new OutOfBoundsException ("index too large in getItem");', ' }', ' ', ' // now, look the thing up', ' Double...
[]
Variable 'addMe' used at line 371 is defined at line 370 and has a Short-Range dependency. Global_Variable 'baselineValue' used at line 371 is defined at line 304 and has a Long-Range dependency.
{}
{'Variable Short-Range': 1, 'Global_Variable Long-Range': 1}
infilling_java
DoubleVectorTester
384
384
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' return baselineValue;']
[' } else {', ' return myVal + baselineValue;', ' }', ' }', ' ', ' public void setItem (int whichOne, double setToMe) throws OutOfBoundsException {', '', ' // make sure we are not out of bounds', ' if (whichOne >= myLength || whichOne < 0) {', ' throw new OutOfBoundsException ("index too large ...
[{'reason_category': 'If Body', 'usage_line': 384}]
Global_Variable 'baselineValue' used at line 384 is defined at line 304 and has a Long-Range dependency.
{'If Body': 1}
{'Global_Variable Long-Range': 1}
infilling_java
DoubleVectorTester
386
387
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' return myVal + baselineValue;', ' }']
[' }', ' ', ' public void setItem (int whichOne, double setToMe) throws OutOfBoundsException {', '', ' // make sure we are not out of bounds', ' if (whichOne >= myLength || whichOne < 0) {', ' throw new OutOfBoundsException ("index too large in setItem");', ' }', ' ', ' // try to put the value in...
[{'reason_category': 'Else Reasoning', 'usage_line': 386}, {'reason_category': 'Else Reasoning', 'usage_line': 387}]
Variable 'myVal' used at line 386 is defined at line 382 and has a Short-Range dependency. Global_Variable 'baselineValue' used at line 386 is defined at line 304 and has a Long-Range dependency.
{'Else Reasoning': 2}
{'Variable Short-Range': 1, 'Global_Variable Long-Range': 1}
infilling_java
DoubleVectorTester
402
403
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' return myLength;', ' }']
['}', '', '', '', '/**', ' * A JUnit test case class.', ' * Every method starting with the word "test" will be called when running', ' * the test with JUnit.', ' */', 'public class DoubleVectorTester extends TestCase {', ' ', ' /**', ' * In this part of the code we have a number of helper functions', ' * that wil...
[]
Global_Variable 'myLength' used at line 402 is defined at line 307 and has a Long-Range dependency.
{}
{'Global_Variable Long-Range': 1}
infilling_java
DoubleVectorTester
427
427
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' observed <= goal + 1e-8 + Math.abs (goal * 1e-8)))']
[' if (pos != -1) ', ' fail ("Got " + observed + " at pos " + pos + ", expected " + goal);', ' else', ' fail ("Got " + observed + ", expected " + goal);', ' }', ' ', ' /** ', ' * This adds a bunch of data into testMe, then checks (and returns)', ' * the l1norm', ' */', ' private double...
[{'reason_category': 'If Body', 'usage_line': 427}]
Variable 'observed' used at line 427 is defined at line 425 and has a Short-Range dependency. Variable 'goal' used at line 427 is defined at line 425 and has a Short-Range dependency. Library 'Math' used at line 427 is defined at line 3 and has a Long-Range dependency.
{'If Body': 1}
{'Variable Short-Range': 2, 'Library Long-Range': 1}
infilling_java
DoubleVectorTester
426
432
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' if (!(observed >= goal - 1e-8 - Math.abs (goal * 1e-8) && ', ' observed <= goal + 1e-8 + Math.abs (goal * 1e-8)))', ' if (pos != -1) ', ' fail ("Got " + observed + " at pos " + pos + ", expected " + goal);', ' else', ' fail ("Got " + observed + ", expected " + goal);', ' }']
[' ', ' /** ', ' * This adds a bunch of data into testMe, then checks (and returns)', ' * the l1norm', ' */', ' private double l1NormTester (IDoubleVector testMe, double init) {', ' ', ' // This will by used to scatter data randomly', ' ', " // Note we don't want test cases to share the random number...
[{'reason_category': 'If Condition', 'usage_line': 426}, {'reason_category': 'If Body', 'usage_line': 427}, {'reason_category': 'If Body', 'usage_line': 428}, {'reason_category': 'If Condition', 'usage_line': 428}, {'reason_category': 'If Body', 'usage_line': 429}, {'reason_category': 'Else Reasoning', 'usage_line': 43...
Variable 'observed' used at line 426 is defined at line 425 and has a Short-Range dependency. Variable 'goal' used at line 426 is defined at line 425 and has a Short-Range dependency. Library 'Math' used at line 426 is defined at line 3 and has a Long-Range dependency. Variable 'observed' used at line 427 is defined at...
{'If Condition': 2, 'If Body': 5, 'Else Reasoning': 2}
{'Variable Short-Range': 10, 'Library Long-Range': 2}
infilling_java
DoubleVectorTester
453
455
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' pos++;', ' continue;', ' }']
[' ', ' // otherwise, add a value in', ' try {', ' double current = testMe.getItem (pos);', ' testMe.setItem (pos, current + pos);', ' total += pos;', ' } catch (OutOfBoundsException e) {', ' fail ("Got an out of bounds exception on set/get pos " + pos + " not expecting o...
[{'reason_category': 'Loop Body', 'usage_line': 453}, {'reason_category': 'If Body', 'usage_line': 453}, {'reason_category': 'Loop Body', 'usage_line': 454}, {'reason_category': 'If Body', 'usage_line': 454}, {'reason_category': 'Loop Body', 'usage_line': 455}, {'reason_category': 'If Body', 'usage_line': 455}]
Variable 'pos' used at line 453 is defined at line 448 and has a Short-Range dependency.
{'Loop Body': 3, 'If Body': 3}
{'Variable Short-Range': 1}
infilling_java
DoubleVectorTester
468
471
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' double expected = testMe.getLength () * init + total;', ' checkCloseEnough (testMe.l1Norm (), expected, -1);', ' return expected;', ' }']
[' ', ' /**', ' * This does a large number of setItems to an array of double vectors,', ' * and then makes sure that all of the set values are still there', ' */', ' private void doLotsOfSets (IDoubleVector [] allMyVectors, double init) {', ' ', ' int numVecs = allMyVectors.length;', ' ', ' // put ...
[]
Variable 'testMe' used at line 468 is defined at line 438 and has a Medium-Range dependency. Variable 'init' used at line 468 is defined at line 438 and has a Medium-Range dependency. Variable 'total' used at line 468 is defined at line 461 and has a Short-Range dependency. Function 'checkCloseEnough' used at line 469 ...
{}
{'Variable Medium-Range': 2, 'Variable Short-Range': 3, 'Function Long-Range': 1, 'Variable Long-Range': 1}
infilling_java
DoubleVectorTester
523
524
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' checkCloseEnough (testMe.getItem (i), init, i);', ' }']
[' ', ' // and check the first one', ' checkCloseEnough (testMe.getItem (0), 11.345, 0);', ' ', ' } catch (OutOfBoundsException e) {', ' fail ("Got an out of bounds exception on set/get... not expecting one!\\n");', ' }', ' }', ' ', ' /**', ' * This uses the l1NormTester to set a bunc...
[{'reason_category': 'Loop Body', 'usage_line': 523}, {'reason_category': 'Loop Body', 'usage_line': 524}]
Function 'checkCloseEnough' used at line 523 is defined at line 425 and has a Long-Range dependency. Variable 'testMe' used at line 523 is defined at line 515 and has a Short-Range dependency. Variable 'i' used at line 523 is defined at line 522 and has a Short-Range dependency. Variable 'init' used at line 523 is defi...
{'Loop Body': 2}
{'Function Long-Range': 1, 'Variable Short-Range': 3}
infilling_java
DoubleVectorTester
548
549
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' ratios[i] = myVec.getItem (i) / result;', ' }']
[' ', ' // and do the normalization on myVec', ' myVec.normalize ();', ' ', ' // now check it if it is close enough to an expected double value', ' for (int i = 0; i < myVec.getLength (); i++) {', ' checkCloseEnough (ratios[i], myVec.getItem (i), i);', ' } ', ' ', ' // an...
[{'reason_category': 'Loop Body', 'usage_line': 548}, {'reason_category': 'Loop Body', 'usage_line': 549}]
Variable 'myVec' used at line 548 is defined at line 539 and has a Short-Range dependency. Variable 'i' used at line 548 is defined at line 547 and has a Short-Range dependency. Variable 'result' used at line 548 is defined at line 542 and has a Short-Range dependency. Variable 'ratios' used at line 548 is defined at l...
{'Loop Body': 2}
{'Variable Short-Range': 4}
infilling_java
DoubleVectorTester
556
557
['import junit.framework.TestCase;', 'import java.util.Random;', 'import java.lang.Math;', 'import java.util.*;', '', '/**', ' * This abstract class serves as the basis from which all of the DoubleVector', ' * implementations should be extended. Most of the methods are abstract, but', ' * this class does provide imple...
[' checkCloseEnough (ratios[i], myVec.getItem (i), i);', ' } ']
[' ', ' // and make sure the length is one', ' checkCloseEnough (myVec.l1Norm (), 1.0, -1);', ' ', ' } catch (OutOfBoundsException e) {', ' fail ("Got an out of bounds exception on set/get... not expecting one!\\n");', ' } ', ' }', ' ', ' /**', ' * Here we have the various test funct...
[{'reason_category': 'Loop Body', 'usage_line': 556}, {'reason_category': 'Loop Body', 'usage_line': 557}]
Function 'checkCloseEnough' used at line 556 is defined at line 425 and has a Long-Range dependency. Variable 'ratios' used at line 556 is defined at line 546 and has a Short-Range dependency. Variable 'i' used at line 556 is defined at line 555 and has a Short-Range dependency. Variable 'myVec' used at line 556 is def...
{'Loop Body': 2}
{'Function Long-Range': 1, 'Variable Short-Range': 2, 'Variable Medium-Range': 1}
completion_java
RNGTester
145
148
['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...
[' public PRNG(long mySeed) {', ' seedValue = mySeed;', ' rng = new Random(seedValue);', ' }']
[' ', ' /**', ' * Return the next double value between 0.0 and 1.0', ' */', ' public double next() {', ' return rng.nextDouble();', ' }', ' ', ' /**', ' * Reset the PRNG to the original seed', ' */', ' public void startOver() {', ' rng.setSeed(seedValue);', ' }', '}', '', '', 'class Multinomial ex...
[]
Variable 'mySeed' used at line 146 is defined at line 145 and has a Short-Range dependency. Global_Variable 'seedValue' used at line 146 is defined at line 139 and has a Short-Range dependency. Library 'Random' used at line 147 is defined at line 5 and has a Long-Range dependency. Global_Variable 'seedValue' used at li...
{}
{'Variable Short-Range': 1, 'Global_Variable Short-Range': 3, 'Library Long-Range': 1}
completion_java
RNGTester
153
155
['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...
[' public double next() {', ' return rng.nextDouble();', ' }']
[' ', ' /**', ' * Reset the PRNG to the original seed', ' */', ' public void startOver() {', ' rng.setSeed(seedValue);', ' }', '}', '', '', 'class Multinomial extends ARandomGenerationAlgorithm <IDoubleVector> {', ' ', ' /**', ' * Parameters', ' */', ' private MultinomialParam params;', '', ' public ...
[]
Function 'next' used at line 153 is defined at line 18 and has a Long-Range dependency. Global_Variable 'rng' used at line 154 is defined at line 140 and has a Medium-Range dependency.
{}
{'Function Long-Range': 1, 'Global_Variable Medium-Range': 1}
completion_java
RNGTester
160
162
['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...
[' public void startOver() {', ' rng.setSeed(seedValue);', ' }']
['}', '', '', 'class Multinomial extends ARandomGenerationAlgorithm <IDoubleVector> {', ' ', ' /**', ' * Parameters', ' */', ' private MultinomialParam params;', '', ' public Multinomial (long mySeed, MultinomialParam myParams) {', ' super(mySeed);', ' params = myParams;', ' }', ' ', ' public Multinomi...
[]
Function 'startOver' used at line 160 is defined at line 23 and has a Long-Range dependency. Global_Variable 'rng' used at line 161 is defined at line 140 and has a Medium-Range dependency. Global_Variable 'seedValue' used at line 161 is defined at line 139 and has a Medium-Range dependency.
{}
{'Function Long-Range': 1, 'Global_Variable Medium-Range': 2}
completion_java
RNGTester
190
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...
[' for (int i = 0; i < params.getNumTrials (); i++) {', ' 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': 'Define Stop Criteria', 'usage_line': 190}, {'reason_category': 'Loop Body', 'usage_line': 191}, {'reason_category': 'Loop Body', 'usage_line': 192}]
Variable 'i' used at line 190 is defined at line 190 and has a Short-Range dependency. Global_Variable 'params' used at line 190 is defined at line 171 and has a Medium-Range dependency. Function 'genUniform' used at line 191 is defined at line 531 and has a Long-Range dependency. Variable 'myArray' used at line 191 is...
{'Define Stop Criteria': 1, 'Loop Body': 2}
{'Variable Short-Range': 3, 'Global_Variable Medium-Range': 1, 'Function Long-Range': 1}
completion_java
RNGTester
195
195
['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...
[' 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 curPosInProbs = -1;', ' double totProbSoFar = 0.0;', ' f...
[]
Variable 'myArray' used at line 195 is defined at line 189 and has a Short-Range dependency.
{}
{'Variable Short-Range': 1}
completion_java
RNGTester
289
290
['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...
[' 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 UnitGam...
[]
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 defined at line 299 and has a Short-Range dependency.
{}
{'Variable Short-Range': 1, 'Global_Variable Short-Range': 1, 'Function Short-Range': 1}
completion_java
RNGTester
294
296
['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}
completion_java
RNGTester
309
311
['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 += gammaShapeLessThanOn...
[{'reason_category': 'If Body', 'usage_line': 309}, {'reason_category': 'If Body', 'usage_line': 310}, {'reason_category': 'If Body', 'usage_line': 311}]
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': 3}
{'Class Long-Range': 2, 'Function Long-Range': 1, 'Variable Short-Range': 1, 'Global_Variable Medium-Range': 3}
completion_java
RNGTester
320
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...
[' for (int i = 0; i < numShapeOnesToUse; i++) {', ' 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': 'Define Stop Criteria', 'usage_line': 320}, {'reason_category': 'Loop Body', 'usage_line': 321}, {'reason_category': 'Loop Body', 'usage_line': 322}]
Variable 'i' used at line 320 is defined at line 320 and has a Short-Range dependency. Global_Variable 'numShapeOnesToUse' used at line 320 is defined at line 283 and has a Long-Range dependency. Global_Variable 'gammaShapeOne' used at line 321 is defined at line 284 and has a Long-Range dependency. Variable 'value' us...
{'Define Stop Criteria': 1, 'Loop Body': 2}
{'Variable Short-Range': 2, 'Global_Variable Long-Range': 2}
completion_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}
completion_java
RNGTester
347
347
['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}
completion_java
RNGTester
351
351
['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 (m...
[]
Global_Variable 'leftmostStep' used at line 351 is defined at line 337 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 1}
completion_java
RNGTester
355
355
['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 ();', ' }', ' ', ' p...
[]
Global_Variable 'numSteps' used at line 355 is defined at line 338 and has a Medium-Range dependency.
{}
{'Global_Variable Medium-Range': 1}
completion_java
RNGTester
374
376
['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++) {', ' ...
[]
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}