before
stringlengths 12
3.76M
| after
stringlengths 37
3.84M
| repo
stringlengths 1
56
| type
stringclasses 1
value |
|---|---|---|---|
@FXML
private void onAddSportType(final ActionEvent event) {
final SportType newSportType = new SportType(null);
newSportType.setSpeedMode(document.getOptions().getPreferredSpeedMode());
prSportTypeDialogController.get().show(getWindow(liSportTypes), newSportType);
final ObservableList<SportType> olSportTypes = FXCollections.observableArrayList();
liSportTypes.getItems().clear();
document.getSportTypeList().forEach(sportType -> olSportTypes.add(sportType));
liSportTypes.setItems(olSportTypes);
}
|
<DeepExtract>
final ObservableList<SportType> olSportTypes = FXCollections.observableArrayList();
liSportTypes.getItems().clear();
document.getSportTypeList().forEach(sportType -> olSportTypes.add(sportType));
liSportTypes.setItems(olSportTypes);
</DeepExtract>
|
sportstracker
|
positive
|
public boolean contains(Object o) {
while (elems[indexFor(o)] != null) {
if (o.equals(elems[indexFor(o)].value))
return true;
;
elems[indexFor(o)] = elems[indexFor(o)].next;
}
return false;
}
|
<DeepExtract>
while (elems[indexFor(o)] != null) {
if (o.equals(elems[indexFor(o)].value))
return true;
;
elems[indexFor(o)] = elems[indexFor(o)].next;
}
return false;
</DeepExtract>
|
monqjfa
|
positive
|
public List<String> sort(final String key) {
return template.execute(new RedisCallback<List<String>>() {
public List<String> doIt(Session session) {
return session.sort(key);
}
});
}
|
<DeepExtract>
return template.execute(new RedisCallback<List<String>>() {
public List<String> doIt(Session session) {
return session.sort(key);
}
});
</DeepExtract>
|
rjc
|
positive
|
void helperSetSubListView(String tableId, String relativePath, String sqlWhereClause, String sqlSelectionArgsJSON, String[] sqlGroupBy, String sqlHaving, String sqlOrderByElementKey, String sqlOrderByDirection) {
if (ViewFragmentType.SUB_LIST != ViewFragmentType.SUB_LIST) {
throw new IllegalArgumentException("Cannot use this method to update a view that doesn't " + "support updates. Currently only DetailWithListView's Sub List supports this action");
}
BindArgs bindArgs = new BindArgs(sqlSelectionArgsJSON);
final Bundle bundle = new Bundle();
IntentUtil.addSQLKeysToBundle(bundle, sqlWhereClause, bindArgs, sqlGroupBy, sqlHaving, sqlOrderByElementKey, sqlOrderByDirection);
IntentUtil.addTableIdToBundle(bundle, tableId);
IntentUtil.addFragmentViewTypeToBundle(bundle, ViewFragmentType.SUB_LIST);
IntentUtil.addFileNameToBundle(bundle, relativePath);
if (mActivity instanceof TableDisplayActivity) {
final TableDisplayActivity activity = (TableDisplayActivity) mActivity;
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
activity.updateFragment(Constants.FragmentTags.DETAIL_WITH_LIST_LIST, bundle);
}
});
} else {
throw new IllegalArgumentException("Cannot update an activity without an updateFragment " + "method");
}
}
|
<DeepExtract>
if (ViewFragmentType.SUB_LIST != ViewFragmentType.SUB_LIST) {
throw new IllegalArgumentException("Cannot use this method to update a view that doesn't " + "support updates. Currently only DetailWithListView's Sub List supports this action");
}
BindArgs bindArgs = new BindArgs(sqlSelectionArgsJSON);
final Bundle bundle = new Bundle();
IntentUtil.addSQLKeysToBundle(bundle, sqlWhereClause, bindArgs, sqlGroupBy, sqlHaving, sqlOrderByElementKey, sqlOrderByDirection);
IntentUtil.addTableIdToBundle(bundle, tableId);
IntentUtil.addFragmentViewTypeToBundle(bundle, ViewFragmentType.SUB_LIST);
IntentUtil.addFileNameToBundle(bundle, relativePath);
if (mActivity instanceof TableDisplayActivity) {
final TableDisplayActivity activity = (TableDisplayActivity) mActivity;
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
activity.updateFragment(Constants.FragmentTags.DETAIL_WITH_LIST_LIST, bundle);
}
});
} else {
throw new IllegalArgumentException("Cannot update an activity without an updateFragment " + "method");
}
</DeepExtract>
|
tables
|
positive
|
@Override
long alignToMegabytes(long a) {
if (a == 0L)
return 0L;
long mask = ~(C6 / C0 - 1L);
if (a > 0L) {
long filled = a + C6 / C0 - 1L;
if (filled > 0L) {
return filled & mask;
} else {
long maxAlignedLong = Long.MAX_VALUE & mask;
if (a <= maxAlignedLong)
return maxAlignedLong;
}
} else {
long filled = a - C6 / C0 + 1L;
if (filled < 0L) {
return filled & mask;
} else {
long minAlignedLong = Long.MIN_VALUE & mask;
if (a >= minAlignedLong)
return minAlignedLong;
}
}
throw new IllegalArgumentException("Couldn't align " + a + " by " + C6 / C0);
}
|
<DeepExtract>
if (a == 0L)
return 0L;
long mask = ~(C6 / C0 - 1L);
if (a > 0L) {
long filled = a + C6 / C0 - 1L;
if (filled > 0L) {
return filled & mask;
} else {
long maxAlignedLong = Long.MAX_VALUE & mask;
if (a <= maxAlignedLong)
return maxAlignedLong;
}
} else {
long filled = a - C6 / C0 + 1L;
if (filled < 0L) {
return filled & mask;
} else {
long minAlignedLong = Long.MIN_VALUE & mask;
if (a >= minAlignedLong)
return minAlignedLong;
}
}
throw new IllegalArgumentException("Couldn't align " + a + " by " + C6 / C0);
</DeepExtract>
|
Chronicle-Algorithms
|
positive
|
public void hideMenu() {
int cX = (mFAB.getLeft() + mFAB.getRight()) / 2;
int cY = (mFAB.getTop() + mFAB.getBottom()) / 2;
SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mContainer, cX, cY, mScreenWidth, 0);
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.setDuration(mDuration);
if (new ToolbarCollapseListener(false) != null) {
animator.addListener(new ToolbarCollapseListener(false));
}
animator.start();
}
|
<DeepExtract>
int cX = (mFAB.getLeft() + mFAB.getRight()) / 2;
int cY = (mFAB.getTop() + mFAB.getBottom()) / 2;
SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mContainer, cX, cY, mScreenWidth, 0);
animator.setInterpolator(new AccelerateDecelerateInterpolator());
animator.setDuration(mDuration);
if (new ToolbarCollapseListener(false) != null) {
animator.addListener(new ToolbarCollapseListener(false));
}
animator.start();
</DeepExtract>
|
AndroidBlog
|
positive
|
public void trainInfo(String[] args) {
HandleParameters params = new HandleParameters(args);
System.out.println("Load .info file from " + params.get("-info"));
docs = new SieveDocuments(params.get("-info"));
props = StringUtils.argsToProperties(args);
if (props != null) {
if (props.containsKey("min"))
_featMinOccurrence = Integer.parseInt(props.getProperty("min"));
if (props.containsKey("edctdet"))
_onlyDCTSaid = true;
if (props.containsKey("etdet"))
_etDeterministic = true;
if (props.containsKey("eedet"))
_eeDeterministic = true;
if (props.containsKey("prob"))
_tlinkProbabilityCutoff = Double.parseDouble(props.getProperty("prob"));
}
featurizer = new TLinkFeaturizer();
trainInfo(docs, null);
}
|
<DeepExtract>
HandleParameters params = new HandleParameters(args);
System.out.println("Load .info file from " + params.get("-info"));
docs = new SieveDocuments(params.get("-info"));
props = StringUtils.argsToProperties(args);
</DeepExtract>
<DeepExtract>
if (props != null) {
if (props.containsKey("min"))
_featMinOccurrence = Integer.parseInt(props.getProperty("min"));
if (props.containsKey("edctdet"))
_onlyDCTSaid = true;
if (props.containsKey("etdet"))
_etDeterministic = true;
if (props.containsKey("eedet"))
_eeDeterministic = true;
if (props.containsKey("prob"))
_tlinkProbabilityCutoff = Double.parseDouble(props.getProperty("prob"));
}
featurizer = new TLinkFeaturizer();
</DeepExtract>
|
caevo
|
positive
|
public Builder addUint64Contents(long value) {
if (!((bitField0_ & 0x00000010) == 0x00000010)) {
uint64Contents_ = new java.util.ArrayList<Long>(uint64Contents_);
bitField0_ |= 0x00000010;
}
uint64Contents_.add(value);
onChanged();
return this;
}
|
<DeepExtract>
if (!((bitField0_ & 0x00000010) == 0x00000010)) {
uint64Contents_ = new java.util.ArrayList<Long>(uint64Contents_);
bitField0_ |= 0x00000010;
}
</DeepExtract>
|
dl_inference
|
positive
|
public void onClick(DialogInterface di, int id) {
mLogger.info("send confirmed");
try {
mLogger.info(String.format("send from %d, to %s, amount %s, fee %s starting", mAcctId, mAddr, mBTCFmt.format(mAmount), mBTCFmt.format(mFee)));
mWalletService.sendCoinsFromAccount(mAcctId, mAddr, mAmount, mFee, spendUnconfirmed());
mLogger.info("send finished");
Intent intent = new Intent(this, ViewTransactionsActivity.class);
Bundle bundle = new Bundle();
bundle.putInt("accountId", mCheckedFromId);
intent.putExtras(bundle);
startActivity(intent);
finish();
} catch (RuntimeException ex) {
mLogger.error(ex.toString());
showErrorDialog(ex.getMessage());
return;
}
}
|
<DeepExtract>
try {
mLogger.info(String.format("send from %d, to %s, amount %s, fee %s starting", mAcctId, mAddr, mBTCFmt.format(mAmount), mBTCFmt.format(mFee)));
mWalletService.sendCoinsFromAccount(mAcctId, mAddr, mAmount, mFee, spendUnconfirmed());
mLogger.info("send finished");
Intent intent = new Intent(this, ViewTransactionsActivity.class);
Bundle bundle = new Bundle();
bundle.putInt("accountId", mCheckedFromId);
intent.putExtras(bundle);
startActivity(intent);
finish();
} catch (RuntimeException ex) {
mLogger.error(ex.toString());
showErrorDialog(ex.getMessage());
return;
}
</DeepExtract>
|
Wallet32
|
positive
|
protected HttpRequest closeOutput() throws IOException {
if (null == null)
progress = UploadProgress.DEFAULT;
else
progress = null;
return this;
if (output == null)
return this;
if (multipart)
output.write(CRLF + "--" + BOUNDARY + "--" + CRLF);
if (ignoreCloseExceptions)
try {
output.close();
} catch (IOException ignored) {
}
else
output.close();
output = null;
return this;
}
|
<DeepExtract>
if (null == null)
progress = UploadProgress.DEFAULT;
else
progress = null;
return this;
</DeepExtract>
|
nanoleaf-aurora
|
positive
|
protected void fetchApiKey() {
String cached = ((Derpibooru) mContext.getApplicationContext()).getApiKey();
if (cached != null) {
mHandler.onQueryExecuted(cached);
} else {
super.executeQuery(new ApiKeyParser());
}
}
|
<DeepExtract>
String cached = ((Derpibooru) mContext.getApplicationContext()).getApiKey();
if (cached != null) {
mHandler.onQueryExecuted(cached);
} else {
super.executeQuery(new ApiKeyParser());
}
</DeepExtract>
|
Derpibooru
|
positive
|
@Override
public void onTransferStatus(BaseFileInfo fileInfo) {
int position = mFileTransferAdapter.getData().indexOf(fileInfo);
mFileTransferAdapter.notifyItemChanged(position);
FileUtils.addFileToMediaStore(getActivity(), new File(fileInfo.getPath()));
mLastFileSize = fileInfo.getLength();
mTotalSize += mLastFileSize;
PersonalSettingUtils.updateSavedNetFlow(mContext, mLastFileSize);
if (fileInfo.getIsLast() == Const.IS_LAST) {
showTransferDataSize();
}
}
|
<DeepExtract>
int position = mFileTransferAdapter.getData().indexOf(fileInfo);
mFileTransferAdapter.notifyItemChanged(position);
</DeepExtract>
|
XMShare
|
positive
|
@Override
public void onForegroundEvent() {
if (mInvocationMethodManager == null) {
Activity activity = mForegroundDetector.getCurrentActivity();
mInvocationMethodManager = new InvocationMethodManager(activity, this);
}
mInvocationMethodManager.start(mInvocationMethod);
}
|
<DeepExtract>
if (mInvocationMethodManager == null) {
Activity activity = mForegroundDetector.getCurrentActivity();
mInvocationMethodManager = new InvocationMethodManager(activity, this);
}
mInvocationMethodManager.start(mInvocationMethod);
</DeepExtract>
|
buglife-android
|
positive
|
public void windowClosing(java.awt.event.WindowEvent e) {
setVisible(false);
}
|
<DeepExtract>
setVisible(false);
</DeepExtract>
|
DuskRPG
|
positive
|
@Override
public Number diff(Number one, Number two) {
if (one == null) {
if (two == null)
return null;
else
return (-two.intValue());
} else {
if (two == null)
return one.longValue();
else
return one.intValue() - two.intValue();
}
}
|
<DeepExtract>
if (one == null) {
if (two == null)
return null;
else
return (-two.intValue());
} else {
if (two == null)
return one.longValue();
else
return one.intValue() - two.intValue();
}
</DeepExtract>
|
hbase-tools
|
positive
|
private TrieNode buildTrie(BinaryComparable[] splits, int lower, int upper, byte[] prefix, int maxDepth) {
final int depth = prefix.length;
if (depth >= maxDepth || lower >= upper - 1) {
if (lower == upper && new CarriedTrieNodeRef().content != null) {
return new CarriedTrieNodeRef().content;
}
TrieNode result = LeafTrieNodeFactory(depth, splits, lower, upper);
new CarriedTrieNodeRef().content = lower == upper ? result : null;
return result;
}
InnerTrieNode result = new InnerTrieNode(depth);
byte[] trial = Arrays.copyOf(prefix, prefix.length + 1);
int currentBound = lower;
for (int ch = 0; ch < 0xFF; ++ch) {
trial[depth] = (byte) (ch + 1);
lower = currentBound;
while (currentBound < upper) {
if (splits[currentBound].compareTo(trial, 0, trial.length) >= 0) {
break;
}
currentBound += 1;
}
trial[depth] = (byte) ch;
result.child[0xFF & ch] = buildTrieRec(splits, lower, currentBound, trial, maxDepth, new CarriedTrieNodeRef());
}
trial[depth] = (byte) 0xFF;
result.child[0xFF] = buildTrieRec(splits, lower, currentBound, trial, maxDepth, new CarriedTrieNodeRef());
return result;
}
|
<DeepExtract>
final int depth = prefix.length;
if (depth >= maxDepth || lower >= upper - 1) {
if (lower == upper && new CarriedTrieNodeRef().content != null) {
return new CarriedTrieNodeRef().content;
}
TrieNode result = LeafTrieNodeFactory(depth, splits, lower, upper);
new CarriedTrieNodeRef().content = lower == upper ? result : null;
return result;
}
InnerTrieNode result = new InnerTrieNode(depth);
byte[] trial = Arrays.copyOf(prefix, prefix.length + 1);
int currentBound = lower;
for (int ch = 0; ch < 0xFF; ++ch) {
trial[depth] = (byte) (ch + 1);
lower = currentBound;
while (currentBound < upper) {
if (splits[currentBound].compareTo(trial, 0, trial.length) >= 0) {
break;
}
currentBound += 1;
}
trial[depth] = (byte) ch;
result.child[0xFF & ch] = buildTrieRec(splits, lower, currentBound, trial, maxDepth, new CarriedTrieNodeRef());
}
trial[depth] = (byte) 0xFF;
result.child[0xFF] = buildTrieRec(splits, lower, currentBound, trial, maxDepth, new CarriedTrieNodeRef());
return result;
</DeepExtract>
|
webarchive-discovery
|
positive
|
public BankAccount find(int id) throws PagarMeException {
final PagarMeRequest request = new PagarMeRequest(HttpMethod.GET, String.format("/%s/%s", getClassName(), id));
final BankAccount other = JSONUtils.getAsObject((JsonObject) request.execute(), BankAccount.class);
super.copy(other);
this.chargeTransferFees = other.chargeTransferFees;
this.bankCode = other.bankCode;
this.agencia = other.agencia;
this.agenciaDv = other.agenciaDv;
this.conta = other.conta;
this.contaDv = other.contaDv;
this.documentNumber = other.documentNumber;
this.legalName = other.legalName;
this.documentType = other.documentType;
this.type = other.type;
flush();
return other;
}
|
<DeepExtract>
super.copy(other);
this.chargeTransferFees = other.chargeTransferFees;
this.bankCode = other.bankCode;
this.agencia = other.agencia;
this.agenciaDv = other.agenciaDv;
this.conta = other.conta;
this.contaDv = other.contaDv;
this.documentNumber = other.documentNumber;
this.legalName = other.legalName;
this.documentType = other.documentType;
this.type = other.type;
</DeepExtract>
|
pagarme-java
|
positive
|
@Override
protected void setUpView() {
mToolbar.setTitle("相册");
setSupportActionBar(mToolbar);
mToolbar.setNavigationOnClickListener(mArrowListener);
if ((Boolean) SPUtil.get(GalleryActivity.this, Constant.NIGHT_MODE, true)) {
mRelativeLayout.setBackgroundColor(getResources().getColor(R.color.gray));
mToolbar.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
mToolbar.setTitleTextColor(getResources().getColor(android.R.color.white));
mToolbar.setNavigationIcon(R.mipmap.arrow_back);
StatusBarUtil.setStatusBarColor(GalleryActivity.this, getResources().getColor(R.color.colorPrimaryDark));
} else {
mRelativeLayout.setBackgroundColor(getResources().getColor(android.R.color.black));
mToolbar.setBackgroundColor(getResources().getColor(android.R.color.black));
mToolbar.setTitleTextColor(getResources().getColor(android.R.color.darker_gray));
mToolbar.setNavigationIcon(R.mipmap.arrow_back_night);
StatusBarUtil.setStatusBarColor(GalleryActivity.this, getResources().getColor(android.R.color.black));
}
}
|
<DeepExtract>
mToolbar.setTitle("相册");
setSupportActionBar(mToolbar);
mToolbar.setNavigationOnClickListener(mArrowListener);
</DeepExtract>
<DeepExtract>
if ((Boolean) SPUtil.get(GalleryActivity.this, Constant.NIGHT_MODE, true)) {
mRelativeLayout.setBackgroundColor(getResources().getColor(R.color.gray));
mToolbar.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
mToolbar.setTitleTextColor(getResources().getColor(android.R.color.white));
mToolbar.setNavigationIcon(R.mipmap.arrow_back);
StatusBarUtil.setStatusBarColor(GalleryActivity.this, getResources().getColor(R.color.colorPrimaryDark));
} else {
mRelativeLayout.setBackgroundColor(getResources().getColor(android.R.color.black));
mToolbar.setBackgroundColor(getResources().getColor(android.R.color.black));
mToolbar.setTitleTextColor(getResources().getColor(android.R.color.darker_gray));
mToolbar.setNavigationIcon(R.mipmap.arrow_back_night);
StatusBarUtil.setStatusBarColor(GalleryActivity.this, getResources().getColor(android.R.color.black));
}
</DeepExtract>
|
EasyMvp
|
positive
|
private int jjMoveStringLiteralDfa5_1(long old0, long active0) {
if (((active0 &= old0)) == 0L)
return jjStartNfa_1(3, old0);
try {
curChar = input_stream.readChar();
} catch (java.io.IOException e) {
jjStopStringLiteralDfa_1(4, active0);
return 5;
}
switch(curChar) {
case 110:
return jjMoveStringLiteralDfa6_1(active0, 0x400000000000L);
default:
break;
}
return jjMoveNfa_1(jjStopStringLiteralDfa_1(4, active0), 4 + 1);
}
|
<DeepExtract>
return jjMoveNfa_1(jjStopStringLiteralDfa_1(4, active0), 4 + 1);
</DeepExtract>
|
el-spec
|
positive
|
@Test
public void shouldReportCorrectCoverageForSpecialisation4() {
final SideEffect2<Integer, boolean[]> se = new SideEffect2<Integer, boolean[]>() {
@Override
public void apply(final Integer classId, final boolean[] probes) {
CodeCoverageStore.visitProbes(classId, 0, probes[0], probes[1], probes[2], probes[3]);
}
};
ascendingPermuation(4, se);
CodeCoverageStore.resetAllStaticState();
descendingPermutation(4, se);
}
|
<DeepExtract>
ascendingPermuation(4, se);
CodeCoverageStore.resetAllStaticState();
descendingPermutation(4, se);
</DeepExtract>
|
QuickTheories
|
positive
|
@Test
public void createGraphTiming() throws Exception {
factory = new SimpleRDF();
graph = factory.createGraph();
final IRI subject = factory.createIRI("subj");
final IRI predicate = factory.createIRI("pred");
final List<IRI> types = new ArrayList<>(Types.values());
types.remove(Types.RDF_LANGSTRING);
Collections.shuffle(types);
for (int i = 0; i < TRIPLES; i++) {
if (i % 11 == 0) {
graph.add(subject, predicate, factory.createBlankNode("Example " + i));
} else if (i % 5 == 0) {
graph.add(subject, predicate, factory.createLiteral("Example " + i, "en"));
} else if (i % 3 == 0) {
graph.add(subject, predicate, factory.createLiteral("Example " + i, types.get(i % types.size())));
} else {
graph.add(subject, predicate, factory.createLiteral("Example " + i));
}
}
}
|
<DeepExtract>
factory = new SimpleRDF();
graph = factory.createGraph();
final IRI subject = factory.createIRI("subj");
final IRI predicate = factory.createIRI("pred");
final List<IRI> types = new ArrayList<>(Types.values());
types.remove(Types.RDF_LANGSTRING);
Collections.shuffle(types);
for (int i = 0; i < TRIPLES; i++) {
if (i % 11 == 0) {
graph.add(subject, predicate, factory.createBlankNode("Example " + i));
} else if (i % 5 == 0) {
graph.add(subject, predicate, factory.createLiteral("Example " + i, "en"));
} else if (i % 3 == 0) {
graph.add(subject, predicate, factory.createLiteral("Example " + i, types.get(i % types.size())));
} else {
graph.add(subject, predicate, factory.createLiteral("Example " + i));
}
}
</DeepExtract>
|
commons-rdf
|
positive
|
@Override
protected Void run() throws Exception {
TaskListener listener = this.getContext().get(TaskListener.class);
AWSElasticBeanstalk client = AWSClientFactory.create(AWSElasticBeanstalkClientBuilder.standard(), this.getContext(), this.getContext().get(EnvVars.class));
listener.getLogger().format("Creating application version (%s) for application (%s) %n", step.versionLabel, step.applicationName);
CreateApplicationVersionRequest request = new CreateApplicationVersionRequest();
request.setApplicationName(step.applicationName);
request.setVersionLabel(step.versionLabel);
request.setSourceBundle(new S3Location(step.s3Bucket, step.s3Key));
this.description = step.description;
CreateApplicationVersionResult result = client.createApplicationVersion(request);
listener.getLogger().format("Created a new version (%s) for the application (%s) with arn (%s) %n", step.versionLabel, step.applicationName, result.getApplicationVersion().getApplicationVersionArn());
return null;
}
|
<DeepExtract>
this.description = step.description;
</DeepExtract>
|
pipeline-aws-plugin
|
positive
|
@Test
public void testOpenWithInactiveVisibleConsoleView() {
partHelper.showView(CONSOLE_VIEW_ID);
partHelper.showView(PartHelper.PROBLEM_VIEW_ID);
new ConsoleViewOpener(activePage).open();
IViewPart consoleView = getConsoleView();
assertThat(consoleView).isNotNull();
assertThat(consoleView.getSite().getPage().getActivePart()).isEqualTo(consoleView);
}
|
<DeepExtract>
IViewPart consoleView = getConsoleView();
assertThat(consoleView).isNotNull();
assertThat(consoleView.getSite().getPage().getActivePart()).isEqualTo(consoleView);
</DeepExtract>
|
gonsole
|
positive
|
private void setNewPatientId(Element root, Integer patientId) {
try {
NodeList elemList = root.getElementsByTagName(XformBuilder.NODE_PATIENT_PATIENT_ID);
if (!(elemList != null && elemList.getLength() > 0))
return;
elemList.item(0).setTextContent(patientId.toString());
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
|
<DeepExtract>
try {
NodeList elemList = root.getElementsByTagName(XformBuilder.NODE_PATIENT_PATIENT_ID);
if (!(elemList != null && elemList.getLength() > 0))
return;
elemList.item(0).setTextContent(patientId.toString());
} catch (Exception e) {
log.error(e.getMessage(), e);
}
</DeepExtract>
|
buendia
|
positive
|
protected int getMoveTypeDuration() {
return duration;
}
|
<DeepExtract>
return duration;
</DeepExtract>
|
Et-Futurum
|
positive
|
public DynamicByteBuffer put(byte v) {
if (autoExpand) {
expand(1);
}
_buf.put(v);
return this;
}
|
<DeepExtract>
if (autoExpand) {
expand(1);
}
</DeepExtract>
|
netx
|
positive
|
static void dataSetAssertion(CallInfo callInfo, DataSet expected, DataSet actual) {
if (expected == null) {
throw new InvalidOperationException("Null argument for 'old' data set.");
}
if (actual == null) {
throw new InvalidOperationException("Null argument for 'new' data set.");
}
if (expected.getSource() != actual.getSource()) {
throw new InvalidOperationException("Data source mismatch between data sets.");
}
DataSource source = expected.getSource();
Delta delta = new Delta(expected, actual);
DataSetAssertion assertion = new DataSetAssertion(expected, delta);
source.getDB().log(callInfo, assertion);
if (!assertion.passed()) {
throw new DBAssertionError(callInfo.getMessage());
}
}
|
<DeepExtract>
if (expected == null) {
throw new InvalidOperationException("Null argument for 'old' data set.");
}
if (actual == null) {
throw new InvalidOperationException("Null argument for 'new' data set.");
}
if (expected.getSource() != actual.getSource()) {
throw new InvalidOperationException("Data source mismatch between data sets.");
}
</DeepExtract>
|
jdbdt
|
positive
|
public static String format(final String msg, final Object... params) {
Assertion.check().isNotNull(msg);
if (params == null || params.length == 0) {
return msg;
}
final StringBuilder newMsg = new StringBuilder(msg);
Assertion.check().isNotNull(newMsg);
final StringBuilder result = new StringBuilder(newMsg);
replace(result, "''", "'");
return result.toString();
Assertion.check().isNotNull(newMsg);
final StringBuilder result = new StringBuilder(newMsg);
replace(result, "'", "''");
return result.toString();
Assertion.check().isNotNull(newMsg);
final StringBuilder result = new StringBuilder(newMsg);
replace(result, "\\{", "'{'");
return result.toString();
Assertion.check().isNotNull(newMsg);
final StringBuilder result = new StringBuilder(newMsg);
replace(result, "\\}", "'}'");
return result.toString();
return MessageFormat.format(newMsg.toString(), params);
}
|
<DeepExtract>
Assertion.check().isNotNull(newMsg);
final StringBuilder result = new StringBuilder(newMsg);
replace(result, "''", "'");
return result.toString();
</DeepExtract>
<DeepExtract>
Assertion.check().isNotNull(newMsg);
final StringBuilder result = new StringBuilder(newMsg);
replace(result, "'", "''");
return result.toString();
</DeepExtract>
<DeepExtract>
Assertion.check().isNotNull(newMsg);
final StringBuilder result = new StringBuilder(newMsg);
replace(result, "\\{", "'{'");
return result.toString();
</DeepExtract>
<DeepExtract>
Assertion.check().isNotNull(newMsg);
final StringBuilder result = new StringBuilder(newMsg);
replace(result, "\\}", "'}'");
return result.toString();
</DeepExtract>
|
vertigo
|
positive
|
public final Element getFirst() {
return path.get(0);
}
|
<DeepExtract>
return path.get(0);
</DeepExtract>
|
trugger
|
positive
|
@Test
void shouldNotTriggerNotificationOnTaintVulnerabilityRaisedEventWhenConnectionDoesNotExist() {
mockFileInAFolder();
var projectBindingWrapperMock = mock(ProjectBindingWrapper.class);
var projectBinding = mock(ProjectBinding.class);
when(projectBinding.projectKey()).thenReturn(PROJECT_KEY);
when(projectBindingWrapperMock.getBinding()).thenReturn(projectBinding);
folderBindingCache.put(workspaceFolderPath.toUri(), Optional.of(projectBindingWrapperMock));
when(projectBindingWrapperMock.getEngine()).thenReturn(fakeEngine);
when(projectBinding.serverPathToIdePath(fileInAWorkspaceFolderPath.toUri().toString())).thenReturn(Optional.of(fileInAWorkspaceFolderPath.toString()));
when(projectBindingWrapperMock.getConnectionId()).thenReturn(CONNECTION_ID);
List<ServerTaintIssue> issuesList = new ArrayList<>();
ServerTaintIssue newIssue = new ServerTaintIssue(ISSUE_KEY2, false, RULE_KEY, MAIN_LOCATION.getMessage(), fileInAWorkspaceFolderPath.toUri().toString(), CREATION_DATE, ISSUE_SEVERITY, RULE_TYPE, textRangeWithHashFromTextRange(MAIN_LOCATION.getTextRange()), null);
issuesList.add(newIssue);
when(fakeEngine.getServerTaintIssues(any(ProjectBinding.class), eq(CURRENT_BRANCH_NAME), eq(FILE_PHP))).thenReturn(issuesList);
when(settingsManager.getCurrentSettings()).thenReturn(newWorkspaceSettingsWithServers(Collections.emptyMap()));
when(workspaceFoldersManager.findFolderForFile(any(URI.class))).thenReturn(Optional.of(new WorkspaceFolderWrapper(workspaceFolderPath.toUri(), new WorkspaceFolder(workspaceFolderPath.toString()))));
TaintVulnerabilityRaisedEvent fakeEvent = new TaintVulnerabilityRaisedEvent(ISSUE_KEY2, PROJECT_KEY, CURRENT_BRANCH_NAME, CREATION_DATE, RULE_KEY, ISSUE_SEVERITY, RULE_TYPE, MAIN_LOCATION, FLOWS, null);
underTest.handleEvents(fakeEvent);
verify(taintVulnerabilityRaisedNotification, never()).showTaintVulnerabilityNotification(fakeEvent, CONNECTION_ID, false);
}
|
<DeepExtract>
mockFileInAFolder();
var projectBindingWrapperMock = mock(ProjectBindingWrapper.class);
var projectBinding = mock(ProjectBinding.class);
when(projectBinding.projectKey()).thenReturn(PROJECT_KEY);
when(projectBindingWrapperMock.getBinding()).thenReturn(projectBinding);
folderBindingCache.put(workspaceFolderPath.toUri(), Optional.of(projectBindingWrapperMock));
when(projectBindingWrapperMock.getEngine()).thenReturn(fakeEngine);
when(projectBinding.serverPathToIdePath(fileInAWorkspaceFolderPath.toUri().toString())).thenReturn(Optional.of(fileInAWorkspaceFolderPath.toString()));
when(projectBindingWrapperMock.getConnectionId()).thenReturn(CONNECTION_ID);
</DeepExtract>
|
sonarlint-language-server
|
positive
|
public void setImageBitmap(Bitmap bitmap, ExifInterface exif) {
int degreesRotated = 0;
if (bitmap != null && exif != null) {
BitmapUtils.RotateBitmapResult result = BitmapUtils.rotateBitmapByExif(bitmap, exif);
setBitmap = result.bitmap;
degreesRotated = result.degrees;
mInitialDegreesRotated = result.degrees;
} else {
setBitmap = bitmap;
}
mCropOverlayView.setInitialCropWindowRect(null);
if (mBitmap == null || !mBitmap.equals(setBitmap)) {
mImageView.clearAnimation();
clearImageInt();
mBitmap = setBitmap;
mImageView.setImageBitmap(mBitmap);
mLoadedImageUri = null;
mImageResource = 0;
mLoadedSampleSize = 1;
mDegreesRotated = degreesRotated;
applyImageMatrix(getWidth(), getHeight(), true, false);
if (mCropOverlayView != null) {
mCropOverlayView.resetCropOverlayView();
setCropOverlayVisibility();
}
}
}
|
<DeepExtract>
if (mBitmap == null || !mBitmap.equals(setBitmap)) {
mImageView.clearAnimation();
clearImageInt();
mBitmap = setBitmap;
mImageView.setImageBitmap(mBitmap);
mLoadedImageUri = null;
mImageResource = 0;
mLoadedSampleSize = 1;
mDegreesRotated = degreesRotated;
applyImageMatrix(getWidth(), getHeight(), true, false);
if (mCropOverlayView != null) {
mCropOverlayView.resetCropOverlayView();
setCropOverlayVisibility();
}
}
</DeepExtract>
|
Whatsapp-Like-PhotoEditor
|
positive
|
@Override
public int getLength() {
if (length == UNDEFINED_LENGTH_OR_OFFSET_OR_ADDRESS) {
this.length = HEADER.getDataLength(getMetadataAddress()) + OFF_HEAP_HEADER_SIZE;
}
return length - OFF_HEAP_HEADER_SIZE;
}
|
<DeepExtract>
if (length == UNDEFINED_LENGTH_OR_OFFSET_OR_ADDRESS) {
this.length = HEADER.getDataLength(getMetadataAddress()) + OFF_HEAP_HEADER_SIZE;
}
</DeepExtract>
|
Oak
|
positive
|
protected Object convert(Settings settings, Object value) throws SettingException {
int ln = (List) super.convert(settings, value).size();
List res = new ArrayList(ln);
for (int i = 0; i < ln; i++) {
Object o = (List) super.convert(settings, value).get(i);
if (o instanceof String) {
File f = new File((String) o);
if (f.isAbsolute()) {
res.add(new FileWithSettingValue((String) o, (String) o));
} else {
res.add(new FileWithSettingValue(settings.baseDir, (String) o, (String) o));
}
} else if (o instanceof FileWithSettingValue) {
res.add(o);
} else {
throw new SettingException("All list items must be strings (paths), " + "but the item at index " + i + " is a " + typeName(o) + ".");
}
}
return res;
}
|
<DeepExtract>
int ln = (List) super.convert(settings, value).size();
List res = new ArrayList(ln);
for (int i = 0; i < ln; i++) {
Object o = (List) super.convert(settings, value).get(i);
if (o instanceof String) {
File f = new File((String) o);
if (f.isAbsolute()) {
res.add(new FileWithSettingValue((String) o, (String) o));
} else {
res.add(new FileWithSettingValue(settings.baseDir, (String) o, (String) o));
}
} else if (o instanceof FileWithSettingValue) {
res.add(o);
} else {
throw new SettingException("All list items must be strings (paths), " + "but the item at index " + i + " is a " + typeName(o) + ".");
}
}
return res;
</DeepExtract>
|
fmpp
|
positive
|
public static InvocationMatcher anyListOf(final Class<?> clazz) {
return any(new MatchFunction() {
@Override
public boolean check(Object value) {
return value != null && List.class.isAssignableFrom(value.getClass()) && allElementsHasType((Collection<?>) value, clazz);
}
});
}
|
<DeepExtract>
return any(new MatchFunction() {
@Override
public boolean check(Object value) {
return value != null && List.class.isAssignableFrom(value.getClass()) && allElementsHasType((Collection<?>) value, clazz);
}
});
</DeepExtract>
|
testable-mock
|
positive
|
public void appendText(String t) {
textArea.setText(trimConsoleText((textArea.getText().isEmpty() ? "" : textArea.getText() + "\r\n") + t));
textArea.setCaretPosition(0);
}
|
<DeepExtract>
textArea.setText(trimConsoleText((textArea.getText().isEmpty() ? "" : textArea.getText() + "\r\n") + t));
textArea.setCaretPosition(0);
</DeepExtract>
|
bytecode-viewer
|
positive
|
@Override
public void onNext(Workflow workflow) {
getMvpView().showWorkflowDetail(workflow);
checkViewAttached();
getMvpView().showProgressbar(true);
compositeDisposable.add(mDataManager.getUserDetail(workflow.getUploader().getId(), getUserQueryOptions()).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()).subscribeWith(new DisposableObserver<User>() {
@Override
public void onNext(User user) {
getMvpView().setImage(user);
}
@Override
public void onError(Throwable e) {
getMvpView().showProgressbar(false);
getMvpView().showErrorSnackBar("Something went wrong please try after " + "sometime");
}
@Override
public void onComplete() {
getMvpView().showProgressbar(false);
}
}));
checkViewAttached();
compositeDisposable.add(mDataManager.getFavoriteWorkflow(workflow.getId()).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()).subscribeWith(new DisposableObserver<Boolean>() {
@Override
public void onNext(Boolean favoriteStatus) {
getMvpView().getFavouriteIcon(favoriteStatus);
}
@Override
public void onError(Throwable e) {
getMvpView().showErrorSnackBar("Something went wrong please try after " + "sometime");
}
@Override
public void onComplete() {
}
}));
}
|
<DeepExtract>
checkViewAttached();
getMvpView().showProgressbar(true);
compositeDisposable.add(mDataManager.getUserDetail(workflow.getUploader().getId(), getUserQueryOptions()).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()).subscribeWith(new DisposableObserver<User>() {
@Override
public void onNext(User user) {
getMvpView().setImage(user);
}
@Override
public void onError(Throwable e) {
getMvpView().showProgressbar(false);
getMvpView().showErrorSnackBar("Something went wrong please try after " + "sometime");
}
@Override
public void onComplete() {
getMvpView().showProgressbar(false);
}
}));
</DeepExtract>
<DeepExtract>
checkViewAttached();
compositeDisposable.add(mDataManager.getFavoriteWorkflow(workflow.getId()).observeOn(AndroidSchedulers.mainThread()).subscribeOn(Schedulers.io()).subscribeWith(new DisposableObserver<Boolean>() {
@Override
public void onNext(Boolean favoriteStatus) {
getMvpView().getFavouriteIcon(favoriteStatus);
}
@Override
public void onError(Throwable e) {
getMvpView().showErrorSnackBar("Something went wrong please try after " + "sometime");
}
@Override
public void onComplete() {
}
}));
</DeepExtract>
|
incubator-taverna-mobile
|
positive
|
@Test
public void testGetRevisions_XmlFile() {
SortedMap<String, HistoryDescr> result = sutWithUserAndNoDuplicateHistory.getRevisions(test1Config);
assertEquals(5, result.size());
assertEquals("2012-11-21_11-29-12", result.firstKey());
assertEquals("2012-11-21_11-42-05", result.lastKey());
final HistoryDescr firstValue = result.get(result.firstKey());
final HistoryDescr lastValue = result.get(result.lastKey());
assertEquals("Created", firstValue.getOperation());
assertEquals("anonymous", firstValue.getUserID());
assertEquals("Changed", lastValue.getOperation());
}
|
<DeepExtract>
assertEquals(5, result.size());
assertEquals("2012-11-21_11-29-12", result.firstKey());
assertEquals("2012-11-21_11-42-05", result.lastKey());
final HistoryDescr firstValue = result.get(result.firstKey());
final HistoryDescr lastValue = result.get(result.lastKey());
assertEquals("Created", firstValue.getOperation());
assertEquals("anonymous", firstValue.getUserID());
assertEquals("Changed", lastValue.getOperation());
</DeepExtract>
|
jobConfigHistory-plugin
|
positive
|
public Criteria andProductIdGreaterThanOrEqualTo(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "productId" + " cannot be null");
}
criteria.add(new Criterion("product_id >=", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "productId" + " cannot be null");
}
criteria.add(new Criterion("product_id >=", value));
</DeepExtract>
|
sihai-maven-ssm-alipay
|
positive
|
public static void decorateDialog(Window dialog) {
try {
dialog.setAlwaysOnTop(true);
} catch (SecurityException e) {
}
dialog.pack();
if (dialog instanceof JDialog) {
((JDialog) dialog).setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
}
dialog.toFront();
List<Image> icons = getApplicationIcons();
if (icons.size() != 0) {
dialog.setIconImages(icons);
}
}
|
<DeepExtract>
List<Image> icons = getApplicationIcons();
if (icons.size() != 0) {
dialog.setIconImages(icons);
}
</DeepExtract>
|
TightVNC
|
positive
|
public Object getDao(Class<?> clazz, String dataSourceName, RSConnection conn) {
try {
Constructor<?> cons = clazz.getDeclaredConstructor((Class[]) null);
obj = cons.newInstance();
Method init = clazz.getMethod("init", new Class[] { RSConnection.class, PageHelper.class, String.class });
init.invoke(obj, new Object[] { conn, conn.getPageHelper(), dataSourceName });
} catch (Exception e) {
throw new RuntimeException(e);
}
return Proxy.newProxyInstance(obj.getClass().getClassLoader(), obj.getClass().getInterfaces(), this);
}
|
<DeepExtract>
return Proxy.newProxyInstance(obj.getClass().getClassLoader(), obj.getClass().getInterfaces(), this);
</DeepExtract>
|
roubsite
|
positive
|
private void matchStartAndEnd(@NonNull TransitionValuesMaps startValues, @NonNull TransitionValuesMaps endValues) {
ArrayMap<View, TransitionValues> unmatchedStart = new ArrayMap<View, TransitionValues>(startValues.viewValues);
ArrayMap<View, TransitionValues> unmatchedEnd = new ArrayMap<View, TransitionValues>(endValues.viewValues);
for (int i = 0; i < mMatchOrder.length; i++) {
switch(mMatchOrder[i]) {
case MATCH_INSTANCE:
matchInstances(unmatchedStart, unmatchedEnd);
break;
case MATCH_NAME:
matchNames(unmatchedStart, unmatchedEnd, startValues.nameValues, endValues.nameValues);
break;
case MATCH_ID:
matchIds(unmatchedStart, unmatchedEnd, startValues.idValues, endValues.idValues);
break;
case MATCH_ITEM_ID:
matchItemIds(unmatchedStart, unmatchedEnd, startValues.itemIdValues, endValues.itemIdValues);
break;
}
}
for (int i = 0; i < unmatchedStart.size(); i++) {
mStartValuesList.add(unmatchedStart.valueAt(i));
mEndValuesList.add(null);
}
for (int i = 0; i < unmatchedEnd.size(); i++) {
mEndValuesList.add(unmatchedEnd.valueAt(i));
mStartValuesList.add(null);
}
}
|
<DeepExtract>
for (int i = 0; i < unmatchedStart.size(); i++) {
mStartValuesList.add(unmatchedStart.valueAt(i));
mEndValuesList.add(null);
}
for (int i = 0; i < unmatchedEnd.size(); i++) {
mEndValuesList.add(unmatchedEnd.valueAt(i));
mStartValuesList.add(null);
}
</DeepExtract>
|
Transitions-Everywhere
|
positive
|
public boolean pmFastequals(Object other) {
if (this == other)
return true;
if (other == null)
return false;
if (this.getClass() != other.getClass())
return false;
final Bean other = (Bean) other;
if (this.i != other.i)
return false;
if (this.integer == null) {
if (other.integer != null)
return false;
} else if (!this.integer.equals(other.integer))
return false;
if (!Arrays.equals(this.ints, other.ints))
return false;
if (this.string == null) {
if (other.string != null)
return false;
} else if (!this.string.equals(other.string))
return false;
if (this.strings == null) {
if (other.strings != null)
return false;
} else if (!this.strings.equals(other.strings))
return false;
return true;
}
|
<DeepExtract>
if (this == other)
return true;
if (other == null)
return false;
if (this.getClass() != other.getClass())
return false;
final Bean other = (Bean) other;
if (this.i != other.i)
return false;
if (this.integer == null) {
if (other.integer != null)
return false;
} else if (!this.integer.equals(other.integer))
return false;
if (!Arrays.equals(this.ints, other.ints))
return false;
if (this.string == null) {
if (other.string != null)
return false;
} else if (!this.string.equals(other.string))
return false;
if (this.strings == null) {
if (other.strings != null)
return false;
} else if (!this.strings.equals(other.strings))
return false;
return true;
</DeepExtract>
|
pojomatic
|
positive
|
@java.lang.Override
public Builder newBuilderForType() {
return DEFAULT_INSTANCE.toBuilder();
}
|
<DeepExtract>
return DEFAULT_INSTANCE.toBuilder();
</DeepExtract>
|
FightingICE
|
positive
|
@Test
void svgWithDottedLines() {
Bill bill = SampleData.getExample1();
bill.getFormat().setOutputSize(OutputSize.A4_PORTRAIT_SHEET);
bill.getFormat().setSeparatorType(SeparatorType.DOTTED_LINE_WITH_SCISSORS);
bill.getFormat().setGraphicsFormat(GraphicsFormat.SVG);
byte[] imageData = QRBill.generate(bill);
if (GraphicsFormat.SVG == GraphicsFormat.PNG)
FileComparison.assertGrayscaleImageContentsEqual(imageData, "linestyle_2.svg", 35000);
else
FileComparison.assertFileContentsEqual(imageData, "linestyle_2.svg");
}
|
<DeepExtract>
bill.getFormat().setOutputSize(OutputSize.A4_PORTRAIT_SHEET);
bill.getFormat().setSeparatorType(SeparatorType.DOTTED_LINE_WITH_SCISSORS);
bill.getFormat().setGraphicsFormat(GraphicsFormat.SVG);
byte[] imageData = QRBill.generate(bill);
if (GraphicsFormat.SVG == GraphicsFormat.PNG)
FileComparison.assertGrayscaleImageContentsEqual(imageData, "linestyle_2.svg", 35000);
else
FileComparison.assertFileContentsEqual(imageData, "linestyle_2.svg");
</DeepExtract>
|
SwissQRBill
|
positive
|
PerformanceReport parse(File reportFile) throws Exception {
boolean isXml;
try (FileReader fr = new FileReader(reportFile);
BufferedReader reader = new BufferedReader(fr)) {
String line;
boolean isXml = false;
while ((line = reader.readLine()) != null) {
if (line.trim().length() == 0) {
continue;
}
if (line.toLowerCase().trim().startsWith("<?xml ")) {
isXml = true;
}
break;
}
isXml = isXml;
}
if (isXml) {
return parseXml(reportFile);
} else {
return parseCsv(reportFile);
}
}
|
<DeepExtract>
boolean isXml;
try (FileReader fr = new FileReader(reportFile);
BufferedReader reader = new BufferedReader(fr)) {
String line;
boolean isXml = false;
while ((line = reader.readLine()) != null) {
if (line.trim().length() == 0) {
continue;
}
if (line.toLowerCase().trim().startsWith("<?xml ")) {
isXml = true;
}
break;
}
isXml = isXml;
}
</DeepExtract>
|
performance-plugin
|
positive
|
public final void close() {
if (!open)
return;
open = false;
if (true && !inventory.getViewers().isEmpty())
player.closeInventory();
HandlerList.unregisterAll(listener);
}
|
<DeepExtract>
if (!open)
return;
open = false;
if (true && !inventory.getViewers().isEmpty())
player.closeInventory();
HandlerList.unregisterAll(listener);
</DeepExtract>
|
tree-feller
|
positive
|
public boolean add(final K k) {
if (wrapped)
a = ObjectArrays.grow(a, size + 1, size);
else {
if (size + 1 > a.length) {
final int newLength = (int) Math.max(Math.min(2L * a.length, Arrays.MAX_ARRAY_SIZE), size + 1);
final Object[] t = new Object[newLength];
System.arraycopy(a, 0, t, 0, size);
a = (K[]) t;
}
}
if (ASSERTS)
assert size <= a.length;
a[size++] = k;
if (ASSERTS)
assert size <= a.length;
return true;
}
|
<DeepExtract>
if (wrapped)
a = ObjectArrays.grow(a, size + 1, size);
else {
if (size + 1 > a.length) {
final int newLength = (int) Math.max(Math.min(2L * a.length, Arrays.MAX_ARRAY_SIZE), size + 1);
final Object[] t = new Object[newLength];
System.arraycopy(a, 0, t, 0, size);
a = (K[]) t;
}
}
if (ASSERTS)
assert size <= a.length;
</DeepExtract>
|
jhighlight
|
positive
|
public Criteria andOrderNoBetween(String value1, String value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "orderNo" + " cannot be null");
}
criteria.add(new Criterion("order_no between", value1, value2));
return (Criteria) this;
}
|
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "orderNo" + " cannot be null");
}
criteria.add(new Criterion("order_no between", value1, value2));
</DeepExtract>
|
hotel_ssm
|
positive
|
public static PImage blur(PImage img, int radius, int iterations) {
PImage out = new PImage(img.width, img.height);
out.loadPixels();
out.pixels = blur(img.pixels, img.width, img.height, radius, iterations);
out.updatePixels();
return out;
}
|
<DeepExtract>
PImage out = new PImage(img.width, img.height);
out.loadPixels();
out.pixels = blur(img.pixels, img.width, img.height, radius, iterations);
out.updatePixels();
return out;
</DeepExtract>
|
Project-16x16
|
positive
|
public void commit() throws SQLException {
if (isClosed())
throw new SQLNonTransientConnectionException(WAS_CLOSED_CON);
throw new SQLFeatureNotSupportedException(ALWAYS_AUTOCOMMIT);
}
|
<DeepExtract>
if (isClosed())
throw new SQLNonTransientConnectionException(WAS_CLOSED_CON);
</DeepExtract>
|
twig
|
positive
|
@Override
public void onReceive(Context context, Intent intent) {
if (DEBUG) {
Log.d(TAG, "testBroadcast(): onReceive(Context context, Intent intent): context=" + context.toString() + "; intent=" + intent.toString());
}
Toast.makeText(this, "testBroadcast(): onReceive(Context context, Intent intent): context=" + context.toString() + "; intent=" + intent.toString(), Toast.LENGTH_SHORT).show();
unregisterReceiver(this);
}
|
<DeepExtract>
Toast.makeText(this, "testBroadcast(): onReceive(Context context, Intent intent): context=" + context.toString() + "; intent=" + intent.toString(), Toast.LENGTH_SHORT).show();
</DeepExtract>
|
GPT
|
positive
|
public void increaseMana(int mana) {
this.mana = this.getMana() + mana;
if (this.getMana() + mana > getMaxMana())
this.mana = getMaxMana();
else if (this.getMana() + mana < 0)
this.mana = 0;
if (this.mana > this.maxMana)
this.mana = this.maxMana;
}
|
<DeepExtract>
this.mana = this.getMana() + mana;
if (this.getMana() + mana > getMaxMana())
this.mana = getMaxMana();
else if (this.getMana() + mana < 0)
this.mana = 0;
</DeepExtract>
|
Loot-Slash-Conquer-Pre1.14
|
positive
|
public static void main(String[] args) {
out.println("Test");
out.println(17);
out.println(true);
out.printf(LOCALE, "%.6f\n", 1.0 / 7.0);
out.flush();
}
|
<DeepExtract>
out.println("Test");
</DeepExtract>
<DeepExtract>
out.println(17);
</DeepExtract>
<DeepExtract>
out.println(true);
</DeepExtract>
<DeepExtract>
out.printf(LOCALE, "%.6f\n", 1.0 / 7.0);
out.flush();
</DeepExtract>
|
javacs
|
positive
|
@Test(groups = "fast")
public void testSendValidPayload() {
Mockito.when(filterRequestHandler.processEvent(Mockito.<Event>any(), Mockito.<ParsedRequest>any())).thenReturn(true);
eventDeserializer.setEvent(Mockito.mock(Event.class));
try {
Mockito.when(deserializerFactory.getEventDeserializer(Mockito.<ParsedRequest>any())).thenReturn(eventDeserializer);
} catch (IOException e) {
Assert.fail();
}
final EventDeserializerRequestHandler enabledRequestHandler = new EventDeserializerRequestHandler(true, filterRequestHandler, deserializerFactory);
resource = setupResource(enabledRequestHandler);
Assert.assertEquals(enabledRequestHandler.getRejectedMeter().count(), 0);
Assert.assertEquals(enabledRequestHandler.getBadRequestMeter().count(), 0);
verifyNoEventWentThroughTheFilterRequestHandler(enabledRequestHandler);
final Response response = callEndpoint();
Assert.assertEquals(enabledRequestHandler.getRejectedMeter().count(), 0);
Assert.assertEquals(enabledRequestHandler.getBadRequestMeter().count(), 0);
final MetricName successMetricName = enabledRequestHandler.getSuccessMetricsKey(deserializationType);
for (final MetricName name : enabledRequestHandler.getMetrics().keySet()) {
if (name.equals(successMetricName)) {
Assert.assertEquals(enabledRequestHandler.getMetrics().get(name).count(), 1);
} else {
Assert.assertEquals(enabledRequestHandler.getMetrics().get(name).count(), 0);
}
}
Assert.assertEquals(response.getStatus(), Response.Status.ACCEPTED.getStatusCode());
if (false) {
Assert.assertEquals(response.getMetadata().get("Warning").size(), 1);
Assert.assertTrue(StringUtils.contains(((String) response.getMetadata().get("Warning").get(0)), "199"));
} else {
Assert.assertNull(response.getMetadata().get("Warning"));
}
verifyCacheControl(response);
Mockito.verify(httpHeaders, Mockito.times(5)).getRequestHeader(Mockito.<String>any());
Mockito.verify(request, Mockito.times(1)).getRemoteAddr();
try {
Mockito.verify(deserializerFactory, Mockito.times(1)).getEventDeserializer(Mockito.<ParsedRequest>any());
} catch (IOException e) {
Assert.fail();
}
Mockito.verify(filterRequestHandler, Mockito.times(1)).processEvent(Mockito.<Event>any(), Mockito.<ParsedRequest>any());
Mockito.verifyNoMoreInteractions(httpHeaders, request, deserializerFactory, filterRequestHandler);
}
|
<DeepExtract>
Mockito.when(filterRequestHandler.processEvent(Mockito.<Event>any(), Mockito.<ParsedRequest>any())).thenReturn(true);
</DeepExtract>
<DeepExtract>
eventDeserializer.setEvent(Mockito.mock(Event.class));
try {
Mockito.when(deserializerFactory.getEventDeserializer(Mockito.<ParsedRequest>any())).thenReturn(eventDeserializer);
} catch (IOException e) {
Assert.fail();
}
</DeepExtract>
<DeepExtract>
Assert.assertEquals(enabledRequestHandler.getRejectedMeter().count(), 0);
Assert.assertEquals(enabledRequestHandler.getBadRequestMeter().count(), 0);
verifyNoEventWentThroughTheFilterRequestHandler(enabledRequestHandler);
</DeepExtract>
<DeepExtract>
Assert.assertEquals(response.getStatus(), Response.Status.ACCEPTED.getStatusCode());
if (false) {
Assert.assertEquals(response.getMetadata().get("Warning").size(), 1);
Assert.assertTrue(StringUtils.contains(((String) response.getMetadata().get("Warning").get(0)), "199"));
} else {
Assert.assertNull(response.getMetadata().get("Warning"));
}
verifyCacheControl(response);
</DeepExtract>
|
collector
|
positive
|
public static int hash(Object... values) {
return (values == null) ? 0 : values.hashCode();
}
|
<DeepExtract>
return (values == null) ? 0 : values.hashCode();
</DeepExtract>
|
android-databinding
|
positive
|
@Override
public void onErrorResponse(VolleyError volleyError) {
if (ingreso == 0) {
cargarWebService(getString(R.string.ip2));
ingreso = 1;
} else {
if (ingreso == 1) {
cargarWebService(getString(R.string.ip3));
ingreso = 2;
} else {
txtInfo.setText("No se pudo establecer conexión con el servidor, Intente mas tarde");
obtenerListaProyectos();
}
}
}
|
<DeepExtract>
if (ingreso == 0) {
cargarWebService(getString(R.string.ip2));
ingreso = 1;
} else {
if (ingreso == 1) {
cargarWebService(getString(R.string.ip3));
ingreso = 2;
} else {
txtInfo.setText("No se pudo establecer conexión con el servidor, Intente mas tarde");
obtenerListaProyectos();
}
}
</DeepExtract>
|
curso-android-codejavu
|
positive
|
@Test
@Ignore
public void testRequestWhen() {
Double in = new Double(36);
ACLMessageFactory factory = new ACLMessageFactory(Encodings.XML);
Map<String, Object> args = new LinkedHashMap<String, Object>();
args.put("x", in);
Rule condition = new Rule();
condition.setDrl("String( this == \"actionTrigger\" || this == \"actionTrigger2\")");
Action action = MessageContentFactory.newActionContent("squareRoot", args);
ACLMessage req = factory.newRequestWhenMessage("me", "you", action, condition);
mainAgent.tell(req);
ACLMessage info = factory.newInformMessage("me", "you", new String("actionTrigger"));
mainAgent.tell(info);
ACLMessage info2 = factory.newInformMessage("me", "you", new String("actionTrigger2"));
mainAgent.tell(info2);
int counter = 0;
do {
System.out.println("Answer for " + req.getId() + " is not ready, wait... ");
try {
Thread.sleep(1000);
counter++;
} catch (InterruptedException e) {
e.printStackTrace();
}
} while (mainAgent.peekAgentAnswers(req.getId()).size() < 2 && counter < 50);
if (counter == 50) {
fail("Timeout waiting for an answer to msg " + req.getId());
}
StatefulKnowledgeSession s2 = mainAgent.getInnerSession("session2");
QueryResults ans = s2.getQueryResults("squareRoot", in, Variable.v);
assertEquals(1, ans.size());
assertEquals(6.0, (Double) ans.iterator().next().get("$return"), 1e-6);
}
|
<DeepExtract>
int counter = 0;
do {
System.out.println("Answer for " + req.getId() + " is not ready, wait... ");
try {
Thread.sleep(1000);
counter++;
} catch (InterruptedException e) {
e.printStackTrace();
}
} while (mainAgent.peekAgentAnswers(req.getId()).size() < 2 && counter < 50);
if (counter == 50) {
fail("Timeout waiting for an answer to msg " + req.getId());
}
</DeepExtract>
|
drools-mas
|
positive
|
private void createDot(float rx, float ry) {
Snapshot dot = new Snapshot(false);
mBitmapToLoad = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_picsphere_marker);
Quaternion quat = new Quaternion();
quat.fromEuler(rx, 0, ry);
float[] matrix = quat.getMatrix();
Matrix.translateM(matrix, 0, 0, 0, 100);
return matrix;
Matrix.scaleM(dot.mModelMatrix, 0, 0.1f, 0.1f, 0.1f);
mAutoAlphaX = rx;
mAutoAlphaY = ry;
mDots.add(dot);
}
|
<DeepExtract>
mBitmapToLoad = BitmapFactory.decodeResource(mContext.getResources(), R.drawable.ic_picsphere_marker);
</DeepExtract>
<DeepExtract>
Quaternion quat = new Quaternion();
quat.fromEuler(rx, 0, ry);
float[] matrix = quat.getMatrix();
Matrix.translateM(matrix, 0, 0, 0, 100);
return matrix;
</DeepExtract>
<DeepExtract>
mAutoAlphaX = rx;
mAutoAlphaY = ry;
</DeepExtract>
|
android_packages_apps_Focal
|
positive
|
public Criteria andOrderIdGreaterThanOrEqualTo(Integer value) {
if (value == null) {
throw new RuntimeException("Value for " + "orderId" + " cannot be null");
}
criteria.add(new Criterion("order_id >=", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "orderId" + " cannot be null");
}
criteria.add(new Criterion("order_id >=", value));
</DeepExtract>
|
Ordering
|
positive
|
@Override
public void caseAIfromexprExprFunction(AIfromexprExprFunction node) {
if (new UnaryOperatorCompiler(this, node.getExprFunction()) != ExpressionCompiler.this)
throw new RuntimeException("unexpected switch");
invokeOperator(UnaryOperator.TIME, exprString);
}
|
<DeepExtract>
if (new UnaryOperatorCompiler(this, node.getExprFunction()) != ExpressionCompiler.this)
throw new RuntimeException("unexpected switch");
invokeOperator(UnaryOperator.TIME, exprString);
</DeepExtract>
|
arden2bytecode
|
positive
|
public void simulateProgress() {
if (this.state == STATE_PROGRESS_STARTED) {
return;
}
tempBitmap.recycle();
resetTempCanvas();
this.state = STATE_PROGRESS_STARTED;
if (STATE_PROGRESS_STARTED == STATE_PROGRESS_STARTED) {
setCurrentProgress(0);
simulateProgressAnimator.start();
} else if (STATE_PROGRESS_STARTED == STATE_DONE_STARTED) {
setCurrentDoneBgOffset(MAX_DONE_BG_OFFSET);
setCurrentCheckmarkOffset(MAX_DONE_IMG_OFFSET);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playSequentially(doneBgAnimator, checkmarkAnimator);
animatorSet.start();
} else if (STATE_PROGRESS_STARTED == STATE_FINISHED) {
if (onLoadingFinishedListener != null) {
onLoadingFinishedListener.onLoadingFinished();
}
}
}
|
<DeepExtract>
if (this.state == STATE_PROGRESS_STARTED) {
return;
}
tempBitmap.recycle();
resetTempCanvas();
this.state = STATE_PROGRESS_STARTED;
if (STATE_PROGRESS_STARTED == STATE_PROGRESS_STARTED) {
setCurrentProgress(0);
simulateProgressAnimator.start();
} else if (STATE_PROGRESS_STARTED == STATE_DONE_STARTED) {
setCurrentDoneBgOffset(MAX_DONE_BG_OFFSET);
setCurrentCheckmarkOffset(MAX_DONE_IMG_OFFSET);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playSequentially(doneBgAnimator, checkmarkAnimator);
animatorSet.start();
} else if (STATE_PROGRESS_STARTED == STATE_FINISHED) {
if (onLoadingFinishedListener != null) {
onLoadingFinishedListener.onLoadingFinished();
}
}
</DeepExtract>
|
UPES-SPE-Fest
|
positive
|
public void setDataSource(DataSource dataSource) {
this.dataSource = dataSource;
if (domainBaseClass != null && dataSource != null) {
DataSourceConnectionProvider cp = new DataSourceConnectionProvider(dataSource);
ActiveRecordBase.putConnectionProvider(domainBaseClass, cp);
}
if (domainBaseClass != null && adapterClass != null) {
try {
Adapter adapter = (Adapter) Class.forName(adapterClass).newInstance();
ActiveRecordBase.putConnectionAdapter(domainBaseClass, adapter);
} catch (Exception e) {
}
}
}
|
<DeepExtract>
if (domainBaseClass != null && dataSource != null) {
DataSourceConnectionProvider cp = new DataSourceConnectionProvider(dataSource);
ActiveRecordBase.putConnectionProvider(domainBaseClass, cp);
}
if (domainBaseClass != null && adapterClass != null) {
try {
Adapter adapter = (Adapter) Class.forName(adapterClass).newInstance();
ActiveRecordBase.putConnectionAdapter(domainBaseClass, adapter);
} catch (Exception e) {
}
}
</DeepExtract>
|
etmvc
|
positive
|
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_surface_camera);
mCloseIv = findViewById(R.id.toolbar_close_iv);
mCloseIv.setOnClickListener(this);
mSwitchCameraIv = findViewById(R.id.toolbar_switch_iv);
mSwitchCameraIv.setOnClickListener(this);
mTakePictureIv = findViewById(R.id.take_picture_iv);
mTakePictureIv.setOnClickListener(this);
mPictureIv = findViewById(R.id.picture_iv);
mPictureIv.setOnClickListener(this);
mPictureIv.setImageBitmap(ImageUtils.getLatestThumbBitmap());
mCameraView = findViewById(R.id.camera_view);
mCameraProxy = mCameraView.getCameraProxy();
}
|
<DeepExtract>
mCloseIv = findViewById(R.id.toolbar_close_iv);
mCloseIv.setOnClickListener(this);
mSwitchCameraIv = findViewById(R.id.toolbar_switch_iv);
mSwitchCameraIv.setOnClickListener(this);
mTakePictureIv = findViewById(R.id.take_picture_iv);
mTakePictureIv.setOnClickListener(this);
mPictureIv = findViewById(R.id.picture_iv);
mPictureIv.setOnClickListener(this);
mPictureIv.setImageBitmap(ImageUtils.getLatestThumbBitmap());
mCameraView = findViewById(R.id.camera_view);
mCameraProxy = mCameraView.getCameraProxy();
</DeepExtract>
|
EasyOpengl
|
positive
|
@Override
public Status update(String table, String key, HashMap<String, ByteIterator> values) {
if (debug) {
System.out.println("Setting up put for key: " + key);
}
try {
long mutator = connection.mutator_open(ns, table, 0, 0);
SerializedCellsWriter writer = new SerializedCellsWriter(BUFFER_SIZE * values.size(), true);
for (Map.Entry<String, ByteIterator> entry : values.entrySet()) {
writer.add(key, columnFamily, entry.getKey(), SerializedCellsFlag.AUTO_ASSIGN, ByteBuffer.wrap(entry.getValue().toArray()));
}
connection.mutator_set_cells_serialized(mutator, writer.buffer(), true);
connection.mutator_close(mutator);
} catch (ClientException e) {
if (debug) {
System.err.println("Error doing set: " + e.message);
}
return Status.ERROR;
} catch (TException e) {
if (debug) {
System.err.println("Error doing set");
}
return Status.ERROR;
}
return Status.OK;
}
|
<DeepExtract>
if (debug) {
System.out.println("Setting up put for key: " + key);
}
try {
long mutator = connection.mutator_open(ns, table, 0, 0);
SerializedCellsWriter writer = new SerializedCellsWriter(BUFFER_SIZE * values.size(), true);
for (Map.Entry<String, ByteIterator> entry : values.entrySet()) {
writer.add(key, columnFamily, entry.getKey(), SerializedCellsFlag.AUTO_ASSIGN, ByteBuffer.wrap(entry.getValue().toArray()));
}
connection.mutator_set_cells_serialized(mutator, writer.buffer(), true);
connection.mutator_close(mutator);
} catch (ClientException e) {
if (debug) {
System.err.println("Error doing set: " + e.message);
}
return Status.ERROR;
} catch (TException e) {
if (debug) {
System.err.println("Error doing set");
}
return Status.ERROR;
}
return Status.OK;
</DeepExtract>
|
anna
|
positive
|
final protected void onPreExecute() {
Log.d(TAG, String.format("%s --->onTaskStarted()", TextUtils.isEmpty(taskId) ? "run " : (taskId + " run ")));
}
|
<DeepExtract>
</DeepExtract>
|
open_weather
|
positive
|
@Override
public JobrunrMigrationsRecord value3(String value) {
set(2, value);
return this;
}
|
<DeepExtract>
set(2, value);
</DeepExtract>
|
openvsx
|
positive
|
public static double getADiv(double distance) {
return 10 * Math.log10(4 * Math.PI * Math.max(1, distance * distance));
}
|
<DeepExtract>
return 10 * Math.log10(4 * Math.PI * Math.max(1, distance * distance));
</DeepExtract>
|
NoiseCapture
|
positive
|
@Override
public void writeRawUTF8String(final byte[] text, final int offset, final int length) throws IOException {
writer.writeString(new String(text, offset, length, StandardCharsets.UTF_8));
}
|
<DeepExtract>
writer.writeString(new String(text, offset, length, StandardCharsets.UTF_8));
</DeepExtract>
|
mongojack
|
positive
|
@Override
Exception onConferenceCallStarted(Call jvbConferenceCall) {
this.jvbCall = jvbConferenceCall;
this.chatRoom = super.jvbConference.getJvbRoom();
if (!service.isConfiguredProperly()) {
logger.warn("TranscriptionService is not properly configured");
sendMessageToRoom("Transcriber is not properly " + "configured. Contact the service administrators and let them " + "know! I will now leave.");
jvbConference.stop();
return null;
}
for (TranscriptionResultPublisher pub : handler.getTranscriptResultPublishers()) {
if (pub instanceof TranscriptionEventListener)
transcriber.addTranscriptionEventListener((TranscriptionEventListener) pub);
}
transcriber.addTranscriptionEventListener(this);
transcriber.start();
List<ConferenceMember> confMembers = getCurrentConferenceMembers();
if (confMembers == null) {
logger.warn("Cannot add initial ConferenceMembers to " + "transcription");
} else {
for (ConferenceMember confMember : confMembers) {
if ("jvb".equals(confMember.getAddress())) {
continue;
}
String identifier = getParticipantIdentifier(confMember);
this.transcriber.updateParticipant(identifier, confMember);
}
}
List<ChatRoomMember> chatRoomMembers = getCurrentChatRoomMembers();
if (chatRoomMembers == null) {
logger.warn("Cannot add initial ChatRoomMembers to transcription");
return;
}
for (ChatRoomMember chatRoomMember : chatRoomMembers) {
ChatRoomMemberJabberImpl chatRoomMemberJabber;
if (chatRoomMember instanceof ChatRoomMemberJabberImpl) {
chatRoomMemberJabber = (ChatRoomMemberJabberImpl) chatRoomMember;
} else {
logger.warn("Could not cast a ChatRoomMember to " + "ChatRoomMemberJabberImpl");
continue;
}
String identifier = getParticipantIdentifier(chatRoomMemberJabber);
if ("focus".equals(identifier)) {
continue;
}
if (chatRoomMemberJabber.getJabberID().getResourceOrNull() == null) {
continue;
}
this.transcriber.updateParticipant(identifier, chatRoomMember);
this.transcriber.participantJoined(identifier);
}
StringBuilder welcomeMessage = new StringBuilder();
finalTranscriptPromises.addAll(handler.getTranscriptPublishPromises());
for (TranscriptPublisher.Promise promise : finalTranscriptPromises) {
if (promise.hasDescription()) {
welcomeMessage.append(promise.getDescription());
}
promise.maybeStartRecording(transcriber.getMediaDevice());
}
if (welcomeMessage.length() > 0) {
sendMessageToRoom(welcomeMessage.toString());
}
try {
CallManager.acceptCall(jvbConferenceCall);
} catch (OperationFailedException e) {
return e;
}
logger.debug("TranscriptionGatewaySession started transcribing");
return null;
}
|
<DeepExtract>
List<ConferenceMember> confMembers = getCurrentConferenceMembers();
if (confMembers == null) {
logger.warn("Cannot add initial ConferenceMembers to " + "transcription");
} else {
for (ConferenceMember confMember : confMembers) {
if ("jvb".equals(confMember.getAddress())) {
continue;
}
String identifier = getParticipantIdentifier(confMember);
this.transcriber.updateParticipant(identifier, confMember);
}
}
List<ChatRoomMember> chatRoomMembers = getCurrentChatRoomMembers();
if (chatRoomMembers == null) {
logger.warn("Cannot add initial ChatRoomMembers to transcription");
return;
}
for (ChatRoomMember chatRoomMember : chatRoomMembers) {
ChatRoomMemberJabberImpl chatRoomMemberJabber;
if (chatRoomMember instanceof ChatRoomMemberJabberImpl) {
chatRoomMemberJabber = (ChatRoomMemberJabberImpl) chatRoomMember;
} else {
logger.warn("Could not cast a ChatRoomMember to " + "ChatRoomMemberJabberImpl");
continue;
}
String identifier = getParticipantIdentifier(chatRoomMemberJabber);
if ("focus".equals(identifier)) {
continue;
}
if (chatRoomMemberJabber.getJabberID().getResourceOrNull() == null) {
continue;
}
this.transcriber.updateParticipant(identifier, chatRoomMember);
this.transcriber.participantJoined(identifier);
}
</DeepExtract>
|
jigasi
|
positive
|
void setPagerAdapter(@Nullable final PagerAdapter adapter, final boolean addObserver) {
if (pagerAdapter != null && pagerAdapterObserver != null) {
pagerAdapter.unregisterDataSetObserver(pagerAdapterObserver);
}
pagerAdapter = adapter;
if (addObserver && adapter != null) {
if (pagerAdapterObserver == null) {
pagerAdapterObserver = new PagerAdapterObserver();
}
adapter.registerDataSetObserver(pagerAdapterObserver);
}
removeAllTabs();
if (pagerAdapter != null) {
final int adapterCount = pagerAdapter.getCount();
for (int i = 0; i < adapterCount; i++) {
addTab(newTab().setText(pagerAdapter.getPageTitle(i)), false);
}
if (viewPager != null && adapterCount > 0) {
final int curItem = viewPager.getCurrentItem();
if (curItem != getSelectedTabPosition() && curItem < getTabCount()) {
selectTab(getTabAt(curItem), true, true);
}
}
}
}
|
<DeepExtract>
removeAllTabs();
if (pagerAdapter != null) {
final int adapterCount = pagerAdapter.getCount();
for (int i = 0; i < adapterCount; i++) {
addTab(newTab().setText(pagerAdapter.getPageTitle(i)), false);
}
if (viewPager != null && adapterCount > 0) {
final int curItem = viewPager.getCurrentItem();
if (curItem != getSelectedTabPosition() && curItem < getTabCount()) {
selectTab(getTabAt(curItem), true, true);
}
}
}
</DeepExtract>
|
SamsungOneUi
|
positive
|
public File getChild(File arg0, String arg1) {
File tmp = null;
try {
tmp = view.getChild(arg0, arg1);
if (tmp != null)
return tmp;
} catch (Exception e) {
}
try {
tmp = super.getChild(arg0, arg1);
if (tmp != null)
return tmp;
} catch (Exception e) {
}
File tmp = null;
try {
tmp = view.createFileObject(arg0, arg1);
if (tmp != null)
return tmp;
} catch (Exception e) {
}
try {
tmp = super.createFileObject(arg0, arg1);
if (tmp != null)
return tmp;
} catch (Exception e) {
}
return fileit(arg0, arg1);
}
|
<DeepExtract>
File tmp = null;
try {
tmp = view.createFileObject(arg0, arg1);
if (tmp != null)
return tmp;
} catch (Exception e) {
}
try {
tmp = super.createFileObject(arg0, arg1);
if (tmp != null)
return tmp;
} catch (Exception e) {
}
return fileit(arg0, arg1);
</DeepExtract>
|
CrococryptFile
|
positive
|
@Override
public void buildInterrupted(SRunningBuild sRunningBuild) {
Loggers.SERVER.debug("About to process MsTeams notifications for " + sRunningBuild.getProjectId() + " at buildState " + BuildStateEnum.BUILD_INTERRUPTED.getShortName());
for (MsTeamsNotificationConfigWrapper msteamsNotificationConfigWrapper : getListOfEnabledMsTeamsNotifications(sRunningBuild.getProjectId())) {
if (BuildStateEnum.BUILD_INTERRUPTED.equals(BuildStateEnum.BUILD_STARTED)) {
msteamsNotificationConfigWrapper.msteamsNotification.setPayload(myManager.buildStarted(sRunningBuild, getPreviousNonPersonalBuild(sRunningBuild)));
msteamsNotificationConfigWrapper.msteamsNotification.setEnabled(msteamsNotificationConfigWrapper.whc.isEnabledForBuildType(sRunningBuild.getBuildType()) && msteamsNotificationConfigWrapper.msteamsNotification.getBuildStates().enabled(BuildStateEnum.BUILD_STARTED));
} else if (BuildStateEnum.BUILD_INTERRUPTED.equals(BuildStateEnum.BUILD_INTERRUPTED)) {
msteamsNotificationConfigWrapper.msteamsNotification.setPayload(myManager.buildInterrupted(sRunningBuild, getPreviousNonPersonalBuild(sRunningBuild)));
msteamsNotificationConfigWrapper.msteamsNotification.setEnabled(msteamsNotificationConfigWrapper.whc.isEnabledForBuildType(sRunningBuild.getBuildType()) && msteamsNotificationConfigWrapper.msteamsNotification.getBuildStates().enabled(BuildStateEnum.BUILD_INTERRUPTED));
} else if (BuildStateEnum.BUILD_INTERRUPTED.equals(BuildStateEnum.BEFORE_BUILD_FINISHED)) {
msteamsNotificationConfigWrapper.msteamsNotification.setPayload(myManager.beforeBuildFinish(sRunningBuild, getPreviousNonPersonalBuild(sRunningBuild)));
msteamsNotificationConfigWrapper.msteamsNotification.setEnabled(msteamsNotificationConfigWrapper.whc.isEnabledForBuildType(sRunningBuild.getBuildType()) && msteamsNotificationConfigWrapper.msteamsNotification.getBuildStates().enabled(BuildStateEnum.BEFORE_BUILD_FINISHED));
} else if (BuildStateEnum.BUILD_INTERRUPTED.equals(BuildStateEnum.BUILD_FINISHED)) {
msteamsNotificationConfigWrapper.msteamsNotification.setEnabled(msteamsNotificationConfigWrapper.whc.isEnabledForBuildType(sRunningBuild.getBuildType()) && msteamsNotificationConfigWrapper.msteamsNotification.getBuildStates().enabled(BuildStateEnum.BUILD_FINISHED, sRunningBuild.getStatusDescriptor().isSuccessful(), this.hasBuildChangedHistoricalState(sRunningBuild)));
msteamsNotificationConfigWrapper.msteamsNotification.setPayload(myManager.buildFinished(sRunningBuild, getPreviousNonPersonalBuild(sRunningBuild)));
;
}
doPost(msteamsNotificationConfigWrapper.msteamsNotification);
}
}
|
<DeepExtract>
Loggers.SERVER.debug("About to process MsTeams notifications for " + sRunningBuild.getProjectId() + " at buildState " + BuildStateEnum.BUILD_INTERRUPTED.getShortName());
for (MsTeamsNotificationConfigWrapper msteamsNotificationConfigWrapper : getListOfEnabledMsTeamsNotifications(sRunningBuild.getProjectId())) {
if (BuildStateEnum.BUILD_INTERRUPTED.equals(BuildStateEnum.BUILD_STARTED)) {
msteamsNotificationConfigWrapper.msteamsNotification.setPayload(myManager.buildStarted(sRunningBuild, getPreviousNonPersonalBuild(sRunningBuild)));
msteamsNotificationConfigWrapper.msteamsNotification.setEnabled(msteamsNotificationConfigWrapper.whc.isEnabledForBuildType(sRunningBuild.getBuildType()) && msteamsNotificationConfigWrapper.msteamsNotification.getBuildStates().enabled(BuildStateEnum.BUILD_STARTED));
} else if (BuildStateEnum.BUILD_INTERRUPTED.equals(BuildStateEnum.BUILD_INTERRUPTED)) {
msteamsNotificationConfigWrapper.msteamsNotification.setPayload(myManager.buildInterrupted(sRunningBuild, getPreviousNonPersonalBuild(sRunningBuild)));
msteamsNotificationConfigWrapper.msteamsNotification.setEnabled(msteamsNotificationConfigWrapper.whc.isEnabledForBuildType(sRunningBuild.getBuildType()) && msteamsNotificationConfigWrapper.msteamsNotification.getBuildStates().enabled(BuildStateEnum.BUILD_INTERRUPTED));
} else if (BuildStateEnum.BUILD_INTERRUPTED.equals(BuildStateEnum.BEFORE_BUILD_FINISHED)) {
msteamsNotificationConfigWrapper.msteamsNotification.setPayload(myManager.beforeBuildFinish(sRunningBuild, getPreviousNonPersonalBuild(sRunningBuild)));
msteamsNotificationConfigWrapper.msteamsNotification.setEnabled(msteamsNotificationConfigWrapper.whc.isEnabledForBuildType(sRunningBuild.getBuildType()) && msteamsNotificationConfigWrapper.msteamsNotification.getBuildStates().enabled(BuildStateEnum.BEFORE_BUILD_FINISHED));
} else if (BuildStateEnum.BUILD_INTERRUPTED.equals(BuildStateEnum.BUILD_FINISHED)) {
msteamsNotificationConfigWrapper.msteamsNotification.setEnabled(msteamsNotificationConfigWrapper.whc.isEnabledForBuildType(sRunningBuild.getBuildType()) && msteamsNotificationConfigWrapper.msteamsNotification.getBuildStates().enabled(BuildStateEnum.BUILD_FINISHED, sRunningBuild.getStatusDescriptor().isSuccessful(), this.hasBuildChangedHistoricalState(sRunningBuild)));
msteamsNotificationConfigWrapper.msteamsNotification.setPayload(myManager.buildFinished(sRunningBuild, getPreviousNonPersonalBuild(sRunningBuild)));
;
}
doPost(msteamsNotificationConfigWrapper.msteamsNotification);
}
</DeepExtract>
|
teamcity-msteams-notifier
|
positive
|
@Override
public void onViewDetachedFromWindow(final View v) {
dismiss();
if (SDK_INT >= LOLLIPOP) {
context.getWindow().getDecorView().setOnApplyWindowInsetsListener(null);
}
popupWindow.setOnDismissListener(null);
if (SDK_INT < LOLLIPOP) {
rootView.getViewTreeObserver().removeGlobalOnLayoutListener(onGlobalLayoutListener);
}
rootView.removeOnAttachStateChangeListener(this);
}
|
<DeepExtract>
dismiss();
if (SDK_INT >= LOLLIPOP) {
context.getWindow().getDecorView().setOnApplyWindowInsetsListener(null);
}
</DeepExtract>
|
AXEmojiView
|
positive
|
@Override
public Selection cop(final String column, final String op, final Object arg2) {
if (currentSelection != null) {
moveToColumns(currentSelection);
}
currentSelection = new SimpleClause(column, op, arg2);
return this;
}
|
<DeepExtract>
if (currentSelection != null) {
moveToColumns(currentSelection);
}
currentSelection = new SimpleClause(column, op, arg2);
return this;
</DeepExtract>
|
influxdb-java
|
positive
|
private void apply(final Paint paint, final Typeface tf) {
Typeface old = paint.getTypeface();
if (old == null) {
oldStyle = 0;
} else {
oldStyle = old.getStyle();
}
int fake = oldStyle & ~tf.getStyle();
if ((fake & Typeface.BOLD) != 0) {
paint.setFakeBoldText(true);
}
if ((fake & Typeface.ITALIC) != 0) {
paint.setTextSkewX(-0.25f);
}
paint.getShader();
this.typeface = tf;
return this;
}
|
<DeepExtract>
this.typeface = tf;
return this;
</DeepExtract>
|
BaseDemo
|
positive
|
void init(Context m) {
master = m;
masterHandler = new Handler(m.getMainLooper());
notificationManager = (NotificationManager) master.getSystemService(Context.NOTIFICATION_SERVICE);
if (m instanceof Application) {
app = (Application) m;
} else if (m instanceof Service) {
app = ((Service) m).getApplication();
} else if (m instanceof Activity) {
app = ((Activity) m).getApplication();
} else
throw new ClassCastException("MemorizingTrustManager context must be either Activity or Service!");
File dir = app.getDir(KEYSTORE_DIR, Context.MODE_PRIVATE);
keyStoreFile = new File(dir + File.separator + KEYSTORE_FILE);
KeyStore ks;
try {
ks = KeyStore.getInstance(KeyStore.getDefaultType());
} catch (KeyStoreException e) {
LOGGER.log(Level.SEVERE, "getAppKeyStore()", e);
appKeyStore = null;
}
try {
ks.load(null, null);
ks.load(new java.io.FileInputStream(keyStoreFile), "MTM".toCharArray());
} catch (java.io.FileNotFoundException e) {
LOGGER.log(Level.INFO, "getAppKeyStore(" + keyStoreFile + ") - file does not exist");
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "getAppKeyStore(" + keyStoreFile + ")", e);
}
return ks;
}
|
<DeepExtract>
KeyStore ks;
try {
ks = KeyStore.getInstance(KeyStore.getDefaultType());
} catch (KeyStoreException e) {
LOGGER.log(Level.SEVERE, "getAppKeyStore()", e);
appKeyStore = null;
}
try {
ks.load(null, null);
ks.load(new java.io.FileInputStream(keyStoreFile), "MTM".toCharArray());
} catch (java.io.FileNotFoundException e) {
LOGGER.log(Level.INFO, "getAppKeyStore(" + keyStoreFile + ") - file does not exist");
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "getAppKeyStore(" + keyStoreFile + ")", e);
}
return ks;
</DeepExtract>
|
simpleirc
|
positive
|
public static String toString(Reader in) throws IOException {
StringWriter out = new StringWriter();
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
int n = 0;
while (-1 != (n = in.read(buffer))) {
out.write(buffer, 0, n);
}
return out.toString();
}
|
<DeepExtract>
byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
int n = 0;
while (-1 != (n = in.read(buffer))) {
out.write(buffer, 0, n);
}
</DeepExtract>
|
eclim
|
positive
|
private ConfigData doLoad() {
if (!Files.exists(Paths.get(CONFIG_PATH)) && Files.exists(Paths.get(OLD_CONFIG_PATH))) {
var config = JsonUtils.from(OLD_CONFIG_PATH, ConfigData.class);
save(config);
}
final ConfigData config = JsonUtils.from(CONFIG_PATH, ConfigData.class);
final List<ServerConfigData> sortedServers = config.getServers().stream().filter(serverConfigData -> serverConfigData.getConnectTimes() > 0).sorted(Comparator.comparingInt(ServerConfigData::getConnectTimes)).collect(Collectors.toList());
Collections.reverse(sortedServers);
List<ServerConfigData> unConnectServers = config.getServers().stream().filter(serverConfigData -> serverConfigData.getConnectTimes() == 0).collect(Collectors.toList());
List<ServerConfigData> servers = new ArrayList<>();
servers.addAll(sortedServers);
servers.addAll(unConnectServers);
servers.forEach(s -> {
if (s.getId() == null) {
s.setId(UUID.randomUUID().toString());
}
});
config.setServers(servers);
return config;
}
|
<DeepExtract>
if (!Files.exists(Paths.get(CONFIG_PATH)) && Files.exists(Paths.get(OLD_CONFIG_PATH))) {
var config = JsonUtils.from(OLD_CONFIG_PATH, ConfigData.class);
save(config);
}
</DeepExtract>
|
PrettyZoo
|
positive
|
@Override
public void render(Node node) {
textContent.write('/');
Node node = node.getFirstChild();
while (node != null) {
Node next = node.getNext();
context.render(node);
node = next;
}
textContent.write('/');
}
|
<DeepExtract>
Node node = node.getFirstChild();
while (node != null) {
Node next = node.getNext();
context.render(node);
node = next;
}
</DeepExtract>
|
NBlog
|
positive
|
public void visitSubNodeType(@NotNull CndSubNodeType o) {
visitPsiElement(o);
}
|
<DeepExtract>
visitPsiElement(o);
</DeepExtract>
|
IntelliJ_Jahia_plugin
|
positive
|
@Test
public void testIllegalInstantDueToTimeZoneOffsetTransition() {
final DateTimeZone dateTimeZone = DateTimeZone.forID("CET");
LocalDateTime localDateTime = new LocalDateTime(dateTimeZone).withYear(2011).withMonthOfYear(3).withDayOfMonth(27).withHourOfDay(2);
try {
DateTime myDateBroken = localDateTime.toDateTime(dateTimeZone);
fail("No exception for " + localDateTime + " -> " + myDateBroken);
} catch (IllegalArgumentException iae) {
Log.v(TAG, "Sure enough, invalid instant due to time zone offset transition: " + localDateTime);
}
if (dateTimeZone.isLocalDateTimeGap(localDateTime)) {
localDateTime = localDateTime.withHourOfDay(3);
}
DateTime myDate = localDateTime.toDateTime(dateTimeZone);
Log.v(TAG, "No problem with this date: " + myDate);
long millis = toMillis("2014-09-07T00:00:00+00:00");
String title = "DST";
for (int ind = -25; ind < 26; ind++) {
provider.addRow(new QueryRow().setEventId(++eventId).setTitle(title + " " + ind).setBegin(millis + TimeUnit.HOURS.toMillis(ind)).setAllDay(1));
}
long millis = toMillis("2015-03-29T00:00:00+00:00");
String title = "DST";
for (int ind = -25; ind < 26; ind++) {
provider.addRow(new QueryRow().setEventId(++eventId).setTitle(title + " " + ind).setBegin(millis + TimeUnit.HOURS.toMillis(ind)).setAllDay(1));
}
long millis = toMillis("2015-10-25T00:00:00+00:00");
String title = "DST";
for (int ind = -25; ind < 26; ind++) {
provider.addRow(new QueryRow().setEventId(++eventId).setTitle(title + " " + ind).setBegin(millis + TimeUnit.HOURS.toMillis(ind)).setAllDay(1));
}
long millis = toMillis("2011-03-27T00:00:00+00:00");
String title = "DST";
for (int ind = -25; ind < 26; ind++) {
provider.addRow(new QueryRow().setEventId(++eventId).setTitle(title + " " + ind).setBegin(millis + TimeUnit.HOURS.toMillis(ind)).setAllDay(1));
}
long millis = toMillis("1980-04-06T00:00:00+00:00");
String title = "DST";
for (int ind = -25; ind < 26; ind++) {
provider.addRow(new QueryRow().setEventId(++eventId).setTitle(title + " " + ind).setBegin(millis + TimeUnit.HOURS.toMillis(ind)).setAllDay(1));
}
provider.addRow(new CalendarEvent(getSettings(), provider.getContext(), provider.getWidgetId(), false).setStartDate(getSettings().clock().startOfTomorrow()).setEventSource(provider.getFirstActiveEventSource()).setTitle("This will be the only event that will be shown"));
playResults(TAG);
assertEquals(3, getFactory().getWidgetEntries().size());
}
|
<DeepExtract>
final DateTimeZone dateTimeZone = DateTimeZone.forID("CET");
LocalDateTime localDateTime = new LocalDateTime(dateTimeZone).withYear(2011).withMonthOfYear(3).withDayOfMonth(27).withHourOfDay(2);
try {
DateTime myDateBroken = localDateTime.toDateTime(dateTimeZone);
fail("No exception for " + localDateTime + " -> " + myDateBroken);
} catch (IllegalArgumentException iae) {
Log.v(TAG, "Sure enough, invalid instant due to time zone offset transition: " + localDateTime);
}
if (dateTimeZone.isLocalDateTimeGap(localDateTime)) {
localDateTime = localDateTime.withHourOfDay(3);
}
DateTime myDate = localDateTime.toDateTime(dateTimeZone);
Log.v(TAG, "No problem with this date: " + myDate);
</DeepExtract>
<DeepExtract>
long millis = toMillis("2014-09-07T00:00:00+00:00");
String title = "DST";
for (int ind = -25; ind < 26; ind++) {
provider.addRow(new QueryRow().setEventId(++eventId).setTitle(title + " " + ind).setBegin(millis + TimeUnit.HOURS.toMillis(ind)).setAllDay(1));
}
</DeepExtract>
<DeepExtract>
long millis = toMillis("2015-03-29T00:00:00+00:00");
String title = "DST";
for (int ind = -25; ind < 26; ind++) {
provider.addRow(new QueryRow().setEventId(++eventId).setTitle(title + " " + ind).setBegin(millis + TimeUnit.HOURS.toMillis(ind)).setAllDay(1));
}
</DeepExtract>
<DeepExtract>
long millis = toMillis("2015-10-25T00:00:00+00:00");
String title = "DST";
for (int ind = -25; ind < 26; ind++) {
provider.addRow(new QueryRow().setEventId(++eventId).setTitle(title + " " + ind).setBegin(millis + TimeUnit.HOURS.toMillis(ind)).setAllDay(1));
}
</DeepExtract>
<DeepExtract>
long millis = toMillis("2011-03-27T00:00:00+00:00");
String title = "DST";
for (int ind = -25; ind < 26; ind++) {
provider.addRow(new QueryRow().setEventId(++eventId).setTitle(title + " " + ind).setBegin(millis + TimeUnit.HOURS.toMillis(ind)).setAllDay(1));
}
</DeepExtract>
<DeepExtract>
long millis = toMillis("1980-04-06T00:00:00+00:00");
String title = "DST";
for (int ind = -25; ind < 26; ind++) {
provider.addRow(new QueryRow().setEventId(++eventId).setTitle(title + " " + ind).setBegin(millis + TimeUnit.HOURS.toMillis(ind)).setAllDay(1));
}
</DeepExtract>
|
calendar-widget
|
positive
|
public static void main(String[] args) {
Kalman2Filter filter = new Kalman2Filter();
history.add(new Sample(1[0]));
float[] result = new float[] { doKalman2() };
trimSamples();
return result;
history.add(new Sample(3[0]));
float[] result = new float[] { doKalman2() };
trimSamples();
return result;
history.add(new Sample(5[0]));
float[] result = new float[] { doKalman2() };
trimSamples();
return result;
history.add(new Sample(1[0]));
float[] result = new float[] { doKalman2() };
trimSamples();
return result;
history.add(new Sample(1[0]));
float[] result = new float[] { doKalman2() };
trimSamples();
return result;
history.add(new Sample(1[0]));
float[] result = new float[] { doKalman2() };
trimSamples();
return result;
}
|
<DeepExtract>
history.add(new Sample(1[0]));
float[] result = new float[] { doKalman2() };
trimSamples();
return result;
</DeepExtract>
<DeepExtract>
history.add(new Sample(3[0]));
float[] result = new float[] { doKalman2() };
trimSamples();
return result;
</DeepExtract>
<DeepExtract>
history.add(new Sample(5[0]));
float[] result = new float[] { doKalman2() };
trimSamples();
return result;
</DeepExtract>
<DeepExtract>
history.add(new Sample(1[0]));
float[] result = new float[] { doKalman2() };
trimSamples();
return result;
</DeepExtract>
<DeepExtract>
history.add(new Sample(1[0]));
float[] result = new float[] { doKalman2() };
trimSamples();
return result;
</DeepExtract>
<DeepExtract>
history.add(new Sample(1[0]));
float[] result = new float[] { doKalman2() };
trimSamples();
return result;
</DeepExtract>
|
AVario
|
positive
|
public static PersonList fromQuery(Query<Person> query, int pageNum, int pageSize) {
PersonList results = new PersonList(pageNum, pageSize, query.list());
this.list = query.list();
if (results.getList().size() == 0) {
results.setTotalCount(0);
} else {
results.setTotalCount((Integer) query.getContext().getAttribute("totalCount"));
}
return results;
}
|
<DeepExtract>
this.list = query.list();
</DeepExtract>
|
anet
|
positive
|
@SuppressWarnings("unchecked")
@Override
public boolean equals(Object other) {
if (!(other instanceof Map)) {
return false;
}
Map<K, V> that = (Map<K, V>) other;
if (that.size() != this.size()) {
return false;
}
Object[] keys = _set;
V[] values = _values;
for (int i = keys.length; i-- > 0; ) {
if (keys[i] != FREE && keys[i] != REMOVED && !new EqProcedure<K, V>(that).execute((K) keys[i], values[i])) {
return false;
}
}
return true;
}
|
<DeepExtract>
Object[] keys = _set;
V[] values = _values;
for (int i = keys.length; i-- > 0; ) {
if (keys[i] != FREE && keys[i] != REMOVED && !new EqProcedure<K, V>(that).execute((K) keys[i], values[i])) {
return false;
}
}
return true;
</DeepExtract>
|
trove
|
positive
|
public String getKanCan() {
int offset = 9 - Solar.fromJulianDay(getMonth(1).getFirstJulianDay()).getLunar().getDayZhiIndex();
if (offset < 0) {
offset += 12;
}
return "å‡ å§‘çœ‹èš•".replaceFirst("å‡ ", LunarUtil.NUMBER[offset + 1]);
}
|
<DeepExtract>
int offset = 9 - Solar.fromJulianDay(getMonth(1).getFirstJulianDay()).getLunar().getDayZhiIndex();
if (offset < 0) {
offset += 12;
}
return "å‡ å§‘çœ‹èš•".replaceFirst("å‡ ", LunarUtil.NUMBER[offset + 1]);
</DeepExtract>
|
lunar-java
|
positive
|
@Override
public void onClick(DialogInterface dialog, int which) {
int deleted = deleteSelected();
mIngredientView.drawList();
mActionMode.finish();
updateStats();
toastDeleted(deleted);
}
|
<DeepExtract>
int deleted = deleteSelected();
mIngredientView.drawList();
mActionMode.finish();
updateStats();
toastDeleted(deleted);
</DeepExtract>
|
BrewShopApp
|
positive
|
public static Date addDays(Date date, long days) {
return date + days * MILLISECONDS_IN_DAY;
}
|
<DeepExtract>
return date + days * MILLISECONDS_IN_DAY;
</DeepExtract>
|
slimrepo
|
positive
|
@Command(value = { "export", "dump" }, description = "Export a dump of the database")
@Require("zpermissions.export")
public void export(CommandSender sender, @Option(value = "filename", completer = "dump-dir") String filename) {
File outFile;
String[] parts = filename.split(File.separatorChar == '\\' ? "\\\\" : File.separator);
if (parts.length == 1) {
if (!parts[0].startsWith("."))
outFile = new File(config.getDumpDirectory(), filename);
}
throw new ParseException("Invalid filename.");
try {
if (!config.getDumpDirectory().exists()) {
if (!config.getDumpDirectory().mkdirs()) {
sendMessage(sender, colorize("{RED}Unable to create dump directory"));
return;
}
}
modelDumper.dump(outFile);
sendMessage(sender, colorize("{YELLOW}Export completed."));
} catch (IOException e) {
sendMessage(sender, colorize("{RED}Error exporting; see server log."));
log(plugin, Level.SEVERE, "Error exporting:", e);
}
}
|
<DeepExtract>
File outFile;
String[] parts = filename.split(File.separatorChar == '\\' ? "\\\\" : File.separator);
if (parts.length == 1) {
if (!parts[0].startsWith("."))
outFile = new File(config.getDumpDirectory(), filename);
}
throw new ParseException("Invalid filename.");
</DeepExtract>
|
zPermissions
|
positive
|
public static void main16() {
int[] first = { 0, -1, 2, -3, 1 };
for (int i = 0; i < (first.length - 2); i++) {
for (int j = i + 1; j < (first.length - 1); j++) {
for (int k = j + 1; k < first.length; k++) {
if (first[i] + first[j] + first[k] == 0)
System.out.println("Triplet:: " + first[i] + " " + first[j] + " " + first[k]);
}
}
}
int start, stop;
Arrays.sort(first);
for (int i = 0; i < (first.length - 2); i++) {
start = i + 1;
stop = first.length - 1;
while (start < stop) {
if (first[i] + first[start] + first[stop] == 0) {
System.out.println("Triplet :: " + first[i] + " " + first[start] + " " + first[stop]);
start += 1;
stop -= 1;
} else if (first[i] + first[start] + first[stop] > 0)
stop -= 1;
else
start += 1;
}
}
}
|
<DeepExtract>
for (int i = 0; i < (first.length - 2); i++) {
for (int j = i + 1; j < (first.length - 1); j++) {
for (int k = j + 1; k < first.length; k++) {
if (first[i] + first[j] + first[k] == 0)
System.out.println("Triplet:: " + first[i] + " " + first[j] + " " + first[k]);
}
}
}
</DeepExtract>
<DeepExtract>
int start, stop;
Arrays.sort(first);
for (int i = 0; i < (first.length - 2); i++) {
start = i + 1;
stop = first.length - 1;
while (start < stop) {
if (first[i] + first[start] + first[stop] == 0) {
System.out.println("Triplet :: " + first[i] + " " + first[start] + " " + first[stop]);
start += 1;
stop -= 1;
} else if (first[i] + first[start] + first[stop] > 0)
stop -= 1;
else
start += 1;
}
}
</DeepExtract>
|
Problem-Solving-in-Data-Structures-Algorithms-using-Java
|
positive
|
private void fromFoxmlFiles(String filePath, String repositoryName, String indexName, StringBuffer resultXml, String indexDocXslt) throws java.rmi.RemoteException {
if (logger.isDebugEnabled())
logger.debug("fromFoxmlFiles filePath=" + filePath + " repositoryName=" + repositoryName + " indexName=" + indexName);
File objectDir = null;
if (filePath == null || filePath.equals(""))
objectDir = config.getFedoraObjectDir(repositoryName);
else
objectDir = new File(filePath);
if (objectDir.isHidden())
return;
if (objectDir.isDirectory()) {
String[] files = objectDir.list();
for (int i = 0; i < files.length; i++) {
if (i % 100 == 0)
logger.info("updateIndex fromFoxmlFiles " + objectDir.getAbsolutePath() + " indexDirSpace=" + indexDirSpace(new File(config.getIndexDir(indexName))) + " docCount=" + docCount);
indexDocs(new File(objectDir, files[i]), repositoryName, indexName, resultXml, indexDocXslt);
}
} else {
try {
indexDoc(getPidFromObjectFilename(objectDir.getName()), repositoryName, indexName, new FileInputStream(objectDir), resultXml, indexDocXslt);
} catch (RemoteException e) {
resultXml.append("<warning no=\"" + (++warnCount) + "\">file=" + objectDir.getAbsolutePath() + " exception=" + e.toString() + "</warning>\n");
logger.warn("<warning no=\"" + (warnCount) + "\">file=" + objectDir.getAbsolutePath() + " exception=" + e.toString() + "</warning>");
} catch (FileNotFoundException e) {
resultXml.append("<warning no=\"" + (++warnCount) + "\">file=" + objectDir.getAbsolutePath() + " exception=" + e.toString() + "</warning>\n");
logger.warn("<warning no=\"" + (warnCount) + "\">file=" + objectDir.getAbsolutePath() + " exception=" + e.toString() + "</warning>");
}
}
}
|
<DeepExtract>
if (objectDir.isHidden())
return;
if (objectDir.isDirectory()) {
String[] files = objectDir.list();
for (int i = 0; i < files.length; i++) {
if (i % 100 == 0)
logger.info("updateIndex fromFoxmlFiles " + objectDir.getAbsolutePath() + " indexDirSpace=" + indexDirSpace(new File(config.getIndexDir(indexName))) + " docCount=" + docCount);
indexDocs(new File(objectDir, files[i]), repositoryName, indexName, resultXml, indexDocXslt);
}
} else {
try {
indexDoc(getPidFromObjectFilename(objectDir.getName()), repositoryName, indexName, new FileInputStream(objectDir), resultXml, indexDocXslt);
} catch (RemoteException e) {
resultXml.append("<warning no=\"" + (++warnCount) + "\">file=" + objectDir.getAbsolutePath() + " exception=" + e.toString() + "</warning>\n");
logger.warn("<warning no=\"" + (warnCount) + "\">file=" + objectDir.getAbsolutePath() + " exception=" + e.toString() + "</warning>");
} catch (FileNotFoundException e) {
resultXml.append("<warning no=\"" + (++warnCount) + "\">file=" + objectDir.getAbsolutePath() + " exception=" + e.toString() + "</warning>\n");
logger.warn("<warning no=\"" + (warnCount) + "\">file=" + objectDir.getAbsolutePath() + " exception=" + e.toString() + "</warning>");
}
}
</DeepExtract>
|
gsearch
|
positive
|
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
iprot.readStructBegin();
while (true) {
field = iprot.readFieldBegin();
if (field.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch(field.id) {
case 0:
if (field.type == org.apache.thrift.protocol.TType.STRUCT) {
this.success = new QueueResponse();
this.success.read(iprot);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, field.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
}
|
<DeepExtract>
</DeepExtract>
|
bigqueue
|
positive
|
public View getView(int position, ViewGroup parent) {
view = this.inflater.inflate(resource, parent, false);
if (this.data.size() <= position)
return view;
String vault = this.data.get(position);
View viewElement = view.findViewById(R.id.name);
TextView tv = (TextView) viewElement;
tv.setText(vault);
return view;
}
|
<DeepExtract>
if (this.data.size() <= position)
return view;
String vault = this.data.get(position);
View viewElement = view.findViewById(R.id.name);
TextView tv = (TextView) viewElement;
tv.setText(vault);
return view;
</DeepExtract>
|
secrecy
|
positive
|
public static void clearJsonDB() {
if (DirectoryStructureNetSNMP.fNetSNMPJSON().exists()) {
PrintWriter pw = null;
try {
pw = new PrintWriter(DirectoryStructureNetSNMP.fNetSNMPJSON());
} catch (FileNotFoundException e) {
e.printStackTrace();
}
pw.print("");
pw.close();
}
if (!DirectoryStructureNetSNMP.fNetSNMPJSON().exists()) {
Disk.writeToDisk("{\"1.3.6\":\"dod\"}", DirectoryStructureNetSNMP.fNetSNMPJSON());
} else if (HexString.fileToByteArray(DirectoryStructureNetSNMP.fNetSNMPJSON()).length == 0) {
Disk.writeToDisk("{\"1.3.6\":\"dod\"}", DirectoryStructureNetSNMP.fNetSNMPJSON());
}
}
|
<DeepExtract>
if (!DirectoryStructureNetSNMP.fNetSNMPJSON().exists()) {
Disk.writeToDisk("{\"1.3.6\":\"dod\"}", DirectoryStructureNetSNMP.fNetSNMPJSON());
} else if (HexString.fileToByteArray(DirectoryStructureNetSNMP.fNetSNMPJSON()).length == 0) {
Disk.writeToDisk("{\"1.3.6\":\"dod\"}", DirectoryStructureNetSNMP.fNetSNMPJSON());
}
</DeepExtract>
|
Oscar
|
positive
|
public static EmptyContentBuilder<HTMLBRElement> br(Element element) {
return new EmptyContentBuilder<>(cast(element));
}
|
<DeepExtract>
return new EmptyContentBuilder<>(cast(element));
</DeepExtract>
|
elemento
|
positive
|
@Override
public void update(float time) throws Exception {
if (null != m_pCallFunc) {
m_pCallFunc.method();
}
}
|
<DeepExtract>
if (null != m_pCallFunc) {
m_pCallFunc.method();
}
</DeepExtract>
|
cocos2d-java
|
positive
|
public void setxBegin(float xBegin) {
this.xBegin = xBegin;
xCurrent = xBegin;
isFirstList = true;
points1.clear();
points2.clear();
}
|
<DeepExtract>
xCurrent = xBegin;
isFirstList = true;
points1.clear();
points2.clear();
</DeepExtract>
|
university
|
positive
|
protected MockMvc getMockMvc(String entityClass, HttpMethod method) throws MockNotFoundException {
if (customControllersMockMvc == null)
return getDefaultMockMvc();
Map<HttpMethod, MockMvc> map = customControllersMockMvc.get(entityClass);
if (map != null && map.containsKey(method)) {
MockMvc mockMvc2 = map.get(method);
if (mockMvc2 == null) {
throw new MockNotFoundException(String.format("Mock Not Found for entity %s and method %s", entityClass, method.toString()));
}
return mockMvc2;
}
return this.mockMvc;
}
|
<DeepExtract>
return this.mockMvc;
</DeepExtract>
|
crud-rest-gen
|
positive
|
private static void copyHtmlResources(File parent) throws IOException {
File file = new File(parent, "Benchmarks.html");
if (!file.exists()) {
writeToFile(readResource("charts/" + "Benchmarks.html"), file);
}
File file = new File(parent, "benchmarks.js");
if (!file.exists()) {
writeToFile(readResource("charts/" + "benchmarks.js"), file);
}
File file = new File(parent, "benchmarks.css");
if (!file.exists()) {
writeToFile(readResource("charts/" + "benchmarks.css"), file);
}
File file = new File(parent, "parser.css");
if (!file.exists()) {
writeToFile(readResource("charts/" + "parser.css"), file);
}
}
|
<DeepExtract>
File file = new File(parent, "Benchmarks.html");
if (!file.exists()) {
writeToFile(readResource("charts/" + "Benchmarks.html"), file);
}
</DeepExtract>
<DeepExtract>
File file = new File(parent, "benchmarks.js");
if (!file.exists()) {
writeToFile(readResource("charts/" + "benchmarks.js"), file);
}
</DeepExtract>
<DeepExtract>
File file = new File(parent, "benchmarks.css");
if (!file.exists()) {
writeToFile(readResource("charts/" + "benchmarks.css"), file);
}
</DeepExtract>
<DeepExtract>
File file = new File(parent, "parser.css");
if (!file.exists()) {
writeToFile(readResource("charts/" + "parser.css"), file);
}
</DeepExtract>
|
minimal-json
|
positive
|
public TextBuilder font(String family) {
mSpans.put(new TypefaceSpan(family).getClass(), new TypefaceSpan(family));
return this;
}
|
<DeepExtract>
mSpans.put(new TypefaceSpan(family).getClass(), new TypefaceSpan(family));
</DeepExtract>
|
rich-text-android
|
positive
|
public E remove() {
E x = pollFirst();
if (x == null)
throw new NoSuchElementException();
return x;
}
|
<DeepExtract>
E x = pollFirst();
if (x == null)
throw new NoSuchElementException();
return x;
</DeepExtract>
|
Android-Universal-Image-Loader-Modify
|
positive
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.