before
stringlengths 12
3.76M
| after
stringlengths 37
3.84M
| repo
stringlengths 1
56
| type
stringclasses 1
value |
|---|---|---|---|
private void uploadFile(String coverPath, String filePath) {
if (loadingDialog == null) {
loadingDialog = new LoadingDialog(getContext());
loadingDialog.setLoadingText(getString(R.string.upload_text));
loadingDialog.setCanceledOnTouchOutside(false);
loadingDialog.setCancelable(false);
}
if (!loadingDialog.isShowing()) {
loadingDialog.show();
}
AtomicInteger count = new AtomicInteger(1);
if (!TextUtils.isEmpty(coverPath)) {
count.set(2);
ArchTaskExecutor.getIOThreadExecutor().execute(new Runnable() {
@Override
public void run() {
int remain = count.decrementAndGet();
coverUrl = FileUploadManager.upload(coverPath);
if (remain <= 0) {
if (!TextUtils.isEmpty(fileUrl) && !TextUtils.isEmpty(coverUrl)) {
publish();
} else {
dismissLoadingDialog();
showToast(getString(R.string.file_upload_failed));
}
}
}
});
}
ArchTaskExecutor.getIOThreadExecutor().execute(new Runnable() {
@Override
public void run() {
int remain = count.decrementAndGet();
fileUrl = FileUploadManager.upload(filePath);
if (remain <= 0) {
if (!TextUtils.isEmpty(fileUrl) || !TextUtils.isEmpty(coverPath) && !TextUtils.isEmpty(coverUrl)) {
publish();
} else {
dismissLoadingDialog();
showToast(getString(R.string.file_upload_failed));
}
}
}
});
}
|
<DeepExtract>
if (loadingDialog == null) {
loadingDialog = new LoadingDialog(getContext());
loadingDialog.setLoadingText(getString(R.string.upload_text));
loadingDialog.setCanceledOnTouchOutside(false);
loadingDialog.setCancelable(false);
}
if (!loadingDialog.isShowing()) {
loadingDialog.show();
}
</DeepExtract>
|
JokeVideo
|
positive
|
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.foodtypefragment, container, false);
ButterKnife.bind(this, view);
mFoodGeneralList = new ArrayList<>();
mAdapter = new FoodGeneralAdapter(getActivity(), R.layout.generalother_listview_item, mFoodGeneralList);
xListView.setAdapter(mAdapter);
xListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
List<FoodGeneralItem> mDatas = mAdapter.returnmDatas();
FoodGeneralItem fooditem = mDatas.get(position - 1);
Intent intent = new Intent(getActivity(), FoodTeachActivity.class);
intent.putExtra("URLLINK", fooditem.getLink());
startActivity(intent);
}
});
xListView.setPullLoadEnable(true);
xListView.setXListViewListener(this);
mFoodTypeFragmentPresenter = new FoodTypeFragmentPresenter(this);
if (NetUtil.checkNet(getActivity())) {
loading.setVisibility(View.VISIBLE);
mFoodTypeFragmentPresenter.onRefresh(mSortBy, mLM, mPage);
} else {
loading.setVisibility(View.GONE);
tip.setVisibility(View.VISIBLE);
}
page = mPage;
return view;
}
|
<DeepExtract>
mFoodGeneralList = new ArrayList<>();
mAdapter = new FoodGeneralAdapter(getActivity(), R.layout.generalother_listview_item, mFoodGeneralList);
xListView.setAdapter(mAdapter);
xListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
List<FoodGeneralItem> mDatas = mAdapter.returnmDatas();
FoodGeneralItem fooditem = mDatas.get(position - 1);
Intent intent = new Intent(getActivity(), FoodTeachActivity.class);
intent.putExtra("URLLINK", fooditem.getLink());
startActivity(intent);
}
});
xListView.setPullLoadEnable(true);
xListView.setXListViewListener(this);
mFoodTypeFragmentPresenter = new FoodTypeFragmentPresenter(this);
if (NetUtil.checkNet(getActivity())) {
loading.setVisibility(View.VISIBLE);
mFoodTypeFragmentPresenter.onRefresh(mSortBy, mLM, mPage);
} else {
loading.setVisibility(View.GONE);
tip.setVisibility(View.VISIBLE);
}
page = mPage;
</DeepExtract>
|
ReIntelligentKitchen
|
positive
|
@Test
public void thenIActionR_doesNothingThenReturnsValue() throws Throwable {
v(tag, "Start " + Thread.currentThread().getStackTrace()[0].getMethodName());
Integer expected = 66;
IAltFuture<?, Integer> test = threadType.then(() -> {
v(tag, "Do 66");
return expected;
}).then(() -> v(tag, "After 66")).then(() -> v(tag, "1")).then(() -> v(tag, "2")).then(() -> v(tag, "3")).then(() -> v(tag, "After notify 66")).fork();
v(tag, "Wait for 66");
return new AltFutureFuture<>(test).get(TEST_TIMEOUT, TimeUnit.MILLISECONDS);
v(tag, "Notified 66");
assertThat(expected).isEqualTo(test.get());
}
|
<DeepExtract>
v(tag, "Start " + Thread.currentThread().getStackTrace()[0].getMethodName());
</DeepExtract>
<DeepExtract>
return new AltFutureFuture<>(test).get(TEST_TIMEOUT, TimeUnit.MILLISECONDS);
</DeepExtract>
|
cascade
|
positive
|
private short computeDigitalSignature(APDU apdu) {
if (!(pw1.isValidated() && pw1_modes[PW1_MODE_NO81]))
ISOException.throwIt(SW_SECURITY_STATUS_NOT_SATISFIED);
if (pw1_status == (byte) 0x00)
pw1_modes[PW1_MODE_NO81] = false;
if (!sig_key.getPrivate().isInitialized())
ISOException.throwIt(SW_REFERENCED_DATA_NOT_FOUND);
cipher.init(sig_key.getPrivate(), Cipher.MODE_ENCRYPT);
for (short i = (short) (ds_counter.length - 1); i >= 0; i--) {
if ((short) (ds_counter[i] & 0xFF) >= 0xFF) {
if (i == 0) {
ISOException.throwIt(SW_WARNING_STATE_UNCHANGED);
} else {
ds_counter[i] = 0;
}
} else {
ds_counter[i]++;
break;
}
}
short length = cipher.doFinal(buffer, _0, in_received, buffer, in_received);
Util.arrayCopyNonAtomic(buffer, in_received, buffer, _0, length);
return length;
}
|
<DeepExtract>
for (short i = (short) (ds_counter.length - 1); i >= 0; i--) {
if ((short) (ds_counter[i] & 0xFF) >= 0xFF) {
if (i == 0) {
ISOException.throwIt(SW_WARNING_STATE_UNCHANGED);
} else {
ds_counter[i] = 0;
}
} else {
ds_counter[i]++;
break;
}
}
</DeepExtract>
|
AppletPlayground
|
positive
|
@Test
public void test() {
assertEquals(CoverageRange.ABYSSMAL, CoverageRange.valueOf(-20.0));
assertNotNull(CoverageRange.fillColorOf(-20.0));
assertNotNull(CoverageRange.ABYSSMAL.getLineColor());
assertNotNull(CoverageRange.ABYSSMAL.getFillHexString());
assertNotNull(CoverageRange.ABYSSMAL.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.ABYSSMAL.getLineColor()));
assertTrue("Had " + -20.0 + " and floor " + CoverageRange.ABYSSMAL.getFloor(), -20.0 < 0 || -20.0 >= CoverageRange.ABYSSMAL.getFloor());
assertEquals(CoverageRange.ABYSSMAL, CoverageRange.valueOf(0.0));
assertNotNull(CoverageRange.fillColorOf(0.0));
assertNotNull(CoverageRange.ABYSSMAL.getLineColor());
assertNotNull(CoverageRange.ABYSSMAL.getFillHexString());
assertNotNull(CoverageRange.ABYSSMAL.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.ABYSSMAL.getLineColor()));
assertTrue("Had " + 0.0 + " and floor " + CoverageRange.ABYSSMAL.getFloor(), 0.0 < 0 || 0.0 >= CoverageRange.ABYSSMAL.getFloor());
assertEquals(CoverageRange.ABYSSMAL, CoverageRange.valueOf(10.3));
assertNotNull(CoverageRange.fillColorOf(10.3));
assertNotNull(CoverageRange.ABYSSMAL.getLineColor());
assertNotNull(CoverageRange.ABYSSMAL.getFillHexString());
assertNotNull(CoverageRange.ABYSSMAL.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.ABYSSMAL.getLineColor()));
assertTrue("Had " + 10.3 + " and floor " + CoverageRange.ABYSSMAL.getFloor(), 10.3 < 0 || 10.3 >= CoverageRange.ABYSSMAL.getFloor());
assertEquals(CoverageRange.TRAGIC, CoverageRange.valueOf(25.0));
assertNotNull(CoverageRange.fillColorOf(25.0));
assertNotNull(CoverageRange.TRAGIC.getLineColor());
assertNotNull(CoverageRange.TRAGIC.getFillHexString());
assertNotNull(CoverageRange.TRAGIC.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.TRAGIC.getLineColor()));
assertTrue("Had " + 25.0 + " and floor " + CoverageRange.TRAGIC.getFloor(), 25.0 < 0 || 25.0 >= CoverageRange.TRAGIC.getFloor());
assertEquals(CoverageRange.TRAGIC, CoverageRange.valueOf(32.0));
assertNotNull(CoverageRange.fillColorOf(32.0));
assertNotNull(CoverageRange.TRAGIC.getLineColor());
assertNotNull(CoverageRange.TRAGIC.getFillHexString());
assertNotNull(CoverageRange.TRAGIC.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.TRAGIC.getLineColor()));
assertTrue("Had " + 32.0 + " and floor " + CoverageRange.TRAGIC.getFloor(), 32.0 < 0 || 32.0 >= CoverageRange.TRAGIC.getFloor());
assertEquals(CoverageRange.POOR, CoverageRange.valueOf(50.0));
assertNotNull(CoverageRange.fillColorOf(50.0));
assertNotNull(CoverageRange.POOR.getLineColor());
assertNotNull(CoverageRange.POOR.getFillHexString());
assertNotNull(CoverageRange.POOR.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.POOR.getLineColor()));
assertTrue("Had " + 50.0 + " and floor " + CoverageRange.POOR.getFloor(), 50.0 < 0 || 50.0 >= CoverageRange.POOR.getFloor());
assertEquals(CoverageRange.POOR, CoverageRange.valueOf(68.2));
assertNotNull(CoverageRange.fillColorOf(68.2));
assertNotNull(CoverageRange.POOR.getLineColor());
assertNotNull(CoverageRange.POOR.getFillHexString());
assertNotNull(CoverageRange.POOR.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.POOR.getLineColor()));
assertTrue("Had " + 68.2 + " and floor " + CoverageRange.POOR.getFloor(), 68.2 < 0 || 68.2 >= CoverageRange.POOR.getFloor());
assertEquals(CoverageRange.FAIR, CoverageRange.valueOf(75.0));
assertNotNull(CoverageRange.fillColorOf(75.0));
assertNotNull(CoverageRange.FAIR.getLineColor());
assertNotNull(CoverageRange.FAIR.getFillHexString());
assertNotNull(CoverageRange.FAIR.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.FAIR.getLineColor()));
assertTrue("Had " + 75.0 + " and floor " + CoverageRange.FAIR.getFloor(), 75.0 < 0 || 75.0 >= CoverageRange.FAIR.getFloor());
assertEquals(CoverageRange.FAIR, CoverageRange.valueOf(83.0));
assertNotNull(CoverageRange.fillColorOf(83.0));
assertNotNull(CoverageRange.FAIR.getLineColor());
assertNotNull(CoverageRange.FAIR.getFillHexString());
assertNotNull(CoverageRange.FAIR.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.FAIR.getLineColor()));
assertTrue("Had " + 83.0 + " and floor " + CoverageRange.FAIR.getFloor(), 83.0 < 0 || 83.0 >= CoverageRange.FAIR.getFloor());
assertEquals(CoverageRange.SUFFICIENT, CoverageRange.valueOf(85.0));
assertNotNull(CoverageRange.fillColorOf(85.0));
assertNotNull(CoverageRange.SUFFICIENT.getLineColor());
assertNotNull(CoverageRange.SUFFICIENT.getFillHexString());
assertNotNull(CoverageRange.SUFFICIENT.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.SUFFICIENT.getLineColor()));
assertTrue("Had " + 85.0 + " and floor " + CoverageRange.SUFFICIENT.getFloor(), 85.0 < 0 || 85.0 >= CoverageRange.SUFFICIENT.getFloor());
assertEquals(CoverageRange.SUFFICIENT, CoverageRange.valueOf(91.0));
assertNotNull(CoverageRange.fillColorOf(91.0));
assertNotNull(CoverageRange.SUFFICIENT.getLineColor());
assertNotNull(CoverageRange.SUFFICIENT.getFillHexString());
assertNotNull(CoverageRange.SUFFICIENT.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.SUFFICIENT.getLineColor()));
assertTrue("Had " + 91.0 + " and floor " + CoverageRange.SUFFICIENT.getFloor(), 91.0 < 0 || 91.0 >= CoverageRange.SUFFICIENT.getFloor());
assertEquals(CoverageRange.GOOD, CoverageRange.valueOf(92.0));
assertNotNull(CoverageRange.fillColorOf(92.0));
assertNotNull(CoverageRange.GOOD.getLineColor());
assertNotNull(CoverageRange.GOOD.getFillHexString());
assertNotNull(CoverageRange.GOOD.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.GOOD.getLineColor()));
assertTrue("Had " + 92.0 + " and floor " + CoverageRange.GOOD.getFloor(), 92.0 < 0 || 92.0 >= CoverageRange.GOOD.getFloor());
assertEquals(CoverageRange.GOOD, CoverageRange.valueOf(96.999));
assertNotNull(CoverageRange.fillColorOf(96.999));
assertNotNull(CoverageRange.GOOD.getLineColor());
assertNotNull(CoverageRange.GOOD.getFillHexString());
assertNotNull(CoverageRange.GOOD.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.GOOD.getLineColor()));
assertTrue("Had " + 96.999 + " and floor " + CoverageRange.GOOD.getFloor(), 96.999 < 0 || 96.999 >= CoverageRange.GOOD.getFloor());
assertEquals(CoverageRange.EXCELLENT, CoverageRange.valueOf(97.0));
assertNotNull(CoverageRange.fillColorOf(97.0));
assertNotNull(CoverageRange.EXCELLENT.getLineColor());
assertNotNull(CoverageRange.EXCELLENT.getFillHexString());
assertNotNull(CoverageRange.EXCELLENT.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.EXCELLENT.getLineColor()));
assertTrue("Had " + 97.0 + " and floor " + CoverageRange.EXCELLENT.getFloor(), 97.0 < 0 || 97.0 >= CoverageRange.EXCELLENT.getFloor());
assertEquals(CoverageRange.EXCELLENT, CoverageRange.valueOf(97.1));
assertNotNull(CoverageRange.fillColorOf(97.1));
assertNotNull(CoverageRange.EXCELLENT.getLineColor());
assertNotNull(CoverageRange.EXCELLENT.getFillHexString());
assertNotNull(CoverageRange.EXCELLENT.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.EXCELLENT.getLineColor()));
assertTrue("Had " + 97.1 + " and floor " + CoverageRange.EXCELLENT.getFloor(), 97.1 < 0 || 97.1 >= CoverageRange.EXCELLENT.getFloor());
assertEquals(CoverageRange.PERFECT, CoverageRange.valueOf(100.0));
assertNotNull(CoverageRange.fillColorOf(100.0));
assertNotNull(CoverageRange.PERFECT.getLineColor());
assertNotNull(CoverageRange.PERFECT.getFillHexString());
assertNotNull(CoverageRange.PERFECT.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.PERFECT.getLineColor()));
assertTrue("Had " + 100.0 + " and floor " + CoverageRange.PERFECT.getFloor(), 100.0 < 0 || 100.0 >= CoverageRange.PERFECT.getFloor());
assertEquals(CoverageRange.PERFECT, CoverageRange.valueOf(230.0));
assertNotNull(CoverageRange.fillColorOf(230.0));
assertNotNull(CoverageRange.PERFECT.getLineColor());
assertNotNull(CoverageRange.PERFECT.getFillHexString());
assertNotNull(CoverageRange.PERFECT.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.PERFECT.getLineColor()));
assertTrue("Had " + 230.0 + " and floor " + CoverageRange.PERFECT.getFloor(), 230.0 < 0 || 230.0 >= CoverageRange.PERFECT.getFloor());
}
|
<DeepExtract>
assertEquals(CoverageRange.ABYSSMAL, CoverageRange.valueOf(-20.0));
assertNotNull(CoverageRange.fillColorOf(-20.0));
assertNotNull(CoverageRange.ABYSSMAL.getLineColor());
assertNotNull(CoverageRange.ABYSSMAL.getFillHexString());
assertNotNull(CoverageRange.ABYSSMAL.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.ABYSSMAL.getLineColor()));
assertTrue("Had " + -20.0 + " and floor " + CoverageRange.ABYSSMAL.getFloor(), -20.0 < 0 || -20.0 >= CoverageRange.ABYSSMAL.getFloor());
</DeepExtract>
<DeepExtract>
assertEquals(CoverageRange.ABYSSMAL, CoverageRange.valueOf(0.0));
assertNotNull(CoverageRange.fillColorOf(0.0));
assertNotNull(CoverageRange.ABYSSMAL.getLineColor());
assertNotNull(CoverageRange.ABYSSMAL.getFillHexString());
assertNotNull(CoverageRange.ABYSSMAL.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.ABYSSMAL.getLineColor()));
assertTrue("Had " + 0.0 + " and floor " + CoverageRange.ABYSSMAL.getFloor(), 0.0 < 0 || 0.0 >= CoverageRange.ABYSSMAL.getFloor());
</DeepExtract>
<DeepExtract>
assertEquals(CoverageRange.ABYSSMAL, CoverageRange.valueOf(10.3));
assertNotNull(CoverageRange.fillColorOf(10.3));
assertNotNull(CoverageRange.ABYSSMAL.getLineColor());
assertNotNull(CoverageRange.ABYSSMAL.getFillHexString());
assertNotNull(CoverageRange.ABYSSMAL.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.ABYSSMAL.getLineColor()));
assertTrue("Had " + 10.3 + " and floor " + CoverageRange.ABYSSMAL.getFloor(), 10.3 < 0 || 10.3 >= CoverageRange.ABYSSMAL.getFloor());
</DeepExtract>
<DeepExtract>
assertEquals(CoverageRange.TRAGIC, CoverageRange.valueOf(25.0));
assertNotNull(CoverageRange.fillColorOf(25.0));
assertNotNull(CoverageRange.TRAGIC.getLineColor());
assertNotNull(CoverageRange.TRAGIC.getFillHexString());
assertNotNull(CoverageRange.TRAGIC.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.TRAGIC.getLineColor()));
assertTrue("Had " + 25.0 + " and floor " + CoverageRange.TRAGIC.getFloor(), 25.0 < 0 || 25.0 >= CoverageRange.TRAGIC.getFloor());
</DeepExtract>
<DeepExtract>
assertEquals(CoverageRange.TRAGIC, CoverageRange.valueOf(32.0));
assertNotNull(CoverageRange.fillColorOf(32.0));
assertNotNull(CoverageRange.TRAGIC.getLineColor());
assertNotNull(CoverageRange.TRAGIC.getFillHexString());
assertNotNull(CoverageRange.TRAGIC.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.TRAGIC.getLineColor()));
assertTrue("Had " + 32.0 + " and floor " + CoverageRange.TRAGIC.getFloor(), 32.0 < 0 || 32.0 >= CoverageRange.TRAGIC.getFloor());
</DeepExtract>
<DeepExtract>
assertEquals(CoverageRange.POOR, CoverageRange.valueOf(50.0));
assertNotNull(CoverageRange.fillColorOf(50.0));
assertNotNull(CoverageRange.POOR.getLineColor());
assertNotNull(CoverageRange.POOR.getFillHexString());
assertNotNull(CoverageRange.POOR.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.POOR.getLineColor()));
assertTrue("Had " + 50.0 + " and floor " + CoverageRange.POOR.getFloor(), 50.0 < 0 || 50.0 >= CoverageRange.POOR.getFloor());
</DeepExtract>
<DeepExtract>
assertEquals(CoverageRange.POOR, CoverageRange.valueOf(68.2));
assertNotNull(CoverageRange.fillColorOf(68.2));
assertNotNull(CoverageRange.POOR.getLineColor());
assertNotNull(CoverageRange.POOR.getFillHexString());
assertNotNull(CoverageRange.POOR.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.POOR.getLineColor()));
assertTrue("Had " + 68.2 + " and floor " + CoverageRange.POOR.getFloor(), 68.2 < 0 || 68.2 >= CoverageRange.POOR.getFloor());
</DeepExtract>
<DeepExtract>
assertEquals(CoverageRange.FAIR, CoverageRange.valueOf(75.0));
assertNotNull(CoverageRange.fillColorOf(75.0));
assertNotNull(CoverageRange.FAIR.getLineColor());
assertNotNull(CoverageRange.FAIR.getFillHexString());
assertNotNull(CoverageRange.FAIR.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.FAIR.getLineColor()));
assertTrue("Had " + 75.0 + " and floor " + CoverageRange.FAIR.getFloor(), 75.0 < 0 || 75.0 >= CoverageRange.FAIR.getFloor());
</DeepExtract>
<DeepExtract>
assertEquals(CoverageRange.FAIR, CoverageRange.valueOf(83.0));
assertNotNull(CoverageRange.fillColorOf(83.0));
assertNotNull(CoverageRange.FAIR.getLineColor());
assertNotNull(CoverageRange.FAIR.getFillHexString());
assertNotNull(CoverageRange.FAIR.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.FAIR.getLineColor()));
assertTrue("Had " + 83.0 + " and floor " + CoverageRange.FAIR.getFloor(), 83.0 < 0 || 83.0 >= CoverageRange.FAIR.getFloor());
</DeepExtract>
<DeepExtract>
assertEquals(CoverageRange.SUFFICIENT, CoverageRange.valueOf(85.0));
assertNotNull(CoverageRange.fillColorOf(85.0));
assertNotNull(CoverageRange.SUFFICIENT.getLineColor());
assertNotNull(CoverageRange.SUFFICIENT.getFillHexString());
assertNotNull(CoverageRange.SUFFICIENT.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.SUFFICIENT.getLineColor()));
assertTrue("Had " + 85.0 + " and floor " + CoverageRange.SUFFICIENT.getFloor(), 85.0 < 0 || 85.0 >= CoverageRange.SUFFICIENT.getFloor());
</DeepExtract>
<DeepExtract>
assertEquals(CoverageRange.SUFFICIENT, CoverageRange.valueOf(91.0));
assertNotNull(CoverageRange.fillColorOf(91.0));
assertNotNull(CoverageRange.SUFFICIENT.getLineColor());
assertNotNull(CoverageRange.SUFFICIENT.getFillHexString());
assertNotNull(CoverageRange.SUFFICIENT.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.SUFFICIENT.getLineColor()));
assertTrue("Had " + 91.0 + " and floor " + CoverageRange.SUFFICIENT.getFloor(), 91.0 < 0 || 91.0 >= CoverageRange.SUFFICIENT.getFloor());
</DeepExtract>
<DeepExtract>
assertEquals(CoverageRange.GOOD, CoverageRange.valueOf(92.0));
assertNotNull(CoverageRange.fillColorOf(92.0));
assertNotNull(CoverageRange.GOOD.getLineColor());
assertNotNull(CoverageRange.GOOD.getFillHexString());
assertNotNull(CoverageRange.GOOD.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.GOOD.getLineColor()));
assertTrue("Had " + 92.0 + " and floor " + CoverageRange.GOOD.getFloor(), 92.0 < 0 || 92.0 >= CoverageRange.GOOD.getFloor());
</DeepExtract>
<DeepExtract>
assertEquals(CoverageRange.GOOD, CoverageRange.valueOf(96.999));
assertNotNull(CoverageRange.fillColorOf(96.999));
assertNotNull(CoverageRange.GOOD.getLineColor());
assertNotNull(CoverageRange.GOOD.getFillHexString());
assertNotNull(CoverageRange.GOOD.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.GOOD.getLineColor()));
assertTrue("Had " + 96.999 + " and floor " + CoverageRange.GOOD.getFloor(), 96.999 < 0 || 96.999 >= CoverageRange.GOOD.getFloor());
</DeepExtract>
<DeepExtract>
assertEquals(CoverageRange.EXCELLENT, CoverageRange.valueOf(97.0));
assertNotNull(CoverageRange.fillColorOf(97.0));
assertNotNull(CoverageRange.EXCELLENT.getLineColor());
assertNotNull(CoverageRange.EXCELLENT.getFillHexString());
assertNotNull(CoverageRange.EXCELLENT.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.EXCELLENT.getLineColor()));
assertTrue("Had " + 97.0 + " and floor " + CoverageRange.EXCELLENT.getFloor(), 97.0 < 0 || 97.0 >= CoverageRange.EXCELLENT.getFloor());
</DeepExtract>
<DeepExtract>
assertEquals(CoverageRange.EXCELLENT, CoverageRange.valueOf(97.1));
assertNotNull(CoverageRange.fillColorOf(97.1));
assertNotNull(CoverageRange.EXCELLENT.getLineColor());
assertNotNull(CoverageRange.EXCELLENT.getFillHexString());
assertNotNull(CoverageRange.EXCELLENT.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.EXCELLENT.getLineColor()));
assertTrue("Had " + 97.1 + " and floor " + CoverageRange.EXCELLENT.getFloor(), 97.1 < 0 || 97.1 >= CoverageRange.EXCELLENT.getFloor());
</DeepExtract>
<DeepExtract>
assertEquals(CoverageRange.PERFECT, CoverageRange.valueOf(100.0));
assertNotNull(CoverageRange.fillColorOf(100.0));
assertNotNull(CoverageRange.PERFECT.getLineColor());
assertNotNull(CoverageRange.PERFECT.getFillHexString());
assertNotNull(CoverageRange.PERFECT.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.PERFECT.getLineColor()));
assertTrue("Had " + 100.0 + " and floor " + CoverageRange.PERFECT.getFloor(), 100.0 < 0 || 100.0 >= CoverageRange.PERFECT.getFloor());
</DeepExtract>
<DeepExtract>
assertEquals(CoverageRange.PERFECT, CoverageRange.valueOf(230.0));
assertNotNull(CoverageRange.fillColorOf(230.0));
assertNotNull(CoverageRange.PERFECT.getLineColor());
assertNotNull(CoverageRange.PERFECT.getFillHexString());
assertNotNull(CoverageRange.PERFECT.getLineHexString());
assertNotNull(CoverageRange.colorAsHexString(CoverageRange.PERFECT.getLineColor()));
assertTrue("Had " + 230.0 + " and floor " + CoverageRange.PERFECT.getFloor(), 230.0 < 0 || 230.0 >= CoverageRange.PERFECT.getFloor());
</DeepExtract>
|
jacoco-plugin
|
positive
|
public static int[] shorten(final int[] list) {
final boolean[] output = new boolean[list.length - 1];
System.arraycopy(list, 0, output, 0, list.length - 1);
return output;
}
|
<DeepExtract>
final boolean[] output = new boolean[list.length - 1];
System.arraycopy(list, 0, output, 0, list.length - 1);
return output;
</DeepExtract>
|
rainbow
|
positive
|
@Override
public void handleEvent(Event event) {
TableColumn[] columns = viewer.getTable().getColumns();
int[] newWidths = new int[columns.length - 1];
int i = 0;
boolean first = true;
for (TableColumn col : columns) {
if (first) {
first = false;
continue;
}
newWidths[i++] = col.getWidth();
}
columnConfig.update(columnConfig.getFields(), newWidths);
}
|
<DeepExtract>
TableColumn[] columns = viewer.getTable().getColumns();
int[] newWidths = new int[columns.length - 1];
int i = 0;
boolean first = true;
for (TableColumn col : columns) {
if (first) {
first = false;
continue;
}
newWidths[i++] = col.getWidth();
}
columnConfig.update(columnConfig.getFields(), newWidths);
</DeepExtract>
|
logsaw-app
|
positive
|
private void performRefreshComplete() {
mStatus = PTR_STATUS_COMPLETE;
if (mScrollChecker.mIsRunning && isAutoRefresh()) {
if (DEBUG) {
PtrCLog.d(LOG_TAG, "performRefreshComplete do nothing, scrolling: %s, auto refresh: %s", mScrollChecker.mIsRunning, mFlag);
}
return;
}
if (mPtrIndicator.hasLeftStartPosition() && !false && mRefreshCompleteHook != null) {
if (DEBUG) {
PtrCLog.d(LOG_TAG, "notifyUIRefreshComplete mRefreshCompleteHook run.");
}
mRefreshCompleteHook.takeOver();
return;
}
if (mPtrUIHandlerHolder.hasHandler()) {
if (DEBUG) {
PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIRefreshComplete");
}
mPtrUIHandlerHolder.onUIRefreshComplete(this);
}
mPtrIndicator.onUIRefreshComplete();
tryScrollBackToTopAfterComplete();
tryToNotifyReset();
}
|
<DeepExtract>
if (mPtrIndicator.hasLeftStartPosition() && !false && mRefreshCompleteHook != null) {
if (DEBUG) {
PtrCLog.d(LOG_TAG, "notifyUIRefreshComplete mRefreshCompleteHook run.");
}
mRefreshCompleteHook.takeOver();
return;
}
if (mPtrUIHandlerHolder.hasHandler()) {
if (DEBUG) {
PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIRefreshComplete");
}
mPtrUIHandlerHolder.onUIRefreshComplete(this);
}
mPtrIndicator.onUIRefreshComplete();
tryScrollBackToTopAfterComplete();
tryToNotifyReset();
</DeepExtract>
|
Android-rxjava-retrofit-okhttp-app
|
positive
|
@EventHandler()
public void onDeath(PlayerDeathEvent event) {
Player p = event.getEntity();
if (NPCChecker.isNPC(p))
return;
event.getDrops().removeIf(item -> {
if (item == null)
return true;
if (item.hasItemMeta()) {
return UTEi18n.cache("item.locked").equalsIgnoreCase(item.getItemMeta().getDisplayName());
}
return false;
});
IPlayer ip = players.get(event.getEntity().getUniqueId());
if (ip == null)
return;
if (EditAction.SET == null)
EditAction.SET = EditAction.INCREMENT;
if (event.getEntity() == null)
return;
if (CheckType.TEMPERATURE == null)
return;
IPlayer ip = players.get(event.getEntity().getUniqueId());
if (ip == null) {
Logging.getLogger().log(Level.SEVERE, "Failed found player data for " + event.getEntity().getName() + ", " + "{class=" + event.getEntity().getClass() + ", uuid=" + event.getEntity().getUniqueId() + "}", new Throwable("Trace Stack Dump"));
return;
}
String mark;
if (getDefault(ip, CheckType.TEMPERATURE, p) > 0)
mark = "↑";
else if (getDefault(ip, CheckType.TEMPERATURE, p) < 0)
mark = "↓";
else
mark = " ";
switch(CheckType.TEMPERATURE) {
case TEMPERATURE:
EditAction.SET.update(() -> ip.temperature, v -> ip.temperature = v, getDefault(ip, CheckType.TEMPERATURE, p));
HudProvider.temperature.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.temperature.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.temperature <= 10)
event.getEntity().sendTitle(UTEi18n.cache("mechanism.temperature.to-cool"), "");
if (ip.temperature >= 60)
event.getEntity().sendTitle(UTEi18n.cache("mechanism.temperature.to-hot"), "");
if (ip.temperature < -5)
ip.temperature = -5;
if (ip.temperature > 75)
ip.temperature = 75;
break;
case HUMIDITY:
EditAction.SET.update(() -> ip.humidity, v -> ip.humidity = v, getDefault(ip, CheckType.TEMPERATURE, p));
HudProvider.humidity.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.humidity.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.humidity < 0)
ip.humidity = 0;
if (ip.humidity > 100)
ip.humidity = 100;
break;
case SANITY:
EditAction.SET.update(() -> ip.sanity, v -> ip.sanity = v, getDefault(ip, CheckType.TEMPERATURE, p));
HudProvider.sanity.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.sanity.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.sanity < 0)
ip.sanity = 0;
if (ip.sanity > ip.roleStats.sanMax)
ip.sanity = ip.roleStats.sanMax;
break;
case TIREDNESS:
EditAction.SET.update(() -> ip.tiredness, v -> ip.tiredness = v, getDefault(ip, CheckType.TEMPERATURE, p));
HudProvider.tiredness.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.tiredness.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.tiredness < 0)
ip.tiredness = 0;
if (ip.tiredness > 100)
ip.tiredness = 100;
break;
case DAMAGELEVEL:
EditAction.SET.update(() -> ip.roleStats.damageLevel, v -> ip.roleStats.damageLevel = v, getDefault(ip, CheckType.TEMPERATURE, p));
break;
case HEALTHMAX:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.healthMax, v -> ip.roleStats.healthMax = v, (int) getDefault(ip, CheckType.TEMPERATURE, p));
break;
case LEVEL:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.level, v -> ip.roleStats.level = v, (int) getDefault(ip, CheckType.TEMPERATURE, p));
break;
case SANMAX:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.sanMax, v -> ip.roleStats.sanMax = v, (int) getDefault(ip, CheckType.TEMPERATURE, p));
break;
}
if (EditAction.SET == null)
EditAction.SET = EditAction.INCREMENT;
if (event.getEntity() == null)
return;
if (CheckType.HUMIDITY == null)
return;
IPlayer ip = players.get(event.getEntity().getUniqueId());
if (ip == null) {
Logging.getLogger().log(Level.SEVERE, "Failed found player data for " + event.getEntity().getName() + ", " + "{class=" + event.getEntity().getClass() + ", uuid=" + event.getEntity().getUniqueId() + "}", new Throwable("Trace Stack Dump"));
return;
}
String mark;
if (getDefault(ip, CheckType.HUMIDITY, p) > 0)
mark = "↑";
else if (getDefault(ip, CheckType.HUMIDITY, p) < 0)
mark = "↓";
else
mark = " ";
switch(CheckType.HUMIDITY) {
case TEMPERATURE:
EditAction.SET.update(() -> ip.temperature, v -> ip.temperature = v, getDefault(ip, CheckType.HUMIDITY, p));
HudProvider.temperature.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.temperature.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.temperature <= 10)
event.getEntity().sendTitle(UTEi18n.cache("mechanism.temperature.to-cool"), "");
if (ip.temperature >= 60)
event.getEntity().sendTitle(UTEi18n.cache("mechanism.temperature.to-hot"), "");
if (ip.temperature < -5)
ip.temperature = -5;
if (ip.temperature > 75)
ip.temperature = 75;
break;
case HUMIDITY:
EditAction.SET.update(() -> ip.humidity, v -> ip.humidity = v, getDefault(ip, CheckType.HUMIDITY, p));
HudProvider.humidity.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.humidity.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.humidity < 0)
ip.humidity = 0;
if (ip.humidity > 100)
ip.humidity = 100;
break;
case SANITY:
EditAction.SET.update(() -> ip.sanity, v -> ip.sanity = v, getDefault(ip, CheckType.HUMIDITY, p));
HudProvider.sanity.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.sanity.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.sanity < 0)
ip.sanity = 0;
if (ip.sanity > ip.roleStats.sanMax)
ip.sanity = ip.roleStats.sanMax;
break;
case TIREDNESS:
EditAction.SET.update(() -> ip.tiredness, v -> ip.tiredness = v, getDefault(ip, CheckType.HUMIDITY, p));
HudProvider.tiredness.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.tiredness.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.tiredness < 0)
ip.tiredness = 0;
if (ip.tiredness > 100)
ip.tiredness = 100;
break;
case DAMAGELEVEL:
EditAction.SET.update(() -> ip.roleStats.damageLevel, v -> ip.roleStats.damageLevel = v, getDefault(ip, CheckType.HUMIDITY, p));
break;
case HEALTHMAX:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.healthMax, v -> ip.roleStats.healthMax = v, (int) getDefault(ip, CheckType.HUMIDITY, p));
break;
case LEVEL:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.level, v -> ip.roleStats.level = v, (int) getDefault(ip, CheckType.HUMIDITY, p));
break;
case SANMAX:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.sanMax, v -> ip.roleStats.sanMax = v, (int) getDefault(ip, CheckType.HUMIDITY, p));
break;
}
if (EditAction.SET == null)
EditAction.SET = EditAction.INCREMENT;
if (event.getEntity() == null)
return;
if (CheckType.SANITY == null)
return;
IPlayer ip = players.get(event.getEntity().getUniqueId());
if (ip == null) {
Logging.getLogger().log(Level.SEVERE, "Failed found player data for " + event.getEntity().getName() + ", " + "{class=" + event.getEntity().getClass() + ", uuid=" + event.getEntity().getUniqueId() + "}", new Throwable("Trace Stack Dump"));
return;
}
String mark;
if (getDefault(ip, CheckType.SANITY, p) > 0)
mark = "↑";
else if (getDefault(ip, CheckType.SANITY, p) < 0)
mark = "↓";
else
mark = " ";
switch(CheckType.SANITY) {
case TEMPERATURE:
EditAction.SET.update(() -> ip.temperature, v -> ip.temperature = v, getDefault(ip, CheckType.SANITY, p));
HudProvider.temperature.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.temperature.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.temperature <= 10)
event.getEntity().sendTitle(UTEi18n.cache("mechanism.temperature.to-cool"), "");
if (ip.temperature >= 60)
event.getEntity().sendTitle(UTEi18n.cache("mechanism.temperature.to-hot"), "");
if (ip.temperature < -5)
ip.temperature = -5;
if (ip.temperature > 75)
ip.temperature = 75;
break;
case HUMIDITY:
EditAction.SET.update(() -> ip.humidity, v -> ip.humidity = v, getDefault(ip, CheckType.SANITY, p));
HudProvider.humidity.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.humidity.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.humidity < 0)
ip.humidity = 0;
if (ip.humidity > 100)
ip.humidity = 100;
break;
case SANITY:
EditAction.SET.update(() -> ip.sanity, v -> ip.sanity = v, getDefault(ip, CheckType.SANITY, p));
HudProvider.sanity.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.sanity.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.sanity < 0)
ip.sanity = 0;
if (ip.sanity > ip.roleStats.sanMax)
ip.sanity = ip.roleStats.sanMax;
break;
case TIREDNESS:
EditAction.SET.update(() -> ip.tiredness, v -> ip.tiredness = v, getDefault(ip, CheckType.SANITY, p));
HudProvider.tiredness.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.tiredness.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.tiredness < 0)
ip.tiredness = 0;
if (ip.tiredness > 100)
ip.tiredness = 100;
break;
case DAMAGELEVEL:
EditAction.SET.update(() -> ip.roleStats.damageLevel, v -> ip.roleStats.damageLevel = v, getDefault(ip, CheckType.SANITY, p));
break;
case HEALTHMAX:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.healthMax, v -> ip.roleStats.healthMax = v, (int) getDefault(ip, CheckType.SANITY, p));
break;
case LEVEL:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.level, v -> ip.roleStats.level = v, (int) getDefault(ip, CheckType.SANITY, p));
break;
case SANMAX:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.sanMax, v -> ip.roleStats.sanMax = v, (int) getDefault(ip, CheckType.SANITY, p));
break;
}
if (EditAction.SET == null)
EditAction.SET = EditAction.INCREMENT;
if (event.getEntity() == null)
return;
if (CheckType.TIREDNESS == null)
return;
IPlayer ip = players.get(event.getEntity().getUniqueId());
if (ip == null) {
Logging.getLogger().log(Level.SEVERE, "Failed found player data for " + event.getEntity().getName() + ", " + "{class=" + event.getEntity().getClass() + ", uuid=" + event.getEntity().getUniqueId() + "}", new Throwable("Trace Stack Dump"));
return;
}
String mark;
if (getDefault(ip, CheckType.TIREDNESS, p) > 0)
mark = "↑";
else if (getDefault(ip, CheckType.TIREDNESS, p) < 0)
mark = "↓";
else
mark = " ";
switch(CheckType.TIREDNESS) {
case TEMPERATURE:
EditAction.SET.update(() -> ip.temperature, v -> ip.temperature = v, getDefault(ip, CheckType.TIREDNESS, p));
HudProvider.temperature.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.temperature.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.temperature <= 10)
event.getEntity().sendTitle(UTEi18n.cache("mechanism.temperature.to-cool"), "");
if (ip.temperature >= 60)
event.getEntity().sendTitle(UTEi18n.cache("mechanism.temperature.to-hot"), "");
if (ip.temperature < -5)
ip.temperature = -5;
if (ip.temperature > 75)
ip.temperature = 75;
break;
case HUMIDITY:
EditAction.SET.update(() -> ip.humidity, v -> ip.humidity = v, getDefault(ip, CheckType.TIREDNESS, p));
HudProvider.humidity.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.humidity.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.humidity < 0)
ip.humidity = 0;
if (ip.humidity > 100)
ip.humidity = 100;
break;
case SANITY:
EditAction.SET.update(() -> ip.sanity, v -> ip.sanity = v, getDefault(ip, CheckType.TIREDNESS, p));
HudProvider.sanity.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.sanity.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.sanity < 0)
ip.sanity = 0;
if (ip.sanity > ip.roleStats.sanMax)
ip.sanity = ip.roleStats.sanMax;
break;
case TIREDNESS:
EditAction.SET.update(() -> ip.tiredness, v -> ip.tiredness = v, getDefault(ip, CheckType.TIREDNESS, p));
HudProvider.tiredness.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.tiredness.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.tiredness < 0)
ip.tiredness = 0;
if (ip.tiredness > 100)
ip.tiredness = 100;
break;
case DAMAGELEVEL:
EditAction.SET.update(() -> ip.roleStats.damageLevel, v -> ip.roleStats.damageLevel = v, getDefault(ip, CheckType.TIREDNESS, p));
break;
case HEALTHMAX:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.healthMax, v -> ip.roleStats.healthMax = v, (int) getDefault(ip, CheckType.TIREDNESS, p));
break;
case LEVEL:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.level, v -> ip.roleStats.level = v, (int) getDefault(ip, CheckType.TIREDNESS, p));
break;
case SANMAX:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.sanMax, v -> ip.roleStats.sanMax = v, (int) getDefault(ip, CheckType.TIREDNESS, p));
break;
}
if (RolesSettings.resetRoleOnPlayerDeath) {
changeRole(event.getEntity(), Roles.DEFAULT);
playerChangedRole.remove(event.getEntity().getUniqueId());
}
Logging.getLogger().log(Level.FINER, "Saving save for " + event.getEntity());
Map<String, Object> data = new HashMap<>();
IPlayer player = players.get(event.getEntity().getUniqueId());
data.put("humidity", player.humidity);
data.put("temperature", player.temperature);
data.put("sanity", player.sanity);
data.put("tiredness", player.tiredness);
data.put("role", player.role.toString());
data.put("level", player.roleStats.level);
data.put("sanMax", player.roleStats.sanMax);
data.put("healthMax", player.roleStats.healthMax);
data.put("damageLevel", player.roleStats.damageLevel);
data.put("unlockedRecipes", player.unlockedRecipes);
try {
PlayerDataLoaderImpl.loader.save(playerdata, event.getEntity(), data);
} catch (IOException e) {
Logging.getLogger().log(Level.WARNING, "Failed save data for " + event.getEntity(), e);
}
}
|
<DeepExtract>
if (EditAction.SET == null)
EditAction.SET = EditAction.INCREMENT;
if (event.getEntity() == null)
return;
if (CheckType.TEMPERATURE == null)
return;
IPlayer ip = players.get(event.getEntity().getUniqueId());
if (ip == null) {
Logging.getLogger().log(Level.SEVERE, "Failed found player data for " + event.getEntity().getName() + ", " + "{class=" + event.getEntity().getClass() + ", uuid=" + event.getEntity().getUniqueId() + "}", new Throwable("Trace Stack Dump"));
return;
}
String mark;
if (getDefault(ip, CheckType.TEMPERATURE, p) > 0)
mark = "↑";
else if (getDefault(ip, CheckType.TEMPERATURE, p) < 0)
mark = "↓";
else
mark = " ";
switch(CheckType.TEMPERATURE) {
case TEMPERATURE:
EditAction.SET.update(() -> ip.temperature, v -> ip.temperature = v, getDefault(ip, CheckType.TEMPERATURE, p));
HudProvider.temperature.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.temperature.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.temperature <= 10)
event.getEntity().sendTitle(UTEi18n.cache("mechanism.temperature.to-cool"), "");
if (ip.temperature >= 60)
event.getEntity().sendTitle(UTEi18n.cache("mechanism.temperature.to-hot"), "");
if (ip.temperature < -5)
ip.temperature = -5;
if (ip.temperature > 75)
ip.temperature = 75;
break;
case HUMIDITY:
EditAction.SET.update(() -> ip.humidity, v -> ip.humidity = v, getDefault(ip, CheckType.TEMPERATURE, p));
HudProvider.humidity.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.humidity.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.humidity < 0)
ip.humidity = 0;
if (ip.humidity > 100)
ip.humidity = 100;
break;
case SANITY:
EditAction.SET.update(() -> ip.sanity, v -> ip.sanity = v, getDefault(ip, CheckType.TEMPERATURE, p));
HudProvider.sanity.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.sanity.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.sanity < 0)
ip.sanity = 0;
if (ip.sanity > ip.roleStats.sanMax)
ip.sanity = ip.roleStats.sanMax;
break;
case TIREDNESS:
EditAction.SET.update(() -> ip.tiredness, v -> ip.tiredness = v, getDefault(ip, CheckType.TEMPERATURE, p));
HudProvider.tiredness.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.tiredness.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.tiredness < 0)
ip.tiredness = 0;
if (ip.tiredness > 100)
ip.tiredness = 100;
break;
case DAMAGELEVEL:
EditAction.SET.update(() -> ip.roleStats.damageLevel, v -> ip.roleStats.damageLevel = v, getDefault(ip, CheckType.TEMPERATURE, p));
break;
case HEALTHMAX:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.healthMax, v -> ip.roleStats.healthMax = v, (int) getDefault(ip, CheckType.TEMPERATURE, p));
break;
case LEVEL:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.level, v -> ip.roleStats.level = v, (int) getDefault(ip, CheckType.TEMPERATURE, p));
break;
case SANMAX:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.sanMax, v -> ip.roleStats.sanMax = v, (int) getDefault(ip, CheckType.TEMPERATURE, p));
break;
}
</DeepExtract>
<DeepExtract>
if (EditAction.SET == null)
EditAction.SET = EditAction.INCREMENT;
if (event.getEntity() == null)
return;
if (CheckType.HUMIDITY == null)
return;
IPlayer ip = players.get(event.getEntity().getUniqueId());
if (ip == null) {
Logging.getLogger().log(Level.SEVERE, "Failed found player data for " + event.getEntity().getName() + ", " + "{class=" + event.getEntity().getClass() + ", uuid=" + event.getEntity().getUniqueId() + "}", new Throwable("Trace Stack Dump"));
return;
}
String mark;
if (getDefault(ip, CheckType.HUMIDITY, p) > 0)
mark = "↑";
else if (getDefault(ip, CheckType.HUMIDITY, p) < 0)
mark = "↓";
else
mark = " ";
switch(CheckType.HUMIDITY) {
case TEMPERATURE:
EditAction.SET.update(() -> ip.temperature, v -> ip.temperature = v, getDefault(ip, CheckType.HUMIDITY, p));
HudProvider.temperature.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.temperature.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.temperature <= 10)
event.getEntity().sendTitle(UTEi18n.cache("mechanism.temperature.to-cool"), "");
if (ip.temperature >= 60)
event.getEntity().sendTitle(UTEi18n.cache("mechanism.temperature.to-hot"), "");
if (ip.temperature < -5)
ip.temperature = -5;
if (ip.temperature > 75)
ip.temperature = 75;
break;
case HUMIDITY:
EditAction.SET.update(() -> ip.humidity, v -> ip.humidity = v, getDefault(ip, CheckType.HUMIDITY, p));
HudProvider.humidity.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.humidity.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.humidity < 0)
ip.humidity = 0;
if (ip.humidity > 100)
ip.humidity = 100;
break;
case SANITY:
EditAction.SET.update(() -> ip.sanity, v -> ip.sanity = v, getDefault(ip, CheckType.HUMIDITY, p));
HudProvider.sanity.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.sanity.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.sanity < 0)
ip.sanity = 0;
if (ip.sanity > ip.roleStats.sanMax)
ip.sanity = ip.roleStats.sanMax;
break;
case TIREDNESS:
EditAction.SET.update(() -> ip.tiredness, v -> ip.tiredness = v, getDefault(ip, CheckType.HUMIDITY, p));
HudProvider.tiredness.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.tiredness.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.tiredness < 0)
ip.tiredness = 0;
if (ip.tiredness > 100)
ip.tiredness = 100;
break;
case DAMAGELEVEL:
EditAction.SET.update(() -> ip.roleStats.damageLevel, v -> ip.roleStats.damageLevel = v, getDefault(ip, CheckType.HUMIDITY, p));
break;
case HEALTHMAX:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.healthMax, v -> ip.roleStats.healthMax = v, (int) getDefault(ip, CheckType.HUMIDITY, p));
break;
case LEVEL:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.level, v -> ip.roleStats.level = v, (int) getDefault(ip, CheckType.HUMIDITY, p));
break;
case SANMAX:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.sanMax, v -> ip.roleStats.sanMax = v, (int) getDefault(ip, CheckType.HUMIDITY, p));
break;
}
</DeepExtract>
<DeepExtract>
if (EditAction.SET == null)
EditAction.SET = EditAction.INCREMENT;
if (event.getEntity() == null)
return;
if (CheckType.SANITY == null)
return;
IPlayer ip = players.get(event.getEntity().getUniqueId());
if (ip == null) {
Logging.getLogger().log(Level.SEVERE, "Failed found player data for " + event.getEntity().getName() + ", " + "{class=" + event.getEntity().getClass() + ", uuid=" + event.getEntity().getUniqueId() + "}", new Throwable("Trace Stack Dump"));
return;
}
String mark;
if (getDefault(ip, CheckType.SANITY, p) > 0)
mark = "↑";
else if (getDefault(ip, CheckType.SANITY, p) < 0)
mark = "↓";
else
mark = " ";
switch(CheckType.SANITY) {
case TEMPERATURE:
EditAction.SET.update(() -> ip.temperature, v -> ip.temperature = v, getDefault(ip, CheckType.SANITY, p));
HudProvider.temperature.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.temperature.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.temperature <= 10)
event.getEntity().sendTitle(UTEi18n.cache("mechanism.temperature.to-cool"), "");
if (ip.temperature >= 60)
event.getEntity().sendTitle(UTEi18n.cache("mechanism.temperature.to-hot"), "");
if (ip.temperature < -5)
ip.temperature = -5;
if (ip.temperature > 75)
ip.temperature = 75;
break;
case HUMIDITY:
EditAction.SET.update(() -> ip.humidity, v -> ip.humidity = v, getDefault(ip, CheckType.SANITY, p));
HudProvider.humidity.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.humidity.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.humidity < 0)
ip.humidity = 0;
if (ip.humidity > 100)
ip.humidity = 100;
break;
case SANITY:
EditAction.SET.update(() -> ip.sanity, v -> ip.sanity = v, getDefault(ip, CheckType.SANITY, p));
HudProvider.sanity.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.sanity.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.sanity < 0)
ip.sanity = 0;
if (ip.sanity > ip.roleStats.sanMax)
ip.sanity = ip.roleStats.sanMax;
break;
case TIREDNESS:
EditAction.SET.update(() -> ip.tiredness, v -> ip.tiredness = v, getDefault(ip, CheckType.SANITY, p));
HudProvider.tiredness.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.tiredness.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.tiredness < 0)
ip.tiredness = 0;
if (ip.tiredness > 100)
ip.tiredness = 100;
break;
case DAMAGELEVEL:
EditAction.SET.update(() -> ip.roleStats.damageLevel, v -> ip.roleStats.damageLevel = v, getDefault(ip, CheckType.SANITY, p));
break;
case HEALTHMAX:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.healthMax, v -> ip.roleStats.healthMax = v, (int) getDefault(ip, CheckType.SANITY, p));
break;
case LEVEL:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.level, v -> ip.roleStats.level = v, (int) getDefault(ip, CheckType.SANITY, p));
break;
case SANMAX:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.sanMax, v -> ip.roleStats.sanMax = v, (int) getDefault(ip, CheckType.SANITY, p));
break;
}
</DeepExtract>
<DeepExtract>
if (EditAction.SET == null)
EditAction.SET = EditAction.INCREMENT;
if (event.getEntity() == null)
return;
if (CheckType.TIREDNESS == null)
return;
IPlayer ip = players.get(event.getEntity().getUniqueId());
if (ip == null) {
Logging.getLogger().log(Level.SEVERE, "Failed found player data for " + event.getEntity().getName() + ", " + "{class=" + event.getEntity().getClass() + ", uuid=" + event.getEntity().getUniqueId() + "}", new Throwable("Trace Stack Dump"));
return;
}
String mark;
if (getDefault(ip, CheckType.TIREDNESS, p) > 0)
mark = "↑";
else if (getDefault(ip, CheckType.TIREDNESS, p) < 0)
mark = "↓";
else
mark = " ";
switch(CheckType.TIREDNESS) {
case TEMPERATURE:
EditAction.SET.update(() -> ip.temperature, v -> ip.temperature = v, getDefault(ip, CheckType.TIREDNESS, p));
HudProvider.temperature.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.temperature.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.temperature <= 10)
event.getEntity().sendTitle(UTEi18n.cache("mechanism.temperature.to-cool"), "");
if (ip.temperature >= 60)
event.getEntity().sendTitle(UTEi18n.cache("mechanism.temperature.to-hot"), "");
if (ip.temperature < -5)
ip.temperature = -5;
if (ip.temperature > 75)
ip.temperature = 75;
break;
case HUMIDITY:
EditAction.SET.update(() -> ip.humidity, v -> ip.humidity = v, getDefault(ip, CheckType.TIREDNESS, p));
HudProvider.humidity.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.humidity.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.humidity < 0)
ip.humidity = 0;
if (ip.humidity > 100)
ip.humidity = 100;
break;
case SANITY:
EditAction.SET.update(() -> ip.sanity, v -> ip.sanity = v, getDefault(ip, CheckType.TIREDNESS, p));
HudProvider.sanity.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.sanity.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.sanity < 0)
ip.sanity = 0;
if (ip.sanity > ip.roleStats.sanMax)
ip.sanity = ip.roleStats.sanMax;
break;
case TIREDNESS:
EditAction.SET.update(() -> ip.tiredness, v -> ip.tiredness = v, getDefault(ip, CheckType.TIREDNESS, p));
HudProvider.tiredness.put(event.getEntity().getUniqueId(), mark);
new BukkitRunnable() {
@Override
public void run() {
HudProvider.tiredness.computeIfPresent(event.getEntity().getUniqueId(), buildMarkFunc(mark));
}
}.runTaskLater(plugin, 40L);
if (ip.tiredness < 0)
ip.tiredness = 0;
if (ip.tiredness > 100)
ip.tiredness = 100;
break;
case DAMAGELEVEL:
EditAction.SET.update(() -> ip.roleStats.damageLevel, v -> ip.roleStats.damageLevel = v, getDefault(ip, CheckType.TIREDNESS, p));
break;
case HEALTHMAX:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.healthMax, v -> ip.roleStats.healthMax = v, (int) getDefault(ip, CheckType.TIREDNESS, p));
break;
case LEVEL:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.level, v -> ip.roleStats.level = v, (int) getDefault(ip, CheckType.TIREDNESS, p));
break;
case SANMAX:
EditAction.SET.update((IntSupplier) () -> ip.roleStats.sanMax, v -> ip.roleStats.sanMax = v, (int) getDefault(ip, CheckType.TIREDNESS, p));
break;
}
</DeepExtract>
<DeepExtract>
Logging.getLogger().log(Level.FINER, "Saving save for " + event.getEntity());
Map<String, Object> data = new HashMap<>();
IPlayer player = players.get(event.getEntity().getUniqueId());
data.put("humidity", player.humidity);
data.put("temperature", player.temperature);
data.put("sanity", player.sanity);
data.put("tiredness", player.tiredness);
data.put("role", player.role.toString());
data.put("level", player.roleStats.level);
data.put("sanMax", player.roleStats.sanMax);
data.put("healthMax", player.roleStats.healthMax);
data.put("damageLevel", player.roleStats.damageLevel);
data.put("unlockedRecipes", player.unlockedRecipes);
try {
PlayerDataLoaderImpl.loader.save(playerdata, event.getEntity(), data);
} catch (IOException e) {
Logging.getLogger().log(Level.WARNING, "Failed save data for " + event.getEntity(), e);
}
</DeepExtract>
|
UntilTheEnd
|
positive
|
@Override
public void onClickYes() {
button.setText("登录");
button.setEnabled(true);
etAccount.setEnabled(true);
etPwd.setEnabled(true);
etPwd2.setEnabled(true);
progressBar.setVisibility(View.GONE);
}
|
<DeepExtract>
button.setText("登录");
button.setEnabled(true);
etAccount.setEnabled(true);
etPwd.setEnabled(true);
etPwd2.setEnabled(true);
progressBar.setVisibility(View.GONE);
</DeepExtract>
|
GuetClassTable
|
positive
|
public String getFormatTotalSize() {
String displaySize;
if (totalSize.divide(ONE_EB_BI).compareTo(BigInteger.ZERO) > 0) {
displaySize = String.valueOf(totalSize.divide(ONE_EB_BI)) + " EB";
} else if (totalSize.divide(ONE_PB_BI).compareTo(BigInteger.ZERO) > 0) {
displaySize = String.valueOf(totalSize.divide(ONE_PB_BI)) + " PB";
} else if (totalSize.divide(ONE_TB_BI).compareTo(BigInteger.ZERO) > 0) {
displaySize = String.valueOf(totalSize.divide(ONE_TB_BI)) + " TB";
} else if (totalSize.divide(ONE_GB_BI).compareTo(BigInteger.ZERO) > 0) {
displaySize = String.valueOf(totalSize.divide(ONE_GB_BI)) + " GB";
} else if (totalSize.divide(ONE_MB_BI).compareTo(BigInteger.ZERO) > 0) {
displaySize = String.valueOf(totalSize.divide(ONE_MB_BI)) + " MB";
} else if (totalSize.divide(ONE_KB_BI).compareTo(BigInteger.ZERO) > 0) {
displaySize = String.valueOf(totalSize.divide(ONE_KB_BI)) + " KB";
} else {
displaySize = String.valueOf(totalSize) + " bytes";
}
return displaySize;
}
|
<DeepExtract>
String displaySize;
if (totalSize.divide(ONE_EB_BI).compareTo(BigInteger.ZERO) > 0) {
displaySize = String.valueOf(totalSize.divide(ONE_EB_BI)) + " EB";
} else if (totalSize.divide(ONE_PB_BI).compareTo(BigInteger.ZERO) > 0) {
displaySize = String.valueOf(totalSize.divide(ONE_PB_BI)) + " PB";
} else if (totalSize.divide(ONE_TB_BI).compareTo(BigInteger.ZERO) > 0) {
displaySize = String.valueOf(totalSize.divide(ONE_TB_BI)) + " TB";
} else if (totalSize.divide(ONE_GB_BI).compareTo(BigInteger.ZERO) > 0) {
displaySize = String.valueOf(totalSize.divide(ONE_GB_BI)) + " GB";
} else if (totalSize.divide(ONE_MB_BI).compareTo(BigInteger.ZERO) > 0) {
displaySize = String.valueOf(totalSize.divide(ONE_MB_BI)) + " MB";
} else if (totalSize.divide(ONE_KB_BI).compareTo(BigInteger.ZERO) > 0) {
displaySize = String.valueOf(totalSize.divide(ONE_KB_BI)) + " KB";
} else {
displaySize = String.valueOf(totalSize) + " bytes";
}
return displaySize;
</DeepExtract>
|
XinFrameworkLib
|
positive
|
@Nullable
private JsonPointer getMatchingPointer(final JsonRef ref) {
if (otherRefs.containsKey(ref))
return otherRefs.get(ref);
if (!ref.isLegal())
return null;
final JsonPointer refPtr = ref.getPointer();
for (final Map.Entry<JsonRef, JsonPointer> entry : absRefs.entrySet()) if (entry.getKey().contains(ref))
return entry.getValue().append(refPtr);
return key.getLoadingRef().contains(ref) ? refPtr : null;
}
|
<DeepExtract>
final JsonPointer refPtr = ref.getPointer();
for (final Map.Entry<JsonRef, JsonPointer> entry : absRefs.entrySet()) if (entry.getKey().contains(ref))
return entry.getValue().append(refPtr);
return key.getLoadingRef().contains(ref) ? refPtr : null;
</DeepExtract>
|
json-schema-core
|
positive
|
public MSSRegistrationReq createRegistrationReq(final String apTransId) {
MSSRegistrationReq req = mssObjFactory.createMSSRegistrationReq();
if (req == null)
throw new IllegalArgumentException("Invalid request (null)");
req.setMajorVersion(Long.valueOf(1));
req.setMinorVersion(Long.valueOf(1));
if (apTransId != null) {
final MessageAbstractType.APInfo aiObject = mssObjFactory.createMessageAbstractTypeAPInfo();
aiObject.setAPID(this.apId);
aiObject.setAPPWD(this.apPwd);
aiObject.setAPTransID(apTransId);
aiObject.setInstant(new GregorianCalendar());
req.setAPInfo(aiObject);
}
final MessageAbstractType.MSSPInfo miObject = mssObjFactory.createMessageAbstractTypeMSSPInfo();
miObject.setMSSPID(mssObjFactory.createMeshMemberType());
req.setMSSPInfo(miObject);
req.setMobileUser(mssObjFactory.createMobileUserType());
return req;
}
|
<DeepExtract>
if (req == null)
throw new IllegalArgumentException("Invalid request (null)");
req.setMajorVersion(Long.valueOf(1));
req.setMinorVersion(Long.valueOf(1));
if (apTransId != null) {
final MessageAbstractType.APInfo aiObject = mssObjFactory.createMessageAbstractTypeAPInfo();
aiObject.setAPID(this.apId);
aiObject.setAPPWD(this.apPwd);
aiObject.setAPTransID(apTransId);
aiObject.setInstant(new GregorianCalendar());
req.setAPInfo(aiObject);
}
final MessageAbstractType.MSSPInfo miObject = mssObjFactory.createMessageAbstractTypeMSSPInfo();
miObject.setMSSPID(mssObjFactory.createMeshMemberType());
req.setMSSPInfo(miObject);
</DeepExtract>
|
laverca
|
positive
|
public static void showShortToast(CharSequence text) {
showToast(Utils.getContext().getResources().getText(text).toString(), Toast.LENGTH_SHORT);
}
|
<DeepExtract>
showToast(Utils.getContext().getResources().getText(text).toString(), Toast.LENGTH_SHORT);
</DeepExtract>
|
Componentized
|
positive
|
public static void numericConcept(String token, ConceptNumeric concept, boolean required, Locale locale, FormField formField) {
String bindName = token;
Element controlNode = getParentNode(formField, locale).createElement(XformBuilder.NAMESPACE_XFORMS, null);
controlNode.setName(XformBuilder.CONTROL_INPUT);
controlNode.setAttribute(null, XformBuilder.ATTRIBUTE_BIND, bindName);
Element bindNode = (Element) bindings.get(bindName);
if (bindNode == null) {
System.out.println("NULL bindNode for: " + bindName);
return null;
}
bindNode.setAttribute(null, XformBuilder.ATTRIBUTE_TYPE, XformBuilder.DATA_TYPE_DECIMAL);
Element labelNode = getParentNode(formField, locale).createElement(XformBuilder.NAMESPACE_XFORMS, null);
labelNode.setName(XformBuilder.NODE_LABEL);
ConceptName name = concept.getBestName(locale);
if (name == null) {
name = concept.getName();
}
labelNode.addChild(Element.TEXT, name.getName());
controlNode.addChild(Element.ELEMENT, labelNode);
addHintNode(labelNode, concept);
XformBuilder.addControl(getParentNode(formField, locale), controlNode);
if (concept instanceof ConceptNumeric) {
ConceptNumeric numericConcept = (ConceptNumeric) concept;
if (numericConcept.isPrecise()) {
Double minInclusive = numericConcept.getLowAbsolute();
Double maxInclusive = numericConcept.getHiAbsolute();
if (!(minInclusive == null && maxInclusive == null)) {
String lower = (minInclusive == null ? "" : FormSchemaFragment.numericToString(minInclusive, numericConcept.isPrecise()));
String upper = (maxInclusive == null ? "" : FormSchemaFragment.numericToString(maxInclusive, numericConcept.isPrecise()));
bindNode.setAttribute(null, XformBuilder.ATTRIBUTE_CONSTRAINT, ". >= " + lower + " and . <= " + upper);
bindNode.setAttribute(null, (XformsUtil.isJavaRosaSaveFormat() ? "jr:constraintMsg" : XformBuilder.ATTRIBUTE_MESSAGE), "value should be between " + lower + " and " + upper + " inclusive");
}
}
}
return controlNode;
}
|
<DeepExtract>
String bindName = token;
Element controlNode = getParentNode(formField, locale).createElement(XformBuilder.NAMESPACE_XFORMS, null);
controlNode.setName(XformBuilder.CONTROL_INPUT);
controlNode.setAttribute(null, XformBuilder.ATTRIBUTE_BIND, bindName);
Element bindNode = (Element) bindings.get(bindName);
if (bindNode == null) {
System.out.println("NULL bindNode for: " + bindName);
return null;
}
bindNode.setAttribute(null, XformBuilder.ATTRIBUTE_TYPE, XformBuilder.DATA_TYPE_DECIMAL);
Element labelNode = getParentNode(formField, locale).createElement(XformBuilder.NAMESPACE_XFORMS, null);
labelNode.setName(XformBuilder.NODE_LABEL);
ConceptName name = concept.getBestName(locale);
if (name == null) {
name = concept.getName();
}
labelNode.addChild(Element.TEXT, name.getName());
controlNode.addChild(Element.ELEMENT, labelNode);
addHintNode(labelNode, concept);
XformBuilder.addControl(getParentNode(formField, locale), controlNode);
if (concept instanceof ConceptNumeric) {
ConceptNumeric numericConcept = (ConceptNumeric) concept;
if (numericConcept.isPrecise()) {
Double minInclusive = numericConcept.getLowAbsolute();
Double maxInclusive = numericConcept.getHiAbsolute();
if (!(minInclusive == null && maxInclusive == null)) {
String lower = (minInclusive == null ? "" : FormSchemaFragment.numericToString(minInclusive, numericConcept.isPrecise()));
String upper = (maxInclusive == null ? "" : FormSchemaFragment.numericToString(maxInclusive, numericConcept.isPrecise()));
bindNode.setAttribute(null, XformBuilder.ATTRIBUTE_CONSTRAINT, ". >= " + lower + " and . <= " + upper);
bindNode.setAttribute(null, (XformsUtil.isJavaRosaSaveFormat() ? "jr:constraintMsg" : XformBuilder.ATTRIBUTE_MESSAGE), "value should be between " + lower + " and " + upper + " inclusive");
}
}
}
return controlNode;
</DeepExtract>
|
buendia
|
positive
|
@Override
public void closeEmphasis(SpannableStringBuilder out) {
int len = out.length();
T obj = getLast(out, Italic.class);
int where = out.getSpanStart(obj);
out.removeSpan(obj);
Object[] nestSpans = out.getSpans(where, len, Object.class);
List<NestSpanInfo> spans = new ArrayList<>();
for (Object nestSpan : nestSpans) {
int spanStart = out.getSpanStart(nestSpan);
int spanEnd = out.getSpanEnd(nestSpan);
int spanFlags = out.getSpanFlags(nestSpan);
out.removeSpan(nestSpan);
spans.add(new NestSpanInfo(nestSpan, spanStart, spanEnd, spanFlags));
}
if (where != len) {
out.setSpan(new StyleSpan(Typeface.ITALIC), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
for (NestSpanInfo span : spans) {
out.setSpan(span.span, span.start, span.end, span.flag);
}
}
|
<DeepExtract>
int len = out.length();
T obj = getLast(out, Italic.class);
int where = out.getSpanStart(obj);
out.removeSpan(obj);
Object[] nestSpans = out.getSpans(where, len, Object.class);
List<NestSpanInfo> spans = new ArrayList<>();
for (Object nestSpan : nestSpans) {
int spanStart = out.getSpanStart(nestSpan);
int spanEnd = out.getSpanEnd(nestSpan);
int spanFlags = out.getSpanFlags(nestSpan);
out.removeSpan(nestSpan);
spans.add(new NestSpanInfo(nestSpan, spanStart, spanEnd, spanFlags));
}
if (where != len) {
out.setSpan(new StyleSpan(Typeface.ITALIC), where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
for (NestSpanInfo span : spans) {
out.setSpan(span.span, span.start, span.end, span.flag);
}
</DeepExtract>
|
kaif-android
|
positive
|
public static EventAssertOperationBuilder fromEventInfo(EventInfo eventInfo) {
this.data = eventInfo.getEventData();
return this;
}
|
<DeepExtract>
this.data = eventInfo.getEventData();
return this;
</DeepExtract>
|
eventuate-cdc
|
positive
|
@Override
public void forward() {
this.setStringAttribute(POLARITY, POLARITY_NORMAL);
this.power = this.power;
this.setIntegerAttribute(DUTY_CYCLE, this.power);
this.setStringAttribute(COMMAND, RUN_FOREVER);
}
|
<DeepExtract>
this.setStringAttribute(POLARITY, POLARITY_NORMAL);
</DeepExtract>
<DeepExtract>
this.power = this.power;
this.setIntegerAttribute(DUTY_CYCLE, this.power);
</DeepExtract>
|
ev3dev-lang-java
|
positive
|
private void addMethodDesc(final String desc) {
switch(Type.getReturnType(desc).getSort()) {
case Type.ARRAY:
addType(Type.getReturnType(desc).getElementType());
break;
case Type.OBJECT:
addName(Type.getReturnType(desc).getInternalName());
break;
}
Type[] types = Type.getArgumentTypes(desc);
for (int i = 0; i < types.length; i++) {
addType(types[i]);
}
}
|
<DeepExtract>
switch(Type.getReturnType(desc).getSort()) {
case Type.ARRAY:
addType(Type.getReturnType(desc).getElementType());
break;
case Type.OBJECT:
addName(Type.getReturnType(desc).getInternalName());
break;
}
</DeepExtract>
|
vinja
|
positive
|
private void createArtworkRequestQueue(final boolean fetchAlbums, final boolean fetchArtists) {
mArtworkRequestQueue.clear();
if (fetchAlbums) {
List<AlbumModel> albums = MusicLibraryHelper.getAllAlbums(getApplicationContext());
for (AlbumModel album : albums) {
mArtworkRequestQueue.add(new ArtworkRequestModel(album));
}
}
if (fetchArtists) {
List<ArtistModel> artists = MusicLibraryHelper.getAllArtists(false, getApplicationContext());
for (ArtistModel artist : artists) {
mArtworkRequestQueue.add(new ArtworkRequestModel(artist));
}
}
if (BuildConfig.DEBUG) {
Log.v(TAG, "Bulkloading started with: " + mArtworkRequestQueue.size());
}
mSumArtworkRequests = mArtworkRequestQueue.size();
mBuilder.setContentTitle(getString(R.string.downloader_notification_remaining_images));
if (mArtworkRequestQueue.isEmpty()) {
finishedLoading();
} else {
performNextRequest();
}
}
|
<DeepExtract>
if (BuildConfig.DEBUG) {
Log.v(TAG, "Bulkloading started with: " + mArtworkRequestQueue.size());
}
mSumArtworkRequests = mArtworkRequestQueue.size();
mBuilder.setContentTitle(getString(R.string.downloader_notification_remaining_images));
if (mArtworkRequestQueue.isEmpty()) {
finishedLoading();
} else {
performNextRequest();
}
</DeepExtract>
|
odyssey
|
positive
|
public static Drawable byteToDrawable(byte[] b) {
return byteToBitmap(b) == null ? null : new BitmapDrawable(byteToBitmap(b));
}
|
<DeepExtract>
return byteToBitmap(b) == null ? null : new BitmapDrawable(byteToBitmap(b));
</DeepExtract>
|
Mantis
|
positive
|
@Override
public boolean hasNext() {
return nextIndex > 0;
}
|
<DeepExtract>
return nextIndex > 0;
</DeepExtract>
|
CoFHTweaks
|
positive
|
public void init(Cursor c) {
if (mAdapter == null) {
return;
}
if (mActivity.isFinishing() && c != null) {
c.close();
c = null;
}
if (c != mActivity.mQueryCursor) {
mActivity.mQueryCursor = c;
super.changeCursor(c);
}
if (mQueryCursor == null) {
setListAdapter(null);
return;
}
}
|
<DeepExtract>
if (mActivity.isFinishing() && c != null) {
c.close();
c = null;
}
if (c != mActivity.mQueryCursor) {
mActivity.mQueryCursor = c;
super.changeCursor(c);
}
</DeepExtract>
|
android_packages_apps_apolloMod
|
positive
|
@Override
protected void onPause() {
unregisterReceiver(airplaneModeChangedReceiver);
unregisterReceiver(updateChartReceiver);
unregisterReceiver(batteryChangedReceiver);
Log.d(TAG, "cancelDimScreenTask");
if (dimScreenTask != null) {
Log.d(TAG, "dimScreenTask != null");
dimScreenTask.cancel(true);
if (!dimScreenTask.isScreenDimmed() && (isUserLeaving || isFinishing())) {
Log.d(TAG, "!screenDimmed && isUserLeaving");
setToast(R.string.warning_dim_sleep_mode_can_only_occur_on_the_sleep_screen_);
}
}
if (mServiceBound.compareAndSet(true, false)) {
unbindService(serviceConnection);
}
isUserLeaving = false;
super.onPause();
}
|
<DeepExtract>
Log.d(TAG, "cancelDimScreenTask");
if (dimScreenTask != null) {
Log.d(TAG, "dimScreenTask != null");
dimScreenTask.cancel(true);
if (!dimScreenTask.isScreenDimmed() && (isUserLeaving || isFinishing())) {
Log.d(TAG, "!screenDimmed && isUserLeaving");
setToast(R.string.warning_dim_sleep_mode_can_only_occur_on_the_sleep_screen_);
}
}
</DeepExtract>
|
ElectricSleep
|
positive
|
@Test
public void testVeienVn() {
assertEquals(cleaner.clean("grefsenvn. 132"), cleaner.clean("grefsenveien 132"));
}
|
<DeepExtract>
assertEquals(cleaner.clean("grefsenvn. 132"), cleaner.clean("grefsenveien 132"));
</DeepExtract>
|
duke
|
positive
|
@Override
public void write(int b) throws IOException {
if (closed)
throw new IOException("Cannot read from stream anymore. It has been closed");
if (available() < 1)
flush();
buf[curr++] = (byte) b;
}
|
<DeepExtract>
if (closed)
throw new IOException("Cannot read from stream anymore. It has been closed");
</DeepExtract>
|
mango
|
positive
|
@Test
public void canWorkWithProcessViewOfModel3c() throws IOException {
ServiceSpecification mdsl = new MDSLResource(getTestResource("flowtest3c-exclusivechoiceviacommand-implicitmerge.mdsl")).getServiceSpecification();
MDSL2GeneratorModelConverter converter = new MDSL2GeneratorModelConverter(mdsl);
MDSLGeneratorModel mdslGenModel = converter.convert();
if (MDSLLogger.logLevel < 2) {
return;
}
String flowDump = mdslGenModel.getOrchestrationFlows().get(0).toString();
System.out.println("----------------------------------------------------------------------------");
System.out.print(flowDump);
System.out.println("----------------------------------------------------------------------------");
Process processViewOnGenModel = mdslGenModel.getOrchestrationFlows().get(0).processView();
PathCollection pc = processViewOnGenModel.getAllPaths();
if (MDSLLogger.logLevel < 2) {
return;
}
System.out.println("----------------------------------------------------------------------------");
if (pc != null)
System.out.println(pc.toString());
else
MDSLLogger.reportWarning("Empty path collection.");
System.out.println("----------------------------------------------------------------------------");
assertEquals("FlowTest3c", mdslGenModel.getApiName());
assertEquals(2, pc.size());
assertEquals(9, processViewOnGenModel.numberOfNodes());
assertEquals(7, processViewOnGenModel.numberOfEdges());
assertEquals(4, pc.getPath(0).length());
assertEquals(3, pc.getPath(1).length());
assertEquals("FlowInitiated", pc.getPath(0).getEventAt(0));
assertEquals("FlowStep1", pc.getPath(0).getCommandAt(0));
assertEquals("FlowStep1CompletedOptionA", pc.getPath(0).getEventAt(1));
assertEquals("FlowStep3", pc.getPath(0).getCommandAt(1));
assertEquals("FlowStep3Completed", pc.getPath(0).getEventAt(2));
assertEquals("FlowStep4", pc.getPath(0).getCommandAt(2));
assertEquals("FlowTerminated", pc.getPath(0).getEventAt(3));
assertEquals("done", pc.getPath(0).getCommandAt(3));
assertEquals("FlowStep2Completed", pc.getPath(1).getEventAt(1));
assertEquals("FlowStep4", pc.getPath(1).getCommandAt(1));
assertEquals("FlowTerminated", pc.getPath(1).getEventAt(2));
assertEquals("done", pc.getPath(1).getCommandAt(2));
}
|
<DeepExtract>
if (MDSLLogger.logLevel < 2) {
return;
}
String flowDump = mdslGenModel.getOrchestrationFlows().get(0).toString();
System.out.println("----------------------------------------------------------------------------");
System.out.print(flowDump);
System.out.println("----------------------------------------------------------------------------");
</DeepExtract>
<DeepExtract>
if (MDSLLogger.logLevel < 2) {
return;
}
System.out.println("----------------------------------------------------------------------------");
if (pc != null)
System.out.println(pc.toString());
else
MDSLLogger.reportWarning("Empty path collection.");
System.out.println("----------------------------------------------------------------------------");
</DeepExtract>
|
MDSL-Specification
|
positive
|
public void ping() throws org.apache.thrift.TException {
ping_args args = new ping_args();
sendBase("ping", args);
ping_result result = new ping_result();
receiveBase(result, "ping");
return;
}
|
<DeepExtract>
ping_args args = new ping_args();
sendBase("ping", args);
</DeepExtract>
<DeepExtract>
ping_result result = new ping_result();
receiveBase(result, "ping");
return;
</DeepExtract>
|
Thrift-Connection-Pool
|
positive
|
@Override
public String toString() {
return position + "-" + type;
}
|
<DeepExtract>
return position + "-" + type;
</DeepExtract>
|
JointER
|
positive
|
public void actionPerformed(java.awt.event.ActionEvent evt) {
}
|
<DeepExtract>
</DeepExtract>
|
CODEX
|
positive
|
@Subscribe
public void handleScapyConnectedEventEngine(ScapyClientConnectedEvent event) {
menuControllerEngine.initTemplateMenu();
}
|
<DeepExtract>
menuControllerEngine.initTemplateMenu();
</DeepExtract>
|
trex-packet-editor
|
positive
|
private static boolean listQuads(ArrayList<XYZO> a, ArrayList<XYZO> b, ArrayList<XYZO> c, ArrayList<XYZO> d, File f) {
if ((a == null) || (f == null))
return false;
try {
pw = new PrintWriter(new FileWriter(f), true);
} catch (IOException ioe) {
return false;
}
if ((a == null) || (pw == null))
return;
for (int i = 0; i < a.size(); i++) {
XYZO o = a.get(i);
double x = o.getX();
double y = o.getY();
double z = o.getZ();
int op = o.getO();
String s = U.fwi(i, 6) + U.fwd(x, 20, 8) + U.fwd(y, 20, 8) + U.fwd(z, 20, 8) + U.fwi(op, 8);
pw.println(s + interpretQuad(op % 1000));
}
if ((b == null) || (pw == null))
return;
for (int i = 0; i < b.size(); i++) {
XYZO o = b.get(i);
double x = o.getX();
double y = o.getY();
double z = o.getZ();
int op = o.getO();
String s = U.fwi(i, 6) + U.fwd(x, 20, 8) + U.fwd(y, 20, 8) + U.fwd(z, 20, 8) + U.fwi(op, 8);
pw.println(s + interpretQuad(op % 1000));
}
if ((c == null) || (pw == null))
return;
for (int i = 0; i < c.size(); i++) {
XYZO o = c.get(i);
double x = o.getX();
double y = o.getY();
double z = o.getZ();
int op = o.getO();
String s = U.fwi(i, 6) + U.fwd(x, 20, 8) + U.fwd(y, 20, 8) + U.fwd(z, 20, 8) + U.fwi(op, 8);
pw.println(s + interpretQuad(op % 1000));
}
pw.close();
return true;
}
|
<DeepExtract>
if ((a == null) || (pw == null))
return;
for (int i = 0; i < a.size(); i++) {
XYZO o = a.get(i);
double x = o.getX();
double y = o.getY();
double z = o.getZ();
int op = o.getO();
String s = U.fwi(i, 6) + U.fwd(x, 20, 8) + U.fwd(y, 20, 8) + U.fwd(z, 20, 8) + U.fwi(op, 8);
pw.println(s + interpretQuad(op % 1000));
}
</DeepExtract>
<DeepExtract>
if ((b == null) || (pw == null))
return;
for (int i = 0; i < b.size(); i++) {
XYZO o = b.get(i);
double x = o.getX();
double y = o.getY();
double z = o.getZ();
int op = o.getO();
String s = U.fwi(i, 6) + U.fwd(x, 20, 8) + U.fwd(y, 20, 8) + U.fwd(z, 20, 8) + U.fwi(op, 8);
pw.println(s + interpretQuad(op % 1000));
}
</DeepExtract>
<DeepExtract>
if ((c == null) || (pw == null))
return;
for (int i = 0; i < c.size(); i++) {
XYZO o = c.get(i);
double x = o.getX();
double y = o.getY();
double z = o.getZ();
int op = o.getO();
String s = U.fwi(i, 6) + U.fwd(x, 20, 8) + U.fwd(y, 20, 8) + U.fwd(z, 20, 8) + U.fwi(op, 8);
pw.println(s + interpretQuad(op % 1000));
}
</DeepExtract>
|
BeamFour
|
positive
|
public Coin plus(final Coin value) {
return new Coin(LongMath.checkedAdd(this.value, value.value));
}
|
<DeepExtract>
return new Coin(LongMath.checkedAdd(this.value, value.value));
</DeepExtract>
|
ulordj-thin
|
positive
|
public void validateForm(String firstName, String lastName, String email, String userName, String password, String confirmPassword) {
clearForm();
firstNameField.sendKeys(firstName);
lastNameField.sendKeys(lastName);
emailField.sendKeys(email);
userNameField.sendKeys(userName);
passwordField.sendKeys(password);
passwordConfirmationField.sendKeys(confirmPassword);
registerButton.click();
}
|
<DeepExtract>
clearForm();
firstNameField.sendKeys(firstName);
lastNameField.sendKeys(lastName);
emailField.sendKeys(email);
userNameField.sendKeys(userName);
passwordField.sendKeys(password);
passwordConfirmationField.sendKeys(confirmPassword);
registerButton.click();
</DeepExtract>
|
product-iots
|
positive
|
public void setColorMap(Palette palette) {
this.colors.clear();
this.colors.addAll(Arrays.asList(palette.getColors()));
setValues(Arrays.asList(palette.getValues()));
}
|
<DeepExtract>
this.colors.clear();
this.colors.addAll(Arrays.asList(palette.getColors()));
setValues(Arrays.asList(palette.getValues()));
</DeepExtract>
|
DicomViewer
|
positive
|
public Criteria andCreate_timeGreaterThan(Date value) {
if (value == null) {
throw new RuntimeException("Value for " + "create_time" + " cannot be null");
}
criteria.add(new Criterion("create_time >", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "create_time" + " cannot be null");
}
criteria.add(new Criterion("create_time >", value));
</DeepExtract>
|
SpringBootLearning
|
positive
|
public RetCode tema(int startIdx, int endIdx, double[] inReal, int optInTimePeriod, MInteger outBegIdx, MInteger outNBElement, double[] outReal) {
MInteger firstEMABegIdx = new MInteger();
MInteger firstEMANbElement = new MInteger();
MInteger secondEMABegIdx = new MInteger();
MInteger secondEMANbElement = new MInteger();
MInteger thirdEMABegIdx = new MInteger();
MInteger thirdEMANbElement = new MInteger();
if (startIdx < 0)
return RetCode.OutOfRangeStartIndex;
if ((endIdx < 0) || (endIdx < startIdx))
return RetCode.OutOfRangeEndIndex;
if ((int) optInTimePeriod == (Integer.MIN_VALUE))
optInTimePeriod = 30;
else if (((int) optInTimePeriod < 2) || ((int) optInTimePeriod > 100000))
return RetCode.BadParam;
outNBElement.value = 0;
outBegIdx.value = 0;
if ((int) optInTimePeriod == (Integer.MIN_VALUE))
optInTimePeriod = 30;
else if (((int) optInTimePeriod < 2) || ((int) optInTimePeriod > 100000))
lookbackEMA = -1;
return optInTimePeriod - 1 + (this.unstablePeriod[FuncUnstId.Ema.ordinal()]);
lookbackTotal = lookbackEMA * 3;
if (startIdx < lookbackTotal)
startIdx = lookbackTotal;
if (startIdx > endIdx)
return RetCode.Success;
tempInt = lookbackTotal + (endIdx - startIdx) + 1;
firstEMA = new double[tempInt];
k = ((double) 2.0 / ((double) (optInTimePeriod + 1)));
double tempReal, prevMA;
int i, today, outIdx, lookbackTotal;
lookbackTotal = emaLookback(optInTimePeriod);
if (startIdx - (lookbackEMA * 2) < lookbackTotal)
startIdx - (lookbackEMA * 2) = lookbackTotal;
if (startIdx - (lookbackEMA * 2) > endIdx) {
firstEMABegIdx.value = 0;
firstEMANbElement.value = 0;
retCode = RetCode.Success;
}
firstEMABegIdx.value = startIdx - (lookbackEMA * 2);
if ((this.compatibility) == Compatibility.Default) {
today = startIdx - (lookbackEMA * 2) - lookbackTotal;
i = optInTimePeriod;
tempReal = 0.0;
while (i-- > 0) tempReal += inReal[today++];
prevMA = tempReal / optInTimePeriod;
} else {
prevMA = inReal[0];
today = 1;
}
while (today <= startIdx - (lookbackEMA * 2)) prevMA = ((inReal[today++] - prevMA) * k) + prevMA;
firstEMA[0] = prevMA;
outIdx = 1;
while (today <= endIdx) {
prevMA = ((inReal[today++] - prevMA) * k) + prevMA;
firstEMA[outIdx++] = prevMA;
}
firstEMANbElement.value = outIdx;
return RetCode.Success;
if ((retCode != RetCode.Success) || (firstEMANbElement.value == 0)) {
return retCode;
}
secondEMA = new double[firstEMANbElement.value];
double tempReal, prevMA;
int i, today, outIdx, lookbackTotal;
lookbackTotal = emaLookback(optInTimePeriod);
if (0 < lookbackTotal)
0 = lookbackTotal;
if (0 > firstEMANbElement.value - 1) {
secondEMABegIdx.value = 0;
secondEMANbElement.value = 0;
retCode = RetCode.Success;
}
secondEMABegIdx.value = 0;
if ((this.compatibility) == Compatibility.Default) {
today = 0 - lookbackTotal;
i = optInTimePeriod;
tempReal = 0.0;
while (i-- > 0) tempReal += firstEMA[today++];
prevMA = tempReal / optInTimePeriod;
} else {
prevMA = firstEMA[0];
today = 1;
}
while (today <= 0) prevMA = ((firstEMA[today++] - prevMA) * k) + prevMA;
secondEMA[0] = prevMA;
outIdx = 1;
while (today <= firstEMANbElement.value - 1) {
prevMA = ((firstEMA[today++] - prevMA) * k) + prevMA;
secondEMA[outIdx++] = prevMA;
}
secondEMANbElement.value = outIdx;
return RetCode.Success;
if ((retCode != RetCode.Success) || (secondEMANbElement.value == 0)) {
return retCode;
}
double tempReal, prevMA;
int i, today, outIdx, lookbackTotal;
lookbackTotal = emaLookback(optInTimePeriod);
if (0 < lookbackTotal)
0 = lookbackTotal;
if (0 > secondEMANbElement.value - 1) {
thirdEMABegIdx.value = 0;
thirdEMANbElement.value = 0;
retCode = RetCode.Success;
}
thirdEMABegIdx.value = 0;
if ((this.compatibility) == Compatibility.Default) {
today = 0 - lookbackTotal;
i = optInTimePeriod;
tempReal = 0.0;
while (i-- > 0) tempReal += secondEMA[today++];
prevMA = tempReal / optInTimePeriod;
} else {
prevMA = secondEMA[0];
today = 1;
}
while (today <= 0) prevMA = ((secondEMA[today++] - prevMA) * k) + prevMA;
outReal[0] = prevMA;
outIdx = 1;
while (today <= secondEMANbElement.value - 1) {
prevMA = ((secondEMA[today++] - prevMA) * k) + prevMA;
outReal[outIdx++] = prevMA;
}
thirdEMANbElement.value = outIdx;
return RetCode.Success;
if ((retCode != RetCode.Success) || (thirdEMANbElement.value == 0)) {
return retCode;
}
firstEMAIdx = thirdEMABegIdx.value + secondEMABegIdx.value;
secondEMAIdx = thirdEMABegIdx.value;
outBegIdx.value = firstEMAIdx + firstEMABegIdx.value;
outIdx = 0;
while (outIdx < thirdEMANbElement.value) {
outReal[outIdx] += (3.0 * firstEMA[firstEMAIdx++]) - (3.0 * secondEMA[secondEMAIdx++]);
outIdx++;
}
outNBElement.value = outIdx;
return RetCode.Success;
}
|
<DeepExtract>
if ((int) optInTimePeriod == (Integer.MIN_VALUE))
optInTimePeriod = 30;
else if (((int) optInTimePeriod < 2) || ((int) optInTimePeriod > 100000))
lookbackEMA = -1;
return optInTimePeriod - 1 + (this.unstablePeriod[FuncUnstId.Ema.ordinal()]);
</DeepExtract>
<DeepExtract>
double tempReal, prevMA;
int i, today, outIdx, lookbackTotal;
lookbackTotal = emaLookback(optInTimePeriod);
if (startIdx - (lookbackEMA * 2) < lookbackTotal)
startIdx - (lookbackEMA * 2) = lookbackTotal;
if (startIdx - (lookbackEMA * 2) > endIdx) {
firstEMABegIdx.value = 0;
firstEMANbElement.value = 0;
retCode = RetCode.Success;
}
firstEMABegIdx.value = startIdx - (lookbackEMA * 2);
if ((this.compatibility) == Compatibility.Default) {
today = startIdx - (lookbackEMA * 2) - lookbackTotal;
i = optInTimePeriod;
tempReal = 0.0;
while (i-- > 0) tempReal += inReal[today++];
prevMA = tempReal / optInTimePeriod;
} else {
prevMA = inReal[0];
today = 1;
}
while (today <= startIdx - (lookbackEMA * 2)) prevMA = ((inReal[today++] - prevMA) * k) + prevMA;
firstEMA[0] = prevMA;
outIdx = 1;
while (today <= endIdx) {
prevMA = ((inReal[today++] - prevMA) * k) + prevMA;
firstEMA[outIdx++] = prevMA;
}
firstEMANbElement.value = outIdx;
return RetCode.Success;
</DeepExtract>
<DeepExtract>
double tempReal, prevMA;
int i, today, outIdx, lookbackTotal;
lookbackTotal = emaLookback(optInTimePeriod);
if (0 < lookbackTotal)
0 = lookbackTotal;
if (0 > firstEMANbElement.value - 1) {
secondEMABegIdx.value = 0;
secondEMANbElement.value = 0;
retCode = RetCode.Success;
}
secondEMABegIdx.value = 0;
if ((this.compatibility) == Compatibility.Default) {
today = 0 - lookbackTotal;
i = optInTimePeriod;
tempReal = 0.0;
while (i-- > 0) tempReal += firstEMA[today++];
prevMA = tempReal / optInTimePeriod;
} else {
prevMA = firstEMA[0];
today = 1;
}
while (today <= 0) prevMA = ((firstEMA[today++] - prevMA) * k) + prevMA;
secondEMA[0] = prevMA;
outIdx = 1;
while (today <= firstEMANbElement.value - 1) {
prevMA = ((firstEMA[today++] - prevMA) * k) + prevMA;
secondEMA[outIdx++] = prevMA;
}
secondEMANbElement.value = outIdx;
return RetCode.Success;
</DeepExtract>
<DeepExtract>
double tempReal, prevMA;
int i, today, outIdx, lookbackTotal;
lookbackTotal = emaLookback(optInTimePeriod);
if (0 < lookbackTotal)
0 = lookbackTotal;
if (0 > secondEMANbElement.value - 1) {
thirdEMABegIdx.value = 0;
thirdEMANbElement.value = 0;
retCode = RetCode.Success;
}
thirdEMABegIdx.value = 0;
if ((this.compatibility) == Compatibility.Default) {
today = 0 - lookbackTotal;
i = optInTimePeriod;
tempReal = 0.0;
while (i-- > 0) tempReal += secondEMA[today++];
prevMA = tempReal / optInTimePeriod;
} else {
prevMA = secondEMA[0];
today = 1;
}
while (today <= 0) prevMA = ((secondEMA[today++] - prevMA) * k) + prevMA;
outReal[0] = prevMA;
outIdx = 1;
while (today <= secondEMANbElement.value - 1) {
prevMA = ((secondEMA[today++] - prevMA) * k) + prevMA;
outReal[outIdx++] = prevMA;
}
thirdEMANbElement.value = outIdx;
return RetCode.Success;
</DeepExtract>
|
TA-Lib
|
positive
|
private JPanel getNonLinearMapPanel() {
JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout());
GridBagConstraints constraints = new GridBagConstraints();
constraints.gridx = 0;
constraints.gridy = 0;
panel.add(getHeader("Non Linear Boost"), constraints);
constraints.gridx = 0;
constraints.gridy = 1;
constraints.insets.top = 16;
Pair<TableDefinition, Map3d> tableDefinition = KfldrlPreferences.getInstance().getSelectedMap();
if (tableDefinition != null && tableDefinition.getSecond() != null) {
Map3d nonLinearMap = new Map3d(tableDefinition.getSecond());
nonLinearMap.zAxis = new Double[nonLinearMap.zAxis.length][nonLinearMap.zAxis[0].length];
nonLinearTable.setMap(nonLinearMap);
}
nonLinearTable.getPublishSubject().subscribe(new Observer<>() {
@Override
public void onNext(@NonNull Map3d map3d) {
Pair<TableDefinition, Map3d> kfldimxTableDefinition = KfldimxPreferences.getInstance().getSelectedMap();
Pair<TableDefinition, Map3d> kfldrlTableDefinition = KfldrlPreferences.getInstance().getSelectedMap();
Map3d linearMap3d = LdrpidCalculator.calculateLinearTable(map3d.zAxis, kfldrlTableDefinition.getSecond());
Map3d kfldrlMap3d = LdrpidCalculator.calculateKfldrl(map3d.zAxis, linearMap3d.zAxis, kfldrlTableDefinition.getSecond());
Map3d kfldimxMap3d = LdrpidCalculator.calculateKfldimx(map3d.zAxis, linearMap3d.zAxis, kfldrlTableDefinition.getSecond(), kfldimxTableDefinition.getSecond());
linearTable.setMap(linearMap3d);
kfldrlTable.setMap(kfldrlMap3d);
Double[][] kfldImxXAxisValues = new Double[1][];
kfldImxXAxisValues[0] = kfldimxMap3d.xAxis;
kfldimxXAxis.setTableData(kfldImxXAxisValues);
kfldimxTable.setMap(kfldimxMap3d);
}
@Override
public void onSubscribe(@NonNull Disposable disposable) {
}
@Override
public void onError(@NonNull Throwable throwable) {
}
@Override
public void onComplete() {
}
});
JScrollPane scrollPane = nonLinearTable.getScrollPane();
panel.add(scrollPane, constraints);
return panel;
}
|
<DeepExtract>
Pair<TableDefinition, Map3d> tableDefinition = KfldrlPreferences.getInstance().getSelectedMap();
if (tableDefinition != null && tableDefinition.getSecond() != null) {
Map3d nonLinearMap = new Map3d(tableDefinition.getSecond());
nonLinearMap.zAxis = new Double[nonLinearMap.zAxis.length][nonLinearMap.zAxis[0].length];
nonLinearTable.setMap(nonLinearMap);
}
nonLinearTable.getPublishSubject().subscribe(new Observer<>() {
@Override
public void onNext(@NonNull Map3d map3d) {
Pair<TableDefinition, Map3d> kfldimxTableDefinition = KfldimxPreferences.getInstance().getSelectedMap();
Pair<TableDefinition, Map3d> kfldrlTableDefinition = KfldrlPreferences.getInstance().getSelectedMap();
Map3d linearMap3d = LdrpidCalculator.calculateLinearTable(map3d.zAxis, kfldrlTableDefinition.getSecond());
Map3d kfldrlMap3d = LdrpidCalculator.calculateKfldrl(map3d.zAxis, linearMap3d.zAxis, kfldrlTableDefinition.getSecond());
Map3d kfldimxMap3d = LdrpidCalculator.calculateKfldimx(map3d.zAxis, linearMap3d.zAxis, kfldrlTableDefinition.getSecond(), kfldimxTableDefinition.getSecond());
linearTable.setMap(linearMap3d);
kfldrlTable.setMap(kfldrlMap3d);
Double[][] kfldImxXAxisValues = new Double[1][];
kfldImxXAxisValues[0] = kfldimxMap3d.xAxis;
kfldimxXAxis.setTableData(kfldImxXAxisValues);
kfldimxTable.setMap(kfldimxMap3d);
}
@Override
public void onSubscribe(@NonNull Disposable disposable) {
}
@Override
public void onError(@NonNull Throwable throwable) {
}
@Override
public void onComplete() {
}
});
</DeepExtract>
|
ME7Tuner
|
positive
|
public boolean beginFakeDrag() {
if (mIsBeingDragged) {
return false;
}
mFakeDragging = true;
if (mScrollState == SCROLL_STATE_DRAGGING) {
return;
}
mScrollState = SCROLL_STATE_DRAGGING;
if (mOnPageChangeListener != null) {
mOnPageChangeListener.onPageScrollStateChanged(SCROLL_STATE_DRAGGING);
}
mInitialMotionY = mLastMotionY = 0;
if (mVelocityTracker == null) {
mVelocityTracker = VelocityTracker.obtain();
} else {
mVelocityTracker.clear();
}
final long time = SystemClock.uptimeMillis();
final MotionEvent ev = MotionEvent.obtain(time, time, MotionEvent.ACTION_DOWN, 0, 0, 0);
mVelocityTracker.addMovement(ev);
ev.recycle();
mFakeDragBeginTime = time;
return true;
}
|
<DeepExtract>
if (mScrollState == SCROLL_STATE_DRAGGING) {
return;
}
mScrollState = SCROLL_STATE_DRAGGING;
if (mOnPageChangeListener != null) {
mOnPageChangeListener.onPageScrollStateChanged(SCROLL_STATE_DRAGGING);
}
</DeepExtract>
|
OkCalendar
|
positive
|
@Override
public MafRecord next() {
MafRecord ret = nextRecord_;
try {
String buffer = lastLine_ != null ? lastLine_ : brMaf_.readLine();
lastLine_ = null;
for (; buffer != null; buffer = brMaf_.readLine()) {
buffer = buffer.trim();
if (buffer.length() > 0 && buffer.charAt(0) != '#')
break;
}
if (buffer == null)
nextRecord_ = null;
if (buffer.charAt(0) != 'a')
throw new RuntimeException("unexpected MAF line: " + buffer);
String header = buffer;
ArrayList<String> entries = new ArrayList<String>(2);
for (buffer = brMaf_.readLine(); buffer != null; buffer = brMaf_.readLine()) {
buffer = buffer.trim();
if (buffer.length() > 0) {
if (buffer.charAt(0) == 's') {
entries.add(buffer);
} else if (buffer.charAt(0) == 'a') {
break;
} else if (buffer.charAt(0) != '#') {
throw new RuntimeException("unexpected MAF line: " + buffer);
}
}
}
lastLine_ = buffer;
nextRecord_ = new MafRecord(header, entries);
} catch (IOException e) {
e.printStackTrace();
nextRecord_ = null;
}
return ret;
}
|
<DeepExtract>
try {
String buffer = lastLine_ != null ? lastLine_ : brMaf_.readLine();
lastLine_ = null;
for (; buffer != null; buffer = brMaf_.readLine()) {
buffer = buffer.trim();
if (buffer.length() > 0 && buffer.charAt(0) != '#')
break;
}
if (buffer == null)
nextRecord_ = null;
if (buffer.charAt(0) != 'a')
throw new RuntimeException("unexpected MAF line: " + buffer);
String header = buffer;
ArrayList<String> entries = new ArrayList<String>(2);
for (buffer = brMaf_.readLine(); buffer != null; buffer = brMaf_.readLine()) {
buffer = buffer.trim();
if (buffer.length() > 0) {
if (buffer.charAt(0) == 's') {
entries.add(buffer);
} else if (buffer.charAt(0) == 'a') {
break;
} else if (buffer.charAt(0) != '#') {
throw new RuntimeException("unexpected MAF line: " + buffer);
}
}
}
lastLine_ = buffer;
nextRecord_ = new MafRecord(header, entries);
} catch (IOException e) {
e.printStackTrace();
nextRecord_ = null;
}
</DeepExtract>
|
varsim
|
positive
|
public Criteria andClassroomNotLike(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "classroom" + " cannot be null");
}
criteria.add(new Criterion("classRoom not like", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "classroom" + " cannot be null");
}
criteria.add(new Criterion("classRoom not like", value));
</DeepExtract>
|
Examination_System
|
positive
|
public static void putIntPreference(ContentResolver resolver, Uri uri, String key, int value) {
ContentValues contentValues = new ContentValues(1);
(v, contentValues) -> contentValues.put(key, v).onPutValue(value, contentValues);
resolver.update(uri, contentValues, null, null);
}
|
<DeepExtract>
ContentValues contentValues = new ContentValues(1);
(v, contentValues) -> contentValues.put(key, v).onPutValue(value, contentValues);
resolver.update(uri, contentValues, null, null);
</DeepExtract>
|
igniter
|
positive
|
public void apkToolDecode(String apkPath) throws TNotFoundEx {
String args = " d -o " + TicklerVars.extractedDir + " " + apkPath;
FileUtil fileT = new FileUtil();
File apkPathFile = new File(apkPath);
try {
File file = new File("/dev/null");
PrintStream ps = new PrintStream(new FileOutputStream(file));
System.setErr(ps);
this.executeApktoolCommand(args);
System.setErr(System.err);
} catch (Exception e) {
e.printStackTrace();
}
try {
fileT.copyOnHost(TicklerVars.extractedDir + "AndroidManifest.xml", TicklerVars.tickManifestFile, true);
} catch (Exception e) {
OutBut.printError("Decompilation failed and Manifest cannot be obtained");
TNotFoundEx eNotFound = new TNotFoundEx("Decompilation failed and Manifest cannot be obtained");
throw eNotFound;
}
}
|
<DeepExtract>
FileUtil fileT = new FileUtil();
File apkPathFile = new File(apkPath);
try {
File file = new File("/dev/null");
PrintStream ps = new PrintStream(new FileOutputStream(file));
System.setErr(ps);
this.executeApktoolCommand(args);
System.setErr(System.err);
} catch (Exception e) {
e.printStackTrace();
}
try {
fileT.copyOnHost(TicklerVars.extractedDir + "AndroidManifest.xml", TicklerVars.tickManifestFile, true);
} catch (Exception e) {
OutBut.printError("Decompilation failed and Manifest cannot be obtained");
TNotFoundEx eNotFound = new TNotFoundEx("Decompilation failed and Manifest cannot be obtained");
throw eNotFound;
}
</DeepExtract>
|
AndroTickler
|
positive
|
public Criteria andField_not_having_default_valueGreaterThan(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "field_not_having_default_value" + " cannot be null");
}
criteria.add(new Criterion("field_not_having_default_value >", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "field_not_having_default_value" + " cannot be null");
}
criteria.add(new Criterion("field_not_having_default_value >", value));
</DeepExtract>
|
mybatis-generator-gui-extension
|
positive
|
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
if (mTarget == null) {
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
if (!child.equals(mCircleView)) {
mTarget = child;
break;
}
}
}
final int action = MotionEventCompat.getActionMasked(ev);
if (mReturningToStart && action == MotionEvent.ACTION_DOWN) {
mReturningToStart = false;
}
switch(mDirection) {
case BOTTOM:
if (!isEnabled() || mReturningToStart || (!mBothDirection && canChildScrollDown()) || mRefreshing || mNestedScrollInProgress) {
return false;
}
break;
case TOP:
default:
if (!isEnabled() || mReturningToStart || (!mBothDirection && canChildScrollUp()) || mRefreshing || mNestedScrollInProgress) {
return false;
}
break;
}
switch(action) {
case MotionEvent.ACTION_DOWN:
setTargetOffsetTopAndBottom(mOriginalOffsetTop - mCircleView.getTop(), true);
mActivePointerId = MotionEventCompat.getPointerId(ev, 0);
mIsBeingDragged = false;
final float initialDownY = getMotionEventY(ev, mActivePointerId);
if (initialDownY == -1) {
return false;
}
mInitialDownY = initialDownY;
break;
case MotionEvent.ACTION_MOVE:
if (mActivePointerId == INVALID_POINTER) {
Log.e(LOG_TAG, "Got ACTION_MOVE event but don't have an active pointer id.");
return false;
}
final float y = getMotionEventY(ev, mActivePointerId);
if (y == -1) {
return false;
}
if (mBothDirection) {
if (y > mInitialDownY) {
setRawDirection(Direction.TOP);
} else if (y < mInitialDownY) {
setRawDirection(Direction.BOTTOM);
}
if ((mDirection == Direction.BOTTOM && canChildScrollDown()) || (mDirection == Direction.TOP && canChildScrollUp())) {
mInitialDownY = y;
return false;
}
}
float yDiff;
switch(mDirection) {
case BOTTOM:
yDiff = mInitialDownY - y;
break;
case TOP:
default:
yDiff = y - mInitialDownY;
break;
}
if (yDiff > mTouchSlop && !mIsBeingDragged) {
switch(mDirection) {
case BOTTOM:
mInitialMotionY = mInitialDownY - mTouchSlop;
break;
case TOP:
default:
mInitialMotionY = mInitialDownY + mTouchSlop;
break;
}
mIsBeingDragged = true;
mProgress.setAlpha(STARTING_PROGRESS_ALPHA);
}
break;
case MotionEventCompat.ACTION_POINTER_UP:
onSecondaryPointerUp(ev);
break;
case MotionEvent.ACTION_UP:
case MotionEvent.ACTION_CANCEL:
mIsBeingDragged = false;
mActivePointerId = INVALID_POINTER;
break;
}
return mIsBeingDragged;
}
|
<DeepExtract>
if (mTarget == null) {
for (int i = 0; i < getChildCount(); i++) {
View child = getChildAt(i);
if (!child.equals(mCircleView)) {
mTarget = child;
break;
}
}
}
</DeepExtract>
|
android-starter-kit
|
positive
|
public String getDependencies() throws MojoExecutionException {
String dependencies = null;
DependencyInputType dependencyType;
if (projectCP != null) {
getLog().info("Reading dependencies from folder");
dependencyType = DependencyInputType.FOLDER;
} else if (groupId != null && artifactId != null) {
getLog().info("Reading dependencies from artifact");
dependencyType = DependencyInputType.ARTIFACT;
} else {
getLog().info("Reading dependencies from pom");
dependencyType = DependencyInputType.POM;
}
if (dependencyType == DependencyInputType.FOLDER) {
dependencies = getDependenciesFromFolder(projectCP);
} else {
dependencies = getDependenciesWithMaven(dependencyType);
}
getLog().info("Collected dependencies: " + dependencies);
return dependencies;
}
|
<DeepExtract>
DependencyInputType dependencyType;
if (projectCP != null) {
getLog().info("Reading dependencies from folder");
dependencyType = DependencyInputType.FOLDER;
} else if (groupId != null && artifactId != null) {
getLog().info("Reading dependencies from artifact");
dependencyType = DependencyInputType.ARTIFACT;
} else {
getLog().info("Reading dependencies from pom");
dependencyType = DependencyInputType.POM;
}
</DeepExtract>
|
botsing
|
positive
|
public String convertToDatabaseForm() {
StringBuilder latStringBuilder = new StringBuilder();
latStringBuilder.append(baseVertex.getLat());
for (TorVertex pillarPoint : pillarVertexes) {
latStringBuilder.append(",").append(pillarPoint.getLat());
}
latStringBuilder.append(",").append(adjVertex.getLat());
return String.valueOf(id);
StringBuilder lonStringBuilder = new StringBuilder();
lonStringBuilder.append(baseVertex.getLng());
for (TorVertex pillarPoint : pillarVertexes) {
lonStringBuilder.append(",").append(pillarPoint.getLat());
}
lonStringBuilder.append(",").append(adjVertex.getLng());
return String.valueOf(id);
if (length == Double.MIN_VALUE) {
TorVertex pre = baseVertex;
length = 0.0;
for (TorVertex pillarPoint : pillarVertexes) {
length += GeoUtil.distance(pre, pillarPoint);
pre = pillarPoint;
}
length += GeoUtil.distance(pre, adjVertex);
}
return length;
StringBuilder res = new StringBuilder();
return String.valueOf(id);
}
|
<DeepExtract>
return String.valueOf(id);
</DeepExtract>
<DeepExtract>
return String.valueOf(id);
</DeepExtract>
<DeepExtract>
if (length == Double.MIN_VALUE) {
TorVertex pre = baseVertex;
length = 0.0;
for (TorVertex pillarPoint : pillarVertexes) {
length += GeoUtil.distance(pre, pillarPoint);
pre = pillarPoint;
}
length += GeoUtil.distance(pre, adjVertex);
}
return length;
</DeepExtract>
<DeepExtract>
return String.valueOf(id);
</DeepExtract>
|
torchtrajectory
|
positive
|
@Override
public void setConfigParams(ConfigParams config) {
super.setConfigParams(config);
icsAlarm = config.getIcsAlarm();
return icsAlarmMinutes;
icsAllDay = config.getIcsAllDay();
extractIcsAttributes(note);
org.psidnell.omnifocus.expr.Date date = null;
if ("due".equals(icsStart)) {
date = new org.psidnell.omnifocus.expr.Date(getPreferred(dueDate, deferDate), config);
} else if ("defer".equals(icsStart)) {
date = new org.psidnell.omnifocus.expr.Date(getPreferred(deferDate, dueDate), config);
} else {
date = new org.psidnell.omnifocus.expr.Date(adjustTime(getPreferred(deferDate, dueDate), icsStart), config);
}
return icsAllDay ? date.getIcsAllDayStart() : date.getIcs();
extractIcsAttributes(note);
org.psidnell.omnifocus.expr.Date date = null;
if ("due".equals(icsEnd)) {
date = new org.psidnell.omnifocus.expr.Date(getPreferred(dueDate, deferDate), config);
} else if ("defer".equals(icsEnd)) {
date = new org.psidnell.omnifocus.expr.Date(getPreferred(deferDate, dueDate), config);
} else {
date = new org.psidnell.omnifocus.expr.Date(adjustTime(getPreferred(dueDate, deferDate), icsEnd), config);
}
return icsAllDay ? date.getIcsAllDayStart() : date.getIcs();
}
|
<DeepExtract>
return icsAlarmMinutes;
</DeepExtract>
<DeepExtract>
extractIcsAttributes(note);
org.psidnell.omnifocus.expr.Date date = null;
if ("due".equals(icsStart)) {
date = new org.psidnell.omnifocus.expr.Date(getPreferred(dueDate, deferDate), config);
} else if ("defer".equals(icsStart)) {
date = new org.psidnell.omnifocus.expr.Date(getPreferred(deferDate, dueDate), config);
} else {
date = new org.psidnell.omnifocus.expr.Date(adjustTime(getPreferred(deferDate, dueDate), icsStart), config);
}
return icsAllDay ? date.getIcsAllDayStart() : date.getIcs();
</DeepExtract>
<DeepExtract>
extractIcsAttributes(note);
org.psidnell.omnifocus.expr.Date date = null;
if ("due".equals(icsEnd)) {
date = new org.psidnell.omnifocus.expr.Date(getPreferred(dueDate, deferDate), config);
} else if ("defer".equals(icsEnd)) {
date = new org.psidnell.omnifocus.expr.Date(getPreferred(deferDate, dueDate), config);
} else {
date = new org.psidnell.omnifocus.expr.Date(adjustTime(getPreferred(dueDate, deferDate), icsEnd), config);
}
return icsAllDay ? date.getIcsAllDayStart() : date.getIcs();
</DeepExtract>
|
ofexport2
|
positive
|
private void writeTestMetric(AbstractOutputWriter writer) {
if (value < 10) {
value += 1;
} else {
value = 1;
}
try {
writer.writeQueryResult("jmxtransagentinputtest", null, value);
writer.writeQueryResult("second", null, value + 20);
tcpByteServer.readResponse = "ZBXA100000000{\"result\":\"success\"}".getBytes(StandardCharsets.UTF_8);
writer.postCollect();
} catch (Exception e) {
e.printStackTrace();
}
}
|
<DeepExtract>
if (value < 10) {
value += 1;
} else {
value = 1;
}
</DeepExtract>
|
jmxtrans-agent
|
positive
|
@Override
@Deprecated
public void setMaxScale(float maxScale) {
mAttacher.setMaximumScale(maxScale);
}
|
<DeepExtract>
mAttacher.setMaximumScale(maxScale);
</DeepExtract>
|
AppleFramework
|
positive
|
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);
if (savedInstanceState != null) {
mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
mFromSavedInstanceState = true;
}
mCurrentSelectedPosition = mCurrentSelectedPosition;
if (mDrawerListView != null) {
mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
}
if (mDrawerLayout != null) {
mDrawerLayout.closeDrawer(mFragmentContainerView);
}
if (mCallbacks != null) {
mCallbacks.onNavigationDrawerItemSelected(mCurrentSelectedPosition);
}
}
|
<DeepExtract>
mCurrentSelectedPosition = mCurrentSelectedPosition;
if (mDrawerListView != null) {
mDrawerListView.setItemChecked(mCurrentSelectedPosition, true);
}
if (mDrawerLayout != null) {
mDrawerLayout.closeDrawer(mFragmentContainerView);
}
if (mCallbacks != null) {
mCallbacks.onNavigationDrawerItemSelected(mCurrentSelectedPosition);
}
</DeepExtract>
|
MonitoraBrasil
|
positive
|
@Test
public void testEventResponse_createSharesRequested_requiredShareCountSetToEmptyAndAllOtherInputsAreValid() {
presenter.startPresenting().blockingGet();
requiredShareCountObservable.onNext(Optional.empty());
totalShareCountObservable.onNext(Optional.of(3));
secretFilePathObservable.onNext(Optional.of(secretFile.getAbsolutePath()));
outputDirectoryPathObservable.onNext(Optional.of(outputDirectory.getAbsolutePath()));
createSharesRequests.onNext(None.getInstance());
verifyZeroInteractions(mockPersistenceOperations);
verifyZeroInteractions(mockRxFiles);
}
|
<DeepExtract>
createSharesRequests.onNext(None.getInstance());
</DeepExtract>
<DeepExtract>
verifyZeroInteractions(mockPersistenceOperations);
verifyZeroInteractions(mockRxFiles);
</DeepExtract>
|
Shamir
|
positive
|
private void printNpc() {
if (!deps.needsNpc()) {
return;
}
out.print(FileUtil.readResource(NPC_HPP));
}
|
<DeepExtract>
out.print(FileUtil.readResource(NPC_HPP));
</DeepExtract>
|
j2c
|
positive
|
@Override
public void restoreMemento(Memento memento) {
this.valor = memento.getValor();
this.cadena = memento.getCadena();
}
|
<DeepExtract>
this.valor = memento.getValor();
</DeepExtract>
<DeepExtract>
this.cadena = memento.getCadena();
</DeepExtract>
|
apaw
|
positive
|
@Override
public void onClick(View view) {
startActivityForResult(AuthUI.getInstance().createSignInIntentBuilder().setTheme(getSelectedTheme()).setLogo(getSelectedLogo()).setProviders(getSelectedProviders()).setTosUrl(getSelectedTosUrl()).setIsSmartLockEnabled(true).build(), RC_SIGN_IN);
}
|
<DeepExtract>
startActivityForResult(AuthUI.getInstance().createSignInIntentBuilder().setTheme(getSelectedTheme()).setLogo(getSelectedLogo()).setProviders(getSelectedProviders()).setTosUrl(getSelectedTosUrl()).setIsSmartLockEnabled(true).build(), RC_SIGN_IN);
</DeepExtract>
|
UPES-SPE-Fest
|
positive
|
@Override
public void run() {
if (!mGoToTopFadeInAnimator.isRunning()) {
if (mGoToTopFadeOutAnimator.isRunning()) {
mGoToTopFadeOutAnimator.cancel();
}
mGoToTopFadeInAnimator.setFloatValues(mGoToTopView.getAlpha(), 1.0f);
mGoToTopFadeInAnimator.start();
}
}
|
<DeepExtract>
if (!mGoToTopFadeInAnimator.isRunning()) {
if (mGoToTopFadeOutAnimator.isRunning()) {
mGoToTopFadeOutAnimator.cancel();
}
mGoToTopFadeInAnimator.setFloatValues(mGoToTopView.getAlpha(), 1.0f);
mGoToTopFadeInAnimator.start();
}
</DeepExtract>
|
SamsungOneUi
|
positive
|
public void assertEqual(long constant, BitVector a) {
if (a == Lit.True || a == Lit.False)
return;
if (a == null) {
throw new NullPointerException("Literal is null");
} else if (a.l < 0) {
throw new IllegalArgumentException("Literal " + a.toString() + " is not a valid literal.");
} else if (a.solver != this) {
throw new IllegalArgumentException("Cannot pass literal belonging to solver " + (a.solver == null ? "null" : a.solver.toString()) + " to solver " + toString());
} else if (a.toVar() >= nVars()) {
throw new IllegalArgumentException("Literal is undefined in solver (too large)");
}
validate(a.eq(constant));
MonosatJNI.Assert(this.getSolverPtr(), a.eq(constant).l);
}
|
<DeepExtract>
if (a == Lit.True || a == Lit.False)
return;
if (a == null) {
throw new NullPointerException("Literal is null");
} else if (a.l < 0) {
throw new IllegalArgumentException("Literal " + a.toString() + " is not a valid literal.");
} else if (a.solver != this) {
throw new IllegalArgumentException("Cannot pass literal belonging to solver " + (a.solver == null ? "null" : a.solver.toString()) + " to solver " + toString());
} else if (a.toVar() >= nVars()) {
throw new IllegalArgumentException("Literal is undefined in solver (too large)");
}
</DeepExtract>
<DeepExtract>
validate(a.eq(constant));
MonosatJNI.Assert(this.getSolverPtr(), a.eq(constant).l);
</DeepExtract>
|
monosat
|
positive
|
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_recycler_view, container, false);
mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
mRecyclerView.addItemDecoration(new BallotRecyclerViewDecorator(getActivity()));
Context context;
try {
context = super.getContext();
} catch (NoSuchMethodError error) {
context = getActivity();
}
mRecyclerView.setLayoutManager(new GridLayoutManager(context, 1));
if (mAdapter != null) {
mRecyclerView.setAdapter(mAdapter);
}
return view;
}
|
<DeepExtract>
Context context;
try {
context = super.getContext();
} catch (NoSuchMethodError error) {
context = getActivity();
}
</DeepExtract>
|
android-white-label-app
|
positive
|
public synchronized void onResume() {
if (registered) {
Log.w(TAG, "PowerStatusReceiver was already registered?");
} else {
activity.registerReceiver(powerStatusReceiver, new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
registered = true;
}
cancel();
inactivityTask = new InactivityAsyncTask();
if (Build.VERSION.SDK_INT >= 11) {
inactivityTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
inactivityTask.execute();
}
}
|
<DeepExtract>
cancel();
inactivityTask = new InactivityAsyncTask();
if (Build.VERSION.SDK_INT >= 11) {
inactivityTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
} else {
inactivityTask.execute();
}
</DeepExtract>
|
RetrofitAndRxjavaforRecyclerview
|
positive
|
public synchronized Snapshot get(String key) throws IOException {
if (journalWriter == null) {
throw new IllegalStateException("cache is closed");
}
if (key.contains(" ") || key.contains("\n") || key.contains("\r")) {
throw new IllegalArgumentException("keys must not contain spaces or newlines: \"" + key + "\"");
}
Entry entry = lruEntries.get(key);
if (entry == null) {
return null;
}
if (!entry.readable) {
return null;
}
InputStream[] ins = new InputStream[valueCount];
try {
for (int i = 0; i < valueCount; i++) {
ins[i] = new FileInputStream(entry.getCleanFile(i));
}
} catch (FileNotFoundException e) {
return null;
}
redundantOpCount++;
journalWriter.append(READ + ' ' + key + '\n');
if (journalRebuildRequired()) {
executorService.submit(cleanupCallable);
}
return new Snapshot(key, entry.sequenceNumber, ins);
}
|
<DeepExtract>
if (journalWriter == null) {
throw new IllegalStateException("cache is closed");
}
</DeepExtract>
<DeepExtract>
if (key.contains(" ") || key.contains("\n") || key.contains("\r")) {
throw new IllegalArgumentException("keys must not contain spaces or newlines: \"" + key + "\"");
}
</DeepExtract>
|
Keep
|
positive
|
@LargeTest
public void testWithInvalidPassword() throws Exception {
solo.assertCurrentActivity("Expected Login Activity", LoginActivity.class);
solo.enterText(0, Account.USERNAME);
solo.enterText(1, "blah");
solo.clickOnButton("Log In");
solo.waitForDialogToClose(DIALOG_TIMEOUT);
solo.assertCurrentActivity("Expected Login Activity", LoginActivity.class);
}
|
<DeepExtract>
solo.enterText(0, Account.USERNAME);
solo.enterText(1, "blah");
solo.clickOnButton("Log In");
</DeepExtract>
|
musicbrainz-android
|
positive
|
@Override
public synchronized int read() {
bitOffset = 0;
return (streamPos < count) ? (buf[(int) (streamPos++)] & 0xff) : -1;
}
|
<DeepExtract>
bitOffset = 0;
</DeepExtract>
|
monte-screen-recorder
|
positive
|
@Override
public void onCancel(DialogInterface dialogInterface) {
activityToFinish.finish();
}
|
<DeepExtract>
activityToFinish.finish();
</DeepExtract>
|
MVPLibrary
|
positive
|
@Override
protected Control createDialogArea(Composite parent) {
this.parentContainer = parent;
Composite container = (Composite) super.createDialogArea(parent);
final int layoutMargin = 10;
GridLayout layout = new GridLayout(1, false);
layout.marginTop = layoutMargin;
layout.marginLeft = layoutMargin;
layout.marginBottom = layoutMargin;
layout.marginRight = layoutMargin;
container.setLayout(layout);
Composite logoContainer = UIUtils.createFullGridedComposite(container, 1);
logoContainer.setData(new GridData(SWT.CENTER, SWT.NONE, true, false));
Label watchdogLogo = UIUtils.createWatchDogLogo(logoContainer);
watchdogLogo.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, true, false));
UIUtils.createLabel(" ", logoContainer);
Composite container = UIUtils.createZeroMarginGridedComposite(container, 2);
colorRed = new Color(getShell().getDisplay(), 255, 0, 0);
colorGreen = new Color(getShell().getDisplay(), 0, 150, 0);
UIUtils.createLabel("WatchDog Status: ", container);
if (WatchDogGlobals.isActive) {
UIUtils.createLabel(WatchDogGlobals.ACTIVE_WATCHDOG_TEXT, container, colorGreen);
} else {
Composite localGrid = UIUtils.createZeroMarginGridedComposite(container, 2);
UIUtils.createLabel(WatchDogGlobals.INACTIVE_WATCHDOG_TEXT, localGrid, colorRed);
createFixThisProblemLink(localGrid, new PreferenceListener());
}
createDataInfoLabels(container);
UIUtils.refreshCommand(UIUtils.COMMAND_SHOW_INFO);
UIUtils.createLabel("", container);
Composite container = UIUtils.createFullGridedComposite(container, 3);
container.setData(new GridData(SWT.CENTER, SWT.NONE, true, false));
UIUtils.createLinkedLabel(container, new WatchDogViewListener(), "Open View.", "").setLayoutData(UIUtils.createFullGridUsageData());
UIUtils.createOpenReportLink(container);
UIUtils.createLabel("", container);
UIUtils.createLinkedLabel(container, new BrowserOpenerSelection(), "Open logs.", "file://" + WatchDogLogger.getInstance().getLogDirectoryPath()).setLayoutData(UIUtils.createFullGridUsageData());
UIUtils.createLinkedLabel(container, new PreferenceListener(), "Open Prefs.", "").setLayoutData(UIUtils.createFullGridUsageData());
UIUtils.createLinkedLabel(container, new BrowserOpenerSelection(), "Report bug.", "https://github.com/TestRoots/watchdog/issues").setLayoutData(UIUtils.createFullGridUsageData());
return container;
}
|
<DeepExtract>
final int layoutMargin = 10;
GridLayout layout = new GridLayout(1, false);
layout.marginTop = layoutMargin;
layout.marginLeft = layoutMargin;
layout.marginBottom = layoutMargin;
layout.marginRight = layoutMargin;
container.setLayout(layout);
</DeepExtract>
<DeepExtract>
Composite logoContainer = UIUtils.createFullGridedComposite(container, 1);
logoContainer.setData(new GridData(SWT.CENTER, SWT.NONE, true, false));
Label watchdogLogo = UIUtils.createWatchDogLogo(logoContainer);
watchdogLogo.setLayoutData(new GridData(SWT.CENTER, SWT.BEGINNING, true, false));
UIUtils.createLabel(" ", logoContainer);
Composite container = UIUtils.createZeroMarginGridedComposite(container, 2);
colorRed = new Color(getShell().getDisplay(), 255, 0, 0);
colorGreen = new Color(getShell().getDisplay(), 0, 150, 0);
UIUtils.createLabel("WatchDog Status: ", container);
if (WatchDogGlobals.isActive) {
UIUtils.createLabel(WatchDogGlobals.ACTIVE_WATCHDOG_TEXT, container, colorGreen);
} else {
Composite localGrid = UIUtils.createZeroMarginGridedComposite(container, 2);
UIUtils.createLabel(WatchDogGlobals.INACTIVE_WATCHDOG_TEXT, localGrid, colorRed);
createFixThisProblemLink(localGrid, new PreferenceListener());
}
createDataInfoLabels(container);
UIUtils.refreshCommand(UIUtils.COMMAND_SHOW_INFO);
</DeepExtract>
<DeepExtract>
UIUtils.createLabel("", container);
Composite container = UIUtils.createFullGridedComposite(container, 3);
container.setData(new GridData(SWT.CENTER, SWT.NONE, true, false));
UIUtils.createLinkedLabel(container, new WatchDogViewListener(), "Open View.", "").setLayoutData(UIUtils.createFullGridUsageData());
UIUtils.createOpenReportLink(container);
UIUtils.createLabel("", container);
UIUtils.createLinkedLabel(container, new BrowserOpenerSelection(), "Open logs.", "file://" + WatchDogLogger.getInstance().getLogDirectoryPath()).setLayoutData(UIUtils.createFullGridUsageData());
UIUtils.createLinkedLabel(container, new PreferenceListener(), "Open Prefs.", "").setLayoutData(UIUtils.createFullGridUsageData());
UIUtils.createLinkedLabel(container, new BrowserOpenerSelection(), "Report bug.", "https://github.com/TestRoots/watchdog/issues").setLayoutData(UIUtils.createFullGridUsageData());
</DeepExtract>
|
watchdog
|
positive
|
@Override
public void deleteCustomCredentials() {
logger.debug("Deleting custom credentials file {}", customCredentialsPath);
asUnchecked(() -> deleteIfExists(customCredentialsPath));
hashOfConfiguredCredentials = configuredToUseCustomCredentials() ? crc32(getAsUnchecked(() -> customCredentialsPath.toUri().toURL())) : STANDARD_CREDENTIALS_URL_HASH;
}
|
<DeepExtract>
hashOfConfiguredCredentials = configuredToUseCustomCredentials() ? crc32(getAsUnchecked(() -> customCredentialsPath.toUri().toURL())) : STANDARD_CREDENTIALS_URL_HASH;
</DeepExtract>
|
jiotty-photos-uploader
|
positive
|
public static void displayStartupInterstitial(Activity activity) {
final String TAG = activity.getLocalClassName();
if (checkDonation(activity)) {
return;
}
final SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(activity);
final SharedPreferences.Editor editor = mPrefs.edit();
int counter = mPrefs.getInt(STARTUP_LAST_SHOWN_COUNT, 0);
final long timePassed = System.currentTimeMillis() - mPrefs.getLong(STARTUP_LAST_SHOWN_TIME, 0);
counter++;
editor.putInt(STARTUP_LAST_SHOWN_COUNT, counter);
editor.apply();
if (timePassed > DateUtils.WEEK_IN_MILLIS || counter >= COUNTER_LIMIT)
try {
final InterstitialAd interstitialAd = InterstitialAd.createInstance(STARTUP_APID);
interstitialAd.setListener(new InterstitialAd.InterstitialListener() {
@Override
public void onLoaded(InterstitialAd interstitialAd) {
Log.i(TAG, "Interstitial Ad loaded.");
try {
interstitialAd.show(activity);
} catch (MMException e) {
Log.i(activity.getLocalClassName(), "Unable to show interstitial ad content, exception occurred");
e.printStackTrace();
}
}
@Override
public void onLoadFailed(InterstitialAd interstitialAd, InterstitialAd.InterstitialErrorStatus errorStatus) {
Log.i(TAG, "Interstitial Ad load failed.");
}
@Override
public void onShown(InterstitialAd interstitialAd) {
editor.putInt(STARTUP_LAST_SHOWN_COUNT, 0);
editor.putLong(STARTUP_LAST_SHOWN_TIME, System.currentTimeMillis());
editor.apply();
Log.i(TAG, "Interstitial Ad shown.");
}
@Override
public void onShowFailed(InterstitialAd interstitialAd, InterstitialAd.InterstitialErrorStatus errorStatus) {
Log.i(TAG, "Interstitial Ad show failed.");
}
@Override
public void onClosed(InterstitialAd interstitialAd) {
Log.i(TAG, "Interstitial Ad closed.");
}
@Override
public void onClicked(InterstitialAd interstitialAd) {
Log.i(TAG, "Interstitial Ad clicked.");
}
@Override
public void onAdLeftApplication(InterstitialAd interstitialAd) {
Log.i(TAG, "Interstitial Ad left application.");
}
@Override
public void onExpired(InterstitialAd interstitialAd) {
Log.i(TAG, "Interstitial Ad expired.");
}
});
interstitialAd.load(activity, null);
} catch (MMException e) {
Log.e(activity.getLocalClassName(), "Error creating interstitial ad", e);
}
}
|
<DeepExtract>
final String TAG = activity.getLocalClassName();
if (checkDonation(activity)) {
return;
}
final SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(activity);
final SharedPreferences.Editor editor = mPrefs.edit();
int counter = mPrefs.getInt(STARTUP_LAST_SHOWN_COUNT, 0);
final long timePassed = System.currentTimeMillis() - mPrefs.getLong(STARTUP_LAST_SHOWN_TIME, 0);
counter++;
editor.putInt(STARTUP_LAST_SHOWN_COUNT, counter);
editor.apply();
if (timePassed > DateUtils.WEEK_IN_MILLIS || counter >= COUNTER_LIMIT)
try {
final InterstitialAd interstitialAd = InterstitialAd.createInstance(STARTUP_APID);
interstitialAd.setListener(new InterstitialAd.InterstitialListener() {
@Override
public void onLoaded(InterstitialAd interstitialAd) {
Log.i(TAG, "Interstitial Ad loaded.");
try {
interstitialAd.show(activity);
} catch (MMException e) {
Log.i(activity.getLocalClassName(), "Unable to show interstitial ad content, exception occurred");
e.printStackTrace();
}
}
@Override
public void onLoadFailed(InterstitialAd interstitialAd, InterstitialAd.InterstitialErrorStatus errorStatus) {
Log.i(TAG, "Interstitial Ad load failed.");
}
@Override
public void onShown(InterstitialAd interstitialAd) {
editor.putInt(STARTUP_LAST_SHOWN_COUNT, 0);
editor.putLong(STARTUP_LAST_SHOWN_TIME, System.currentTimeMillis());
editor.apply();
Log.i(TAG, "Interstitial Ad shown.");
}
@Override
public void onShowFailed(InterstitialAd interstitialAd, InterstitialAd.InterstitialErrorStatus errorStatus) {
Log.i(TAG, "Interstitial Ad show failed.");
}
@Override
public void onClosed(InterstitialAd interstitialAd) {
Log.i(TAG, "Interstitial Ad closed.");
}
@Override
public void onClicked(InterstitialAd interstitialAd) {
Log.i(TAG, "Interstitial Ad clicked.");
}
@Override
public void onAdLeftApplication(InterstitialAd interstitialAd) {
Log.i(TAG, "Interstitial Ad left application.");
}
@Override
public void onExpired(InterstitialAd interstitialAd) {
Log.i(TAG, "Interstitial Ad expired.");
}
});
interstitialAd.load(activity, null);
} catch (MMException e) {
Log.e(activity.getLocalClassName(), "Error creating interstitial ad", e);
}
</DeepExtract>
|
routerkeygenAndroid
|
positive
|
public static boolean hasBusyBox() {
for (String path : SU_BINARY_PATH) {
File file = new File(path, BUSYBOX);
if (file.exists()) {
return true;
}
}
return false;
}
|
<DeepExtract>
for (String path : SU_BINARY_PATH) {
File file = new File(path, BUSYBOX);
if (file.exists()) {
return true;
}
}
return false;
</DeepExtract>
|
apptoolkit
|
positive
|
@Override
public boolean isMultipart() {
if (destroyed) {
throw new IllegalStateException(HttpPostMultipartRequestDecoder.class.getSimpleName() + " was destroyed already");
}
return true;
}
|
<DeepExtract>
if (destroyed) {
throw new IllegalStateException(HttpPostMultipartRequestDecoder.class.getSimpleName() + " was destroyed already");
}
</DeepExtract>
|
dorado
|
positive
|
private DotElement handleDotRow(int y, DotRowHandler h) {
Map<Integer, DotElement> row = foods.get(Integer.valueOf(y));
if (row == null) {
return null;
}
return row.get(Integer.valueOf(x));
}
|
<DeepExtract>
return row.get(Integer.valueOf(x));
</DeepExtract>
|
google-pacman
|
positive
|
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
final Bundle args = getArguments();
pickerId = args.getInt(ARG_PICKER_ID);
title = args.getString(ARG_TITLE);
positiveButtonText = args.getString(ARG_POSITIVE_BUTTON_TEXT);
negativeButtonText = args.getString(ARG_NEGATIVE_BUTTON_TEXT);
enableMultipleSelection = args.getBoolean(ARG_ENABLE_MULTIPLE_SELECTION);
setSelectedItems(args.getIntArray(ARG_SELECTED_ITEMS_INDICES));
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()).setPositiveButton(positiveButtonText, dialogButtonClickListener).setNegativeButton(negativeButtonText, dialogButtonClickListener);
if (title != null)
builder.setTitle(title);
if (enableMultipleSelection) {
setupMultiChoiceDialog(builder);
} else {
setupSingleChoiceDialog(builder);
}
return builder.create();
}
|
<DeepExtract>
final Bundle args = getArguments();
pickerId = args.getInt(ARG_PICKER_ID);
title = args.getString(ARG_TITLE);
positiveButtonText = args.getString(ARG_POSITIVE_BUTTON_TEXT);
negativeButtonText = args.getString(ARG_NEGATIVE_BUTTON_TEXT);
enableMultipleSelection = args.getBoolean(ARG_ENABLE_MULTIPLE_SELECTION);
setSelectedItems(args.getIntArray(ARG_SELECTED_ITEMS_INDICES));
</DeepExtract>
|
MVPAndroidBootstrap
|
positive
|
@Override
public MonetaryAmount apply(MonetaryAmount amount) {
Objects.requireNonNull(amount, "Amount required");
Objects.requireNonNull(rate, "Rate required");
return amount.divide(rate.get());
}
|
<DeepExtract>
Objects.requireNonNull(amount, "Amount required");
Objects.requireNonNull(rate, "Rate required");
return amount.divide(rate.get());
</DeepExtract>
|
javamoney-lib
|
positive
|
static int sizeMetricDefinitions() {
return metricDefs.size();
}
|
<DeepExtract>
return metricDefs.size();
</DeepExtract>
|
monasca-thresh
|
positive
|
public void mouseExited(java.awt.event.MouseEvent evt) {
banDriverButton.setBackground(new Color(51, 0, 102));
}
|
<DeepExtract>
banDriverButton.setBackground(new Color(51, 0, 102));
</DeepExtract>
|
vehler
|
positive
|
@Test
public void iteratorDirectory() throws IOException {
AmazonS3ClientMock client = AmazonS3MockFactory.getAmazonClientMock();
client.bucket("bucketA").dir("dir").file("dir/file1");
S3FileSystem s3FileSystem = (S3FileSystem) FileSystems.getFileSystem(endpoint);
S3Path path = s3FileSystem.getPath("/bucketA", "dir");
S3Iterator iterator = new S3Iterator(path);
assertNotNull(iterator);
assertTrue(iterator.hasNext());
List<String> filesNamesExpected = Arrays.asList("file1");
List<String> filesNamesActual = new ArrayList<>();
while (iterator.hasNext()) {
Path path = iterator.next();
String fileName = path.getFileName().toString();
filesNamesActual.add(fileName);
}
assertEquals(filesNamesExpected, filesNamesActual);
}
|
<DeepExtract>
assertNotNull(iterator);
assertTrue(iterator.hasNext());
List<String> filesNamesExpected = Arrays.asList("file1");
List<String> filesNamesActual = new ArrayList<>();
while (iterator.hasNext()) {
Path path = iterator.next();
String fileName = path.getFileName().toString();
filesNamesActual.add(fileName);
}
assertEquals(filesNamesExpected, filesNamesActual);
</DeepExtract>
|
nifi-minio
|
positive
|
public void run() {
dbHelper.DeleteImagePreview();
dbHelper.CreateImagePreview(mContext);
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(mContext);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putBoolean(Constants.REFRESH, true);
editor.apply();
if (pDialog.isShowing())
pDialog.dismiss();
Toasty.success(mContext, "Cache Rebuilt", Toast.LENGTH_SHORT).show();
}
|
<DeepExtract>
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(mContext);
SharedPreferences.Editor editor = sharedPref.edit();
editor.putBoolean(Constants.REFRESH, true);
editor.apply();
</DeepExtract>
<DeepExtract>
if (pDialog.isShowing())
pDialog.dismiss();
</DeepExtract>
|
Rocket-Notes
|
positive
|
@Test
public void testTransactions() throws Exception {
try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) {
System.out.println("Test tx: " + "85db49cb288f3a92168fae9f4bf155279f7d5418636c9ef04e9fdc1b7f5fa024");
Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("85db49cb288f3a92168fae9f4bf155279f7d5418636c9ef04e9fdc1b7f5fa024")).getTx(jelly.getNetworkParameters());
for (TransactionInput in : tx.getInputs()) {
ByteString in_parse = tx_util.getScriptHashForInput(in, true, null);
Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters());
TransactionOutput out = src.getOutput(in.getOutpoint().getIndex());
ByteString out_parse = tx_util.getScriptHashForOutput(out);
Assert.assertEquals(getHexString(out_parse), getHexString(in_parse));
}
}
try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) {
System.out.println("Test tx: " + "8bedbd27fc8b8cc4f1771b95b878d8a2279ad88cb1ef52e15a2b8f69778a9ccb");
Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("8bedbd27fc8b8cc4f1771b95b878d8a2279ad88cb1ef52e15a2b8f69778a9ccb")).getTx(jelly.getNetworkParameters());
for (TransactionInput in : tx.getInputs()) {
ByteString in_parse = tx_util.getScriptHashForInput(in, true, null);
Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters());
TransactionOutput out = src.getOutput(in.getOutpoint().getIndex());
ByteString out_parse = tx_util.getScriptHashForOutput(out);
Assert.assertEquals(getHexString(out_parse), getHexString(in_parse));
}
}
try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) {
System.out.println("Test tx: " + "8afaf20659ac2762b2c10c74f0a26bdecc78f82c011a89db8a006f6827a80390");
Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("8afaf20659ac2762b2c10c74f0a26bdecc78f82c011a89db8a006f6827a80390")).getTx(jelly.getNetworkParameters());
for (TransactionInput in : tx.getInputs()) {
ByteString in_parse = tx_util.getScriptHashForInput(in, true, null);
Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters());
TransactionOutput out = src.getOutput(in.getOutpoint().getIndex());
ByteString out_parse = tx_util.getScriptHashForOutput(out);
Assert.assertEquals(getHexString(out_parse), getHexString(in_parse));
}
}
try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) {
System.out.println("Test tx: " + "6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4");
Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4")).getTx(jelly.getNetworkParameters());
for (TransactionInput in : tx.getInputs()) {
ByteString in_parse = tx_util.getScriptHashForInput(in, true, null);
Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters());
TransactionOutput out = src.getOutput(in.getOutpoint().getIndex());
ByteString out_parse = tx_util.getScriptHashForOutput(out);
Assert.assertEquals(getHexString(out_parse), getHexString(in_parse));
}
}
try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) {
System.out.println("Test tx: " + "f6f89da0b22ca49233197e072a39554147b55755be0c7cdf139ad33cc973ec46");
Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("f6f89da0b22ca49233197e072a39554147b55755be0c7cdf139ad33cc973ec46")).getTx(jelly.getNetworkParameters());
for (TransactionInput in : tx.getInputs()) {
ByteString in_parse = tx_util.getScriptHashForInput(in, true, null);
Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters());
TransactionOutput out = src.getOutput(in.getOutpoint().getIndex());
ByteString out_parse = tx_util.getScriptHashForOutput(out);
Assert.assertEquals(getHexString(out_parse), getHexString(in_parse));
}
}
try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) {
System.out.println("Test tx: " + "92a8b6d40b58d802ab2e8488af204742b0db3e6d2651a55b0e4456425cb5497c");
Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("92a8b6d40b58d802ab2e8488af204742b0db3e6d2651a55b0e4456425cb5497c")).getTx(jelly.getNetworkParameters());
for (TransactionInput in : tx.getInputs()) {
ByteString in_parse = tx_util.getScriptHashForInput(in, true, null);
Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters());
TransactionOutput out = src.getOutput(in.getOutpoint().getIndex());
ByteString out_parse = tx_util.getScriptHashForOutput(out);
Assert.assertEquals(getHexString(out_parse), getHexString(in_parse));
}
}
try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) {
System.out.println("Test tx: " + "0d94f4d0ea3c092a8bce7afe27edb84a4167cda55871b12b0bd0d6e2b4ef4e81");
Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("0d94f4d0ea3c092a8bce7afe27edb84a4167cda55871b12b0bd0d6e2b4ef4e81")).getTx(jelly.getNetworkParameters());
for (TransactionInput in : tx.getInputs()) {
ByteString in_parse = tx_util.getScriptHashForInput(in, true, null);
Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters());
TransactionOutput out = src.getOutput(in.getOutpoint().getIndex());
ByteString out_parse = tx_util.getScriptHashForOutput(out);
Assert.assertEquals(getHexString(out_parse), getHexString(in_parse));
}
}
try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) {
System.out.println("Test tx: " + "bc26380619a36e0ecbb5bae4eebf78d8fdef24ba5ed5fd040e7bff37311e180d");
Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("bc26380619a36e0ecbb5bae4eebf78d8fdef24ba5ed5fd040e7bff37311e180d")).getTx(jelly.getNetworkParameters());
for (TransactionInput in : tx.getInputs()) {
ByteString in_parse = tx_util.getScriptHashForInput(in, true, null);
Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters());
TransactionOutput out = src.getOutput(in.getOutpoint().getIndex());
ByteString out_parse = tx_util.getScriptHashForOutput(out);
Assert.assertEquals(getHexString(out_parse), getHexString(in_parse));
}
}
}
|
<DeepExtract>
try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) {
System.out.println("Test tx: " + "85db49cb288f3a92168fae9f4bf155279f7d5418636c9ef04e9fdc1b7f5fa024");
Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("85db49cb288f3a92168fae9f4bf155279f7d5418636c9ef04e9fdc1b7f5fa024")).getTx(jelly.getNetworkParameters());
for (TransactionInput in : tx.getInputs()) {
ByteString in_parse = tx_util.getScriptHashForInput(in, true, null);
Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters());
TransactionOutput out = src.getOutput(in.getOutpoint().getIndex());
ByteString out_parse = tx_util.getScriptHashForOutput(out);
Assert.assertEquals(getHexString(out_parse), getHexString(in_parse));
}
}
</DeepExtract>
<DeepExtract>
try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) {
System.out.println("Test tx: " + "8bedbd27fc8b8cc4f1771b95b878d8a2279ad88cb1ef52e15a2b8f69778a9ccb");
Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("8bedbd27fc8b8cc4f1771b95b878d8a2279ad88cb1ef52e15a2b8f69778a9ccb")).getTx(jelly.getNetworkParameters());
for (TransactionInput in : tx.getInputs()) {
ByteString in_parse = tx_util.getScriptHashForInput(in, true, null);
Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters());
TransactionOutput out = src.getOutput(in.getOutpoint().getIndex());
ByteString out_parse = tx_util.getScriptHashForOutput(out);
Assert.assertEquals(getHexString(out_parse), getHexString(in_parse));
}
}
</DeepExtract>
<DeepExtract>
try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) {
System.out.println("Test tx: " + "8afaf20659ac2762b2c10c74f0a26bdecc78f82c011a89db8a006f6827a80390");
Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("8afaf20659ac2762b2c10c74f0a26bdecc78f82c011a89db8a006f6827a80390")).getTx(jelly.getNetworkParameters());
for (TransactionInput in : tx.getInputs()) {
ByteString in_parse = tx_util.getScriptHashForInput(in, true, null);
Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters());
TransactionOutput out = src.getOutput(in.getOutpoint().getIndex());
ByteString out_parse = tx_util.getScriptHashForOutput(out);
Assert.assertEquals(getHexString(out_parse), getHexString(in_parse));
}
}
</DeepExtract>
<DeepExtract>
try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) {
System.out.println("Test tx: " + "6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4");
Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("6359f0868171b1d194cbee1af2f16ea598ae8fad666d9b012c8ed2b79a236ec4")).getTx(jelly.getNetworkParameters());
for (TransactionInput in : tx.getInputs()) {
ByteString in_parse = tx_util.getScriptHashForInput(in, true, null);
Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters());
TransactionOutput out = src.getOutput(in.getOutpoint().getIndex());
ByteString out_parse = tx_util.getScriptHashForOutput(out);
Assert.assertEquals(getHexString(out_parse), getHexString(in_parse));
}
}
</DeepExtract>
<DeepExtract>
try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) {
System.out.println("Test tx: " + "f6f89da0b22ca49233197e072a39554147b55755be0c7cdf139ad33cc973ec46");
Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("f6f89da0b22ca49233197e072a39554147b55755be0c7cdf139ad33cc973ec46")).getTx(jelly.getNetworkParameters());
for (TransactionInput in : tx.getInputs()) {
ByteString in_parse = tx_util.getScriptHashForInput(in, true, null);
Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters());
TransactionOutput out = src.getOutput(in.getOutpoint().getIndex());
ByteString out_parse = tx_util.getScriptHashForOutput(out);
Assert.assertEquals(getHexString(out_parse), getHexString(in_parse));
}
}
</DeepExtract>
<DeepExtract>
try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) {
System.out.println("Test tx: " + "92a8b6d40b58d802ab2e8488af204742b0db3e6d2651a55b0e4456425cb5497c");
Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("92a8b6d40b58d802ab2e8488af204742b0db3e6d2651a55b0e4456425cb5497c")).getTx(jelly.getNetworkParameters());
for (TransactionInput in : tx.getInputs()) {
ByteString in_parse = tx_util.getScriptHashForInput(in, true, null);
Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters());
TransactionOutput out = src.getOutput(in.getOutpoint().getIndex());
ByteString out_parse = tx_util.getScriptHashForOutput(out);
Assert.assertEquals(getHexString(out_parse), getHexString(in_parse));
}
}
</DeepExtract>
<DeepExtract>
try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) {
System.out.println("Test tx: " + "0d94f4d0ea3c092a8bce7afe27edb84a4167cda55871b12b0bd0d6e2b4ef4e81");
Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("0d94f4d0ea3c092a8bce7afe27edb84a4167cda55871b12b0bd0d6e2b4ef4e81")).getTx(jelly.getNetworkParameters());
for (TransactionInput in : tx.getInputs()) {
ByteString in_parse = tx_util.getScriptHashForInput(in, true, null);
Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters());
TransactionOutput out = src.getOutput(in.getOutpoint().getIndex());
ByteString out_parse = tx_util.getScriptHashForOutput(out);
Assert.assertEquals(getHexString(out_parse), getHexString(in_parse));
}
}
</DeepExtract>
<DeepExtract>
try (TimeRecordAuto tra = new TimeRecordAuto("test_transaction")) {
System.out.println("Test tx: " + "bc26380619a36e0ecbb5bae4eebf78d8fdef24ba5ed5fd040e7bff37311e180d");
Transaction tx = jelly.getDB().getTransaction(Sha256Hash.wrap("bc26380619a36e0ecbb5bae4eebf78d8fdef24ba5ed5fd040e7bff37311e180d")).getTx(jelly.getNetworkParameters());
for (TransactionInput in : tx.getInputs()) {
ByteString in_parse = tx_util.getScriptHashForInput(in, true, null);
Transaction src = jelly.getDB().getTransaction(in.getOutpoint().getHash()).getTx(jelly.getNetworkParameters());
TransactionOutput out = src.getOutput(in.getOutpoint().getIndex());
ByteString out_parse = tx_util.getScriptHashForOutput(out);
Assert.assertEquals(getHexString(out_parse), getHexString(in_parse));
}
}
</DeepExtract>
|
jelectrum
|
positive
|
@Override
public void onShowMessage(@NonNull String msg) {
if (getProgressDialog().isShowing())
getProgressDialog().dismiss();
Toast.makeText(this, msg, Toast.LENGTH_LONG).show();
}
|
<DeepExtract>
if (getProgressDialog().isShowing())
getProgressDialog().dismiss();
</DeepExtract>
|
FastAccess
|
positive
|
public TreeNode deserialize(String data) {
Queue<String> qu = new LinkedList<>();
qu.addAll(Arrays.asList(data.split(",")));
if (qu.isEmpty())
return null;
String cur = qu.remove();
if (cur.equals("N")) {
return null;
} else {
TreeNode root = new TreeNode(Integer.valueOf(cur));
root.left = buildTree(qu);
root.right = buildTree(qu);
return root;
}
}
|
<DeepExtract>
if (qu.isEmpty())
return null;
String cur = qu.remove();
if (cur.equals("N")) {
return null;
} else {
TreeNode root = new TreeNode(Integer.valueOf(cur));
root.left = buildTree(qu);
root.right = buildTree(qu);
return root;
}
</DeepExtract>
|
Leetcode-for-Fun
|
positive
|
@Override
public OUTER set(OUTER newValue) {
return converter.pushIn(ref.set(converter.pushIn(newValue)));
}
|
<DeepExtract>
return converter.pushIn(ref.set(converter.pushIn(newValue)));
</DeepExtract>
|
karg
|
positive
|
private void assignLayers(Set<Vertex> comp) {
LinkedList<Vertex> queue = new LinkedList<Vertex>();
HashSet<Vertex> processed = new HashSet<Vertex>();
int ctr = 0;
for (Vertex v : comp) {
if (network.isOrphan(v)) {
queue.add(v);
}
}
while (!queue.isEmpty()) {
Vertex v = queue.removeFirst();
processed.add(v);
ctr++;
int layer = (v instanceof Fam) ? 1 : 0;
for (Vertex p : network.getAscendants(v)) {
layer = Math.max(layer, p.getLayer() + 1);
}
v.setLayer(layer);
for (Vertex d : network.getDescendants(v)) {
if (processed.containsAll(network.getAscendants(d))) {
queue.addLast(d);
}
}
}
assert (ctr == comp.size());
if (comp.size() <= 1)
return;
while (tightTree(comp) < comp.size()) {
Edge e = null;
for (Vertex v : comp) {
for (Edge f : network.getInEdges(v)) {
if (!treeEdge.contains(f) && incident(f) != null && ((e == null) || (slack(f) < slack(e)))) {
e = f;
}
}
}
if (e != null) {
int delta = slack(e);
if (delta != 0) {
if (incident(e) == network.getDescendant(e))
delta = -delta;
network.offsetLayer(delta, treeNode);
} else
LOG.error("Unexpected tight node");
}
}
int min = comp.size();
for (Vertex v : comp) {
min = Math.min(min, v.getLayer());
}
if ((min % 2) == 1)
min--;
network.offsetLayer(-min, comp);
}
|
<DeepExtract>
LinkedList<Vertex> queue = new LinkedList<Vertex>();
HashSet<Vertex> processed = new HashSet<Vertex>();
int ctr = 0;
for (Vertex v : comp) {
if (network.isOrphan(v)) {
queue.add(v);
}
}
while (!queue.isEmpty()) {
Vertex v = queue.removeFirst();
processed.add(v);
ctr++;
int layer = (v instanceof Fam) ? 1 : 0;
for (Vertex p : network.getAscendants(v)) {
layer = Math.max(layer, p.getLayer() + 1);
}
v.setLayer(layer);
for (Vertex d : network.getDescendants(v)) {
if (processed.containsAll(network.getAscendants(d))) {
queue.addLast(d);
}
}
}
assert (ctr == comp.size());
</DeepExtract>
<DeepExtract>
if (comp.size() <= 1)
return;
while (tightTree(comp) < comp.size()) {
Edge e = null;
for (Vertex v : comp) {
for (Edge f : network.getInEdges(v)) {
if (!treeEdge.contains(f) && incident(f) != null && ((e == null) || (slack(f) < slack(e)))) {
e = f;
}
}
}
if (e != null) {
int delta = slack(e);
if (delta != 0) {
if (incident(e) == network.getDescendant(e))
delta = -delta;
network.offsetLayer(delta, treeNode);
} else
LOG.error("Unexpected tight node");
}
}
</DeepExtract>
|
geneaquilt
|
positive
|
public Criteria andIsDeletedGreaterThanOrEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "isDeleted" + " cannot be null");
}
criteria.add(new Criterion("is_deleted >=", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "isDeleted" + " cannot be null");
}
criteria.add(new Criterion("is_deleted >=", value));
</DeepExtract>
|
MarketServer
|
positive
|
public static String getNewFormatDateString(Date date) {
DateFormat dateFormat = new SimpleDateFormat(simple);
if (date == null || dateFormat == null) {
return null;
}
return dateFormat.format(date);
}
|
<DeepExtract>
if (date == null || dateFormat == null) {
return null;
}
return dateFormat.format(date);
</DeepExtract>
|
classchecks
|
positive
|
public Criteria andSongidNotBetween(String value1, String value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "songid" + " cannot be null");
}
criteria.add(new Criterion("songId not between", value1, value2));
return (Criteria) this;
}
|
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "songid" + " cannot be null");
}
criteria.add(new Criterion("songId not between", value1, value2));
</DeepExtract>
|
music
|
positive
|
public void newMap(int width, int height) {
String uuid = UUID.randomUUID().toString();
this.scene = new Scene(null, uuid, width, height);
this.scene.setCamera(camera);
this.scene.setDebug(true);
this.terrain = this.scene.getTerrain();
terrain.setDebugListener(this);
terrain.fillEmptyTilesWithDebugTile();
terrain.buildSectors();
camera.position.set(width / 2, 17, height / 2);
camera.lookAt(width / 2, 0, height / 2);
this.scene.initialize();
terrainBrush = new TerrainBrush(terrain);
autoTileBrush = new AutoTileBrush(terrain);
passableTileBrush = new PassableBrush(terrain);
eventBrush = new EventBrush(terrain);
liquidBrush = new LiquidBrush(terrain);
foliageBrush = new FoliageBrush(terrain);
}
|
<DeepExtract>
terrainBrush = new TerrainBrush(terrain);
autoTileBrush = new AutoTileBrush(terrain);
passableTileBrush = new PassableBrush(terrain);
eventBrush = new EventBrush(terrain);
liquidBrush = new LiquidBrush(terrain);
foliageBrush = new FoliageBrush(terrain);
</DeepExtract>
|
FabulaEngine
|
positive
|
@Override
public IntIterator getUidxIidxs(int uidx) {
return d.getUidxIidxs(uidx);
}
|
<DeepExtract>
return d.getUidxIidxs(uidx);
</DeepExtract>
|
kNNBandit
|
positive
|
void start() throws Exception {
if (mSession == null || !mSession.isRunning()) {
try {
mSession = createSession();
} catch (Exception e) {
e.printStackTrace();
}
if (mSession == null) {
startServer();
mSession = createSession();
}
}
return mSession;
}
|
<DeepExtract>
if (mSession == null || !mSession.isRunning()) {
try {
mSession = createSession();
} catch (Exception e) {
e.printStackTrace();
}
if (mSession == null) {
startServer();
mSession = createSession();
}
}
return mSession;
</DeepExtract>
|
AppOpsX
|
positive
|
@Deprecated
public void closeSubPath() throws IOException {
if (inTextMode) {
throw new IllegalStateException("Error: closePath is not allowed within a text block.");
}
writeOperator("h");
}
|
<DeepExtract>
if (inTextMode) {
throw new IllegalStateException("Error: closePath is not allowed within a text block.");
}
writeOperator("h");
</DeepExtract>
|
pint-publisher
|
positive
|
@Override
public Completable sendDeliveryReceipt(String userId, DeliveryReceiptType type, String messageId, @Nullable Consumer<String> newId) {
return send(Paths.messagesPath(userId), new DeliveryReceipt(type, messageId), newId);
}
|
<DeepExtract>
return send(Paths.messagesPath(userId), new DeliveryReceipt(type, messageId), newId);
</DeepExtract>
|
firestream-android
|
positive
|
@Override
public Number getNumberValue() throws IOException {
Object n = currentNode();
if (n instanceof Number) {
return (Number) n;
} else {
throw _constructError(n + " is not a number");
}
}
|
<DeepExtract>
Object n = currentNode();
if (n instanceof Number) {
return (Number) n;
} else {
throw _constructError(n + " is not a number");
}
</DeepExtract>
|
mongojack
|
positive
|
public void onClick(DialogInterface dialog, int id) {
isGameStarted = false;
isUserTurn = false;
WarpController.getInstance().stopApp();
super.onBackPressed();
}
|
<DeepExtract>
isGameStarted = false;
isUserTurn = false;
WarpController.getInstance().stopApp();
super.onBackPressed();
</DeepExtract>
|
AppWarpAndroidSamples
|
positive
|
public long incrementAndGet() {
long currentValue;
long newValue;
do {
currentValue = get();
newValue = currentValue + 1L;
} while (!compareAndSet(currentValue, newValue));
return newValue;
}
|
<DeepExtract>
long currentValue;
long newValue;
do {
currentValue = get();
newValue = currentValue + 1L;
} while (!compareAndSet(currentValue, newValue));
return newValue;
</DeepExtract>
|
disruptor-translation
|
positive
|
public static FinalDb create(DaoConfig daoConfig) {
FinalDb dao = daoMap.get(daoConfig.getDbName());
if (dao == null) {
dao = new FinalDb(daoConfig);
daoMap.put(daoConfig.getDbName(), dao);
}
return dao;
}
|
<DeepExtract>
FinalDb dao = daoMap.get(daoConfig.getDbName());
if (dao == null) {
dao = new FinalDb(daoConfig);
daoMap.put(daoConfig.getDbName(), dao);
}
return dao;
</DeepExtract>
|
afinal
|
positive
|
@Override
public void onClick(final ClickEvent event) {
String branchName = nameTxtBox.getText();
if ("".equals(branchName)) {
nameTxtBox.setFocus(true);
return;
}
String rev = irevTxtBox.getText();
if ("".equals(rev)) {
irevTxtBox.setText("HEAD");
DeferredCommand.addCommand(new Command() {
@Override
public void execute() {
irevTxtBox.selectAll();
irevTxtBox.setFocus(true);
}
});
return;
}
if (!branchName.startsWith(Branch.R_REFS)) {
branchName = Branch.R_HEADS + branchName;
}
addBranch.setEnabled(false);
Util.PROJECT_SVC.addBranch(getProjectKey(), branchName, rev, new GerritCallback<ListBranchesResult>() {
public void onSuccess(final ListBranchesResult result) {
addBranch.setEnabled(true);
nameTxtBox.setText("");
irevTxtBox.setText("");
display(result.getBranches());
}
@Override
public void onFailure(final Throwable caught) {
if (caught instanceof InvalidNameException || caught instanceof RemoteJsonException && caught.getMessage().equals(InvalidNameException.MESSAGE)) {
nameTxtBox.selectAll();
nameTxtBox.setFocus(true);
} else if (caught instanceof InvalidRevisionException || caught instanceof RemoteJsonException && caught.getMessage().equals(InvalidRevisionException.MESSAGE)) {
irevTxtBox.selectAll();
irevTxtBox.setFocus(true);
}
addBranch.setEnabled(true);
super.onFailure(caught);
}
});
}
|
<DeepExtract>
String branchName = nameTxtBox.getText();
if ("".equals(branchName)) {
nameTxtBox.setFocus(true);
return;
}
String rev = irevTxtBox.getText();
if ("".equals(rev)) {
irevTxtBox.setText("HEAD");
DeferredCommand.addCommand(new Command() {
@Override
public void execute() {
irevTxtBox.selectAll();
irevTxtBox.setFocus(true);
}
});
return;
}
if (!branchName.startsWith(Branch.R_REFS)) {
branchName = Branch.R_HEADS + branchName;
}
addBranch.setEnabled(false);
Util.PROJECT_SVC.addBranch(getProjectKey(), branchName, rev, new GerritCallback<ListBranchesResult>() {
public void onSuccess(final ListBranchesResult result) {
addBranch.setEnabled(true);
nameTxtBox.setText("");
irevTxtBox.setText("");
display(result.getBranches());
}
@Override
public void onFailure(final Throwable caught) {
if (caught instanceof InvalidNameException || caught instanceof RemoteJsonException && caught.getMessage().equals(InvalidNameException.MESSAGE)) {
nameTxtBox.selectAll();
nameTxtBox.setFocus(true);
} else if (caught instanceof InvalidRevisionException || caught instanceof RemoteJsonException && caught.getMessage().equals(InvalidRevisionException.MESSAGE)) {
irevTxtBox.selectAll();
irevTxtBox.setFocus(true);
}
addBranch.setEnabled(true);
super.onFailure(caught);
}
});
</DeepExtract>
|
mini-git-server
|
positive
|
@Override
public void execute() {
ActivitiesQuery query = ActivitiesQuery.activitiesInGroup(_item.getId());
if (false) {
query = query.byUser(UserId.currentUser());
}
ActivityFeedViewBuilder builder = ActivityFeedViewBuilder.create(query).setActionListener(_activityListener.dependencies().actionListener()).setViewStateListener(new ViewStateListener() {
@Override
public void onOpen() {
_log.logInfoAndToast("Feed open for " + _item.getId());
}
@Override
public void onClose() {
_log.logInfoAndToast("Feed closed for " + _item.getId());
loadItems();
}
}).setUiActionListener((action, pendingAction) -> {
final String actionDescription = action.name().replace("_", " ").toLowerCase();
_log.logInfoAndToast("User is going to " + actionDescription);
if (GetSocial.getCurrentUser().isAnonymous() && FORBIDDEN_FOR_ANONYMOUS.contains(action)) {
showAuthorizeUserDialogForPendingAction(actionDescription, pendingAction);
} else {
pendingAction.proceed();
}
}).setAvatarClickListener(user -> {
_log.logInfoAndToast("User avatar clicked:" + user);
if (user.isApp()) {
return;
}
showUserActionDialog(user);
}).setMentionClickListener(mention -> {
_log.logInfoAndToast("User clicked: " + mention);
getUserAndShowActionDialog(mention);
}).setTagClickListener(tag -> _log.logInfoAndToast("Tag clicked: " + tag));
if (Utils.isCustomErrorMessageEnabled(getContext())) {
builder.setCustomErrorMessageProvider(new CustomErrorMessageProvider() {
@Override
public String onError(int errorCode, String errorMessage) {
if (errorCode == ErrorCode.ACTIVITY_REJECTED) {
return "Be careful what you say :)";
}
return errorMessage;
}
});
}
builder.show();
}
|
<DeepExtract>
ActivitiesQuery query = ActivitiesQuery.activitiesInGroup(_item.getId());
if (false) {
query = query.byUser(UserId.currentUser());
}
ActivityFeedViewBuilder builder = ActivityFeedViewBuilder.create(query).setActionListener(_activityListener.dependencies().actionListener()).setViewStateListener(new ViewStateListener() {
@Override
public void onOpen() {
_log.logInfoAndToast("Feed open for " + _item.getId());
}
@Override
public void onClose() {
_log.logInfoAndToast("Feed closed for " + _item.getId());
loadItems();
}
}).setUiActionListener((action, pendingAction) -> {
final String actionDescription = action.name().replace("_", " ").toLowerCase();
_log.logInfoAndToast("User is going to " + actionDescription);
if (GetSocial.getCurrentUser().isAnonymous() && FORBIDDEN_FOR_ANONYMOUS.contains(action)) {
showAuthorizeUserDialogForPendingAction(actionDescription, pendingAction);
} else {
pendingAction.proceed();
}
}).setAvatarClickListener(user -> {
_log.logInfoAndToast("User avatar clicked:" + user);
if (user.isApp()) {
return;
}
showUserActionDialog(user);
}).setMentionClickListener(mention -> {
_log.logInfoAndToast("User clicked: " + mention);
getUserAndShowActionDialog(mention);
}).setTagClickListener(tag -> _log.logInfoAndToast("Tag clicked: " + tag));
if (Utils.isCustomErrorMessageEnabled(getContext())) {
builder.setCustomErrorMessageProvider(new CustomErrorMessageProvider() {
@Override
public String onError(int errorCode, String errorMessage) {
if (errorCode == ErrorCode.ACTIVITY_REJECTED) {
return "Be careful what you say :)";
}
return errorMessage;
}
});
}
builder.show();
</DeepExtract>
|
getsocial-android-sdk
|
positive
|
private static String convertDataToWitsml20From1411(com.hashmapinc.tempus.WitsmlObjects.v1411.ObjLog log) {
if (log == null)
return null;
String wml20Data = "[";
for (int j = 0; j < log.getLogData().get(0).getData().size(); j++) {
List<String> data = Arrays.asList(log.getLogData().get(0).getData().get(j).split("\\s*,\\s*"));
for (int i = 0; i < data.size(); i++) {
if (i == 0) {
wml20Data = wml20Data + "[[" + data.get(i) + "]";
} else if (i == 1) {
wml20Data = wml20Data + ",[" + data.get(i);
} else {
wml20Data = wml20Data + ", " + data.get(i);
}
if (i == (data.size() - 1)) {
wml20Data = wml20Data + "]]";
if (j != (log.getLogData().get(0).getData().size() - 1)) {
wml20Data = wml20Data + ",";
}
}
}
}
wml20Data = wml20Data + "]";
return wml20Data;
}
|
<DeepExtract>
String wml20Data = "[";
for (int j = 0; j < log.getLogData().get(0).getData().size(); j++) {
List<String> data = Arrays.asList(log.getLogData().get(0).getData().get(j).split("\\s*,\\s*"));
for (int i = 0; i < data.size(); i++) {
if (i == 0) {
wml20Data = wml20Data + "[[" + data.get(i) + "]";
} else if (i == 1) {
wml20Data = wml20Data + ",[" + data.get(i);
} else {
wml20Data = wml20Data + ", " + data.get(i);
}
if (i == (data.size() - 1)) {
wml20Data = wml20Data + "]]";
if (j != (log.getLogData().get(0).getData().size() - 1)) {
wml20Data = wml20Data + ",";
}
}
}
}
wml20Data = wml20Data + "]";
return wml20Data;
</DeepExtract>
|
Drillflow
|
positive
|
@Override
public Void call() {
putAll(updateSpec.getNonTransactionalGroup().getBarriers());
putAll(updateSpec.getNonTransactionalGroup().getJobs());
putAll(updateSpec.getNonTransactionalGroup().getSlots());
putAll(updateSpec.getNonTransactionalGroup().getJobInstanceRecords());
putAll(updateSpec.getNonTransactionalGroup().getFailureRecords());
return null;
}
|
<DeepExtract>
putAll(updateSpec.getNonTransactionalGroup().getBarriers());
putAll(updateSpec.getNonTransactionalGroup().getJobs());
putAll(updateSpec.getNonTransactionalGroup().getSlots());
putAll(updateSpec.getNonTransactionalGroup().getJobInstanceRecords());
putAll(updateSpec.getNonTransactionalGroup().getFailureRecords());
</DeepExtract>
|
appengine-pipelines
|
positive
|
void onStop(Task onCompleted) {
if (onCompleted != null) {
runnables.add(onCompleted);
}
dispose = true;
}
|
<DeepExtract>
</DeepExtract>
<DeepExtract>
if (onCompleted != null) {
runnables.add(onCompleted);
}
</DeepExtract>
|
hawtdispatch
|
positive
|
public void show(Context context) {
ShareSDK.initSDK(context);
this.context = context;
ShareSDK.logDemoEvent(1, null);
if (shareParamsMap.containsKey("platform")) {
String name = String.valueOf(shareParamsMap.get("platform"));
Platform platform = ShareSDK.getPlatform(name);
if (silent || ShareCore.isUseClientToShare(name) || platform instanceof CustomPlatform) {
HashMap<Platform, HashMap<String, Object>> shareData = new HashMap<Platform, HashMap<String, Object>>();
shareData.put(ShareSDK.getPlatform(name), shareParamsMap);
share(shareData);
return;
}
}
try {
if (OnekeyShareTheme.SKYBLUE == theme) {
platformListFakeActivity = (PlatformListFakeActivity) Class.forName("cn.sharesdk.onekeyshare.theme.skyblue.PlatformListPage").newInstance();
} else {
platformListFakeActivity = (PlatformListFakeActivity) Class.forName("cn.sharesdk.onekeyshare.theme.classic.PlatformListPage").newInstance();
}
} catch (Exception e) {
e.printStackTrace();
return;
}
platformListFakeActivity.setDialogMode(dialogMode);
platformListFakeActivity.setShareParamsMap(shareParamsMap);
this.silent = silent;
platformListFakeActivity.setCustomerLogos(customers);
platformListFakeActivity.setBackgroundView(bgView);
platformListFakeActivity.setHiddenPlatforms(hiddenPlatforms);
this.onShareButtonClickListener = onShareButtonClickListener;
platformListFakeActivity.setThemeShareCallback(new ThemeShareCallback() {
public void doShare(HashMap<Platform, HashMap<String, Object>> shareData) {
share(shareData);
}
});
if (shareParamsMap.containsKey("platform")) {
String name = String.valueOf(shareParamsMap.get("platform"));
Platform platform = ShareSDK.getPlatform(name);
platformListFakeActivity.showEditPage(context, platform);
return;
}
platformListFakeActivity.show(context, null);
}
|
<DeepExtract>
this.silent = silent;
</DeepExtract>
<DeepExtract>
this.onShareButtonClickListener = onShareButtonClickListener;
</DeepExtract>
|
Feeder
|
positive
|
public static void removeCookie(HttpServletResponse response, String name) {
Cookie cookie = new Cookie(name, null);
cookie.setMaxAge(0);
response.addCookie(cookie);
}
|
<DeepExtract>
Cookie cookie = new Cookie(name, null);
cookie.setMaxAge(0);
response.addCookie(cookie);
</DeepExtract>
|
zkfiddle
|
positive
|
public int get(int key) {
if (!records.containsKey(key)) {
return -1;
}
Node node = records.get(key);
node.times++;
NodeList curNodeList = heads.get(node);
curNodeList.deleteNode(node);
NodeList preList = modifyHeadList(curNodeList) ? curNodeList.last : curNodeList;
NodeList nextList = curNodeList.next;
if (nextList == null) {
NodeList newList = new NodeList(node);
if (preList != null) {
preList.next = newList;
}
newList.last = preList;
if (headList == null) {
headList = newList;
}
heads.put(node, newList);
} else {
if (nextList.head.times.equals(node.times)) {
nextList.addNodeFromHead(node);
heads.put(node, nextList);
} else {
NodeList newList = new NodeList(node);
if (preList != null) {
preList.next = newList;
}
newList.last = preList;
newList.next = nextList;
nextList.last = newList;
if (headList == nextList) {
headList = newList;
}
heads.put(node, newList);
}
}
return node.value;
}
|
<DeepExtract>
curNodeList.deleteNode(node);
NodeList preList = modifyHeadList(curNodeList) ? curNodeList.last : curNodeList;
NodeList nextList = curNodeList.next;
if (nextList == null) {
NodeList newList = new NodeList(node);
if (preList != null) {
preList.next = newList;
}
newList.last = preList;
if (headList == null) {
headList = newList;
}
heads.put(node, newList);
} else {
if (nextList.head.times.equals(node.times)) {
nextList.addNodeFromHead(node);
heads.put(node, nextList);
} else {
NodeList newList = new NodeList(node);
if (preList != null) {
preList.next = newList;
}
newList.last = preList;
newList.next = nextList;
nextList.last = newList;
if (headList == nextList) {
headList = newList;
}
heads.put(node, newList);
}
}
</DeepExtract>
|
fanrui-learning
|
positive
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.