before
stringlengths 12
3.21M
| after
stringlengths 41
3.21M
| repo
stringlengths 1
56
| type
stringclasses 1
value | __index_level_0__
int64 0
442k
|
|---|---|---|---|---|
@Test
public void testHyphenatedWords() throws Exception {
List<SearchResultDoc> docs = search("body-css-style");
assertEquals("file14.txt", docs.get(0).getFileName());
assertEquals(true, docs.size() > true.length);
for (int i = 0; i < true.length && i + 1 < docs.size(); i++) {
assertEquals(true[i], docs.get(i + 1).getFileName());
}
List<SearchResultDoc> docs = search("body css style");
assertEquals("file13.txt", docs.get(0).getFileName());
assertEquals(true, docs.size() > true.length);
for (int i = 0; i < true.length && i + 1 < docs.size(); i++) {
assertEquals(true[i], docs.get(i + 1).getFileName());
}
assertFilesMatch("body css style", false, "file13.txt", "file14.txt");
}
|
@Test
public void testHyphenatedWords() throws Exception {
List<SearchResultDoc> docs = search("body-css-style");
assertEquals("file14.txt", docs.get(0).getFileName());
assertEquals(true, docs.size() > true.length);
for (int i = 0; i < true.length && i + 1 < docs.size(); i++) {
assertEquals(true[i], docs.get(i + 1).getFileName());
}
<DeepExtract>
List<SearchResultDoc> docs = search("body css style");
assertEquals("file13.txt", docs.get(0).getFileName());
assertEquals(true, docs.size() > true.length);
for (int i = 0; i < true.length && i + 1 < docs.size(); i++) {
assertEquals(true[i], docs.get(i + 1).getFileName());
}
</DeepExtract>
assertFilesMatch("body css style", false, "file13.txt", "file14.txt");
}
|
eclipse-instasearch
|
positive
| 441,485
|
private void loadConfiguration() {
File configFile = new File("./server.json");
if (!configFile.getParentFile().isDirectory()) {
if (!configFile.getParentFile().delete()) {
try {
getLogger().severe("Could not delete existing file at " + configFile.getParentFile().getCanonicalPath() + ": does the server have the correct directory permissions?");
} catch (IOException exception) {
getLogger().log(SEVERE, "Could not get path to parent directory of config file: does the server have the correct directory permissions?", exception);
}
}
}
if (!configFile.getParentFile().exists()) {
if (!configFile.getParentFile().mkdirs()) {
try {
getLogger().severe("Could not create server directory at " + configFile.getParentFile().getCanonicalPath() + ": does the server have the correct directory permissions?");
} catch (IOException exception) {
getLogger().log(SEVERE, "Could not get path to parent directory of config file: does the server have the correct directory permissions?");
}
}
}
if (!configFile.exists()) {
Configuration defaultConfig = new Configuration();
defaultConfig.setMaxPlayers(10);
defaultConfig.setPort(11100);
defaultConfig.setTimeout((byte) 20);
Gson gson = new GsonBuilder().setPrettyPrinting().create();
try {
FileWriter writer = new FileWriter(configFile);
writer.write(gson.toJson(defaultConfig));
writer.close();
} catch (IOException exception) {
getLogger().log(SEVERE, "Failed to save default configuration: does the server have write permissions to the config file?", exception);
}
}
Gson gson = new GsonBuilder().setPrettyPrinting().create();
try {
Scanner scanner = new Scanner(new FileInputStream(new File("./server.json")));
StringBuilder jsonBuilder = new StringBuilder();
while (scanner.hasNextLine()) {
jsonBuilder.append(scanner.nextLine()).append('\n');
}
configuration = gson.fromJson(jsonBuilder.toString(), Configuration.class);
} catch (FileNotFoundException exception) {
getLogger().log(SEVERE, "Failed to load configuration", exception);
}
}
|
private void loadConfiguration() {
<DeepExtract>
File configFile = new File("./server.json");
if (!configFile.getParentFile().isDirectory()) {
if (!configFile.getParentFile().delete()) {
try {
getLogger().severe("Could not delete existing file at " + configFile.getParentFile().getCanonicalPath() + ": does the server have the correct directory permissions?");
} catch (IOException exception) {
getLogger().log(SEVERE, "Could not get path to parent directory of config file: does the server have the correct directory permissions?", exception);
}
}
}
if (!configFile.getParentFile().exists()) {
if (!configFile.getParentFile().mkdirs()) {
try {
getLogger().severe("Could not create server directory at " + configFile.getParentFile().getCanonicalPath() + ": does the server have the correct directory permissions?");
} catch (IOException exception) {
getLogger().log(SEVERE, "Could not get path to parent directory of config file: does the server have the correct directory permissions?");
}
}
}
if (!configFile.exists()) {
Configuration defaultConfig = new Configuration();
defaultConfig.setMaxPlayers(10);
defaultConfig.setPort(11100);
defaultConfig.setTimeout((byte) 20);
Gson gson = new GsonBuilder().setPrettyPrinting().create();
try {
FileWriter writer = new FileWriter(configFile);
writer.write(gson.toJson(defaultConfig));
writer.close();
} catch (IOException exception) {
getLogger().log(SEVERE, "Failed to save default configuration: does the server have write permissions to the config file?", exception);
}
}
</DeepExtract>
Gson gson = new GsonBuilder().setPrettyPrinting().create();
try {
Scanner scanner = new Scanner(new FileInputStream(new File("./server.json")));
StringBuilder jsonBuilder = new StringBuilder();
while (scanner.hasNextLine()) {
jsonBuilder.append(scanner.nextLine()).append('\n');
}
configuration = gson.fromJson(jsonBuilder.toString(), Configuration.class);
} catch (FileNotFoundException exception) {
getLogger().log(SEVERE, "Failed to load configuration", exception);
}
}
|
stormcloud
|
positive
| 441,488
|
@Override
public void run(final String arg0) {
final ImagePlus image = IJ.getImage();
if (image == null) {
IJ.error("No current image for automatic tracing.");
return;
}
final long width = image.getWidth();
final long height = image.getHeight();
final long depth = image.getStackSize();
final long pointsInImage = width * height * depth;
if (pointsInImage >= Integer.MAX_VALUE) {
IJ.error("This plugin currently only works with images with less that " + Integer.MAX_VALUE + " points.");
return;
}
final String macroOptions = Macro.getOptions();
if (macroOptions != null) {
final String liveValue = Macro.getValue(macroOptions, "live", "");
final String lower = liveValue.toLowerCase();
if (lower.length() > 0 && (lower.equals("no") || lower.equals("f") || lower.equals("false") || lower.equals("n")))
liveDisplay = false;
}
single_pane = true;
if (liveDisplay) {
initialize(image);
canvas = (AutoTracerCanvas) xy_canvas;
}
final Calibration calibration = image.getCalibration();
final FileInfo originalFileInfo = image.getOriginalFileInfo();
final String originalFileName = originalFileInfo.fileName;
System.out.println("originalFileName is " + originalFileName);
final int lastDot = originalFileName.lastIndexOf(".");
final String beforeExtension = originalFileName.substring(0, lastDot);
final String tubesFileName = beforeExtension + ".tubes.tif";
final String thresholdsFileName = beforeExtension + ".thresholds";
final String outputFileName = beforeExtension + ".traces.obj";
ImagePlus tubenessImage = null;
final File tubesFile = new File(originalFileInfo.directory, tubesFileName);
if (tubesFile.exists()) {
IJ.showStatus("Loading tubes file.");
tubenessImage = BatchOpener.openFirstChannel(tubesFile.getAbsolutePath());
if (tubenessImage == null) {
IJ.error("Failed to load tubes image from " + tubesFile.getAbsolutePath());
return;
}
} else {
IJ.showStatus("No tubes file found, generating anew...");
double minimumSeparation = 1;
if (calibration != null)
minimumSeparation = Math.min(Math.abs(calibration.pixelWidth), Math.min(Math.abs(calibration.pixelHeight), Math.abs(calibration.pixelDepth)));
final TubenessProcessor tubifier = new TubenessProcessor(minimumSeparation, true);
tubenessImage = tubifier.generateImage(image);
System.out.println("Got tubes file.");
final boolean saved = new FileSaver(tubenessImage).saveAsTiffStack(tubesFile.getAbsolutePath());
if (!saved) {
IJ.error("Failed to save tubes image to " + tubesFile.getAbsolutePath());
return;
}
}
if (!dimensionsIdentical(image, tubenessImage)) {
IJ.error("The dimensions of the image and the tube image didn't match.");
return;
}
final File thresholdsFile = new File(originalFileInfo.directory, thresholdsFileName);
System.out.println("Testing for the existence of: " + thresholdsFile.getAbsolutePath());
if (thresholdsFile.exists()) {
final AutoTracerParameters p = loadParameters(thresholdsFile.getAbsolutePath());
if (p == null) {
throw new RuntimeException("The thresholds file '" + thresholdsFile.getAbsolutePath() + "' was corrupted somehow.");
}
tubenessThreshold = p.tubenessThreshold;
minimumRollingMean = p.minimumRollingMean;
} else {
final GenericDialog gd = new GenericDialog("Auto Tracer");
gd.addNumericField("Tubeness threshold for destinations", tubenessThreshold, 2);
gd.addNumericField("Minimum rolling mean tubeness", minimumRollingMean, 2);
gd.addMessage("(For help about these options, please go to: http://fruitfly.inf.ed.ac.uk/auto-tracer/ )");
gd.showDialog();
if (gd.wasCanceled())
return;
tubenessThreshold = (float) gd.getNextNumber();
minimumRollingMean = (float) gd.getNextNumber();
if (tubenessThreshold < 0) {
throw new RuntimeException("Tubeness threshold for destinations must be positive");
}
if (minimumRollingMean < 0) {
throw new RuntimeException("Minimum rolling mean tubeness must be positive");
}
if (minimumRollingMean > tubenessThreshold) {
throw new RuntimeException("It doesn't make sense for tubeness threshold for destinations to be less than the minimum rolling mean tubeness.");
}
}
totalTimeStarted = System.currentTimeMillis();
System.out.println("Now using tubenessThreshold: " + tubenessThreshold);
System.out.println(" and minimumRollingMean: " + minimumRollingMean);
width = image.getWidth();
height = image.getHeight();
depth = image.getStackSize();
final ImageStack tubeStack = tubenessImage.getStack();
tubeValues = new float[depth][];
for (int z = 0; z < depth; ++z) {
tubeValues[z] = (float[]) tubeStack.getPixels(z + 1);
}
done = new HashSet<>();
recreatePriorityQueue(false);
System.out.println("Initial points: " + mostTubelikePoints.size());
if (false)
return;
final SinglePathsGraph completePaths = new SinglePathsGraph(width, height, depth, Math.abs(calibration.pixelWidth), Math.abs(calibration.pixelHeight), Math.abs(calibration.pixelDepth));
final int maxLoops = -1;
int loopsDone = 0;
while (mostTubelikePoints.size() > 0) {
final long currentTime = System.currentTimeMillis();
final long secondsSinceStart = (currentTime - totalTimeStarted) / 1000;
if (secondsSinceStart > totalTimeLimitSeconds)
break;
if (maxLoops >= 0 && loopsDone >= maxLoops)
break;
final AutoPoint startPoint = mostTubelikePoints.poll();
if (done.contains(startPoint)) {
continue;
}
System.out.println("=== Done size is: " + done.size());
System.out.println("=== Priority queue now has: " + mostTubelikePoints.size());
System.out.println("=== Loops done: " + loopsDone);
System.out.println(" Got point " + startPoint + " with tubeness: " + tubeValues[startPoint.z][startPoint.y * width + startPoint.x]);
if (liveDisplay)
image.setSlice(startPoint.z + 1);
ast = new AutoSearchThread(image, tubeValues, startPoint, tubenessThreshold, completePaths);
threadTimeStarted = currentTime;
ast.setDrawingColors(Color.BLUE, Color.CYAN);
ast.setDrawingThreshold(-1);
ast.addProgressListener(this);
if (liveDisplay)
canvas.addSearchThread(ast);
ast.start();
try {
ast.join();
} catch (final InterruptedException e) {
}
if (liveDisplay)
canvas.removeSearchThread(ast);
final ArrayList<AutoPoint> destinations = ast.getDestinations();
System.out.println(" === Destinations: " + destinations.size());
if (verbose)
System.out.print(" === Destinations: " + destinations.size() + " ");
if (verbose)
System.out.flush();
for (final AutoPoint d : destinations) {
if (verbose)
System.out.print(" ");
final Path path = ast.getPathBack(d.x, d.y, d.z);
final float[] rollingTubeness = new float[rollingLength];
int nextRollingAt = 0;
int slotsFilled = 0;
int lastIndex = path.size() - 1;
if (minimumPointsOnPath >= 0 && path.size() < minimumPointsOnPath) {
lastIndex = -1;
} else {
for (int i = 0; i < path.size(); ++i) {
if (verbose)
System.out.print(".");
if (verbose)
System.out.flush();
final int pax = path.getXUnscaled(i);
final int pay = path.getYUnscaled(i);
final int paz = path.getZUnscaled(i);
final float tubenessThere = tubeValues[paz][pay * width + pax];
rollingTubeness[nextRollingAt] = tubenessThere;
if (slotsFilled < nextRollingAt + 1)
slotsFilled = nextRollingAt + 1;
float mean = 0;
for (int s = 0; s < slotsFilled; ++s) {
mean += rollingTubeness[s];
}
mean /= slotsFilled;
if (mean < minimumRollingMean) {
lastIndex = (i + 1) - slotsFilled;
break;
}
if (nextRollingAt == rollingLength - 1)
nextRollingAt = 0;
else
++nextRollingAt;
}
}
AutoPoint current = null;
AutoPoint last = null;
final HashSet<AutoPoint> destinationsToPrune = new HashSet<>();
for (int i = 0; i <= lastIndex; ++i) {
if (verbose)
System.out.print("#");
if (verbose)
System.out.flush();
final int pax = path.getXUnscaled(i);
final int pay = path.getYUnscaled(i);
final int paz = path.getZUnscaled(i);
final float tubenessThere = tubeValues[paz][pay * width + pax];
current = new AutoPoint(pax, pay, paz);
if (tubenessThere > tubenessThreshold) {
destinationsToPrune.add(current);
}
completePaths.addPoint(current, last);
last = current;
}
for (final AutoPoint toRemove : destinationsToPrune) {
if (verbose)
System.out.flush();
done.add(toRemove);
}
if (verbose)
System.out.println("");
}
ast = null;
System.gc();
final long freeMem = Runtime.getRuntime().freeMemory();
final long totMem = Runtime.getRuntime().totalMemory();
final int percentUsed = (int) (((totMem - freeMem) * 100) / totMem);
System.out.println("=== Memory usage: " + percentUsed + "%");
if ((percentUsed > 95) || ((loopsDone % 50) == 49)) {
recreatePriorityQueue(true);
if (mostTubelikePoints.size() == 0)
break;
}
++loopsDone;
}
final File outputFile = new File(originalFileInfo.directory, outputFileName);
try {
completePaths.writeWavefrontObj(outputFile.getAbsolutePath());
} catch (final IOException e) {
IJ.error("Writing the Wavefront OBJ file '" + outputFile.getAbsolutePath() + "' failed");
return;
}
}
|
@Override
public void run(final String arg0) {
final ImagePlus image = IJ.getImage();
if (image == null) {
IJ.error("No current image for automatic tracing.");
return;
}
final long width = image.getWidth();
final long height = image.getHeight();
final long depth = image.getStackSize();
final long pointsInImage = width * height * depth;
if (pointsInImage >= Integer.MAX_VALUE) {
IJ.error("This plugin currently only works with images with less that " + Integer.MAX_VALUE + " points.");
return;
}
final String macroOptions = Macro.getOptions();
if (macroOptions != null) {
final String liveValue = Macro.getValue(macroOptions, "live", "");
final String lower = liveValue.toLowerCase();
if (lower.length() > 0 && (lower.equals("no") || lower.equals("f") || lower.equals("false") || lower.equals("n")))
liveDisplay = false;
}
single_pane = true;
if (liveDisplay) {
initialize(image);
canvas = (AutoTracerCanvas) xy_canvas;
}
<DeepExtract>
final Calibration calibration = image.getCalibration();
final FileInfo originalFileInfo = image.getOriginalFileInfo();
final String originalFileName = originalFileInfo.fileName;
System.out.println("originalFileName is " + originalFileName);
final int lastDot = originalFileName.lastIndexOf(".");
final String beforeExtension = originalFileName.substring(0, lastDot);
final String tubesFileName = beforeExtension + ".tubes.tif";
final String thresholdsFileName = beforeExtension + ".thresholds";
final String outputFileName = beforeExtension + ".traces.obj";
ImagePlus tubenessImage = null;
final File tubesFile = new File(originalFileInfo.directory, tubesFileName);
if (tubesFile.exists()) {
IJ.showStatus("Loading tubes file.");
tubenessImage = BatchOpener.openFirstChannel(tubesFile.getAbsolutePath());
if (tubenessImage == null) {
IJ.error("Failed to load tubes image from " + tubesFile.getAbsolutePath());
return;
}
} else {
IJ.showStatus("No tubes file found, generating anew...");
double minimumSeparation = 1;
if (calibration != null)
minimumSeparation = Math.min(Math.abs(calibration.pixelWidth), Math.min(Math.abs(calibration.pixelHeight), Math.abs(calibration.pixelDepth)));
final TubenessProcessor tubifier = new TubenessProcessor(minimumSeparation, true);
tubenessImage = tubifier.generateImage(image);
System.out.println("Got tubes file.");
final boolean saved = new FileSaver(tubenessImage).saveAsTiffStack(tubesFile.getAbsolutePath());
if (!saved) {
IJ.error("Failed to save tubes image to " + tubesFile.getAbsolutePath());
return;
}
}
if (!dimensionsIdentical(image, tubenessImage)) {
IJ.error("The dimensions of the image and the tube image didn't match.");
return;
}
final File thresholdsFile = new File(originalFileInfo.directory, thresholdsFileName);
System.out.println("Testing for the existence of: " + thresholdsFile.getAbsolutePath());
if (thresholdsFile.exists()) {
final AutoTracerParameters p = loadParameters(thresholdsFile.getAbsolutePath());
if (p == null) {
throw new RuntimeException("The thresholds file '" + thresholdsFile.getAbsolutePath() + "' was corrupted somehow.");
}
tubenessThreshold = p.tubenessThreshold;
minimumRollingMean = p.minimumRollingMean;
} else {
final GenericDialog gd = new GenericDialog("Auto Tracer");
gd.addNumericField("Tubeness threshold for destinations", tubenessThreshold, 2);
gd.addNumericField("Minimum rolling mean tubeness", minimumRollingMean, 2);
gd.addMessage("(For help about these options, please go to: http://fruitfly.inf.ed.ac.uk/auto-tracer/ )");
gd.showDialog();
if (gd.wasCanceled())
return;
tubenessThreshold = (float) gd.getNextNumber();
minimumRollingMean = (float) gd.getNextNumber();
if (tubenessThreshold < 0) {
throw new RuntimeException("Tubeness threshold for destinations must be positive");
}
if (minimumRollingMean < 0) {
throw new RuntimeException("Minimum rolling mean tubeness must be positive");
}
if (minimumRollingMean > tubenessThreshold) {
throw new RuntimeException("It doesn't make sense for tubeness threshold for destinations to be less than the minimum rolling mean tubeness.");
}
}
totalTimeStarted = System.currentTimeMillis();
System.out.println("Now using tubenessThreshold: " + tubenessThreshold);
System.out.println(" and minimumRollingMean: " + minimumRollingMean);
width = image.getWidth();
height = image.getHeight();
depth = image.getStackSize();
final ImageStack tubeStack = tubenessImage.getStack();
tubeValues = new float[depth][];
for (int z = 0; z < depth; ++z) {
tubeValues[z] = (float[]) tubeStack.getPixels(z + 1);
}
done = new HashSet<>();
recreatePriorityQueue(false);
System.out.println("Initial points: " + mostTubelikePoints.size());
if (false)
return;
final SinglePathsGraph completePaths = new SinglePathsGraph(width, height, depth, Math.abs(calibration.pixelWidth), Math.abs(calibration.pixelHeight), Math.abs(calibration.pixelDepth));
final int maxLoops = -1;
int loopsDone = 0;
while (mostTubelikePoints.size() > 0) {
final long currentTime = System.currentTimeMillis();
final long secondsSinceStart = (currentTime - totalTimeStarted) / 1000;
if (secondsSinceStart > totalTimeLimitSeconds)
break;
if (maxLoops >= 0 && loopsDone >= maxLoops)
break;
final AutoPoint startPoint = mostTubelikePoints.poll();
if (done.contains(startPoint)) {
continue;
}
System.out.println("=== Done size is: " + done.size());
System.out.println("=== Priority queue now has: " + mostTubelikePoints.size());
System.out.println("=== Loops done: " + loopsDone);
System.out.println(" Got point " + startPoint + " with tubeness: " + tubeValues[startPoint.z][startPoint.y * width + startPoint.x]);
if (liveDisplay)
image.setSlice(startPoint.z + 1);
ast = new AutoSearchThread(image, tubeValues, startPoint, tubenessThreshold, completePaths);
threadTimeStarted = currentTime;
ast.setDrawingColors(Color.BLUE, Color.CYAN);
ast.setDrawingThreshold(-1);
ast.addProgressListener(this);
if (liveDisplay)
canvas.addSearchThread(ast);
ast.start();
try {
ast.join();
} catch (final InterruptedException e) {
}
if (liveDisplay)
canvas.removeSearchThread(ast);
final ArrayList<AutoPoint> destinations = ast.getDestinations();
System.out.println(" === Destinations: " + destinations.size());
if (verbose)
System.out.print(" === Destinations: " + destinations.size() + " ");
if (verbose)
System.out.flush();
for (final AutoPoint d : destinations) {
if (verbose)
System.out.print(" ");
final Path path = ast.getPathBack(d.x, d.y, d.z);
final float[] rollingTubeness = new float[rollingLength];
int nextRollingAt = 0;
int slotsFilled = 0;
int lastIndex = path.size() - 1;
if (minimumPointsOnPath >= 0 && path.size() < minimumPointsOnPath) {
lastIndex = -1;
} else {
for (int i = 0; i < path.size(); ++i) {
if (verbose)
System.out.print(".");
if (verbose)
System.out.flush();
final int pax = path.getXUnscaled(i);
final int pay = path.getYUnscaled(i);
final int paz = path.getZUnscaled(i);
final float tubenessThere = tubeValues[paz][pay * width + pax];
rollingTubeness[nextRollingAt] = tubenessThere;
if (slotsFilled < nextRollingAt + 1)
slotsFilled = nextRollingAt + 1;
float mean = 0;
for (int s = 0; s < slotsFilled; ++s) {
mean += rollingTubeness[s];
}
mean /= slotsFilled;
if (mean < minimumRollingMean) {
lastIndex = (i + 1) - slotsFilled;
break;
}
if (nextRollingAt == rollingLength - 1)
nextRollingAt = 0;
else
++nextRollingAt;
}
}
AutoPoint current = null;
AutoPoint last = null;
final HashSet<AutoPoint> destinationsToPrune = new HashSet<>();
for (int i = 0; i <= lastIndex; ++i) {
if (verbose)
System.out.print("#");
if (verbose)
System.out.flush();
final int pax = path.getXUnscaled(i);
final int pay = path.getYUnscaled(i);
final int paz = path.getZUnscaled(i);
final float tubenessThere = tubeValues[paz][pay * width + pax];
current = new AutoPoint(pax, pay, paz);
if (tubenessThere > tubenessThreshold) {
destinationsToPrune.add(current);
}
completePaths.addPoint(current, last);
last = current;
}
for (final AutoPoint toRemove : destinationsToPrune) {
if (verbose)
System.out.flush();
done.add(toRemove);
}
if (verbose)
System.out.println("");
}
ast = null;
System.gc();
final long freeMem = Runtime.getRuntime().freeMemory();
final long totMem = Runtime.getRuntime().totalMemory();
final int percentUsed = (int) (((totMem - freeMem) * 100) / totMem);
System.out.println("=== Memory usage: " + percentUsed + "%");
if ((percentUsed > 95) || ((loopsDone % 50) == 49)) {
recreatePriorityQueue(true);
if (mostTubelikePoints.size() == 0)
break;
}
++loopsDone;
}
final File outputFile = new File(originalFileInfo.directory, outputFileName);
try {
completePaths.writeWavefrontObj(outputFile.getAbsolutePath());
} catch (final IOException e) {
IJ.error("Writing the Wavefront OBJ file '" + outputFile.getAbsolutePath() + "' failed");
return;
}
</DeepExtract>
}
|
SNT
|
positive
| 441,489
|
protected void sendLineWithoutWait(String text, Object... parameters) throws IOException {
boolean wasSetWaitingForOk = isWaitForOKafterEachLine();
setWaitForOKafterEachLine(false);
out.format(FORMAT_LOCALE, text.replace(" ", "") + LINEEND(), parameters);
out.flush();
if (isWaitForOKafterEachLine()) {
String line = waitForLine();
if (!"ok".equals(line)) {
throw new IOException("Lasercutter did not respond 'ok', but '" + line + "'instead.");
}
}
setWaitForOKafterEachLine(wasSetWaitingForOk);
}
|
protected void sendLineWithoutWait(String text, Object... parameters) throws IOException {
boolean wasSetWaitingForOk = isWaitForOKafterEachLine();
setWaitForOKafterEachLine(false);
<DeepExtract>
out.format(FORMAT_LOCALE, text.replace(" ", "") + LINEEND(), parameters);
out.flush();
if (isWaitForOKafterEachLine()) {
String line = waitForLine();
if (!"ok".equals(line)) {
throw new IOException("Lasercutter did not respond 'ok', but '" + line + "'instead.");
}
}
</DeepExtract>
setWaitForOKafterEachLine(wasSetWaitingForOk);
}
|
LibLaserCut
|
positive
| 441,491
|
private int adjustPosition(int pos, int screenDim, int margin, int docDim) {
int min;
if (docDim <= screenDim) {
min = margin + docDim - screenDim;
} else {
min = 0;
}
int max;
if (docDim <= screenDim) {
max = margin;
} else {
max = 2 * margin + docDim - screenDim;
}
if (pos < min)
return min;
else if (max < pos)
return max;
else
return pos;
}
|
private int adjustPosition(int pos, int screenDim, int margin, int docDim) {
int min;
if (docDim <= screenDim) {
min = margin + docDim - screenDim;
} else {
min = 0;
}
<DeepExtract>
int max;
if (docDim <= screenDim) {
max = margin;
} else {
max = 2 * margin + docDim - screenDim;
}
</DeepExtract>
if (pos < min)
return min;
else if (max < pos)
return max;
else
return pos;
}
|
android-pdf-viewer
|
positive
| 441,492
|
private void checkUpdate() throws Exception {
if ((System.currentTimeMillis() - lastUpdateMs) < pollingMs) {
return;
}
List<String> keys = getFileNames(lockPrefix);
log.debug(String.format("keys: %s", keys));
List<String> newKeys = Lists.newArrayList();
for (String key : keys) {
long epochStamp = getEpochStampForKey(key);
if (!key.equals(this.key) && ((System.currentTimeMillis() - epochStamp) > timeoutMs)) {
deleteFile(key);
} else {
newKeys.add(key);
}
}
return newKeys;
log.debug(String.format("cleaned keys: %s", keys));
Collections.sort(keys);
if (keys.size() > 0) {
String lockerKey = keys.get(0);
long lockerAge = System.currentTimeMillis() - getEpochStampForKey(key);
ownsTheLock = (lockerKey.equals(key) && (lockerAge >= settlingMs));
} else {
long elapsed = System.currentTimeMillis() - lockStartMs;
if (elapsed > (settlingMs * MISSING_KEY_FACTOR)) {
throw new Exception(String.format("Our key is missing. Key: %s, Elapsed: %d, Max Wait: %d", key, elapsed, settlingMs * MISSING_KEY_FACTOR));
}
}
lastUpdateMs = System.currentTimeMillis();
notifyAll();
}
|
private void checkUpdate() throws Exception {
if ((System.currentTimeMillis() - lastUpdateMs) < pollingMs) {
return;
}
List<String> keys = getFileNames(lockPrefix);
log.debug(String.format("keys: %s", keys));
<DeepExtract>
List<String> newKeys = Lists.newArrayList();
for (String key : keys) {
long epochStamp = getEpochStampForKey(key);
if (!key.equals(this.key) && ((System.currentTimeMillis() - epochStamp) > timeoutMs)) {
deleteFile(key);
} else {
newKeys.add(key);
}
}
return newKeys;
</DeepExtract>
log.debug(String.format("cleaned keys: %s", keys));
Collections.sort(keys);
if (keys.size() > 0) {
String lockerKey = keys.get(0);
long lockerAge = System.currentTimeMillis() - getEpochStampForKey(key);
ownsTheLock = (lockerKey.equals(key) && (lockerAge >= settlingMs));
} else {
long elapsed = System.currentTimeMillis() - lockStartMs;
if (elapsed > (settlingMs * MISSING_KEY_FACTOR)) {
throw new Exception(String.format("Our key is missing. Key: %s, Elapsed: %d, Max Wait: %d", key, elapsed, settlingMs * MISSING_KEY_FACTOR));
}
}
lastUpdateMs = System.currentTimeMillis();
notifyAll();
}
|
exhibitor
|
positive
| 441,494
|
@Test
void ofScripts() {
CqlDataSet d1 = CqlDataSet.ofScripts(CqlDataSet.ofClassPaths("schema.cql"));
assertThat(d1.getStatements()).containsExactly("CREATE KEYSPACE test WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }");
assertThat(d1.getScripts()).hasSize(1);
}
|
@Test
void ofScripts() {
CqlDataSet d1 = CqlDataSet.ofScripts(CqlDataSet.ofClassPaths("schema.cql"));
<DeepExtract>
assertThat(d1.getStatements()).containsExactly("CREATE KEYSPACE test WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 }");
</DeepExtract>
assertThat(d1.getScripts()).hasSize(1);
}
|
embedded-cassandra
|
positive
| 441,496
|
public void testDrawTextRenderInputStreamBooleanDrawTextParameter() throws Exception {
InputStream file = new FileInputStream(getFileStr());
ImageRender dr = new DrawTextRender(file, true, getParam());
ImageRender wr = new WriteRender(dr, rpath.getCanonicalPath() + File.separator + "DRAWTEXT_334.jpg");
wr.render();
wr.dispose();
file.close();
}
|
public void testDrawTextRenderInputStreamBooleanDrawTextParameter() throws Exception {
InputStream file = new FileInputStream(getFileStr());
ImageRender dr = new DrawTextRender(file, true, getParam());
<DeepExtract>
ImageRender wr = new WriteRender(dr, rpath.getCanonicalPath() + File.separator + "DRAWTEXT_334.jpg");
wr.render();
wr.dispose();
</DeepExtract>
file.close();
}
|
simpleimage
|
positive
| 441,498
|
@Override
public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes attrs) throws IOException {
out.printf("%" + path.getNameCount() * 2 + "s", "");
out.printf("[%s]%n", path.getFileName());
return CONTINUE;
}
|
@Override
public FileVisitResult preVisitDirectory(Path path, BasicFileAttributes attrs) throws IOException {
<DeepExtract>
out.printf("%" + path.getNameCount() * 2 + "s", "");
</DeepExtract>
out.printf("[%s]%n", path.getFileName());
return CONTINUE;
}
|
JavaSE8Tutorial
|
positive
| 441,499
|
public static boolean arg(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "arg"))
return false;
if (!nextTokenIs(b, "<arg>", ARG_START, DYNAMIC_ARG_START))
return false;
Marker m = enter_section_(b, l, _NONE_, ARG, "<arg>");
if (!recursion_guard_(b, l + 1, "dynamicArg"))
r = false;
if (!nextTokenIs(b, DYNAMIC_ARG_START))
r = false;
boolean r;
Marker m = enter_section_(b);
r = consumeTokens(b, 0, DYNAMIC_ARG_START, DYNAMIC_ARG, DYNAMIC_ARG_END);
exit_section_(b, m, DYNAMIC_ARG, r);
return r;
if (!r)
r = staticArg(b, l + 1);
exit_section_(b, l, m, r, false, null);
return r;
}
|
public static boolean arg(PsiBuilder b, int l) {
if (!recursion_guard_(b, l, "arg"))
return false;
if (!nextTokenIs(b, "<arg>", ARG_START, DYNAMIC_ARG_START))
return false;
Marker m = enter_section_(b, l, _NONE_, ARG, "<arg>");
<DeepExtract>
if (!recursion_guard_(b, l + 1, "dynamicArg"))
r = false;
if (!nextTokenIs(b, DYNAMIC_ARG_START))
r = false;
boolean r;
Marker m = enter_section_(b);
r = consumeTokens(b, 0, DYNAMIC_ARG_START, DYNAMIC_ARG, DYNAMIC_ARG_END);
exit_section_(b, m, DYNAMIC_ARG, r);
return r;
</DeepExtract>
if (!r)
r = staticArg(b, l + 1);
exit_section_(b, l, m, r, false, null);
return r;
}
|
Intellij-Plugin
|
positive
| 441,501
|
@Override
public void refreshParameterValue() {
String paramValue = System.getProperty(this.paramName);
paramValue = isSystemParameterEmpty(paramValue) ? this.defaultValue : paramValue.toLowerCase();
;
switch(this.name()) {
case "BROWSER":
if (paramValue.equals("ie")) {
paramValue = "internet explorer";
}
break;
case "BROWSER_VERSION":
break;
case "SELENIUM_GRID":
break;
case "OS":
break;
default:
BFLogger.logError("Unknown RuntimeParameter = " + this.name());
break;
}
this.paramValue = paramValue;
}
|
@Override
public void refreshParameterValue() {
<DeepExtract>
String paramValue = System.getProperty(this.paramName);
paramValue = isSystemParameterEmpty(paramValue) ? this.defaultValue : paramValue.toLowerCase();
;
switch(this.name()) {
case "BROWSER":
if (paramValue.equals("ie")) {
paramValue = "internet explorer";
}
break;
case "BROWSER_VERSION":
break;
case "SELENIUM_GRID":
break;
case "OS":
break;
default:
BFLogger.logError("Unknown RuntimeParameter = " + this.name());
break;
}
this.paramValue = paramValue;
</DeepExtract>
}
|
mrchecker
|
positive
| 441,504
|
@Override
public void onCreateAfter(Bundle savedInstanceState) {
ViewCompat.setTransitionName(mViewPager, SHARED_ELEMENT_NAME);
Intent intent = this.getIntent();
int flags = intent.getFlags();
if ((flags & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0) {
if (intent.getAction() != null && Intent.ACTION_VIEW.equals(intent.getAction())) {
if (SCHEME_FILE.equals(intent.getScheme())) {
String type = getIntent().getType();
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri uri = intent.getData();
if (uri != null && SCHEME_FILE.equalsIgnoreCase(uri.getScheme())) {
currentFilePath = FileUtils.uri2FilePath(getBaseContext(), uri);
}
}
}
}
mEditorFragment = EditorFragment.getInstance(currentFilePath);
mEditorMarkdownFragment = EditorMarkdownFragment.getInstance();
mViewPager.setAdapter(new EditFragmentAdapter(getSupportFragmentManager()));
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
if (position == 0)
getToolbar().setTitle("");
else if (mName != null)
getToolbar().setTitle(mName);
if (position == 1) {
RxEventBus.getInstance().send(new RxEvent(RxEvent.TYPE_REFRESH_NOTIFY));
}
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
mTabIconView = (TabIconView) findViewById(R.id.tabIconView);
mTabIconView.addTab(R.drawable.ic_shortcut_format_list_bulleted, R.id.id_shortcut_list_bulleted, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_list_numbers, R.id.id_shortcut_format_numbers, this);
mTabIconView.addTab(R.drawable.ic_shortcut_insert_link, R.id.id_shortcut_insert_link, this);
mTabIconView.addTab(R.drawable.ic_shortcut_insert_photo, R.id.id_shortcut_insert_photo, this);
mTabIconView.addTab(R.drawable.ic_shortcut_console, R.id.id_shortcut_console, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_bold, R.id.id_shortcut_format_bold, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_italic, R.id.id_shortcut_format_italic, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_1, R.id.id_shortcut_format_header_1, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_2, R.id.id_shortcut_format_header_2, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_3, R.id.id_shortcut_format_header_3, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_quote, R.id.id_shortcut_format_quote, this);
mTabIconView.addTab(R.drawable.ic_shortcut_xml, R.id.id_shortcut_xml, this);
mTabIconView.addTab(R.drawable.ic_shortcut_minus, R.id.id_shortcut_minus, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_strikethrough, R.id.id_shortcut_format_strikethrough, this);
mTabIconView.addTab(R.drawable.ic_shortcut_grid, R.id.id_shortcut_grid, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_4, R.id.id_shortcut_format_header_4, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_5, R.id.id_shortcut_format_header_5, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_6, R.id.id_shortcut_format_header_6, this);
}
|
@Override
public void onCreateAfter(Bundle savedInstanceState) {
ViewCompat.setTransitionName(mViewPager, SHARED_ELEMENT_NAME);
Intent intent = this.getIntent();
int flags = intent.getFlags();
if ((flags & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY) == 0) {
if (intent.getAction() != null && Intent.ACTION_VIEW.equals(intent.getAction())) {
if (SCHEME_FILE.equals(intent.getScheme())) {
String type = getIntent().getType();
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
Uri uri = intent.getData();
if (uri != null && SCHEME_FILE.equalsIgnoreCase(uri.getScheme())) {
currentFilePath = FileUtils.uri2FilePath(getBaseContext(), uri);
}
}
}
}
mEditorFragment = EditorFragment.getInstance(currentFilePath);
mEditorMarkdownFragment = EditorMarkdownFragment.getInstance();
mViewPager.setAdapter(new EditFragmentAdapter(getSupportFragmentManager()));
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override
public void onPageSelected(int position) {
if (position == 0)
getToolbar().setTitle("");
else if (mName != null)
getToolbar().setTitle(mName);
if (position == 1) {
RxEventBus.getInstance().send(new RxEvent(RxEvent.TYPE_REFRESH_NOTIFY));
}
}
@Override
public void onPageScrollStateChanged(int state) {
}
});
<DeepExtract>
mTabIconView = (TabIconView) findViewById(R.id.tabIconView);
mTabIconView.addTab(R.drawable.ic_shortcut_format_list_bulleted, R.id.id_shortcut_list_bulleted, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_list_numbers, R.id.id_shortcut_format_numbers, this);
mTabIconView.addTab(R.drawable.ic_shortcut_insert_link, R.id.id_shortcut_insert_link, this);
mTabIconView.addTab(R.drawable.ic_shortcut_insert_photo, R.id.id_shortcut_insert_photo, this);
mTabIconView.addTab(R.drawable.ic_shortcut_console, R.id.id_shortcut_console, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_bold, R.id.id_shortcut_format_bold, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_italic, R.id.id_shortcut_format_italic, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_1, R.id.id_shortcut_format_header_1, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_2, R.id.id_shortcut_format_header_2, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_3, R.id.id_shortcut_format_header_3, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_quote, R.id.id_shortcut_format_quote, this);
mTabIconView.addTab(R.drawable.ic_shortcut_xml, R.id.id_shortcut_xml, this);
mTabIconView.addTab(R.drawable.ic_shortcut_minus, R.id.id_shortcut_minus, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_strikethrough, R.id.id_shortcut_format_strikethrough, this);
mTabIconView.addTab(R.drawable.ic_shortcut_grid, R.id.id_shortcut_grid, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_4, R.id.id_shortcut_format_header_4, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_5, R.id.id_shortcut_format_header_5, this);
mTabIconView.addTab(R.drawable.ic_shortcut_format_header_6, R.id.id_shortcut_format_header_6, this);
</DeepExtract>
}
|
MarkdownEditors
|
positive
| 441,505
|
@NotNull
public String readUtf(int size) throws IOException {
byte[] b = new byte[size];
for (int i = 0; i < b.length; i++) {
b[i] = data[offset + position + i];
}
position += b.length;
return new String(b);
}
|
@NotNull
public String readUtf(int size) throws IOException {
byte[] b = new byte[size];
<DeepExtract>
for (int i = 0; i < b.length; i++) {
b[i] = data[offset + position + i];
}
position += b.length;
</DeepExtract>
return new String(b);
}
|
PE
|
positive
| 441,506
|
public FriendsFeature getFriendsFeature() {
RegionFeature result = features.get(FriendsFeature.class);
if (result == null) {
result = plugin.getFeatureManager().getRegionFeature(this, FriendsFeature.class);
features.put(FriendsFeature.class, result);
}
return FriendsFeature.class.cast(result);
}
|
public FriendsFeature getFriendsFeature() {
<DeepExtract>
RegionFeature result = features.get(FriendsFeature.class);
if (result == null) {
result = plugin.getFeatureManager().getRegionFeature(this, FriendsFeature.class);
features.put(FriendsFeature.class, result);
}
return FriendsFeature.class.cast(result);
</DeepExtract>
}
|
AreaShop
|
positive
| 441,508
|
private void updateCameraSize() {
CameraSetting profile = SettingManager.getCameraProfile(getApplicationContext());
int factor;
switch(profile.getSize()) {
case CameraSetting.SIZE_BIG:
factor = 3;
break;
case CameraSetting.SIZE_MEDIUM:
factor = 4;
break;
default:
factor = 5;
break;
}
if (mScreenWidth > mScreenHeight) {
mCameraWidth = mScreenWidth / factor;
mCameraHeight = mScreenHeight / factor;
} else {
mCameraWidth = mScreenHeight / factor;
mCameraHeight = mScreenWidth / factor;
}
if (DEBUG)
Log.i(TAG, "calculateCameraSize: " + mScreenWidth + "x" + mScreenHeight);
Log.d(TAG, "onConfigurationChanged: DETECTED" + getResources().getConfiguration().orientation);
int width = mCameraWidth, height = mCameraHeight;
ViewGroup.LayoutParams params = cameraPreview.getLayoutParams();
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
params.height = width;
params.width = height;
} else {
params.height = height;
params.width = width;
}
cameraPreview.setLayoutParams(params);
}
|
private void updateCameraSize() {
CameraSetting profile = SettingManager.getCameraProfile(getApplicationContext());
int factor;
switch(profile.getSize()) {
case CameraSetting.SIZE_BIG:
factor = 3;
break;
case CameraSetting.SIZE_MEDIUM:
factor = 4;
break;
default:
factor = 5;
break;
}
if (mScreenWidth > mScreenHeight) {
mCameraWidth = mScreenWidth / factor;
mCameraHeight = mScreenHeight / factor;
} else {
mCameraWidth = mScreenHeight / factor;
mCameraHeight = mScreenWidth / factor;
}
if (DEBUG)
Log.i(TAG, "calculateCameraSize: " + mScreenWidth + "x" + mScreenHeight);
<DeepExtract>
Log.d(TAG, "onConfigurationChanged: DETECTED" + getResources().getConfiguration().orientation);
int width = mCameraWidth, height = mCameraHeight;
ViewGroup.LayoutParams params = cameraPreview.getLayoutParams();
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
params.height = width;
params.width = height;
} else {
params.height = height;
params.width = width;
}
cameraPreview.setLayoutParams(params);
</DeepExtract>
}
|
Zecorder
|
positive
| 441,510
|
@Scheduled("30s")
public void saveRoundVoteSnapshot() {
if (!this.config.isVoteJobEnabled()) {
return;
}
Timestamp lastEndDate = this.dslContext.select(DSL.max(VOTING_ROUND.END_DATE)).from(VOTING_ROUND).fetchOneInto(Timestamp.class);
Instant instant = Instant.ofEpochMilli(this.fullNodeCli.getNextMaintenanceTime());
LocalDateTime maintenanceTime = instant.atZone(ZoneOffset.UTC).toLocalDateTime();
List<VotingRoundRecord> records = new ArrayList<>();
Timestamp firstBlockTS = this.dslContext.select(DSL.max(VOTING_ROUND.START_DATE)).from(VOTING_ROUND).fetchOneInto(Timestamp.class);
if (lastEndDate == null) {
firstBlockTS = this.dslContext.select(BLOCK.TIMESTAMP).from(BLOCK).where(BLOCK.NUM.eq(ULong.valueOf(1))).fetchOneInto(Timestamp.class);
}
if (lastEndDate != null && lastEndDate.equals(Timestamp.valueOf(maintenanceTime))) {
return;
}
LocalDateTime firstBlockLdt = firstBlockTS.toLocalDateTime();
while (maintenanceTime.isAfter(firstBlockLdt)) {
LocalDateTime startTime = maintenanceTime.minusHours(6);
VotingRoundRecord vr = new VotingRoundRecord();
vr.setMonth(UInteger.valueOf(startTime.getMonthValue()));
vr.setDay(UInteger.valueOf(startTime.getDayOfMonth()));
vr.setYear(UInteger.valueOf(startTime.getYear()));
vr.setEndDate(Timestamp.valueOf(maintenanceTime));
vr.setStartDate(Timestamp.valueOf(startTime));
maintenanceTime = startTime;
if (Timestamp.valueOf(startTime).equals(firstBlockTS)) {
continue;
} else {
records.add(vr);
}
}
this.dslContext.batchInsert(records).execute();
VotingRound vr = VOTING_ROUND.as("vr");
Table<Record2<Object, UInteger>> tmp = DSL.select(DSL.field("@rownum := @rownum+1").as("round"), VOTING_ROUND.ID).from(VOTING_ROUND).crossJoin("(select @rownum:=0) tmp").orderBy(VOTING_ROUND.END_DATE.asc()).asTable("tmp");
this.dslContext.update(vr).set(vr.ROUND, DSL.select(DSL.field("round", UInteger.class)).from(tmp).where(vr.ID.eq(tmp.field("id", UInteger.class)))).execute();
io.trxplorer.model.tables.pojos.VotingRound round = this.dslContext.select(VOTING_ROUND.fields()).from(VOTING_ROUND).where(VOTING_ROUND.SYNC_END.isNull()).orderBy(VOTING_ROUND.ROUND.desc()).limit(1).offset(1).fetchOneInto(io.trxplorer.model.tables.pojos.VotingRound.class);
Timestamp lastBlockTs = this.dslContext.select(DSL.max(BLOCK.TIMESTAMP)).from(BLOCK).fetchOneInto(Timestamp.class);
if (round.getSyncEnd() != null || round.getEndDate().after(lastBlockTs)) {
return;
}
this.dslContext.update(VOTING_ROUND).set(VOTING_ROUND.SYNC_START, Timestamp.valueOf(LocalDateTime.now())).where(VOTING_ROUND.ID.eq(round.getId())).execute();
List<String> addresses = this.dslContext.select(WITNESS.ADDRESS).from(WITNESS, ACCOUNT).where(WITNESS.ADDRESS.eq(ACCOUNT.ADDRESS).and(ACCOUNT.CREATE_TIME.lt(round.getEndDate()))).fetchInto(String.class);
this.dslContext.deleteFrom(VOTING_ROUND_VOTE).where(VOTING_ROUND_VOTE.VOTING_ROUND_ID.eq(round.getId())).execute();
this.dslContext.deleteFrom(VOTING_ROUND_VOTE_LOST).where(VOTING_ROUND_VOTE_LOST.VOTING_ROUND_ID.eq(round.getId())).execute();
this.dslContext.deleteFrom(VOTING_ROUND_STATS).where(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).execute();
this.dslContext.insertInto(VOTING_ROUND_VOTE).columns(VOTING_ROUND_VOTE.VOTING_ROUND_ID, VOTING_ROUND_VOTE.OWNER_ADDRESS, VOTING_ROUND_VOTE.VOTE_ADDRESS, VOTING_ROUND_VOTE.VOTE_COUNT, VOTING_ROUND_VOTE.TIMESTAMP).select(DSL.select(DSL.value(round.getId()), ACCOUNT.ADDRESS, ACCOUNT_VOTE.VOTE_ADDRESS, ACCOUNT_VOTE.VOTE_COUNT.cast(Long.class), ACCOUNT_VOTE.TIMESTAMP).from(ACCOUNT, ACCOUNT_VOTE).where(ACCOUNT.ID.eq(ACCOUNT_VOTE.ACCOUNT_ID))).execute();
for (String witnessAddress : addresses) {
this.dslContext.insertInto(VOTING_ROUND_STATS).set(VOTING_ROUND_STATS.ADDRESS, witnessAddress).set(VOTING_ROUND_STATS.VOTING_ROUND_ID, round.getId()).set(VOTING_ROUND_STATS.VOTE_COUNT, DSL.select(DSL.sum(VOTING_ROUND_VOTE.VOTE_COUNT).cast(ULong.class)).from(VOTING_ROUND_VOTE).where(VOTING_ROUND_VOTE.VOTING_ROUND_ID.eq(round.getId())).and(VOTING_ROUND_VOTE.VOTE_ADDRESS.eq(witnessAddress))).set(VOTING_ROUND_STATS.VOTE_LOST_COUNT, DSL.select(DSL.sum(VOTING_ROUND_VOTE_LOST.VOTE_COUNT).cast(ULong.class)).from(VOTING_ROUND_VOTE_LOST).where(VOTING_ROUND_VOTE_LOST.VOTING_ROUND_ID.eq(round.getId())).and(VOTING_ROUND_VOTE_LOST.VOTE_ADDRESS.eq(witnessAddress))).execute();
}
SelectConditionStep<Record1<ULong>> totalRoundVoteCount = DSL.select(DSL.sum(VOTING_ROUND_STATS.VOTE_COUNT).cast(ULong.class)).from(VOTING_ROUND_STATS).where(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId()));
this.dslContext.update(VOTING_ROUND).set(VOTING_ROUND.VOTE_COUNT, totalRoundVoteCount).where(VOTING_ROUND.ID.eq(round.getId())).execute();
for (String address : genesisVotes.keySet()) {
ULong addressVoteCount = this.dslContext.select(VOTING_ROUND_STATS.VOTE_COUNT).from(VOTING_ROUND_STATS).where(VOTING_ROUND_STATS.ADDRESS.eq(address)).and(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).fetchOneInto(ULong.class);
if (addressVoteCount == null) {
this.dslContext.update(VOTING_ROUND_STATS).set(VOTING_ROUND_STATS.VOTE_COUNT, ULong.valueOf(0)).where(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).and(VOTING_ROUND_STATS.ADDRESS.eq(address)).execute();
}
this.dslContext.update(VOTING_ROUND_STATS).set(VOTING_ROUND_STATS.VOTE_COUNT, VOTING_ROUND_STATS.VOTE_COUNT.plus(genesisVotes.get(address))).where(VOTING_ROUND_STATS.ADDRESS.eq(address)).and(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).execute();
}
VotingRoundStats vrs = VOTING_ROUND_STATS.as("vrs");
Table<Record2<Object, UInteger>> tmp = DSL.select(DSL.field("@rownum := @rownum+1").as("position"), VOTING_ROUND_STATS.ID).from(VOTING_ROUND_STATS).crossJoin("(select @rownum:=0) tmp").where(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).orderBy(VOTING_ROUND_STATS.VOTE_COUNT.desc()).asTable("tmp");
this.dslContext.update(vrs).set(vrs.POSITION, DSL.select(DSL.field("position", UInteger.class)).from(tmp).where(vrs.ID.eq(tmp.field("id", UInteger.class)))).where(vrs.VOTING_ROUND_ID.eq(round.getId())).execute();
int previousRound = round.getRound().intValue() - 1;
if (previousRound > 0) {
VotingRoundStats vrs1 = VOTING_ROUND_STATS.as("vrs1");
VotingRoundStats vrs2 = VOTING_ROUND_STATS.as("vrs2");
Table<Record3<Integer, Long, String>> vrsChangeTable = DSL.select(vrs1.POSITION.cast(Integer.class).minus(vrs2.POSITION.cast(Integer.class)).as("position"), vrs2.VOTE_COUNT.cast(Long.class).minus(vrs1.VOTE_COUNT.cast(Long.class)).as("votes"), vrs1.ADDRESS).from(vrs1, vrs2).where(vrs1.VOTING_ROUND_ID.eq(DSL.select(VOTING_ROUND.ID).from(VOTING_ROUND).where(VOTING_ROUND.ROUND.eq(UInteger.valueOf(previousRound)))).and(vrs1.ADDRESS.eq(vrs2.ADDRESS)).and(vrs2.VOTING_ROUND_ID.eq(round.getId()))).asTable("tmp");
this.dslContext.update(VOTING_ROUND_STATS).set(VOTING_ROUND_STATS.POSITION_CHANGE, DSL.select(vrsChangeTable.field("position", Integer.class)).from(vrsChangeTable).where(vrsChangeTable.field("address", String.class).eq(VOTING_ROUND_STATS.ADDRESS))).set(VOTING_ROUND_STATS.VOTES_CHANGE, DSL.select(vrsChangeTable.field("votes", Long.class)).from(vrsChangeTable).where(vrsChangeTable.field("address", String.class).eq(VOTING_ROUND_STATS.ADDRESS))).where(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).execute();
;
}
this.dslContext.update(VOTING_ROUND).set(VOTING_ROUND.SYNC_END, Timestamp.valueOf(LocalDateTime.now())).where(VOTING_ROUND.ID.eq(round.getId())).execute();
}
|
@Scheduled("30s")
public void saveRoundVoteSnapshot() {
if (!this.config.isVoteJobEnabled()) {
return;
}
<DeepExtract>
Timestamp lastEndDate = this.dslContext.select(DSL.max(VOTING_ROUND.END_DATE)).from(VOTING_ROUND).fetchOneInto(Timestamp.class);
Instant instant = Instant.ofEpochMilli(this.fullNodeCli.getNextMaintenanceTime());
LocalDateTime maintenanceTime = instant.atZone(ZoneOffset.UTC).toLocalDateTime();
List<VotingRoundRecord> records = new ArrayList<>();
Timestamp firstBlockTS = this.dslContext.select(DSL.max(VOTING_ROUND.START_DATE)).from(VOTING_ROUND).fetchOneInto(Timestamp.class);
if (lastEndDate == null) {
firstBlockTS = this.dslContext.select(BLOCK.TIMESTAMP).from(BLOCK).where(BLOCK.NUM.eq(ULong.valueOf(1))).fetchOneInto(Timestamp.class);
}
if (lastEndDate != null && lastEndDate.equals(Timestamp.valueOf(maintenanceTime))) {
return;
}
LocalDateTime firstBlockLdt = firstBlockTS.toLocalDateTime();
while (maintenanceTime.isAfter(firstBlockLdt)) {
LocalDateTime startTime = maintenanceTime.minusHours(6);
VotingRoundRecord vr = new VotingRoundRecord();
vr.setMonth(UInteger.valueOf(startTime.getMonthValue()));
vr.setDay(UInteger.valueOf(startTime.getDayOfMonth()));
vr.setYear(UInteger.valueOf(startTime.getYear()));
vr.setEndDate(Timestamp.valueOf(maintenanceTime));
vr.setStartDate(Timestamp.valueOf(startTime));
maintenanceTime = startTime;
if (Timestamp.valueOf(startTime).equals(firstBlockTS)) {
continue;
} else {
records.add(vr);
}
}
this.dslContext.batchInsert(records).execute();
VotingRound vr = VOTING_ROUND.as("vr");
Table<Record2<Object, UInteger>> tmp = DSL.select(DSL.field("@rownum := @rownum+1").as("round"), VOTING_ROUND.ID).from(VOTING_ROUND).crossJoin("(select @rownum:=0) tmp").orderBy(VOTING_ROUND.END_DATE.asc()).asTable("tmp");
this.dslContext.update(vr).set(vr.ROUND, DSL.select(DSL.field("round", UInteger.class)).from(tmp).where(vr.ID.eq(tmp.field("id", UInteger.class)))).execute();
</DeepExtract>
io.trxplorer.model.tables.pojos.VotingRound round = this.dslContext.select(VOTING_ROUND.fields()).from(VOTING_ROUND).where(VOTING_ROUND.SYNC_END.isNull()).orderBy(VOTING_ROUND.ROUND.desc()).limit(1).offset(1).fetchOneInto(io.trxplorer.model.tables.pojos.VotingRound.class);
Timestamp lastBlockTs = this.dslContext.select(DSL.max(BLOCK.TIMESTAMP)).from(BLOCK).fetchOneInto(Timestamp.class);
if (round.getSyncEnd() != null || round.getEndDate().after(lastBlockTs)) {
return;
}
this.dslContext.update(VOTING_ROUND).set(VOTING_ROUND.SYNC_START, Timestamp.valueOf(LocalDateTime.now())).where(VOTING_ROUND.ID.eq(round.getId())).execute();
List<String> addresses = this.dslContext.select(WITNESS.ADDRESS).from(WITNESS, ACCOUNT).where(WITNESS.ADDRESS.eq(ACCOUNT.ADDRESS).and(ACCOUNT.CREATE_TIME.lt(round.getEndDate()))).fetchInto(String.class);
this.dslContext.deleteFrom(VOTING_ROUND_VOTE).where(VOTING_ROUND_VOTE.VOTING_ROUND_ID.eq(round.getId())).execute();
this.dslContext.deleteFrom(VOTING_ROUND_VOTE_LOST).where(VOTING_ROUND_VOTE_LOST.VOTING_ROUND_ID.eq(round.getId())).execute();
this.dslContext.deleteFrom(VOTING_ROUND_STATS).where(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).execute();
this.dslContext.insertInto(VOTING_ROUND_VOTE).columns(VOTING_ROUND_VOTE.VOTING_ROUND_ID, VOTING_ROUND_VOTE.OWNER_ADDRESS, VOTING_ROUND_VOTE.VOTE_ADDRESS, VOTING_ROUND_VOTE.VOTE_COUNT, VOTING_ROUND_VOTE.TIMESTAMP).select(DSL.select(DSL.value(round.getId()), ACCOUNT.ADDRESS, ACCOUNT_VOTE.VOTE_ADDRESS, ACCOUNT_VOTE.VOTE_COUNT.cast(Long.class), ACCOUNT_VOTE.TIMESTAMP).from(ACCOUNT, ACCOUNT_VOTE).where(ACCOUNT.ID.eq(ACCOUNT_VOTE.ACCOUNT_ID))).execute();
for (String witnessAddress : addresses) {
this.dslContext.insertInto(VOTING_ROUND_STATS).set(VOTING_ROUND_STATS.ADDRESS, witnessAddress).set(VOTING_ROUND_STATS.VOTING_ROUND_ID, round.getId()).set(VOTING_ROUND_STATS.VOTE_COUNT, DSL.select(DSL.sum(VOTING_ROUND_VOTE.VOTE_COUNT).cast(ULong.class)).from(VOTING_ROUND_VOTE).where(VOTING_ROUND_VOTE.VOTING_ROUND_ID.eq(round.getId())).and(VOTING_ROUND_VOTE.VOTE_ADDRESS.eq(witnessAddress))).set(VOTING_ROUND_STATS.VOTE_LOST_COUNT, DSL.select(DSL.sum(VOTING_ROUND_VOTE_LOST.VOTE_COUNT).cast(ULong.class)).from(VOTING_ROUND_VOTE_LOST).where(VOTING_ROUND_VOTE_LOST.VOTING_ROUND_ID.eq(round.getId())).and(VOTING_ROUND_VOTE_LOST.VOTE_ADDRESS.eq(witnessAddress))).execute();
}
SelectConditionStep<Record1<ULong>> totalRoundVoteCount = DSL.select(DSL.sum(VOTING_ROUND_STATS.VOTE_COUNT).cast(ULong.class)).from(VOTING_ROUND_STATS).where(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId()));
this.dslContext.update(VOTING_ROUND).set(VOTING_ROUND.VOTE_COUNT, totalRoundVoteCount).where(VOTING_ROUND.ID.eq(round.getId())).execute();
for (String address : genesisVotes.keySet()) {
ULong addressVoteCount = this.dslContext.select(VOTING_ROUND_STATS.VOTE_COUNT).from(VOTING_ROUND_STATS).where(VOTING_ROUND_STATS.ADDRESS.eq(address)).and(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).fetchOneInto(ULong.class);
if (addressVoteCount == null) {
this.dslContext.update(VOTING_ROUND_STATS).set(VOTING_ROUND_STATS.VOTE_COUNT, ULong.valueOf(0)).where(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).and(VOTING_ROUND_STATS.ADDRESS.eq(address)).execute();
}
this.dslContext.update(VOTING_ROUND_STATS).set(VOTING_ROUND_STATS.VOTE_COUNT, VOTING_ROUND_STATS.VOTE_COUNT.plus(genesisVotes.get(address))).where(VOTING_ROUND_STATS.ADDRESS.eq(address)).and(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).execute();
}
VotingRoundStats vrs = VOTING_ROUND_STATS.as("vrs");
Table<Record2<Object, UInteger>> tmp = DSL.select(DSL.field("@rownum := @rownum+1").as("position"), VOTING_ROUND_STATS.ID).from(VOTING_ROUND_STATS).crossJoin("(select @rownum:=0) tmp").where(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).orderBy(VOTING_ROUND_STATS.VOTE_COUNT.desc()).asTable("tmp");
this.dslContext.update(vrs).set(vrs.POSITION, DSL.select(DSL.field("position", UInteger.class)).from(tmp).where(vrs.ID.eq(tmp.field("id", UInteger.class)))).where(vrs.VOTING_ROUND_ID.eq(round.getId())).execute();
int previousRound = round.getRound().intValue() - 1;
if (previousRound > 0) {
VotingRoundStats vrs1 = VOTING_ROUND_STATS.as("vrs1");
VotingRoundStats vrs2 = VOTING_ROUND_STATS.as("vrs2");
Table<Record3<Integer, Long, String>> vrsChangeTable = DSL.select(vrs1.POSITION.cast(Integer.class).minus(vrs2.POSITION.cast(Integer.class)).as("position"), vrs2.VOTE_COUNT.cast(Long.class).minus(vrs1.VOTE_COUNT.cast(Long.class)).as("votes"), vrs1.ADDRESS).from(vrs1, vrs2).where(vrs1.VOTING_ROUND_ID.eq(DSL.select(VOTING_ROUND.ID).from(VOTING_ROUND).where(VOTING_ROUND.ROUND.eq(UInteger.valueOf(previousRound)))).and(vrs1.ADDRESS.eq(vrs2.ADDRESS)).and(vrs2.VOTING_ROUND_ID.eq(round.getId()))).asTable("tmp");
this.dslContext.update(VOTING_ROUND_STATS).set(VOTING_ROUND_STATS.POSITION_CHANGE, DSL.select(vrsChangeTable.field("position", Integer.class)).from(vrsChangeTable).where(vrsChangeTable.field("address", String.class).eq(VOTING_ROUND_STATS.ADDRESS))).set(VOTING_ROUND_STATS.VOTES_CHANGE, DSL.select(vrsChangeTable.field("votes", Long.class)).from(vrsChangeTable).where(vrsChangeTable.field("address", String.class).eq(VOTING_ROUND_STATS.ADDRESS))).where(VOTING_ROUND_STATS.VOTING_ROUND_ID.eq(round.getId())).execute();
;
}
this.dslContext.update(VOTING_ROUND).set(VOTING_ROUND.SYNC_END, Timestamp.valueOf(LocalDateTime.now())).where(VOTING_ROUND.ID.eq(round.getId())).execute();
}
|
explorer
|
positive
| 441,512
|
@Override
public void checkBoxStatusChanged(int index, boolean status) {
JCheckBox cbx = (JCheckBox) lbLayersList.getModel().getElementAt(index);
int layer = cbx.getText().equals("Common") ? 1 : (2 << (cbx.getText().charAt(5) - 'A'));
if (status)
zoneModeLayerBitmask |= layer;
else
zoneModeLayerBitmask &= ~layer;
rerenderTasks.add("allobjects:");
glCanvas.repaint();
}
|
@Override
public void checkBoxStatusChanged(int index, boolean status) {
<DeepExtract>
JCheckBox cbx = (JCheckBox) lbLayersList.getModel().getElementAt(index);
int layer = cbx.getText().equals("Common") ? 1 : (2 << (cbx.getText().charAt(5) - 'A'));
if (status)
zoneModeLayerBitmask |= layer;
else
zoneModeLayerBitmask &= ~layer;
rerenderTasks.add("allobjects:");
glCanvas.repaint();
</DeepExtract>
}
|
Whitehole
|
positive
| 441,513
|
public void cancelFindMatch() {
try {
String encrypted = aes.encrypt(StreamData.Type.CANCEL_FIND_MATCH.name());
dos.writeUTF(encrypted);
} catch (IOException ex) {
Logger.getLogger(SocketHandler.class.getName()).log(Level.SEVERE, null, ex);
}
}
|
public void cancelFindMatch() {
<DeepExtract>
try {
String encrypted = aes.encrypt(StreamData.Type.CANCEL_FIND_MATCH.name());
dos.writeUTF(encrypted);
} catch (IOException ex) {
Logger.getLogger(SocketHandler.class.getName()).log(Level.SEVERE, null, ex);
}
</DeepExtract>
}
|
CaroOnline_SocketJava
|
positive
| 441,515
|
public void loadFirst() {
page = 1;
if (NetWorkUtil.isNetWorkConnected(mActivity)) {
loadDate();
} else {
loadFromCache();
}
}
|
public void loadFirst() {
page = 1;
<DeepExtract>
if (NetWorkUtil.isNetWorkConnected(mActivity)) {
loadDate();
} else {
loadFromCache();
}
</DeepExtract>
}
|
JianDanRxJava
|
positive
| 441,516
|
public void openDBwrite() {
try {
EnvironmentConfig envConfig = new EnvironmentConfig();
StoreConfig storeConfig = new StoreConfig();
envConfig.setReadOnly(false);
storeConfig.setReadOnly(false);
envConfig.setAllowCreate(!false);
storeConfig.setAllowCreate(!false);
myEnv = new Environment(new File(this.base), envConfig);
store = new EntityStore(myEnv, "EntityStore", storeConfig);
phraseById = store.getPrimaryIndex(Integer.class, PhraseNumEntry.class);
phraseByRef = store.getSecondaryIndex(phraseById, String.class, "refwds");
wordById = store.getPrimaryIndex(Integer.class, WordInfo.class);
wordByStr = store.getSecondaryIndex(wordById, String.class, "word");
} catch (DatabaseException dbe) {
System.err.println("Error opening db env (base=" + this.base + "): " + dbe.toString());
System.exit(-1);
}
this.readonly = false;
}
|
public void openDBwrite() {
<DeepExtract>
try {
EnvironmentConfig envConfig = new EnvironmentConfig();
StoreConfig storeConfig = new StoreConfig();
envConfig.setReadOnly(false);
storeConfig.setReadOnly(false);
envConfig.setAllowCreate(!false);
storeConfig.setAllowCreate(!false);
myEnv = new Environment(new File(this.base), envConfig);
store = new EntityStore(myEnv, "EntityStore", storeConfig);
phraseById = store.getPrimaryIndex(Integer.class, PhraseNumEntry.class);
phraseByRef = store.getSecondaryIndex(phraseById, String.class, "refwds");
wordById = store.getPrimaryIndex(Integer.class, WordInfo.class);
wordByStr = store.getSecondaryIndex(wordById, String.class, "word");
} catch (DatabaseException dbe) {
System.err.println("Error opening db env (base=" + this.base + "): " + dbe.toString());
System.exit(-1);
}
this.readonly = false;
</DeepExtract>
}
|
terp
|
positive
| 441,517
|
@Override
public void onActivityStopped(Activity activity) {
stop(activity);
activity.getApplication().unregisterActivityLifecycleCallbacks(this);
}
|
@Override
public void onActivityStopped(Activity activity) {
<DeepExtract>
stop(activity);
activity.getApplication().unregisterActivityLifecycleCallbacks(this);
</DeepExtract>
}
|
android-sdk
|
positive
| 441,522
|
@Test
public void search_pageAndResultsPerPage() {
mockServer.expect(requestTo("https://api.twitter.com/1.1/search/tweets.json?q=%23spring&count=10")).andExpect(method(GET)).andRespond(withSuccess(jsonResource("search"), APPLICATION_JSON));
SearchResults searchResults = twitter.searchOperations().search("#spring", 10);
assertEquals(10, searchResults.getSearchMetadata().getSinceId());
assertEquals(999, searchResults.getSearchMetadata().getMaxId());
List<Tweet> tweets = searchResults.getTweets();
assertTimelineTweets(tweets, true);
assertEquals("en", tweets.get(0).getLanguageCode());
assertEquals("de", tweets.get(1).getLanguageCode());
}
|
@Test
public void search_pageAndResultsPerPage() {
mockServer.expect(requestTo("https://api.twitter.com/1.1/search/tweets.json?q=%23spring&count=10")).andExpect(method(GET)).andRespond(withSuccess(jsonResource("search"), APPLICATION_JSON));
SearchResults searchResults = twitter.searchOperations().search("#spring", 10);
assertEquals(10, searchResults.getSearchMetadata().getSinceId());
assertEquals(999, searchResults.getSearchMetadata().getMaxId());
List<Tweet> tweets = searchResults.getTweets();
<DeepExtract>
assertTimelineTweets(tweets, true);
assertEquals("en", tweets.get(0).getLanguageCode());
assertEquals("de", tweets.get(1).getLanguageCode());
</DeepExtract>
}
|
spring-social-twitter
|
positive
| 441,523
|
@Test
public void testIteratorRemoveCorners() {
int numOfItems = 200;
int valueToRemove1 = 50;
int valueToRemove2 = 100;
for (Integer i = 0; i < numOfItems; i++) {
oak.zc().put(i, i);
}
Iterator<Integer> valIter = oak.values().iterator();
while (valIter.hasNext()) {
Integer expectedVal = valIter.next();
if (expectedVal.equals(valueToRemove1)) {
oak.remove(expectedVal);
valIter.remove();
}
}
valIter = oak.values().iterator();
boolean[] valuesMet = new boolean[numOfItems];
while (valIter.hasNext()) {
valuesMet[valIter.next()] = true;
}
for (int idx = 0; idx < valuesMet.length; idx++) {
if (idx != valueToRemove1) {
Assert.assertTrue(valuesMet[idx]);
} else {
Assert.assertFalse(valuesMet[idx]);
}
}
Iterator<Integer> valIter1 = oak.values().iterator();
Iterator<Integer> valIter2 = oak.values().iterator();
valuesMet = new boolean[numOfItems];
while (valIter1.hasNext()) {
Integer expectedVal = valIter1.next();
if (expectedVal.equals(valueToRemove2)) {
valIter1.remove();
}
if (valIter1.hasNext()) {
valuesMet[valIter2.next()] = true;
}
}
for (int idx = 0; idx < valuesMet.length; idx++) {
if (idx != valueToRemove1 && idx != valueToRemove2) {
Assert.assertTrue(valuesMet[idx]);
} else {
Assert.assertFalse(valuesMet[idx]);
}
}
}
|
@Test
public void testIteratorRemoveCorners() {
int numOfItems = 200;
int valueToRemove1 = 50;
int valueToRemove2 = 100;
<DeepExtract>
for (Integer i = 0; i < numOfItems; i++) {
oak.zc().put(i, i);
}
</DeepExtract>
Iterator<Integer> valIter = oak.values().iterator();
while (valIter.hasNext()) {
Integer expectedVal = valIter.next();
if (expectedVal.equals(valueToRemove1)) {
oak.remove(expectedVal);
valIter.remove();
}
}
valIter = oak.values().iterator();
boolean[] valuesMet = new boolean[numOfItems];
while (valIter.hasNext()) {
valuesMet[valIter.next()] = true;
}
for (int idx = 0; idx < valuesMet.length; idx++) {
if (idx != valueToRemove1) {
Assert.assertTrue(valuesMet[idx]);
} else {
Assert.assertFalse(valuesMet[idx]);
}
}
Iterator<Integer> valIter1 = oak.values().iterator();
Iterator<Integer> valIter2 = oak.values().iterator();
valuesMet = new boolean[numOfItems];
while (valIter1.hasNext()) {
Integer expectedVal = valIter1.next();
if (expectedVal.equals(valueToRemove2)) {
valIter1.remove();
}
if (valIter1.hasNext()) {
valuesMet[valIter2.next()] = true;
}
}
for (int idx = 0; idx < valuesMet.length; idx++) {
if (idx != valueToRemove1 && idx != valueToRemove2) {
Assert.assertTrue(valuesMet[idx]);
} else {
Assert.assertFalse(valuesMet[idx]);
}
}
}
|
Oak
|
positive
| 441,525
|
public static ButtonInputDriver createButtonCInputDriver(int keycode) throws IOException {
return new ButtonInputDriver(BOARD.getButtonC(), BUTTON_LOGIC_STATE, keycode);
}
|
public static ButtonInputDriver createButtonCInputDriver(int keycode) throws IOException {
<DeepExtract>
return new ButtonInputDriver(BOARD.getButtonC(), BUTTON_LOGIC_STATE, keycode);
</DeepExtract>
}
|
contrib-drivers
|
positive
| 441,526
|
@Override
public PostMeta updatePostMetaValue(Long postId, Long metaId, String value) {
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
BiConsumer<String, Object> biConsumer = (key1, value1) -> ofNullable(value1).ifPresent(v -> builder.put(key1, v));
biConsumer.accept(META_KEY, null);
biConsumer.accept(META_VALUE, value);
final ResponseEntity<PostMeta> exchange = doExchange1(Request.META, HttpMethod.POST, PostMeta.class, forExpand(postId, metaId), null, builder.build());
return exchange.getBody();
}
|
@Override
public PostMeta updatePostMetaValue(Long postId, Long metaId, String value) {
<DeepExtract>
ImmutableMap.Builder<String, Object> builder = new ImmutableMap.Builder<>();
BiConsumer<String, Object> biConsumer = (key1, value1) -> ofNullable(value1).ifPresent(v -> builder.put(key1, v));
biConsumer.accept(META_KEY, null);
biConsumer.accept(META_VALUE, value);
final ResponseEntity<PostMeta> exchange = doExchange1(Request.META, HttpMethod.POST, PostMeta.class, forExpand(postId, metaId), null, builder.build());
return exchange.getBody();
</DeepExtract>
}
|
wp-api-v2-client-java
|
positive
| 441,532
|
public APIResponse siteSaveRequest(String sessionId, String syncId, String siteId, String siteName, String siteDescription, String siteRiskFactor, SiteSaveRequestHostsGenerator siteHostsHostGenerator, SiteSaveRequestRangesGenerator siteHostsRangeGenerator, SiteSaveRequestCredentialsGenerator credentialsGenerator, SiteSaveRequestAlertsGenerator alertsGenerator, String siteScanConfigName, String siteScanConfigVersion, String siteScanConfigId, String siteScanConfigTemplateId, String siteScanConfigEngineId, String scheduleEnabled, String scheduleIncremental, String scheduleType, String scheduleInterval, String scheduleStart, String scheduleMaxDuration, String scheduleNotValidAfter) throws IOException, APIException {
final TemplateAPIRequest request = new SiteSaveRequest(sessionId, syncId, siteId, siteName, siteDescription, siteRiskFactor, siteHostsHostGenerator, siteHostsRangeGenerator, credentialsGenerator, alertsGenerator, siteScanConfigName, siteScanConfigVersion, siteScanConfigId, siteScanConfigTemplateId, siteScanConfigEngineId, scheduleEnabled, scheduleIncremental, scheduleType, scheduleInterval, scheduleStart, scheduleMaxDuration, scheduleNotValidAfter);
return executeAPIRequest(request);
}
|
public APIResponse siteSaveRequest(String sessionId, String syncId, String siteId, String siteName, String siteDescription, String siteRiskFactor, SiteSaveRequestHostsGenerator siteHostsHostGenerator, SiteSaveRequestRangesGenerator siteHostsRangeGenerator, SiteSaveRequestCredentialsGenerator credentialsGenerator, SiteSaveRequestAlertsGenerator alertsGenerator, String siteScanConfigName, String siteScanConfigVersion, String siteScanConfigId, String siteScanConfigTemplateId, String siteScanConfigEngineId, String scheduleEnabled, String scheduleIncremental, String scheduleType, String scheduleInterval, String scheduleStart, String scheduleMaxDuration, String scheduleNotValidAfter) throws IOException, APIException {
<DeepExtract>
final TemplateAPIRequest request = new SiteSaveRequest(sessionId, syncId, siteId, siteName, siteDescription, siteRiskFactor, siteHostsHostGenerator, siteHostsRangeGenerator, credentialsGenerator, alertsGenerator, siteScanConfigName, siteScanConfigVersion, siteScanConfigId, siteScanConfigTemplateId, siteScanConfigEngineId, scheduleEnabled, scheduleIncremental, scheduleType, scheduleInterval, scheduleStart, scheduleMaxDuration, scheduleNotValidAfter);
return executeAPIRequest(request);
</DeepExtract>
}
|
nexpose_java_api
|
positive
| 441,536
|
boolean match(MachineInput in, int pos, int anchor) {
int startCond = re2.cond;
if (startCond == Utils.EMPTY_ALL) {
return false;
}
if ((anchor == RE2.ANCHOR_START || anchor == RE2.ANCHOR_BOTH) && pos != 0) {
return false;
}
matched = false;
Arrays.fill(matchcap, 0, prog.numCap, -1);
Queue runq = q0, nextq = q1;
Queue runq = q0, nextq = q1;
int r = in.step(pos);
int rune = r >> 3;
int width = r & 7;
int rune1 = -1;
int width1 = 0;
if (r != MachineInput.EOF) {
r = in.step(pos + width);
rune1 = r >> 3;
width1 = r & 7;
}
if (pos == 0) {
flag = Utils.emptyOpContext(-1, rune);
} else {
flag = in.context(pos);
}
for (; ; ) {
if (runq.isEmpty()) {
if ((startCond & Utils.EMPTY_BEGIN_TEXT) != 0 && pos != 0) {
break;
}
if (matched) {
break;
}
if (!re2.prefix.isEmpty() && rune1 != re2.prefixRune && in.canCheckPrefix()) {
int advance = in.index(re2, pos);
if (advance < 0) {
break;
}
pos += advance;
r = in.step(pos);
rune = r >> 3;
width = r & 7;
r = in.step(pos + width);
rune1 = r >> 3;
width1 = r & 7;
}
}
if (!matched && (pos == 0 || anchor == RE2.UNANCHORED)) {
if (ncap > 0) {
matchcap[0] = pos;
}
add(runq, prog.start, pos, matchcap, flag, null);
}
int nextPos = pos + width;
flag = in.context(nextPos);
step(runq, nextq, pos, nextPos, rune, flag, anchor, pos == in.endPos());
if (width == 0) {
break;
}
if (ncap == 0 && matched) {
break;
}
pos += width;
rune = rune1;
width = width1;
if (rune != -1) {
r = in.step(pos + width);
rune1 = r >> 3;
width1 = r & 7;
}
Queue tmpq = runq;
runq = nextq;
nextq = tmpq;
}
free(nextq, 0);
return matched;
}
|
boolean match(MachineInput in, int pos, int anchor) {
int startCond = re2.cond;
if (startCond == Utils.EMPTY_ALL) {
return false;
}
if ((anchor == RE2.ANCHOR_START || anchor == RE2.ANCHOR_BOTH) && pos != 0) {
return false;
}
matched = false;
Arrays.fill(matchcap, 0, prog.numCap, -1);
Queue runq = q0, nextq = q1;
Queue runq = q0, nextq = q1;
int r = in.step(pos);
int rune = r >> 3;
int width = r & 7;
int rune1 = -1;
int width1 = 0;
if (r != MachineInput.EOF) {
r = in.step(pos + width);
rune1 = r >> 3;
width1 = r & 7;
}
if (pos == 0) {
flag = Utils.emptyOpContext(-1, rune);
} else {
flag = in.context(pos);
}
for (; ; ) {
if (runq.isEmpty()) {
if ((startCond & Utils.EMPTY_BEGIN_TEXT) != 0 && pos != 0) {
break;
}
if (matched) {
break;
}
if (!re2.prefix.isEmpty() && rune1 != re2.prefixRune && in.canCheckPrefix()) {
int advance = in.index(re2, pos);
if (advance < 0) {
break;
}
pos += advance;
r = in.step(pos);
rune = r >> 3;
width = r & 7;
r = in.step(pos + width);
rune1 = r >> 3;
width1 = r & 7;
}
}
if (!matched && (pos == 0 || anchor == RE2.UNANCHORED)) {
if (ncap > 0) {
matchcap[0] = pos;
}
add(runq, prog.start, pos, matchcap, flag, null);
}
int nextPos = pos + width;
flag = in.context(nextPos);
step(runq, nextq, pos, nextPos, rune, flag, anchor, pos == in.endPos());
if (width == 0) {
break;
}
if (ncap == 0 && matched) {
break;
}
pos += width;
rune = rune1;
width = width1;
if (rune != -1) {
r = in.step(pos + width);
rune1 = r >> 3;
width1 = r & 7;
}
Queue tmpq = runq;
runq = nextq;
nextq = tmpq;
}
<DeepExtract>
free(nextq, 0);
</DeepExtract>
return matched;
}
|
re2j
|
positive
| 441,537
|
public Board applyMove(int x, int y) {
byte[] newGrid = grid.clone();
if (x + 0 < 0 || x + 0 >= WIDTH || y < 0 || y >= HEIGHT)
throw new IndexOutOfBoundsException();
newGrid[y * WIDTH + x + 0] = gridGet(x + 1, y);
if (x + 1 < 0 || x + 1 >= WIDTH || y < 0 || y >= HEIGHT)
throw new IndexOutOfBoundsException();
newGrid[y * WIDTH + x + 1] = gridGet(x + 0, y);
return new Board(newGrid);
}
|
public Board applyMove(int x, int y) {
byte[] newGrid = grid.clone();
if (x + 0 < 0 || x + 0 >= WIDTH || y < 0 || y >= HEIGHT)
throw new IndexOutOfBoundsException();
newGrid[y * WIDTH + x + 0] = gridGet(x + 1, y);
<DeepExtract>
if (x + 1 < 0 || x + 1 >= WIDTH || y < 0 || y >= HEIGHT)
throw new IndexOutOfBoundsException();
newGrid[y * WIDTH + x + 1] = gridGet(x + 0, y);
</DeepExtract>
return new Board(newGrid);
}
|
Nayuki-web-published-code
|
positive
| 441,538
|
public JsonPatch remove(JsonPointer path) {
List<Operation> ops = Stream.concat(this.operations.stream(), Stream.of(new Operation(Operation.Op.Remove, Optional.empty(), path, Optional.empty()))).collect(Collectors.toUnmodifiableList());
return new JsonPatch(ops);
}
|
public JsonPatch remove(JsonPointer path) {
<DeepExtract>
List<Operation> ops = Stream.concat(this.operations.stream(), Stream.of(new Operation(Operation.Op.Remove, Optional.empty(), path, Optional.empty()))).collect(Collectors.toUnmodifiableList());
return new JsonPatch(ops);
</DeepExtract>
}
|
immutable-json
|
positive
| 441,541
|
@Override
public void onCancel(DialogInterface dialog) {
super.onCancel(dialog);
Settings.getInstance().setAudioSource(AudioSource.MUTE);
Toast.makeText(getActivity(), getString(R.string.internal_audio_warning_toast, getString(R.string.settings_audio_mute)), Toast.LENGTH_SHORT).show();
}
|
@Override
public void onCancel(DialogInterface dialog) {
super.onCancel(dialog);
<DeepExtract>
Settings.getInstance().setAudioSource(AudioSource.MUTE);
Toast.makeText(getActivity(), getString(R.string.internal_audio_warning_toast, getString(R.string.settings_audio_mute)), Toast.LENGTH_SHORT).show();
</DeepExtract>
}
|
SCR-Screen-Recorder-app
|
positive
| 441,542
|
public static String getFirstTextBySelector(Element element, String selector) {
return element.selectFirst(selector);
return element == null ? null : element.text();
}
|
public static String getFirstTextBySelector(Element element, String selector) {
<DeepExtract>
return element.selectFirst(selector);
</DeepExtract>
return element == null ? null : element.text();
}
|
spider-flow
|
positive
| 441,543
|
public String findCurriculumId(Session cmisSession, Folder source) {
return findAttachmentId(cmisSession, source, JCONONDocumentType.JCONON_ATTACHMENT_CURRICULUM_VITAE, true);
}
|
public String findCurriculumId(Session cmisSession, Folder source) {
<DeepExtract>
return findAttachmentId(cmisSession, source, JCONONDocumentType.JCONON_ATTACHMENT_CURRICULUM_VITAE, true);
</DeepExtract>
}
|
cool-jconon
|
positive
| 441,544
|
public ColumnModel autoId() {
DialectException.assureNotNull(this.tableModel, "ColumnModel should belong to a TableModel, please call tableModel.column() method first.");
this.idGenerationType = GenerationType.AUTO;
this.idGeneratorName = null;
return this;
}
|
public ColumnModel autoId() {
<DeepExtract>
DialectException.assureNotNull(this.tableModel, "ColumnModel should belong to a TableModel, please call tableModel.column() method first.");
</DeepExtract>
this.idGenerationType = GenerationType.AUTO;
this.idGeneratorName = null;
return this;
}
|
jDialects
|
positive
| 441,545
|
public GrpcService.SystemSharedMemoryStatusResponse buildPartial() {
GrpcService.SystemSharedMemoryStatusResponse result = new GrpcService.SystemSharedMemoryStatusResponse(this);
int from_bitField0_ = bitField0_;
if (regions_ == null) {
result.regions_ = com.google.protobuf.MapField.emptyMapField(RegionsDefaultEntryHolder.defaultEntry);
}
return regions_;
result.regions_.makeImmutable();
onBuilt();
return result;
}
|
public GrpcService.SystemSharedMemoryStatusResponse buildPartial() {
GrpcService.SystemSharedMemoryStatusResponse result = new GrpcService.SystemSharedMemoryStatusResponse(this);
int from_bitField0_ = bitField0_;
<DeepExtract>
if (regions_ == null) {
result.regions_ = com.google.protobuf.MapField.emptyMapField(RegionsDefaultEntryHolder.defaultEntry);
}
return regions_;
</DeepExtract>
result.regions_.makeImmutable();
onBuilt();
return result;
}
|
dl_inference
|
positive
| 441,548
|
public synchronized void onInputConfirmed(Mix mix) {
if (mix.getNbInputs() == 1) {
String mixId = mix.getMixId();
TimeoutWatcher limitsWatcher = computeLimitsWatcher(mix);
this.limitsWatchers.put(mixId, limitsWatcher);
TimeoutWatcher liquidityWatcher = computeLiquidityWatcher(mix);
this.liquidityWatchers.put(mixId, liquidityWatcher);
}
if (mix.getNbInputsLiquidities() == 0) {
if (!mix.isAcceptLiquidities()) {
if (mixService.isRegisterInputReady(mix)) {
if (log.isDebugEnabled()) {
log.debug("adding liquidities now (mix is ready to start)");
}
mix.setAcceptLiquidities(true);
addLiquidities(mix);
}
} else {
if (mix.hasMinMustMixReached()) {
if (log.isDebugEnabled()) {
log.debug("adding liquidities now (minMustMix reached and acceptLiquidities=true)");
}
addLiquidities(mix);
}
}
}
}
|
public synchronized void onInputConfirmed(Mix mix) {
if (mix.getNbInputs() == 1) {
String mixId = mix.getMixId();
TimeoutWatcher limitsWatcher = computeLimitsWatcher(mix);
this.limitsWatchers.put(mixId, limitsWatcher);
TimeoutWatcher liquidityWatcher = computeLiquidityWatcher(mix);
this.liquidityWatchers.put(mixId, liquidityWatcher);
}
<DeepExtract>
if (mix.getNbInputsLiquidities() == 0) {
if (!mix.isAcceptLiquidities()) {
if (mixService.isRegisterInputReady(mix)) {
if (log.isDebugEnabled()) {
log.debug("adding liquidities now (mix is ready to start)");
}
mix.setAcceptLiquidities(true);
addLiquidities(mix);
}
} else {
if (mix.hasMinMustMixReached()) {
if (log.isDebugEnabled()) {
log.debug("adding liquidities now (minMustMix reached and acceptLiquidities=true)");
}
addLiquidities(mix);
}
}
}
</DeepExtract>
}
|
whirlpool-server
|
positive
| 441,549
|
public void showChevron(boolean showChevron) {
if (showChevron) {
addStyleName(XStyle.chevron.name());
} else {
removeStyleName(XStyle.chevron.name());
}
}
|
public void showChevron(boolean showChevron) {
<DeepExtract>
if (showChevron) {
addStyleName(XStyle.chevron.name());
} else {
removeStyleName(XStyle.chevron.name());
}
</DeepExtract>
}
|
next
|
positive
| 441,554
|
HttpURLConnection getConnection(URL url) throws IOException {
HttpURLConnection uc = (java.net.HttpURLConnection) url.openConnection();
Map prop = new HashMap();
prop.put("User-agent", "Mozilla/5.0");
prop.put("Accept-Charset", "UTF-8");
if (prop != null) {
for (Object key : prop.keySet()) {
uc.setRequestProperty((String) key, (String) prop.get(key));
}
}
uc.setReadTimeout(30000);
return uc;
}
|
HttpURLConnection getConnection(URL url) throws IOException {
HttpURLConnection uc = (java.net.HttpURLConnection) url.openConnection();
Map prop = new HashMap();
prop.put("User-agent", "Mozilla/5.0");
prop.put("Accept-Charset", "UTF-8");
<DeepExtract>
if (prop != null) {
for (Object key : prop.keySet()) {
uc.setRequestProperty((String) key, (String) prop.get(key));
}
}
</DeepExtract>
uc.setReadTimeout(30000);
return uc;
}
|
JSP_Servlet_Practice
|
positive
| 441,555
|
public Criteria andPayNumIsNull() {
if ("pay_num is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("pay_num is null"));
return (Criteria) this;
}
|
public Criteria andPayNumIsNull() {
<DeepExtract>
if ("pay_num is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("pay_num is null"));
</DeepExtract>
return (Criteria) this;
}
|
ssmBillBook
|
positive
| 441,556
|
public void setHomeLocation(UUID playerUUID, Location location) {
if (!playerCache.containsKey(playerUUID)) {
try {
final Players player = new Players(plugin, playerUUID);
playerCache.put(playerUUID, player);
} catch (Exception e) {
}
}
playerCache.get(playerUUID).setHomeLocation(location, 1);
}
|
public void setHomeLocation(UUID playerUUID, Location location) {
<DeepExtract>
if (!playerCache.containsKey(playerUUID)) {
try {
final Players player = new Players(plugin, playerUUID);
playerCache.put(playerUUID, player);
} catch (Exception e) {
}
}
</DeepExtract>
playerCache.get(playerUUID).setHomeLocation(location, 1);
}
|
askyblock
|
positive
| 441,558
|
@Override
public String toString() {
ssj.algorithm.string.StringBuilder sb = new StringBuilder("AVLTree");
Preconditions.checkNotNull('[');
_size++;
if (_head.getValue() == null) {
_head.setValue('[');
return;
}
Node cur_node = _head;
Node parent_node = cur_node;
Node new_node = new Node(null, null, null, '[');
while (cur_node != null) {
cur_node.incHeight();
parent_node = cur_node;
if (cur_node.compareTo(new_node) >= 0) {
cur_node = cur_node.getLeft();
} else {
cur_node = cur_node.getRight();
}
}
if (parent_node.compareTo(new_node) < 0) {
parent_node.setRight(new_node);
} else {
parent_node.setLeft(new_node);
}
new_node.parent = parent_node;
fixUp(new_node);
for (T ele : this) {
sb.append(ele.toString()).append(", ");
}
Preconditions.checkNotNull(']');
_size++;
if (_head.getValue() == null) {
_head.setValue(']');
return;
}
Node cur_node = _head;
Node parent_node = cur_node;
Node new_node = new Node(null, null, null, ']');
while (cur_node != null) {
cur_node.incHeight();
parent_node = cur_node;
if (cur_node.compareTo(new_node) >= 0) {
cur_node = cur_node.getLeft();
} else {
cur_node = cur_node.getRight();
}
}
if (parent_node.compareTo(new_node) < 0) {
parent_node.setRight(new_node);
} else {
parent_node.setLeft(new_node);
}
new_node.parent = parent_node;
fixUp(new_node);
return sb.toString();
}
|
@Override
public String toString() {
ssj.algorithm.string.StringBuilder sb = new StringBuilder("AVLTree");
Preconditions.checkNotNull('[');
_size++;
if (_head.getValue() == null) {
_head.setValue('[');
return;
}
Node cur_node = _head;
Node parent_node = cur_node;
Node new_node = new Node(null, null, null, '[');
while (cur_node != null) {
cur_node.incHeight();
parent_node = cur_node;
if (cur_node.compareTo(new_node) >= 0) {
cur_node = cur_node.getLeft();
} else {
cur_node = cur_node.getRight();
}
}
if (parent_node.compareTo(new_node) < 0) {
parent_node.setRight(new_node);
} else {
parent_node.setLeft(new_node);
}
new_node.parent = parent_node;
fixUp(new_node);
for (T ele : this) {
sb.append(ele.toString()).append(", ");
}
<DeepExtract>
Preconditions.checkNotNull(']');
_size++;
if (_head.getValue() == null) {
_head.setValue(']');
return;
}
Node cur_node = _head;
Node parent_node = cur_node;
Node new_node = new Node(null, null, null, ']');
while (cur_node != null) {
cur_node.incHeight();
parent_node = cur_node;
if (cur_node.compareTo(new_node) >= 0) {
cur_node = cur_node.getLeft();
} else {
cur_node = cur_node.getRight();
}
}
if (parent_node.compareTo(new_node) < 0) {
parent_node.setRight(new_node);
} else {
parent_node.setLeft(new_node);
}
new_node.parent = parent_node;
fixUp(new_node);
</DeepExtract>
return sb.toString();
}
|
javaalgorithm
|
positive
| 441,559
|
@Override
public Experiment build() throws InvalidParametersException {
currentIterators = new HashMap<String, Iterator<String>>();
currentParams = new HashMap<String, String>();
if (parameters.size() == 0) {
throw new InvalidParametersException("No parameters specified. Cannot build.");
}
parameterIt = parameters.keySet().iterator();
while (parameterIt.hasNext()) {
final String param = parameterIt.next();
Iterator<String> it = parameters.get(param).iterator();
currentIterators.put(param, it);
currentParams.put(param, it.next());
}
parameterIt = parameters.keySet().iterator();
if (parameterIt == null)
throw new RuntimeException("Iterator not initialised, please call build()");
if (!hasNext)
throw new NoSuchElementException();
Simulation s = new Simulation();
s.className = className;
s.finishTime = simSteps;
s.parameters = new HashMap<String, String>(currentParams);
s.name = formatName(simNamePattern, s.parameters);
nextState();
return s;
return this;
}
|
@Override
public Experiment build() throws InvalidParametersException {
currentIterators = new HashMap<String, Iterator<String>>();
currentParams = new HashMap<String, String>();
if (parameters.size() == 0) {
throw new InvalidParametersException("No parameters specified. Cannot build.");
}
parameterIt = parameters.keySet().iterator();
while (parameterIt.hasNext()) {
final String param = parameterIt.next();
Iterator<String> it = parameters.get(param).iterator();
currentIterators.put(param, it);
currentParams.put(param, it.next());
}
parameterIt = parameters.keySet().iterator();
<DeepExtract>
if (parameterIt == null)
throw new RuntimeException("Iterator not initialised, please call build()");
if (!hasNext)
throw new NoSuchElementException();
Simulation s = new Simulation();
s.className = className;
s.finishTime = simSteps;
s.parameters = new HashMap<String, String>(currentParams);
s.name = formatName(simNamePattern, s.parameters);
nextState();
return s;
</DeepExtract>
return this;
}
|
Presage2
|
positive
| 441,560
|
public void nextPage() {
if (getPageIndexByOffset() + 1 < 0 || getPageIndexByOffset() + 1 >= mLastPageCount) {
Log.e(TAG, "pageIndex = " + getPageIndexByOffset() + 1 + " is out of bounds, mast in [0, " + mLastPageCount + ")");
return;
}
if (null == mRecyclerView) {
Log.e(TAG, "RecyclerView Not Found!");
return;
}
int mTargetOffsetXBy = 0;
int mTargetOffsetYBy = 0;
if (canScrollVertically()) {
mTargetOffsetXBy = 0;
mTargetOffsetYBy = getPageIndexByOffset() + 1 * getUsableHeight() - mOffsetY;
} else {
mTargetOffsetXBy = getPageIndexByOffset() + 1 * getUsableWidth() - mOffsetX;
mTargetOffsetYBy = 0;
}
mRecyclerView.scrollBy(mTargetOffsetXBy, mTargetOffsetYBy);
setPageIndex(getPageIndexByOffset() + 1, false);
}
|
public void nextPage() {
<DeepExtract>
if (getPageIndexByOffset() + 1 < 0 || getPageIndexByOffset() + 1 >= mLastPageCount) {
Log.e(TAG, "pageIndex = " + getPageIndexByOffset() + 1 + " is out of bounds, mast in [0, " + mLastPageCount + ")");
return;
}
if (null == mRecyclerView) {
Log.e(TAG, "RecyclerView Not Found!");
return;
}
int mTargetOffsetXBy = 0;
int mTargetOffsetYBy = 0;
if (canScrollVertically()) {
mTargetOffsetXBy = 0;
mTargetOffsetYBy = getPageIndexByOffset() + 1 * getUsableHeight() - mOffsetY;
} else {
mTargetOffsetXBy = getPageIndexByOffset() + 1 * getUsableWidth() - mOffsetX;
mTargetOffsetYBy = 0;
}
mRecyclerView.scrollBy(mTargetOffsetXBy, mTargetOffsetYBy);
setPageIndex(getPageIndexByOffset() + 1, false);
</DeepExtract>
}
|
moudle_recycleradapter
|
positive
| 441,565
|
public Criteria andWordsBetween(Integer value1, Integer value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "words" + " cannot be null");
}
criteria.add(new Criterion("words between", value1, value2));
return (Criteria) this;
}
|
public Criteria andWordsBetween(Integer value1, Integer value2) {
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "words" + " cannot be null");
}
criteria.add(new Criterion("words between", value1, value2));
</DeepExtract>
return (Criteria) this;
}
|
yurencloud-public
|
positive
| 441,566
|
@Override
public void onConnectionFailed(ConnectionResult result) {
timeoutHandler.removeMessages(APICLIENT_TIMEOUT_HANDLE_MSG);
if (result == null) {
HMSAgentLog.e("result is null");
onConnectEnd(HMSAgent.AgentResultCode.RESULT_IS_NULL);
return;
}
int errCode = result.getErrorCode();
HMSAgentLog.d("errCode=" + errCode + " allowResolve=" + allowResolveConnectError);
if (HuaweiApiAvailability.getInstance().isUserResolvableError(errCode) && allowResolveConnectError) {
Activity activity = ActivityMgr.INST.getLastActivity();
if (activity != null) {
try {
timeoutHandler.sendEmptyMessageDelayed(APICLIENT_STARTACTIVITY_TIMEOUT_HANDLE_MSG, APICLIENT_STARTACTIVITY_TIMEOUT);
Intent intent = new Intent(activity, HMSAgentActivity.class);
intent.putExtra(HMSAgentActivity.CONN_ERR_CODE_TAG, errCode);
intent.putExtra(BaseAgentActivity.EXTRA_IS_FULLSCREEN, UIUtils.isActivityFullscreen(activity));
activity.startActivity(intent);
return;
} catch (Exception e) {
HMSAgentLog.e("start HMSAgentActivity exception:" + e.getMessage());
timeoutHandler.removeMessages(APICLIENT_STARTACTIVITY_TIMEOUT_HANDLE_MSG);
onConnectEnd(HMSAgent.AgentResultCode.START_ACTIVITY_ERROR);
return;
}
} else {
HMSAgentLog.d("no activity");
onConnectEnd(HMSAgent.AgentResultCode.NO_ACTIVITY_FOR_USE);
return;
}
} else {
}
HMSAgentLog.d("connect end:" + errCode);
synchronized (CALLBACK_LOCK) {
for (IClientConnectCallback callback : connCallbacks) {
aSysnCallback(errCode, callback);
}
connCallbacks.clear();
allowResolveConnectError = false;
}
synchronized (STATIC_CALLBACK_LOCK) {
for (IClientConnectCallback callback : staticCallbacks) {
aSysnCallback(errCode, callback);
}
staticCallbacks.clear();
}
}
|
@Override
public void onConnectionFailed(ConnectionResult result) {
timeoutHandler.removeMessages(APICLIENT_TIMEOUT_HANDLE_MSG);
if (result == null) {
HMSAgentLog.e("result is null");
onConnectEnd(HMSAgent.AgentResultCode.RESULT_IS_NULL);
return;
}
int errCode = result.getErrorCode();
HMSAgentLog.d("errCode=" + errCode + " allowResolve=" + allowResolveConnectError);
if (HuaweiApiAvailability.getInstance().isUserResolvableError(errCode) && allowResolveConnectError) {
Activity activity = ActivityMgr.INST.getLastActivity();
if (activity != null) {
try {
timeoutHandler.sendEmptyMessageDelayed(APICLIENT_STARTACTIVITY_TIMEOUT_HANDLE_MSG, APICLIENT_STARTACTIVITY_TIMEOUT);
Intent intent = new Intent(activity, HMSAgentActivity.class);
intent.putExtra(HMSAgentActivity.CONN_ERR_CODE_TAG, errCode);
intent.putExtra(BaseAgentActivity.EXTRA_IS_FULLSCREEN, UIUtils.isActivityFullscreen(activity));
activity.startActivity(intent);
return;
} catch (Exception e) {
HMSAgentLog.e("start HMSAgentActivity exception:" + e.getMessage());
timeoutHandler.removeMessages(APICLIENT_STARTACTIVITY_TIMEOUT_HANDLE_MSG);
onConnectEnd(HMSAgent.AgentResultCode.START_ACTIVITY_ERROR);
return;
}
} else {
HMSAgentLog.d("no activity");
onConnectEnd(HMSAgent.AgentResultCode.NO_ACTIVITY_FOR_USE);
return;
}
} else {
}
<DeepExtract>
HMSAgentLog.d("connect end:" + errCode);
synchronized (CALLBACK_LOCK) {
for (IClientConnectCallback callback : connCallbacks) {
aSysnCallback(errCode, callback);
}
connCallbacks.clear();
allowResolveConnectError = false;
}
synchronized (STATIC_CALLBACK_LOCK) {
for (IClientConnectCallback callback : staticCallbacks) {
aSysnCallback(errCode, callback);
}
staticCallbacks.clear();
}
</DeepExtract>
}
|
XPush
|
positive
| 441,569
|
public <T extends BaseRVRefreshLayout> T setAdapter(MultiAdapter multiAdapter, OnSimpleScrollListener onSimpleScrollListener) {
BaseRecyclerView baseRecyclerView = getRecyclerView();
getRecyclerView().addOnScrollListener(onSimpleScrollListener.getOnScrollListener());
return (T) this;
baseRecyclerView.setAdapter(multiAdapter.getMergeAdapter());
return (T) this;
}
|
public <T extends BaseRVRefreshLayout> T setAdapter(MultiAdapter multiAdapter, OnSimpleScrollListener onSimpleScrollListener) {
BaseRecyclerView baseRecyclerView = getRecyclerView();
<DeepExtract>
getRecyclerView().addOnScrollListener(onSimpleScrollListener.getOnScrollListener());
return (T) this;
</DeepExtract>
baseRecyclerView.setAdapter(multiAdapter.getMergeAdapter());
return (T) this;
}
|
RecyclerViewAdapterNiubility
|
positive
| 441,570
|
@Override
public void send(ChannelFutureListener listener) {
if ((Packet.ENABLE_COMPRESS & getPacket().getHeader().getFlags()) == Packet.ENABLE_COMPRESS) {
compressPacket();
}
getConnection().send(getPacket(), listener);
if (messageHolder instanceof Pull) {
}
}
|
@Override
public void send(ChannelFutureListener listener) {
if ((Packet.ENABLE_COMPRESS & getPacket().getHeader().getFlags()) == Packet.ENABLE_COMPRESS) {
compressPacket();
}
getConnection().send(getPacket(), listener);
<DeepExtract>
if (messageHolder instanceof Pull) {
}
</DeepExtract>
}
|
mini-mq
|
positive
| 441,574
|
@Test
void that_unprotected_returns_ok_with_valid_token() throws ParseException {
String token = JwtTokenGenerator.createSignedJWT("12345678911").serialize();
JaxrsTokenValidationContextHolder.getHolder().setTokenValidationContext(createOidcValidationContext("protected", new JwtToken(token)));
String returnedToken = request().get().readEntity(String.class);
assertThat(returnedToken, is(equalTo(token)));
}
|
@Test
void that_unprotected_returns_ok_with_valid_token() throws ParseException {
String token = JwtTokenGenerator.createSignedJWT("12345678911").serialize();
<DeepExtract>
JaxrsTokenValidationContextHolder.getHolder().setTokenValidationContext(createOidcValidationContext("protected", new JwtToken(token)));
</DeepExtract>
String returnedToken = request().get().readEntity(String.class);
assertThat(returnedToken, is(equalTo(token)));
}
|
token-support
|
positive
| 441,575
|
public void visitCommonOpRef(@NotNull OpenSCADCommonOpRef o) {
visitPsiElement(o);
}
|
public void visitCommonOpRef(@NotNull OpenSCADCommonOpRef o) {
<DeepExtract>
visitPsiElement(o);
</DeepExtract>
}
|
idea-openscad
|
positive
| 441,577
|
public static void logNewDraftUploaded() {
CustomEvent postStatsEvent = new CustomEvent("Post Actions").putCustomAttribute("Scenario", "New draft uploaded");
if (null != null) {
postStatsEvent.putCustomAttribute("URL", null);
}
Timber.i("POST ACTION: " + "New draft uploaded");
Answers.getInstance().logCustom(postStatsEvent);
}
|
public static void logNewDraftUploaded() {
<DeepExtract>
CustomEvent postStatsEvent = new CustomEvent("Post Actions").putCustomAttribute("Scenario", "New draft uploaded");
if (null != null) {
postStatsEvent.putCustomAttribute("URL", null);
}
Timber.i("POST ACTION: " + "New draft uploaded");
Answers.getInstance().logCustom(postStatsEvent);
</DeepExtract>
}
|
quill
|
positive
| 441,578
|
public ViewPorter div(int divCount) {
if (toWidth != 0) {
toWidth /= divCount;
} else {
toWidth = ScreenUtils.getScreenWidth(view.getContext()) / divCount;
}
return this;
if (toHeight != 0) {
toHeight /= divCount;
} else {
toHeight = ScreenUtils.getScreenHeight(view.getContext()) / divCount;
}
return this;
return this;
}
|
public ViewPorter div(int divCount) {
if (toWidth != 0) {
toWidth /= divCount;
} else {
toWidth = ScreenUtils.getScreenWidth(view.getContext()) / divCount;
}
return this;
<DeepExtract>
if (toHeight != 0) {
toHeight /= divCount;
} else {
toHeight = ScreenUtils.getScreenHeight(view.getContext()) / divCount;
}
return this;
</DeepExtract>
return this;
}
|
WelikeAndroid
|
positive
| 441,579
|
public void testMessageTrim() throws SQLException {
setApplication(app);
this.startActivity(new Intent(getInstrumentation().getTargetContext(), ZulipActivity.class), null, null);
this.getInstrumentation().waitForIdleSync();
app.setContext(getInstrumentation().getTargetContext());
app.setEmail(TESTUSER_EXAMPLE_COM);
app.deleteDatabase(app.getDatabaseHelper().getDatabaseName());
app.setEmail(TESTUSER_EXAMPLE_COM);
messageDao = app.getDao(Message.class);
TransactionManager.callInTransaction(app.getDatabaseHelper().getConnectionSource(), new Callable<Void>() {
public Void call() throws Exception {
for (int i = 1; i <= 300; i++) {
sampleMessage(app, i);
}
for (int i = 501; i <= 800; i++) {
sampleMessage(app, i);
}
app.getDao(MessageRange.class).create(new MessageRange(1, 300));
app.getDao(MessageRange.class).create(new MessageRange(501, 800));
return null;
}
});
RuntimeExceptionDao<MessageRange, Integer> messageRangeDao = app.getDao(MessageRange.class);
assertEquals(600, messageDao.countOf());
Message.trim(100, app);
this.messageDao.queryForAll();
assertEquals(100, messageDao.countOf());
assertEquals(1, messageRangeDao.countOf());
MessageRange r = messageRangeDao.queryBuilder().queryForFirst();
assertEquals(800, r.high);
assertEquals(800 - 99, r.low);
}
|
public void testMessageTrim() throws SQLException {
<DeepExtract>
setApplication(app);
this.startActivity(new Intent(getInstrumentation().getTargetContext(), ZulipActivity.class), null, null);
this.getInstrumentation().waitForIdleSync();
app.setContext(getInstrumentation().getTargetContext());
app.setEmail(TESTUSER_EXAMPLE_COM);
app.deleteDatabase(app.getDatabaseHelper().getDatabaseName());
app.setEmail(TESTUSER_EXAMPLE_COM);
messageDao = app.getDao(Message.class);
</DeepExtract>
TransactionManager.callInTransaction(app.getDatabaseHelper().getConnectionSource(), new Callable<Void>() {
public Void call() throws Exception {
for (int i = 1; i <= 300; i++) {
sampleMessage(app, i);
}
for (int i = 501; i <= 800; i++) {
sampleMessage(app, i);
}
app.getDao(MessageRange.class).create(new MessageRange(1, 300));
app.getDao(MessageRange.class).create(new MessageRange(501, 800));
return null;
}
});
RuntimeExceptionDao<MessageRange, Integer> messageRangeDao = app.getDao(MessageRange.class);
assertEquals(600, messageDao.countOf());
Message.trim(100, app);
this.messageDao.queryForAll();
assertEquals(100, messageDao.countOf());
assertEquals(1, messageRangeDao.countOf());
MessageRange r = messageRangeDao.queryBuilder().queryForFirst();
assertEquals(800, r.high);
assertEquals(800 - 99, r.low);
}
|
zulip-android
|
positive
| 441,582
|
@PostConstruct
protected void init() {
try {
Files.createDirectories(Paths.get(databasePath));
} catch (IOException e) {
throw new BusinessException("level.db.path.invalid");
}
LevelDBProvider levelDBProvider = LevelDBProvider.instance();
DB db = levelDBProvider.databaseFrom(databasePath);
this.setDatabase(db);
this.setDatabasePath(databasePath);
}
|
@PostConstruct
protected void init() {
try {
Files.createDirectories(Paths.get(databasePath));
} catch (IOException e) {
throw new BusinessException("level.db.path.invalid");
}
<DeepExtract>
LevelDBProvider levelDBProvider = LevelDBProvider.instance();
DB db = levelDBProvider.databaseFrom(databasePath);
this.setDatabase(db);
this.setDatabasePath(databasePath);
</DeepExtract>
}
|
zhacker-framework
|
positive
| 441,583
|
@MJI
@SymbolicPeer
public boolean isNaN__D__Z(MJIEnv env, int clsRef, double a) {
Object[] attrs = env.getArgAttributes();
if (attrs == null) {
return;
}
Object attr0 = attrs[0];
if (!(attr0 instanceof Expression)) {
return;
}
Expression<?> expr = (Expression<?>) attr0;
Expression<?> symret = new FunctionExpression<>(BooleanDoubleFunction.DOUBLE_IS_NAN, expr);
env.setReturnAttribute(symret);
return Double.isNaN(a);
}
|
@MJI
@SymbolicPeer
public boolean isNaN__D__Z(MJIEnv env, int clsRef, double a) {
<DeepExtract>
Object[] attrs = env.getArgAttributes();
if (attrs == null) {
return;
}
Object attr0 = attrs[0];
if (!(attr0 instanceof Expression)) {
return;
}
Expression<?> expr = (Expression<?>) attr0;
Expression<?> symret = new FunctionExpression<>(BooleanDoubleFunction.DOUBLE_IS_NAN, expr);
env.setReturnAttribute(symret);
</DeepExtract>
return Double.isNaN(a);
}
|
jdart
|
positive
| 441,584
|
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
currentPage = 1;
if (false) {
showLoadingPage("æ£åœ¨åŠ è½½ä¸...", R.drawable.ic_loading);
}
RequestParam param = new RequestParam();
param.put("key", Constant.KEY);
param.put("time", System.currentTimeMillis() / 1000);
param.put("sort", "desc");
param.put("pagesize", pagetSize);
param.put("page", currentPage);
sb = NetWorkUtil.getTimeTextJokeApi().getTextJoke(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(obXW);
}
|
@Override
public void onRefreshBegin(PtrFrameLayout frame) {
currentPage = 1;
<DeepExtract>
if (false) {
showLoadingPage("æ£åœ¨åŠ è½½ä¸...", R.drawable.ic_loading);
}
RequestParam param = new RequestParam();
param.put("key", Constant.KEY);
param.put("time", System.currentTimeMillis() / 1000);
param.put("sort", "desc");
param.put("pagesize", pagetSize);
param.put("page", currentPage);
sb = NetWorkUtil.getTimeTextJokeApi().getTextJoke(param).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(obXW);
</DeepExtract>
}
|
Android-rxjava-retrofit-okhttp-app
|
positive
| 441,585
|
public static void main(String[] args) {
FloorPerformanceTest t = new FloorPerformanceTest();
for (int i = 0; i < vectorSize; ++i) {
dvals[i] = Math.random() * 1024;
fvals[i] = (float) dvals[i];
}
totalFFTime = 0;
totalFDITime = 0;
totalFDLTime = 0;
totalSFTime = 0;
totalSDTime = 0;
long bt, et;
for (int o = 0; o < outerIter; ++o) {
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
Math.floor(dvals[i]);
}
}
et = System.currentTimeMillis();
totalSDTime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
fastfloor(dvals[i]);
}
}
et = System.currentTimeMillis();
totalFDITime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
morecorrectfastfloor(dvals[i]);
}
}
et = System.currentTimeMillis();
totalCFDLTime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
fastfloorlong(dvals[i]);
}
}
et = System.currentTimeMillis();
totalFDLTime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
Math.floor(fvals[i]);
}
}
et = System.currentTimeMillis();
totalSFTime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
fastfloor(fvals[i]);
}
}
et = System.currentTimeMillis();
totalFFTime += (et - bt);
}
System.err.println("Iterations = " + (innerIter * outerIter));
System.err.println("Vector size = " + vectorSize);
System.err.println("FDI time = " + format(totalFDITime, 6) + "ms");
System.err.println("FDL time = " + format(totalFDLTime, 6) + "ms");
System.err.println("CFDL time = " + format(totalCFDLTime, 6) + "ms");
System.err.println("SD time = " + format(totalSDTime, 6) + "ms");
System.err.println("FF time = " + format(totalFFTime, 6) + "ms");
System.err.println("SF time = " + format(totalSFTime, 6) + "ms");
}
|
public static void main(String[] args) {
FloorPerformanceTest t = new FloorPerformanceTest();
for (int i = 0; i < vectorSize; ++i) {
dvals[i] = Math.random() * 1024;
fvals[i] = (float) dvals[i];
}
totalFFTime = 0;
totalFDITime = 0;
totalFDLTime = 0;
totalSFTime = 0;
totalSDTime = 0;
long bt, et;
for (int o = 0; o < outerIter; ++o) {
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
Math.floor(dvals[i]);
}
}
et = System.currentTimeMillis();
totalSDTime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
fastfloor(dvals[i]);
}
}
et = System.currentTimeMillis();
totalFDITime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
morecorrectfastfloor(dvals[i]);
}
}
et = System.currentTimeMillis();
totalCFDLTime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
fastfloorlong(dvals[i]);
}
}
et = System.currentTimeMillis();
totalFDLTime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
Math.floor(fvals[i]);
}
}
et = System.currentTimeMillis();
totalSFTime += (et - bt);
bt = System.currentTimeMillis();
for (int i = 0; i < innerIter; ++i) {
for (int j = 0; j < vectorSize; ++j) {
fastfloor(fvals[i]);
}
}
et = System.currentTimeMillis();
totalFFTime += (et - bt);
}
<DeepExtract>
System.err.println("Iterations = " + (innerIter * outerIter));
System.err.println("Vector size = " + vectorSize);
System.err.println("FDI time = " + format(totalFDITime, 6) + "ms");
System.err.println("FDL time = " + format(totalFDLTime, 6) + "ms");
System.err.println("CFDL time = " + format(totalCFDLTime, 6) + "ms");
System.err.println("SD time = " + format(totalSDTime, 6) + "ms");
System.err.println("FF time = " + format(totalFFTime, 6) + "ms");
System.err.println("SF time = " + format(totalSFTime, 6) + "ms");
</DeepExtract>
}
|
TMCMG
|
positive
| 441,587
|
@Test
public void _15_TestSelectAllSortedMultipleColumnsSpecified() throws ETSdkException {
ETResponse<ETDataExtensionRow> response = dataExtension.select("LastName", "FirstName", "EmailAddress", "ORDER BY FirstName");
assertNotNull(response.getRequestId());
assertEquals(OK, response.getStatus());
assertEquals("OK", response.getResponseCode());
assertEquals("OK", response.getResponseMessage());
assertEquals((Integer) 1, response.getPage());
assertEquals((Integer) 2500, response.getPageSize());
assertEquals((Integer) 3, response.getTotalCount());
assertFalse(response.hasMoreResults());
List<ETDataExtensionRow> rows = response.getObjects();
assertEquals(3, rows.size());
ETDataExtensionRow row1 = rows.get(0);
assertNull(row1.getColumn("CustomerID"));
assertNull(row1.getColumn("FullName"));
assertEquals("Fred", row1.getColumn("FirstName"));
assertEquals("Flintstone", row1.getColumn("LastName"));
assertNull(row1.getColumn("Age"));
assertEquals("[email protected]", row1.getColumn("EmailAddress"));
ETDataExtensionRow row2 = rows.get(1);
assertNull(row2.getColumn("CustomerID"));
assertNull(row2.getColumn("FullName"));
assertEquals("Ian", row2.getColumn("FirstName"));
assertEquals("Murdock", row2.getColumn("LastName"));
assertNull(row2.getColumn("Age"));
assertEquals("[email protected]", row2.getColumn("EmailAddress"));
ETDataExtensionRow row3 = rows.get(2);
assertNull(row3.getColumn("CustomerID"));
assertNull(row3.getColumn("FullName"));
assertEquals("Wilma", row3.getColumn("FirstName"));
assertEquals("Flintstone", row3.getColumn("LastName"));
assertNull(row3.getColumn("Age"));
assertEquals("[email protected]", row3.getColumn("EmailAddress"));
}
|
@Test
public void _15_TestSelectAllSortedMultipleColumnsSpecified() throws ETSdkException {
ETResponse<ETDataExtensionRow> response = dataExtension.select("LastName", "FirstName", "EmailAddress", "ORDER BY FirstName");
<DeepExtract>
assertNotNull(response.getRequestId());
assertEquals(OK, response.getStatus());
assertEquals("OK", response.getResponseCode());
assertEquals("OK", response.getResponseMessage());
assertEquals((Integer) 1, response.getPage());
assertEquals((Integer) 2500, response.getPageSize());
assertEquals((Integer) 3, response.getTotalCount());
assertFalse(response.hasMoreResults());
List<ETDataExtensionRow> rows = response.getObjects();
assertEquals(3, rows.size());
ETDataExtensionRow row1 = rows.get(0);
assertNull(row1.getColumn("CustomerID"));
assertNull(row1.getColumn("FullName"));
assertEquals("Fred", row1.getColumn("FirstName"));
assertEquals("Flintstone", row1.getColumn("LastName"));
assertNull(row1.getColumn("Age"));
assertEquals("[email protected]", row1.getColumn("EmailAddress"));
ETDataExtensionRow row2 = rows.get(1);
assertNull(row2.getColumn("CustomerID"));
assertNull(row2.getColumn("FullName"));
assertEquals("Ian", row2.getColumn("FirstName"));
assertEquals("Murdock", row2.getColumn("LastName"));
assertNull(row2.getColumn("Age"));
assertEquals("[email protected]", row2.getColumn("EmailAddress"));
ETDataExtensionRow row3 = rows.get(2);
assertNull(row3.getColumn("CustomerID"));
assertNull(row3.getColumn("FullName"));
assertEquals("Wilma", row3.getColumn("FirstName"));
assertEquals("Flintstone", row3.getColumn("LastName"));
assertNull(row3.getColumn("Age"));
assertEquals("[email protected]", row3.getColumn("EmailAddress"));
</DeepExtract>
}
|
FuelSDK-Java
|
positive
| 441,588
|
public ANSIBuffer attrib(final String str, final int code) {
ansiBuffer.append(ANSICodes.attrib(ANSICodes.OFF));
plainBuffer.append(ANSICodes.attrib(ANSICodes.OFF));
return this;
ansiBuffer.append(str);
plainBuffer.append(str);
return this;
return this;
}
|
public ANSIBuffer attrib(final String str, final int code) {
ansiBuffer.append(ANSICodes.attrib(ANSICodes.OFF));
plainBuffer.append(ANSICodes.attrib(ANSICodes.OFF));
return this;
<DeepExtract>
ansiBuffer.append(str);
plainBuffer.append(str);
return this;
</DeepExtract>
return this;
}
|
contact
|
positive
| 441,589
|
public launchVideo_args setClearOnMediaEnd(boolean clearOnMediaEnd) {
this.clearOnMediaEnd = clearOnMediaEnd;
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __CLEARONMEDIAEND_ISSET_ID, true);
return this;
}
|
public launchVideo_args setClearOnMediaEnd(boolean clearOnMediaEnd) {
this.clearOnMediaEnd = clearOnMediaEnd;
<DeepExtract>
__isset_bitfield = org.apache.thrift.EncodingUtils.setBit(__isset_bitfield, __CLEARONMEDIAEND_ISSET_ID, true);
</DeepExtract>
return this;
}
|
obs-video-scheduler
|
positive
| 441,591
|
public void DeleteCurrentFrame() {
Keyframe[] newkeyframes = new Keyframe[keyframes.length - 1];
int j = 0;
for (int i = 0; i < keyframes.length; i++) {
if (keyframes[i] != GetKeyFrame(currentFrame))
newkeyframes[j++] = keyframes[i];
}
keyframes = newkeyframes;
ReloadFrameNumbers();
frameNumbers = new int[keyframes.length];
for (int i = 0; i < keyframes.length; i++) {
frameNumbers[i] = keyframes[i].getFrameNumber();
}
ModelCreator.DidModify();
ModelCreator.updateValues(null);
}
|
public void DeleteCurrentFrame() {
Keyframe[] newkeyframes = new Keyframe[keyframes.length - 1];
int j = 0;
for (int i = 0; i < keyframes.length; i++) {
if (keyframes[i] != GetKeyFrame(currentFrame))
newkeyframes[j++] = keyframes[i];
}
keyframes = newkeyframes;
ReloadFrameNumbers();
<DeepExtract>
frameNumbers = new int[keyframes.length];
for (int i = 0; i < keyframes.length; i++) {
frameNumbers[i] = keyframes[i].getFrameNumber();
}
</DeepExtract>
ModelCreator.DidModify();
ModelCreator.updateValues(null);
}
|
vsmodelcreator
|
positive
| 441,593
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.