before
stringlengths 14
203k
| after
stringlengths 37
104k
| repo
stringlengths 2
50
| type
stringclasses 1
value |
|---|---|---|---|
public void resize(int maxSize) {
if (maxSize <= 0) {
throw new IllegalArgumentException("maxSize <= 0");
}
synchronized (this) {
this.maxSize = maxSize;
}
while (true) {
K key;
V value;
synchronized (this) {
if (size < 0 || (map.isEmpty() && size != 0)) {
throw new IllegalStateException(getClass().getName() + ".sizeOf() is reporting inconsistent results!");
}
if (size <= maxSize) {
break;
}
Map.Entry<K, V> toEvict = null;
for (Map.Entry<K, V> entry : map.entrySet()) {
toEvict = entry;
if (!trimRecentItem) {
break;
}
}
if (toEvict == null) {
break;
}
key = toEvict.getKey();
value = toEvict.getValue();
map.remove(key);
size -= safeSizeOf(key, value);
evictionCount++;
}
entryRemoved(true, key, value, null);
}
}
|
<DeepExtract>
while (true) {
K key;
V value;
synchronized (this) {
if (size < 0 || (map.isEmpty() && size != 0)) {
throw new IllegalStateException(getClass().getName() + ".sizeOf() is reporting inconsistent results!");
}
if (size <= maxSize) {
break;
}
Map.Entry<K, V> toEvict = null;
for (Map.Entry<K, V> entry : map.entrySet()) {
toEvict = entry;
if (!trimRecentItem) {
break;
}
}
if (toEvict == null) {
break;
}
key = toEvict.getKey();
value = toEvict.getValue();
map.remove(key);
size -= safeSizeOf(key, value);
evictionCount++;
}
entryRemoved(true, key, value, null);
}
</DeepExtract>
|
thistle
|
positive
|
public Criteria andTry_countBetween(Integer value1, Integer value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "try_count" + " cannot be null");
}
criteria.add(new Criterion("try_count between", value1, value2));
return (Criteria) this;
}
|
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "try_count" + " cannot be null");
}
criteria.add(new Criterion("try_count between", value1, value2));
</DeepExtract>
|
SpringBootLearning
|
positive
|
private String orderHistoryBaseUrl(String... pathElements) {
assertNotNull("host", host);
StringBuilder sb = new StringBuilder("http://");
sb.append(host);
sb.append(":");
sb.append(apiGatewayPort);
sb.append("/");
sb.append("orders");
for (String pe : pathElements) {
sb.append("/");
sb.append(pe);
}
String s = sb.toString();
System.out.println("url=" + s);
return s;
}
|
<DeepExtract>
assertNotNull("host", host);
StringBuilder sb = new StringBuilder("http://");
sb.append(host);
sb.append(":");
sb.append(apiGatewayPort);
sb.append("/");
sb.append("orders");
for (String pe : pathElements) {
sb.append("/");
sb.append(pe);
}
String s = sb.toString();
System.out.println("url=" + s);
return s;
</DeepExtract>
|
ftgo-application
|
positive
|
public void run() {
double val = 0;
val++;
try {
this.sleep(3000);
} catch (InterruptedException ie) {
ie.printStackTrace();
}
return val;
}
|
<DeepExtract>
double val = 0;
val++;
try {
this.sleep(3000);
} catch (InterruptedException ie) {
ie.printStackTrace();
}
return val;
</DeepExtract>
|
javase
|
positive
|
public static void sdSize(final String sdSize, final String message) throws AndroidContainerConfigurationException {
notNull("Exception message is a null object!", "Exception message is a null object!");
if (message == null || message.trim().length() == 0) {
throw new IllegalStateException("Exception message is a null object!");
}
notNull("Size of the Android SD card to check is null object or empty string", "Exception message is a null object!");
if (sdSize == null || sdSize.trim().length() == 0) {
throw new IllegalStateException("Size of the Android SD card to check is null object or empty string");
}
if (!(sdSize.trim().length() >= 2) || !sdSize.matches("^[1-9]{1}[0-9]*[KGM]?$")) {
throw new AndroidContainerConfigurationException(message);
}
String sizeString = null;
String sizeUnit = null;
if (sdSize.substring(sdSize.length() - 1).matches("[KGM]")) {
sizeString = sdSize.substring(0, sdSize.length() - 1);
sizeUnit = sdSize.substring(sdSize.length() - 1);
} else {
sizeString = sdSize;
}
try {
size = Long.parseLong(sizeString);
} catch (NumberFormatException e) {
throw new IllegalArgumentException("Unable to parse '" + sizeString + "' to number.");
}
if (sizeUnit == null) {
if (size > 1099511627264L || size < 9437184) {
throw new AndroidContainerConfigurationException("Minimum size is 9M. Maximum size is 1023G. The Android emulator cannot use smaller or bigger images.");
}
return;
}
if ((size > 1023 && sizeUnit.equals("G")) || (size > 1048575 && sizeUnit.equals("M")) || (size > 1073741823 && sizeUnit.equals("K")) || (size < 9 && sizeUnit.equals("M")) || (size < 9126 && sizeUnit.equals("K"))) {
throw new AndroidContainerConfigurationException("Maximum size is 1099511627264 bytes, 1073741823K, 1048575M or 1023G. Minimum size is 9M. " + "The Android emulator cannot use smaller images.");
}
}
|
<DeepExtract>
notNull("Exception message is a null object!", "Exception message is a null object!");
if (message == null || message.trim().length() == 0) {
throw new IllegalStateException("Exception message is a null object!");
}
</DeepExtract>
<DeepExtract>
notNull("Size of the Android SD card to check is null object or empty string", "Exception message is a null object!");
if (sdSize == null || sdSize.trim().length() == 0) {
throw new IllegalStateException("Size of the Android SD card to check is null object or empty string");
}
</DeepExtract>
|
arquillian-droidium
|
positive
|
private void continueSport() {
currentSportState = RUN_SPORT;
isStart = true;
isPause = false;
isClickContinue = true;
if (!TIME_PAUSE) {
rangeTime = SystemClock.elapsedRealtime() - chronometer.getBase();
chronometer.stop();
} else {
chronometer.setBase(SystemClock.elapsedRealtime() - rangeTime);
chronometer.start();
}
TIME_PAUSE = !TIME_PAUSE;
}
|
<DeepExtract>
if (!TIME_PAUSE) {
rangeTime = SystemClock.elapsedRealtime() - chronometer.getBase();
chronometer.stop();
} else {
chronometer.setBase(SystemClock.elapsedRealtime() - rangeTime);
chronometer.start();
}
TIME_PAUSE = !TIME_PAUSE;
</DeepExtract>
|
MVP_Project
|
positive
|
public static int[] readInts() {
String[] fields = readAllStrings();
int[] vals = new int[fields.length];
for (int i = 0; i < fields.length; i++) vals[i] = Integer.parseInt(fields[i]);
return vals;
}
|
<DeepExtract>
String[] fields = readAllStrings();
int[] vals = new int[fields.length];
for (int i = 0; i < fields.length; i++) vals[i] = Integer.parseInt(fields[i]);
return vals;
</DeepExtract>
|
cs61b-sp18-Data-Structure
|
positive
|
@Override
public void onError(Exception e) {
connectionCallback.onFinish(true);
}
|
<DeepExtract>
connectionCallback.onFinish(true);
</DeepExtract>
|
MissZzzReader
|
positive
|
public void actionPerformed(ActionEvent e) {
boolean state = cpu.invertClockState();
rbTact.setSelected(!state);
}
|
<DeepExtract>
boolean state = cpu.invertClockState();
rbTact.setSelected(!state);
</DeepExtract>
|
BasicComputer
|
positive
|
public Builder clearPackage() {
java.lang.Object ref = package_;
if (ref instanceof java.lang.String) {
package_ = (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
package_ = s;
package_ = s;
}
onChanged();
return this;
}
|
<DeepExtract>
java.lang.Object ref = package_;
if (ref instanceof java.lang.String) {
package_ = (java.lang.String) ref;
} else {
com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref;
java.lang.String s = bs.toStringUtf8();
package_ = s;
package_ = s;
}
</DeepExtract>
|
url-frontier
|
positive
|
@Override
public void onRequestConnect(Peer peer) {
if (!mPeerList.contains(peer)) {
mPeerList.add(peer);
}
if (mTvTip == null) {
return;
}
if (mPeerList.size() > 0) {
mTvTip.setVisibility(View.VISIBLE);
} else {
mTvTip.setVisibility(View.INVISIBLE);
}
Log.i("w2k", "有设备请求建立连接:" + peer.getNickName() + " " + peer.getHostAddress());
Toast.makeText(mContext, peer.getNickName() + "请求建立连接", Toast.LENGTH_SHORT).show();
mPeerAdapter.notifyDataSetChanged();
if (mOnReceivePairActionListener != null) {
mOnReceivePairActionListener.onRequestSendFileAction();
}
}
|
<DeepExtract>
if (mTvTip == null) {
return;
}
if (mPeerList.size() > 0) {
mTvTip.setVisibility(View.VISIBLE);
} else {
mTvTip.setVisibility(View.INVISIBLE);
}
</DeepExtract>
|
XMShare
|
positive
|
public static void unzip(String _zipFile, String _targetLocation) {
File f = new File(_targetLocation);
if (!f.isDirectory()) {
f.mkdirs();
}
try {
FileInputStream fin = new FileInputStream(_zipFile);
ZipInputStream zin = new ZipInputStream(fin);
ZipEntry ze = null;
while ((ze = zin.getNextEntry()) != null) {
if (ze.isDirectory()) {
dirChecker(ze.getName());
} else {
FileOutputStream fout = new FileOutputStream(_targetLocation + ze.getName());
for (int c = zin.read(); c != -1; c = zin.read()) {
fout.write(c);
}
zin.closeEntry();
fout.close();
}
}
zin.close();
} catch (Exception e) {
System.out.println(e);
}
}
|
<DeepExtract>
File f = new File(_targetLocation);
if (!f.isDirectory()) {
f.mkdirs();
}
</DeepExtract>
|
cgm-scanner
|
positive
|
public void init(Session session, Map<String, String> options) throws OpenAS2Exception {
super.init(session, options);
String pwd = System.getProperty("org.openas2.cert.Password");
if (pwd != null) {
setPassword(pwd.toCharArray());
}
try {
this.keyStore = AS2Util.getCryptoHelper().getKeyStore();
} catch (Exception e) {
throw new WrappedException(e);
}
load(getFilename(), getPassword());
}
|
<DeepExtract>
load(getFilename(), getPassword());
</DeepExtract>
|
OpenAs2App
|
positive
|
public Criteria andRouteIdEqualTo(Long value) {
if (value == null) {
throw new RuntimeException("Value for " + "routeId" + " cannot be null");
}
criteria.add(new Criterion("routeId =", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "routeId" + " cannot be null");
}
criteria.add(new Criterion("routeId =", value));
</DeepExtract>
|
jtt808-simulator
|
positive
|
@Override
public void setImageBitmap(Bitmap bm) {
super.setImageBitmap(bm);
mBitmap = bm;
if (!mReady) {
mSetupPending = true;
return;
}
if (mBitmap == null) {
return;
}
mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
mBitmapPaint.setAntiAlias(true);
mBitmapPaint.setShader(mBitmapShader);
mBorderPaint.setStyle(Paint.Style.STROKE);
mBorderPaint.setAntiAlias(true);
mBorderPaint.setColor(mBorderColor);
mBorderPaint.setStrokeWidth(mBorderWidth);
mBitmapHeight = mBitmap.getHeight();
mBitmapWidth = mBitmap.getWidth();
mBorderRect.set(0, 0, getWidth(), getHeight());
mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2, (mBorderRect.width() - mBorderWidth) / 2);
mDrawableRect.set(mBorderWidth, mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth);
mDrawableRadius = Math.min(mDrawableRect.height() / 2, mDrawableRect.width() / 2);
updateShaderMatrix();
invalidate();
}
|
<DeepExtract>
if (!mReady) {
mSetupPending = true;
return;
}
if (mBitmap == null) {
return;
}
mBitmapShader = new BitmapShader(mBitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
mBitmapPaint.setAntiAlias(true);
mBitmapPaint.setShader(mBitmapShader);
mBorderPaint.setStyle(Paint.Style.STROKE);
mBorderPaint.setAntiAlias(true);
mBorderPaint.setColor(mBorderColor);
mBorderPaint.setStrokeWidth(mBorderWidth);
mBitmapHeight = mBitmap.getHeight();
mBitmapWidth = mBitmap.getWidth();
mBorderRect.set(0, 0, getWidth(), getHeight());
mBorderRadius = Math.min((mBorderRect.height() - mBorderWidth) / 2, (mBorderRect.width() - mBorderWidth) / 2);
mDrawableRect.set(mBorderWidth, mBorderWidth, mBorderRect.width() - mBorderWidth, mBorderRect.height() - mBorderWidth);
mDrawableRadius = Math.min(mDrawableRect.height() / 2, mDrawableRect.width() / 2);
updateShaderMatrix();
invalidate();
</DeepExtract>
|
xmpp
|
positive
|
public static boolean moveFile(final File srcFile, final File destFile, final OnReplaceListener listener) {
if (srcFile == null || destFile == null) {
return false;
}
if (srcFile.equals(destFile)) {
return false;
}
if (!srcFile.exists() || !srcFile.isFile()) {
return false;
}
if (destFile.exists()) {
if (listener.onReplace()) {
if (!destFile.delete()) {
return false;
}
} else {
return true;
}
}
if (!createOrExistsDir(destFile.getParentFile())) {
return false;
}
try {
return FileIOUtils.writeFileFromIS(destFile, new FileInputStream(srcFile), false) && !(true && !deleteFile(srcFile));
} catch (FileNotFoundException e) {
e.printStackTrace();
return false;
}
}
|
<DeepExtract>
if (srcFile == null || destFile == null) {
return false;
}
if (srcFile.equals(destFile)) {
return false;
}
if (!srcFile.exists() || !srcFile.isFile()) {
return false;
}
if (destFile.exists()) {
if (listener.onReplace()) {
if (!destFile.delete()) {
return false;
}
} else {
return true;
}
}
if (!createOrExistsDir(destFile.getParentFile())) {
return false;
}
try {
return FileIOUtils.writeFileFromIS(destFile, new FileInputStream(srcFile), false) && !(true && !deleteFile(srcFile));
} catch (FileNotFoundException e) {
e.printStackTrace();
return false;
}
</DeepExtract>
|
Engine
|
positive
|
void computeTextLayoutBounds(RectBounds bounds, BaseTransform transform, float scaleX, float layoutX, float layoutY, int token) {
RectBounds ret = new RectBounds(x, y, x + w, y + h);
if (!null.equals(savedBoundsTx)) {
inverseTxBounds(ret, savedBoundsTx);
txBounds(ret, null);
}
return ret;
TEMP_TX.setTransform(transform);
TEMP_TX.scale(scaleX, 1);
TEMP_TX.translate(layoutX, layoutY);
TEMP_TX.transform(bounds, bounds);
if (token == STROKE_TEXT) {
int flag = PrismTextLayout.TYPE_TEXT;
Shape textShape = textLayout.getShape(flag, null);
RectBounds shapeBounds = new RectBounds();
strokebounds(getStroke(), textShape, shapeBounds, TEMP_TX);
bounds.unionWith(shapeBounds);
}
}
|
<DeepExtract>
RectBounds ret = new RectBounds(x, y, x + w, y + h);
if (!null.equals(savedBoundsTx)) {
inverseTxBounds(ret, savedBoundsTx);
txBounds(ret, null);
}
return ret;
</DeepExtract>
|
marlin-fx
|
positive
|
private static Boolean getBooleanProp(String propertiesKey, boolean def) {
if (!debug)
return;
String result = System.getProperty(propertiesKey);
if (result != null) {
System.out.println("-D" + propertiesKey + "=" + result + " ");
}
String val = System.getProperty(propertiesKey);
Boolean ret = def;
if (val != null) {
try {
ret = Boolean.parseBoolean(val);
} catch (Exception e) {
}
}
return ret;
}
|
<DeepExtract>
if (!debug)
return;
String result = System.getProperty(propertiesKey);
if (result != null) {
System.out.println("-D" + propertiesKey + "=" + result + " ");
}
</DeepExtract>
|
run-jetty-run
|
positive
|
@Override
public JsonWriter value(boolean value) throws IOException {
if (pendingName != null) {
if (!new JsonPrimitive(value).isJsonNull() || getSerializeNulls()) {
JsonObject object = (JsonObject) peek();
object.add(pendingName, new JsonPrimitive(value));
}
pendingName = null;
} else if (stack.isEmpty()) {
product = new JsonPrimitive(value);
} else {
JsonElement element = peek();
if (element.isJsonArray()) {
element.getAsJsonArray().add(new JsonPrimitive(value));
} else {
throw new IllegalStateException();
}
}
return this;
}
|
<DeepExtract>
if (pendingName != null) {
if (!new JsonPrimitive(value).isJsonNull() || getSerializeNulls()) {
JsonObject object = (JsonObject) peek();
object.add(pendingName, new JsonPrimitive(value));
}
pendingName = null;
} else if (stack.isEmpty()) {
product = new JsonPrimitive(value);
} else {
JsonElement element = peek();
if (element.isJsonArray()) {
element.getAsJsonArray().add(new JsonPrimitive(value));
} else {
throw new IllegalStateException();
}
}
</DeepExtract>
|
funf-core-android
|
positive
|
@RequestMapping(value = "/update", method = { RequestMethod.POST })
public ResponseBean update(@RequestBody HBUserGroup object) {
if (object.getRoles() != null) {
Collection<HBRole> allRoles = roleService.dao().findAll(object.getRoles(), "id");
if (HBCollectionUtil.isNotEmpty(allRoles)) {
object.setRoles(allRoles.stream().filter(r -> object.getRoles().contains(r.getId())).map(r -> r.getId()).collect(Collectors.toList()));
}
}
if (object.getLeader() != null && HBStringUtil.isNotBlank(object.getLeader().getUserName())) {
HBUser user = userDao.findUserByName(object.getLeader().getUserName());
if (user != null) {
object.getLeader().setId(user.getId());
} else {
object.setLeader(null);
}
}
return super.update(object);
}
|
<DeepExtract>
if (object.getRoles() != null) {
Collection<HBRole> allRoles = roleService.dao().findAll(object.getRoles(), "id");
if (HBCollectionUtil.isNotEmpty(allRoles)) {
object.setRoles(allRoles.stream().filter(r -> object.getRoles().contains(r.getId())).map(r -> r.getId()).collect(Collectors.toList()));
}
}
if (object.getLeader() != null && HBStringUtil.isNotBlank(object.getLeader().getUserName())) {
HBUser user = userDao.findUserByName(object.getLeader().getUserName());
if (user != null) {
object.getLeader().setId(user.getId());
} else {
object.setLeader(null);
}
}
</DeepExtract>
|
resys-one
|
positive
|
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater menuInflater = getMenuInflater();
menuInflater.inflate(R.menu.personal, menu);
mFollowItem = menu.findItem(R.id.action_follow);
if (mFollowItem == null)
return;
Drawable drawable = mIsFollowUser ? getResources().getDrawable(R.drawable.ic_favorite) : getResources().getDrawable(R.drawable.ic_favorite_border);
drawable = DrawableCompat.wrap(drawable);
DrawableCompat.setTint(drawable, Resource.Color.WHITE);
mFollowItem.setIcon(drawable);
return true;
}
|
<DeepExtract>
if (mFollowItem == null)
return;
Drawable drawable = mIsFollowUser ? getResources().getDrawable(R.drawable.ic_favorite) : getResources().getDrawable(R.drawable.ic_favorite_border);
drawable = DrawableCompat.wrap(drawable);
DrawableCompat.setTint(drawable, Resource.Color.WHITE);
mFollowItem.setIcon(drawable);
</DeepExtract>
|
ITalkerChat
|
positive
|
public void put(String key, int value) {
editor = sp.edit();
editor.putInt(key, value).commit();
}
|
<DeepExtract>
editor = sp.edit();
</DeepExtract>
|
Android-development-with-example
|
positive
|
public final void add(int pos, Box b) {
width += b.getWidth();
height = Math.max((children.size() == 0 ? Float.NEGATIVE_INFINITY : height), b.height - b.shift);
depth = Math.max((children.size() == 0 ? Float.NEGATIVE_INFINITY : depth), b.depth + b.shift);
super.add(pos, b);
}
|
<DeepExtract>
width += b.getWidth();
height = Math.max((children.size() == 0 ? Float.NEGATIVE_INFINITY : height), b.height - b.shift);
depth = Math.max((children.size() == 0 ? Float.NEGATIVE_INFINITY : depth), b.depth + b.shift);
</DeepExtract>
|
JLaTexMath-andriod
|
positive
|
static void emitStoreInt(String source, String dest, PrintStream s) {
s.println(SW + source + " " + DEFAULT_OBJFIELDS * WORD_SIZE + "(" + dest + ")");
}
|
<DeepExtract>
s.println(SW + source + " " + DEFAULT_OBJFIELDS * WORD_SIZE + "(" + dest + ")");
</DeepExtract>
|
Compiler
|
positive
|
public static void writeBMP(Image img, String destFile, boolean sharpen, float sharpenLevel) throws IOException {
float[] normalMatrix = { 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f };
float[] edgeMatrix = { 0.0f, -1.0f, 0.0f, -1.0f, 4.0f, -1.0f, 0.0f, -1.0f, 0.0f };
float[] sharpMatrix = new float[9];
for (int i = 0; i < 9; i++) {
sharpMatrix[i] = normalMatrix[i] + sharpenLevel * edgeMatrix[i];
}
return sharpMatrix;
BufferedImage imageRGBSharpen = null;
IIOImage iioImage = null;
BufferedImage image = SwingFXUtils.fromFXImage(img, null);
BufferedImage imageRGB = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.OPAQUE);
Graphics2D graphics = imageRGB.createGraphics();
graphics.drawImage(image, 0, 0, null);
if (sharpen) {
imageRGBSharpen = new BufferedImage(image.getWidth(), image.getHeight(), BufferedImage.TYPE_INT_RGB);
Kernel kernel = new Kernel(3, 3, sharpenMatrix);
ConvolveOp cop = new ConvolveOp(kernel, ConvolveOp.EDGE_NO_OP, null);
cop.filter(imageRGB, imageRGBSharpen);
}
ImageWriter writer = null;
FileImageOutputStream output = null;
try {
writer = ImageIO.getImageWritersByFormatName("bmp").next();
ImageWriteParam param = writer.getDefaultWriteParam();
output = new FileImageOutputStream(new File(destFile));
writer.setOutput(output);
if (sharpen) {
iioImage = new IIOImage(imageRGBSharpen, null, null);
} else {
iioImage = new IIOImage(imageRGB, null, null);
}
writer.write(null, iioImage, param);
} catch (IOException ex) {
throw ex;
} finally {
if (writer != null) {
writer.dispose();
}
if (output != null) {
output.close();
}
}
graphics.dispose();
}
|
<DeepExtract>
float[] normalMatrix = { 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f };
float[] edgeMatrix = { 0.0f, -1.0f, 0.0f, -1.0f, 4.0f, -1.0f, 0.0f, -1.0f, 0.0f };
float[] sharpMatrix = new float[9];
for (int i = 0; i < 9; i++) {
sharpMatrix[i] = normalMatrix[i] + sharpenLevel * edgeMatrix[i];
}
return sharpMatrix;
</DeepExtract>
|
editeurPanovisu
|
positive
|
@Test
public void testPrimingWriteTimeoutPrimeCL() {
WriteTimeoutConfig config = new WriteTimeoutConfig(SIMPLE, 2, 3, Consistency.ONE);
String query = "select * from people";
PrimingRequest prime = PrimingRequest.preparedStatementBuilder().withQuery(query).withResult(write_request_timeout).withConfig(config).build();
primingClient.prime(prime);
CassandraResult cassandraResult = cassandra().prepareAndExecuteWithConsistency(query, Consistency.ALL.name());
CassandraResult.ResponseStatus status = cassandraResult.status();
assertEquals(write_request_timeout, status.getResult());
assertEquals(Consistency.ONE.name(), ((CassandraResult.WriteTimeoutStatus) status).getConsistency());
assertEquals(2, ((CassandraResult.WriteTimeoutStatus) status).getReceivedAcknowledgements());
assertEquals(3, ((CassandraResult.WriteTimeoutStatus) status).getRequiredAcknowledgements());
assertEquals(SIMPLE, ((CassandraResult.WriteTimeoutStatus) status).getWriteTypePrime());
}
|
<DeepExtract>
String query = "select * from people";
PrimingRequest prime = PrimingRequest.preparedStatementBuilder().withQuery(query).withResult(write_request_timeout).withConfig(config).build();
primingClient.prime(prime);
CassandraResult cassandraResult = cassandra().prepareAndExecuteWithConsistency(query, Consistency.ALL.name());
CassandraResult.ResponseStatus status = cassandraResult.status();
assertEquals(write_request_timeout, status.getResult());
assertEquals(Consistency.ONE.name(), ((CassandraResult.WriteTimeoutStatus) status).getConsistency());
assertEquals(2, ((CassandraResult.WriteTimeoutStatus) status).getReceivedAcknowledgements());
assertEquals(3, ((CassandraResult.WriteTimeoutStatus) status).getRequiredAcknowledgements());
assertEquals(SIMPLE, ((CassandraResult.WriteTimeoutStatus) status).getWriteTypePrime());
</DeepExtract>
|
scassandra-server
|
positive
|
@Override
public void init() {
NodeBuilder nb = RegistryNodeBuilders.singleton.getByName(params.nodeBuilderName);
BitSet badNodes = chooseBadNodes(network.rd, params.nodeCount, params.nodesDown);
for (int i = 0; i < params.nodeCount; i++) {
int startAt = params.desynchronizedStart == 0 ? 0 : network.rd.nextInt(params.desynchronizedStart);
final HNode n = new HNode(this, startAt, nb);
if (badNodes.get(i)) {
n.stop();
}
network.addNode(n);
}
List<HNode> all = new ArrayList<>(network().allNodes);
for (HNode s : network().allNodes) {
Collections.shuffle(all, network.rd);
for (int i = 0; i < all.size(); i++) {
s.receptionRanks[all.get(i).nodeId] = i;
}
}
for (HNode sender : network.allNodes) {
if (sender.isDown()) {
continue;
}
List<HNode>[] ourRankInDest = new List[params.nodeCount];
for (HNode receiver : network.allNodes) {
int recRank = receiver.receptionRanks[sender.nodeId];
List<HNode> levelList = ourRankInDest[recRank];
if (levelList == null) {
levelList = new ArrayList<>(1);
ourRankInDest[recRank] = levelList;
}
levelList.add(receiver);
}
assert sender.peersPerLevel.isEmpty();
sender.peersPerLevel.add(Collections.emptyList());
for (int l = 1; l <= levelCount(); l++) {
sender.peersPerLevel.add(new ArrayList<>());
}
for (List<HNode> lr : ourRankInDest) {
if (lr == null) {
continue;
}
for (HNode n : lr) {
if (n != sender) {
int comLevel = sender.communicationLevel(n);
sender.peersPerLevel.get(comLevel).add(n);
}
}
}
}
for (HNode n : network.allNodes) {
if (!n.isDown()) {
network.registerPeriodicTask(n::startNewAggregation, n.deltaStart + 1, HandelEth2Parameters.PERIOD_TIME, n);
network.registerPeriodicTask(n::dissemination, n.deltaStart + 1, params.periodDurationMs, n);
network.registerPeriodicTask(n::verify, n.deltaStart + 1, n.nodePairingTime, n);
}
}
}
|
<DeepExtract>
List<HNode> all = new ArrayList<>(network().allNodes);
for (HNode s : network().allNodes) {
Collections.shuffle(all, network.rd);
for (int i = 0; i < all.size(); i++) {
s.receptionRanks[all.get(i).nodeId] = i;
}
}
</DeepExtract>
<DeepExtract>
for (HNode sender : network.allNodes) {
if (sender.isDown()) {
continue;
}
List<HNode>[] ourRankInDest = new List[params.nodeCount];
for (HNode receiver : network.allNodes) {
int recRank = receiver.receptionRanks[sender.nodeId];
List<HNode> levelList = ourRankInDest[recRank];
if (levelList == null) {
levelList = new ArrayList<>(1);
ourRankInDest[recRank] = levelList;
}
levelList.add(receiver);
}
assert sender.peersPerLevel.isEmpty();
sender.peersPerLevel.add(Collections.emptyList());
for (int l = 1; l <= levelCount(); l++) {
sender.peersPerLevel.add(new ArrayList<>());
}
for (List<HNode> lr : ourRankInDest) {
if (lr == null) {
continue;
}
for (HNode n : lr) {
if (n != sender) {
int comLevel = sender.communicationLevel(n);
sender.peersPerLevel.get(comLevel).add(n);
}
}
}
}
</DeepExtract>
|
wittgenstein
|
positive
|
public static void notEmpty(Collection<?> field, String fieldName) {
if (field == null) {
throw new IllegalArgumentException(fieldName + " cannot be null");
}
if (field.isEmpty()) {
throw new IllegalArgumentException(fieldName + " cannot be empty");
}
}
|
<DeepExtract>
if (field == null) {
throw new IllegalArgumentException(fieldName + " cannot be null");
}
</DeepExtract>
|
shopify
|
positive
|
public static Address newAddress(String street, String city, State state, String zipCode) {
Assert.hasText(street, "street is required");
Assert.hasText(city, "city is required");
Assert.notNull(state, "state is required");
Assert.hasText(zipCode, "zipCode is required");
Address address = new Address();
this.street = street;
this.city = city;
this.state = state;
this.zipCode = zipCode;
return address;
}
|
<DeepExtract>
this.street = street;
</DeepExtract>
<DeepExtract>
this.city = city;
</DeepExtract>
<DeepExtract>
this.state = state;
</DeepExtract>
<DeepExtract>
this.zipCode = zipCode;
</DeepExtract>
|
contacts-application
|
positive
|
@Override
public Builder<T, K> whereInRaw(String column, String sql) {
String sqlPart = backQuote(column) + "in" + FormatUtils.bracket(sql);
if (!ObjectUtils.isEmpty(sqlPart)) {
whereGrammar(sqlPart, null, " and ");
}
return this;
}
|
<DeepExtract>
if (!ObjectUtils.isEmpty(sqlPart)) {
whereGrammar(sqlPart, null, " and ");
}
return this;
</DeepExtract>
|
database-all
|
positive
|
public static void copyPropertiesAllowNull(Object from, Object to) {
try {
new BeanUtilsBean().copyProperties(to, from);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
|
<DeepExtract>
try {
new BeanUtilsBean().copyProperties(to, from);
} catch (Exception e) {
throw new RuntimeException(e);
}
</DeepExtract>
|
cola-cloud
|
positive
|
public void includeAll() {
add("bucket", "biographies");
add("bucket", "blogs");
add("bucket", "familiarity");
add("bucket", "hotttnesss");
add("bucket", "images");
add("bucket", "news");
add("bucket", "reviews");
add("bucket", "urls");
add("bucket", "video");
add("bucket", "songs");
add("bucket", "doc_counts");
add("bucket", "years_active");
add("bucket", "artist_location");
add("bucket", "terms");
}
|
<DeepExtract>
add("bucket", "biographies");
</DeepExtract>
<DeepExtract>
add("bucket", "blogs");
</DeepExtract>
<DeepExtract>
add("bucket", "familiarity");
</DeepExtract>
<DeepExtract>
add("bucket", "hotttnesss");
</DeepExtract>
<DeepExtract>
add("bucket", "images");
</DeepExtract>
<DeepExtract>
add("bucket", "news");
</DeepExtract>
<DeepExtract>
add("bucket", "reviews");
</DeepExtract>
<DeepExtract>
add("bucket", "urls");
</DeepExtract>
<DeepExtract>
add("bucket", "video");
</DeepExtract>
<DeepExtract>
add("bucket", "songs");
</DeepExtract>
<DeepExtract>
add("bucket", "doc_counts");
</DeepExtract>
<DeepExtract>
add("bucket", "years_active");
</DeepExtract>
<DeepExtract>
add("bucket", "artist_location");
</DeepExtract>
<DeepExtract>
add("bucket", "terms");
</DeepExtract>
|
jEN
|
positive
|
@Override
public void onRemoveItem(Dialog dialog, PinConfig pinConfig, int position, int totalPin) {
PinConfig rp = new PinConfig();
for (PinConfig p : pinConfigs) if ((p.position == pinConfig.position) && p.sku.equals(pinConfig.sku)) {
rp = p;
break;
}
pinConfigs.remove(rp);
Message message = Message.obtain();
message.what = RMV_I2C_GROVE;
message.obj = pinConfig;
mHandler.sendMessage(message);
if (totalPin < 1) {
dialog.dismiss();
}
}
|
<DeepExtract>
PinConfig rp = new PinConfig();
for (PinConfig p : pinConfigs) if ((p.position == pinConfig.position) && p.sku.equals(pinConfig.sku)) {
rp = p;
break;
}
pinConfigs.remove(rp);
</DeepExtract>
|
Wio_Link_Android_App
|
positive
|
public UpdateColumnIncrement<T, Integer> increment(int field) {
A alias = getPrimitiveAliasByValue(field);
if (alias == null) {
return increment(field);
}
return increment(alias);
}
|
<DeepExtract>
A alias = getPrimitiveAliasByValue(field);
if (alias == null) {
return increment(field);
}
return increment(alias);
</DeepExtract>
|
iciql
|
positive
|
public static void assertPositive(Number obj, String fieldName) {
if (obj == null) {
LOG.warn("Field '{}' should not be null", fieldName);
throw new WebApplicationException(Response.Status.BAD_REQUEST);
}
if (obj.intValue() < 0) {
LOG.warn("Field '{}' should be positive", fieldName);
throw new WebApplicationException(Response.Status.BAD_REQUEST);
}
}
|
<DeepExtract>
if (obj == null) {
LOG.warn("Field '{}' should not be null", fieldName);
throw new WebApplicationException(Response.Status.BAD_REQUEST);
}
</DeepExtract>
|
multibit-merchant
|
positive
|
@Test
public void testEditLinkInList() {
switchToSource();
setSourceText("* one\n* [[two>>http://www.xwiki.com]]\n** three");
switchToWysiwyg();
moveCaret("document.body.firstChild.childNodes[1].firstChild.firstChild", 1);
clickMenu(MENU_LINK);
assertTrue(isMenuEnabled(MENU_LINK_EDIT));
clickMenu(MENU_LINK_EDIT);
waitForDialogToLoad();
getDriver().waitUntilElementIsVisible(By.className("xLinkToUrl"));
assertEquals("two", getInputValue(LABEL_INPUT_TITLE));
assertEquals("http://www.xwiki.com", getInputValue("Web page address"));
typeInInput("Web page address", "http://www.xwiki.org");
clickButtonWithText(BUTTON_CREATE_LINK);
waitForDialogToClose();
switchToSource();
assertSourceText("* one\n* [[two>>http://www.xwiki.org]]\n** three");
}
|
<DeepExtract>
clickMenu(MENU_LINK);
assertTrue(isMenuEnabled(MENU_LINK_EDIT));
clickMenu(MENU_LINK_EDIT);
waitForDialogToLoad();
</DeepExtract>
<DeepExtract>
getDriver().waitUntilElementIsVisible(By.className("xLinkToUrl"));
</DeepExtract>
|
xwiki-enterprise
|
positive
|
@Test
public void testGenerateOnlyBug() throws Exception {
for (String label : BUG) {
addIssue(1, CLOSED, "Mock issue title 1", label);
addIssue(2, CLOSED, "Mock issue title 2", label);
addIssue(3, CLOSED, "Mock issue title 3", label);
addIssue(4, CLOSED, "Mock issue title 4", label);
addIssue(5, CLOSED, "Mock issue title 5 ==> test", label);
addIssue(6, CLOSED, "Mock issue title 6 L12345678901234567890123456789012345678" + "90123456789012345678901234567890oooooooooooooooooooooooooooooooooooooooooooooo" + "ooong'\"", label);
addIssue(7, CLOSED, "Mock issue title 7 thisIssueTitleIsExactly87Characters" + "LongAndThenYouThe13ChrIndentation", label);
addIssue(8, CLOSED, "Mock issue title 8 thisIssueTitleIsExactly100Characters" + "LongAndWeExpectItToGetWrappedDueToBeingTooLng", label);
addIssue(9, CLOSED, "Mock issue title 9 escape @ and @@@@@", label);
addIssue(10, CLOSED, "Mock issue title 10 escape < > & <&<>&<<", label);
addIssue(13, CLOSED, "Mock pull title 13", label);
addIssue(14, CLOSED, "Mock issue title 14", label);
addIssue(15, CLOSED, "Mock issue title 15", label);
addIssue(16, CLOSED, "Mock issue title 16", label);
}
addCommit("Issue #1: Mock issue title 1", "Author 1");
addCommit("Issue #2: Mock issue title 2", "Author 3, Author 4");
addCommit("Issue #3: Mock issue title 3", "Author 5");
addCommit("Issue #4: Mock issue title 4", "Author 6, Author 7");
addCommit("Issue #5: Mock issue title 5 ==> test", "Author 6, Author 7");
addCommit("Issue #6: Mock issue title 6 L12345678901234567890123456789012345678" + "90123456789012345678901234567890oooooooooooooooooooooooooooooooooooooooooooooo" + "ooong'\"", "Author 1");
addCommit("Issue #7: Mock issue title 7 thisIssueTitleIsExactly87Characters" + "LongAndThenYouThe13ChrIndentation", "Author 10");
addCommit("Issue #8: Mock issue title 8 thisIssueTitleIsExactly100Characters" + "LongAndWeExpectItToGetWrappedDueToBeingTooLng", "Author 11");
addCommit("Issue #9: Mock issue title 9 escape @ and @@@@@", "Author 12");
addCommit("Issue #10: Mock issue title 10 escape < > & <&<>&<<", "Author 13");
addCommit("Issue 11: Mock issue title 11 missing #", "Author 14");
addCommit("Pull 12: Mock pull title 12 missing #", "Author 15");
addCommit("[email protected]", "Author 16");
addCommit("Issue #asd: asd", "Author 17");
addCommit("Pull #13: Mock pull title 13", "Author 18");
addCommit(".Issue #14: Mock issue title 14", "Author 19");
addCommit("Issue #14: Mock issue title 14\r\n", "Author 20");
addCommit("Issue #15: Mock issue title 15\r", "Author 21");
addCommit("Issue #16: Mock issue title 16\n", "Author 22");
runMainContentGenerationAndAssertReturnCode(0, "-releaseNumber", "1.0.1", "-generateAll", "-validateVersion");
Assert.assertEquals("expected error output", "", systemErr.getLog());
Assert.assertEquals("expected output", MSG_EXECUTION_SUCCEEDED, systemOut.getLog());
assertFile("xdocBug.txt", MainProcess.XDOC_FILENAME);
assertFile("twitterBug.txt", MainProcess.TWITTER_FILENAME);
assertFile("githubPageBug.txt", MainProcess.GITHUB_FILENAME);
}
|
<DeepExtract>
for (String label : BUG) {
addIssue(1, CLOSED, "Mock issue title 1", label);
addIssue(2, CLOSED, "Mock issue title 2", label);
addIssue(3, CLOSED, "Mock issue title 3", label);
addIssue(4, CLOSED, "Mock issue title 4", label);
addIssue(5, CLOSED, "Mock issue title 5 ==> test", label);
addIssue(6, CLOSED, "Mock issue title 6 L12345678901234567890123456789012345678" + "90123456789012345678901234567890oooooooooooooooooooooooooooooooooooooooooooooo" + "ooong'\"", label);
addIssue(7, CLOSED, "Mock issue title 7 thisIssueTitleIsExactly87Characters" + "LongAndThenYouThe13ChrIndentation", label);
addIssue(8, CLOSED, "Mock issue title 8 thisIssueTitleIsExactly100Characters" + "LongAndWeExpectItToGetWrappedDueToBeingTooLng", label);
addIssue(9, CLOSED, "Mock issue title 9 escape @ and @@@@@", label);
addIssue(10, CLOSED, "Mock issue title 10 escape < > & <&<>&<<", label);
addIssue(13, CLOSED, "Mock pull title 13", label);
addIssue(14, CLOSED, "Mock issue title 14", label);
addIssue(15, CLOSED, "Mock issue title 15", label);
addIssue(16, CLOSED, "Mock issue title 16", label);
}
</DeepExtract>
<DeepExtract>
addCommit("Issue #1: Mock issue title 1", "Author 1");
addCommit("Issue #2: Mock issue title 2", "Author 3, Author 4");
addCommit("Issue #3: Mock issue title 3", "Author 5");
addCommit("Issue #4: Mock issue title 4", "Author 6, Author 7");
addCommit("Issue #5: Mock issue title 5 ==> test", "Author 6, Author 7");
addCommit("Issue #6: Mock issue title 6 L12345678901234567890123456789012345678" + "90123456789012345678901234567890oooooooooooooooooooooooooooooooooooooooooooooo" + "ooong'\"", "Author 1");
addCommit("Issue #7: Mock issue title 7 thisIssueTitleIsExactly87Characters" + "LongAndThenYouThe13ChrIndentation", "Author 10");
addCommit("Issue #8: Mock issue title 8 thisIssueTitleIsExactly100Characters" + "LongAndWeExpectItToGetWrappedDueToBeingTooLng", "Author 11");
addCommit("Issue #9: Mock issue title 9 escape @ and @@@@@", "Author 12");
addCommit("Issue #10: Mock issue title 10 escape < > & <&<>&<<", "Author 13");
addCommit("Issue 11: Mock issue title 11 missing #", "Author 14");
addCommit("Pull 12: Mock pull title 12 missing #", "Author 15");
addCommit("[email protected]", "Author 16");
addCommit("Issue #asd: asd", "Author 17");
addCommit("Pull #13: Mock pull title 13", "Author 18");
addCommit(".Issue #14: Mock issue title 14", "Author 19");
addCommit("Issue #14: Mock issue title 14\r\n", "Author 20");
addCommit("Issue #15: Mock issue title 15\r", "Author 21");
addCommit("Issue #16: Mock issue title 16\n", "Author 22");
</DeepExtract>
|
contribution
|
positive
|
@Test
public void testReturnValDepend() {
String class1 = "mod.returnvaldepend.ClassDependsOnReturnValue";
String class2 = "mod.dummy.DummyInterface";
expectDesignCheckFailure("testReturnValDepend", Design.getErrorMessage(class1, class2), null);
}
|
<DeepExtract>
expectDesignCheckFailure("testReturnValDepend", Design.getErrorMessage(class1, class2), null);
</DeepExtract>
|
ant-contrib
|
positive
|
public int nextRandomIndex() {
return new FairArgMax(list);
}
|
<DeepExtract>
return new FairArgMax(list);
</DeepExtract>
|
subare
|
positive
|
public static int getRetryCount() {
String value = getProperty("weibo4j.http.retryCount");
try {
return Integer.parseInt(value);
} catch (NumberFormatException nfe) {
return -1;
}
}
|
<DeepExtract>
String value = getProperty("weibo4j.http.retryCount");
try {
return Integer.parseInt(value);
} catch (NumberFormatException nfe) {
return -1;
}
</DeepExtract>
|
WeiboCluster
|
positive
|
void encode(OutputStream os) throws IOException {
os.write(initCodeSize);
remaining = imgW * imgH;
curPixel = 0;
int fcode;
int i;
int c;
int ent;
int disp;
int hsize_reg;
int hshift;
g_init_bits = initCodeSize + 1;
clear_flg = false;
n_bits = g_init_bits;
maxcode = MAXCODE(n_bits);
ClearCode = 1 << (initCodeSize + 1 - 1);
EOFCode = ClearCode + 1;
free_ent = ClearCode + 2;
a_count = 0;
ent = nextPixel();
hshift = 0;
for (fcode = hsize; fcode < 65536; fcode *= 2) ++hshift;
hshift = 8 - hshift;
hsize_reg = hsize;
cl_hash(hsize_reg);
output(ClearCode, os);
outer_loop: while ((c = nextPixel()) != EOF) {
fcode = (c << maxbits) + ent;
i = (c << hshift) ^ ent;
if (htab[i] == fcode) {
ent = codetab[i];
continue;
} else if (htab[i] >= 0) {
disp = hsize_reg - i;
if (i == 0)
disp = 1;
do {
if ((i -= disp) < 0)
i += hsize_reg;
if (htab[i] == fcode) {
ent = codetab[i];
continue outer_loop;
}
} while (htab[i] >= 0);
}
output(ent, os);
ent = c;
if (free_ent < maxmaxcode) {
codetab[i] = free_ent++;
htab[i] = fcode;
} else
cl_block(os);
}
output(ent, os);
output(EOFCode, os);
os.write(0);
}
|
<DeepExtract>
int fcode;
int i;
int c;
int ent;
int disp;
int hsize_reg;
int hshift;
g_init_bits = initCodeSize + 1;
clear_flg = false;
n_bits = g_init_bits;
maxcode = MAXCODE(n_bits);
ClearCode = 1 << (initCodeSize + 1 - 1);
EOFCode = ClearCode + 1;
free_ent = ClearCode + 2;
a_count = 0;
ent = nextPixel();
hshift = 0;
for (fcode = hsize; fcode < 65536; fcode *= 2) ++hshift;
hshift = 8 - hshift;
hsize_reg = hsize;
cl_hash(hsize_reg);
output(ClearCode, os);
outer_loop: while ((c = nextPixel()) != EOF) {
fcode = (c << maxbits) + ent;
i = (c << hshift) ^ ent;
if (htab[i] == fcode) {
ent = codetab[i];
continue;
} else if (htab[i] >= 0) {
disp = hsize_reg - i;
if (i == 0)
disp = 1;
do {
if ((i -= disp) < 0)
i += hsize_reg;
if (htab[i] == fcode) {
ent = codetab[i];
continue outer_loop;
}
} while (htab[i] >= 0);
}
output(ent, os);
ent = c;
if (free_ent < maxmaxcode) {
codetab[i] = free_ent++;
htab[i] = fcode;
} else
cl_block(os);
}
output(ent, os);
output(EOFCode, os);
</DeepExtract>
|
mayfly
|
positive
|
public JettyConfigBuilder argRef(String name, String id) {
beginArg();
builder.attribute("name", name);
return this;
{
ref(id);
}
builder.end();
return this;
return this;
}
|
<DeepExtract>
beginArg();
builder.attribute("name", name);
return this;
</DeepExtract>
<DeepExtract>
builder.end();
return this;
</DeepExtract>
|
eclipse-jetty-plugin
|
positive
|
protected void addTestDevice(String deviceID) {
if (bDebug) {
Log.d(LOG_TAG, "addTestDevice invoked:" + deviceID);
}
if (null == mTestDevices) {
mTestDevices = new HashSet<String>();
}
mTestDevices.add(deviceID);
}
|
<DeepExtract>
if (bDebug) {
Log.d(LOG_TAG, "addTestDevice invoked:" + deviceID);
}
</DeepExtract>
|
HelloRuby
|
positive
|
@Override
public final ArdenValue runElement(ArdenValue lhs, ArdenValue rhs) {
long newTime;
if (lhs.primaryTime == rhs.primaryTime)
newTime = lhs.primaryTime;
else
newTime = ArdenValue.NOPRIMARYTIME;
if (lhs instanceof ArdenDuration && rhs instanceof ArdenTime) {
return new ArdenTime(((ArdenTime) rhs).add((ArdenDuration) lhs), newTime);
}
return ArdenNull.create(newTime);
}
|
<DeepExtract>
long newTime;
if (lhs.primaryTime == rhs.primaryTime)
newTime = lhs.primaryTime;
else
newTime = ArdenValue.NOPRIMARYTIME;
</DeepExtract>
|
arden2bytecode
|
positive
|
@Override
public String toString() {
StringWriter sw = new StringWriter();
new PrintWriter(sw).println(Util.getSpaces(0) + "ISO Compliant Answer To Reset (ATR)");
String indentStr = Util.getSpaces(0 + 3);
new PrintWriter(sw).println(indentStr + "Convention - " + convention);
new PrintWriter(sw).println(indentStr + "Protocol - " + protocol);
if (numHistoricalBytes > 0) {
new PrintWriter(sw).println(indentStr + "Historical bytes - " + Util.prettyPrintHex(Util.byteArrayToHexString(getHistoricalBytes())));
}
return sw.toString();
}
|
<DeepExtract>
new PrintWriter(sw).println(Util.getSpaces(0) + "ISO Compliant Answer To Reset (ATR)");
String indentStr = Util.getSpaces(0 + 3);
new PrintWriter(sw).println(indentStr + "Convention - " + convention);
new PrintWriter(sw).println(indentStr + "Protocol - " + protocol);
if (numHistoricalBytes > 0) {
new PrintWriter(sw).println(indentStr + "Historical bytes - " + Util.prettyPrintHex(Util.byteArrayToHexString(getHistoricalBytes())));
}
</DeepExtract>
|
javaemvreader
|
positive
|
@Test
public void rangeQueryTest() throws Exception {
LindenResult result = clusterClient.search("select * from linden where catId = 4 source");
if (result.isSuccess()) {
try {
if (6 >= 0) {
Assert.assertEquals(6, result.getHitsSize());
Assert.assertEquals(6, result.getTotalHits());
}
if (null != null) {
if (null.startsWith("{")) {
Assert.assertEquals(null, result.getHits().get(0).getSource());
} else {
String[] ids = null.split(",");
for (int i = 0; i < ids.length; i++) {
Assert.assertEquals(ids[i], result.getHits().get(i).getId());
}
}
}
} catch (Throwable t) {
System.out.println(result);
throw t;
}
} else {
throw new Exception(result.getError());
}
return result;
LindenResult result = clusterClient.search("select * from linden where catId > 3 limit 0,12 source");
if (result.isSuccess()) {
try {
if (12 >= 0) {
Assert.assertEquals(12, result.getHitsSize());
Assert.assertEquals(92, result.getTotalHits());
}
if (null != null) {
if (null.startsWith("{")) {
Assert.assertEquals(null, result.getHits().get(0).getSource());
} else {
String[] ids = null.split(",");
for (int i = 0; i < ids.length; i++) {
Assert.assertEquals(ids[i], result.getHits().get(i).getId());
}
}
}
} catch (Throwable t) {
System.out.println(result);
throw t;
}
} else {
throw new Exception(result.getError());
}
return result;
LindenResult result = clusterClient.search("select * from linden where catId > 3 source");
if (result.isSuccess()) {
try {
if (10 >= 0) {
Assert.assertEquals(10, result.getHitsSize());
Assert.assertEquals(92, result.getTotalHits());
}
if (null != null) {
if (null.startsWith("{")) {
Assert.assertEquals(null, result.getHits().get(0).getSource());
} else {
String[] ids = null.split(",");
for (int i = 0; i < ids.length; i++) {
Assert.assertEquals(ids[i], result.getHits().get(i).getId());
}
}
}
} catch (Throwable t) {
System.out.println(result);
throw t;
}
} else {
throw new Exception(result.getError());
}
return result;
LindenResult result = clusterClient.search("select * from linden where catId >= 3 source");
if (result.isSuccess()) {
try {
if (10 >= 0) {
Assert.assertEquals(10, result.getHitsSize());
Assert.assertEquals(96, result.getTotalHits());
}
if (null != null) {
if (null.startsWith("{")) {
Assert.assertEquals(null, result.getHits().get(0).getSource());
} else {
String[] ids = null.split(",");
for (int i = 0; i < ids.length; i++) {
Assert.assertEquals(ids[i], result.getHits().get(i).getId());
}
}
}
} catch (Throwable t) {
System.out.println(result);
throw t;
}
} else {
throw new Exception(result.getError());
}
return result;
LindenResult result = clusterClient.search("select * from linden where catId < 3 source");
if (result.isSuccess()) {
try {
if (10 >= 0) {
Assert.assertEquals(10, result.getHitsSize());
Assert.assertEquals(15, result.getTotalHits());
}
if (null != null) {
if (null.startsWith("{")) {
Assert.assertEquals(null, result.getHits().get(0).getSource());
} else {
String[] ids = null.split(",");
for (int i = 0; i < ids.length; i++) {
Assert.assertEquals(ids[i], result.getHits().get(i).getId());
}
}
}
} catch (Throwable t) {
System.out.println(result);
throw t;
}
} else {
throw new Exception(result.getError());
}
return result;
LindenResult result = clusterClient.search("select * from linden where catId between 1 AND 4 source");
if (result.isSuccess()) {
try {
if (10 >= 0) {
Assert.assertEquals(10, result.getHitsSize());
Assert.assertEquals(13, result.getTotalHits());
}
if (null != null) {
if (null.startsWith("{")) {
Assert.assertEquals(null, result.getHits().get(0).getSource());
} else {
String[] ids = null.split(",");
for (int i = 0; i < ids.length; i++) {
Assert.assertEquals(ids[i], result.getHits().get(i).getId());
}
}
}
} catch (Throwable t) {
System.out.println(result);
throw t;
}
} else {
throw new Exception(result.getError());
}
return result;
LindenResult result = clusterClient.search("select * from linden where id <> '4006' source");
if (result.isSuccess()) {
try {
if (10 >= 0) {
Assert.assertEquals(10, result.getHitsSize());
Assert.assertEquals(110, result.getTotalHits());
}
if (null != null) {
if (null.startsWith("{")) {
Assert.assertEquals(null, result.getHits().get(0).getSource());
} else {
String[] ids = null.split(",");
for (int i = 0; i < ids.length; i++) {
Assert.assertEquals(ids[i], result.getHits().get(i).getId());
}
}
}
} catch (Throwable t) {
System.out.println(result);
throw t;
}
} else {
throw new Exception(result.getError());
}
return result;
}
|
<DeepExtract>
LindenResult result = clusterClient.search("select * from linden where catId = 4 source");
if (result.isSuccess()) {
try {
if (6 >= 0) {
Assert.assertEquals(6, result.getHitsSize());
Assert.assertEquals(6, result.getTotalHits());
}
if (null != null) {
if (null.startsWith("{")) {
Assert.assertEquals(null, result.getHits().get(0).getSource());
} else {
String[] ids = null.split(",");
for (int i = 0; i < ids.length; i++) {
Assert.assertEquals(ids[i], result.getHits().get(i).getId());
}
}
}
} catch (Throwable t) {
System.out.println(result);
throw t;
}
} else {
throw new Exception(result.getError());
}
return result;
</DeepExtract>
<DeepExtract>
LindenResult result = clusterClient.search("select * from linden where catId > 3 limit 0,12 source");
if (result.isSuccess()) {
try {
if (12 >= 0) {
Assert.assertEquals(12, result.getHitsSize());
Assert.assertEquals(92, result.getTotalHits());
}
if (null != null) {
if (null.startsWith("{")) {
Assert.assertEquals(null, result.getHits().get(0).getSource());
} else {
String[] ids = null.split(",");
for (int i = 0; i < ids.length; i++) {
Assert.assertEquals(ids[i], result.getHits().get(i).getId());
}
}
}
} catch (Throwable t) {
System.out.println(result);
throw t;
}
} else {
throw new Exception(result.getError());
}
return result;
</DeepExtract>
<DeepExtract>
LindenResult result = clusterClient.search("select * from linden where catId > 3 source");
if (result.isSuccess()) {
try {
if (10 >= 0) {
Assert.assertEquals(10, result.getHitsSize());
Assert.assertEquals(92, result.getTotalHits());
}
if (null != null) {
if (null.startsWith("{")) {
Assert.assertEquals(null, result.getHits().get(0).getSource());
} else {
String[] ids = null.split(",");
for (int i = 0; i < ids.length; i++) {
Assert.assertEquals(ids[i], result.getHits().get(i).getId());
}
}
}
} catch (Throwable t) {
System.out.println(result);
throw t;
}
} else {
throw new Exception(result.getError());
}
return result;
</DeepExtract>
<DeepExtract>
LindenResult result = clusterClient.search("select * from linden where catId >= 3 source");
if (result.isSuccess()) {
try {
if (10 >= 0) {
Assert.assertEquals(10, result.getHitsSize());
Assert.assertEquals(96, result.getTotalHits());
}
if (null != null) {
if (null.startsWith("{")) {
Assert.assertEquals(null, result.getHits().get(0).getSource());
} else {
String[] ids = null.split(",");
for (int i = 0; i < ids.length; i++) {
Assert.assertEquals(ids[i], result.getHits().get(i).getId());
}
}
}
} catch (Throwable t) {
System.out.println(result);
throw t;
}
} else {
throw new Exception(result.getError());
}
return result;
</DeepExtract>
<DeepExtract>
LindenResult result = clusterClient.search("select * from linden where catId < 3 source");
if (result.isSuccess()) {
try {
if (10 >= 0) {
Assert.assertEquals(10, result.getHitsSize());
Assert.assertEquals(15, result.getTotalHits());
}
if (null != null) {
if (null.startsWith("{")) {
Assert.assertEquals(null, result.getHits().get(0).getSource());
} else {
String[] ids = null.split(",");
for (int i = 0; i < ids.length; i++) {
Assert.assertEquals(ids[i], result.getHits().get(i).getId());
}
}
}
} catch (Throwable t) {
System.out.println(result);
throw t;
}
} else {
throw new Exception(result.getError());
}
return result;
</DeepExtract>
<DeepExtract>
LindenResult result = clusterClient.search("select * from linden where catId between 1 AND 4 source");
if (result.isSuccess()) {
try {
if (10 >= 0) {
Assert.assertEquals(10, result.getHitsSize());
Assert.assertEquals(13, result.getTotalHits());
}
if (null != null) {
if (null.startsWith("{")) {
Assert.assertEquals(null, result.getHits().get(0).getSource());
} else {
String[] ids = null.split(",");
for (int i = 0; i < ids.length; i++) {
Assert.assertEquals(ids[i], result.getHits().get(i).getId());
}
}
}
} catch (Throwable t) {
System.out.println(result);
throw t;
}
} else {
throw new Exception(result.getError());
}
return result;
</DeepExtract>
<DeepExtract>
LindenResult result = clusterClient.search("select * from linden where id <> '4006' source");
if (result.isSuccess()) {
try {
if (10 >= 0) {
Assert.assertEquals(10, result.getHitsSize());
Assert.assertEquals(110, result.getTotalHits());
}
if (null != null) {
if (null.startsWith("{")) {
Assert.assertEquals(null, result.getHits().get(0).getSource());
} else {
String[] ids = null.split(",");
for (int i = 0; i < ids.length; i++) {
Assert.assertEquals(ids[i], result.getHits().get(i).getId());
}
}
}
} catch (Throwable t) {
System.out.println(result);
throw t;
}
} else {
throw new Exception(result.getError());
}
return result;
</DeepExtract>
|
linden
|
positive
|
@Override
public void onLoadShowTimesTaskCallBack(List<Theater> result) {
movie = null;
super.onPostExecute(result);
if (callBack != null) {
if (erreurReseau)
callBack.onErreurReseau();
else {
if (movie != null) {
new LoadShowTimesTask(this, true).execute(movie, result);
} else {
try {
callBack.onSearchTheatersTaskCallBack(result);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
}
|
<DeepExtract>
super.onPostExecute(result);
if (callBack != null) {
if (erreurReseau)
callBack.onErreurReseau();
else {
if (movie != null) {
new LoadShowTimesTask(this, true).execute(movie, result);
} else {
try {
callBack.onSearchTheatersTaskCallBack(result);
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
</DeepExtract>
|
OCiney
|
positive
|
private int uploadBuffer(Buffer buffer, int elementSize) {
mGLId.glGenBuffers(1, mTempIntArray, 0);
int error = GLES20.glGetError();
if (error != 0) {
Throwable t = new Throwable();
Log.e(TAG, "GL error: " + error, t);
}
int bufferId = mTempIntArray[0];
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, bufferId);
int error = GLES20.glGetError();
if (error != 0) {
Throwable t = new Throwable();
Log.e(TAG, "GL error: " + error, t);
}
GLES20.glBufferData(GLES20.GL_ARRAY_BUFFER, buffer.capacity() * elementSize, buffer, GLES20.GL_STATIC_DRAW);
int error = GLES20.glGetError();
if (error != 0) {
Throwable t = new Throwable();
Log.e(TAG, "GL error: " + error, t);
}
return bufferId;
}
|
<DeepExtract>
int error = GLES20.glGetError();
if (error != 0) {
Throwable t = new Throwable();
Log.e(TAG, "GL error: " + error, t);
}
</DeepExtract>
<DeepExtract>
int error = GLES20.glGetError();
if (error != 0) {
Throwable t = new Throwable();
Log.e(TAG, "GL error: " + error, t);
}
</DeepExtract>
<DeepExtract>
int error = GLES20.glGetError();
if (error != 0) {
Throwable t = new Throwable();
Log.e(TAG, "GL error: " + error, t);
}
</DeepExtract>
|
android-openGL-canvas
|
positive
|
public int length() {
byte[] btarray = new byte[] { packetInBytes[0], packetInBytes[0 + 1], packetInBytes[0 + 2], packetInBytes[0 + 3] };
return java.nio.ByteBuffer.wrap(btarray).getInt();
}
|
<DeepExtract>
byte[] btarray = new byte[] { packetInBytes[0], packetInBytes[0 + 1], packetInBytes[0 + 2], packetInBytes[0 + 3] };
return java.nio.ByteBuffer.wrap(btarray).getInt();
</DeepExtract>
|
G-Earth
|
positive
|
public void change(int i, T newItem) {
assert !contain(i);
i += 1;
data[i] = newItem;
while (reverse[i] > 1 && data[indexs[reverse[i] / 2]].compareTo(data[indexs[reverse[i]]]) < 0) {
swapIndexs(reverse[i], reverse[i] / 2);
reverse[i] = reverse[i] / 2;
}
while (2 * reverse[i] < size) {
int left = 2 * reverse[i];
if (left + 1 < size && data[indexs[left + 1]].compareTo(data[indexs[left]]) > 0) {
left++;
}
if (data[indexs[reverse[i]]].compareTo(data[indexs[left]]) >= 0) {
break;
}
swapIndexs(reverse[i], left);
reverse[i] = left;
}
}
|
<DeepExtract>
while (reverse[i] > 1 && data[indexs[reverse[i] / 2]].compareTo(data[indexs[reverse[i]]]) < 0) {
swapIndexs(reverse[i], reverse[i] / 2);
reverse[i] = reverse[i] / 2;
}
</DeepExtract>
<DeepExtract>
while (2 * reverse[i] < size) {
int left = 2 * reverse[i];
if (left + 1 < size && data[indexs[left + 1]].compareTo(data[indexs[left]]) > 0) {
left++;
}
if (data[indexs[reverse[i]]].compareTo(data[indexs[left]]) >= 0) {
break;
}
swapIndexs(reverse[i], left);
reverse[i] = left;
}
</DeepExtract>
|
ExerciseJava
|
positive
|
public Criteria andOpportunityTypeNotEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "opportunityType" + " cannot be null");
}
criteria.add(new Criterion("opportunity_type <>", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "opportunityType" + " cannot be null");
}
criteria.add(new Criterion("opportunity_type <>", value));
</DeepExtract>
|
CRM
|
positive
|
private static void payResult(int ret, String msg) {
IAPWrapper.onPayResult(mAdapter, ret, msg);
if (bDebug) {
Log.d(LOG_TAG, "IAPOnlineUC result : " + ret + " msg : " + msg);
}
}
|
<DeepExtract>
if (bDebug) {
Log.d(LOG_TAG, "IAPOnlineUC result : " + ret + " msg : " + msg);
}
</DeepExtract>
|
HelloRuby
|
positive
|
@OnlyIn(Dist.CLIENT)
public void fullRender(CodexGui gui, MatrixStack mStack, int x, int y, int mouseX, int mouseY) {
Minecraft.getInstance().getTextureManager().bindTexture(bg);
Minecraft.getInstance().getTextureManager().bindTexture(bg);
gui.blit(mStack, x, y, 0, 0, 128, 160);
}
|
<DeepExtract>
Minecraft.getInstance().getTextureManager().bindTexture(bg);
gui.blit(mStack, x, y, 0, 0, 128, 160);
</DeepExtract>
<DeepExtract>
</DeepExtract>
<DeepExtract>
</DeepExtract>
|
eidolon
|
positive
|
public void run() {
m_active = true;
try {
routine();
} catch (AutoModeEndedException e) {
System.out.println("Auto mode done, ended early");
return;
}
System.out.println("Auto mode done");
}
|
<DeepExtract>
</DeepExtract>
|
2019DeepSpace
|
positive
|
public final CC wrap() {
wrap = true ? (wrap == null ? DEF_GAP : wrap) : null;
return this;
}
|
<DeepExtract>
wrap = true ? (wrap == null ? DEF_GAP : wrap) : null;
</DeepExtract>
|
miglayout
|
positive
|
public void removeLightFromTaggedLightCollection(LFXLight light, LFXTaggedLightCollection taggedLightCollection) {
LFXDeviceMapping deviceMapping = routingTable.getDeviceMappingForDeviceID(light.getDeviceID());
LFXSiteID siteID = deviceMapping.getSiteID();
ArrayList<LFXTagMapping> mappings = routingTable.getTagMappingsForSiteIDAndTag(siteID, taggedLightCollection.getTag());
if (mappings.size() == 0) {
return;
}
LFXTagMapping tagMapping = mappings.get(0);
if (tagMapping == null) {
return;
}
LFXMessage setTags = LFXMessage.messageWithTypeAndPath(Type.LX_PROTOCOL_DEVICE_SET_TAGS, LFXBinaryPath.getBroadcastBinaryPathWithSiteID(tagMapping.getSiteID()));
Object padding = new Object();
UInt64 tags = new UInt64(LFXByteUtils.bitwiseAndByteArrays(deviceMapping.getTagField().tagData, LFXByteUtils.inverseByteArrayBits(tagMapping.getTagField().tagData)));
LxProtocolDevice.SetTags payload = new SetTags(padding, tags);
setTags.setPayload(payload);
if (setTags.getTarget() != null) {
for (LFXBinaryPath aBinaryPath : routingTable.getBinaryPathsForTarget(setTags.getTarget())) {
LFXMessage newMessage = (LFXMessage) setTags.clone();
newMessage.setPath(aBinaryPath);
transportManager.sendMessage(newMessage);
}
} else {
transportManager.sendMessage(setTags);
}
}
|
<DeepExtract>
if (setTags.getTarget() != null) {
for (LFXBinaryPath aBinaryPath : routingTable.getBinaryPathsForTarget(setTags.getTarget())) {
LFXMessage newMessage = (LFXMessage) setTags.clone();
newMessage.setPath(aBinaryPath);
transportManager.sendMessage(newMessage);
}
} else {
transportManager.sendMessage(setTags);
}
</DeepExtract>
|
MoodSync
|
positive
|
public void setData(Collection<OnlineModule> modules) {
if (modules == null)
return;
runOnUiThread(() -> {
if (null != null)
showList = null;
this.isLoaded = false;
notifyDataSetChanged();
});
channel = App.getPreferences().getString("update_channel", channels[0]);
int sort = App.getPreferences().getInt("repo_sort", 0);
boolean upgradableFirst = App.getPreferences().getBoolean("upgradable_first", true);
ConcurrentHashMap<String, Boolean> upgradable = new ConcurrentHashMap<>();
fullList = modules.parallelStream().filter((onlineModule -> !onlineModule.isHide() && !(repoLoader.getReleases(onlineModule.getName()) != null && repoLoader.getReleases(onlineModule.getName()).isEmpty()))).sorted((a, b) -> {
if (upgradableFirst) {
var aUpgrade = upgradable.computeIfAbsent(a.getName(), n -> getUpgradableVer(a) != null);
var bUpgrade = upgradable.computeIfAbsent(b.getName(), n -> getUpgradableVer(b) != null);
if (aUpgrade && !bUpgrade)
return -1;
else if (!aUpgrade && bUpgrade)
return 1;
}
if (sort == 0) {
return labelComparator.compare(a.getDescription(), b.getDescription());
} else {
return Instant.parse(repoLoader.getLatestReleaseTime(b.getName(), channel)).compareTo(Instant.parse(repoLoader.getLatestReleaseTime(a.getName(), channel)));
}
}).collect(Collectors.toList());
String queryStr = searchView != null ? searchView.getQuery().toString() : "";
runOnUiThread(() -> getFilter().filter(queryStr));
}
|
<DeepExtract>
runOnUiThread(() -> {
if (null != null)
showList = null;
this.isLoaded = false;
notifyDataSetChanged();
});
</DeepExtract>
|
LSPosed
|
positive
|
public void start() throws Exception {
XxlJobFileAppender.initLogPath(logPath);
serializer = Serializer.SerializeEnum.HESSIAN.getSerializer();
if (adminAddresses != null && adminAddresses.trim().length() > 0) {
for (String address : adminAddresses.trim().split(",")) {
if (address != null && address.trim().length() > 0) {
String addressUrl = address.concat(AdminBiz.MAPPING);
AdminBiz adminBiz = (AdminBiz) new XxlRpcReferenceBean(NetEnum.NETTY_HTTP, serializer, CallType.SYNC, LoadBalance.ROUND, AdminBiz.class, null, 10000, addressUrl, accessToken, null, null).getObject();
if (adminBizList == null) {
adminBizList = new ArrayList<AdminBiz>();
}
adminBizList.add(adminBiz);
}
}
}
JobLogFileCleanThread.getInstance().start(logRetentionDays);
TriggerCallbackThread.getInstance().start();
port = port > 0 ? port : NetUtil.findAvailablePort(9999);
ip = (ip != null && ip.trim().length() > 0) ? ip : IpUtil.getIp();
String address = IpUtil.getIpPort(ip, port);
Map<String, String> serviceRegistryParam = new HashMap<String, String>();
serviceRegistryParam.put("appName", appName);
serviceRegistryParam.put("address", address);
xxlRpcProviderFactory = new XxlRpcProviderFactory();
xxlRpcProviderFactory.initConfig(NetEnum.NETTY_HTTP, Serializer.SerializeEnum.HESSIAN.getSerializer(), ip, port, accessToken, ExecutorServiceRegistry.class, serviceRegistryParam);
xxlRpcProviderFactory.addService(ExecutorBiz.class.getName(), null, new ExecutorBizImpl());
xxlRpcProviderFactory.start();
}
|
<DeepExtract>
serializer = Serializer.SerializeEnum.HESSIAN.getSerializer();
if (adminAddresses != null && adminAddresses.trim().length() > 0) {
for (String address : adminAddresses.trim().split(",")) {
if (address != null && address.trim().length() > 0) {
String addressUrl = address.concat(AdminBiz.MAPPING);
AdminBiz adminBiz = (AdminBiz) new XxlRpcReferenceBean(NetEnum.NETTY_HTTP, serializer, CallType.SYNC, LoadBalance.ROUND, AdminBiz.class, null, 10000, addressUrl, accessToken, null, null).getObject();
if (adminBizList == null) {
adminBizList = new ArrayList<AdminBiz>();
}
adminBizList.add(adminBiz);
}
}
}
</DeepExtract>
<DeepExtract>
String address = IpUtil.getIpPort(ip, port);
Map<String, String> serviceRegistryParam = new HashMap<String, String>();
serviceRegistryParam.put("appName", appName);
serviceRegistryParam.put("address", address);
xxlRpcProviderFactory = new XxlRpcProviderFactory();
xxlRpcProviderFactory.initConfig(NetEnum.NETTY_HTTP, Serializer.SerializeEnum.HESSIAN.getSerializer(), ip, port, accessToken, ExecutorServiceRegistry.class, serviceRegistryParam);
xxlRpcProviderFactory.addService(ExecutorBiz.class.getName(), null, new ExecutorBizImpl());
xxlRpcProviderFactory.start();
</DeepExtract>
|
taodong-shop
|
positive
|
public void child(@Nullable String project, @Nullable String child) {
getChildren().addAll(entriesToRuns(new MapEntry(project, child)).collect(Collectors.toList()));
}
|
<DeepExtract>
getChildren().addAll(entriesToRuns(new MapEntry(project, child)).collect(Collectors.toList()));
</DeepExtract>
|
ForgeGradleCN
|
positive
|
@Test
public void testSet() {
var bos = new ByteArrayOutputStream();
var out = new PrintStream(bos);
interpretAndRun(UserOptions.ofTest(), loadSourceCodeFromResource("set.bas"), out, env);
out.close();
assertEquals(loadOutputFromResource("set.bas.output"), new String(bos.toByteArray()));
}
|
<DeepExtract>
var bos = new ByteArrayOutputStream();
var out = new PrintStream(bos);
interpretAndRun(UserOptions.ofTest(), loadSourceCodeFromResource("set.bas"), out, env);
out.close();
assertEquals(loadOutputFromResource("set.bas.output"), new String(bos.toByteArray()));
</DeepExtract>
|
PuffinBASIC
|
positive
|
void eval() {
}
|
<DeepExtract>
</DeepExtract>
|
AndroidPDFViewerLibrary
|
positive
|
@Test
public void shouldGenerateAcrossReducedMaxRange() {
Set<Long> generated = new HashSet<>(generateLongValues(testee, prng -> prng.nextLong(Long.MIN_VALUE, Long.MAX_VALUE - 2), 1000));
org.assertj.core.api.Assertions.assertThat(generated.size()).isGreaterThanOrEqualTo(1000);
}
|
<DeepExtract>
Set<Long> generated = new HashSet<>(generateLongValues(testee, prng -> prng.nextLong(Long.MIN_VALUE, Long.MAX_VALUE - 2), 1000));
org.assertj.core.api.Assertions.assertThat(generated.size()).isGreaterThanOrEqualTo(1000);
</DeepExtract>
|
QuickTheories
|
positive
|
public Token reverse() {
if (op.reverse() == Type.NOT_EQUALS && "0".equals(right.toString())) {
return left;
}
return new Operation(left, op.reverse(), right);
}
|
<DeepExtract>
if (op.reverse() == Type.NOT_EQUALS && "0".equals(right.toString())) {
return left;
}
return new Operation(left, op.reverse(), right);
</DeepExtract>
|
iciql
|
positive
|
private void computeNormalAndCentroid(double minArea) {
computeNormal(normal);
if (area < minArea) {
HalfEdge hedgeMax = null;
double lenSqrMax = 0;
HalfEdge hedge = he0;
do {
double lenSqr = hedge.lengthSquared();
if (lenSqr > lenSqrMax) {
hedgeMax = hedge;
lenSqrMax = lenSqr;
}
hedge = hedge.next;
} while (hedge != he0);
Point3d p2 = hedgeMax.head().pnt;
Point3d p1 = hedgeMax.tail().pnt;
double lenMax = Math.sqrt(lenSqrMax);
double ux = (p2.x - p1.x) / lenMax;
double uy = (p2.y - p1.y) / lenMax;
double uz = (p2.z - p1.z) / lenMax;
double dot = normal.x * ux + normal.y * uy + normal.z * uz;
normal.x -= dot * ux;
normal.y -= dot * uy;
normal.z -= dot * uz;
normal.normalize();
}
centroid.setZero();
HalfEdge he = he0;
do {
centroid.add(he.head().pnt);
he = he.next;
} while (he != he0);
centroid.scale(1 / (double) numVerts);
planeOffset = normal.dot(centroid);
}
|
<DeepExtract>
computeNormal(normal);
if (area < minArea) {
HalfEdge hedgeMax = null;
double lenSqrMax = 0;
HalfEdge hedge = he0;
do {
double lenSqr = hedge.lengthSquared();
if (lenSqr > lenSqrMax) {
hedgeMax = hedge;
lenSqrMax = lenSqr;
}
hedge = hedge.next;
} while (hedge != he0);
Point3d p2 = hedgeMax.head().pnt;
Point3d p1 = hedgeMax.tail().pnt;
double lenMax = Math.sqrt(lenSqrMax);
double ux = (p2.x - p1.x) / lenMax;
double uy = (p2.y - p1.y) / lenMax;
double uz = (p2.z - p1.z) / lenMax;
double dot = normal.x * ux + normal.y * uy + normal.z * uz;
normal.x -= dot * ux;
normal.y -= dot * uy;
normal.z -= dot * uz;
normal.normalize();
}
</DeepExtract>
<DeepExtract>
centroid.setZero();
HalfEdge he = he0;
do {
centroid.add(he.head().pnt);
he = he.next;
} while (he != he0);
centroid.scale(1 / (double) numVerts);
</DeepExtract>
|
JCSG
|
positive
|
public static ElementProperty isDescendantOf(Path path) {
return new ElementProperty() {
@Override
public String toXpath() {
return getRelationXpath(path, "ancestor");
}
public String toString() {
return "has ancestor: " + rValueToString(path);
}
};
}
|
<DeepExtract>
return new ElementProperty() {
@Override
public String toXpath() {
return getRelationXpath(path, "ancestor");
}
public String toString() {
return "has ancestor: " + rValueToString(path);
}
};
</DeepExtract>
|
dollarx
|
positive
|
public Criteria andProduct_idLessThanOrEqualTo(Integer value) {
if (value == null) {
throw new RuntimeException("Value for " + "product_id" + " cannot be null");
}
criteria.add(new Criterion("product_id <=", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "product_id" + " cannot be null");
}
criteria.add(new Criterion("product_id <=", value));
</DeepExtract>
|
Tmall_SSM-master
|
positive
|
@Override
public void startPlay(String path, long seekTime, float speed) {
this.path = path;
this.seekTime = seekTime;
this.speed = speed;
isInitStart = true;
currentState = STATE_LOAD;
mPlayerStateCallback.setPlayerState(currentState);
mainHandler.post(new Runnable() {
@Override
public void run() {
if (mediaListenerEvent != null)
mediaListenerEvent.eventPlayInit(true);
}
});
if (isAttached) {
theadsHandler.obtainMessage(INIT_START).sendToTarget();
} else {
isSufaceDelayerPlay = true;
}
}
|
<DeepExtract>
currentState = STATE_LOAD;
mPlayerStateCallback.setPlayerState(currentState);
</DeepExtract>
|
VlcVideoView
|
positive
|
public void doGet(HttpServletRequest req, HttpServletResponse res) throws IOException {
res.setContentType("text/plain");
res.setHeader("X-Test-Header", "test header");
res.setHeader("X-Test-Count", String.valueOf(++count));
res.getWriter().println("Hello, World!");
}
|
<DeepExtract>
res.setContentType("text/plain");
res.setHeader("X-Test-Header", "test header");
res.setHeader("X-Test-Count", String.valueOf(++count));
res.getWriter().println("Hello, World!");
</DeepExtract>
|
appengine-java-vm-runtime
|
positive
|
private void init() {
setBorder(NimbusFocusBorder.getRectangle());
putClientProperty("insets", getInsets());
setFocusable(true);
addFocusListener(this);
addMouseListener(new MouseAdapter() {
public void mousePressed(MouseEvent e) {
if (isFocusable() && isEnabled())
requestFocus();
}
});
shouldPaintBg = true;
super.setBackground(new Color(0, 0, 0, 0));
setOpaque(!clear);
}
|
<DeepExtract>
shouldPaintBg = true;
super.setBackground(new Color(0, 0, 0, 0));
</DeepExtract>
|
SwingOSC
|
positive
|
public void relationalSave() {
log.debug("in get all relations.");
for (Npc n : (List<Npc>) (List<?>) npcRelation.getList()) {
log.debug("\t" + n.getID());
}
god.setNpcs(new ArrayList<Npc>((List<Npc>) (List<?>) npcRelation.getList()));
god.setInteractions(new ArrayList<Interaction>((List<Interaction>) (List<?>) interactionController.getAllInteractions()));
god.setRegions(new ArrayList<Region>((List<Region>) (List<?>) regionRelation.getList()));
god.setEvents(new ArrayList<com.forj.fwm.entity.Event>((List<com.forj.fwm.entity.Event>) (List<?>) eventRelation.getList()));
god.setTemplates(new ArrayList<Template>((List<Template>) (List<?>) templateRelation.getList()));
if (tabHead.getText() != null && !tabHead.getText().equals("")) {
} else {
log.debug("can't save, no name");
App.getMainController().addStatus("Unable to save without a name.");
return;
}
try {
Backend.getGodDao().saveRelationalGod(god);
log.debug("Save successfull!");
log.debug("god id: " + god.getID());
App.getMainController().addStatus("Successfully saved God relations" + god.getName() + " ID: " + god.getID());
} catch (SQLException e) {
log.error(e);
e.printStackTrace();
}
}
|
<DeepExtract>
log.debug("in get all relations.");
for (Npc n : (List<Npc>) (List<?>) npcRelation.getList()) {
log.debug("\t" + n.getID());
}
god.setNpcs(new ArrayList<Npc>((List<Npc>) (List<?>) npcRelation.getList()));
god.setInteractions(new ArrayList<Interaction>((List<Interaction>) (List<?>) interactionController.getAllInteractions()));
god.setRegions(new ArrayList<Region>((List<Region>) (List<?>) regionRelation.getList()));
god.setEvents(new ArrayList<com.forj.fwm.entity.Event>((List<com.forj.fwm.entity.Event>) (List<?>) eventRelation.getList()));
god.setTemplates(new ArrayList<Template>((List<Template>) (List<?>) templateRelation.getList()));
</DeepExtract>
|
fwm
|
positive
|
@Override
public void onMailClicked(String mail) {
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:" + mail));
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, getString(R.string.send_mail_error), Toast.LENGTH_SHORT).show();
}
}
|
<DeepExtract>
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setData(Uri.parse("mailto:" + mail));
try {
startActivity(intent);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, getString(R.string.send_mail_error), Toast.LENGTH_SHORT).show();
}
</DeepExtract>
|
leafpicrevived
|
positive
|
@Override
public Long value2() {
return (Long) getValue(1);
}
|
<DeepExtract>
return (Long) getValue(1);
</DeepExtract>
|
BlocklyProp
|
positive
|
public Criteria andNameLessThan(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "name" + " cannot be null");
}
criteria.add(new Criterion("name <", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "name" + " cannot be null");
}
criteria.add(new Criterion("name <", value));
</DeepExtract>
|
Gotrip
|
positive
|
@Override
public <T> T get(Object key, Callable<T> valueLoader) {
try {
value = valueLoader.call();
} catch (Exception ex) {
throw new ValueRetrievalException(key, valueLoader, ex);
}
cacheChannel.set(j2CacheName, String.valueOf(key), value, super.isAllowNullValues());
return value;
}
|
<DeepExtract>
cacheChannel.set(j2CacheName, String.valueOf(key), value, super.isAllowNullValues());
</DeepExtract>
|
spring-tutorial
|
positive
|
public void mouseEntered(java.awt.event.MouseEvent evt) {
jPanel4.setBackground(new Color(153, 102, 255));
}
|
<DeepExtract>
jPanel4.setBackground(new Color(153, 102, 255));
</DeepExtract>
|
vehler
|
positive
|
public void fullImport(String entity) {
SolrQuery query = new SolrQuery();
query.setRequestHandler("/dataimport");
String command = false ? "delta-import" : "full-import";
String clean = false ? "false" : "true";
String optimize = false ? "false" : "true";
query.setParam("command", command).setParam("clean", clean).setParam("commit", "true").setParam("entity", entity).setParam("optimize", optimize);
try {
solrClient.query(this.defaultCore, query, SolrRequest.METHOD.GET);
} catch (Exception e) {
log.error(command + "occurs an exception[core:" + this.defaultCore + "]:", e);
}
}
|
<DeepExtract>
SolrQuery query = new SolrQuery();
query.setRequestHandler("/dataimport");
String command = false ? "delta-import" : "full-import";
String clean = false ? "false" : "true";
String optimize = false ? "false" : "true";
query.setParam("command", command).setParam("clean", clean).setParam("commit", "true").setParam("entity", entity).setParam("optimize", optimize);
try {
solrClient.query(this.defaultCore, query, SolrRequest.METHOD.GET);
} catch (Exception e) {
log.error(command + "occurs an exception[core:" + this.defaultCore + "]:", e);
}
</DeepExtract>
|
solr-book
|
positive
|
@Override
public OAuth2Authentication extractAuthentication(Map<String, ?> tokenMap) {
final Map<String, Object> details = new HashMap<>();
if (tokenMap.containsKey(AUTH_TENANT_KEY)) {
details.put(AUTH_TENANT_KEY, tokenMap.get(AUTH_TENANT_KEY));
}
if (tokenMap.containsKey(AUTH_USER_KEY)) {
details.put(AUTH_USER_KEY, tokenMap.get(AUTH_USER_KEY));
}
if (tokenMap.containsKey(CREATE_TOKEN_TIME)) {
details.put(CREATE_TOKEN_TIME, tokenMap.get(CREATE_TOKEN_TIME));
}
if (tokenMap.containsKey(AUTH_ADDITIONAL_DETAILS)) {
details.put(AUTH_ADDITIONAL_DETAILS, tokenMap.get(AUTH_ADDITIONAL_DETAILS));
}
if (tokenMap.containsKey(AUTH_ROLE_KEY)) {
details.put(AUTH_ROLE_KEY, tokenMap.get(AUTH_ROLE_KEY));
}
if (tokenMap.containsKey(TOKEN_AUTH_DETAILS_TFA_VERIFICATION_OTP_KEY)) {
details.put(TOKEN_AUTH_DETAILS_TFA_VERIFICATION_OTP_KEY, tokenMap.get(TOKEN_AUTH_DETAILS_TFA_VERIFICATION_OTP_KEY));
}
if (tokenMap.containsKey(TOKEN_AUTH_DETAILS_TFA_OTP_CHANNEL_TYPE)) {
details.put(TOKEN_AUTH_DETAILS_TFA_OTP_CHANNEL_TYPE, tokenMap.get(TOKEN_AUTH_DETAILS_TFA_OTP_CHANNEL_TYPE));
}
if (tokenMap.containsKey(AUTH_LOGINS_KEY)) {
details.put(AUTH_LOGINS_KEY, tokenMap.get(AUTH_LOGINS_KEY));
}
final OAuth2Authentication authentication = super.extractAuthentication(tokenMap);
authentication.setDetails(details);
return authentication;
}
|
<DeepExtract>
if (tokenMap.containsKey(AUTH_TENANT_KEY)) {
details.put(AUTH_TENANT_KEY, tokenMap.get(AUTH_TENANT_KEY));
}
</DeepExtract>
<DeepExtract>
if (tokenMap.containsKey(AUTH_USER_KEY)) {
details.put(AUTH_USER_KEY, tokenMap.get(AUTH_USER_KEY));
}
</DeepExtract>
<DeepExtract>
if (tokenMap.containsKey(CREATE_TOKEN_TIME)) {
details.put(CREATE_TOKEN_TIME, tokenMap.get(CREATE_TOKEN_TIME));
}
</DeepExtract>
<DeepExtract>
if (tokenMap.containsKey(AUTH_ADDITIONAL_DETAILS)) {
details.put(AUTH_ADDITIONAL_DETAILS, tokenMap.get(AUTH_ADDITIONAL_DETAILS));
}
</DeepExtract>
<DeepExtract>
if (tokenMap.containsKey(AUTH_ROLE_KEY)) {
details.put(AUTH_ROLE_KEY, tokenMap.get(AUTH_ROLE_KEY));
}
</DeepExtract>
<DeepExtract>
if (tokenMap.containsKey(TOKEN_AUTH_DETAILS_TFA_VERIFICATION_OTP_KEY)) {
details.put(TOKEN_AUTH_DETAILS_TFA_VERIFICATION_OTP_KEY, tokenMap.get(TOKEN_AUTH_DETAILS_TFA_VERIFICATION_OTP_KEY));
}
</DeepExtract>
<DeepExtract>
if (tokenMap.containsKey(TOKEN_AUTH_DETAILS_TFA_OTP_CHANNEL_TYPE)) {
details.put(TOKEN_AUTH_DETAILS_TFA_OTP_CHANNEL_TYPE, tokenMap.get(TOKEN_AUTH_DETAILS_TFA_OTP_CHANNEL_TYPE));
}
</DeepExtract>
<DeepExtract>
if (tokenMap.containsKey(AUTH_LOGINS_KEY)) {
details.put(AUTH_LOGINS_KEY, tokenMap.get(AUTH_LOGINS_KEY));
}
</DeepExtract>
|
xm-uaa
|
positive
|
@RepeatedTest(2)
public void syncModeWithRacingAndCancellationTest() throws InterruptedException {
final CountDownLatch cancellationLatch = new CountDownLatch(1);
List<Integer> integers = Flowable.range(0, 100000).toList().blockingGet();
final CountDownLatch startedLatch = new CountDownLatch(1);
final TestSubscriberProducer<Integer> producer = Flowable.fromIterable(new SlowingIterable<Integer>(integers)).subscribeWith(new TestSubscriberProducer<Integer>() {
@Override
public void cancel() {
super.cancel();
cancellationLatch.countDown();
}
});
final TestCallStreamObserver<Integer> downstream = new TestCallStreamObserver<Integer>(executorService);
executorService.execute(new Runnable() {
@Override
public void run() {
producer.subscribe(downstream);
startedLatch.countDown();
}
});
startedLatch.await();
Observable.range(0, 100).concatMapCompletable(new Function<Integer, CompletableSource>() {
@Override
public CompletableSource apply(Integer i) {
return Completable.fromAction(new Action() {
@Override
public void run() {
downstream.resume();
}
}).subscribeOn(Schedulers.computation()).andThen(Completable.fromAction(new Action() {
@Override
public void run() {
downstream.pause();
}
}).subscribeOn(Schedulers.computation()));
}
}).blockingAwait();
downstream.pause();
executorService.execute(new Runnable() {
@Override
public void run() {
downstream.resume();
}
});
producer.cancel();
Assertions.assertThat(cancellationLatch.await(1, TimeUnit.MINUTES)).isTrue();
Assertions.assertThat(downstream.done.getCount()).isEqualTo(1);
Assertions.assertThat(downstream.e).isNull();
Assertions.assertThat(producer).hasFieldOrPropertyWithValue("sourceMode", 1);
Assertions.assertThat(downstream.collected).isSubsetOf(integers);
Assertions.assertThat(unhandledThrowable).isEmpty();
}
|
<DeepExtract>
Observable.range(0, 100).concatMapCompletable(new Function<Integer, CompletableSource>() {
@Override
public CompletableSource apply(Integer i) {
return Completable.fromAction(new Action() {
@Override
public void run() {
downstream.resume();
}
}).subscribeOn(Schedulers.computation()).andThen(Completable.fromAction(new Action() {
@Override
public void run() {
downstream.pause();
}
}).subscribeOn(Schedulers.computation()));
}
}).blockingAwait();
downstream.pause();
executorService.execute(new Runnable() {
@Override
public void run() {
downstream.resume();
}
});
</DeepExtract>
|
reactive-grpc
|
positive
|
public void writeInt(int v) throws IOException {
if (buf.length == written) {
writeToOutput(out, false);
}
buf[written] = (byte) (v >>> 24);
written++;
if (buf.length == written) {
writeToOutput(out, false);
}
buf[written] = (byte) (v >>> 16);
written++;
if (buf.length == written) {
writeToOutput(out, false);
}
buf[written] = (byte) (v >>> 8);
written++;
if (buf.length == written) {
writeToOutput(out, false);
}
buf[written] = (byte) v;
written++;
}
|
<DeepExtract>
if (buf.length == written) {
writeToOutput(out, false);
}
buf[written] = (byte) (v >>> 24);
written++;
</DeepExtract>
<DeepExtract>
if (buf.length == written) {
writeToOutput(out, false);
}
buf[written] = (byte) (v >>> 16);
written++;
</DeepExtract>
<DeepExtract>
if (buf.length == written) {
writeToOutput(out, false);
}
buf[written] = (byte) (v >>> 8);
written++;
</DeepExtract>
<DeepExtract>
if (buf.length == written) {
writeToOutput(out, false);
}
buf[written] = (byte) v;
written++;
</DeepExtract>
|
jrpip
|
positive
|
public void onFailure(int messageType, org.apache.http.Header[] headers, byte[] responseBody, Throwable error) {
switch(MessageType.FAILED) {
case REG_SAVED:
if (dataInputListener != null) {
dataInputListener.onData(true);
}
break;
case FAILED:
if (dataInputListener != null) {
dataInputListener.onData(false);
}
break;
default:
break;
}
if (MessageType.FAILED == null) {
return;
}
decodeConfigVariables(null);
switch(MessageType.FAILED) {
case FAILED:
if (serverErrorMsgShownCount++ % 2 == 0)
quizApp.getStaticPopupDialogBoxes().yesOrNo(UiText.SERVER_ERROR.getValue(), UiText.OK.getValue(), UiText.CANCEL.getValue(), null);
break;
case NOT_AUTHORIZED:
quizApp.getStaticPopupDialogBoxes().yesOrNo(UiText.SERVER_ERROR.getValue(), UiText.OK.getValue(), UiText.CANCEL.getValue(), new DataInputListener<Boolean>() {
@Override
public String onData(Boolean s) {
if (s) {
quizApp.getUserDeviceManager().clearUserPreferences();
quizApp.reinit(true);
}
return null;
}
});
default:
break;
}
}
|
<DeepExtract>
switch(MessageType.FAILED) {
case REG_SAVED:
if (dataInputListener != null) {
dataInputListener.onData(true);
}
break;
case FAILED:
if (dataInputListener != null) {
dataInputListener.onData(false);
}
break;
default:
break;
}
</DeepExtract>
<DeepExtract>
if (MessageType.FAILED == null) {
return;
}
decodeConfigVariables(null);
switch(MessageType.FAILED) {
case FAILED:
if (serverErrorMsgShownCount++ % 2 == 0)
quizApp.getStaticPopupDialogBoxes().yesOrNo(UiText.SERVER_ERROR.getValue(), UiText.OK.getValue(), UiText.CANCEL.getValue(), null);
break;
case NOT_AUTHORIZED:
quizApp.getStaticPopupDialogBoxes().yesOrNo(UiText.SERVER_ERROR.getValue(), UiText.OK.getValue(), UiText.CANCEL.getValue(), new DataInputListener<Boolean>() {
@Override
public String onData(Boolean s) {
if (s) {
quizApp.getUserDeviceManager().clearUserPreferences();
quizApp.reinit(true);
}
return null;
}
});
default:
break;
}
</DeepExtract>
|
QuizApp_Android
|
positive
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
colorByMentionsCheckboxActionPerformed(evt);
}
|
<DeepExtract>
colorByMentionsCheckboxActionPerformed(evt);
</DeepExtract>
|
vizlinc
|
positive
|
public double distanceFromOrigin() {
double xyDistance = super.distanceFrom(new Point3d());
int dz = Math.abs(z - new Point3d().getZ());
return Math.sqrt((xyDistance * xyDistance) + (dz * dz));
}
|
<DeepExtract>
double xyDistance = super.distanceFrom(new Point3d());
int dz = Math.abs(z - new Point3d().getZ());
return Math.sqrt((xyDistance * xyDistance) + (dz * dz));
</DeepExtract>
|
masters
|
positive
|
@Override
protected void insertTwitterConnection() {
dataAccessor.update("insert into " + getTablePrefix() + "UserConnection (userId, providerId, providerUserId, rank, displayName, profileUrl, imageUrl, accessToken, secret, refreshToken, expireTime) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", getUserId1(), TWITTER_DATA.getProviderId(), TWITTER_DATA.getProviderUserId(), 1, TWITTER_DATA.getDisplayName(), TWITTER_DATA.getProfileUrl(), TWITTER_DATA.getImageUrl(), TWITTER_DATA.getAccessToken(), TWITTER_DATA.getSecret(), TWITTER_DATA.getRefreshToken(), System.currentTimeMillis() + 3600000);
}
|
<DeepExtract>
dataAccessor.update("insert into " + getTablePrefix() + "UserConnection (userId, providerId, providerUserId, rank, displayName, profileUrl, imageUrl, accessToken, secret, refreshToken, expireTime) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", getUserId1(), TWITTER_DATA.getProviderId(), TWITTER_DATA.getProviderUserId(), 1, TWITTER_DATA.getDisplayName(), TWITTER_DATA.getProfileUrl(), TWITTER_DATA.getImageUrl(), TWITTER_DATA.getAccessToken(), TWITTER_DATA.getSecret(), TWITTER_DATA.getRefreshToken(), System.currentTimeMillis() + 3600000);
</DeepExtract>
|
spring-social
|
positive
|
public JSONWriter value(boolean b) throws JSONException {
if (b ? "true" : "false" == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write(',');
}
this.writer.write(b ? "true" : "false");
} catch (IOException e) {
throw new JSONException(e);
}
if (this.mode == 'o') {
this.mode = 'k';
}
this.comma = true;
return this;
}
throw new JSONException("Value out of sequence.");
}
|
<DeepExtract>
if (b ? "true" : "false" == null) {
throw new JSONException("Null pointer");
}
if (this.mode == 'o' || this.mode == 'a') {
try {
if (this.comma && this.mode == 'a') {
this.writer.write(',');
}
this.writer.write(b ? "true" : "false");
} catch (IOException e) {
throw new JSONException(e);
}
if (this.mode == 'o') {
this.mode = 'k';
}
this.comma = true;
return this;
}
throw new JSONException("Value out of sequence.");
</DeepExtract>
|
HTAPBench
|
positive
|
private void missile1SetResetToPlayer(int res) {
lastObservableChangeClock = clock;
if (repeatLastLine)
repeatLastLine = false;
if (missile1ResetToPlayer = (res & 0x02) != 0)
missile1Enabled = false;
}
|
<DeepExtract>
lastObservableChangeClock = clock;
if (repeatLastLine)
repeatLastLine = false;
</DeepExtract>
|
javatari
|
positive
|
@Override
public ListType next() {
final ListType next = mIterator.next();
mFreetalk = mFreetalk;
mDB = mFreetalk.getDatabase();
return next;
}
|
<DeepExtract>
mFreetalk = mFreetalk;
mDB = mFreetalk.getDatabase();
</DeepExtract>
|
plugin-Freetalk
|
positive
|
@Override
public void readFromNBT(NBTTagCompound nbt) {
super.readFromNBT(nbt);
completeStructure = nbt.getBoolean("completeStructure");
canRender = nbt.getBoolean("canRender");
}
|
<DeepExtract>
</DeepExtract>
|
libVulpes
|
positive
|
public void finishTrack() {
this.finished = true;
}
|
<DeepExtract>
this.finished = true;
</DeepExtract>
|
Data4All
|
positive
|
public static DWProto.KeyDependencySetMsg parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException {
DWProto.DataWrapperMsg result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result).asInvalidProtocolBufferException();
}
return result;
}
|
<DeepExtract>
DWProto.DataWrapperMsg result = buildPartial();
if (!result.isInitialized()) {
throw newUninitializedMessageException(result).asInvalidProtocolBufferException();
}
return result;
</DeepExtract>
|
bolton-sigmod2013-code
|
positive
|
@Override
protected Term function(final Memory memory, final Term[] x) {
if (x.length != 1) {
throw new IllegalStateException("Requires 1 Term argument");
}
final Term content = x[0];
if (!(content instanceof CompoundTerm)) {
return content;
}
final CompoundTerm t = (CompoundTerm) content;
switch(t.operator()) {
case INHERITANCE:
return sop((Inheritance) t, "inheritance");
case SIMILARITY:
return sop((Similarity) t, "similarity");
default:
return sop(t.operator().toString(), t.term);
}
}
|
<DeepExtract>
if (!(content instanceof CompoundTerm)) {
return content;
}
final CompoundTerm t = (CompoundTerm) content;
switch(t.operator()) {
case INHERITANCE:
return sop((Inheritance) t, "inheritance");
case SIMILARITY:
return sop((Similarity) t, "similarity");
default:
return sop(t.operator().toString(), t.term);
}
</DeepExtract>
|
opennars
|
positive
|
public int sendRgbFrame(byte ofs, int[] data, ColorFormat colorFormat, int totalPanels) {
if (data.length != bufferSize) {
throw new IllegalArgumentException("data lenght must be " + bufferSize + " bytes, was " + data.length);
}
int ofsAsInt = ofs;
if (correctionMap.containsKey(ofsAsInt)) {
RGBAdjust correction = correctionMap.get(ofsAsInt);
return sendFrame(ofs, OutputHelper.convertBufferTo15bit(data, colorFormat, correction), totalPanels);
}
byte[] imagePayload = Tpm2NetProtocol.createImagePayload(ofs, totalPanels, OutputHelper.convertBufferTo15bit(data, colorFormat));
if (sendData(imagePayload)) {
return imagePayload.length;
}
lastDataMap.put(ofs, 0L);
return -1;
}
|
<DeepExtract>
byte[] imagePayload = Tpm2NetProtocol.createImagePayload(ofs, totalPanels, OutputHelper.convertBufferTo15bit(data, colorFormat));
if (sendData(imagePayload)) {
return imagePayload.length;
}
lastDataMap.put(ofs, 0L);
return -1;
</DeepExtract>
|
PixelController
|
positive
|
@Test
public void multiArtistRadio() throws EchoNestException {
PlaylistParams p = new PlaylistParams();
p.addArtistID(WEEZER_ID);
p.addArtist("radiohead");
p.setType(PlaylistType.ARTIST_RADIO);
p.setResults(20);
Playlist playlist = en.createStaticPlaylist(p);
assertTrue("playlist length", playlist.getSongs().size() == 20);
if (playlist.getSession() != null) {
System.out.println("Session: " + playlist.getSession());
}
for (Song song : playlist.getSongs()) {
showSong(song);
}
basicChecks(playlist);
}
|
<DeepExtract>
if (playlist.getSession() != null) {
System.out.println("Session: " + playlist.getSession());
}
for (Song song : playlist.getSongs()) {
showSong(song);
}
</DeepExtract>
<DeepExtract>
basicChecks(playlist);
</DeepExtract>
|
jEN
|
positive
|
@Override
public void onRefreshPositionChanged(SmoothRefreshLayout layout, byte status, IIndicator indicator) {
mOffsetX = (getWidth() - mDrawZoneWidth) / 2;
if (mStyle.mStyle != STYLE_SCALE && mStyle.mStyle != STYLE_FOLLOW_SCALE) {
mOffsetY = getTopOffset();
} else {
if (mStyle.mStyle == STYLE_FOLLOW_SCALE && indicator.getCurrentPos() <= getCustomHeight()) {
mOffsetY = getTopOffset();
} else {
mOffsetY = (int) (getTopOffset() + (getHeight() - getCustomHeight()) / 2f);
}
}
mDropHeight = getBottomOffset();
if (status == SmoothRefreshLayout.SR_STATUS_PREPARE || status == SmoothRefreshLayout.SR_STATUS_COMPLETE) {
float currentPercent = Math.min(1f, indicator.getCurrentPercentOfRefreshOffset());
setProgress(currentPercent);
invalidate();
}
}
|
<DeepExtract>
mOffsetX = (getWidth() - mDrawZoneWidth) / 2;
if (mStyle.mStyle != STYLE_SCALE && mStyle.mStyle != STYLE_FOLLOW_SCALE) {
mOffsetY = getTopOffset();
} else {
if (mStyle.mStyle == STYLE_FOLLOW_SCALE && indicator.getCurrentPos() <= getCustomHeight()) {
mOffsetY = getTopOffset();
} else {
mOffsetY = (int) (getTopOffset() + (getHeight() - getCustomHeight()) / 2f);
}
}
mDropHeight = getBottomOffset();
</DeepExtract>
|
SmoothRefreshLayout
|
positive
|
public static void assertNonEmptyList(final Term t) {
if (t.getTermType() == VAR) {
throw new ProlInstantiationErrorException("Grounded value expected: " + t, t);
}
if (t.getTermType() != TermType.LIST) {
throw new ProlTypeErrorException("list", "Expected list: " + t, t);
} else {
if (t == Terms.NULL_LIST) {
throw new ProlDomainErrorException("[]", "Expected non-empty list: " + t, t);
}
}
}
|
<DeepExtract>
if (t.getTermType() == VAR) {
throw new ProlInstantiationErrorException("Grounded value expected: " + t, t);
}
</DeepExtract>
|
jprol
|
positive
|
public Criteria andNegativeProbIsNotNull() {
if ("negative_prob is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("negative_prob is not null"));
return (Criteria) this;
}
|
<DeepExtract>
if ("negative_prob is not null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("negative_prob is not null"));
</DeepExtract>
|
music
|
positive
|
@Override
public void onCreateActivity(@Nullable Bundle savedInstanceState) {
initToolbar(UiUtils.getString(R.string.title_about));
mRepository = new CommonRepository();
mTxtSlogan.setText(UiUtils.getString(R.string.app_name));
mTxtVersion.setText("V".concat(AppUtils.getAppVersionName()));
ProgressUtils.show(mContext);
mRepository.aboutApp(new CommonDataSource.GetAboutAppInfoCallback() {
@Override
public void getSuccess(AboutApp about) {
ProgressUtils.dismiss();
if (about != null) {
mTxtContent.setText(UiUtils.show(about.getContent()));
}
}
@Override
public void getFail(Error e) {
ProgressUtils.dismiss();
}
});
}
|
<DeepExtract>
mTxtSlogan.setText(UiUtils.getString(R.string.app_name));
mTxtVersion.setText("V".concat(AppUtils.getAppVersionName()));
ProgressUtils.show(mContext);
mRepository.aboutApp(new CommonDataSource.GetAboutAppInfoCallback() {
@Override
public void getSuccess(AboutApp about) {
ProgressUtils.dismiss();
if (about != null) {
mTxtContent.setText(UiUtils.show(about.getContent()));
}
}
@Override
public void getFail(Error e) {
ProgressUtils.dismiss();
}
});
</DeepExtract>
|
AccountBook
|
positive
|
public boolean isEnabledSharedCache() {
return Boolean.parseBoolean(pragmaTable.getProperty(Pragma.SHARED_CACHE.pragmaName, "false"));
}
|
<DeepExtract>
return Boolean.parseBoolean(pragmaTable.getProperty(Pragma.SHARED_CACHE.pragmaName, "false"));
</DeepExtract>
|
sqlcipher-jdbc
|
positive
|
@Override
public void onClick(View v) {
Log.d("Call Update Accepted");
if (timer != null) {
timer.cancel();
}
if (callUpdateDialog != null) {
callUpdateDialog.dismissAllowingStateLoss();
}
LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
if (call == null) {
return;
}
LinphoneCallParams params = call.getCurrentParamsCopy();
if (true) {
params.setVideoEnabled(true);
LinphoneManager.getLc().enableVideo(true, true);
}
try {
LinphoneManager.getLc().acceptCallUpdate(call, params);
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
}
|
<DeepExtract>
if (timer != null) {
timer.cancel();
}
if (callUpdateDialog != null) {
callUpdateDialog.dismissAllowingStateLoss();
}
LinphoneCall call = LinphoneManager.getLc().getCurrentCall();
if (call == null) {
return;
}
LinphoneCallParams params = call.getCurrentParamsCopy();
if (true) {
params.setVideoEnabled(true);
LinphoneManager.getLc().enableVideo(true, true);
}
try {
LinphoneManager.getLc().acceptCallUpdate(call, params);
} catch (LinphoneCoreException e) {
e.printStackTrace();
}
</DeepExtract>
|
linphone-android
|
positive
|
public TreeNode subtreeWithAllDeepest(TreeNode root) {
if (root == null)
return root;
result[0] = null;
if (root == null)
return 0;
int l = getNode(root.left, 0 + 1);
int r = getNode(root.right, 0 + 1);
if (l == r && l >= maxDepth) {
maxDepth = l;
result[0] = root;
}
return Math.max(l, r);
return result[0];
}
|
<DeepExtract>
if (root == null)
return 0;
int l = getNode(root.left, 0 + 1);
int r = getNode(root.right, 0 + 1);
if (l == r && l >= maxDepth) {
maxDepth = l;
result[0] = root;
}
return Math.max(l, r);
</DeepExtract>
|
myleetcode
|
positive
|
public static void setTranslucentForImageViewInFragment(Activity activity, @IntRange(from = 0, to = 255) int statusBarAlpha, View needOffsetView) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
setTransparentForWindow(activity);
addTranslucentView(activity, statusBarAlpha);
if (needOffsetView != null) {
Object haveSetOffset = needOffsetView.getTag(TAG_KEY_HAVE_SET_OFFSET);
if (haveSetOffset != null && (Boolean) haveSetOffset) {
return;
}
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams();
layoutParams.setMargins(layoutParams.leftMargin, layoutParams.topMargin + getStatusBarHeight(activity), layoutParams.rightMargin, layoutParams.bottomMargin);
needOffsetView.setTag(TAG_KEY_HAVE_SET_OFFSET, true);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT && Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
clearPreviousSetting(activity);
}
}
|
<DeepExtract>
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
return;
}
setTransparentForWindow(activity);
addTranslucentView(activity, statusBarAlpha);
if (needOffsetView != null) {
Object haveSetOffset = needOffsetView.getTag(TAG_KEY_HAVE_SET_OFFSET);
if (haveSetOffset != null && (Boolean) haveSetOffset) {
return;
}
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) needOffsetView.getLayoutParams();
layoutParams.setMargins(layoutParams.leftMargin, layoutParams.topMargin + getStatusBarHeight(activity), layoutParams.rightMargin, layoutParams.bottomMargin);
needOffsetView.setTag(TAG_KEY_HAVE_SET_OFFSET, true);
}
</DeepExtract>
|
SakuraAnime
|
positive
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.