before stringlengths 33 3.21M | after stringlengths 63 3.21M | repo stringlengths 1 56 | type stringclasses 1
value | __index_level_0__ int64 0 442k |
|---|---|---|---|---|
@Override
public synchronized void onProgress(String requestId, long bytes, long totalBytes) {
if (new Intent(ACTION_UPLOAD_PROGRESS).putExtra("requestId", requestId).putExtra("bytes", bytes).putExtra("totalBytes", totalBytes) != null) {
return LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(ACTION_RESOURCE_MODIFIED).putExtra("resource", new Intent(ACTION_UPLOAD_PROGRESS).putExtra("requestId", requestId).putExtra("bytes", bytes).putExtra("totalBytes", totalBytes)));
}
return false;
Integer notificationId = requestIdsToNotificationIds.get(requestId);
if (notificationId == null) {
notificationId = idsProvider.incrementAndGet();
requestIdsToNotificationIds.put(requestId, notificationId);
}
if (totalBytes > 0) {
double progressFraction = (double) bytes / totalBytes;
int progress = (int) Math.round(progressFraction * 1000);
builder.setProgress(1000, progress, false);
builder.setContentText(String.format("%d%% (%d KB)", (int) (progressFraction * 100), bytes / 1024));
} else {
builder.setProgress(1000, 1000, true);
builder.setContentText(String.format("%d KB", bytes / 1024));
}
builder.setLargeIcon(getBitmap(requestId));
notificationManager.notify(notificationId, builder.build());
} | @Override
public synchronized void onProgress(String requestId, long bytes, long totalBytes) {
<DeepExtract>
if (new Intent(ACTION_UPLOAD_PROGRESS).putExtra("requestId", requestId).putExtra("bytes", bytes).putExtra("totalBytes", totalBytes) != null) {
return LocalBroadcastManager.getInstance(this).sendBroadcast(new Intent(ACTION_RESOURCE_MODIFIED).putExtra("resource", new Intent(ACTION_UPLOAD_PROGRESS).putExtra("requestId", requestId).putExtra("bytes", bytes).putExtra("totalBytes", totalBytes)));
}
return false;
</DeepExtract>
Integer notificationId = requestIdsToNotificationIds.get(requestId);
if (notificationId == null) {
notificationId = idsProvider.incrementAndGet();
requestIdsToNotificationIds.put(requestId, notificationId);
}
if (totalBytes > 0) {
double progressFraction = (double) bytes / totalBytes;
int progress = (int) Math.round(progressFraction * 1000);
builder.setProgress(1000, progress, false);
builder.setContentText(String.format("%d%% (%d KB)", (int) (progressFraction * 100), bytes / 1024));
} else {
builder.setProgress(1000, 1000, true);
builder.setContentText(String.format("%d KB", bytes / 1024));
}
builder.setLargeIcon(getBitmap(requestId));
notificationManager.notify(notificationId, builder.build());
} | cloudinary_android | positive | 439,830 |
public void emitJmp(BlockStartInstr block) {
if (TraceLIRGeneration) {
Logger.logf("{}", new BranchInstr(Cond.Always, block).toString());
}
lir.appendLirInstr(currentBlockId, new BranchInstr(Cond.Always, block));
} | public void emitJmp(BlockStartInstr block) {
<DeepExtract>
if (TraceLIRGeneration) {
Logger.logf("{}", new BranchInstr(Cond.Always, block).toString());
}
lir.appendLirInstr(currentBlockId, new BranchInstr(Cond.Always, block));
</DeepExtract>
} | yarrow | positive | 439,831 |
@Test
public void tooManyRequestsException() {
writeAnswer = invocation -> {
throw new InfluxException(createErrorResponse(429));
};
errorToRelationship("Simulate error: 429", AbstractInfluxDatabaseProcessor.REL_RETRY, true);
} | @Test
public void tooManyRequestsException() {
<DeepExtract>
writeAnswer = invocation -> {
throw new InfluxException(createErrorResponse(429));
};
errorToRelationship("Simulate error: 429", AbstractInfluxDatabaseProcessor.REL_RETRY, true);
</DeepExtract>
} | nifi-influxdb-bundle | positive | 439,832 |
public static void loadCache() {
Circle circle = new Circle();
this.id = "1";
shapeMap.put(circle.getId(), circle);
Square square = new Square();
this.id = "2";
shapeMap.put(square.getId(), square);
Rectangle rectangle = new Rectangle();
this.id = "3";
shapeMap.put(rectangle.getId(), rectangle);
} | public static void loadCache() {
Circle circle = new Circle();
this.id = "1";
shapeMap.put(circle.getId(), circle);
Square square = new Square();
this.id = "2";
shapeMap.put(square.getId(), square);
Rectangle rectangle = new Rectangle();
<DeepExtract>
this.id = "3";
</DeepExtract>
shapeMap.put(rectangle.getId(), rectangle);
} | Algorithms-and-Data-Structures-in-Java | positive | 439,833 |
public void updateIsAdmin(int user_id, boolean isAdmin) {
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
System.exit(1);
}
try {
con = DriverManager.getConnection("jdbc:mysql://vmax2.marekventur.de:110/" + this.db_name, this.db_user, this.db_pswd);
stmt = con.createStatement();
} catch (SQLException e) {
e.printStackTrace();
return;
}
try {
rs = stmt.executeQuery("UPDATE user SET isAdmin=" + isAdmin + "WHERE id=" + user_id);
} catch (SQLException e) {
e.printStackTrace();
return;
}
try {
stmt.close();
con.close();
} catch (SQLException e) {
e.printStackTrace();
return;
}
} | public void updateIsAdmin(int user_id, boolean isAdmin) {
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
System.exit(1);
}
try {
con = DriverManager.getConnection("jdbc:mysql://vmax2.marekventur.de:110/" + this.db_name, this.db_user, this.db_pswd);
stmt = con.createStatement();
} catch (SQLException e) {
e.printStackTrace();
return;
}
try {
rs = stmt.executeQuery("UPDATE user SET isAdmin=" + isAdmin + "WHERE id=" + user_id);
} catch (SQLException e) {
e.printStackTrace();
return;
}
<DeepExtract>
try {
stmt.close();
con.close();
} catch (SQLException e) {
e.printStackTrace();
return;
}
</DeepExtract>
} | myHome | positive | 439,835 |
public boolean onPreferenceChange(final Preference preference, final Object newValue) {
Log.d(TAG, "onPreferenceChanged");
pref.setText((String) newValue);
final Intent i = new Intent();
i.setAction(PREFERENCES_CHANGED_INTENT);
context.sendBroadcast(i);
return false;
} | public boolean onPreferenceChange(final Preference preference, final Object newValue) {
Log.d(TAG, "onPreferenceChanged");
pref.setText((String) newValue);
<DeepExtract>
final Intent i = new Intent();
i.setAction(PREFERENCES_CHANGED_INTENT);
context.sendBroadcast(i);
</DeepExtract>
return false;
} | Humansense-Android-App | positive | 439,836 |
public static void saveBoolean(String key, Boolean value) {
SharedPreferences.Editor editor = getPrefs().edit();
if (TextUtils.isEmpty(Boolean.toString(value))) {
editor.putString(key, Boolean.toString(value));
editor.apply();
} else {
try {
editor.putString(key, Encrypt3DESUtil.encrypt3DES(Boolean.toString(value).getBytes()));
editor.apply();
} catch (Exception e) {
e.printStackTrace();
}
}
} | public static void saveBoolean(String key, Boolean value) {
<DeepExtract>
SharedPreferences.Editor editor = getPrefs().edit();
if (TextUtils.isEmpty(Boolean.toString(value))) {
editor.putString(key, Boolean.toString(value));
editor.apply();
} else {
try {
editor.putString(key, Encrypt3DESUtil.encrypt3DES(Boolean.toString(value).getBytes()));
editor.apply();
} catch (Exception e) {
e.printStackTrace();
}
}
</DeepExtract>
} | Jectpack-MVVM-master | positive | 439,837 |
@Override
public void channelInactive(final ChannelHandlerContext ctx) {
if (processor == null) {
return;
}
processor.handleChannelClosed();
processor = null;
} | @Override
public void channelInactive(final ChannelHandlerContext ctx) {
if (processor == null) {
return;
}
processor.handleChannelClosed();
<DeepExtract>
processor = null;
</DeepExtract>
} | imapnio | positive | 439,838 |
public boolean isVisible() {
final AccountGroup.Id owner = group.getOwnerGroupId();
return getCurrentUser().getEffectiveGroups().contains(owner) || getCurrentUser().isAdministrator();
} | public boolean isVisible() {
<DeepExtract>
final AccountGroup.Id owner = group.getOwnerGroupId();
return getCurrentUser().getEffectiveGroups().contains(owner) || getCurrentUser().isAdministrator();
</DeepExtract>
} | mini-git-server | positive | 439,839 |
@Test
public void testOverflowLocation6() {
List<ByteBuffer> atoms = makeAtoms();
List<ByteBuffer> atomsWithOverflow = addOverflowMarker(atoms, 6);
BaggageReader reader = BaggageReader.create(atomsWithOverflow);
assertNotEquals(atomsWithOverflow, atoms);
assertEquals(atoms, reader.unprocessedAtoms());
List<ByteBuffer> expectedMergedAtoms = addOverflowMarker(atoms, 5);
assertEquals(expectedMergedAtoms, Lexicographic.merge(atoms, reader.overflowAtoms()));
assertEquals(expectedMergedAtoms, Lexicographic.merge(reader.unprocessedAtoms(), reader.overflowAtoms()));
} | @Test
public void testOverflowLocation6() {
<DeepExtract>
List<ByteBuffer> atoms = makeAtoms();
List<ByteBuffer> atomsWithOverflow = addOverflowMarker(atoms, 6);
BaggageReader reader = BaggageReader.create(atomsWithOverflow);
assertNotEquals(atomsWithOverflow, atoms);
assertEquals(atoms, reader.unprocessedAtoms());
List<ByteBuffer> expectedMergedAtoms = addOverflowMarker(atoms, 5);
assertEquals(expectedMergedAtoms, Lexicographic.merge(atoms, reader.overflowAtoms()));
assertEquals(expectedMergedAtoms, Lexicographic.merge(reader.unprocessedAtoms(), reader.overflowAtoms()));
</DeepExtract>
} | tracingplane-java | positive | 439,840 |
public Transaction find(Integer id) throws PagarMeException {
final PagarMeRequest request = new PagarMeRequest(HttpMethod.GET, String.format("/%s/%s", getClassName(), id));
final Transaction other = JSONUtils.getAsObject((JsonObject) request.execute(), Transaction.class);
super.copy(other);
this.subscriptionId = other.subscriptionId;
this.amount = other.amount;
this.installments = other.installments;
this.cost = other.cost;
this.status = other.status;
this.statusReason = other.statusReason;
this.acquirerName = other.acquirerName;
this.acquirerResponseCode = other.acquirerResponseCode;
this.authorizationCode = other.authorizationCode;
this.softDescriptor = other.softDescriptor;
this.tid = other.tid;
this.nsu = other.nsu;
this.postbackUrl = other.postbackUrl;
this.paymentMethod = other.paymentMethod;
this.boletoUrl = other.boletoUrl;
this.boletoBarcode = other.boletoBarcode;
this.boletoExpirationDate = other.boletoExpirationDate;
this.pixExpirationDate = other.pixExpirationDate;
this.pixQRCode = other.pixQRCode;
this.referer = other.referer;
this.referenceKey = other.referenceKey;
this.ip = other.ip;
this.cardId = other.cardId;
this.metadata = other.metadata;
this.card = other.card;
this.paidAmount = other.paidAmount;
this.refundedAmount = other.refundedAmount;
this.authorizedAmount = other.authorizedAmount;
this.refuseReason = other.refuseReason;
this.antifraudMetadata = other.antifraudMetadata;
this.splitRules = other.splitRules;
this.cardEmvResponse = other.cardEmvResponse;
this.updatedAt = other.updatedAt;
flush();
return other;
} | public Transaction find(Integer id) throws PagarMeException {
final PagarMeRequest request = new PagarMeRequest(HttpMethod.GET, String.format("/%s/%s", getClassName(), id));
final Transaction other = JSONUtils.getAsObject((JsonObject) request.execute(), Transaction.class);
<DeepExtract>
super.copy(other);
this.subscriptionId = other.subscriptionId;
this.amount = other.amount;
this.installments = other.installments;
this.cost = other.cost;
this.status = other.status;
this.statusReason = other.statusReason;
this.acquirerName = other.acquirerName;
this.acquirerResponseCode = other.acquirerResponseCode;
this.authorizationCode = other.authorizationCode;
this.softDescriptor = other.softDescriptor;
this.tid = other.tid;
this.nsu = other.nsu;
this.postbackUrl = other.postbackUrl;
this.paymentMethod = other.paymentMethod;
this.boletoUrl = other.boletoUrl;
this.boletoBarcode = other.boletoBarcode;
this.boletoExpirationDate = other.boletoExpirationDate;
this.pixExpirationDate = other.pixExpirationDate;
this.pixQRCode = other.pixQRCode;
this.referer = other.referer;
this.referenceKey = other.referenceKey;
this.ip = other.ip;
this.cardId = other.cardId;
this.metadata = other.metadata;
this.card = other.card;
this.paidAmount = other.paidAmount;
this.refundedAmount = other.refundedAmount;
this.authorizedAmount = other.authorizedAmount;
this.refuseReason = other.refuseReason;
this.antifraudMetadata = other.antifraudMetadata;
this.splitRules = other.splitRules;
this.cardEmvResponse = other.cardEmvResponse;
this.updatedAt = other.updatedAt;
</DeepExtract>
flush();
return other;
} | pagarme-java | positive | 439,841 |
private void otaUpdateProcess(String filePath) {
try {
if (mHandler != null) {
mHandler.obtainMessage(OTA_BEFORE, mIndex).sendToTarget();
}
FileInputStream fileInputStream = new FileInputStream(filePath);
int fileSize = fileInputStream.available();
if (fileSize == 0 || mShouldStop) {
fileInputStream.close();
this.serErrorCode(OtaStatus.OtaResult.OTA_RESULT_FW_SIZE_ERROR);
if (mHandler != null) {
mHandler.obtainMessage(OTA_FAIL, mIndex).sendToTarget();
}
return;
}
int metaSize = this.otaSendMetaData(fileInputStream);
if (metaSize < 0 || mShouldStop) {
fileInputStream.close();
this.serErrorCode(OtaStatus.OtaResult.OTA_RESULT_SEND_META_ERROR);
if (mHandler != null) {
mHandler.obtainMessage(OTA_FAIL, mIndex).sendToTarget();
}
return;
}
int offset1 = this.getOffset();
if (offset1 < 0 || mShouldStop) {
if (BuildConfig.DEBUG) {
Log.e(TAG, "wait cmd OTA_CMD_META_DATA timeout");
}
fileInputStream.close();
this.serErrorCode(OtaStatus.OtaResult.OTA_RESULT_META_RESPONSE_TIMEOUT);
if (mHandler != null) {
mHandler.obtainMessage(OTA_FAIL, mIndex).sendToTarget();
}
return;
}
if (offset1 > 0) {
fileInputStream.skip((long) offset1);
}
int brickDataSize = fileSize - metaSize;
int transfereedSize = 0;
if (BuildConfig.DEBUG) {
Log.d(TAG, "offset=" + offset1 + " meta size " + metaSize);
}
long begin = Calendar.getInstance().getTimeInMillis();
do {
int ret1 = this.otaSendBrickData(fileInputStream, mPacketSize);
if (ret1 < 0 || mShouldStop) {
fileInputStream.close();
if (BuildConfig.DEBUG) {
Log.e(TAG, "otaUpdateProcess Exit for some transfer issue");
}
this.serErrorCode(OtaStatus.OtaResult.OTA_RESULT_DATA_RESPONSE_TIMEOUT);
if (mHandler != null) {
mHandler.obtainMessage(OTA_FAIL, mIndex).sendToTarget();
}
return;
}
if (!this.waitReadDataCompleted() || mShouldStop) {
if (BuildConfig.DEBUG) {
Log.e(TAG, "waitReadDataCompleted timeout");
}
this.serErrorCode(OtaStatus.OtaResult.OTA_RESULT_DATA_RESPONSE_TIMEOUT);
if (mHandler != null) {
mHandler.obtainMessage(OTA_FAIL, mIndex).sendToTarget();
}
return;
}
offset1 += ret1;
this.mPercent = offset1 * 100 / fileSize;
if (mHandler != null) {
mHandler.obtainMessage(OTA_UPDATE, mPercent, 0, mIndex).sendToTarget();
}
transfereedSize += mPacketSize;
long now = Calendar.getInstance().getTimeInMillis();
this.mElapsedTime = (int) ((now - begin) / 1000L);
this.mByteRate = (int) ((long) (transfereedSize * 1000) / (now - begin));
} while (offset1 < brickDataSize);
if (!this.otaSendVerifyCmd() || mShouldStop) {
fileInputStream.close();
this.serErrorCode(OtaStatus.OtaResult.OTA_RESULT_FW_VERIFY_ERROR);
if (mHandler != null) {
mHandler.obtainMessage(OTA_FAIL, mIndex).sendToTarget();
}
return;
}
this.mPercent = 100;
this.otaSendResetCmd();
fileInputStream.close();
} catch (Exception e) {
if (BuildConfig.DEBUG) {
Log.e(TAG, "send ota update error", e);
}
this.serErrorCode(OtaStatus.OtaResult.OTA_RESULT_DATA_RESPONSE_TIMEOUT);
if (mHandler != null) {
mHandler.obtainMessage(OTA_FAIL, mIndex).sendToTarget();
}
return;
}
if (BuildConfig.DEBUG) {
Log.i(TAG, "otaUpdateProcess Exit");
}
if (mHandler != null) {
mHandler.obtainMessage(OTA_OVER, mIndex).sendToTarget();
}
this.mRetValue = OtaStatus.OtaResult.OTA_RESULT_SUCCESS;
} | private void otaUpdateProcess(String filePath) {
try {
if (mHandler != null) {
mHandler.obtainMessage(OTA_BEFORE, mIndex).sendToTarget();
}
FileInputStream fileInputStream = new FileInputStream(filePath);
int fileSize = fileInputStream.available();
if (fileSize == 0 || mShouldStop) {
fileInputStream.close();
this.serErrorCode(OtaStatus.OtaResult.OTA_RESULT_FW_SIZE_ERROR);
if (mHandler != null) {
mHandler.obtainMessage(OTA_FAIL, mIndex).sendToTarget();
}
return;
}
int metaSize = this.otaSendMetaData(fileInputStream);
if (metaSize < 0 || mShouldStop) {
fileInputStream.close();
this.serErrorCode(OtaStatus.OtaResult.OTA_RESULT_SEND_META_ERROR);
if (mHandler != null) {
mHandler.obtainMessage(OTA_FAIL, mIndex).sendToTarget();
}
return;
}
int offset1 = this.getOffset();
if (offset1 < 0 || mShouldStop) {
if (BuildConfig.DEBUG) {
Log.e(TAG, "wait cmd OTA_CMD_META_DATA timeout");
}
fileInputStream.close();
this.serErrorCode(OtaStatus.OtaResult.OTA_RESULT_META_RESPONSE_TIMEOUT);
if (mHandler != null) {
mHandler.obtainMessage(OTA_FAIL, mIndex).sendToTarget();
}
return;
}
if (offset1 > 0) {
fileInputStream.skip((long) offset1);
}
int brickDataSize = fileSize - metaSize;
int transfereedSize = 0;
if (BuildConfig.DEBUG) {
Log.d(TAG, "offset=" + offset1 + " meta size " + metaSize);
}
long begin = Calendar.getInstance().getTimeInMillis();
do {
int ret1 = this.otaSendBrickData(fileInputStream, mPacketSize);
if (ret1 < 0 || mShouldStop) {
fileInputStream.close();
if (BuildConfig.DEBUG) {
Log.e(TAG, "otaUpdateProcess Exit for some transfer issue");
}
this.serErrorCode(OtaStatus.OtaResult.OTA_RESULT_DATA_RESPONSE_TIMEOUT);
if (mHandler != null) {
mHandler.obtainMessage(OTA_FAIL, mIndex).sendToTarget();
}
return;
}
if (!this.waitReadDataCompleted() || mShouldStop) {
if (BuildConfig.DEBUG) {
Log.e(TAG, "waitReadDataCompleted timeout");
}
this.serErrorCode(OtaStatus.OtaResult.OTA_RESULT_DATA_RESPONSE_TIMEOUT);
if (mHandler != null) {
mHandler.obtainMessage(OTA_FAIL, mIndex).sendToTarget();
}
return;
}
offset1 += ret1;
this.mPercent = offset1 * 100 / fileSize;
if (mHandler != null) {
mHandler.obtainMessage(OTA_UPDATE, mPercent, 0, mIndex).sendToTarget();
}
transfereedSize += mPacketSize;
long now = Calendar.getInstance().getTimeInMillis();
this.mElapsedTime = (int) ((now - begin) / 1000L);
this.mByteRate = (int) ((long) (transfereedSize * 1000) / (now - begin));
} while (offset1 < brickDataSize);
if (!this.otaSendVerifyCmd() || mShouldStop) {
fileInputStream.close();
this.serErrorCode(OtaStatus.OtaResult.OTA_RESULT_FW_VERIFY_ERROR);
if (mHandler != null) {
mHandler.obtainMessage(OTA_FAIL, mIndex).sendToTarget();
}
return;
}
this.mPercent = 100;
this.otaSendResetCmd();
fileInputStream.close();
} catch (Exception e) {
if (BuildConfig.DEBUG) {
Log.e(TAG, "send ota update error", e);
}
this.serErrorCode(OtaStatus.OtaResult.OTA_RESULT_DATA_RESPONSE_TIMEOUT);
if (mHandler != null) {
mHandler.obtainMessage(OTA_FAIL, mIndex).sendToTarget();
}
return;
}
if (BuildConfig.DEBUG) {
Log.i(TAG, "otaUpdateProcess Exit");
}
if (mHandler != null) {
mHandler.obtainMessage(OTA_OVER, mIndex).sendToTarget();
}
<DeepExtract>
this.mRetValue = OtaStatus.OtaResult.OTA_RESULT_SUCCESS;
</DeepExtract>
} | Android-BLE | positive | 439,842 |
public void testRenameLocalVariableWithMethodCallOnIt() {
myFixture.configureByFiles(this.getTestName(false) + "Before.vala");
myFixture.renameElementAtCaret("goodName");
myFixture.checkResultByFile(this.getTestName(false) + "After.vala");
} | public void testRenameLocalVariableWithMethodCallOnIt() {
<DeepExtract>
myFixture.configureByFiles(this.getTestName(false) + "Before.vala");
myFixture.renameElementAtCaret("goodName");
myFixture.checkResultByFile(this.getTestName(false) + "After.vala");
</DeepExtract>
} | vala-intellij-plugin | positive | 439,843 |
public static void addMeltingRecipe() {
if (ExAstrisRebirthData.allowAddTConstructNetherOre) {
addMeltableOre(new ItemStack(ExAstrisRebirthBlock.blockOreCobalt, 1, 2), new FluidStack(TinkerSmeltery.moltenCobaltFluid, ingotCostHighoven), 650);
addMeltableOre(new ItemStack(ExAstrisRebirthBlock.blockOreArdite, 1, 2), new FluidStack(TinkerSmeltery.moltenArditeFluid, ingotCostHighoven), 650);
}
if (new ItemStack(GameRegistry.findBlock("exnihilo", "iron_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenIronFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "iron_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenIronFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "iron_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenIronFluid, ingotCostHighoven), 600);
}
if (new ItemStack(GameRegistry.findBlock("exnihilo", "gold_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenGoldFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "gold_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenGoldFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "gold_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenGoldFluid, ingotCostHighoven), 400);
}
if (new ItemStack(GameRegistry.findBlock("exnihilo", "copper_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenCopperFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "copper_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenCopperFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "copper_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenCopperFluid, ingotCostHighoven), 550);
}
if (new ItemStack(GameRegistry.findBlock("exnihilo", "tin_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenTinFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "tin_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenTinFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "tin_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenTinFluid, ingotCostHighoven), 400);
}
if (new ItemStack(GameRegistry.findBlock("exnihilo", "silver_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenSilverFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "silver_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenSilverFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "silver_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenSilverFluid, ingotCostHighoven), 400);
}
if (new ItemStack(GameRegistry.findBlock("exnihilo", "lead_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenLeadFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "lead_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenLeadFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "lead_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenLeadFluid, ingotCostHighoven), 400);
}
if (new ItemStack(GameRegistry.findBlock("exnihilo", "nickel_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenNickelFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "nickel_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenNickelFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "nickel_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenNickelFluid, ingotCostHighoven), 400);
}
if (new ItemStack(GameRegistry.findBlock("exnihilo", "platinum_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenShinyFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "platinum_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenShinyFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "platinum_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenShinyFluid, ingotCostHighoven), 400);
}
if (new ItemStack(GameRegistry.findBlock("exnihilo", "aluminum_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenAluminumFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "aluminum_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenAluminumFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "aluminum_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenAluminumFluid, ingotCostHighoven), 400);
}
} | public static void addMeltingRecipe() {
if (ExAstrisRebirthData.allowAddTConstructNetherOre) {
addMeltableOre(new ItemStack(ExAstrisRebirthBlock.blockOreCobalt, 1, 2), new FluidStack(TinkerSmeltery.moltenCobaltFluid, ingotCostHighoven), 650);
addMeltableOre(new ItemStack(ExAstrisRebirthBlock.blockOreArdite, 1, 2), new FluidStack(TinkerSmeltery.moltenArditeFluid, ingotCostHighoven), 650);
}
if (new ItemStack(GameRegistry.findBlock("exnihilo", "iron_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenIronFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "iron_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenIronFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "iron_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenIronFluid, ingotCostHighoven), 600);
}
if (new ItemStack(GameRegistry.findBlock("exnihilo", "gold_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenGoldFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "gold_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenGoldFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "gold_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenGoldFluid, ingotCostHighoven), 400);
}
if (new ItemStack(GameRegistry.findBlock("exnihilo", "copper_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenCopperFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "copper_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenCopperFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "copper_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenCopperFluid, ingotCostHighoven), 550);
}
if (new ItemStack(GameRegistry.findBlock("exnihilo", "tin_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenTinFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "tin_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenTinFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "tin_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenTinFluid, ingotCostHighoven), 400);
}
if (new ItemStack(GameRegistry.findBlock("exnihilo", "silver_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenSilverFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "silver_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenSilverFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "silver_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenSilverFluid, ingotCostHighoven), 400);
}
if (new ItemStack(GameRegistry.findBlock("exnihilo", "lead_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenLeadFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "lead_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenLeadFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "lead_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenLeadFluid, ingotCostHighoven), 400);
}
if (new ItemStack(GameRegistry.findBlock("exnihilo", "nickel_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenNickelFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "nickel_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenNickelFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "nickel_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenNickelFluid, ingotCostHighoven), 400);
}
if (new ItemStack(GameRegistry.findBlock("exnihilo", "platinum_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenShinyFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "platinum_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenShinyFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "platinum_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenShinyFluid, ingotCostHighoven), 400);
}
<DeepExtract>
if (new ItemStack(GameRegistry.findBlock("exnihilo", "aluminum_dust"), 0) != null && new FluidStack(TinkerSmeltery.moltenAluminumFluid, ingotCostHighoven) != null && new ItemStack(GameRegistry.findBlock("exnihilo", "aluminum_dust"), 0).getItem() != null && new FluidStack(TinkerSmeltery.moltenAluminumFluid, ingotCostHighoven).getFluid() != null) {
instance.addMeltable(new ItemStack(GameRegistry.findBlock("exnihilo", "aluminum_dust"), 0), true, new FluidStack(TinkerSmeltery.moltenAluminumFluid, ingotCostHighoven), 400);
}
</DeepExtract>
} | Ex-Astris-Rebirth | positive | 439,848 |
@Test
public void loadEventsUnpublishedWait() throws InterruptedException {
List<EventEnvelope<VikingEvent, Void, Void>> events = API.List(event1, event2, event3, event4, event5, event6);
inTransaction(ctx -> postgresEventStore.persist(ctx, events)).toCompletableFuture().join();
CompletionStage<java.util.List<EventEnvelope<VikingEvent, Void, Void>>> first = transactionSource().flatMapMany(t -> Flux.from(postgresEventStore.loadEventsUnpublished(t, WAIT)).concatMap(elt -> Flux.interval(Duration.ofMillis(100), Duration.ofMillis(100)).map(__ -> elt).take(1)).concatMap(e -> Mono.fromCompletionStage(() -> postgresEventStore.markAsPublished(t, e).toCompletableFuture()).map(__ -> e)).doFinally(it -> t.commit())).collectList().toFuture();
Thread.sleep(100);
long start = System.currentTimeMillis();
CompletionStage<java.util.List<EventEnvelope<VikingEvent, Void, Void>>> second = transactionSource().flatMapMany(t -> Flux.from(postgresEventStore.loadEventsUnpublished(t, WAIT)).doOnComplete(() -> postgresEventStore.commitOrRollback(Option.none(), t)).doOnError(e -> postgresEventStore.commitOrRollback(Option.of(e), t))).collectList().toFuture();
List<EventEnvelope<VikingEvent, Void, Void>> events2 = List.ofAll(second.toCompletableFuture().join());
long took = System.currentTimeMillis() - start;
List<EventEnvelope<VikingEvent, Void, Void>> events1 = List.ofAll(first.toCompletableFuture().join());
assertThat(events1).containsExactlyInAnyOrder(event1, event2, event3, event4, event5, event6);
assertThat(events2).isEmpty();
assertThat(took).isGreaterThan(600);
} | @Test
public void loadEventsUnpublishedWait() throws InterruptedException {
<DeepExtract>
List<EventEnvelope<VikingEvent, Void, Void>> events = API.List(event1, event2, event3, event4, event5, event6);
inTransaction(ctx -> postgresEventStore.persist(ctx, events)).toCompletableFuture().join();
</DeepExtract>
CompletionStage<java.util.List<EventEnvelope<VikingEvent, Void, Void>>> first = transactionSource().flatMapMany(t -> Flux.from(postgresEventStore.loadEventsUnpublished(t, WAIT)).concatMap(elt -> Flux.interval(Duration.ofMillis(100), Duration.ofMillis(100)).map(__ -> elt).take(1)).concatMap(e -> Mono.fromCompletionStage(() -> postgresEventStore.markAsPublished(t, e).toCompletableFuture()).map(__ -> e)).doFinally(it -> t.commit())).collectList().toFuture();
Thread.sleep(100);
long start = System.currentTimeMillis();
CompletionStage<java.util.List<EventEnvelope<VikingEvent, Void, Void>>> second = transactionSource().flatMapMany(t -> Flux.from(postgresEventStore.loadEventsUnpublished(t, WAIT)).doOnComplete(() -> postgresEventStore.commitOrRollback(Option.none(), t)).doOnError(e -> postgresEventStore.commitOrRollback(Option.of(e), t))).collectList().toFuture();
List<EventEnvelope<VikingEvent, Void, Void>> events2 = List.ofAll(second.toCompletableFuture().join());
long took = System.currentTimeMillis() - start;
List<EventEnvelope<VikingEvent, Void, Void>> events1 = List.ofAll(first.toCompletableFuture().join());
assertThat(events1).containsExactlyInAnyOrder(event1, event2, event3, event4, event5, event6);
assertThat(events2).isEmpty();
assertThat(took).isGreaterThan(600);
} | thoth | positive | 439,850 |
public Criteria andPermissionProjectsBetween(String value1, String value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "permissionProjects" + " cannot be null");
}
criteria.add(new Criterion("permission_projects between", value1, value2));
return (Criteria) this;
} | public Criteria andPermissionProjectsBetween(String value1, String value2) {
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "permissionProjects" + " cannot be null");
}
criteria.add(new Criterion("permission_projects between", value1, value2));
</DeepExtract>
return (Criteria) this;
} | lightconf | positive | 439,851 |
@Test
void statements() {
return cast(suppress(() -> grammarClass.getField("stmt").get(grammar)));
success("int x;");
success("int x = 1;");
success("int x = 1, y;");
success("@Annot final List<String> name = x, stuff[] = array();");
success("if (true) ; else ;");
success("for (;;) ;");
success("for (int i = 0 ; true ; ++i, ++j) ;");
success("for (i = 0, j = 0 ; i < 10 ; ++i) ;");
success("for (@Annot String x : list) ;");
success("while (true) ;");
success("do ; while (true);");
success("try {} catch (Exception e) {} finally {}");
success("try {} finally {}");
success("try {} catch (Exception e) {}");
success("try {} catch (@Annot Exception|Error e) {}");
success("try (@Annot Resource res[] = myres) {} finally {}");
success("try (Resource res[] = myres ; Resource x = youpie()) {} finally {}");
success("switch (x) { case 1: dox(); doy(); case 2: case 3: doz(); break; default: dou();}");
success("switch (x) {}");
success("synchronized (expr) {}");
success("return;");
success("return x;");
success("throw new Exception(lol);");
success("assert x || y && z : lol;");
success("assert x || y;");
success("continue;");
success("continue label;");
success("break;");
success("break label;");
success("label: funCall();");
success("label: while (x) {}");
success(";");
success("funcall();");
success("++i;");
} | @Test
void statements() {
<DeepExtract>
return cast(suppress(() -> grammarClass.getField("stmt").get(grammar)));
</DeepExtract>
success("int x;");
success("int x = 1;");
success("int x = 1, y;");
success("@Annot final List<String> name = x, stuff[] = array();");
success("if (true) ; else ;");
success("for (;;) ;");
success("for (int i = 0 ; true ; ++i, ++j) ;");
success("for (i = 0, j = 0 ; i < 10 ; ++i) ;");
success("for (@Annot String x : list) ;");
success("while (true) ;");
success("do ; while (true);");
success("try {} catch (Exception e) {} finally {}");
success("try {} finally {}");
success("try {} catch (Exception e) {}");
success("try {} catch (@Annot Exception|Error e) {}");
success("try (@Annot Resource res[] = myres) {} finally {}");
success("try (Resource res[] = myres ; Resource x = youpie()) {} finally {}");
success("switch (x) { case 1: dox(); doy(); case 2: case 3: doz(); break; default: dou();}");
success("switch (x) {}");
success("synchronized (expr) {}");
success("return;");
success("return x;");
success("throw new Exception(lol);");
success("assert x || y && z : lol;");
success("assert x || y;");
success("continue;");
success("continue label;");
success("break;");
success("break label;");
success("label: funCall();");
success("label: while (x) {}");
success(";");
success("funcall();");
success("++i;");
} | autumn | positive | 439,852 |
@Override
protected void initPopupContent() {
super.initPopupContent();
setClipChildren(false);
setClipToPadding(false);
positionPopupContainer.enableDrag = popupInfo.enableDrag;
return DragOrientation.DragToUp;
XPopupUtils.applyPopupSize((ViewGroup) getPopupContentView(), getMaxWidth(), getMaxHeight(), getPopupWidth(), getPopupHeight(), new Runnable() {
@Override
public void run() {
doPosition();
}
});
positionPopupContainer.setOnPositionDragChangeListener(new PositionPopupContainer.OnPositionDragListener() {
@Override
public void onDismiss() {
dismiss();
}
});
} | @Override
protected void initPopupContent() {
super.initPopupContent();
setClipChildren(false);
setClipToPadding(false);
positionPopupContainer.enableDrag = popupInfo.enableDrag;
<DeepExtract>
return DragOrientation.DragToUp;
</DeepExtract>
XPopupUtils.applyPopupSize((ViewGroup) getPopupContentView(), getMaxWidth(), getMaxHeight(), getPopupWidth(), getPopupHeight(), new Runnable() {
@Override
public void run() {
doPosition();
}
});
positionPopupContainer.setOnPositionDragChangeListener(new PositionPopupContainer.OnPositionDragListener() {
@Override
public void onDismiss() {
dismiss();
}
});
} | XPopup | positive | 439,854 |
public boolean delConstraintHasMultiR(IPAPointsToSetVariable lhs, IPAAssignOperator op, ArrayList<IPAPointsToSetVariable> rhss, MutableIntSet delset, IPAPointsToSetVariable base) {
if (lhs == null) {
throw new IllegalArgumentException("null lhs");
}
if (op == null) {
throw new IllegalArgumentException("op null");
}
try {
if (lhs.getPointerKey() instanceof LocalPointerKey) {
LocalPointerKey LocalPK = (LocalPointerKey) lhs.getPointerKey();
if (LocalPK.getNode().getMethod().isInit() || LocalPK.getNode().getMethod().isClinit())
return false;
}
} catch (Exception e) {
return false;
}
if (op == null) {
throw new IllegalArgumentException("operator is null");
}
for (IPAPointsToSetVariable lhs : lhs) {
IPAUnaryStatement s = op.makeEquation(lhs, rhss);
if (!getFixedPointSystem().containsStatement(s)) {
continue;
}
if (getFirstDel()) {
getFixedPointSystem().removeStatement(s);
}
}
int nrOfWorks = rhss.size();
if (nrOfWorks == 0) {
return false;
}
if (delset == null)
return false;
if (!false) {
if (isTransitiveRoot(lhs.getPointerKey()))
return;
}
final IPAMutableSharedBitVectorIntSet remaining = computeRemaining(delset, lhs);
if (!remaining.isEmpty()) {
DeletionUtil.removeSome(lhs, remaining);
if (lhs.getChange().size() > 0) {
if (!changes.contains(lhs)) {
changes.add(lhs);
}
final ArrayList<IPAPointsToSetVariable> firstUsers = findFirstUsers(lhs);
final int nrOfWorks = firstUsers.size();
if (nrOfWorks == 0) {
return;
} else if (nrOfWorks == 1) {
IPAPointsToSetVariable first = firstUsers.get(0);
singleProcedureToDelPointsToSet(first, delset);
} else {
if (useAkka) {
} else {
try {
threadHub.initialRRTasks(lhs.getChange(), firstUsers, this);
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
}
}
}
} else {
return;
}
return true;
} | public boolean delConstraintHasMultiR(IPAPointsToSetVariable lhs, IPAAssignOperator op, ArrayList<IPAPointsToSetVariable> rhss, MutableIntSet delset, IPAPointsToSetVariable base) {
if (lhs == null) {
throw new IllegalArgumentException("null lhs");
}
if (op == null) {
throw new IllegalArgumentException("op null");
}
try {
if (lhs.getPointerKey() instanceof LocalPointerKey) {
LocalPointerKey LocalPK = (LocalPointerKey) lhs.getPointerKey();
if (LocalPK.getNode().getMethod().isInit() || LocalPK.getNode().getMethod().isClinit())
return false;
}
} catch (Exception e) {
return false;
}
if (op == null) {
throw new IllegalArgumentException("operator is null");
}
for (IPAPointsToSetVariable lhs : lhs) {
IPAUnaryStatement s = op.makeEquation(lhs, rhss);
if (!getFixedPointSystem().containsStatement(s)) {
continue;
}
if (getFirstDel()) {
getFixedPointSystem().removeStatement(s);
}
}
int nrOfWorks = rhss.size();
if (nrOfWorks == 0) {
return false;
}
if (delset == null)
return false;
<DeepExtract>
if (!false) {
if (isTransitiveRoot(lhs.getPointerKey()))
return;
}
final IPAMutableSharedBitVectorIntSet remaining = computeRemaining(delset, lhs);
if (!remaining.isEmpty()) {
DeletionUtil.removeSome(lhs, remaining);
if (lhs.getChange().size() > 0) {
if (!changes.contains(lhs)) {
changes.add(lhs);
}
final ArrayList<IPAPointsToSetVariable> firstUsers = findFirstUsers(lhs);
final int nrOfWorks = firstUsers.size();
if (nrOfWorks == 0) {
return;
} else if (nrOfWorks == 1) {
IPAPointsToSetVariable first = firstUsers.get(0);
singleProcedureToDelPointsToSet(first, delset);
} else {
if (useAkka) {
} else {
try {
threadHub.initialRRTasks(lhs.getChange(), firstUsers, this);
} catch (InterruptedException | ExecutionException e) {
e.printStackTrace();
}
}
}
}
} else {
return;
}
</DeepExtract>
return true;
} | Incremental_Points_to_Analysis | positive | 439,855 |
public void exitGame() {
if (Atlantis.game() == null) {
return;
}
int resourcesBalance = AGame.killsLossesResourceBalance();
System.out.println();
System.out.println("### Total time: " + AGame.timeSeconds() + " seconds. ###\r\n" + "### Units killed/lost: " + Atlantis.KILLED + "/" + Atlantis.LOST + " ###" + "### Resource killed/lost: " + (resourcesBalance > 0 ? "+" + resourcesBalance : resourcesBalance) + " ###");
if (A.isUms()) {
System.out.println();
UnitsArchive.paintLostUnits();
UnitsArchive.paintKilledUnits();
}
UnitsArchive.paintKillLossResources();
System.out.println("");
System.out.println("Killing StarCraft process... ");
ProcessHelper.killStarcraftProcess();
System.out.print("Killing Chaoslauncher process... ");
ProcessHelper.killChaosLauncherProcess();
System.out.println("Exit...");
System.exit(0);
} | public void exitGame() {
if (Atlantis.game() == null) {
return;
}
int resourcesBalance = AGame.killsLossesResourceBalance();
System.out.println();
System.out.println("### Total time: " + AGame.timeSeconds() + " seconds. ###\r\n" + "### Units killed/lost: " + Atlantis.KILLED + "/" + Atlantis.LOST + " ###" + "### Resource killed/lost: " + (resourcesBalance > 0 ? "+" + resourcesBalance : resourcesBalance) + " ###");
if (A.isUms()) {
System.out.println();
UnitsArchive.paintLostUnits();
UnitsArchive.paintKilledUnits();
}
UnitsArchive.paintKillLossResources();
<DeepExtract>
System.out.println("");
System.out.println("Killing StarCraft process... ");
ProcessHelper.killStarcraftProcess();
System.out.print("Killing Chaoslauncher process... ");
ProcessHelper.killChaosLauncherProcess();
System.out.println("Exit...");
System.exit(0);
</DeepExtract>
} | Atlantis | positive | 439,857 |
public OSchemaHelper set(OClass.ATTRIBUTES attr, Object value) {
if (lastClass == null)
throw new IllegalStateException("Last OClass should not be null");
lastClass.set(attr, value);
return this;
} | public OSchemaHelper set(OClass.ATTRIBUTES attr, Object value) {
<DeepExtract>
if (lastClass == null)
throw new IllegalStateException("Last OClass should not be null");
</DeepExtract>
lastClass.set(attr, value);
return this;
} | wicket-orientdb | positive | 439,858 |
public static DateTime offsiteDay(Date date, int offsite) {
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DAY_OF_YEAR, offsite);
return new DateTime(cal.getTime());
} | public static DateTime offsiteDay(Date date, int offsite) {
<DeepExtract>
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DAY_OF_YEAR, offsite);
return new DateTime(cal.getTime());
</DeepExtract>
} | school-bus | positive | 439,859 |
@Override
protected void exit(DClareMPS dClareMPS, SModel original) {
DModelListener l = new DModelListener(this, dClareMPS);
SModel sModel = tryOriginal();
if (sModel != null) {
sModel.removeModelListener(l);
}
SModel sModel = tryOriginal();
if (sModel != null) {
sModel.removeChangeListener(l);
}
SModel sModel = tryOriginal();
if (sModel != null) {
sModel.removeModelListener(l);
}
} | @Override
protected void exit(DClareMPS dClareMPS, SModel original) {
DModelListener l = new DModelListener(this, dClareMPS);
<DeepExtract>
SModel sModel = tryOriginal();
if (sModel != null) {
sModel.removeModelListener(l);
}
</DeepExtract>
SModel sModel = tryOriginal();
if (sModel != null) {
sModel.removeChangeListener(l);
}
<DeepExtract>
SModel sModel = tryOriginal();
if (sModel != null) {
sModel.removeModelListener(l);
}
</DeepExtract>
} | DclareForMPS | positive | 439,860 |
@Test
void shouldReplaceSpacesEncodedWithPlusCharacter() throws IOException, InterruptedException {
String givenPath = "/test";
String givenMethod = "GET";
String parameterToEncode = "parameterToEncode";
String notEncodedValueContainingPlusCharacters = " Param with spaces ";
RequestDefinition givenRequestDefinition = RequestDefinition.builder(givenMethod, givenPath).addQueryParameter(new Parameter(parameterToEncode, notEncodedValueContainingPlusCharacters)).build();
RequestFactory requestFactory = new RequestFactory(GIVEN_API_KEY, localhost(server.getPort()), json);
client.newCall(requestFactory.create(givenRequestDefinition)).execute().close();
String expectedEncodedValue = "%20Param%20with%20%20spaces%20%20%20";
String expectedPath = String.format("/test?%s=%s", parameterToEncode, expectedEncodedValue);
RecordedRequest recordedRequest = server.takeRequest();
then(recordedRequest.getPath()).isEqualTo(expectedPath);
then(recordedRequest.getMethod()).isEqualTo(givenMethod);
} | @Test
void shouldReplaceSpacesEncodedWithPlusCharacter() throws IOException, InterruptedException {
String givenPath = "/test";
String givenMethod = "GET";
String parameterToEncode = "parameterToEncode";
String notEncodedValueContainingPlusCharacters = " Param with spaces ";
RequestDefinition givenRequestDefinition = RequestDefinition.builder(givenMethod, givenPath).addQueryParameter(new Parameter(parameterToEncode, notEncodedValueContainingPlusCharacters)).build();
RequestFactory requestFactory = new RequestFactory(GIVEN_API_KEY, localhost(server.getPort()), json);
<DeepExtract>
client.newCall(requestFactory.create(givenRequestDefinition)).execute().close();
</DeepExtract>
String expectedEncodedValue = "%20Param%20with%20%20spaces%20%20%20";
String expectedPath = String.format("/test?%s=%s", parameterToEncode, expectedEncodedValue);
RecordedRequest recordedRequest = server.takeRequest();
then(recordedRequest.getPath()).isEqualTo(expectedPath);
then(recordedRequest.getMethod()).isEqualTo(givenMethod);
} | infobip-api-java-client | positive | 439,861 |
public static void main(String[] args) {
Node root = new Node(1);
root.left = new Node(3);
root.right = new Node(4);
root.left.left = new Node(2);
root.right.left = new Node(5);
root.left.right = new Node(9);
if (root == null)
return;
if (root.left == null && root.right == null) {
System.out.print(0 + root.val + " ");
return;
}
BranchSum(root.left, 0 + root.val);
BranchSum(root.right, 0 + root.val);
} | public static void main(String[] args) {
Node root = new Node(1);
root.left = new Node(3);
root.right = new Node(4);
root.left.left = new Node(2);
root.right.left = new Node(5);
root.left.right = new Node(9);
<DeepExtract>
if (root == null)
return;
if (root.left == null && root.right == null) {
System.out.print(0 + root.val + " ");
return;
}
BranchSum(root.left, 0 + root.val);
BranchSum(root.right, 0 + root.val);
</DeepExtract>
} | CodeGym | positive | 439,863 |
public static void main(String[] args) {
int[] a = { 6, 3, 2, 7, 1 };
int n = 5;
boolean isSorted = false;
int counter = 0;
while (!isSorted) {
isSorted = true;
for (int i = 0; i < n - 1 - counter; i++) {
if (a[i] > a[i + 1]) {
swap(a, i, i + 1);
isSorted = false;
}
}
counter++;
}
for (int i : a) System.out.print(i + " ");
} | public static void main(String[] args) {
int[] a = { 6, 3, 2, 7, 1 };
int n = 5;
<DeepExtract>
boolean isSorted = false;
int counter = 0;
while (!isSorted) {
isSorted = true;
for (int i = 0; i < n - 1 - counter; i++) {
if (a[i] > a[i + 1]) {
swap(a, i, i + 1);
isSorted = false;
}
}
counter++;
}
</DeepExtract>
for (int i : a) System.out.print(i + " ");
} | CodeGym | positive | 439,864 |
public void unitClear(mindustry.gen.Player player) {
original = Vars.net;
staticNet.setNet(net).setProvider(provider);
Vars.net = staticNet;
mindustry.gen.Call.unitClear(player);
Vars.net = original;
original = null;
} | public void unitClear(mindustry.gen.Player player) {
original = Vars.net;
staticNet.setNet(net).setProvider(provider);
Vars.net = staticNet;
mindustry.gen.Call.unitClear(player);
<DeepExtract>
Vars.net = original;
original = null;
</DeepExtract>
} | Mindustry-Ozone | positive | 439,865 |
@CallSuper
public int incrementAndGet() {
while (true) {
final int currentValue = get();
if (compareAndSet(currentValue, currentValue + 1)) {
return currentValue;
}
RCLog.d(this, "Collision concurrent add, will try again: " + currentValue);
}
} | @CallSuper
public int incrementAndGet() {
<DeepExtract>
while (true) {
final int currentValue = get();
if (compareAndSet(currentValue, currentValue + 1)) {
return currentValue;
}
RCLog.d(this, "Collision concurrent add, will try again: " + currentValue);
}
</DeepExtract>
} | cascade | positive | 439,866 |
public void multiply(Integer other) {
if (this.isPositive() && other.isNegative()) {
this.setSign((byte) 1);
} else if (this.isNegative() && other.isPositive()) {
this.setSign((byte) 1);
} else {
this.setSign((byte) 0);
}
if (!bLocked) {
bLocked = true;
if (ERASE_ON_LOCK) {
erase();
}
} else {
ISOException.throwIt(ReturnCodes.SW_LOCK_ALREADYLOCKED);
}
if (this.magnitude.length() < 0 || this.magnitude.length() > max_size) {
ISOException.throwIt(ReturnCodes.SW_BIGNAT_RESIZETOLONGER);
} else {
this.size = this.magnitude.length();
}
Util.arrayFillNonAtomic(value, (short) 0, this.size, (byte) 0);
bnh.fnc_int_multiply_mod.as_byte_array()[0] = (byte) 0x80;
if (!bLocked) {
bLocked = true;
if (ERASE_ON_LOCK) {
erase();
}
} else {
ISOException.throwIt(ReturnCodes.SW_LOCK_ALREADYLOCKED);
}
if (this.magnitude.length() < 0 || this.magnitude.length() > max_size) {
ISOException.throwIt(ReturnCodes.SW_BIGNAT_RESIZETOLONGER);
} else {
this.size = this.magnitude.length();
}
bnh.fnc_mod_mult_tmpThis.lock();
bnh.fnc_mod_mult_tmpThis.resize_to_max(false);
bnh.fnc_mod_mult_tmpThis.mult(this.getMagnitude(), other.getMagnitude());
bnh.fnc_mod_mult_tmpThis.mod(bnh.fnc_int_multiply_mod);
bnh.fnc_mod_mult_tmpThis.shrink();
this.clone(bnh.fnc_mod_mult_tmpThis);
bnh.fnc_mod_mult_tmpThis.unlock();
short this_start, other_start, len;
if (this.size >= bnh.fnc_int_multiply_tmpThis.size) {
this_start = (short) (this.size - bnh.fnc_int_multiply_tmpThis.size);
other_start = 0;
len = bnh.fnc_int_multiply_tmpThis.size;
} else {
this_start = 0;
other_start = (short) (bnh.fnc_int_multiply_tmpThis.size - this.size);
len = this.size;
for (short i = 0; i < other_start; i++) {
if (bnh.fnc_int_multiply_tmpThis.value[i] != 0) {
ISOException.throwIt(ReturnCodes.SW_BIGNAT_INVALIDCOPYOTHER);
}
}
}
if (this_start > 0) {
Util.arrayFillNonAtomic(this.value, (short) 0, this_start, (byte) 0);
}
Util.arrayCopyNonAtomic(bnh.fnc_int_multiply_tmpThis.value, other_start, this.value, this_start, len);
if (bLocked) {
bLocked = false;
if (ERASE_ON_UNLOCK) {
erase();
}
} else {
ISOException.throwIt(ReturnCodes.SW_LOCK_NOTLOCKED);
}
if (bLocked) {
bLocked = false;
if (ERASE_ON_UNLOCK) {
erase();
}
} else {
ISOException.throwIt(ReturnCodes.SW_LOCK_NOTLOCKED);
}
} | public void multiply(Integer other) {
if (this.isPositive() && other.isNegative()) {
this.setSign((byte) 1);
} else if (this.isNegative() && other.isPositive()) {
this.setSign((byte) 1);
} else {
this.setSign((byte) 0);
}
if (!bLocked) {
bLocked = true;
if (ERASE_ON_LOCK) {
erase();
}
} else {
ISOException.throwIt(ReturnCodes.SW_LOCK_ALREADYLOCKED);
}
if (this.magnitude.length() < 0 || this.magnitude.length() > max_size) {
ISOException.throwIt(ReturnCodes.SW_BIGNAT_RESIZETOLONGER);
} else {
this.size = this.magnitude.length();
}
Util.arrayFillNonAtomic(value, (short) 0, this.size, (byte) 0);
bnh.fnc_int_multiply_mod.as_byte_array()[0] = (byte) 0x80;
if (!bLocked) {
bLocked = true;
if (ERASE_ON_LOCK) {
erase();
}
} else {
ISOException.throwIt(ReturnCodes.SW_LOCK_ALREADYLOCKED);
}
if (this.magnitude.length() < 0 || this.magnitude.length() > max_size) {
ISOException.throwIt(ReturnCodes.SW_BIGNAT_RESIZETOLONGER);
} else {
this.size = this.magnitude.length();
}
bnh.fnc_mod_mult_tmpThis.lock();
bnh.fnc_mod_mult_tmpThis.resize_to_max(false);
bnh.fnc_mod_mult_tmpThis.mult(this.getMagnitude(), other.getMagnitude());
bnh.fnc_mod_mult_tmpThis.mod(bnh.fnc_int_multiply_mod);
bnh.fnc_mod_mult_tmpThis.shrink();
this.clone(bnh.fnc_mod_mult_tmpThis);
bnh.fnc_mod_mult_tmpThis.unlock();
short this_start, other_start, len;
if (this.size >= bnh.fnc_int_multiply_tmpThis.size) {
this_start = (short) (this.size - bnh.fnc_int_multiply_tmpThis.size);
other_start = 0;
len = bnh.fnc_int_multiply_tmpThis.size;
} else {
this_start = 0;
other_start = (short) (bnh.fnc_int_multiply_tmpThis.size - this.size);
len = this.size;
for (short i = 0; i < other_start; i++) {
if (bnh.fnc_int_multiply_tmpThis.value[i] != 0) {
ISOException.throwIt(ReturnCodes.SW_BIGNAT_INVALIDCOPYOTHER);
}
}
}
if (this_start > 0) {
Util.arrayFillNonAtomic(this.value, (short) 0, this_start, (byte) 0);
}
Util.arrayCopyNonAtomic(bnh.fnc_int_multiply_tmpThis.value, other_start, this.value, this_start, len);
<DeepExtract>
if (bLocked) {
bLocked = false;
if (ERASE_ON_UNLOCK) {
erase();
}
} else {
ISOException.throwIt(ReturnCodes.SW_LOCK_NOTLOCKED);
}
</DeepExtract>
if (bLocked) {
bLocked = false;
if (ERASE_ON_UNLOCK) {
erase();
}
} else {
ISOException.throwIt(ReturnCodes.SW_LOCK_NOTLOCKED);
}
} | JCMathLib | positive | 439,867 |
public Criteria andOperatorAddressNotLike(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "operatorAddress" + " cannot be null");
}
criteria.add(new Criterion("operator_address not like", value));
return (Criteria) this;
} | public Criteria andOperatorAddressNotLike(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "operatorAddress" + " cannot be null");
}
criteria.add(new Criterion("operator_address not like", value));
</DeepExtract>
return (Criteria) this;
} | cloud | positive | 439,868 |
@Override
public boolean beginImportSession() {
Optional<ActionStatus> transition = model.getActionStatus().beginSecondary();
transition.ifPresent(s -> begin(ACTION_IMPORT, s));
return transition.isPresent();
} | @Override
public boolean beginImportSession() {
<DeepExtract>
Optional<ActionStatus> transition = model.getActionStatus().beginSecondary();
transition.ifPresent(s -> begin(ACTION_IMPORT, s));
return transition.isPresent();
</DeepExtract>
} | Santulator | positive | 439,869 |
public SnmpListener newListener(String address, int port, Mib mib, String providerName) {
if (closed.get()) {
throw new IllegalStateException("factory has been closed");
}
return getProvider(providerName).newListener(address, port, mib);
} | public SnmpListener newListener(String address, int port, Mib mib, String providerName) {
<DeepExtract>
if (closed.get()) {
throw new IllegalStateException("factory has been closed");
}
</DeepExtract>
return getProvider(providerName).newListener(address, port, mib);
} | tnm4j | positive | 439,872 |
@Test
public void setEncoderDoesNotThrowExceptionWhenV2TagDoesNotExist() {
ID3v1 id3v1Tag = new ID3v1TagForTesting();
ID3Wrapper wrapper = new ID3Wrapper(id3v1Tag, null);
this.encoder = "an encoder";
} | @Test
public void setEncoderDoesNotThrowExceptionWhenV2TagDoesNotExist() {
ID3v1 id3v1Tag = new ID3v1TagForTesting();
ID3Wrapper wrapper = new ID3Wrapper(id3v1Tag, null);
<DeepExtract>
this.encoder = "an encoder";
</DeepExtract>
} | mp3agic | positive | 439,873 |
public static IdentifierPath getColumnNameFromProperty(Member member) {
Column column = ((AnnotatedElement) getAnnotatedField(member)).getAnnotation(Column.class);
if (column != null) {
CharSequence cname = column.name();
if (Strings.isNullOrEmpty(cname))
cname = toDBNotation(getFieldName(getAnnotatedField(member)));
return new IdentifierPath.Resolved(cname, getAnnotatedField(member).getDeclaringClass(), getAnnotatedField(member).getName(), column.table());
}
JoinColumn join = ((AnnotatedElement) getAnnotatedField(member)).getAnnotation(JoinColumn.class);
if (join != null) {
CharSequence cname = join.name();
if (Strings.isNullOrEmpty(cname))
cname = toDBNotation(getFieldName(getAnnotatedField(member)));
return new IdentifierPath.Resolved(cname, getAnnotatedField(member).getDeclaringClass(), getAnnotatedField(member).getName(), join.table());
}
JoinColumns joins = ((AnnotatedElement) getAnnotatedField(member)).getAnnotation(JoinColumns.class);
if (joins != null)
return new IdentifierPath.MultiColumnIdentifierPath(getAnnotatedField(member).getName(), c -> getAssociation(getAnnotatedField(member), true), joins.value()[0].table());
MapsId mapsId = ((AnnotatedElement) getAnnotatedField(member)).getAnnotation(MapsId.class);
if (mapsId != null) {
Class<?> declaringClass = getAnnotatedField(member).getDeclaringClass();
List<ID> entityIds = getClassMeta(declaringClass).getIds();
String idPath = mapsId.value();
if (Strings.isNullOrEmpty(idPath)) {
return entityIds.size() == 1 ? new IdentifierPath.Resolved(entityIds.get(0).getColumn(), getAnnotatedField(member).getDeclaringClass(), getAnnotatedField(member).getName(), null) : new IdentifierPath.MultiColumnIdentifierPath(getAnnotatedField(member).getName(), c -> getAssociation(getAnnotatedField(member), true), null);
}
return new IdentifierPath.Resolved(entityIds.stream().filter(id -> isIDMapped(id, idPath)).findFirst().get().getColumn(), getAnnotatedField(member).getDeclaringClass(), getAnnotatedField(member).getName(), null);
}
return new IdentifierPath.Resolved(toDBNotation(getFieldName(getAnnotatedField(member))), getAnnotatedField(member).getDeclaringClass(), getAnnotatedField(member).getName(), null);
} | public static IdentifierPath getColumnNameFromProperty(Member member) {
<DeepExtract>
Column column = ((AnnotatedElement) getAnnotatedField(member)).getAnnotation(Column.class);
if (column != null) {
CharSequence cname = column.name();
if (Strings.isNullOrEmpty(cname))
cname = toDBNotation(getFieldName(getAnnotatedField(member)));
return new IdentifierPath.Resolved(cname, getAnnotatedField(member).getDeclaringClass(), getAnnotatedField(member).getName(), column.table());
}
JoinColumn join = ((AnnotatedElement) getAnnotatedField(member)).getAnnotation(JoinColumn.class);
if (join != null) {
CharSequence cname = join.name();
if (Strings.isNullOrEmpty(cname))
cname = toDBNotation(getFieldName(getAnnotatedField(member)));
return new IdentifierPath.Resolved(cname, getAnnotatedField(member).getDeclaringClass(), getAnnotatedField(member).getName(), join.table());
}
JoinColumns joins = ((AnnotatedElement) getAnnotatedField(member)).getAnnotation(JoinColumns.class);
if (joins != null)
return new IdentifierPath.MultiColumnIdentifierPath(getAnnotatedField(member).getName(), c -> getAssociation(getAnnotatedField(member), true), joins.value()[0].table());
MapsId mapsId = ((AnnotatedElement) getAnnotatedField(member)).getAnnotation(MapsId.class);
if (mapsId != null) {
Class<?> declaringClass = getAnnotatedField(member).getDeclaringClass();
List<ID> entityIds = getClassMeta(declaringClass).getIds();
String idPath = mapsId.value();
if (Strings.isNullOrEmpty(idPath)) {
return entityIds.size() == 1 ? new IdentifierPath.Resolved(entityIds.get(0).getColumn(), getAnnotatedField(member).getDeclaringClass(), getAnnotatedField(member).getName(), null) : new IdentifierPath.MultiColumnIdentifierPath(getAnnotatedField(member).getName(), c -> getAssociation(getAnnotatedField(member), true), null);
}
return new IdentifierPath.Resolved(entityIds.stream().filter(id -> isIDMapped(id, idPath)).findFirst().get().getColumn(), getAnnotatedField(member).getDeclaringClass(), getAnnotatedField(member).getName(), null);
}
return new IdentifierPath.Resolved(toDBNotation(getFieldName(getAnnotatedField(member))), getAnnotatedField(member).getDeclaringClass(), getAnnotatedField(member).getName(), null);
</DeepExtract>
} | FluentJPA | positive | 439,874 |
public CalendarView create() {
CalendarView calendarView = new CalendarView(P.mContext);
calendarView.mAttributes.put(Attr.weekHeaderBackgroundColor, weekHeaderBackgroundColor);
calendarView.mAttributes.put(Attr.weekHeaderOffsetDayBackgroundColor, weekHeaderOffsetDayBackgroundColor);
calendarView.mAttributes.put(Attr.currentDayTextColor, currentDayTextColor);
calendarView.mAttributes.put(Attr.selectedDayBorderColor, selectedItemBorderColor);
if (calendarView.mAttributes.get(Attr.selectedDayTextColor) == calendarView.mAttributes.get(Attr.dayTextColor))
calendarView.mAttributes.put(Attr.selectedDayTextColor, dayItemTextColor);
calendarView.mAttributes.put(Attr.selectedDayTextColor, dayItemSelectedTextColor);
calendarView.mAttributes.put(Attr.dayTextColor, dayItemTextColor);
calendarView.mAttributes.put(Attr.monthHeaderTextColor, monthHeaderTextColor);
calendarView.mAttributes.put(Attr.monthHeaderArrowsColor, monthArrowsColor);
mListener = P.onItemClickListener;
mObjectsByMonthMap.clear();
for (CalendarObject object : P.calendarObjectList) addCalendarObjectToSparseArray(object);
mCalendarPagerAdapter.notifyDataSetChanged();
return calendarView;
} | public CalendarView create() {
CalendarView calendarView = new CalendarView(P.mContext);
calendarView.mAttributes.put(Attr.weekHeaderBackgroundColor, weekHeaderBackgroundColor);
calendarView.mAttributes.put(Attr.weekHeaderOffsetDayBackgroundColor, weekHeaderOffsetDayBackgroundColor);
calendarView.mAttributes.put(Attr.currentDayTextColor, currentDayTextColor);
calendarView.mAttributes.put(Attr.selectedDayBorderColor, selectedItemBorderColor);
if (calendarView.mAttributes.get(Attr.selectedDayTextColor) == calendarView.mAttributes.get(Attr.dayTextColor))
calendarView.mAttributes.put(Attr.selectedDayTextColor, dayItemTextColor);
calendarView.mAttributes.put(Attr.selectedDayTextColor, dayItemSelectedTextColor);
calendarView.mAttributes.put(Attr.dayTextColor, dayItemTextColor);
calendarView.mAttributes.put(Attr.monthHeaderTextColor, monthHeaderTextColor);
calendarView.mAttributes.put(Attr.monthHeaderArrowsColor, monthArrowsColor);
mListener = P.onItemClickListener;
<DeepExtract>
mObjectsByMonthMap.clear();
for (CalendarObject object : P.calendarObjectList) addCalendarObjectToSparseArray(object);
mCalendarPagerAdapter.notifyDataSetChanged();
</DeepExtract>
return calendarView;
} | CalendarView-Widget | positive | 439,876 |
private String getPath() {
StringBuilder thisPath = new StringBuilder();
if (exhibitor.getRestPath() != null) {
if (!exhibitor.getRestPath().startsWith("/")) {
thisPath.append("/");
}
thisPath.append(exhibitor.getRestPath());
if (!exhibitor.getRestPath().endsWith("/")) {
thisPath.append("/");
}
} else {
thisPath.append("/");
}
thisPath.append(clusterResourcePath);
return "Result{" + "remoteResponse='" + remoteResponse + '\'' + ", errorMessage='" + errorMessage + '\'' + '}';
} | private String getPath() {
StringBuilder thisPath = new StringBuilder();
if (exhibitor.getRestPath() != null) {
if (!exhibitor.getRestPath().startsWith("/")) {
thisPath.append("/");
}
thisPath.append(exhibitor.getRestPath());
if (!exhibitor.getRestPath().endsWith("/")) {
thisPath.append("/");
}
} else {
thisPath.append("/");
}
thisPath.append(clusterResourcePath);
<DeepExtract>
return "Result{" + "remoteResponse='" + remoteResponse + '\'' + ", errorMessage='" + errorMessage + '\'' + '}';
</DeepExtract>
} | exhibitor | positive | 439,877 |
@Override
public Void visit(Relation relation) {
Document document = new Document();
new Field("class", "relation", Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS).accept(addVisitor);
new Field("relation.identity", String.valueOf(relation.getId()), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS).accept(addVisitor);
if (relation.getTags() != null) {
for (Map.Entry<String, String> tag : relation.getTags().entrySet()) {
document.add(new Field("tag.key", tag.getKey(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
document.add(new Field("tag.value", tag.getValue(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
document.add(new Field("tag.key_and_value", tag.getKey() + "=" + tag.getValue(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
}
}
try {
indexWriter.updateDocument(new Term("relation.identity", String.valueOf(relation.getId())), document);
} catch (IOException e) {
throw new RuntimeException(e);
}
return null;
} | @Override
public Void visit(Relation relation) {
Document document = new Document();
new Field("class", "relation", Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS).accept(addVisitor);
new Field("relation.identity", String.valueOf(relation.getId()), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS).accept(addVisitor);
<DeepExtract>
if (relation.getTags() != null) {
for (Map.Entry<String, String> tag : relation.getTags().entrySet()) {
document.add(new Field("tag.key", tag.getKey(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
document.add(new Field("tag.value", tag.getValue(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
document.add(new Field("tag.key_and_value", tag.getKey() + "=" + tag.getValue(), Field.Store.NO, Field.Index.NOT_ANALYZED_NO_NORMS));
}
}
</DeepExtract>
try {
indexWriter.updateDocument(new Term("relation.identity", String.valueOf(relation.getId())), document);
} catch (IOException e) {
throw new RuntimeException(e);
}
return null;
} | osm-common | positive | 439,878 |
@Test
@DisplayName("Check position auto close")
public void checkAutoClose() {
final PositionCreationResultDTO creationResult1 = strategy.createLongPosition(ETH_BTC, new BigDecimal("0.0001"), PositionRulesDTO.builder().stopGainPercentage(100f).build());
final long position1Id = creationResult1.getPosition().getUid();
assertEquals("ORDER00010", creationResult1.getPosition().getOpeningOrder().getOrderId());
final PositionCreationResultDTO creationResult2 = strategy.createLongPosition(ETH_BTC, new BigDecimal("0.0002"), PositionRulesDTO.builder().stopGainPercentage(100f).build());
final long position2Id = creationResult2.getPosition().getUid();
assertEquals("ORDER00020", creationResult2.getPosition().getOpeningOrder().getOrderId());
strategy.setAutoClose(position2Id, false);
await().untilAsserted(() -> {
orderFlux.update();
assertEquals(4, strategy.getPositionsUpdatesReceived().size());
});
PositionDTO p1;
final Optional<PositionDTO> p = positionService.getPositionByUid(position1Id);
if (p.isPresent()) {
p1 = p.get();
} else {
throw new NoSuchElementException("Position not found : " + position1Id);
}
assertEquals(OPENING, p1.getStatus());
assertTrue(p1.isAutoClose());
PositionDTO p2;
final Optional<PositionDTO> p = positionService.getPositionByUid(position2Id);
if (p.isPresent()) {
p2 = p.get();
} else {
throw new NoSuchElementException("Position not found : " + position2Id);
}
assertEquals(OPENING, p2.getStatus());
assertFalse(p2.isAutoClose());
tradeFlux.emitValue(TradeDTO.builder().tradeId("000001").type(BID).orderId("ORDER00010").currencyPair(ETH_BTC).amount(new CurrencyAmountDTO("0.0001", ETH_BTC.getBaseCurrency())).price(new CurrencyAmountDTO("0.2", ETH_BTC.getQuoteCurrency())).build());
await().untilAsserted(() -> assertEquals(OPENED, getPositionDTO(position1Id).getStatus()));
tradeFlux.emitValue(TradeDTO.builder().tradeId("000002").type(BID).orderId("ORDER00020").currencyPair(ETH_BTC).amount(new CurrencyAmountDTO("0.0002", ETH_BTC.getBaseCurrency())).price(new CurrencyAmountDTO("0.2", ETH_BTC.getQuoteCurrency())).build());
await().untilAsserted(() -> assertEquals(OPENED, getPositionDTO(position2Id).getStatus()));
tickerFlux.emitValue(TickerDTO.builder().currencyPair(ETH_BTC).last(new BigDecimal("1")).build());
await().untilAsserted(() -> assertEquals(CLOSING, getPositionDTO(position1Id).getStatus()));
assertEquals(OPENED, getPositionDTO(position2Id).getStatus());
} | @Test
@DisplayName("Check position auto close")
public void checkAutoClose() {
final PositionCreationResultDTO creationResult1 = strategy.createLongPosition(ETH_BTC, new BigDecimal("0.0001"), PositionRulesDTO.builder().stopGainPercentage(100f).build());
final long position1Id = creationResult1.getPosition().getUid();
assertEquals("ORDER00010", creationResult1.getPosition().getOpeningOrder().getOrderId());
final PositionCreationResultDTO creationResult2 = strategy.createLongPosition(ETH_BTC, new BigDecimal("0.0002"), PositionRulesDTO.builder().stopGainPercentage(100f).build());
final long position2Id = creationResult2.getPosition().getUid();
assertEquals("ORDER00020", creationResult2.getPosition().getOpeningOrder().getOrderId());
strategy.setAutoClose(position2Id, false);
await().untilAsserted(() -> {
orderFlux.update();
assertEquals(4, strategy.getPositionsUpdatesReceived().size());
});
PositionDTO p1;
final Optional<PositionDTO> p = positionService.getPositionByUid(position1Id);
if (p.isPresent()) {
p1 = p.get();
} else {
throw new NoSuchElementException("Position not found : " + position1Id);
}
assertEquals(OPENING, p1.getStatus());
assertTrue(p1.isAutoClose());
<DeepExtract>
PositionDTO p2;
final Optional<PositionDTO> p = positionService.getPositionByUid(position2Id);
if (p.isPresent()) {
p2 = p.get();
} else {
throw new NoSuchElementException("Position not found : " + position2Id);
}
</DeepExtract>
assertEquals(OPENING, p2.getStatus());
assertFalse(p2.isAutoClose());
tradeFlux.emitValue(TradeDTO.builder().tradeId("000001").type(BID).orderId("ORDER00010").currencyPair(ETH_BTC).amount(new CurrencyAmountDTO("0.0001", ETH_BTC.getBaseCurrency())).price(new CurrencyAmountDTO("0.2", ETH_BTC.getQuoteCurrency())).build());
await().untilAsserted(() -> assertEquals(OPENED, getPositionDTO(position1Id).getStatus()));
tradeFlux.emitValue(TradeDTO.builder().tradeId("000002").type(BID).orderId("ORDER00020").currencyPair(ETH_BTC).amount(new CurrencyAmountDTO("0.0002", ETH_BTC.getBaseCurrency())).price(new CurrencyAmountDTO("0.2", ETH_BTC.getQuoteCurrency())).build());
await().untilAsserted(() -> assertEquals(OPENED, getPositionDTO(position2Id).getStatus()));
tickerFlux.emitValue(TickerDTO.builder().currencyPair(ETH_BTC).last(new BigDecimal("1")).build());
await().untilAsserted(() -> assertEquals(CLOSING, getPositionDTO(position1Id).getStatus()));
assertEquals(OPENED, getPositionDTO(position2Id).getStatus());
} | cassandre-trading-bot | positive | 439,881 |
public static String getModuleSupport(String packageName) {
String[] projection = new String[] { ModulesColumns.SUPPORT };
String where = ModulesColumns.PKGNAME + " = ?";
String[] whereArgs = new String[] { packageName };
Cursor c = sDb.query(ModulesColumns.TABLE_NAME, projection, where, whereArgs, null, null, null, "1");
if (c.moveToFirst()) {
String result = c.getString(c.getColumnIndexOrThrow(ModulesColumns.SUPPORT));
c.close();
return result;
} else {
c.close();
throw new RowNotFoundException("Could not find " + ModulesColumns.TABLE_NAME + "." + ModulesColumns.PKGNAME + " with value '" + packageName + "'");
}
} | public static String getModuleSupport(String packageName) {
<DeepExtract>
String[] projection = new String[] { ModulesColumns.SUPPORT };
String where = ModulesColumns.PKGNAME + " = ?";
String[] whereArgs = new String[] { packageName };
Cursor c = sDb.query(ModulesColumns.TABLE_NAME, projection, where, whereArgs, null, null, null, "1");
if (c.moveToFirst()) {
String result = c.getString(c.getColumnIndexOrThrow(ModulesColumns.SUPPORT));
c.close();
return result;
} else {
c.close();
throw new RowNotFoundException("Could not find " + ModulesColumns.TABLE_NAME + "." + ModulesColumns.PKGNAME + " with value '" + packageName + "'");
}
</DeepExtract>
} | EdXposedManager | positive | 439,882 |
public Object apply2(Object string, Object k) {
int n;
if (k instanceof Number)
n = ((Number) k).intValue();
throw new SchemeException("Expected a number, got " + ReadEvalPrint.write(k));
if (string instanceof String)
return new Character(((String) string).charAt(n));
return ((Character[]) string)[n];
} | public Object apply2(Object string, Object k) {
<DeepExtract>
int n;
if (k instanceof Number)
n = ((Number) k).intValue();
throw new SchemeException("Expected a number, got " + ReadEvalPrint.write(k));
</DeepExtract>
if (string instanceof String)
return new Character(((String) string).charAt(n));
return ((Character[]) string)[n];
} | programming-for-the-jvm | positive | 439,885 |
@Override
public DriveFileQueryBuilder trashed(final boolean trashed) {
qTerms.add(TRASHED + EQ + trashed);
return this;
} | @Override
public DriveFileQueryBuilder trashed(final boolean trashed) {
<DeepExtract>
qTerms.add(TRASHED + EQ + trashed);
return this;
</DeepExtract>
} | spring-social-google | positive | 439,886 |
@Override
public void run() {
_messageBoxUI.setVisible(false);
_mapMgr.loadMap(MapFactory.MapType.TOP_WORLD);
_mapMgr.disableCurrentmapMusic();
_camera.position.set(50, 30, 0f);
_isCameraFixed = true;
_animBlackSmith.setPosition(50, 30);
_animInnKeeper.setPosition(52, 30);
_animMage.setPosition(50, 28);
_animFire.setPosition(52, 28);
_animFire.setVisible(true);
} | @Override
public void run() {
_messageBoxUI.setVisible(false);
_mapMgr.loadMap(MapFactory.MapType.TOP_WORLD);
_mapMgr.disableCurrentmapMusic();
<DeepExtract>
_camera.position.set(50, 30, 0f);
_isCameraFixed = true;
</DeepExtract>
_animBlackSmith.setPosition(50, 30);
_animInnKeeper.setPosition(52, 30);
_animMage.setPosition(50, 28);
_animFire.setPosition(52, 28);
_animFire.setVisible(true);
} | BludBourne | positive | 439,887 |
public double m(double a, double b, double sigma1, double sigma2, double t) {
double term1;
throw new UnsupportedOperationException("Not yet implemented");
double term2;
throw new UnsupportedOperationException("Not yet implemented");
return Bivnorm.bivar_params.evalArgs(-term1, -term2, rho);
} | public double m(double a, double b, double sigma1, double sigma2, double t) {
double term1;
throw new UnsupportedOperationException("Not yet implemented");
double term2;
throw new UnsupportedOperationException("Not yet implemented");
<DeepExtract>
return Bivnorm.bivar_params.evalArgs(-term1, -term2, rho);
</DeepExtract>
} | maygard | positive | 439,889 |
@Override
public void run() {
timer.timeStart = SystemClock.uptimeMillis();
timer.count();
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
int vi = false ? View.VISIBLE : View.GONE;
tvScramble.setVisibility(vi);
if (showStat)
tvStat.setVisibility(vi);
btnScramble.setVisibility(vi);
if (currentScramble.getScrambleListSize() > 1) {
btnLeft.setVisibility(vi);
btnRight.setVisibility(vi);
}
toolbar.setVisibility(vi);
if (showImage)
scrambleView.setVisibility(vi);
} | @Override
public void run() {
timer.timeStart = SystemClock.uptimeMillis();
timer.count();
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
<DeepExtract>
int vi = false ? View.VISIBLE : View.GONE;
tvScramble.setVisibility(vi);
if (showStat)
tvStat.setVisibility(vi);
btnScramble.setVisibility(vi);
if (currentScramble.getScrambleListSize() > 1) {
btnLeft.setVisibility(vi);
btnRight.setVisibility(vi);
}
toolbar.setVisibility(vi);
if (showImage)
scrambleView.setVisibility(vi);
</DeepExtract>
} | DCTimer-Android | positive | 439,890 |
public Criteria andN_dateNotEqualTo(Date value) {
if (value == null) {
throw new RuntimeException("Value for " + "n_date" + " cannot be null");
}
criteria.add(new Criterion("n_date <>", value));
return (Criteria) this;
} | public Criteria andN_dateNotEqualTo(Date value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "n_date" + " cannot be null");
}
criteria.add(new Criterion("n_date <>", value));
</DeepExtract>
return (Criteria) this;
} | BaiChengNews | positive | 439,892 |
public void emitBranch(Cond condition, JavaKind type, BlockStartInstr block) {
if (TraceLIRGeneration) {
Logger.logf("{}", new BranchInstr(condition, type, block).toString());
}
lir.appendLirInstr(currentBlockId, new BranchInstr(condition, type, block));
} | public void emitBranch(Cond condition, JavaKind type, BlockStartInstr block) {
<DeepExtract>
if (TraceLIRGeneration) {
Logger.logf("{}", new BranchInstr(condition, type, block).toString());
}
lir.appendLirInstr(currentBlockId, new BranchInstr(condition, type, block));
</DeepExtract>
} | yarrow | positive | 439,894 |
@Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
String current = states.get(id, null);
states.put(id, current == null ? "SUCCESS" : current + "," + "SUCCESS");
clearOutputs();
for (int i = 0; i < states.size(); i++) {
debugResponse(LOG_TAG, String.format("%d (from %d): %s", states.keyAt(i), getCounter(), states.get(states.keyAt(i))));
}
} | @Override
public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
<DeepExtract>
String current = states.get(id, null);
states.put(id, current == null ? "SUCCESS" : current + "," + "SUCCESS");
clearOutputs();
for (int i = 0; i < states.size(); i++) {
debugResponse(LOG_TAG, String.format("%d (from %d): %s", states.keyAt(i), getCounter(), states.get(states.keyAt(i))));
}
</DeepExtract>
} | android-http-library-analyze | positive | 439,895 |
public void writeDifficulty(int index, Difficulty difficulty) {
Enum<?> enumConstant = EnumUtil.valueByIndex(NMSUtils.enumDifficultyClass, difficulty.ordinal());
try {
write(enumConstant.getClass(), index, enumConstant);
} catch (WrapperFieldNotFoundException ex) {
write(enumConstant.getDeclaringClass(), index, enumConstant);
}
} | public void writeDifficulty(int index, Difficulty difficulty) {
Enum<?> enumConstant = EnumUtil.valueByIndex(NMSUtils.enumDifficultyClass, difficulty.ordinal());
<DeepExtract>
try {
write(enumConstant.getClass(), index, enumConstant);
} catch (WrapperFieldNotFoundException ex) {
write(enumConstant.getDeclaringClass(), index, enumConstant);
}
</DeepExtract>
} | packetevents | positive | 439,896 |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_starred);
getActivityHelper().setupActionBar(getTitle(), 0);
mTabHost = (TabHost) findViewById(android.R.id.tabhost);
mTabWidget = (TabWidget) findViewById(android.R.id.tabs);
mTabHost.setup();
FrameLayout fragmentContainer = new FrameLayout(this);
fragmentContainer.setId(R.id.fragment_sessions);
fragmentContainer.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
((ViewGroup) findViewById(android.R.id.tabcontent)).addView(fragmentContainer);
final Intent intent = new Intent(Intent.ACTION_VIEW, Sessions.CONTENT_STARRED_URI);
final FragmentManager fm = getSupportFragmentManager();
mSessionsFragment = (SessionsFragment) fm.findFragmentByTag("sessions");
if (mSessionsFragment == null) {
mSessionsFragment = new SessionsFragment();
mSessionsFragment.setArguments(intentToFragmentArguments(intent));
fm.beginTransaction().add(R.id.fragment_sessions, mSessionsFragment, "sessions").commit();
}
mTabHost.addTab(mTabHost.newTabSpec(TAG_SESSIONS).setIndicator(buildIndicator(R.string.starred_sessions)).setContent(R.id.fragment_sessions));
FrameLayout fragmentContainer = new FrameLayout(this);
fragmentContainer.setId(R.id.fragment_vendors);
fragmentContainer.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
((ViewGroup) findViewById(android.R.id.tabcontent)).addView(fragmentContainer);
final Intent intent = new Intent(Intent.ACTION_VIEW, Vendors.CONTENT_STARRED_URI);
final FragmentManager fm = getSupportFragmentManager();
mVendorsFragment = (VendorsFragment) fm.findFragmentByTag("vendors");
if (mVendorsFragment == null) {
mVendorsFragment = new VendorsFragment();
mVendorsFragment.setArguments(intentToFragmentArguments(intent));
fm.beginTransaction().add(R.id.fragment_vendors, mVendorsFragment, "vendors").commit();
}
mTabHost.addTab(mTabHost.newTabSpec(TAG_VENDORS).setIndicator(buildIndicator(R.string.starred_vendors)).setContent(R.id.fragment_vendors));
} | @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_starred);
getActivityHelper().setupActionBar(getTitle(), 0);
mTabHost = (TabHost) findViewById(android.R.id.tabhost);
mTabWidget = (TabWidget) findViewById(android.R.id.tabs);
mTabHost.setup();
FrameLayout fragmentContainer = new FrameLayout(this);
fragmentContainer.setId(R.id.fragment_sessions);
fragmentContainer.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
((ViewGroup) findViewById(android.R.id.tabcontent)).addView(fragmentContainer);
final Intent intent = new Intent(Intent.ACTION_VIEW, Sessions.CONTENT_STARRED_URI);
final FragmentManager fm = getSupportFragmentManager();
mSessionsFragment = (SessionsFragment) fm.findFragmentByTag("sessions");
if (mSessionsFragment == null) {
mSessionsFragment = new SessionsFragment();
mSessionsFragment.setArguments(intentToFragmentArguments(intent));
fm.beginTransaction().add(R.id.fragment_sessions, mSessionsFragment, "sessions").commit();
}
mTabHost.addTab(mTabHost.newTabSpec(TAG_SESSIONS).setIndicator(buildIndicator(R.string.starred_sessions)).setContent(R.id.fragment_sessions));
<DeepExtract>
FrameLayout fragmentContainer = new FrameLayout(this);
fragmentContainer.setId(R.id.fragment_vendors);
fragmentContainer.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT));
((ViewGroup) findViewById(android.R.id.tabcontent)).addView(fragmentContainer);
final Intent intent = new Intent(Intent.ACTION_VIEW, Vendors.CONTENT_STARRED_URI);
final FragmentManager fm = getSupportFragmentManager();
mVendorsFragment = (VendorsFragment) fm.findFragmentByTag("vendors");
if (mVendorsFragment == null) {
mVendorsFragment = new VendorsFragment();
mVendorsFragment.setArguments(intentToFragmentArguments(intent));
fm.beginTransaction().add(R.id.fragment_vendors, mVendorsFragment, "vendors").commit();
}
mTabHost.addTab(mTabHost.newTabSpec(TAG_VENDORS).setIndicator(buildIndicator(R.string.starred_vendors)).setContent(R.id.fragment_vendors));
</DeepExtract>
} | iosched | positive | 439,897 |
private final int jjStartNfaWithStates_0(int pos, int kind, int state) {
jjmatchedKind = kind;
jjmatchedPos = pos;
try {
curChar = input_stream.readChar();
} catch (java.io.IOException e) {
return pos + 1;
}
int[] nextStates;
int startsAt = 0;
jjnewStateCnt = 1;
int i = 1;
jjstateSet[0] = state;
int j, kind = 0x7fffffff;
for (; ; ) {
if (++jjround == 0x7fffffff)
ReInitRounds();
if (curChar < 64) {
long l = 1L << curChar;
MatchLoop: do {
switch(jjstateSet[--i]) {
case 0:
if ((0xffffffff00002600L & l) != 0L)
kind = 79;
break;
default:
break;
}
} while (i != startsAt);
} else if (curChar < 128) {
long l = 1L << (curChar & 077);
MatchLoop: do {
switch(jjstateSet[--i]) {
case 0:
kind = 79;
break;
default:
break;
}
} while (i != startsAt);
} else {
int hiByte = (int) (curChar >> 8);
int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6;
long l2 = 1L << (curChar & 077);
MatchLoop: do {
switch(jjstateSet[--i]) {
case 0:
if (jjCanMove_3(hiByte, i1, i2, l1, l2) && kind > 79)
kind = 79;
break;
default:
break;
}
} while (i != startsAt);
}
if (kind != 0x7fffffff) {
jjmatchedKind = kind;
jjmatchedPos = pos + 1;
kind = 0x7fffffff;
}
++pos + 1;
if ((i = jjnewStateCnt) == (startsAt = 1 - (jjnewStateCnt = startsAt)))
return pos + 1;
try {
curChar = input_stream.readChar();
} catch (java.io.IOException e) {
return pos + 1;
}
}
} | private final int jjStartNfaWithStates_0(int pos, int kind, int state) {
jjmatchedKind = kind;
jjmatchedPos = pos;
try {
curChar = input_stream.readChar();
} catch (java.io.IOException e) {
return pos + 1;
}
<DeepExtract>
int[] nextStates;
int startsAt = 0;
jjnewStateCnt = 1;
int i = 1;
jjstateSet[0] = state;
int j, kind = 0x7fffffff;
for (; ; ) {
if (++jjround == 0x7fffffff)
ReInitRounds();
if (curChar < 64) {
long l = 1L << curChar;
MatchLoop: do {
switch(jjstateSet[--i]) {
case 0:
if ((0xffffffff00002600L & l) != 0L)
kind = 79;
break;
default:
break;
}
} while (i != startsAt);
} else if (curChar < 128) {
long l = 1L << (curChar & 077);
MatchLoop: do {
switch(jjstateSet[--i]) {
case 0:
kind = 79;
break;
default:
break;
}
} while (i != startsAt);
} else {
int hiByte = (int) (curChar >> 8);
int i1 = hiByte >> 6;
long l1 = 1L << (hiByte & 077);
int i2 = (curChar & 0xff) >> 6;
long l2 = 1L << (curChar & 077);
MatchLoop: do {
switch(jjstateSet[--i]) {
case 0:
if (jjCanMove_3(hiByte, i1, i2, l1, l2) && kind > 79)
kind = 79;
break;
default:
break;
}
} while (i != startsAt);
}
if (kind != 0x7fffffff) {
jjmatchedKind = kind;
jjmatchedPos = pos + 1;
kind = 0x7fffffff;
}
++pos + 1;
if ((i = jjnewStateCnt) == (startsAt = 1 - (jjnewStateCnt = startsAt)))
return pos + 1;
try {
curChar = input_stream.readChar();
} catch (java.io.IOException e) {
return pos + 1;
}
}
</DeepExtract>
} | dmgextractor | positive | 439,898 |
private void initUI() {
tfScreen.setHorizontalAlignment(JTextField.RIGHT);
JButton btnBackspace = new JButton("Backspace");
btnBackspace.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doProcessBackspace();
}
});
JButton btnReset = new JButton("C");
btnReset.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doReset();
}
});
JPanel pnGridPanel = new JPanel(new GridLayout(1, 2, 8, 8));
pnGridPanel.add(btnBackspace);
pnGridPanel.add(btnReset);
setLayout(new GridBagLayout());
JButton btnSwapSign = new SquareButton("+/-");
btnSwapSign.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doSwapSign();
}
});
add(tfScreen, new GridBagConstraints(0, 0, 5, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(pnGridPanel, new GridBagConstraints(0, 1, 5, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('7'), new GridBagConstraints(0, 2, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('8'), new GridBagConstraints(1, 2, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('9'), new GridBagConstraints(2, 2, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new OperatorButton(Operator.DIVISION, "/"), new GridBagConstraints(3, 2, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new OperatorButton(Operator.INVERSE, "1/x"), new GridBagConstraints(4, 2, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('4'), new GridBagConstraints(0, 3, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('5'), new GridBagConstraints(1, 3, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('6'), new GridBagConstraints(2, 3, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new OperatorButton(Operator.MULTIPLICATION, "*"), new GridBagConstraints(3, 3, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new OperatorButton(Operator.SQRT, "sqrt"), new GridBagConstraints(4, 3, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('1'), new GridBagConstraints(0, 4, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('2'), new GridBagConstraints(1, 4, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('3'), new GridBagConstraints(2, 4, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new OperatorButton(Operator.SUBTRACTION, "-"), new GridBagConstraints(3, 4, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('0'), new GridBagConstraints(0, 5, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(btnSwapSign, new GridBagConstraints(1, 5, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton(DECIMAL_SEPARATOR), new GridBagConstraints(2, 5, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new OperatorButton(Operator.ADDITION, "+"), new GridBagConstraints(3, 5, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new OperatorButton(Operator.EQUALS, "="), new GridBagConstraints(4, 5, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
this.setFocusable(false);
if (this instanceof Container) {
for (Component c : ((Container) this).getComponents()) {
resetFocusable(c);
}
}
setFocusable(true);
} | private void initUI() {
tfScreen.setHorizontalAlignment(JTextField.RIGHT);
JButton btnBackspace = new JButton("Backspace");
btnBackspace.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doProcessBackspace();
}
});
JButton btnReset = new JButton("C");
btnReset.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doReset();
}
});
JPanel pnGridPanel = new JPanel(new GridLayout(1, 2, 8, 8));
pnGridPanel.add(btnBackspace);
pnGridPanel.add(btnReset);
setLayout(new GridBagLayout());
JButton btnSwapSign = new SquareButton("+/-");
btnSwapSign.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
doSwapSign();
}
});
add(tfScreen, new GridBagConstraints(0, 0, 5, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(pnGridPanel, new GridBagConstraints(0, 1, 5, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('7'), new GridBagConstraints(0, 2, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('8'), new GridBagConstraints(1, 2, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('9'), new GridBagConstraints(2, 2, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new OperatorButton(Operator.DIVISION, "/"), new GridBagConstraints(3, 2, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new OperatorButton(Operator.INVERSE, "1/x"), new GridBagConstraints(4, 2, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('4'), new GridBagConstraints(0, 3, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('5'), new GridBagConstraints(1, 3, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('6'), new GridBagConstraints(2, 3, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new OperatorButton(Operator.MULTIPLICATION, "*"), new GridBagConstraints(3, 3, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new OperatorButton(Operator.SQRT, "sqrt"), new GridBagConstraints(4, 3, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('1'), new GridBagConstraints(0, 4, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('2'), new GridBagConstraints(1, 4, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('3'), new GridBagConstraints(2, 4, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new OperatorButton(Operator.SUBTRACTION, "-"), new GridBagConstraints(3, 4, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton('0'), new GridBagConstraints(0, 5, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(btnSwapSign, new GridBagConstraints(1, 5, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new CharButton(DECIMAL_SEPARATOR), new GridBagConstraints(2, 5, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new OperatorButton(Operator.ADDITION, "+"), new GridBagConstraints(3, 5, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
add(new OperatorButton(Operator.EQUALS, "="), new GridBagConstraints(4, 5, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(4, 4, 4, 4), 0, 0));
<DeepExtract>
this.setFocusable(false);
if (this instanceof Container) {
for (Component c : ((Container) this).getComponents()) {
resetFocusable(c);
}
}
</DeepExtract>
setFocusable(true);
} | swingset3 | positive | 439,899 |
@Test
public void capsuleIntTest() {
Theme theme = new Theme();
Chunk c = theme.makeChunk();
c.append("{$user_age} {$x.user_age} {$y.user_age}");
OldThing userA = new OldThing("Bob", 27, true);
c.addData(userA);
c.addData(userA, "y");
c.set("x", userA);
this.age = 28;
assertEquals("27 28 28", c.toString());
} | @Test
public void capsuleIntTest() {
Theme theme = new Theme();
Chunk c = theme.makeChunk();
c.append("{$user_age} {$x.user_age} {$y.user_age}");
OldThing userA = new OldThing("Bob", 27, true);
c.addData(userA);
c.addData(userA, "y");
c.set("x", userA);
<DeepExtract>
this.age = 28;
</DeepExtract>
assertEquals("27 28 28", c.toString());
} | chunk-templates | positive | 439,900 |
@Override
public void visitInvokeDynamicInsn(final String name, final String descriptor, final Handle bootstrapMethodHandle, final Object... bootstrapMethodArguments) {
super.visitInvokeDynamicInsn(name, descriptor, bootstrapMethodHandle, bootstrapMethodArguments);
if (this.locals == null) {
labels = null;
return;
}
int size = stack.size();
int end = size - descriptor;
for (int i = size - 1; i >= end; --i) {
stack.remove(i);
}
String descriptor = descriptor.charAt(0) == '(' ? Type.getReturnType(descriptor).getDescriptor() : descriptor;
switch(descriptor.charAt(0)) {
case 'V':
return;
case 'Z':
case 'C':
case 'B':
case 'S':
case 'I':
push(Opcodes.INTEGER);
return;
case 'F':
push(Opcodes.FLOAT);
return;
case 'J':
push(Opcodes.LONG);
push(Opcodes.TOP);
return;
case 'D':
push(Opcodes.DOUBLE);
push(Opcodes.TOP);
return;
case '[':
push(descriptor);
break;
case 'L':
push(descriptor.substring(1, descriptor.length() - 1));
break;
default:
throw new AssertionError();
}
labels = null;
} | @Override
public void visitInvokeDynamicInsn(final String name, final String descriptor, final Handle bootstrapMethodHandle, final Object... bootstrapMethodArguments) {
super.visitInvokeDynamicInsn(name, descriptor, bootstrapMethodHandle, bootstrapMethodArguments);
if (this.locals == null) {
labels = null;
return;
}
int size = stack.size();
int end = size - descriptor;
for (int i = size - 1; i >= end; --i) {
stack.remove(i);
}
<DeepExtract>
String descriptor = descriptor.charAt(0) == '(' ? Type.getReturnType(descriptor).getDescriptor() : descriptor;
switch(descriptor.charAt(0)) {
case 'V':
return;
case 'Z':
case 'C':
case 'B':
case 'S':
case 'I':
push(Opcodes.INTEGER);
return;
case 'F':
push(Opcodes.FLOAT);
return;
case 'J':
push(Opcodes.LONG);
push(Opcodes.TOP);
return;
case 'D':
push(Opcodes.DOUBLE);
push(Opcodes.TOP);
return;
case '[':
push(descriptor);
break;
case 'L':
push(descriptor.substring(1, descriptor.length() - 1));
break;
default:
throw new AssertionError();
}
</DeepExtract>
labels = null;
} | LunarClientSpoofer | positive | 439,901 |
@Override
public UserFeed getUserFollowedByListNextPage(String userId, String cursor) throws InstagramException {
Preconditions.checkEmptyString(userId, USER_ID_CANNOT_BE_NULL_OR_EMPTY);
Map<String, String> params = new HashMap<String, String>(1);
if (cursor != null)
params.put("cursor", cursor);
String apiMethod = format(Methods.USERS_ID_FOLLOWED_BY, userId);
return createInstagramObject(Verbs.GET, UserFeed.class, apiMethod, apiMethod, params);
} | @Override
public UserFeed getUserFollowedByListNextPage(String userId, String cursor) throws InstagramException {
Preconditions.checkEmptyString(userId, USER_ID_CANNOT_BE_NULL_OR_EMPTY);
Map<String, String> params = new HashMap<String, String>(1);
if (cursor != null)
params.put("cursor", cursor);
String apiMethod = format(Methods.USERS_ID_FOLLOWED_BY, userId);
<DeepExtract>
return createInstagramObject(Verbs.GET, UserFeed.class, apiMethod, apiMethod, params);
</DeepExtract>
} | jInstagram | positive | 439,902 |
@Test
public void zadd() throws Exception {
String key = keyPrefix + "_ZADD";
assertEquals(1, executeSingleIntegerResult("ZADD " + key + " 1 \"one\""));
execute("DEL " + key);
} | @Test
public void zadd() throws Exception {
String key = keyPrefix + "_ZADD";
assertEquals(1, executeSingleIntegerResult("ZADD " + key + " 1 \"one\""));
<DeepExtract>
execute("DEL " + key);
</DeepExtract>
} | jdbc-redis | positive | 439,904 |
private void startGdx() {
canvas = config.getCanvas();
graphics = new TeaVMGraphics(canvas, config);
files = new TeaVMFiles();
audio = new TeaVMAudio();
input = new TeaVMInput(canvas);
Gdx.app = this;
Gdx.graphics = graphics;
Gdx.gl = graphics.getGL20();
Gdx.gl20 = graphics.getGL20();
Gdx.files = files;
Gdx.audio = audio;
Gdx.input = input;
listener.create();
listener.resize(canvas.getWidth(), canvas.getHeight());
window.setTimeout(() -> step(), 10);
} | private void startGdx() {
canvas = config.getCanvas();
graphics = new TeaVMGraphics(canvas, config);
files = new TeaVMFiles();
audio = new TeaVMAudio();
input = new TeaVMInput(canvas);
Gdx.app = this;
Gdx.graphics = graphics;
Gdx.gl = graphics.getGL20();
Gdx.gl20 = graphics.getGL20();
Gdx.files = files;
Gdx.audio = audio;
Gdx.input = input;
listener.create();
listener.resize(canvas.getWidth(), canvas.getHeight());
<DeepExtract>
window.setTimeout(() -> step(), 10);
</DeepExtract>
} | teavm-libgdx | positive | 439,905 |
@Test
public void testBoundMaxRowsSuspended() {
withConnectionSync(origConn -> c -> c.prepare("SELECT * FROM generate_series(1, $1)").thenCompose(pConn -> pConn.bindReusable("testBoundMaxRowsSuspended-bound", 4)).thenCompose(bConn -> bConn.execute(2)).thenCompose(bConn -> bConn.done()).apply(origConn).handle((__, ex) -> {
if (ex != null)
log.log(Level.FINE, "Ignoring error", ex);
return origConn;
}).thenCompose(Connection.Started::fullReset).thenCompose(conn -> conn.simpleQueryRows("SELECT 'test'")).thenAccept(rows -> Assert.assertEquals("test", RowReader.DEFAULT.get(rows.get(0), 0, String.class))));
withConnectionSync(origConn -> c -> c.prepare("SELECT * FROM generate_series(1, $1)").thenCompose(pConn -> pConn.bindReusable("testBoundMaxRowsSuspended-bound", 4)).thenCompose(bConn -> bConn.execute(2)).thenCompose(bConn -> bConn.done()).apply(origConn).handle((__, ex) -> {
if (ex != null)
log.log(Level.FINE, "Ignoring error", ex);
return origConn;
}).thenCompose(Connection.Started::fullReset).thenCompose(conn -> conn.simpleQueryExec("SELECT * FROM not_really_there")).handle((__, ex) -> {
Assert.assertTrue(ex.getMessage().contains("\"not_really_there\""));
return null;
}));
} | @Test
public void testBoundMaxRowsSuspended() {
<DeepExtract>
withConnectionSync(origConn -> c -> c.prepare("SELECT * FROM generate_series(1, $1)").thenCompose(pConn -> pConn.bindReusable("testBoundMaxRowsSuspended-bound", 4)).thenCompose(bConn -> bConn.execute(2)).thenCompose(bConn -> bConn.done()).apply(origConn).handle((__, ex) -> {
if (ex != null)
log.log(Level.FINE, "Ignoring error", ex);
return origConn;
}).thenCompose(Connection.Started::fullReset).thenCompose(conn -> conn.simpleQueryRows("SELECT 'test'")).thenAccept(rows -> Assert.assertEquals("test", RowReader.DEFAULT.get(rows.get(0), 0, String.class))));
withConnectionSync(origConn -> c -> c.prepare("SELECT * FROM generate_series(1, $1)").thenCompose(pConn -> pConn.bindReusable("testBoundMaxRowsSuspended-bound", 4)).thenCompose(bConn -> bConn.execute(2)).thenCompose(bConn -> bConn.done()).apply(origConn).handle((__, ex) -> {
if (ex != null)
log.log(Level.FINE, "Ignoring error", ex);
return origConn;
}).thenCompose(Connection.Started::fullReset).thenCompose(conn -> conn.simpleQueryExec("SELECT * FROM not_really_there")).handle((__, ex) -> {
Assert.assertTrue(ex.getMessage().contains("\"not_really_there\""));
return null;
}));
</DeepExtract>
} | pgnio | positive | 439,906 |
private Token nextNumber(char first) {
StringBuilder sb = new StringBuilder();
int base;
if (first > '9' || first < '0') {
base = -1;
}
if (first != '0') {
base = 10;
}
switch(peek()) {
case 'x':
case 'X':
read();
base = 16;
case 'b':
case 'B':
read();
base = 2;
default:
base = 8;
}
if (base != 16 && base != 2) {
sb.append(first);
}
while (peek() > -1 && isValidChar((char) peek(), base)) {
if (!isValidChar((char) peek(), base)) {
throw new RuntimeException("Illegal digit: " + (char) peek());
}
sb.append((char) read());
}
if (peek() == '.') {
sb.append((char) read());
int peek = peek();
while (peek > -1 && Chars.isDigit((char) peek)) {
sb.append((char) read());
peek = peek();
}
}
if (peek() == 'e') {
sb.append((char) read());
if (peek() == '+' || peek() == '-') {
sb.append((char) read());
}
while (Chars.isDigit((char) peek())) {
sb.append((char) read());
}
}
Class<? extends Number> type;
switch(peek()) {
case 'f':
case 'F':
read();
type = Float.class;
case 'd':
case 'D':
read();
type = Double.class;
case 'l':
case 'L':
read();
type = Long.class;
default:
type = null;
}
Number num;
if (base != 10 && (sb.toString().contains(".") || sb.toString().contains("e"))) {
throw new RuntimeException("Illegal base prefix");
}
Number result;
if (sb.toString().contains(".") || sb.toString().contains("e")) {
result = Double.valueOf(sb.toString());
} else {
Long converted = Long.parseLong(sb.toString(), base);
if (converted <= Integer.MAX_VALUE && converted >= Integer.MIN_VALUE) {
result = converted.intValue();
} else {
result = converted;
}
}
if (type == Double.class) {
num = result.doubleValue();
} else if (type == Float.class) {
num = result.floatValue();
} else if (type == Long.class) {
if (result.getClass() == Long.class || result.getClass() == Integer.class) {
num = result.longValue();
} else {
throw new RuntimeException("Illegal long suffix");
}
} else {
num = result;
}
return new NumberToken(num, advanceRecorder(), currentPosition);
} | private Token nextNumber(char first) {
StringBuilder sb = new StringBuilder();
int base;
if (first > '9' || first < '0') {
base = -1;
}
if (first != '0') {
base = 10;
}
switch(peek()) {
case 'x':
case 'X':
read();
base = 16;
case 'b':
case 'B':
read();
base = 2;
default:
base = 8;
}
if (base != 16 && base != 2) {
sb.append(first);
}
while (peek() > -1 && isValidChar((char) peek(), base)) {
if (!isValidChar((char) peek(), base)) {
throw new RuntimeException("Illegal digit: " + (char) peek());
}
sb.append((char) read());
}
if (peek() == '.') {
sb.append((char) read());
int peek = peek();
while (peek > -1 && Chars.isDigit((char) peek)) {
sb.append((char) read());
peek = peek();
}
}
if (peek() == 'e') {
sb.append((char) read());
if (peek() == '+' || peek() == '-') {
sb.append((char) read());
}
while (Chars.isDigit((char) peek())) {
sb.append((char) read());
}
}
Class<? extends Number> type;
switch(peek()) {
case 'f':
case 'F':
read();
type = Float.class;
case 'd':
case 'D':
read();
type = Double.class;
case 'l':
case 'L':
read();
type = Long.class;
default:
type = null;
}
<DeepExtract>
Number num;
if (base != 10 && (sb.toString().contains(".") || sb.toString().contains("e"))) {
throw new RuntimeException("Illegal base prefix");
}
Number result;
if (sb.toString().contains(".") || sb.toString().contains("e")) {
result = Double.valueOf(sb.toString());
} else {
Long converted = Long.parseLong(sb.toString(), base);
if (converted <= Integer.MAX_VALUE && converted >= Integer.MIN_VALUE) {
result = converted.intValue();
} else {
result = converted;
}
}
if (type == Double.class) {
num = result.doubleValue();
} else if (type == Float.class) {
num = result.floatValue();
} else if (type == Long.class) {
if (result.getClass() == Long.class || result.getClass() == Integer.class) {
num = result.longValue();
} else {
throw new RuntimeException("Illegal long suffix");
}
} else {
num = result;
}
</DeepExtract>
return new NumberToken(num, advanceRecorder(), currentPosition);
} | lumen | positive | 439,907 |
static public BigComplex divideRound(final BigComplex x, final BigComplex y) {
BigDecimal resul = x.multiply(invertRound(y));
MathContext mc = new MathContext(Math.min(x.precision(), invertRound(y).precision()));
return resul.round(mc);
} | static public BigComplex divideRound(final BigComplex x, final BigComplex y) {
<DeepExtract>
BigDecimal resul = x.multiply(invertRound(y));
MathContext mc = new MathContext(Math.min(x.precision(), invertRound(y).precision()));
return resul.round(mc);
</DeepExtract>
} | blz-ospl | positive | 439,908 |
public <T, R> PoolActorLeader<T, R, S> newPoolWithReturn(Function<T, R> actorLogic) {
PoolActorLeader<T, R, S> leader = createFixedPool(Either.right(actorLogic), null);
if (poolParams.minSize != poolParams.maxSize)
autoScale(leader, Either.right(actorLogic));
return leader;
} | public <T, R> PoolActorLeader<T, R, S> newPoolWithReturn(Function<T, R> actorLogic) {
<DeepExtract>
PoolActorLeader<T, R, S> leader = createFixedPool(Either.right(actorLogic), null);
if (poolParams.minSize != poolParams.maxSize)
autoScale(leader, Either.right(actorLogic));
return leader;
</DeepExtract>
} | Fibry | positive | 439,909 |
@Override
protected void init() {
slagBlock = TinkerWorld.oreSlag;
bushes = new ItemStack[] { new ItemStack(TinkerWorld.oreBerry, 1, 12), new ItemStack(TinkerWorld.oreBerry, 1, 13), new ItemStack(TinkerWorld.oreBerry, 1, 14), new ItemStack(TinkerWorld.oreBerry, 1, 15), new ItemStack(TinkerWorld.oreBerrySecond, 1, 12), new ItemStack(TinkerWorld.oreBerrySecond, 1, 13) };
for (int i = 0; i < bushes.length; i++) MessageRegistry.addMessage(new ModifyOreMessage(bushes[i], Priority.FIRST, new ItemStack(TinkerWorld.oreBerries, 1, i)));
for (int i = 0; i < 6; i++) gravel[i] = new ItemStack(TinkerWorld.oreGravel, 1, i);
if (PHConstruct.generateCopper)
generateUnderground(new ItemStack(slagBlock, 1, 3), PHConstruct.copperuDensity, PHConstruct.copperuMinY, PHConstruct.copperuMaxY, 8);
if (PHConstruct.generateTin)
generateUnderground(new ItemStack(slagBlock, 1, 4), PHConstruct.tinuDensity, PHConstruct.tinuMinY, PHConstruct.tinuMaxY, 8);
if (PHConstruct.generateAluminum)
generateUnderground(new ItemStack(slagBlock, 1, 5), PHConstruct.aluminumuDensity, PHConstruct.aluminumuMinY, PHConstruct.aluminumuMaxY, 6);
if (PHConstruct.generateNetherOres)
generateNetherOres();
if (PHConstruct.generateIronBush)
generateOreBush(bushes[0], PHConstruct.ironBushDensity, PHConstruct.ironBushDensity, getAverageSize(12), 32, 32);
if (PHConstruct.generateGoldBush)
generateOreBush(bushes[1], PHConstruct.goldBushDensity, PHConstruct.goldBushDensity, getAverageSize(6), 32, 32);
if (PHConstruct.generateCopperBush)
generateOreBush(bushes[2], PHConstruct.copperBushDensity, PHConstruct.copperBushDensity, getAverageSize(12), 32, 32);
if (PHConstruct.generateTinBush)
generateOreBush(bushes[3], PHConstruct.tinBushDensity, PHConstruct.tinBushDensity, getAverageSize(12), 32, 32);
if (PHConstruct.generateAluminumBush)
generateOreBush(bushes[4], PHConstruct.aluminumBushDensity, PHConstruct.aluminumBushDensity, getAverageSize(14), 32, 32);
if (PHConstruct.generateEssenceBush)
generateOreBush(bushes[5], PHConstruct.essenceBushRarity, PHConstruct.essenceBushRarity, getAverageSize(12), 32, 32);
if (PHConstruct.enableTBlueSlime)
registerBlueSlimes();
registerDropChanges();
} | @Override
protected void init() {
<DeepExtract>
slagBlock = TinkerWorld.oreSlag;
bushes = new ItemStack[] { new ItemStack(TinkerWorld.oreBerry, 1, 12), new ItemStack(TinkerWorld.oreBerry, 1, 13), new ItemStack(TinkerWorld.oreBerry, 1, 14), new ItemStack(TinkerWorld.oreBerry, 1, 15), new ItemStack(TinkerWorld.oreBerrySecond, 1, 12), new ItemStack(TinkerWorld.oreBerrySecond, 1, 13) };
for (int i = 0; i < bushes.length; i++) MessageRegistry.addMessage(new ModifyOreMessage(bushes[i], Priority.FIRST, new ItemStack(TinkerWorld.oreBerries, 1, i)));
for (int i = 0; i < 6; i++) gravel[i] = new ItemStack(TinkerWorld.oreGravel, 1, i);
if (PHConstruct.generateCopper)
generateUnderground(new ItemStack(slagBlock, 1, 3), PHConstruct.copperuDensity, PHConstruct.copperuMinY, PHConstruct.copperuMaxY, 8);
if (PHConstruct.generateTin)
generateUnderground(new ItemStack(slagBlock, 1, 4), PHConstruct.tinuDensity, PHConstruct.tinuMinY, PHConstruct.tinuMaxY, 8);
if (PHConstruct.generateAluminum)
generateUnderground(new ItemStack(slagBlock, 1, 5), PHConstruct.aluminumuDensity, PHConstruct.aluminumuMinY, PHConstruct.aluminumuMaxY, 6);
if (PHConstruct.generateNetherOres)
generateNetherOres();
if (PHConstruct.generateIronBush)
generateOreBush(bushes[0], PHConstruct.ironBushDensity, PHConstruct.ironBushDensity, getAverageSize(12), 32, 32);
if (PHConstruct.generateGoldBush)
generateOreBush(bushes[1], PHConstruct.goldBushDensity, PHConstruct.goldBushDensity, getAverageSize(6), 32, 32);
if (PHConstruct.generateCopperBush)
generateOreBush(bushes[2], PHConstruct.copperBushDensity, PHConstruct.copperBushDensity, getAverageSize(12), 32, 32);
if (PHConstruct.generateTinBush)
generateOreBush(bushes[3], PHConstruct.tinBushDensity, PHConstruct.tinBushDensity, getAverageSize(12), 32, 32);
if (PHConstruct.generateAluminumBush)
generateOreBush(bushes[4], PHConstruct.aluminumBushDensity, PHConstruct.aluminumBushDensity, getAverageSize(14), 32, 32);
if (PHConstruct.generateEssenceBush)
generateOreBush(bushes[5], PHConstruct.essenceBushRarity, PHConstruct.essenceBushRarity, getAverageSize(12), 32, 32);
if (PHConstruct.enableTBlueSlime)
registerBlueSlimes();
registerDropChanges();
</DeepExtract>
} | NotEnoughResources | positive | 439,910 |
private void loginImpl(OnLoginListener onLoginListener) {
mLoginCallback.loginListener = onLoginListener;
if (configuration.hasPublishPermissions() && configuration.isAllPermissionsAtOnce()) {
mLoginCallback.askPublishPermissions = true;
mLoginCallback.publishPermissions = configuration.getPublishPermissions();
}
mLoginManager.logInWithReadPermissions(mActivity.get(), configuration.getReadPermissions());
} | private void loginImpl(OnLoginListener onLoginListener) {
mLoginCallback.loginListener = onLoginListener;
if (configuration.hasPublishPermissions() && configuration.isAllPermissionsAtOnce()) {
mLoginCallback.askPublishPermissions = true;
mLoginCallback.publishPermissions = configuration.getPublishPermissions();
}
<DeepExtract>
mLoginManager.logInWithReadPermissions(mActivity.get(), configuration.getReadPermissions());
</DeepExtract>
} | android-simple-facebook | positive | 439,912 |
private void printWhoUsage(Player player) {
if (!hasHelpPermission(player, "bending.command.who")) {
sendNoCommandPermissionMessage(player, "who");
return;
}
ChatColor color = ChatColor.AQUA;
String usage = Tools.getMessage(player, "General.usage");
String description = Tools.getMessage(player, "General.who_usage");
sendMessage(player, color + usage + ": " + "/bending who");
sendMessage(player, color + "-" + description);
ChatColor color = ChatColor.AQUA;
String usage = Tools.getMessage(player, "General.usage");
String description = Tools.getMessage(player, "General.who_player_usage");
sendMessage(player, color + usage + ": " + "/bending who <player>");
sendMessage(player, color + "-" + description);
} | private void printWhoUsage(Player player) {
if (!hasHelpPermission(player, "bending.command.who")) {
sendNoCommandPermissionMessage(player, "who");
return;
}
ChatColor color = ChatColor.AQUA;
String usage = Tools.getMessage(player, "General.usage");
String description = Tools.getMessage(player, "General.who_usage");
sendMessage(player, color + usage + ": " + "/bending who");
sendMessage(player, color + "-" + description);
<DeepExtract>
ChatColor color = ChatColor.AQUA;
String usage = Tools.getMessage(player, "General.usage");
String description = Tools.getMessage(player, "General.who_player_usage");
sendMessage(player, color + usage + ": " + "/bending who <player>");
sendMessage(player, color + "-" + description);
</DeepExtract>
} | MinecraftTLA | positive | 439,914 |
public void alignInitialPlacement(int x, int y, int z) {
boolean oldStructureHasBottom = structureHasBottom;
boolean oldStructureHasTop = structureHasTop;
structureHasBottom = false;
structureHasTop = false;
int checkedLayers = 0;
if (checkSameLevel(x, y, z)) {
checkedLayers++;
checkedLayers += recurseStructureUp(x, y + 1, z, 0);
checkedLayers += recurseStructureDown(x, y - 1, z, 0);
}
if ((oldStructureHasBottom != structureHasBottom) || (oldStructureHasTop != structureHasTop) || (this.layers != checkedLayers)) {
if (structureHasBottom && structureHasTop && checkedLayers > 0) {
adjustLayers(checkedLayers, false);
validStructure = true;
} else {
internalTemp = ROOM_TEMP;
validStructure = false;
}
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
} | public void alignInitialPlacement(int x, int y, int z) {
<DeepExtract>
boolean oldStructureHasBottom = structureHasBottom;
boolean oldStructureHasTop = structureHasTop;
structureHasBottom = false;
structureHasTop = false;
int checkedLayers = 0;
if (checkSameLevel(x, y, z)) {
checkedLayers++;
checkedLayers += recurseStructureUp(x, y + 1, z, 0);
checkedLayers += recurseStructureDown(x, y - 1, z, 0);
}
if ((oldStructureHasBottom != structureHasBottom) || (oldStructureHasTop != structureHasTop) || (this.layers != checkedLayers)) {
if (structureHasBottom && structureHasTop && checkedLayers > 0) {
adjustLayers(checkedLayers, false);
validStructure = true;
} else {
internalTemp = ROOM_TEMP;
validStructure = false;
}
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
</DeepExtract>
} | TinkersSteelworks | positive | 439,915 |
@Test
public void testLabel() {
check("#1=#t #2=#f (#1#)", ScmBoolean.TRUE, ScmBoolean.FALSE, ScmList.toList(ScmBoolean.TRUE));
check("#1=#t #1# #1#", ScmBoolean.TRUE, ScmBoolean.TRUE, ScmBoolean.TRUE);
check("#1=(a b) #1#", ScmList.toList(new ScmSymbol("a"), new ScmSymbol("b")), ScmList.toList(new ScmSymbol("a"), new ScmSymbol("b")));
ScmObject obj = new Parser("#1=(#1#)").nextDatum();
Assert.assertTrue(obj instanceof ScmPair && ((ScmPair) obj).getCar() == obj);
obj = new Parser("#1=(() . #1#)").nextDatum();
Assert.assertTrue(obj instanceof ScmPair && ((ScmPair) obj).getCdr().equals(obj));
obj = new Parser("#1=#(#1#)").nextDatum();
Assert.assertTrue(obj instanceof ScmVector && ((ScmVector) obj).get(0).equals(obj));
obj = new Parser("#1=#(1 #1# 4)").nextDatum();
Assert.assertTrue(obj instanceof ScmVector && ((ScmVector) obj).get(1).equals(obj));
obj = new Parser("#(#11=(#11#) #11#)").nextDatum();
Assert.assertTrue(obj instanceof ScmVector && ((ScmVector) obj).get(0).equals(((ScmVector) obj).get(1)));
Assert.assertTrue(((ScmVector) obj).get(0).equals(((ScmPair) ((ScmVector) obj).get(0)).getCar()));
try {
new Parser("#1=3 #20#").getRemainingDatums();
Assert.assertTrue(false);
} catch (SyntaxException ex) {
}
try {
new Parser("#1=#t #1=#t").getRemainingDatums();
Assert.assertTrue(false);
} catch (SyntaxException ex) {
}
try {
new Parser("#1=(1 #1=a)").getRemainingDatums();
Assert.assertTrue(false);
} catch (SyntaxException ex) {
}
} | @Test
public void testLabel() {
check("#1=#t #2=#f (#1#)", ScmBoolean.TRUE, ScmBoolean.FALSE, ScmList.toList(ScmBoolean.TRUE));
check("#1=#t #1# #1#", ScmBoolean.TRUE, ScmBoolean.TRUE, ScmBoolean.TRUE);
check("#1=(a b) #1#", ScmList.toList(new ScmSymbol("a"), new ScmSymbol("b")), ScmList.toList(new ScmSymbol("a"), new ScmSymbol("b")));
ScmObject obj = new Parser("#1=(#1#)").nextDatum();
Assert.assertTrue(obj instanceof ScmPair && ((ScmPair) obj).getCar() == obj);
obj = new Parser("#1=(() . #1#)").nextDatum();
Assert.assertTrue(obj instanceof ScmPair && ((ScmPair) obj).getCdr().equals(obj));
obj = new Parser("#1=#(#1#)").nextDatum();
Assert.assertTrue(obj instanceof ScmVector && ((ScmVector) obj).get(0).equals(obj));
obj = new Parser("#1=#(1 #1# 4)").nextDatum();
Assert.assertTrue(obj instanceof ScmVector && ((ScmVector) obj).get(1).equals(obj));
obj = new Parser("#(#11=(#11#) #11#)").nextDatum();
Assert.assertTrue(obj instanceof ScmVector && ((ScmVector) obj).get(0).equals(((ScmVector) obj).get(1)));
Assert.assertTrue(((ScmVector) obj).get(0).equals(((ScmPair) ((ScmVector) obj).get(0)).getCar()));
try {
new Parser("#1=3 #20#").getRemainingDatums();
Assert.assertTrue(false);
} catch (SyntaxException ex) {
}
try {
new Parser("#1=#t #1=#t").getRemainingDatums();
Assert.assertTrue(false);
} catch (SyntaxException ex) {
}
<DeepExtract>
try {
new Parser("#1=(1 #1=a)").getRemainingDatums();
Assert.assertTrue(false);
} catch (SyntaxException ex) {
}
</DeepExtract>
} | JSchemeMin | positive | 439,916 |
public Map<SamlVersion, String> getSamlVersions() {
final Map<LK, String> valuesToLabels = new LinkedHashMap<LK, String>();
for (LK lk : SamlVersion.values()) {
valuesToLabels.put(lk, getText(lk.getLabelKey()));
}
return Collections.unmodifiableMap(valuesToLabels);
} | public Map<SamlVersion, String> getSamlVersions() {
<DeepExtract>
final Map<LK, String> valuesToLabels = new LinkedHashMap<LK, String>();
for (LK lk : SamlVersion.values()) {
valuesToLabels.put(lk, getText(lk.getLabelKey()));
}
return Collections.unmodifiableMap(valuesToLabels);
</DeepExtract>
} | axiom | positive | 439,917 |
public Object getValue(EvaluationContext ctx) throws ELException {
Object base;
try {
base = this.children[0].getValue(ctx);
} catch (PropertyNotFoundException ex) {
if (this.children[0] instanceof AstIdentifier) {
String name = ((AstIdentifier) this.children[0]).image;
ImportHandler importHandler = ctx.getImportHandler();
if (importHandler != null) {
Class<?> c = importHandler.resolveClass(name);
if (c != null) {
base = new ELClass(c);
}
}
}
throw ex;
}
int propCount = this.jjtGetNumChildren();
int i = 1;
while (base != null && i < propCount) {
base = getValue(base, this.children[i], ctx);
i++;
}
return base;
} | public Object getValue(EvaluationContext ctx) throws ELException {
<DeepExtract>
Object base;
try {
base = this.children[0].getValue(ctx);
} catch (PropertyNotFoundException ex) {
if (this.children[0] instanceof AstIdentifier) {
String name = ((AstIdentifier) this.children[0]).image;
ImportHandler importHandler = ctx.getImportHandler();
if (importHandler != null) {
Class<?> c = importHandler.resolveClass(name);
if (c != null) {
base = new ELClass(c);
}
}
}
throw ex;
}
</DeepExtract>
int propCount = this.jjtGetNumChildren();
int i = 1;
while (base != null && i < propCount) {
base = getValue(base, this.children[i], ctx);
i++;
}
return base;
} | el-spec | positive | 439,919 |
@Override
public void run() {
long t1 = System.nanoTime();
BConfig.reloader = null;
Iterator<BCauldron> iter = BCauldron.bcauldrons.values().iterator();
while (iter.hasNext()) {
if (!iter.next().onUpdate()) {
iter.remove();
}
}
long t2 = System.nanoTime();
Barrel.onUpdate();
long t3 = System.nanoTime();
if (use1_14)
MCBarrel.onUpdate();
if (BConfig.useBlocklocker)
BlocklockerBarrel.clearBarrelSign();
long t4 = System.nanoTime();
BPlayer.onUpdate();
long t5 = System.nanoTime();
DataSave.autoSave();
long t6 = System.nanoTime();
if (debug) {
this.msg(Bukkit.getConsoleSender(), "&2[Debug] &f" + "BreweryRunnable: " + "t1: " + (t2 - t1) / 1000000.0 + "ms" + " | t2: " + (t3 - t2) / 1000000.0 + "ms" + " | t3: " + (t4 - t3) / 1000000.0 + "ms" + " | t4: " + (t5 - t4) / 1000000.0 + "ms" + " | t5: " + (t6 - t5) / 1000000.0 + "ms");
}
} | @Override
public void run() {
long t1 = System.nanoTime();
BConfig.reloader = null;
Iterator<BCauldron> iter = BCauldron.bcauldrons.values().iterator();
while (iter.hasNext()) {
if (!iter.next().onUpdate()) {
iter.remove();
}
}
long t2 = System.nanoTime();
Barrel.onUpdate();
long t3 = System.nanoTime();
if (use1_14)
MCBarrel.onUpdate();
if (BConfig.useBlocklocker)
BlocklockerBarrel.clearBarrelSign();
long t4 = System.nanoTime();
BPlayer.onUpdate();
long t5 = System.nanoTime();
DataSave.autoSave();
long t6 = System.nanoTime();
<DeepExtract>
if (debug) {
this.msg(Bukkit.getConsoleSender(), "&2[Debug] &f" + "BreweryRunnable: " + "t1: " + (t2 - t1) / 1000000.0 + "ms" + " | t2: " + (t3 - t2) / 1000000.0 + "ms" + " | t3: " + (t4 - t3) / 1000000.0 + "ms" + " | t4: " + (t5 - t4) / 1000000.0 + "ms" + " | t5: " + (t6 - t5) / 1000000.0 + "ms");
}
</DeepExtract>
} | Brewery | positive | 439,924 |
@Override
public JobrunrJobsStatsRecord value10(Long value) {
set(9, value);
return this;
} | @Override
public JobrunrJobsStatsRecord value10(Long value) {
<DeepExtract>
set(9, value);
</DeepExtract>
return this;
} | openvsx | positive | 439,925 |
@Nullable
public LanguageServer getServer() {
if (status == STOPPED && !alreadyShownCrash && !alreadyShownTimeout) {
setStatus(STARTING);
try {
Pair<InputStream, OutputStream> streams = serverDefinition.start(projectRootPath);
InputStream inputStream = streams.getKey();
OutputStream outputStream = streams.getValue();
InitializeParams initParams = getInitParams();
ExecutorService executorService = Executors.newCachedThreadPool();
MessageHandler messageHandler = new MessageHandler(serverDefinition.getServerListener(), () -> getStatus() != STOPPED);
if (extManager != null && extManager.getExtendedServerInterface() != null) {
Class<? extends LanguageServer> remoteServerInterFace = extManager.getExtendedServerInterface();
client = extManager.getExtendedClientFor(new ServerWrapperBaseClientContext(this));
Launcher<? extends LanguageServer> launcher = Launcher.createLauncher(client, remoteServerInterFace, inputStream, outputStream, executorService, messageHandler);
languageServer = launcher.getRemoteProxy();
launcherFuture = launcher.startListening();
} else {
client = new DefaultLanguageClient(new ServerWrapperBaseClientContext(this));
Launcher<LanguageServer> launcher = Launcher.createLauncher(client, LanguageServer.class, inputStream, outputStream, executorService, messageHandler);
languageServer = launcher.getRemoteProxy();
launcherFuture = launcher.startListening();
}
messageHandler.setLanguageServer(languageServer);
initializeFuture = languageServer.initialize(initParams).thenApply(res -> {
initializeResult = res;
LOG.info("Got initializeResult for " + serverDefinition + " ; " + projectRootPath);
if (extManager != null) {
requestManager = extManager.getExtendedRequestManagerFor(this, languageServer, client, res.getCapabilities());
if (requestManager == null) {
requestManager = new DefaultRequestManager(this, languageServer, client, res.getCapabilities());
}
} else {
requestManager = new DefaultRequestManager(this, languageServer, client, res.getCapabilities());
}
setStatus(STARTED);
requestManager.initialized(new InitializedParams());
setStatus(INITIALIZED);
return res;
});
} catch (LSPException | IOException e) {
LOG.warn(e);
invokeLater(() -> notifier.showMessage(String.format("Can't start server due to %s", e.getMessage()), MessageType.WARNING));
removeServerWrapper();
}
}
if (initializeFuture != null && !initializeFuture.isDone()) {
initializeFuture.join();
}
return languageServer;
} | @Nullable
public LanguageServer getServer() {
<DeepExtract>
if (status == STOPPED && !alreadyShownCrash && !alreadyShownTimeout) {
setStatus(STARTING);
try {
Pair<InputStream, OutputStream> streams = serverDefinition.start(projectRootPath);
InputStream inputStream = streams.getKey();
OutputStream outputStream = streams.getValue();
InitializeParams initParams = getInitParams();
ExecutorService executorService = Executors.newCachedThreadPool();
MessageHandler messageHandler = new MessageHandler(serverDefinition.getServerListener(), () -> getStatus() != STOPPED);
if (extManager != null && extManager.getExtendedServerInterface() != null) {
Class<? extends LanguageServer> remoteServerInterFace = extManager.getExtendedServerInterface();
client = extManager.getExtendedClientFor(new ServerWrapperBaseClientContext(this));
Launcher<? extends LanguageServer> launcher = Launcher.createLauncher(client, remoteServerInterFace, inputStream, outputStream, executorService, messageHandler);
languageServer = launcher.getRemoteProxy();
launcherFuture = launcher.startListening();
} else {
client = new DefaultLanguageClient(new ServerWrapperBaseClientContext(this));
Launcher<LanguageServer> launcher = Launcher.createLauncher(client, LanguageServer.class, inputStream, outputStream, executorService, messageHandler);
languageServer = launcher.getRemoteProxy();
launcherFuture = launcher.startListening();
}
messageHandler.setLanguageServer(languageServer);
initializeFuture = languageServer.initialize(initParams).thenApply(res -> {
initializeResult = res;
LOG.info("Got initializeResult for " + serverDefinition + " ; " + projectRootPath);
if (extManager != null) {
requestManager = extManager.getExtendedRequestManagerFor(this, languageServer, client, res.getCapabilities());
if (requestManager == null) {
requestManager = new DefaultRequestManager(this, languageServer, client, res.getCapabilities());
}
} else {
requestManager = new DefaultRequestManager(this, languageServer, client, res.getCapabilities());
}
setStatus(STARTED);
requestManager.initialized(new InitializedParams());
setStatus(INITIALIZED);
return res;
});
} catch (LSPException | IOException e) {
LOG.warn(e);
invokeLater(() -> notifier.showMessage(String.format("Can't start server due to %s", e.getMessage()), MessageType.WARNING));
removeServerWrapper();
}
}
</DeepExtract>
if (initializeFuture != null && !initializeFuture.isDone()) {
initializeFuture.join();
}
return languageServer;
} | lsp4intellij | positive | 439,926 |
@Override
public void testAsyncResponseBodyValid() throws Throwable {
JSONObject calendar = new JSONObject();
calendar.put(JsonKeys.ID, "calendar_id");
calendar.put(JsonKeys.DESCRIPTION, JSONObject.NULL);
calendar.put(JsonKeys.NAME, "name");
calendar.put(JsonKeys.PERMISSIONS, "owner");
calendar.put(JsonKeys.IS_DEFAULT, false);
JSONObject from = new JSONObject();
from.put(JsonKeys.ID, "from_id");
from.put(JsonKeys.NAME, "from_name");
calendar.put(JsonKeys.FROM, from);
calendar.put(JsonKeys.SUBSCRIPTION_LOCATION, JSONObject.NULL);
calendar.put(JsonKeys.CREATED_TIME, "2011-12-10T02:48:33+0000");
calendar.put(JsonKeys.UPDATED_TIME, "2011-12-10T02:48:33+0000");
byte[] bytes = calendar.toString().getBytes();
this.mockEntity.setInputStream(new ByteArrayInputStream(bytes));
String requestPath = Paths.ME_CALENDARS;
this.runTestOnUiThread(createAsyncRunnable(requestPath, CALENDAR));
LiveOperation fromMethod = this.responseQueue.take();
LiveOperation fromCallback = this.pollResponseQueue();
this.checkReturnedOperations(fromMethod, fromCallback);
this.checkOperationMembers(fromMethod, METHOD, requestPath);
JSONObject result = fromMethod.getResult();
String id = result.getString(JsonKeys.ID);
Object description = result.get(JsonKeys.DESCRIPTION);
String name = result.getString(JsonKeys.NAME);
String permissions = result.getString(JsonKeys.PERMISSIONS);
boolean isDefault = result.getBoolean(JsonKeys.IS_DEFAULT);
JSONObject from = result.getJSONObject(JsonKeys.FROM);
String fromId = from.getString(JsonKeys.ID);
String fromName = from.getString(JsonKeys.NAME);
Object subscriptionLocation = result.get(JsonKeys.SUBSCRIPTION_LOCATION);
String createdTime = result.getString(JsonKeys.CREATED_TIME);
String updatedTime = result.getString(JsonKeys.UPDATED_TIME);
assertEquals("calendar_id", id);
assertEquals(JSONObject.NULL, description);
assertEquals("name", name);
assertEquals("owner", permissions);
assertEquals(false, isDefault);
assertEquals("from_id", fromId);
assertEquals("from_name", fromName);
assertEquals(JSONObject.NULL, subscriptionLocation);
assertEquals("2011-12-10T02:48:33+0000", createdTime);
assertEquals("2011-12-10T02:48:33+0000", updatedTime);
} | @Override
public void testAsyncResponseBodyValid() throws Throwable {
JSONObject calendar = new JSONObject();
calendar.put(JsonKeys.ID, "calendar_id");
calendar.put(JsonKeys.DESCRIPTION, JSONObject.NULL);
calendar.put(JsonKeys.NAME, "name");
calendar.put(JsonKeys.PERMISSIONS, "owner");
calendar.put(JsonKeys.IS_DEFAULT, false);
JSONObject from = new JSONObject();
from.put(JsonKeys.ID, "from_id");
from.put(JsonKeys.NAME, "from_name");
calendar.put(JsonKeys.FROM, from);
calendar.put(JsonKeys.SUBSCRIPTION_LOCATION, JSONObject.NULL);
calendar.put(JsonKeys.CREATED_TIME, "2011-12-10T02:48:33+0000");
calendar.put(JsonKeys.UPDATED_TIME, "2011-12-10T02:48:33+0000");
byte[] bytes = calendar.toString().getBytes();
this.mockEntity.setInputStream(new ByteArrayInputStream(bytes));
String requestPath = Paths.ME_CALENDARS;
this.runTestOnUiThread(createAsyncRunnable(requestPath, CALENDAR));
LiveOperation fromMethod = this.responseQueue.take();
LiveOperation fromCallback = this.pollResponseQueue();
this.checkReturnedOperations(fromMethod, fromCallback);
this.checkOperationMembers(fromMethod, METHOD, requestPath);
<DeepExtract>
JSONObject result = fromMethod.getResult();
String id = result.getString(JsonKeys.ID);
Object description = result.get(JsonKeys.DESCRIPTION);
String name = result.getString(JsonKeys.NAME);
String permissions = result.getString(JsonKeys.PERMISSIONS);
boolean isDefault = result.getBoolean(JsonKeys.IS_DEFAULT);
JSONObject from = result.getJSONObject(JsonKeys.FROM);
String fromId = from.getString(JsonKeys.ID);
String fromName = from.getString(JsonKeys.NAME);
Object subscriptionLocation = result.get(JsonKeys.SUBSCRIPTION_LOCATION);
String createdTime = result.getString(JsonKeys.CREATED_TIME);
String updatedTime = result.getString(JsonKeys.UPDATED_TIME);
assertEquals("calendar_id", id);
assertEquals(JSONObject.NULL, description);
assertEquals("name", name);
assertEquals("owner", permissions);
assertEquals(false, isDefault);
assertEquals("from_id", fromId);
assertEquals("from_name", fromName);
assertEquals(JSONObject.NULL, subscriptionLocation);
assertEquals("2011-12-10T02:48:33+0000", createdTime);
assertEquals("2011-12-10T02:48:33+0000", updatedTime);
</DeepExtract>
} | LiveSDK-for-Android | positive | 439,928 |
@Override
public double UPSToEncoder(final double FPS) {
return (FPS / postEncoderGearing) / unitPerRotation * 60.;
} | @Override
public double UPSToEncoder(final double FPS) {
<DeepExtract>
return (FPS / postEncoderGearing) / unitPerRotation * 60.;
</DeepExtract>
} | 449-central-repo | positive | 439,931 |
@Override
public ApiResponse<Channel> getChannel(String channelId, String etag) {
return doApiRequest(HttpMethod.GET, apiUrl + getChannelRoute(channelId), null, etag, Channel.class);
} | @Override
public ApiResponse<Channel> getChannel(String channelId, String etag) {
<DeepExtract>
return doApiRequest(HttpMethod.GET, apiUrl + getChannelRoute(channelId), null, etag, Channel.class);
</DeepExtract>
} | mattermost4j | positive | 439,933 |
@Override
public void onResume() {
super.onResume();
incomeList = sortList(DBTableManager.getInstance(getActivity()).selectIncome());
adapter.setData(incomeList);
} | @Override
public void onResume() {
super.onResume();
<DeepExtract>
incomeList = sortList(DBTableManager.getInstance(getActivity()).selectIncome());
adapter.setData(incomeList);
</DeepExtract>
} | Mayigushi-App | positive | 439,934 |
public Type visit(LessThan exp, MethodEntry method) {
Type typeLeft = (Type) visit(exp.e1, method);
Type typeRight = (Type) visit(exp.e2, method);
if (typeLeft == null || !typeLeft.equals(IntegerType.instance)) {
reporter.typeError(exp.e1, IntegerType.instance, typeLeft);
} else if (typeRight == null || !typeRight.equals(IntegerType.instance)) {
reporter.typeError(exp.e2, IntegerType.instance, typeRight);
}
return BooleanType.instance;
} | public Type visit(LessThan exp, MethodEntry method) {
<DeepExtract>
Type typeLeft = (Type) visit(exp.e1, method);
Type typeRight = (Type) visit(exp.e2, method);
if (typeLeft == null || !typeLeft.equals(IntegerType.instance)) {
reporter.typeError(exp.e1, IntegerType.instance, typeLeft);
} else if (typeRight == null || !typeRight.equals(IntegerType.instance)) {
reporter.typeError(exp.e2, IntegerType.instance, typeRight);
}
</DeepExtract>
return BooleanType.instance;
} | MiniJava | positive | 439,935 |
public void writeMysteriousX(SignatureX x) throws IOException {
if (!(x.longTermPublicKey instanceof DSAPublicKey))
throw new UnsupportedOperationException("Key types other than DSA are not supported at the moment.");
DSAPublicKey dsaKey = (DSAPublicKey) x.longTermPublicKey;
writeShort(0);
DSAParams dsaParams = dsaKey.getParams();
writeBigInt(dsaParams.getP());
writeBigInt(dsaParams.getQ());
writeBigInt(dsaParams.getG());
writeBigInt(dsaKey.getY());
writeNumber(x.dhKeyID, TYPE_LEN_INT);
if (!x.longTermPublicKey.getAlgorithm().equals("DSA"))
throw new UnsupportedOperationException();
out.write(x.signature);
} | public void writeMysteriousX(SignatureX x) throws IOException {
if (!(x.longTermPublicKey instanceof DSAPublicKey))
throw new UnsupportedOperationException("Key types other than DSA are not supported at the moment.");
DSAPublicKey dsaKey = (DSAPublicKey) x.longTermPublicKey;
writeShort(0);
DSAParams dsaParams = dsaKey.getParams();
writeBigInt(dsaParams.getP());
writeBigInt(dsaParams.getQ());
writeBigInt(dsaParams.getG());
writeBigInt(dsaKey.getY());
writeNumber(x.dhKeyID, TYPE_LEN_INT);
<DeepExtract>
if (!x.longTermPublicKey.getAlgorithm().equals("DSA"))
throw new UnsupportedOperationException();
out.write(x.signature);
</DeepExtract>
} | otr4j | positive | 439,936 |
public static HeapDumpAnalyzer getOrBuildHeapDumpAnalyzer(String dump, Map<String, String> options, ProgressListener listener) {
T result = getInstance().getCacheValueIfPresent(dump);
if (result != null) {
return result;
}
synchronized (dump.intern()) {
result = getInstance().getCacheValueIfPresent(dump);
if (result != null) {
return result;
}
try {
result = key -> HEAP_DUMP_ANALYZER_PROVIDER.provide(new File(FileSupport.filePath(HEAP_DUMP, dump)).toPath(), options, listener).build(dump);
} catch (Throwable t) {
throw new JifaException(t);
}
getInstance().putCacheValue(dump, result);
return result;
}
} | public static HeapDumpAnalyzer getOrBuildHeapDumpAnalyzer(String dump, Map<String, String> options, ProgressListener listener) {
<DeepExtract>
T result = getInstance().getCacheValueIfPresent(dump);
if (result != null) {
return result;
}
synchronized (dump.intern()) {
result = getInstance().getCacheValueIfPresent(dump);
if (result != null) {
return result;
}
try {
result = key -> HEAP_DUMP_ANALYZER_PROVIDER.provide(new File(FileSupport.filePath(HEAP_DUMP, dump)).toPath(), options, listener).build(dump);
} catch (Throwable t) {
throw new JifaException(t);
}
getInstance().putCacheValue(dump, result);
return result;
}
</DeepExtract>
} | jifa | positive | 439,937 |
public void add(double pos, double value) {
if (pos < min || pos >= max || Double.isNaN(pos)) {
throw new IllegalArgumentException("value must be in [" + min + ", " + max + "[ but was: " + pos);
}
int index;
assert (pos <= max) : "pos > max: " + pos + " > " + max;
int index = Arrays.binarySearch(lowerKey, pos);
if (index >= 0) {
index = index;
} else {
index = -index - 2;
}
final double mid = lowerKey[index] + (0.5 * binWidth);
if (pos - mid == 0) {
bins[index] += value;
} else if (pos > mid) {
double weight = (pos - mid) / binWidth;
bins[index] += (1 - weight) * value;
if (index + 1 < bins.length) {
bins[index + 1] += weight * value;
}
} else if (pos < mid) {
double weight = (mid - pos) / binWidth;
bins[index] += (1 - weight) * value;
if (index - 1 >= 0) {
bins[index - 1] += weight * value;
}
}
} | public void add(double pos, double value) {
if (pos < min || pos >= max || Double.isNaN(pos)) {
throw new IllegalArgumentException("value must be in [" + min + ", " + max + "[ but was: " + pos);
}
<DeepExtract>
int index;
assert (pos <= max) : "pos > max: " + pos + " > " + max;
int index = Arrays.binarySearch(lowerKey, pos);
if (index >= 0) {
index = index;
} else {
index = -index - 2;
}
</DeepExtract>
final double mid = lowerKey[index] + (0.5 * binWidth);
if (pos - mid == 0) {
bins[index] += value;
} else if (pos > mid) {
double weight = (pos - mid) / binWidth;
bins[index] += (1 - weight) * value;
if (index + 1 < bins.length) {
bins[index + 1] += weight * value;
}
} else if (pos < mid) {
double weight = (mid - pos) / binWidth;
bins[index] += (1 - weight) * value;
if (index - 1 >= 0) {
bins[index - 1] += weight * value;
}
}
} | JFeatureLib | positive | 439,938 |
@Override
public void clear() {
reset();
return new InputStreamReader(new ByteArrayInputStream(new byte[0]));
} | @Override
public void clear() {
reset();
<DeepExtract>
return new InputStreamReader(new ByteArrayInputStream(new byte[0]));
</DeepExtract>
} | msgpack-java | positive | 439,939 |
public static boolean isPhone(String str) {
if (null == str || str.trim().length() <= 0)
return false;
Pattern p = Pattern.compile(PHONE);
Matcher m = p.matcher(str);
return m.matches();
} | public static boolean isPhone(String str) {
<DeepExtract>
if (null == str || str.trim().length() <= 0)
return false;
Pattern p = Pattern.compile(PHONE);
Matcher m = p.matcher(str);
return m.matches();
</DeepExtract>
} | babyIyo | positive | 439,940 |
private void applyItemVerticalOffsets(Rect outRect, int itemPosition, int childCount, int spanCount, SpanLookup spanLookup, LRecyclerViewAdapter adapter) {
if (adapter.isHeader(itemPosition) || adapter.isRefreshHeader(itemPosition) || adapter.isFooter(itemPosition)) {
outRect.top = 0;
} else {
if (itemIsOnTheTopRow(spanLookup, itemPosition, spanCount, childCount)) {
outRect.top = 0;
} else {
outRect.top = (int) (.5f * verticalSpacing);
}
}
if (adapter.isHeader(itemPosition) || adapter.isRefreshHeader(itemPosition) || adapter.isFooter(itemPosition)) {
outRect.bottom = 0;
} else {
if (itemIsOnTheBottomRow(spanLookup, itemPosition, childCount)) {
outRect.bottom = 0;
} else {
outRect.bottom = (int) (.5f * verticalSpacing);
}
}
} | private void applyItemVerticalOffsets(Rect outRect, int itemPosition, int childCount, int spanCount, SpanLookup spanLookup, LRecyclerViewAdapter adapter) {
if (adapter.isHeader(itemPosition) || adapter.isRefreshHeader(itemPosition) || adapter.isFooter(itemPosition)) {
outRect.top = 0;
} else {
if (itemIsOnTheTopRow(spanLookup, itemPosition, spanCount, childCount)) {
outRect.top = 0;
} else {
outRect.top = (int) (.5f * verticalSpacing);
}
}
<DeepExtract>
if (adapter.isHeader(itemPosition) || adapter.isRefreshHeader(itemPosition) || adapter.isFooter(itemPosition)) {
outRect.bottom = 0;
} else {
if (itemIsOnTheBottomRow(spanLookup, itemPosition, childCount)) {
outRect.bottom = 0;
} else {
outRect.bottom = (int) (.5f * verticalSpacing);
}
}
</DeepExtract>
} | Designer | positive | 439,942 |
final String toStringWithQualifiers(final String classname, final byte[] family, final byte[][] qualifiers, final byte[][] values, final String fields) {
final StringBuilder buf = new StringBuilder(256 + fields.length());
buf.append(classname).append("(table=");
Bytes.pretty(buf, table);
buf.append(", key=");
Bytes.pretty(buf, key);
buf.append(", family=");
Bytes.pretty(buf, family);
buf.append(", qualifiers=");
Bytes.pretty(buf, qualifiers);
if (values != null) {
buf.append(", values=");
Bytes.pretty(buf, values);
}
buf.append(fields);
buf.append(", attempt=").append(attempt).append(", region=");
buf.append(')');
final String method = "method";
final StringBuilder buf = new StringBuilder(16 + method.length() + 2 + 8 + (table == null ? 4 : table.length + 2) + 6 + (key == null ? 4 : key.length * 2) + 10 + 1 + 1);
buf.append("HBaseRpc(method=");
buf.append(method);
buf.append(", table=");
Bytes.pretty(buf, table);
buf.append(", key=");
Bytes.pretty(buf, key);
buf.append(", region=");
buf.append(", attempt=").append(attempt);
buf.append(')');
return buf.toString();
} | final String toStringWithQualifiers(final String classname, final byte[] family, final byte[][] qualifiers, final byte[][] values, final String fields) {
final StringBuilder buf = new StringBuilder(256 + fields.length());
buf.append(classname).append("(table=");
Bytes.pretty(buf, table);
buf.append(", key=");
Bytes.pretty(buf, key);
buf.append(", family=");
Bytes.pretty(buf, family);
buf.append(", qualifiers=");
Bytes.pretty(buf, qualifiers);
if (values != null) {
buf.append(", values=");
Bytes.pretty(buf, values);
}
buf.append(fields);
buf.append(", attempt=").append(attempt).append(", region=");
buf.append(')');
<DeepExtract>
final String method = "method";
final StringBuilder buf = new StringBuilder(16 + method.length() + 2 + 8 + (table == null ? 4 : table.length + 2) + 6 + (key == null ? 4 : key.length * 2) + 10 + 1 + 1);
buf.append("HBaseRpc(method=");
buf.append(method);
buf.append(", table=");
Bytes.pretty(buf, table);
buf.append(", key=");
Bytes.pretty(buf, key);
buf.append(", region=");
buf.append(", attempt=").append(attempt);
buf.append(')');
return buf.toString();
</DeepExtract>
} | asyncbigtable | positive | 439,943 |
private String getContent() {
if (propsFile != null) {
loadFile(propsFile);
}
if (textProps != null) {
loadTextProps(textProps);
}
StringBuilder content = new StringBuilder();
try {
for (Map.Entry<String, String> entry : props.entrySet()) {
if (content.length() != 0) {
content.append("&");
}
content.append(URLEncoder.encode(entry.getKey(), encoding));
content.append("=");
content.append(URLEncoder.encode(entry.getValue(), encoding));
}
} catch (IOException ex) {
if (failOnError) {
throw new BuildException(ex, getLocation());
}
}
StringBuilder sb = new StringBuilder();
sb.append(name).append("=").append(value).append(";");
if (domain != null) {
sb.append("Domain=").append(domain).append(";");
}
if (path != null) {
sb.append("Path=").append(path).append(";");
}
sb.append("Version=\"1\";");
return sb.toString();
} | private String getContent() {
if (propsFile != null) {
loadFile(propsFile);
}
if (textProps != null) {
loadTextProps(textProps);
}
StringBuilder content = new StringBuilder();
try {
for (Map.Entry<String, String> entry : props.entrySet()) {
if (content.length() != 0) {
content.append("&");
}
content.append(URLEncoder.encode(entry.getKey(), encoding));
content.append("=");
content.append(URLEncoder.encode(entry.getValue(), encoding));
}
} catch (IOException ex) {
if (failOnError) {
throw new BuildException(ex, getLocation());
}
}
<DeepExtract>
StringBuilder sb = new StringBuilder();
sb.append(name).append("=").append(value).append(";");
if (domain != null) {
sb.append("Domain=").append(domain).append(";");
}
if (path != null) {
sb.append("Path=").append(path).append(";");
}
sb.append("Version=\"1\";");
return sb.toString();
</DeepExtract>
} | ant-contrib | positive | 439,944 |
@Override
public void onClick(View view) {
Cart cart = mCartItemTypeList.get(position).getCart();
if (cart.getIsSelect() == 1) {
cart.setIsSelect(0);
} else {
cart.setIsSelect(1);
}
mCartAdapter.replaceAll(mCartItemTypeList);
calcSum();
} | @Override
public void onClick(View view) {
<DeepExtract>
Cart cart = mCartItemTypeList.get(position).getCart();
if (cart.getIsSelect() == 1) {
cart.setIsSelect(0);
} else {
cart.setIsSelect(1);
}
mCartAdapter.replaceAll(mCartItemTypeList);
calcSum();
</DeepExtract>
} | shop-mall-android | positive | 439,948 |
public void stopRecording() throws IOException {
Log.d(TAG, "stop recording");
isRecording = false;
stopTime = new Date().getTime();
length += stopTime - startTime;
try {
if (audioRecord != null) {
audioRecord.stop();
audioRecord.release();
audioRecord = null;
}
Message msg = Message.obtain(encodeThread.getHandler(), DataEncodeThread.PROCESS_STOP);
msg.sendToTarget();
Log.d(TAG, "waiting for encoding thread");
encodeThread.join();
if (listener != null) {
listener.stop();
}
Log.d(TAG, "done encoding thread");
} catch (InterruptedException e) {
Log.d(TAG, "Faile to join encode thread");
} finally {
if (os != null) {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
} | public void stopRecording() throws IOException {
Log.d(TAG, "stop recording");
isRecording = false;
<DeepExtract>
stopTime = new Date().getTime();
length += stopTime - startTime;
</DeepExtract>
try {
if (audioRecord != null) {
audioRecord.stop();
audioRecord.release();
audioRecord = null;
}
Message msg = Message.obtain(encodeThread.getHandler(), DataEncodeThread.PROCESS_STOP);
msg.sendToTarget();
Log.d(TAG, "waiting for encoding thread");
encodeThread.join();
if (listener != null) {
listener.stop();
}
Log.d(TAG, "done encoding thread");
} catch (InterruptedException e) {
Log.d(TAG, "Faile to join encode thread");
} finally {
if (os != null) {
try {
os.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
} | MyDemos | positive | 439,949 |
@BeforeTest
public void setUpTest() {
System.getProperties().remove("my.string.property");
System.getProperties().remove("my.boolean.property");
System.getProperties().remove("my.byte.property");
System.getProperties().remove("my.short.property");
System.getProperties().remove("my.int.property");
System.getProperties().remove("my.long.property");
System.getProperties().remove("my.float.property");
System.getProperties().remove("my.double.property");
System.getProperties().remove("my.char.property");
System.getProperties().remove(DEFAULT_PROPERTY_BEAN_KEY);
System.setProperty("my.string.property", "text");
System.setProperty("my.boolean.property", "true");
System.setProperty("my.byte.property", "127");
System.setProperty("my.short.property", "32767");
System.setProperty("my.int.property", "5");
System.setProperty("my.long.property", "10");
System.setProperty("my.float.property", "10.5");
System.setProperty("my.double.property", "11.5");
System.setProperty("my.char.property", "c");
System.setProperty(DEFAULT_PROPERTY_BEAN_KEY, "pathConfigValue");
} | @BeforeTest
public void setUpTest() {
System.getProperties().remove("my.string.property");
System.getProperties().remove("my.boolean.property");
System.getProperties().remove("my.byte.property");
System.getProperties().remove("my.short.property");
System.getProperties().remove("my.int.property");
System.getProperties().remove("my.long.property");
System.getProperties().remove("my.float.property");
System.getProperties().remove("my.double.property");
System.getProperties().remove("my.char.property");
System.getProperties().remove(DEFAULT_PROPERTY_BEAN_KEY);
<DeepExtract>
System.setProperty("my.string.property", "text");
System.setProperty("my.boolean.property", "true");
System.setProperty("my.byte.property", "127");
System.setProperty("my.short.property", "32767");
System.setProperty("my.int.property", "5");
System.setProperty("my.long.property", "10");
System.setProperty("my.float.property", "10.5");
System.setProperty("my.double.property", "11.5");
System.setProperty("my.char.property", "c");
System.setProperty(DEFAULT_PROPERTY_BEAN_KEY, "pathConfigValue");
</DeepExtract>
} | microprofile-config | positive | 439,951 |
public DeepType getInArray(PsiElement call) {
Key keyEntry = new Key(KeyType.integer(call), call).addType(Tls.onDemand(() -> new Mt(It(types).mem())), PhpType.MIXED);
return new Build(call, PhpType.ARRAY).keys(som(keyEntry)).get();
} | public DeepType getInArray(PsiElement call) {
<DeepExtract>
Key keyEntry = new Key(KeyType.integer(call), call).addType(Tls.onDemand(() -> new Mt(It(types).mem())), PhpType.MIXED);
return new Build(call, PhpType.ARRAY).keys(som(keyEntry)).get();
</DeepExtract>
} | deep-assoc-completion | positive | 439,952 |
public String getAnalysisTimeoutReport() {
StringBuffer buf = new StringBuffer();
buf.append("NFA conversion early termination report:");
buf.append(newline);
buf.append("Number of NFA conversions that terminated early: ");
buf.append(grammar.setOfDFAWhoseAnalysisTimedOut.size());
buf.append(newline);
buf.append(getDFALocations(grammar.setOfDFAWhoseAnalysisTimedOut));
return toString(toNotifyString());
} | public String getAnalysisTimeoutReport() {
StringBuffer buf = new StringBuffer();
buf.append("NFA conversion early termination report:");
buf.append(newline);
buf.append("Number of NFA conversions that terminated early: ");
buf.append(grammar.setOfDFAWhoseAnalysisTimedOut.size());
buf.append(newline);
buf.append(getDFALocations(grammar.setOfDFAWhoseAnalysisTimedOut));
<DeepExtract>
return toString(toNotifyString());
</DeepExtract>
} | org.xtext.antlr.generator | positive | 439,954 |
public StoredDocumentAuditEntry createAndSaveEntry(StoredDocument storedDocument, AuditActions action, String username, String serviceName) {
StoredDocumentAuditEntry storedDocumentAuditEntry = new StoredDocumentAuditEntry();
storedDocumentAuditEntry.setAction(action);
storedDocumentAuditEntry.setUsername(username);
storedDocumentAuditEntry.setServiceName(serviceName);
storedDocumentAuditEntry.setRecordedDateTime(new Date());
storedDocumentAuditEntry.setStoredDocument(storedDocument);
storedDocumentAuditEntryRepository.save(storedDocumentAuditEntry);
return storedDocumentAuditEntry;
} | public StoredDocumentAuditEntry createAndSaveEntry(StoredDocument storedDocument, AuditActions action, String username, String serviceName) {
StoredDocumentAuditEntry storedDocumentAuditEntry = new StoredDocumentAuditEntry();
<DeepExtract>
storedDocumentAuditEntry.setAction(action);
storedDocumentAuditEntry.setUsername(username);
storedDocumentAuditEntry.setServiceName(serviceName);
storedDocumentAuditEntry.setRecordedDateTime(new Date());
</DeepExtract>
storedDocumentAuditEntry.setStoredDocument(storedDocument);
storedDocumentAuditEntryRepository.save(storedDocumentAuditEntry);
return storedDocumentAuditEntry;
} | document-management-store-app | positive | 439,955 |
@Security(PrivilegeEnum.PLAY)
@GetMapping("/mainpage/{numberOfElement}/")
public String getMainPageWithNumberOfElements(@PathVariable @Valid @NotNull @Max(50) Integer numberOfElement, Model model) {
model.addAttribute("rlArtists", artistService.getSomeRandomArtistMinimal(numberOfElement));
model.addAttribute("genres", genreService.getSomeRandomGenreMinimal(numberOfElement));
model.addAttribute("labels", labelService.getSomeRandomLabelsMinimal(numberOfElement));
return UiFragmentEnum.MAIN_PAGE.getPage();
} | @Security(PrivilegeEnum.PLAY)
@GetMapping("/mainpage/{numberOfElement}/")
public String getMainPageWithNumberOfElements(@PathVariable @Valid @NotNull @Max(50) Integer numberOfElement, Model model) {
<DeepExtract>
model.addAttribute("rlArtists", artistService.getSomeRandomArtistMinimal(numberOfElement));
model.addAttribute("genres", genreService.getSomeRandomGenreMinimal(numberOfElement));
model.addAttribute("labels", labelService.getSomeRandomLabelsMinimal(numberOfElement));
</DeepExtract>
return UiFragmentEnum.MAIN_PAGE.getPage();
} | ManaZeak | positive | 439,957 |
@Test
public void testGetTokenEntries() throws Exception {
TokenStorePojo store = new TokenStorePojo();
final int LIST_SIZE = 3;
store.clearAllTokens();
assertTrue("store was not properly cleared.", 0 == store.getTokenEntries().size());
if (store == null) {
throw new Exception("ERROR: Toke store is null.");
}
if (LIST_SIZE >= 0) {
for (int i = 0; i < LIST_SIZE; i++) {
store.addToken(TEST_USERNAME + i, TEST_TOKEN);
}
}
List<String> entries = store.getTokenEntries();
logger.info("stage 1 store.getTokenEntries():" + entries.size());
assertEquals(LIST_SIZE, entries.size());
for (int i = 0; i < entries.size(); i++) {
assertTrue(store.confirmToken(TEST_USERNAME + i, TEST_TOKEN));
}
logger.info("stage 2 store.getTokenEntries():" + entries.size());
} | @Test
public void testGetTokenEntries() throws Exception {
TokenStorePojo store = new TokenStorePojo();
final int LIST_SIZE = 3;
store.clearAllTokens();
assertTrue("store was not properly cleared.", 0 == store.getTokenEntries().size());
<DeepExtract>
if (store == null) {
throw new Exception("ERROR: Toke store is null.");
}
if (LIST_SIZE >= 0) {
for (int i = 0; i < LIST_SIZE; i++) {
store.addToken(TEST_USERNAME + i, TEST_TOKEN);
}
}
</DeepExtract>
List<String> entries = store.getTokenEntries();
logger.info("stage 1 store.getTokenEntries():" + entries.size());
assertEquals(LIST_SIZE, entries.size());
for (int i = 0; i < entries.size(); i++) {
assertTrue(store.confirmToken(TEST_USERNAME + i, TEST_TOKEN));
}
logger.info("stage 2 store.getTokenEntries():" + entries.size());
} | axiom | positive | 439,958 |
public DoubleMatrix getPredictions(ClassifierTheta Theta, DoubleMatrix Features) {
int numDataItems = Features.columns;
DoubleMatrix Input = ((Theta.W.transpose()).mmul(Features)).addColumnVector(Theta.b);
Input = DoubleMatrix.concatVertically(Input, DoubleMatrix.zeros(1, numDataItems));
if (!requiresEvaluation(Input))
return value;
int numDataItems = Features.columns;
int[] requiredRows = ArraysHelper.makeArray(0, CatSize - 2);
ClassifierTheta Theta = new ClassifierTheta(Input, FeatureLength, CatSize);
DoubleMatrix Prediction = getPredictions(Theta, Features);
double MeanTerm = 1.0 / (double) numDataItems;
double Cost = getLoss(Prediction, Labels).sum() * MeanTerm;
double RegularisationTerm = 0.5 * Lambda * DoubleMatrixFunctions.SquaredNorm(Theta.W);
DoubleMatrix Diff = Prediction.sub(Labels).muli(MeanTerm);
DoubleMatrix Delta = Features.mmul(Diff.transpose());
DoubleMatrix gradW = Delta.getColumns(requiredRows);
DoubleMatrix gradb = ((Diff.rowSums()).getRows(requiredRows));
gradW = gradW.addi(Theta.W.mul(Lambda));
Gradient = new ClassifierTheta(gradW, gradb);
value = Cost + RegularisationTerm;
gradient = Gradient.Theta;
return value;
} | public DoubleMatrix getPredictions(ClassifierTheta Theta, DoubleMatrix Features) {
int numDataItems = Features.columns;
DoubleMatrix Input = ((Theta.W.transpose()).mmul(Features)).addColumnVector(Theta.b);
Input = DoubleMatrix.concatVertically(Input, DoubleMatrix.zeros(1, numDataItems));
<DeepExtract>
if (!requiresEvaluation(Input))
return value;
int numDataItems = Features.columns;
int[] requiredRows = ArraysHelper.makeArray(0, CatSize - 2);
ClassifierTheta Theta = new ClassifierTheta(Input, FeatureLength, CatSize);
DoubleMatrix Prediction = getPredictions(Theta, Features);
double MeanTerm = 1.0 / (double) numDataItems;
double Cost = getLoss(Prediction, Labels).sum() * MeanTerm;
double RegularisationTerm = 0.5 * Lambda * DoubleMatrixFunctions.SquaredNorm(Theta.W);
DoubleMatrix Diff = Prediction.sub(Labels).muli(MeanTerm);
DoubleMatrix Delta = Features.mmul(Diff.transpose());
DoubleMatrix gradW = Delta.getColumns(requiredRows);
DoubleMatrix gradb = ((Diff.rowSums()).getRows(requiredRows));
gradW = gradW.addi(Theta.W.mul(Lambda));
Gradient = new ClassifierTheta(gradW, gradb);
value = Cost + RegularisationTerm;
gradient = Gradient.Theta;
return value;
</DeepExtract>
} | jrae | positive | 439,960 |
public static BrightnessFragment create(String inputUrl, OnBrightnessListener onBrightnessListener) {
BrightnessFragment fragment = new BrightnessFragment();
this.onBrightnessListener = onBrightnessListener;
Bundle bundle = new Bundle();
bundle.putString(INPUT_URL, inputUrl);
fragment.setArguments(bundle);
return fragment;
} | public static BrightnessFragment create(String inputUrl, OnBrightnessListener onBrightnessListener) {
BrightnessFragment fragment = new BrightnessFragment();
<DeepExtract>
this.onBrightnessListener = onBrightnessListener;
</DeepExtract>
Bundle bundle = new Bundle();
bundle.putString(INPUT_URL, inputUrl);
fragment.setArguments(bundle);
return fragment;
} | EditPhoto | positive | 439,961 |
public void login(final AuthResult res, final boolean rememberMe) {
final Account.Id id = res.getAccountId();
final AccountExternalId.Key identity = res.getExternalId();
if (val != null) {
manager.destroy(key);
key = null;
val = null;
saveCookie();
}
key = manager.createKey(id);
val = manager.createVal(key, id, rememberMe, identity);
final String token;
final int ageSeconds;
if (key == null) {
token = "";
ageSeconds = 0;
} else {
token = key.getToken();
ageSeconds = manager.getCookieAge(val);
}
if (outCookie == null) {
String path = request.getContextPath();
if (path.equals("")) {
path = "/";
}
outCookie = new Cookie(ACCOUNT_COOKIE, token);
outCookie.setPath(path);
outCookie.setMaxAge(ageSeconds);
response.addCookie(outCookie);
} else {
outCookie.setValue(token);
outCookie.setMaxAge(ageSeconds);
}
} | public void login(final AuthResult res, final boolean rememberMe) {
final Account.Id id = res.getAccountId();
final AccountExternalId.Key identity = res.getExternalId();
if (val != null) {
manager.destroy(key);
key = null;
val = null;
saveCookie();
}
key = manager.createKey(id);
val = manager.createVal(key, id, rememberMe, identity);
<DeepExtract>
final String token;
final int ageSeconds;
if (key == null) {
token = "";
ageSeconds = 0;
} else {
token = key.getToken();
ageSeconds = manager.getCookieAge(val);
}
if (outCookie == null) {
String path = request.getContextPath();
if (path.equals("")) {
path = "/";
}
outCookie = new Cookie(ACCOUNT_COOKIE, token);
outCookie.setPath(path);
outCookie.setMaxAge(ageSeconds);
response.addCookie(outCookie);
} else {
outCookie.setValue(token);
outCookie.setMaxAge(ageSeconds);
}
</DeepExtract>
} | mini-git-server | positive | 439,964 |
@Override
public void e(Class<?> clazz, Throwable t, String format, Object... args) {
if (isDebugEnabled()) {
LogInfo.Builder builder = new LogInfo.Builder(LogInfo.LogLevel.ERROR, clazz.getSimpleName(), String.format(format, args));
Boolean displayThreadName = LOCAL_THREAD_INFO.get();
if (displayThreadName != null && displayThreadName) {
builder.threadName(Thread.currentThread().getName());
}
String title = LOCAL_TITLE.get();
if (!TextUtils.isEmpty(title)) {
builder.title(title);
}
Integer methodCount = LOCAL_METHOD_COUNT.get();
if (methodCount != null && methodCount > 0) {
builder.stackTrace(getStackTrace(), methodCount);
}
if (t != null) {
builder.throwable(t);
}
mPrinter.print(builder.build());
}
LOCAL_THREAD_INFO.remove();
LOCAL_TITLE.remove();
LOCAL_METHOD_COUNT.remove();
} | @Override
public void e(Class<?> clazz, Throwable t, String format, Object... args) {
<DeepExtract>
if (isDebugEnabled()) {
LogInfo.Builder builder = new LogInfo.Builder(LogInfo.LogLevel.ERROR, clazz.getSimpleName(), String.format(format, args));
Boolean displayThreadName = LOCAL_THREAD_INFO.get();
if (displayThreadName != null && displayThreadName) {
builder.threadName(Thread.currentThread().getName());
}
String title = LOCAL_TITLE.get();
if (!TextUtils.isEmpty(title)) {
builder.title(title);
}
Integer methodCount = LOCAL_METHOD_COUNT.get();
if (methodCount != null && methodCount > 0) {
builder.stackTrace(getStackTrace(), methodCount);
}
if (t != null) {
builder.throwable(t);
}
mPrinter.print(builder.build());
}
LOCAL_THREAD_INFO.remove();
LOCAL_TITLE.remove();
LOCAL_METHOD_COUNT.remove();
</DeepExtract>
} | AZList | positive | 439,965 |
static void delete(Path path) throws IOException {
if (isLogging(LOG_DEBUG))
STDERR.println((AGENT ? LOG_AGENT_PREFIX : LOG_PREFIX) + "Deleting " + path);
if (!Files.exists(path))
return;
if (Files.isDirectory(path)) {
try (DirectoryStream<Path> ds = Files.newDirectoryStream(path)) {
for (Path f : ds) delete(f);
}
}
Files.delete(path);
} | static void delete(Path path) throws IOException {
<DeepExtract>
if (isLogging(LOG_DEBUG))
STDERR.println((AGENT ? LOG_AGENT_PREFIX : LOG_PREFIX) + "Deleting " + path);
</DeepExtract>
if (!Files.exists(path))
return;
if (Files.isDirectory(path)) {
try (DirectoryStream<Path> ds = Files.newDirectoryStream(path)) {
for (Path f : ds) delete(f);
}
}
Files.delete(path);
} | capsule | positive | 439,966 |
@Override
public AccessibilityNodeInfoCompat createAccessibilityNodeInfo(int virtualViewId) {
if (virtualViewId == View.NO_ID) {
return getNodeForParent();
}
final T item = getItemForId(virtualViewId);
if (item == null) {
return null;
}
final AccessibilityNodeInfoCompat node = AccessibilityNodeInfoCompat.obtain();
final int virtualDescendantId = getIdForItem(item);
node.setEnabled(true);
populateNodeForItem(item, node);
if (TextUtils.isEmpty(node.getText()) && TextUtils.isEmpty(node.getContentDescription())) {
throw new RuntimeException("You must add text or a content description in populateNodeForItem()");
}
node.setPackageName(mParentView.getContext().getPackageName());
node.setClassName(item.getClass().getName());
node.setParent(mParentView);
node.setSource(mParentView, virtualDescendantId);
if (mFocusedItemId == virtualDescendantId) {
node.addAction(AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
} else {
node.addAction(AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS);
}
node.getBoundsInParent(mTempParentRect);
if (mTempParentRect.isEmpty()) {
throw new RuntimeException("You must set parent bounds in populateNodeForItem()");
}
if (intersectVisibleToUser(mTempParentRect)) {
node.setVisibleToUser(true);
node.setBoundsInParent(mTempParentRect);
}
mParentView.getLocationOnScreen(mTempGlobalRect);
final int offsetX = mTempGlobalRect[0];
final int offsetY = mTempGlobalRect[1];
mTempScreenRect.set(mTempParentRect);
mTempScreenRect.offset(offsetX, offsetY);
node.setBoundsInScreen(mTempScreenRect);
return node;
return node;
} | @Override
public AccessibilityNodeInfoCompat createAccessibilityNodeInfo(int virtualViewId) {
if (virtualViewId == View.NO_ID) {
return getNodeForParent();
}
final T item = getItemForId(virtualViewId);
if (item == null) {
return null;
}
final AccessibilityNodeInfoCompat node = AccessibilityNodeInfoCompat.obtain();
<DeepExtract>
final int virtualDescendantId = getIdForItem(item);
node.setEnabled(true);
populateNodeForItem(item, node);
if (TextUtils.isEmpty(node.getText()) && TextUtils.isEmpty(node.getContentDescription())) {
throw new RuntimeException("You must add text or a content description in populateNodeForItem()");
}
node.setPackageName(mParentView.getContext().getPackageName());
node.setClassName(item.getClass().getName());
node.setParent(mParentView);
node.setSource(mParentView, virtualDescendantId);
if (mFocusedItemId == virtualDescendantId) {
node.addAction(AccessibilityNodeInfoCompat.ACTION_CLEAR_ACCESSIBILITY_FOCUS);
} else {
node.addAction(AccessibilityNodeInfoCompat.ACTION_ACCESSIBILITY_FOCUS);
}
node.getBoundsInParent(mTempParentRect);
if (mTempParentRect.isEmpty()) {
throw new RuntimeException("You must set parent bounds in populateNodeForItem()");
}
if (intersectVisibleToUser(mTempParentRect)) {
node.setVisibleToUser(true);
node.setBoundsInParent(mTempParentRect);
}
mParentView.getLocationOnScreen(mTempGlobalRect);
final int offsetX = mTempGlobalRect[0];
final int offsetY = mTempGlobalRect[1];
mTempScreenRect.set(mTempParentRect);
mTempScreenRect.offset(offsetX, offsetY);
node.setBoundsInScreen(mTempScreenRect);
return node;
</DeepExtract>
return node;
} | android-betterpickers | positive | 439,967 |
@Test
public void testParseSimple() {
for (String[] test : PARSE_TESTS) {
try {
Regexp re = Parser.parse(test[0], TEST_FLAGS);
String d = dump(re);
Truth.assertWithMessage("parse/dump of " + test[0]).that(d).isEqualTo(test[1]);
} catch (PatternSyntaxException e) {
throw new RuntimeException("Parsing failed: " + test[0], e);
}
}
} | @Test
public void testParseSimple() {
<DeepExtract>
for (String[] test : PARSE_TESTS) {
try {
Regexp re = Parser.parse(test[0], TEST_FLAGS);
String d = dump(re);
Truth.assertWithMessage("parse/dump of " + test[0]).that(d).isEqualTo(test[1]);
} catch (PatternSyntaxException e) {
throw new RuntimeException("Parsing failed: " + test[0], e);
}
}
</DeepExtract>
} | re2j | positive | 439,968 |
public static void drawTextureCropped(Texture texture, float x, float y, float cropXPercent, float cropYPercent) {
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glColor3f(1, 1, 1);
texture.bind();
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(0, 0);
GL11.glVertex2f(x, y);
GL11.glTexCoord2f(texture.getWidth() * cropXPercent, 0);
GL11.glVertex2f(x + texture.getImageWidth() * cropXPercent, y);
GL11.glTexCoord2f(texture.getWidth() * cropXPercent, texture.getHeight() * cropYPercent);
GL11.glVertex2f(x + texture.getImageWidth() * cropXPercent, y + texture.getImageHeight() * cropYPercent);
GL11.glTexCoord2f(0, texture.getHeight() * cropYPercent);
GL11.glVertex2f(x, y + texture.getImageHeight() * cropYPercent);
GL11.glEnd();
GL11.glDisable(GL11.GL_TEXTURE_2D);
} | public static void drawTextureCropped(Texture texture, float x, float y, float cropXPercent, float cropYPercent) {
<DeepExtract>
GL11.glEnable(GL11.GL_TEXTURE_2D);
GL11.glColor3f(1, 1, 1);
texture.bind();
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(0, 0);
GL11.glVertex2f(x, y);
GL11.glTexCoord2f(texture.getWidth() * cropXPercent, 0);
GL11.glVertex2f(x + texture.getImageWidth() * cropXPercent, y);
GL11.glTexCoord2f(texture.getWidth() * cropXPercent, texture.getHeight() * cropYPercent);
GL11.glVertex2f(x + texture.getImageWidth() * cropXPercent, y + texture.getImageHeight() * cropYPercent);
GL11.glTexCoord2f(0, texture.getHeight() * cropYPercent);
GL11.glVertex2f(x, y + texture.getImageHeight() * cropYPercent);
GL11.glEnd();
GL11.glDisable(GL11.GL_TEXTURE_2D);
</DeepExtract>
} | blocks | positive | 439,969 |
public boolean isMaximized() {
if (glfwGetWindowAttrib(handle, GLFW_MAXIMIZED) == GL_TRUE) {
return true;
} else {
return false;
}
} | public boolean isMaximized() {
<DeepExtract>
if (glfwGetWindowAttrib(handle, GLFW_MAXIMIZED) == GL_TRUE) {
return true;
} else {
return false;
}
</DeepExtract>
} | Clear | positive | 439,971 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.