before
stringlengths 14
203k
| after
stringlengths 37
104k
| repo
stringlengths 2
50
| type
stringclasses 1
value |
|---|---|---|---|
public void recruitPlayersFromStr(String playersStr) {
String[] players = playersStr.split("%\n");
String currLine = players[0];
int i = 0;
while (!currLine.equals("END_RECRUITS")) {
loadPlayerSaveData(currLine, false);
currLine = players[++i];
}
int star;
walkon = true;
int needs = minQBs - teamQBs.size();
for (int i = 0; i < teamQBs.size(); ++i) {
if (teamQBs.get(i).isRedshirt || teamQBs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamQBs.add(new PlayerQB(league.getRandName(), 1, star, this, walkon));
}
needs = minRBs - teamRBs.size();
for (int i = 0; i < teamRBs.size(); ++i) {
if (teamRBs.get(i).isRedshirt || teamRBs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamRBs.add(new PlayerRB(league.getRandName(), 1, star, this, walkon));
}
needs = minWRs - teamWRs.size();
for (int i = 0; i < teamWRs.size(); ++i) {
if (teamWRs.get(i).isRedshirt || teamWRs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamWRs.add(new PlayerWR(league.getRandName(), 1, star, this, walkon));
}
needs = minTEs - teamTEs.size();
for (int i = 0; i < teamTEs.size(); ++i) {
if (teamTEs.get(i).isRedshirt || teamTEs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamTEs.add(new PlayerTE(league.getRandName(), 1, star, this, walkon));
}
needs = minOLs - teamOLs.size();
for (int i = 0; i < teamOLs.size(); ++i) {
if (teamOLs.get(i).isRedshirt || teamOLs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamOLs.add(new PlayerOL(league.getRandName(), 1, star, this, walkon));
}
needs = minKs - teamKs.size();
for (int i = 0; i < teamKs.size(); ++i) {
if (teamKs.get(i).isRedshirt || teamKs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamKs.add(new PlayerK(league.getRandName(), 1, star, this, walkon));
}
needs = minDLs - teamDLs.size();
for (int i = 0; i < teamDLs.size(); ++i) {
if (teamDLs.get(i).isRedshirt || teamDLs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamDLs.add(new PlayerDL(league.getRandName(), 1, star, this, walkon));
}
needs = minLBs - teamLBs.size();
for (int i = 0; i < teamLBs.size(); ++i) {
if (teamLBs.get(i).isRedshirt || teamLBs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamLBs.add(new PlayerLB(league.getRandName(), 1, star, this, walkon));
}
needs = minCBs - teamCBs.size();
for (int i = 0; i < teamCBs.size(); ++i) {
if (teamCBs.get(i).isRedshirt || teamCBs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamCBs.add(new PlayerCB(league.getRandName(), 1, star, this, walkon));
}
needs = minSs - teamSs.size();
for (int i = 0; i < teamSs.size(); ++i) {
if (teamSs.get(i).isRedshirt || teamSs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamSs.add(new PlayerS(league.getRandName(), 1, star, this, walkon));
}
sortPlayers();
}
|
<DeepExtract>
int star;
walkon = true;
int needs = minQBs - teamQBs.size();
for (int i = 0; i < teamQBs.size(); ++i) {
if (teamQBs.get(i).isRedshirt || teamQBs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamQBs.add(new PlayerQB(league.getRandName(), 1, star, this, walkon));
}
needs = minRBs - teamRBs.size();
for (int i = 0; i < teamRBs.size(); ++i) {
if (teamRBs.get(i).isRedshirt || teamRBs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamRBs.add(new PlayerRB(league.getRandName(), 1, star, this, walkon));
}
needs = minWRs - teamWRs.size();
for (int i = 0; i < teamWRs.size(); ++i) {
if (teamWRs.get(i).isRedshirt || teamWRs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamWRs.add(new PlayerWR(league.getRandName(), 1, star, this, walkon));
}
needs = minTEs - teamTEs.size();
for (int i = 0; i < teamTEs.size(); ++i) {
if (teamTEs.get(i).isRedshirt || teamTEs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamTEs.add(new PlayerTE(league.getRandName(), 1, star, this, walkon));
}
needs = minOLs - teamOLs.size();
for (int i = 0; i < teamOLs.size(); ++i) {
if (teamOLs.get(i).isRedshirt || teamOLs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamOLs.add(new PlayerOL(league.getRandName(), 1, star, this, walkon));
}
needs = minKs - teamKs.size();
for (int i = 0; i < teamKs.size(); ++i) {
if (teamKs.get(i).isRedshirt || teamKs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamKs.add(new PlayerK(league.getRandName(), 1, star, this, walkon));
}
needs = minDLs - teamDLs.size();
for (int i = 0; i < teamDLs.size(); ++i) {
if (teamDLs.get(i).isRedshirt || teamDLs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamDLs.add(new PlayerDL(league.getRandName(), 1, star, this, walkon));
}
needs = minLBs - teamLBs.size();
for (int i = 0; i < teamLBs.size(); ++i) {
if (teamLBs.get(i).isRedshirt || teamLBs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamLBs.add(new PlayerLB(league.getRandName(), 1, star, this, walkon));
}
needs = minCBs - teamCBs.size();
for (int i = 0; i < teamCBs.size(); ++i) {
if (teamCBs.get(i).isRedshirt || teamCBs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamCBs.add(new PlayerCB(league.getRandName(), 1, star, this, walkon));
}
needs = minSs - teamSs.size();
for (int i = 0; i < teamSs.size(); ++i) {
if (teamSs.get(i).isRedshirt || teamSs.get(i).isTransfer) {
needs++;
}
}
for (int i = 0; i < needs; ++i) {
star = (int) Math.random() * 2 + 1;
teamSs.add(new PlayerS(league.getRandName(), 1, star, this, walkon));
}
sortPlayers();
</DeepExtract>
|
CFB-Coach-v1
|
positive
|
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
helper = new RestaurantHelper(this);
prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (model != null) {
stopManagingCursor(model);
model.close();
}
model = helper.getAll(prefs.getString("sort_order", "name"));
startManagingCursor(model);
adapter = new RestaurantAdapter(model);
setListAdapter(adapter);
prefs.registerOnSharedPreferenceChangeListener(prefListener);
}
|
<DeepExtract>
if (model != null) {
stopManagingCursor(model);
model.close();
}
model = helper.getAll(prefs.getString("sort_order", "name"));
startManagingCursor(model);
adapter = new RestaurantAdapter(model);
setListAdapter(adapter);
</DeepExtract>
|
cw-lunchlist
|
positive
|
public void testRegularExpressionsMatch_CMSIncrementalDutyCycleMin() {
assertMatchesExactly("-XX:CMSIncrementalDutyCycleMin=1", 1);
assertMatchesExactly("-XX:CMSIncrementalDutyCycleMin=11", 1);
assertMatchesExactly("-XX:CMSIncrementalDutyCycleMin=1k", 0);
assertMatchesExactly("-XX:CMSIncrementalDutyCycleMin=1m", 0);
assertMatchesExactly("-XX:CMSIncrementalDutyCycleMin=1g", 0);
assertMatchesExactly("-XX:CMSIncrementalDutyCycleMin=1K", 0);
assertMatchesExactly("-XX:CMSIncrementalDutyCycleMin=1M", 0);
assertMatchesExactly("-XX:CMSIncrementalDutyCycleMin=1G", 0);
}
|
<DeepExtract>
assertMatchesExactly("-XX:CMSIncrementalDutyCycleMin=1", 1);
</DeepExtract>
<DeepExtract>
assertMatchesExactly("-XX:CMSIncrementalDutyCycleMin=11", 1);
</DeepExtract>
<DeepExtract>
assertMatchesExactly("-XX:CMSIncrementalDutyCycleMin=1k", 0);
</DeepExtract>
<DeepExtract>
assertMatchesExactly("-XX:CMSIncrementalDutyCycleMin=1m", 0);
</DeepExtract>
<DeepExtract>
assertMatchesExactly("-XX:CMSIncrementalDutyCycleMin=1g", 0);
</DeepExtract>
<DeepExtract>
assertMatchesExactly("-XX:CMSIncrementalDutyCycleMin=1K", 0);
</DeepExtract>
<DeepExtract>
assertMatchesExactly("-XX:CMSIncrementalDutyCycleMin=1M", 0);
</DeepExtract>
<DeepExtract>
assertMatchesExactly("-XX:CMSIncrementalDutyCycleMin=1G", 0);
</DeepExtract>
|
groningen
|
positive
|
@Override
protected Object readResolve() {
return new XmlMapper(this);
}
|
<DeepExtract>
return new XmlMapper(this);
</DeepExtract>
|
jackson-dataformat-xml
|
positive
|
public Iterator<ActionTreeElement> getChildren() {
return getChildren();
}
|
<DeepExtract>
return getChildren();
</DeepExtract>
|
SudoQ
|
positive
|
public Builder newBuilderForType() {
return Builder.create();
}
|
<DeepExtract>
return Builder.create();
</DeepExtract>
|
NettyProtobufWebsocket
|
positive
|
public void printHelp() {
CommandLineHelper.printHelp(getUsage(), getOptions());
System.out.println("commands:");
System.out.println(String.format(" %-16s %s", "help", "print help for command"));
for (Map.Entry<String, Command> entry : commands.entrySet()) {
printHelpEntry(entry);
}
}
|
<DeepExtract>
System.out.println(String.format(" %-16s %s", "help", "print help for command"));
</DeepExtract>
|
robot
|
positive
|
@Override
public void visitMethodInsn(final int opcode, final String owner, final String name, final String desc, boolean itf) {
if (needsProbe(this.counter.currentInstructionCount())) {
this.methodVisitor.visitLdcInsn(this.classId);
this.methodVisitor.visitLdcInsn(this.probeCount + this.probeOffset);
this.methodVisitor.visitMethodInsn(Opcodes.INVOKESTATIC, CodeCoverageStore.CLASS_NAME, "visitSingleProbe", "(II)V", false);
this.probeCount++;
}
super.visitMethodInsn(opcode, owner, name, desc, itf);
}
|
<DeepExtract>
if (needsProbe(this.counter.currentInstructionCount())) {
this.methodVisitor.visitLdcInsn(this.classId);
this.methodVisitor.visitLdcInsn(this.probeCount + this.probeOffset);
this.methodVisitor.visitMethodInsn(Opcodes.INVOKESTATIC, CodeCoverageStore.CLASS_NAME, "visitSingleProbe", "(II)V", false);
this.probeCount++;
}
</DeepExtract>
|
QuickTheories
|
positive
|
@Override
protected void onStart() {
super.onStart();
mServerSyncController.enableAutomaticSync();
mServerSyncController.requestImmediateSync();
checkGpsPermission();
}
|
<DeepExtract>
checkGpsPermission();
</DeepExtract>
|
idocare-android
|
positive
|
private static boolean multipleSelValueContains(String nodeName, String valueName, Element node, Hashtable<String, String[]> multipleSelValues) {
String[] values = multipleSelValues.get(nodeName);
if (values == null) {
Element multNode = XformBuilder.getElement(node, "xforms_value");
if (multNode != null) {
String value = XformBuilder.getTextValue(multNode);
if (value == null)
value = "";
values = value.split(XformBuilder.MULTIPLE_SELECT_VALUE_SEPARATOR);
multipleSelValues.put(nodeName, values);
}
}
for (String value : values) {
if (!value.equalsIgnoreCase(valueName))
continue;
return true;
}
return false;
}
|
<DeepExtract>
for (String value : values) {
if (!value.equalsIgnoreCase(valueName))
continue;
return true;
}
return false;
</DeepExtract>
|
buendia
|
positive
|
@Nullable
public static String embeddedCommandTextOf(@NotNull PsiElement injected) {
if (findChildOfType(getParentOfType(injected, ConcordionStatement.class), ConcordionEmbeddedCommand.class) == null) {
return null;
}
String text = findChildOfType(getParentOfType(injected, ConcordionStatement.class), ConcordionEmbeddedCommand.class).getText();
if ("?=".equals(text)) {
return ASSERT_EQUALS_SPINAL.text();
}
int prefix = text.indexOf(':');
int assignment = text.indexOf('=');
return text.substring(prefix + 1, assignment);
}
|
<DeepExtract>
if (findChildOfType(getParentOfType(injected, ConcordionStatement.class), ConcordionEmbeddedCommand.class) == null) {
return null;
}
String text = findChildOfType(getParentOfType(injected, ConcordionStatement.class), ConcordionEmbeddedCommand.class).getText();
if ("?=".equals(text)) {
return ASSERT_EQUALS_SPINAL.text();
}
int prefix = text.indexOf(':');
int assignment = text.indexOf('=');
return text.substring(prefix + 1, assignment);
</DeepExtract>
|
idea-concordion-support
|
positive
|
@Subscribe
public void onSaveSearchEvent(SaveSearchEvent event) {
DDGApplication.getDB().insertSavedSearch(event.pageTitle, event.pageData);
BusProvider.getInstance().post(new SyncAdaptersEvent());
Toast.makeText(this, R.string.ToastSaveSearch, Toast.LENGTH_SHORT).show();
}
|
<DeepExtract>
DDGApplication.getDB().insertSavedSearch(event.pageTitle, event.pageData);
</DeepExtract>
<DeepExtract>
BusProvider.getInstance().post(new SyncAdaptersEvent());
</DeepExtract>
|
android-search-and-stories
|
positive
|
public void setCharacterSpacing(final float spacing) throws IOException {
final int byteCount = NumberFormatUtil.formatFloatFast(spacing, m_aFormatDecimal.getMaximumFractionDigits(), m_aFormatBuffer);
if (byteCount == -1) {
write(m_aFormatDecimal.format(spacing));
} else {
m_aOS.write(m_aFormatBuffer, 0, byteCount);
}
m_aOS.write(' ');
writeOperator((byte) 'T', (byte) 'c');
}
|
<DeepExtract>
final int byteCount = NumberFormatUtil.formatFloatFast(spacing, m_aFormatDecimal.getMaximumFractionDigits(), m_aFormatBuffer);
if (byteCount == -1) {
write(m_aFormatDecimal.format(spacing));
} else {
m_aOS.write(m_aFormatBuffer, 0, byteCount);
}
m_aOS.write(' ');
</DeepExtract>
|
ph-pdf-layout
|
positive
|
@Override
public void apply(final com.mongodb.async.SingleResultCallback<Long> callback) {
wrapped.skip(bytesToSkip).subscribe(new Subscriber<Long>() {
private Long result = null;
@Override
public void onSubscribe(final Subscription s) {
s.request(1);
}
@Override
public void onNext(final Long skipped) {
result = skipped;
}
@Override
public void onError(final Throwable t) {
callback.onResult(null, t);
}
@Override
public void onComplete() {
callback.onResult(result, null);
}
});
}
|
<DeepExtract>
wrapped.skip(bytesToSkip).subscribe(new Subscriber<Long>() {
private Long result = null;
@Override
public void onSubscribe(final Subscription s) {
s.request(1);
}
@Override
public void onNext(final Long skipped) {
result = skipped;
}
@Override
public void onError(final Throwable t) {
callback.onResult(null, t);
}
@Override
public void onComplete() {
callback.onResult(result, null);
}
});
</DeepExtract>
|
mongo-java-driver-reactivestreams
|
positive
|
protected void setLinkBoth(FramedVertex vertex, String... labels) {
if (null != null) {
bothE(labels).mark().bothV().retain(null).back().removeAll();
} else {
bothE(labels).removeAll();
}
if (vertex != null) {
linkBoth(vertex, labels);
}
}
|
<DeepExtract>
if (null != null) {
bothE(labels).mark().bothV().retain(null).back().removeAll();
} else {
bothE(labels).removeAll();
}
</DeepExtract>
|
totorom
|
positive
|
public synchronized void destory() {
if (started) {
for (Module module : modules.values()) {
try {
module.stop();
} catch (Exception e) {
e.printStackTrace();
LOGGER.error("Failed to stop module,module name {}.cause :{}", module, e.getMessage(), e);
}
}
started = false;
}
for (Module module : modules.values()) {
try {
module.destroy();
} catch (Exception e) {
e.printStackTrace();
LOGGER.error("Failed to destory module,module name {}.cause :{}", module, e.getMessage(), e);
}
}
taskEngine.shutdown();
}
|
<DeepExtract>
if (started) {
for (Module module : modules.values()) {
try {
module.stop();
} catch (Exception e) {
e.printStackTrace();
LOGGER.error("Failed to stop module,module name {}.cause :{}", module, e.getMessage(), e);
}
}
started = false;
}
</DeepExtract>
|
anima
|
positive
|
public static void dateConcept(String token, Concept concept, boolean required, Locale locale, FormField formField) {
String bindName = token;
Element controlNode = getParentNode(formField, locale).createElement(XformBuilder.NAMESPACE_XFORMS, null);
controlNode.setName(XformBuilder.CONTROL_INPUT);
controlNode.setAttribute(null, XformBuilder.ATTRIBUTE_BIND, bindName);
Element bindNode = (Element) bindings.get(bindName);
if (bindNode == null) {
System.out.println("NULL bindNode for: " + bindName);
return null;
}
bindNode.setAttribute(null, XformBuilder.ATTRIBUTE_TYPE, XformBuilder.DATA_TYPE_DATE);
Element labelNode = getParentNode(formField, locale).createElement(XformBuilder.NAMESPACE_XFORMS, null);
labelNode.setName(XformBuilder.NODE_LABEL);
ConceptName name = concept.getBestName(locale);
if (name == null) {
name = concept.getName();
}
labelNode.addChild(Element.TEXT, name.getName());
controlNode.addChild(Element.ELEMENT, labelNode);
addHintNode(labelNode, concept);
XformBuilder.addControl(getParentNode(formField, locale), controlNode);
if (concept instanceof ConceptNumeric) {
ConceptNumeric numericConcept = (ConceptNumeric) concept;
if (numericConcept.isPrecise()) {
Double minInclusive = numericConcept.getLowAbsolute();
Double maxInclusive = numericConcept.getHiAbsolute();
if (!(minInclusive == null && maxInclusive == null)) {
String lower = (minInclusive == null ? "" : FormSchemaFragment.numericToString(minInclusive, numericConcept.isPrecise()));
String upper = (maxInclusive == null ? "" : FormSchemaFragment.numericToString(maxInclusive, numericConcept.isPrecise()));
bindNode.setAttribute(null, XformBuilder.ATTRIBUTE_CONSTRAINT, ". >= " + lower + " and . <= " + upper);
bindNode.setAttribute(null, (XformsUtil.isJavaRosaSaveFormat() ? "jr:constraintMsg" : XformBuilder.ATTRIBUTE_MESSAGE), "value should be between " + lower + " and " + upper + " inclusive");
}
}
}
return controlNode;
}
|
<DeepExtract>
String bindName = token;
Element controlNode = getParentNode(formField, locale).createElement(XformBuilder.NAMESPACE_XFORMS, null);
controlNode.setName(XformBuilder.CONTROL_INPUT);
controlNode.setAttribute(null, XformBuilder.ATTRIBUTE_BIND, bindName);
Element bindNode = (Element) bindings.get(bindName);
if (bindNode == null) {
System.out.println("NULL bindNode for: " + bindName);
return null;
}
bindNode.setAttribute(null, XformBuilder.ATTRIBUTE_TYPE, XformBuilder.DATA_TYPE_DATE);
Element labelNode = getParentNode(formField, locale).createElement(XformBuilder.NAMESPACE_XFORMS, null);
labelNode.setName(XformBuilder.NODE_LABEL);
ConceptName name = concept.getBestName(locale);
if (name == null) {
name = concept.getName();
}
labelNode.addChild(Element.TEXT, name.getName());
controlNode.addChild(Element.ELEMENT, labelNode);
addHintNode(labelNode, concept);
XformBuilder.addControl(getParentNode(formField, locale), controlNode);
if (concept instanceof ConceptNumeric) {
ConceptNumeric numericConcept = (ConceptNumeric) concept;
if (numericConcept.isPrecise()) {
Double minInclusive = numericConcept.getLowAbsolute();
Double maxInclusive = numericConcept.getHiAbsolute();
if (!(minInclusive == null && maxInclusive == null)) {
String lower = (minInclusive == null ? "" : FormSchemaFragment.numericToString(minInclusive, numericConcept.isPrecise()));
String upper = (maxInclusive == null ? "" : FormSchemaFragment.numericToString(maxInclusive, numericConcept.isPrecise()));
bindNode.setAttribute(null, XformBuilder.ATTRIBUTE_CONSTRAINT, ". >= " + lower + " and . <= " + upper);
bindNode.setAttribute(null, (XformsUtil.isJavaRosaSaveFormat() ? "jr:constraintMsg" : XformBuilder.ATTRIBUTE_MESSAGE), "value should be between " + lower + " and " + upper + " inclusive");
}
}
}
return controlNode;
</DeepExtract>
|
buendia
|
positive
|
@Override
public List<SchoolRoom> getSchoolRoomList() {
List<E> viewTypeList = new ArrayList<E>();
SQLiteDatabase database = this.database.openDatabase(false);
Cursor query = this.database.queryWithLoginSetKey(database, DatabaseViewTypeConstants.TABLE_SCHOOL_ROOMS_NAME);
int indexID = query.getColumnIndex(DatabaseViewTypeConstants.ID);
int indexName = query.getColumnIndex(DatabaseViewTypeConstants.NAME);
int indexLongName = query.getColumnIndex(DatabaseViewTypeConstants.LONG_NAME);
int indexForeColor = query.getColumnIndex(DatabaseViewTypeConstants.FORE_COLOR);
int indexBackColor = query.getColumnIndex(DatabaseViewTypeConstants.BACK_COLOR);
while (query.moveToNext()) {
int id = query.getInt(indexID);
String name = query.getString(indexName);
String longName = query.getString(indexLongName);
String foreColor = query.getString(indexForeColor);
String backColor = query.getString(indexBackColor);
ViewType viewType = getViewType(DatabaseViewTypeConstants.TABLE_SCHOOL_ROOMS_NAME);
viewType.setId(id);
viewType.setName(name);
viewType.setLongName(longName);
viewType.setForeColor(foreColor);
viewType.setBackColor(backColor);
viewTypeList.add((E) viewType);
}
query.close();
this.database.closeDatabase(database);
return viewTypeList;
}
|
<DeepExtract>
List<E> viewTypeList = new ArrayList<E>();
SQLiteDatabase database = this.database.openDatabase(false);
Cursor query = this.database.queryWithLoginSetKey(database, DatabaseViewTypeConstants.TABLE_SCHOOL_ROOMS_NAME);
int indexID = query.getColumnIndex(DatabaseViewTypeConstants.ID);
int indexName = query.getColumnIndex(DatabaseViewTypeConstants.NAME);
int indexLongName = query.getColumnIndex(DatabaseViewTypeConstants.LONG_NAME);
int indexForeColor = query.getColumnIndex(DatabaseViewTypeConstants.FORE_COLOR);
int indexBackColor = query.getColumnIndex(DatabaseViewTypeConstants.BACK_COLOR);
while (query.moveToNext()) {
int id = query.getInt(indexID);
String name = query.getString(indexName);
String longName = query.getString(indexLongName);
String foreColor = query.getString(indexForeColor);
String backColor = query.getString(indexBackColor);
ViewType viewType = getViewType(DatabaseViewTypeConstants.TABLE_SCHOOL_ROOMS_NAME);
viewType.setId(id);
viewType.setName(name);
viewType.setLongName(longName);
viewType.setForeColor(foreColor);
viewType.setBackColor(backColor);
viewTypeList.add((E) viewType);
}
query.close();
this.database.closeDatabase(database);
return viewTypeList;
</DeepExtract>
|
SchoolPlanner4Untis
|
positive
|
@Override
public void onRefresh() {
sfl.setRefreshing(true);
songsAdapter.clearAll();
new GetSongs().execute();
}
|
<DeepExtract>
sfl.setRefreshing(true);
songsAdapter.clearAll();
new GetSongs().execute();
</DeepExtract>
|
Android-development-with-example
|
positive
|
public void _testEmailUserName() throws ValidatorException {
final ValueBean info = new ValueBean();
info.setValue("[email protected]");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("[email protected]");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("[email protected]");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("[email protected]");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("[email protected]");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("[email protected]");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("[email protected]");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("joe*@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("joe'@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("joe(@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("joe)@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("joe,@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("joe%[email protected]");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("joe;@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("[email protected]");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("joe&@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("[email protected]");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("\"joe.\"@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("\"joe+\"@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("\"joe!\"@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("\"joe*\"@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("\"joe'\"@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("\"joe(\"@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("\"joe)\"@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("\"joe,\"@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("\"joe%45\"@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("\"joe;\"@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("\"joe?\"@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("\"joe&\"@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
info.setValue("\"joe=\"@apache.org");
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
}
|
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (false ? "passed" : "failed") + ".", (false ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
<DeepExtract>
final Validator validator = new Validator(resources, FORM_KEY);
validator.setParameter(Validator.BEAN_PARAM, info);
final ValidatorResults results = validator.validate();
assertNotNull("Results are null.", results);
final ValidatorResult result = results.getValidatorResult("value");
assertNotNull(ACTION + " value ValidatorResult should not be null.", result);
assertTrue("Value " + info.getValue() + " ValidatorResult should contain the '" + ACTION + "' action.", result.containsAction(ACTION));
assertTrue("Value " + info.getValue() + "ValidatorResult for the '" + ACTION + "' action should have " + (true ? "passed" : "failed") + ".", (true ? result.isValid(ACTION) : !result.isValid(ACTION)));
</DeepExtract>
|
commons-validator
|
positive
|
public static LDMsgBase generateLTPMessage(BigDecimal ltp, BigDecimal bestBid, BigDecimal bestAsk) {
LDMsgInternal m = new LDMsgInternal();
m.type = 't';
m.price = ltp;
m.bestAsk = bestAsk;
m.bestBid = bestBid;
LDMsgBase m = new LDMsgBase();
m.timestamp = System.currentTimeMillis();
m.message = m;
m.error = null;
return m;
}
|
<DeepExtract>
LDMsgBase m = new LDMsgBase();
m.timestamp = System.currentTimeMillis();
m.message = m;
m.error = null;
return m;
</DeepExtract>
|
lodax
|
positive
|
public static boolean moveFile(File srcFile, File destFile) {
return copyOrMoveFile(getFileByPath(srcFile), getFileByPath(destFile), true);
}
|
<DeepExtract>
return copyOrMoveFile(getFileByPath(srcFile), getFileByPath(destFile), true);
</DeepExtract>
|
MDFolder
|
positive
|
@Override
public List<T> queryForList(String path, Map<String, String> vars) {
String method = path.split("\\.")[1];
String sql = dgraphMapperManager.getSql(path);
if (null == vars) {
vars = null;
} else {
Map<String, String> newVars = new HashMap<>();
vars.forEach((k, v) -> {
if (k.startsWith(VAR_PREFIX)) {
newVars.put(k, v);
} else {
newVars.put(VAR_PREFIX + k, v);
}
});
vars = newVars;
}
log.info("execute query sql:{}, vars:{}, method:{}", sql, vars, method);
DgraphProto.Response response = dgraphClientAdapter.query(sql, vars);
JSONObject jsonResult = JSON.parseObject(response.getJson().toStringUtf8());
try {
return dgraphParser.extractJSONArray(jsonResult.getJSONArray(method));
} catch (ClassCastException e) {
log.error("execute query error! method:{}, jsonResult:{}", method, jsonResult, e);
}
return Collections.emptyList();
}
|
<DeepExtract>
if (null == vars) {
vars = null;
} else {
Map<String, String> newVars = new HashMap<>();
vars.forEach((k, v) -> {
if (k.startsWith(VAR_PREFIX)) {
newVars.put(k, v);
} else {
newVars.put(VAR_PREFIX + k, v);
}
});
vars = newVars;
}
</DeepExtract>
|
Arc
|
positive
|
private Object doConvertResult(Result result, Format format) {
Schema type = result.getType();
if (type == null)
return null;
String reference;
Category category = type.getCategory();
switch(category) {
case BASIC:
reference = type.getName();
case DICTIONARY:
reference = format.getMapPrefix() + " " + doConvertReference(type.getComponent(), format) + format.getMapSuffix();
case ARRAY:
reference = format.getArrPrefix() + doConvertReference(type.getComponent(), format) + format.getArrSuffix();
case ENUM:
reference = format.getRefPrefix() + (format.isPkgIncluded() ? type.getPkg() + "." : "") + type.getName() + format.getRefSuffix();
case OBJECT:
reference = format.getRefPrefix() + (format.isPkgIncluded() ? type.getPkg() + "." : "") + type.getName() + format.getRefSuffix();
default:
reference = null;
}
String description = result.getDescription();
if (format.isCanonical() || !StringKit.isBlank(description)) {
Map<String, String> map = new LinkedHashMap<>();
if (reference != null)
map.put("type", reference);
if (!StringKit.isBlank(description))
map.put("description", description);
return map;
}
return reference;
}
|
<DeepExtract>
String reference;
Category category = type.getCategory();
switch(category) {
case BASIC:
reference = type.getName();
case DICTIONARY:
reference = format.getMapPrefix() + " " + doConvertReference(type.getComponent(), format) + format.getMapSuffix();
case ARRAY:
reference = format.getArrPrefix() + doConvertReference(type.getComponent(), format) + format.getArrSuffix();
case ENUM:
reference = format.getRefPrefix() + (format.isPkgIncluded() ? type.getPkg() + "." : "") + type.getName() + format.getRefSuffix();
case OBJECT:
reference = format.getRefPrefix() + (format.isPkgIncluded() ? type.getPkg() + "." : "") + type.getName() + format.getRefSuffix();
default:
reference = null;
}
</DeepExtract>
|
halo-docs
|
positive
|
@Override
public void string(String s) {
sort = s;
sfl.setRefreshing(true);
videoAdapter.clearAll();
new GetVideos(sort).execute(getContentResolver());
}
|
<DeepExtract>
sfl.setRefreshing(true);
videoAdapter.clearAll();
new GetVideos(sort).execute(getContentResolver());
</DeepExtract>
|
Android-development-with-example
|
positive
|
public void finishDefaultPanel() {
iYPos = iYPos + 100;
addToPanel(new JPanel(), 0, 250, 1, 1, VERTICAL, -1.0, -1.0, -1);
}
|
<DeepExtract>
addToPanel(new JPanel(), 0, 250, 1, 1, VERTICAL, -1.0, -1.0, -1);
</DeepExtract>
|
gomule
|
positive
|
private int matchTokenAt_23(Token token, ParserContext context) {
if (match_EOF(context, token)) {
endRule(context, RuleType.Group);
endRule(context, RuleType.SimulationPeriod);
endRule(context, RuleType.Simulation_Definition);
endRule(context, RuleType.Plan);
build(context, token);
return 36;
}
if (match_TableRow(context, token)) {
startRule(context, RuleType.DataTable);
build(context, token);
return 24;
}
if (match_DocStringSeparator(context, token)) {
startRule(context, RuleType.DocString);
build(context, token);
return 25;
}
if (match_RunnersLine(context, token)) {
startRule(context, RuleType.Runners);
build(context, token);
return 27;
}
if (match_CountLine(context, token)) {
startRule(context, RuleType.Count);
build(context, token);
return 28;
}
if (match_GroupLine(context, token)) {
endRule(context, RuleType.Group);
startRule(context, RuleType.Group);
build(context, token);
return 23;
}
if (match_TimeLine(context, token)) {
endRule(context, RuleType.Group);
startRule(context, RuleType.Time);
build(context, token);
return 29;
}
if (match_SynchronizedLine(context, token)) {
endRule(context, RuleType.Group);
startRule(context, RuleType.Synchronized);
build(context, token);
return 32;
}
if (match_RampUpLine(context, token)) {
endRule(context, RuleType.Group);
startRule(context, RuleType.RampUp);
build(context, token);
return 33;
}
if (match_RampDownLine(context, token)) {
endRule(context, RuleType.Group);
startRule(context, RuleType.RampDown);
build(context, token);
return 34;
}
if (match_RandomWaitLine(context, token)) {
endRule(context, RuleType.Group);
startRule(context, RuleType.RandomWait);
build(context, token);
return 35;
}
if (match_TagLine(context, token)) {
endRule(context, RuleType.Group);
endRule(context, RuleType.SimulationPeriod);
endRule(context, RuleType.Simulation_Definition);
startRule(context, RuleType.Simulation_Definition);
startRule(context, RuleType.Tags);
build(context, token);
return 6;
}
if (match_SimulationLine(context, token)) {
endRule(context, RuleType.Group);
endRule(context, RuleType.SimulationPeriod);
endRule(context, RuleType.Simulation_Definition);
startRule(context, RuleType.Simulation_Definition);
startRule(context, RuleType.Simulation);
build(context, token);
return 7;
}
if (match_SimulationPeriodLine(context, token)) {
endRule(context, RuleType.Group);
endRule(context, RuleType.SimulationPeriod);
endRule(context, RuleType.Simulation_Definition);
startRule(context, RuleType.Simulation_Definition);
startRule(context, RuleType.SimulationPeriod);
build(context, token);
return 20;
}
if (match_Comment(context, token)) {
build(context, token);
return 23;
}
if (match_Empty(context, token)) {
build(context, token);
return 23;
}
final String stateComment = "State: 23 - SaladDocument:0>Plan:1>Simulation_Definition:1>__alt0:1>SimulationPeriod:2>Group:0>#GroupLine:0";
token.detach();
List<String> expectedTokens = asList("#EOF", "#TableRow", "#DocStringSeparator", "#RunnersLine", "#CountLine", "#GroupLine", "#TimeLine", "#SynchronizedLine", "#RampUpLine", "#RampDownLine", "#RandomWaitLine", "#TagLine", "#SimulationLine", "#SimulationPeriodLine", "#Comment", "#Empty");
ParserException error = token.isEOF() ? new ParserException.UnexpectedEOFException(token, expectedTokens, stateComment) : new ParserException.UnexpectedTokenException(token, expectedTokens, stateComment);
if (stopAtFirstError)
throw error;
context.errors.add(error);
if (context.errors.size() > 10)
throw new ParserException.CompositeParserException(context.errors);
return 23;
}
|
<DeepExtract>
context.errors.add(error);
if (context.errors.size() > 10)
throw new ParserException.CompositeParserException(context.errors);
</DeepExtract>
|
cucumber-performance
|
positive
|
@Override
public void write(DataOutput out) throws IOException {
if (!this.bloom.hasArray()) {
throw new IOException("Only writes ByteBuffer with underlying array.");
}
out.write(bloom.array(), bloom.arrayOffset(), bloom.limit());
}
|
<DeepExtract>
if (!this.bloom.hasArray()) {
throw new IOException("Only writes ByteBuffer with underlying array.");
}
out.write(bloom.array(), bloom.arrayOffset(), bloom.limit());
</DeepExtract>
|
beatles
|
positive
|
private static String getRandomBase62UUID() {
UUID uuid = UUID.randomUUID();
ByteBuffer uuidBytes = ByteBuffer.wrap(new byte[16]);
uuidBytes.putLong(uuid.getMostSignificantBits());
uuidBytes.putLong(uuid.getLeastSignificantBits());
StringBuffer buffer = new StringBuffer(Base64.toBase64String(uuidBytes.array()).length() * 2);
for (int i = 0; i < Base64.toBase64String(uuidBytes.array()).length(); i++) {
char c = Base64.toBase64String(uuidBytes.array()).charAt(i);
switch(c) {
case 'i':
buffer.append("ii");
break;
case '+':
buffer.append("ip");
break;
case '/':
buffer.append("is");
break;
case '=':
buffer.append("ie");
break;
case '\n':
break;
default:
buffer.append(c);
}
}
return buffer.toString();
}
|
<DeepExtract>
StringBuffer buffer = new StringBuffer(Base64.toBase64String(uuidBytes.array()).length() * 2);
for (int i = 0; i < Base64.toBase64String(uuidBytes.array()).length(); i++) {
char c = Base64.toBase64String(uuidBytes.array()).charAt(i);
switch(c) {
case 'i':
buffer.append("ii");
break;
case '+':
buffer.append("ip");
break;
case '/':
buffer.append("is");
break;
case '=':
buffer.append("ie");
break;
case '\n':
break;
default:
buffer.append(c);
}
}
return buffer.toString();
</DeepExtract>
|
OpenAs2App
|
positive
|
@Override
public void push_back(Buffer buffer, int start, int number) {
int size = newSizeInWords(number);
if (size >= this.buffer.length) {
long[] oldBuffer = this.buffer;
this.buffer = new long[size];
System.arraycopy(oldBuffer, 0, this.buffer, 0, oldBuffer.length);
}
if (buffer instanceof LongArray) {
long[] data = ((LongArray) buffer).buffer;
System.arraycopy(data, start, this.buffer, this.actualSizeInWords, number);
} else {
for (int i = 0; i < number; ++i) {
this.buffer[this.actualSizeInWords + i] = buffer.getWord(start + i);
}
}
this.actualSizeInWords += number;
}
|
<DeepExtract>
int size = newSizeInWords(number);
if (size >= this.buffer.length) {
long[] oldBuffer = this.buffer;
this.buffer = new long[size];
System.arraycopy(oldBuffer, 0, this.buffer, 0, oldBuffer.length);
}
</DeepExtract>
|
javaewah
|
positive
|
public R onEventBefore(M event, I userData, boolean exceptionOnUnexpectedEvent) throws ExecutionException, InterruptedException {
var prevState = mapStates.get(currentState);
var nextState = prevState.onEvent(event, exceptionOnUnexpectedEvent);
var prevState = mapStates.get(currentState);
var nextState = mapStates.get(nextState.state);
final R res = nextState.actor == null ? null : nextState.actor.sendMessageReturn(new FsmContext<>(prevState.state, nextState.state, event, userData)).get();
currentState = nextState.state;
return res;
}
|
<DeepExtract>
var prevState = mapStates.get(currentState);
var nextState = mapStates.get(nextState.state);
final R res = nextState.actor == null ? null : nextState.actor.sendMessageReturn(new FsmContext<>(prevState.state, nextState.state, event, userData)).get();
currentState = nextState.state;
return res;
</DeepExtract>
|
Fibry
|
positive
|
@Override
public Response<Long> create(SysUserSaveParam param) {
SysUser sysUser = new SysUser();
BeanCopier.copy(param, sysUser);
sysUser.setState(Boolean.FALSE);
sysUser.setPassword(new BCryptPasswordEncoder().encode(sysUser.getPassword()));
sysUser.setCreateTime(DateUtils.dateTime());
sysUser.setUpdateTime(DateUtils.dateTime());
sysUser.setDeleteStatus(Boolean.FALSE);
sysUserMapper.insert(sysUser);
param.getRoleIds().forEach(id -> {
LambdaQueryWrapper<SysRole> sysRoleWrapper = new LambdaQueryWrapper<SysRole>().eq(SysRole::getDeleteStatus, Boolean.FALSE).eq(SysRole::getSysUserId, sysUser.getId());
List<SysRole> sysRoles = sysRoleMapper.selectList(sysRoleWrapper);
LocalDateTime time = DateUtils.dateTime();
sysRoles.forEach(item -> {
SysRole sysRole = new SysRole();
sysRole.setRoleId(id);
sysRole.setSysUserId(sysUser.getId());
sysRole.setCreateTime(time);
sysRole.setUpdateTime(time);
sysRole.setDeleteStatus(Boolean.FALSE);
sysRoleMapper.insert(sysRole);
});
});
return Response.toResponse(sysUser.getId());
}
|
<DeepExtract>
param.getRoleIds().forEach(id -> {
LambdaQueryWrapper<SysRole> sysRoleWrapper = new LambdaQueryWrapper<SysRole>().eq(SysRole::getDeleteStatus, Boolean.FALSE).eq(SysRole::getSysUserId, sysUser.getId());
List<SysRole> sysRoles = sysRoleMapper.selectList(sysRoleWrapper);
LocalDateTime time = DateUtils.dateTime();
sysRoles.forEach(item -> {
SysRole sysRole = new SysRole();
sysRole.setRoleId(id);
sysRole.setSysUserId(sysUser.getId());
sysRole.setCreateTime(time);
sysRole.setUpdateTime(time);
sysRole.setDeleteStatus(Boolean.FALSE);
sysRoleMapper.insert(sysRole);
});
});
</DeepExtract>
|
spring-cloud-shop
|
positive
|
public short getShort() {
int end = _buf.position() + 2;
if (end > _buf.limit()) {
throw new BufferUnderflowException();
}
short v = _buf.getShort();
return v;
}
|
<DeepExtract>
int end = _buf.position() + 2;
if (end > _buf.limit()) {
throw new BufferUnderflowException();
}
</DeepExtract>
|
netx
|
positive
|
public void setPath(String path) {
if (isParsedUri)
return;
mUri = Uri.newBuilder(getURI()).build();
if (isParsedUri)
return;
isParsedUri = true;
mUri = mUri.builder().setPath(path).build();
}
|
<DeepExtract>
if (isParsedUri)
return;
mUri = Uri.newBuilder(getURI()).build();
if (isParsedUri)
return;
isParsedUri = true;
</DeepExtract>
|
AndServer
|
positive
|
private Bitmap scaleBitmapToHeightWithMinWidth(Bitmap bitmap, int newHeight, int minWidth) {
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int lowestDimension = width < height ? width : height;
Bitmap croppedBitmap = Bitmap.createBitmap(bitmap, 0, 0, lowestDimension, lowestDimension);
return croppedBitmap;
int imgHeight = bitmap.getHeight();
int imgWidth = bitmap.getWidth();
float scaleFactor = ((float) newHeight) / imgHeight;
int newWidth = (int) (imgWidth * scaleFactor);
bitmap = Bitmap.createScaledBitmap(bitmap, newWidth, newHeight, true);
Bitmap scaledBitmap = bitmap;
int imgWidth = bitmap.getWidth();
if (imgWidth < minWidth) {
float scaleFactor = ((float) minWidth) / imgWidth;
int imgHeight = bitmap.getHeight();
int newHeight = (int) (imgHeight * scaleFactor);
scaledBitmap = Bitmap.createScaledBitmap(bitmap, minWidth, newHeight, true);
}
return scaledBitmap;
return bitmap;
}
|
<DeepExtract>
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int lowestDimension = width < height ? width : height;
Bitmap croppedBitmap = Bitmap.createBitmap(bitmap, 0, 0, lowestDimension, lowestDimension);
return croppedBitmap;
</DeepExtract>
<DeepExtract>
Bitmap scaledBitmap = bitmap;
int imgWidth = bitmap.getWidth();
if (imgWidth < minWidth) {
float scaleFactor = ((float) minWidth) / imgWidth;
int imgHeight = bitmap.getHeight();
int newHeight = (int) (imgHeight * scaleFactor);
scaledBitmap = Bitmap.createScaledBitmap(bitmap, minWidth, newHeight, true);
}
return scaledBitmap;
</DeepExtract>
|
Canorum
|
positive
|
private void updateTestCases(long problemId, String testCases, boolean isExactlyMatch) {
checkpointMapper.deleteCheckpoint(problemId);
JSONArray jsonArray = JSON.parseArray(testCases);
for (int i = 0; i < jsonArray.size(); ++i) {
JSONObject testCase = jsonArray.getJSONObject(i);
int score = 100 / jsonArray.size();
if (i == jsonArray.size() - 1) {
score = 100 - score * i;
}
String input = testCase.getString("input");
String output = testCase.getString("output");
Checkpoint checkpoint = new Checkpoint(problemId, i, isExactlyMatch, score, input, output);
checkpointMapper.createCheckpoint(checkpoint);
}
}
|
<DeepExtract>
JSONArray jsonArray = JSON.parseArray(testCases);
for (int i = 0; i < jsonArray.size(); ++i) {
JSONObject testCase = jsonArray.getJSONObject(i);
int score = 100 / jsonArray.size();
if (i == jsonArray.size() - 1) {
score = 100 - score * i;
}
String input = testCase.getString("input");
String output = testCase.getString("output");
Checkpoint checkpoint = new Checkpoint(problemId, i, isExactlyMatch, score, input, output);
checkpointMapper.createCheckpoint(checkpoint);
}
</DeepExtract>
|
voj
|
positive
|
public void setWidgetType(OField.WidgetType type) {
mWidget = type;
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
removeAllViews();
setOrientation(VERTICAL);
if (mEditable) {
edtText = new EditText(mContext);
edtText.setTypeface(OControlHelper.lightFont());
edtText.setLayoutParams(params);
edtText.setBackgroundColor(Color.TRANSPARENT);
edtText.setPadding(0, 10, 10, 10);
edtText.setHint(getLabel());
edtText.setOnFocusChangeListener(this);
if (textSize > -1) {
edtText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
}
if (appearance > -1) {
edtText.setTextAppearance(mContext, appearance);
}
edtText.setTextColor(textColor);
addView(edtText);
} else {
txvText = new TextView(mContext);
txvText.setTypeface(OControlHelper.lightFont());
txvText.setLayoutParams(params);
txvText.setBackgroundColor(Color.TRANSPARENT);
txvText.setPadding(0, 10, 10, 10);
if (textSize > -1) {
txvText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
}
if (appearance > -1) {
txvText.setTextAppearance(mContext, appearance);
}
txvText.setTextColor(textColor);
addView(txvText);
}
}
|
<DeepExtract>
LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
removeAllViews();
setOrientation(VERTICAL);
if (mEditable) {
edtText = new EditText(mContext);
edtText.setTypeface(OControlHelper.lightFont());
edtText.setLayoutParams(params);
edtText.setBackgroundColor(Color.TRANSPARENT);
edtText.setPadding(0, 10, 10, 10);
edtText.setHint(getLabel());
edtText.setOnFocusChangeListener(this);
if (textSize > -1) {
edtText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
}
if (appearance > -1) {
edtText.setTextAppearance(mContext, appearance);
}
edtText.setTextColor(textColor);
addView(edtText);
} else {
txvText = new TextView(mContext);
txvText.setTypeface(OControlHelper.lightFont());
txvText.setLayoutParams(params);
txvText.setBackgroundColor(Color.TRANSPARENT);
txvText.setPadding(0, 10, 10, 10);
if (textSize > -1) {
txvText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize);
}
if (appearance > -1) {
txvText.setTextAppearance(mContext, appearance);
}
txvText.setTextColor(textColor);
addView(txvText);
}
</DeepExtract>
|
hr
|
positive
|
protected String _bean() {
if (_setter != null) {
return _setter.getDeclaringClass().getName();
}
return _name;
}
|
<DeepExtract>
return _name;
</DeepExtract>
|
jackson-jr
|
positive
|
@Override
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
if (closed) {
LogUtils.w("onBindViewHolder on closed adapter");
return;
}
AbstractAnnotationActivity activity = ObjectUtils.requireNonNull(mReference.get());
mCursor.moveToPosition(position);
AnnotationViewHolder annotationViewHolder = (AnnotationViewHolder) holder;
String osis = mCursor.getString(columnOsisIndex);
String book = BibleUtils.getBook(osis);
annotationViewHolder.humanView.setText(activity.getHuman(book));
String osis = mCursor.getString(columnOsisIndex);
String book = BibleUtils.getBook(osis);
String chapter = BibleUtils.getChapter(osis);
String verses = mCursor.getString(columnVersesIndex);
String string = activity.getString(R.string.annotation_verses, chapter, verses);
annotationViewHolder.verseView.setText(string);
OsisItem osisItem = new OsisItem(book, chapter);
osisItem.verseStart = BibleUtils.getVerse(verses);
osisItem.verses = verses;
annotationViewHolder.cardView.setTag(osisItem);
CharSequence text = null;
if (!mCursor.isNull(columnDateIndex)) {
try {
text = DateUtils.formatSameDayTime(mCursor.getLong(columnDateIndex) * 1000, System.currentTimeMillis(), DateFormat.SHORT, DateFormat.SHORT);
} catch (RuntimeException e) {
LogUtils.d("cannot format time", e);
}
}
annotationViewHolder.dateView.setText(text);
String content = activity.prepareContent(mCursor);
if (TextUtils.isEmpty(content)) {
BibleApplication application = (BibleApplication) activity.getApplication();
String bookChapterVerse = annotationViewHolder.humanView.getText() + " " + annotationViewHolder.verseView.getText();
content = activity.getString(R.string.annotation_no_book, bookChapterVerse, application.getFullname());
annotationViewHolder.contentView.setText(content);
} else {
content = BibleUtils.fix((BibleApplication) activity.getApplication(), content);
annotationViewHolder.contentView.setText(content, TextView.BufferType.SPANNABLE);
if (!TextUtils.isEmpty(mQuery)) {
selectQuery(annotationViewHolder.contentView, content);
}
}
}
|
<DeepExtract>
String osis = mCursor.getString(columnOsisIndex);
String book = BibleUtils.getBook(osis);
annotationViewHolder.humanView.setText(activity.getHuman(book));
</DeepExtract>
<DeepExtract>
String osis = mCursor.getString(columnOsisIndex);
String book = BibleUtils.getBook(osis);
String chapter = BibleUtils.getChapter(osis);
String verses = mCursor.getString(columnVersesIndex);
String string = activity.getString(R.string.annotation_verses, chapter, verses);
annotationViewHolder.verseView.setText(string);
OsisItem osisItem = new OsisItem(book, chapter);
osisItem.verseStart = BibleUtils.getVerse(verses);
osisItem.verses = verses;
annotationViewHolder.cardView.setTag(osisItem);
</DeepExtract>
<DeepExtract>
CharSequence text = null;
if (!mCursor.isNull(columnDateIndex)) {
try {
text = DateUtils.formatSameDayTime(mCursor.getLong(columnDateIndex) * 1000, System.currentTimeMillis(), DateFormat.SHORT, DateFormat.SHORT);
} catch (RuntimeException e) {
LogUtils.d("cannot format time", e);
}
}
annotationViewHolder.dateView.setText(text);
</DeepExtract>
<DeepExtract>
String content = activity.prepareContent(mCursor);
if (TextUtils.isEmpty(content)) {
BibleApplication application = (BibleApplication) activity.getApplication();
String bookChapterVerse = annotationViewHolder.humanView.getText() + " " + annotationViewHolder.verseView.getText();
content = activity.getString(R.string.annotation_no_book, bookChapterVerse, application.getFullname());
annotationViewHolder.contentView.setText(content);
} else {
content = BibleUtils.fix((BibleApplication) activity.getApplication(), content);
annotationViewHolder.contentView.setText(content, TextView.BufferType.SPANNABLE);
if (!TextUtils.isEmpty(mQuery)) {
selectQuery(annotationViewHolder.contentView, content);
}
}
</DeepExtract>
|
bible
|
positive
|
public static byte[] encryptMD2(byte[] data) {
if (data == null || data.length <= 0) {
return null;
}
try {
MessageDigest md = MessageDigest.getInstance("MD2");
md.update(data);
return md.digest();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
}
|
<DeepExtract>
if (data == null || data.length <= 0) {
return null;
}
try {
MessageDigest md = MessageDigest.getInstance("MD2");
md.update(data);
return md.digest();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
return null;
}
</DeepExtract>
|
Engine
|
positive
|
public void authorizeDesktop() {
URI uri;
try {
requestToken = scribe.getRequestToken();
String url = "https://api.twitter.com/oauth/authorize?oauth_token=" + requestToken.getToken();
uri = new URI(url);
} catch (URISyntaxException e) {
throw new TwitterException(e);
}
try {
Class<?> desktopClass = Class.forName("java.awt.Desktop");
Method getDesktop = desktopClass.getMethod("getDesktop");
Object d = getDesktop.invoke(null);
Method browse = desktopClass.getMethod("browse", URI.class);
browse.invoke(d, uri);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
|
<DeepExtract>
URI uri;
try {
requestToken = scribe.getRequestToken();
String url = "https://api.twitter.com/oauth/authorize?oauth_token=" + requestToken.getToken();
uri = new URI(url);
} catch (URISyntaxException e) {
throw new TwitterException(e);
}
</DeepExtract>
|
JTwitter
|
positive
|
@Override
protected void fromWireData(ByteBuffer buffer) {
AsfRsspSessionStatus s = Code.fromBuffer(AsfRsspSessionStatus.class, buffer);
this.status = s;
return this;
assertWireBytesZero(buffer, 3);
this.clientSessionId = buffer.getInt();
return this;
if (!AsfRsspSessionStatus.NO_ERROR.equals(s))
return;
byte[] integrityData = null;
buffer.get(integrityData);
}
|
<DeepExtract>
this.status = s;
return this;
</DeepExtract>
<DeepExtract>
this.clientSessionId = buffer.getInt();
return this;
</DeepExtract>
|
ipmi4j
|
positive
|
public Criteria andKilometersBetween(Integer value1, Integer value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "kilometers" + " cannot be null");
}
criteria.add(new Criterion("kilometers between", value1, value2));
return (Criteria) this;
}
|
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "kilometers" + " cannot be null");
}
criteria.add(new Criterion("kilometers between", value1, value2));
</DeepExtract>
|
health_online
|
positive
|
@PreUpdate
public void updateDateUpdated() {
if (now() != null) {
this.dateUpdated = now();
}
}
|
<DeepExtract>
if (now() != null) {
this.dateUpdated = now();
}
</DeepExtract>
|
starter-kit-spring-maven
|
positive
|
public static void emptyScenarioRegistry() {
instance.driverFactory.clear();
instance.windowManager.clear();
instance.scenarioRegistry.clear();
instance.scenarioName = null;
}
|
<DeepExtract>
instance.driverFactory.clear();
instance.windowManager.clear();
instance.scenarioRegistry.clear();
instance.scenarioName = null;
</DeepExtract>
|
NoraUi
|
positive
|
protected RegressionTree buildDepthLimitedTree(Instances instances, int maxDepth) {
RegressionTree tree = new RegressionTree();
final int limit = 5;
double[] stats = new double[4];
if (maxDepth <= 0) {
getStats(instances, stats);
tree.root = new RegressionTreeLeaf(stats[1]);
return tree;
}
Map<TreeNode, Dataset> datasets = new HashMap<>();
Map<TreeNode, Integer> depths = new HashMap<>();
Dataset dataset = null;
if (this.cache != null) {
dataset = Dataset.create(this.cache, instances);
} else {
dataset = Dataset.create(instances);
}
boolean stdIs0 = getStats(dataset.instances, stats);
final double totalWeights = stats[0];
final double sum = stats[1];
final double weightedMean = stats[2];
if (dataset.instances.size() < limit || stdIs0) {
TreeNode node = new RegressionTreeLeaf(weightedMean);
tree.root = node;
}
double bestEval = Double.POSITIVE_INFINITY;
List<IntDoublePair> splits = new ArrayList<>();
List<Attribute> attributes = dataset.instances.getAttributes();
for (int j = 0; j < attributes.size(); j++) {
int attIndex = attributes.get(j).getIndex();
String attName = attributes.get(j).getName();
List<IntDoublePair> sortedList = dataset.sortedLists.get(attName);
List<Double> uniqueValues = new ArrayList<>(sortedList.size());
List<DoublePair> histogram = new ArrayList<>(sortedList.size());
getHistogram(dataset.instances, sortedList, uniqueValues, totalWeights, sum, histogram);
if (uniqueValues.size() > 1) {
DoublePair split = split(uniqueValues, histogram, totalWeights, sum);
if (split.v2 <= bestEval) {
IntDoublePair splitPoint = new IntDoublePair(attIndex, split.v1);
if (split.v2 < bestEval) {
splits.clear();
bestEval = split.v2;
}
splits.add(splitPoint);
}
}
}
if (bestEval < Double.POSITIVE_INFINITY) {
Random rand = Random.getInstance();
IntDoublePair splitPoint = splits.get(rand.nextInt(splits.size()));
int attIndex = splitPoint.v1;
TreeNode node = new TreeInteriorNode(attIndex, splitPoint.v2);
stats[3] = bestEval + totalWeights * weightedMean * weightedMean;
tree.root = node;
} else {
TreeNode node = new RegressionTreeLeaf(weightedMean);
tree.root = node;
}
PriorityQueue<Element<TreeNode>> q = new PriorityQueue<>();
q.add(new Element<TreeNode>(tree.root, stats[2]));
datasets.put(tree.root, dataset);
depths.put(tree.root, 0);
while (!q.isEmpty()) {
Element<TreeNode> elemt = q.remove();
TreeNode node = elemt.element;
Dataset data = datasets.get(node);
int depth = depths.get(node);
if (!node.isLeaf()) {
TreeInteriorNode interiorNode = (TreeInteriorNode) node;
Dataset left = new Dataset(data.instances);
Dataset right = new Dataset(data.instances);
split(data, interiorNode, left, right);
if (depth >= maxDepth - 1) {
getStats(left.instances, stats);
interiorNode.left = new RegressionTreeLeaf(stats[2]);
getStats(right.instances, stats);
interiorNode.right = new RegressionTreeLeaf(stats[2]);
} else {
interiorNode.left = createNode(left, limit, stats);
if (!interiorNode.left.isLeaf()) {
q.add(new Element<TreeNode>(interiorNode.left, stats[3]));
datasets.put(interiorNode.left, left);
depths.put(interiorNode.left, depth + 1);
}
interiorNode.right = createNode(right, limit, stats);
if (!interiorNode.right.isLeaf()) {
q.add(new Element<TreeNode>(interiorNode.right, stats[3]));
datasets.put(interiorNode.right, right);
depths.put(interiorNode.right, depth + 1);
}
}
}
}
return tree;
}
|
<DeepExtract>
boolean stdIs0 = getStats(dataset.instances, stats);
final double totalWeights = stats[0];
final double sum = stats[1];
final double weightedMean = stats[2];
if (dataset.instances.size() < limit || stdIs0) {
TreeNode node = new RegressionTreeLeaf(weightedMean);
tree.root = node;
}
double bestEval = Double.POSITIVE_INFINITY;
List<IntDoublePair> splits = new ArrayList<>();
List<Attribute> attributes = dataset.instances.getAttributes();
for (int j = 0; j < attributes.size(); j++) {
int attIndex = attributes.get(j).getIndex();
String attName = attributes.get(j).getName();
List<IntDoublePair> sortedList = dataset.sortedLists.get(attName);
List<Double> uniqueValues = new ArrayList<>(sortedList.size());
List<DoublePair> histogram = new ArrayList<>(sortedList.size());
getHistogram(dataset.instances, sortedList, uniqueValues, totalWeights, sum, histogram);
if (uniqueValues.size() > 1) {
DoublePair split = split(uniqueValues, histogram, totalWeights, sum);
if (split.v2 <= bestEval) {
IntDoublePair splitPoint = new IntDoublePair(attIndex, split.v1);
if (split.v2 < bestEval) {
splits.clear();
bestEval = split.v2;
}
splits.add(splitPoint);
}
}
}
if (bestEval < Double.POSITIVE_INFINITY) {
Random rand = Random.getInstance();
IntDoublePair splitPoint = splits.get(rand.nextInt(splits.size()));
int attIndex = splitPoint.v1;
TreeNode node = new TreeInteriorNode(attIndex, splitPoint.v2);
stats[3] = bestEval + totalWeights * weightedMean * weightedMean;
tree.root = node;
} else {
TreeNode node = new RegressionTreeLeaf(weightedMean);
tree.root = node;
}
</DeepExtract>
|
mltk
|
positive
|
public void play(MP3Metadata metadata, boolean add) {
GuiDevTools.debugLog("Resetting Player.");
playing = false;
if (player != null)
player.close();
player = null;
if (add)
addToLastPlayed(metadata);
playingMP3 = metadata;
paused = false;
queued = true;
}
|
<DeepExtract>
GuiDevTools.debugLog("Resetting Player.");
playing = false;
if (player != null)
player.close();
player = null;
</DeepExtract>
|
MineTunes
|
positive
|
public void ensureCapacity(long numBits) {
if (bits.length < bits2words(numBits)) {
bits = grow(bits, bits2words(numBits));
}
}
|
<DeepExtract>
if (bits.length < bits2words(numBits)) {
bits = grow(bits, bits2words(numBits));
}
</DeepExtract>
|
hppc
|
positive
|
public void resetZoom() {
normalizedScale = 1;
Drawable drawable = getDrawable();
if (drawable == null || drawable.getIntrinsicWidth() == 0 || drawable.getIntrinsicHeight() == 0) {
return;
}
if (matrix == null || prevMatrix == null) {
return;
}
int drawableWidth = drawable.getIntrinsicWidth();
int drawableHeight = drawable.getIntrinsicHeight();
float scaleX = (float) viewWidth / drawableWidth;
float scaleY = (float) viewHeight / drawableHeight;
switch(mScaleType) {
case CENTER:
scaleX = scaleY = 1;
break;
case CENTER_CROP:
scaleX = scaleY = Math.max(scaleX, scaleY);
break;
case CENTER_INSIDE:
scaleX = scaleY = Math.min(1, Math.min(scaleX, scaleY));
case FIT_CENTER:
scaleX = scaleY = Math.min(scaleX, scaleY);
break;
case FIT_XY:
break;
default:
throw new UnsupportedOperationException("TouchImageView does not support FIT_START or FIT_END");
}
float redundantXSpace = viewWidth - (scaleX * drawableWidth);
float redundantYSpace = viewHeight - (scaleY * drawableHeight);
matchViewWidth = viewWidth - redundantXSpace;
matchViewHeight = viewHeight - redundantYSpace;
if (!isZoomed() && !imageRenderedAtLeastOnce) {
matrix.setScale(scaleX, scaleY);
matrix.postTranslate(redundantXSpace / 2, redundantYSpace / 2);
normalizedScale = 1;
} else {
if (prevMatchViewWidth == 0 || prevMatchViewHeight == 0) {
savePreviousImageValues();
}
prevMatrix.getValues(m);
m[Matrix.MSCALE_X] = matchViewWidth / drawableWidth * normalizedScale;
m[Matrix.MSCALE_Y] = matchViewHeight / drawableHeight * normalizedScale;
float transX = m[Matrix.MTRANS_X];
float transY = m[Matrix.MTRANS_Y];
float prevActualWidth = prevMatchViewWidth * normalizedScale;
float actualWidth = getImageWidth();
translateMatrixAfterRotate(Matrix.MTRANS_X, transX, prevActualWidth, actualWidth, prevViewWidth, viewWidth, drawableWidth);
float prevActualHeight = prevMatchViewHeight * normalizedScale;
float actualHeight = getImageHeight();
translateMatrixAfterRotate(Matrix.MTRANS_Y, transY, prevActualHeight, actualHeight, prevViewHeight, viewHeight, drawableHeight);
matrix.setValues(m);
}
fixTrans();
setImageMatrix(matrix);
}
|
<DeepExtract>
Drawable drawable = getDrawable();
if (drawable == null || drawable.getIntrinsicWidth() == 0 || drawable.getIntrinsicHeight() == 0) {
return;
}
if (matrix == null || prevMatrix == null) {
return;
}
int drawableWidth = drawable.getIntrinsicWidth();
int drawableHeight = drawable.getIntrinsicHeight();
float scaleX = (float) viewWidth / drawableWidth;
float scaleY = (float) viewHeight / drawableHeight;
switch(mScaleType) {
case CENTER:
scaleX = scaleY = 1;
break;
case CENTER_CROP:
scaleX = scaleY = Math.max(scaleX, scaleY);
break;
case CENTER_INSIDE:
scaleX = scaleY = Math.min(1, Math.min(scaleX, scaleY));
case FIT_CENTER:
scaleX = scaleY = Math.min(scaleX, scaleY);
break;
case FIT_XY:
break;
default:
throw new UnsupportedOperationException("TouchImageView does not support FIT_START or FIT_END");
}
float redundantXSpace = viewWidth - (scaleX * drawableWidth);
float redundantYSpace = viewHeight - (scaleY * drawableHeight);
matchViewWidth = viewWidth - redundantXSpace;
matchViewHeight = viewHeight - redundantYSpace;
if (!isZoomed() && !imageRenderedAtLeastOnce) {
matrix.setScale(scaleX, scaleY);
matrix.postTranslate(redundantXSpace / 2, redundantYSpace / 2);
normalizedScale = 1;
} else {
if (prevMatchViewWidth == 0 || prevMatchViewHeight == 0) {
savePreviousImageValues();
}
prevMatrix.getValues(m);
m[Matrix.MSCALE_X] = matchViewWidth / drawableWidth * normalizedScale;
m[Matrix.MSCALE_Y] = matchViewHeight / drawableHeight * normalizedScale;
float transX = m[Matrix.MTRANS_X];
float transY = m[Matrix.MTRANS_Y];
float prevActualWidth = prevMatchViewWidth * normalizedScale;
float actualWidth = getImageWidth();
translateMatrixAfterRotate(Matrix.MTRANS_X, transX, prevActualWidth, actualWidth, prevViewWidth, viewWidth, drawableWidth);
float prevActualHeight = prevMatchViewHeight * normalizedScale;
float actualHeight = getImageHeight();
translateMatrixAfterRotate(Matrix.MTRANS_Y, transY, prevActualHeight, actualHeight, prevViewHeight, viewHeight, drawableHeight);
matrix.setValues(m);
}
fixTrans();
setImageMatrix(matrix);
</DeepExtract>
|
social-app-android
|
positive
|
@Override
public void onNumberFormatErrorEvent(NumberFormatErrorEvent event) {
String message = "Invalid value: \"" + event.getInvalidValue() + "\", it must be: " + event.getExpectedType().getText();
messageLabel.setText(message);
highlight(this);
}
|
<DeepExtract>
messageLabel.setText(message);
highlight(this);
</DeepExtract>
|
nevada
|
positive
|
public void any(String fromPath, String toPath, Status status) {
http.get(fromPath, redirectRoute(toPath, status));
http.post(fromPath, redirectRoute(toPath, status));
http.put(fromPath, redirectRoute(toPath, status));
http.delete(fromPath, redirectRoute(toPath, status));
}
|
<DeepExtract>
http.get(fromPath, redirectRoute(toPath, status));
</DeepExtract>
<DeepExtract>
http.post(fromPath, redirectRoute(toPath, status));
</DeepExtract>
<DeepExtract>
http.put(fromPath, redirectRoute(toPath, status));
</DeepExtract>
<DeepExtract>
http.delete(fromPath, redirectRoute(toPath, status));
</DeepExtract>
|
spark
|
positive
|
public double max() {
double maxCount = true ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY;
for (Entry<E, Double> entry : entries.entrySet()) {
if ((true && entry.getValue() > maxCount) || (!true && entry.getValue() < maxCount)) {
maxCount = entry.getValue();
}
}
return maxCount;
}
|
<DeepExtract>
double maxCount = true ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY;
for (Entry<E, Double> entry : entries.entrySet()) {
if ((true && entry.getValue() > maxCount) || (!true && entry.getValue() < maxCount)) {
maxCount = entry.getValue();
}
}
return maxCount;
</DeepExtract>
|
Canova
|
positive
|
public static SchemaAndValueProducer createKeySchemaAndValueProvider(final MongoSourceConfig config) {
OutputFormat outputFormat = false ? config.getValueOutputFormat() : config.getKeyOutputFormat();
switch(outputFormat) {
case JSON:
return new RawJsonStringSchemaAndValueProducer(config.getJsonWriterSettings());
case BSON:
return new BsonSchemaAndValueProducer();
case SCHEMA:
String jsonSchema = false ? config.getString(OUTPUT_SCHEMA_VALUE_CONFIG) : config.getString(OUTPUT_SCHEMA_KEY_CONFIG);
if (false && config.getBoolean(OUTPUT_SCHEMA_INFER_VALUE_CONFIG)) {
return new InferSchemaAndValueProducer(config.getJsonWriterSettings());
}
return new AvroSchemaAndValueProducer(jsonSchema, config.getJsonWriterSettings());
default:
throw new ConnectException("Unsupported key output format" + config.getKeyOutputFormat());
}
}
|
<DeepExtract>
OutputFormat outputFormat = false ? config.getValueOutputFormat() : config.getKeyOutputFormat();
switch(outputFormat) {
case JSON:
return new RawJsonStringSchemaAndValueProducer(config.getJsonWriterSettings());
case BSON:
return new BsonSchemaAndValueProducer();
case SCHEMA:
String jsonSchema = false ? config.getString(OUTPUT_SCHEMA_VALUE_CONFIG) : config.getString(OUTPUT_SCHEMA_KEY_CONFIG);
if (false && config.getBoolean(OUTPUT_SCHEMA_INFER_VALUE_CONFIG)) {
return new InferSchemaAndValueProducer(config.getJsonWriterSettings());
}
return new AvroSchemaAndValueProducer(jsonSchema, config.getJsonWriterSettings());
default:
throw new ConnectException("Unsupported key output format" + config.getKeyOutputFormat());
}
</DeepExtract>
|
mongo-kafka
|
positive
|
public void deliverToEmail(Long mailId, String email) throws NotFoundException {
EmailAddress ea = this.em.getEmailAddress(email);
Mail mail = this.em.get(Mail.class, mailId);
log.log(Level.FINE, "Delivering mailId {0} to email {1}", new Object[] { mail.getId(), ea.getId() });
try {
Address destination = new InternetAddress(ea.getId());
SubEthaMessage msg = new SubEthaMessage(this.mailSession, mail.getContent());
String listEmail = mail.getList().getEmail();
log.log(Level.FINE, "Delivering msg of contentType {0}", msg.getContentType());
msg.addXLoop(listEmail);
msg.setHeader(SubEthaMessage.HDR_PRECEDENCE, "list");
byte[] token = this.encryptor.encryptString(ea.getId());
String verp = VERPAddress.encodeVERP(listEmail, token);
msg.setEnvelopeFrom(verp);
msg.setHeader(SubEthaMessage.HDR_ERRORS_TO, verp);
msg.setHeader(SubEthaMessage.HDR_SENDER, listEmail);
this.filterRunner.onSend(msg, mail);
this.detacher.attach(msg);
Transport.send(msg, new Address[] { destination });
ea.bounceDecay();
} catch (IgnoreException ex) {
LogRecord logRecord = new LogRecord(Level.FINE, "Ignoring mail {0}");
logRecord.setParameters(new Object[] { mail });
logRecord.setThrown(ex);
log.log(logRecord);
} catch (MessagingException ex) {
LogRecord logRecord = new LogRecord(Level.SEVERE, "Error delivering mailId {0} to address {1}");
logRecord.setParameters(new Object[] { mail.getId(), ea.getId() });
logRecord.setThrown(ex);
log.log(logRecord);
throw new RuntimeException(ex);
} catch (IOException ex) {
LogRecord logRecord = new LogRecord(Level.SEVERE, "Error delivering mailId {0} to address {1}");
logRecord.setParameters(new Object[] { mail.getId(), ea.getId() });
logRecord.setThrown(ex);
log.log(logRecord);
throw new RuntimeException(ex);
}
}
|
<DeepExtract>
log.log(Level.FINE, "Delivering mailId {0} to email {1}", new Object[] { mail.getId(), ea.getId() });
try {
Address destination = new InternetAddress(ea.getId());
SubEthaMessage msg = new SubEthaMessage(this.mailSession, mail.getContent());
String listEmail = mail.getList().getEmail();
log.log(Level.FINE, "Delivering msg of contentType {0}", msg.getContentType());
msg.addXLoop(listEmail);
msg.setHeader(SubEthaMessage.HDR_PRECEDENCE, "list");
byte[] token = this.encryptor.encryptString(ea.getId());
String verp = VERPAddress.encodeVERP(listEmail, token);
msg.setEnvelopeFrom(verp);
msg.setHeader(SubEthaMessage.HDR_ERRORS_TO, verp);
msg.setHeader(SubEthaMessage.HDR_SENDER, listEmail);
this.filterRunner.onSend(msg, mail);
this.detacher.attach(msg);
Transport.send(msg, new Address[] { destination });
ea.bounceDecay();
} catch (IgnoreException ex) {
LogRecord logRecord = new LogRecord(Level.FINE, "Ignoring mail {0}");
logRecord.setParameters(new Object[] { mail });
logRecord.setThrown(ex);
log.log(logRecord);
} catch (MessagingException ex) {
LogRecord logRecord = new LogRecord(Level.SEVERE, "Error delivering mailId {0} to address {1}");
logRecord.setParameters(new Object[] { mail.getId(), ea.getId() });
logRecord.setThrown(ex);
log.log(logRecord);
throw new RuntimeException(ex);
} catch (IOException ex) {
LogRecord logRecord = new LogRecord(Level.SEVERE, "Error delivering mailId {0} to address {1}");
logRecord.setParameters(new Object[] { mail.getId(), ea.getId() });
logRecord.setThrown(ex);
log.log(logRecord);
throw new RuntimeException(ex);
}
</DeepExtract>
|
subetha
|
positive
|
protected void recordFeedback(DrawContext dc, KMLController model, Vec4 modelPoint, Rectangle screenRect) {
if (!this.isFeedbackEnabled(dc, model))
return;
model.setValue(AVKey.FEEDBACK_REFERENCE_POINT, modelPoint);
model.setValue(AVKey.FEEDBACK_SCREEN_BOUNDS, screenRect);
}
|
<DeepExtract>
model.setValue(AVKey.FEEDBACK_REFERENCE_POINT, modelPoint);
model.setValue(AVKey.FEEDBACK_SCREEN_BOUNDS, screenRect);
</DeepExtract>
|
sdt
|
positive
|
public void maximizeSecondaryContent() {
mLastPrimaryContentSize = getPrimaryContentSize();
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mPrimaryContent.getLayoutParams();
LinearLayout.LayoutParams secondaryParams = (LinearLayout.LayoutParams) mSecondaryContent.getLayoutParams();
params.weight = 0;
secondaryParams.weight = 1;
if (getOrientation() == VERTICAL) {
params.height = 1;
} else {
params.width = 1;
}
mPrimaryContent.setLayoutParams(params);
mSecondaryContent.setLayoutParams(secondaryParams);
}
|
<DeepExtract>
mLastPrimaryContentSize = getPrimaryContentSize();
LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mPrimaryContent.getLayoutParams();
LinearLayout.LayoutParams secondaryParams = (LinearLayout.LayoutParams) mSecondaryContent.getLayoutParams();
params.weight = 0;
secondaryParams.weight = 1;
if (getOrientation() == VERTICAL) {
params.height = 1;
} else {
params.width = 1;
}
mPrimaryContent.setLayoutParams(params);
mSecondaryContent.setLayoutParams(secondaryParams);
</DeepExtract>
|
Sefaria-Android
|
positive
|
public void setGraphNodeColorInfo(String info) {
nodeColorInfo = info;
StringBuilder status = new StringBuilder("<html><b>Graph: </b>");
status.append(String.valueOf(numberOfNodes));
status.append(" people: ");
status.append(graphScope);
if (GraphManager.getInstance().singletonNodesRemoved()) {
status.append(" (singleton nodes removed)");
}
status.append(" ");
if (nodeSizeInfo.equals(nodeColorInfo) && !nodeSizeInfo.isEmpty()) {
status.append("<b>Node Size and Color:</b> ");
status.append(nodeSizeInfo);
} else {
if (!nodeSizeInfo.isEmpty()) {
status.append("<b>Node Size:</b> ");
status.append(nodeSizeInfo);
}
status.append(" ");
if (!nodeColorInfo.isEmpty()) {
status.append("<b>Node Color:</b> ");
status.append(nodeColorInfo);
}
}
status.append("</html>");
jLabelGraphStatus.setText(status.toString());
}
|
<DeepExtract>
StringBuilder status = new StringBuilder("<html><b>Graph: </b>");
status.append(String.valueOf(numberOfNodes));
status.append(" people: ");
status.append(graphScope);
if (GraphManager.getInstance().singletonNodesRemoved()) {
status.append(" (singleton nodes removed)");
}
status.append(" ");
if (nodeSizeInfo.equals(nodeColorInfo) && !nodeSizeInfo.isEmpty()) {
status.append("<b>Node Size and Color:</b> ");
status.append(nodeSizeInfo);
} else {
if (!nodeSizeInfo.isEmpty()) {
status.append("<b>Node Size:</b> ");
status.append(nodeSizeInfo);
}
status.append(" ");
if (!nodeColorInfo.isEmpty()) {
status.append("<b>Node Color:</b> ");
status.append(nodeColorInfo);
}
}
status.append("</html>");
jLabelGraphStatus.setText(status.toString());
</DeepExtract>
|
vizlinc
|
positive
|
public void onChildAlignChanged(GuiElementBase element, Direction direction) {
if (children.isEmpty() || !doesExpand(direction))
return;
setSize(direction, getPadding(direction) + children.stream().mapToInt(child -> {
Alignment align = child.getAlign(direction);
return (align instanceof Alignment.Both) ? 0 : (align instanceof Alignment.Center) ? child.getSize(direction) : getChildPos(child, direction) - getPaddingMin(direction) + child.getSize(direction);
}).max().orElse(0));
}
|
<DeepExtract>
if (children.isEmpty() || !doesExpand(direction))
return;
setSize(direction, getPadding(direction) + children.stream().mapToInt(child -> {
Alignment align = child.getAlign(direction);
return (align instanceof Alignment.Both) ? 0 : (align instanceof Alignment.Center) ? child.getSize(direction) : getChildPos(child, direction) - getPaddingMin(direction) + child.getSize(direction);
}).max().orElse(0));
</DeepExtract>
|
WearableBackpacks
|
positive
|
@Override
public void onClick(View view) {
presenter.deleteReminder(id);
listView.setAdapter(presenter.getAdapter());
listView.invalidate();
mBottomSheetDialog.dismiss();
}
|
<DeepExtract>
listView.setAdapter(presenter.getAdapter());
listView.invalidate();
</DeepExtract>
|
glucosio-android
|
positive
|
@Test
public void symmetry() {
var matrix = new Matrix3x3(1.0, 2.0, 3.0, 2.0, 5.0, 3.0, 1.0, 0.0, 8.0);
var inverse;
var a = new Matrix3x3(1.0, 2.0, 3.0, 2.0, 5.0, 3.0, 1.0, 0.0, 8.0);
var b = a.invert();
var expected = new Matrix3x3(-40.0, 16.0, 9.0, 13.0, -5.0, -3.0, 5.0, -2.0, -1.0);
assertArrayEquals(expected.values[0], b.values[0], MIN_VALUE);
assertArrayEquals(expected.values[1], b.values[1], MIN_VALUE);
assertArrayEquals(expected.values[2], b.values[2], MIN_VALUE);
var c = b.invert();
assertArrayEquals(a.values[0], c.values[0], MIN_VALUE);
assertArrayEquals(a.values[1], c.values[1], MIN_VALUE);
assertArrayEquals(a.values[2], c.values[2], MIN_VALUE);
var mult = matrix.multiply(inverse);
var identity = new Matrix3x3(1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0);
assertArrayEquals(identity.values[0], mult.values[0]);
assertArrayEquals(identity.values[1], mult.values[1]);
assertArrayEquals(identity.values[2], mult.values[2]);
}
|
<DeepExtract>
var inverse;
var a = new Matrix3x3(1.0, 2.0, 3.0, 2.0, 5.0, 3.0, 1.0, 0.0, 8.0);
var b = a.invert();
var expected = new Matrix3x3(-40.0, 16.0, 9.0, 13.0, -5.0, -3.0, 5.0, -2.0, -1.0);
assertArrayEquals(expected.values[0], b.values[0], MIN_VALUE);
assertArrayEquals(expected.values[1], b.values[1], MIN_VALUE);
assertArrayEquals(expected.values[2], b.values[2], MIN_VALUE);
var c = b.invert();
assertArrayEquals(a.values[0], c.values[0], MIN_VALUE);
assertArrayEquals(a.values[1], c.values[1], MIN_VALUE);
assertArrayEquals(a.values[2], c.values[2], MIN_VALUE);
</DeepExtract>
|
testing-video
|
positive
|
public void adjustZoomBy(float delta) {
float newZoom = surveyToViewScale * delta;
Coord2D centre = new Coord2D(getWidth() / 2f, getHeight() / 2f);
setZoom(newZoom, centre);
}
|
<DeepExtract>
Coord2D centre = new Coord2D(getWidth() / 2f, getHeight() / 2f);
setZoom(newZoom, centre);
</DeepExtract>
|
sexytopo
|
positive
|
public void toggleCameraConfigFragment(View v) {
View v = mCameraConfigFragment.getView();
if (v != null) {
v.setVisibility(v.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
}
}
|
<DeepExtract>
View v = mCameraConfigFragment.getView();
if (v != null) {
v.setVisibility(v.getVisibility() == View.VISIBLE ? View.GONE : View.VISIBLE);
}
</DeepExtract>
|
FUQiniuDemoDroid
|
positive
|
@Test
@GivenFiguresInQueue({ @FigureProperties, @FigureProperties(left = 1) })
public void shouldOverflowWhenFigureRejectedAtFirstStep() {
return when(glass.accept(Matchers.<Figure>anyObject(), eq(CENTER_X), eq(HEIGHT))).thenReturn(false);
game.tick();
captureFigureAtValues();
assertEquals(CENTER_X, xCaptor.getValue().intValue());
assertEquals(HEIGHT, yCaptor.getValue().intValue());
verify(glass).empty();
}
|
<DeepExtract>
return when(glass.accept(Matchers.<Figure>anyObject(), eq(CENTER_X), eq(HEIGHT))).thenReturn(false);
</DeepExtract>
<DeepExtract>
captureFigureAtValues();
assertEquals(CENTER_X, xCaptor.getValue().intValue());
assertEquals(HEIGHT, yCaptor.getValue().intValue());
</DeepExtract>
<DeepExtract>
verify(glass).empty();
</DeepExtract>
|
tetris
|
positive
|
@Override
public String getHeader(CharSequence charSequence) {
Object o = context.get(charSequence);
if (o instanceof Map) {
return (R) new JsonObject((Map) o);
}
if (o instanceof List) {
return (R) new JsonArray((List) o);
}
return (R) o;
}
|
<DeepExtract>
Object o = context.get(charSequence);
if (o instanceof Map) {
return (R) new JsonObject((Map) o);
}
if (o instanceof List) {
return (R) new JsonArray((List) o);
}
return (R) o;
</DeepExtract>
|
yoke
|
positive
|
public void mouseClicked(java.awt.event.MouseEvent evt) {
}
|
<DeepExtract>
</DeepExtract>
|
vehler
|
positive
|
protected AuthenticationSession findSessionForJabberId(Jid jabberId) {
if (jabberId == null) {
return null;
}
ArrayList<AuthenticationSession> sessions = new ArrayList<>(authenticationSessions.values());
return sessions.stream().filter(session -> jabberId.equals(session.getUserJabberId())).findFirst().orElse(null);
}
|
<DeepExtract>
ArrayList<AuthenticationSession> sessions = new ArrayList<>(authenticationSessions.values());
return sessions.stream().filter(session -> jabberId.equals(session.getUserJabberId())).findFirst().orElse(null);
</DeepExtract>
|
jicofo
|
positive
|
public void loadVariable(int vindex) {
if (vindex < 0)
throw new IllegalArgumentException("vindex must be positive");
if (vindex >= numLocals) {
numLocals = vindex + 1;
if (numLocals > 65535)
throw new ClassFileLimitExceededException("Too many locals.");
}
if (stackSize == -1) {
return;
}
stackSize -= 0;
if (stackSize < 0)
throw new IllegalStateException("Stack underflow.");
stackSize += 1;
if (stackSize > maxStackSize) {
maxStackSize = stackSize;
if (stackSize >= 65534)
throw new ClassFileLimitExceededException("Stack overflow.");
}
if (vindex < 4) {
emit(42 + vindex);
} else if (vindex <= 255) {
emit(25);
emit(vindex);
} else {
emit(196);
emit(25);
emitUInt16(vindex);
}
}
|
<DeepExtract>
if (vindex < 0)
throw new IllegalArgumentException("vindex must be positive");
if (vindex >= numLocals) {
numLocals = vindex + 1;
if (numLocals > 65535)
throw new ClassFileLimitExceededException("Too many locals.");
}
</DeepExtract>
<DeepExtract>
if (stackSize == -1) {
return;
}
stackSize -= 0;
if (stackSize < 0)
throw new IllegalStateException("Stack underflow.");
stackSize += 1;
if (stackSize > maxStackSize) {
maxStackSize = stackSize;
if (stackSize >= 65534)
throw new ClassFileLimitExceededException("Stack overflow.");
}
</DeepExtract>
|
arden2bytecode
|
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
|
public void guardarcomo() {
File ficheiro = null;
AlgolFileFilter filter = new AlgolFileFilter();
filter.addExtension("alg");
filter.setDescription("AlgolXXI");
chooser = new JFileChooser();
chooser.setFileFilter(filter);
int returnVal = chooser.showSaveDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
ficheiro = chooser.getSelectedFile();
while (AlgolXXI.Editor.Utils.EditorUtils.containsChars(ficheiro.getName(), new char[] { '\\', '/', '*', '?', '<', '>', '|', '.' }) && ficheiro.getName().length() > 0) {
JOptionPane.showMessageDialog(null, bundle.getString("Caracter_invalido"));
filter = new AlgolFileFilter();
filter.addExtension("alg");
filter.setDescription("AlgolXXI");
chooser = new JFileChooser();
chooser.setFileFilter(filter);
returnVal = chooser.showSaveDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
ficheiro = chooser.getSelectedFile();
} else {
ficheiro = null;
break;
}
}
}
if (ficheiro != null) {
String str_ficheiro = "";
if (!ficheiro.toString().contains(".alg") && !ficheiro.toString().contains(".cpp") && !ficheiro.toString().contains(".java") && !ficheiro.toString().contains(".jpg")) {
str_ficheiro = ficheiro.toString() + "." + "alg";
} else {
str_ficheiro = ficheiro.toString();
}
if ("alg".equals("alg")) {
if (!ficheiro.toString().contains(".alg")) {
this.setDisplayName(ficheiro.getName() + ".alg");
} else {
this.setDisplayName(ficheiro.getName());
}
}
save_location = str_ficheiro;
}
return null;
if (save_location == null || save_location.equals("")) {
return;
}
if (tabpane.getSelectedIndex() == tabpane.indexOfTab(bundle.getString("Codigo"))) {
try {
FileWriter fstream = new FileWriter(save_location);
BufferedWriter out = new BufferedWriter(fstream);
out.write(codigo.getText());
out.close();
saved = true;
label_file.setText(" Ficheiro: " + save_location);
getConsole_info().writeLn("Ficheiro Guardado -> " + save_location);
} catch (Exception e) {
System.err.println("Erro Guardar: " + e.getMessage());
}
}
}
|
<DeepExtract>
File ficheiro = null;
AlgolFileFilter filter = new AlgolFileFilter();
filter.addExtension("alg");
filter.setDescription("AlgolXXI");
chooser = new JFileChooser();
chooser.setFileFilter(filter);
int returnVal = chooser.showSaveDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
ficheiro = chooser.getSelectedFile();
while (AlgolXXI.Editor.Utils.EditorUtils.containsChars(ficheiro.getName(), new char[] { '\\', '/', '*', '?', '<', '>', '|', '.' }) && ficheiro.getName().length() > 0) {
JOptionPane.showMessageDialog(null, bundle.getString("Caracter_invalido"));
filter = new AlgolFileFilter();
filter.addExtension("alg");
filter.setDescription("AlgolXXI");
chooser = new JFileChooser();
chooser.setFileFilter(filter);
returnVal = chooser.showSaveDialog(null);
if (returnVal == JFileChooser.APPROVE_OPTION) {
ficheiro = chooser.getSelectedFile();
} else {
ficheiro = null;
break;
}
}
}
if (ficheiro != null) {
String str_ficheiro = "";
if (!ficheiro.toString().contains(".alg") && !ficheiro.toString().contains(".cpp") && !ficheiro.toString().contains(".java") && !ficheiro.toString().contains(".jpg")) {
str_ficheiro = ficheiro.toString() + "." + "alg";
} else {
str_ficheiro = ficheiro.toString();
}
if ("alg".equals("alg")) {
if (!ficheiro.toString().contains(".alg")) {
this.setDisplayName(ficheiro.getName() + ".alg");
} else {
this.setDisplayName(ficheiro.getName());
}
}
save_location = str_ficheiro;
}
return null;
</DeepExtract>
|
portugol
|
positive
|
public void show(boolean anim) {
if (mVisible != true || false) {
mVisible = true;
int height = getHeight();
if (height == 0 && !false) {
ViewTreeObserver vto = getViewTreeObserver();
if (vto.isAlive()) {
vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
ViewTreeObserver currentVto = getViewTreeObserver();
if (currentVto.isAlive()) {
currentVto.removeOnPreDrawListener(this);
}
toggle(true, anim, true);
return true;
}
});
return;
}
}
int translationY = true ? 0 : height;
if (anim) {
animate().setInterpolator(mInterpolator).setDuration(TRANSLATE_DURATION_MILLIS).translationY(translationY);
} else {
ViewCompat.setTranslationY(this, translationY);
}
}
}
|
<DeepExtract>
if (mVisible != true || false) {
mVisible = true;
int height = getHeight();
if (height == 0 && !false) {
ViewTreeObserver vto = getViewTreeObserver();
if (vto.isAlive()) {
vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
ViewTreeObserver currentVto = getViewTreeObserver();
if (currentVto.isAlive()) {
currentVto.removeOnPreDrawListener(this);
}
toggle(true, anim, true);
return true;
}
});
return;
}
}
int translationY = true ? 0 : height;
if (anim) {
animate().setInterpolator(mInterpolator).setDuration(TRANSLATE_DURATION_MILLIS).translationY(translationY);
} else {
ViewCompat.setTranslationY(this, translationY);
}
}
</DeepExtract>
|
Fragmentation
|
positive
|
public void scheduleExpPlayoff() {
hasScheduledBowls = true;
playoffWeek = 1;
playoffTeams.clear();
ArrayList<Team> qualifiedTeams = getQualifiedTeams();
if (currentWeek > regSeasonWeeks) {
for (int i = 0; i < qualifiedTeams.size(); i++) {
if (qualifiedTeams.get(i).confChampion.equals("CC")) {
playoffTeams.add(qualifiedTeams.get(i));
}
}
int x = playoffTeams.size();
for (int i = 0; i < qualifiedTeams.size(); i++) {
if (!qualifiedTeams.get(i).confChampion.equals("CC")) {
playoffTeams.add(qualifiedTeams.get(i));
x++;
if (x >= 16)
break;
}
}
} else {
for (int i = 0; i < conferences.size(); i++) {
if (!conferences.get(i).confName.equals("Independent") && conferences.get(i).confTeams.size() > 0) {
Collections.sort(conferences.get(i).confTeams, new CompTeamConfWins());
playoffTeams.add(conferences.get(i).confTeams.get(0));
}
}
int x = playoffTeams.size();
for (int i = 0; i < qualifiedTeams.size(); i++) {
if (!playoffTeams.contains(qualifiedTeams.get(i))) {
playoffTeams.add(qualifiedTeams.get(i));
x++;
if (x >= 16)
break;
}
}
}
Collections.sort(playoffTeams, new CompTeamPoll());
StringBuilder sb = new StringBuilder();
sb.append("The following teams are expected to make it to the Football Playoffs!\n\n");
int i = 1;
for (Team t : playoffTeams) {
sb.append(i + ". " + t.strRankTeamRecord() + " [" + t.conference + "]\n");
i++;
}
postseason = sb.toString();
for (int x = 0; x < playoffTeams.size(); x++) {
qualifiedTeams.remove(playoffTeams.get(x));
}
if (hasScheduledBowls)
bowlScheduleLogic(qualifiedTeams);
for (int i = 0; i < 8; i++) {
cfpGames[i] = new Game(playoffTeams.get(i), playoffTeams.get(15 - i), "Sweet 16");
playoffTeams.get(i).gameSchedule.add(cfpGames[i]);
playoffTeams.get(15 - i).gameSchedule.add(cfpGames[i]);
newsStories.get(currentWeek + 1).add("Upcoming Sweet 16 Playoff Games!>" + "#" + playoffTeams.get(i).rankTeamPollScore + " " + playoffTeams.get(i).getStrAbbrWL() + " will battle with #" + playoffTeams.get(15 - i).rankTeamPollScore + " " + playoffTeams.get(15 - i).getStrAbbrWL() + " in the " + getYear() + " Sweet 16 round of the Playoffs!");
weeklyScores.get(currentWeek + 2).add(cfpGames[i].gameName + ">" + cfpGames[i].awayTeam.strRankTeamRecord() + "\n" + cfpGames[i].homeTeam.strRankTeamRecord());
}
for (int i = 0; i < teamList.size(); i++) {
teamList.get(i).postSeasonHealing(1);
}
}
|
<DeepExtract>
playoffTeams.clear();
ArrayList<Team> qualifiedTeams = getQualifiedTeams();
if (currentWeek > regSeasonWeeks) {
for (int i = 0; i < qualifiedTeams.size(); i++) {
if (qualifiedTeams.get(i).confChampion.equals("CC")) {
playoffTeams.add(qualifiedTeams.get(i));
}
}
int x = playoffTeams.size();
for (int i = 0; i < qualifiedTeams.size(); i++) {
if (!qualifiedTeams.get(i).confChampion.equals("CC")) {
playoffTeams.add(qualifiedTeams.get(i));
x++;
if (x >= 16)
break;
}
}
} else {
for (int i = 0; i < conferences.size(); i++) {
if (!conferences.get(i).confName.equals("Independent") && conferences.get(i).confTeams.size() > 0) {
Collections.sort(conferences.get(i).confTeams, new CompTeamConfWins());
playoffTeams.add(conferences.get(i).confTeams.get(0));
}
}
int x = playoffTeams.size();
for (int i = 0; i < qualifiedTeams.size(); i++) {
if (!playoffTeams.contains(qualifiedTeams.get(i))) {
playoffTeams.add(qualifiedTeams.get(i));
x++;
if (x >= 16)
break;
}
}
}
Collections.sort(playoffTeams, new CompTeamPoll());
StringBuilder sb = new StringBuilder();
sb.append("The following teams are expected to make it to the Football Playoffs!\n\n");
int i = 1;
for (Team t : playoffTeams) {
sb.append(i + ". " + t.strRankTeamRecord() + " [" + t.conference + "]\n");
i++;
}
postseason = sb.toString();
for (int x = 0; x < playoffTeams.size(); x++) {
qualifiedTeams.remove(playoffTeams.get(x));
}
if (hasScheduledBowls)
bowlScheduleLogic(qualifiedTeams);
</DeepExtract>
|
CFB-Coach-v1
|
positive
|
public static TokenList groupByParameterTerm(Parser parser, Token smokin) {
StringIterator iterator = new StringIterator(smokin.toString(), smokin.getHint());
TokenList tokens = LexicalAnalyzer.GroupParameterTokens(parser, iterator);
TokenList rv = new TokenList();
if (tokens.getList().size() == 0) {
return rv;
}
StringBuffer current = new StringBuffer();
int hint = -1;
Iterator i = tokens.getList().iterator();
while (i.hasNext()) {
Token temp = (Token) i.next();
hint = hint == -1 ? temp.getHint() : hint;
if (temp.toString().equals("EOT")) {
rv.add(new Token(current.toString(), hint));
current = new StringBuffer();
hint = -1;
} else {
if (current.length() > 0)
current.append(" ");
current.append(temp.toString());
}
}
if (current.length() > 0)
rv.add(new Token(current.toString(), hint));
return rv;
}
|
<DeepExtract>
TokenList rv = new TokenList();
if (tokens.getList().size() == 0) {
return rv;
}
StringBuffer current = new StringBuffer();
int hint = -1;
Iterator i = tokens.getList().iterator();
while (i.hasNext()) {
Token temp = (Token) i.next();
hint = hint == -1 ? temp.getHint() : hint;
if (temp.toString().equals("EOT")) {
rv.add(new Token(current.toString(), hint));
current = new StringBuffer();
hint = -1;
} else {
if (current.length() > 0)
current.append(" ");
current.append(temp.toString());
}
}
if (current.length() > 0)
rv.add(new Token(current.toString(), hint));
return rv;
</DeepExtract>
|
sleep
|
positive
|
private boolean planIsEmpty() {
return taskIsEmpty();
}
|
<DeepExtract>
return taskIsEmpty();
</DeepExtract>
|
Rk_Cms
|
positive
|
private void performVelocityCheck(EMVApplication app) throws TerminalException {
byte[] command;
int SW1;
int SW2;
Log.commandHeader("Send GET DATA command to find the Application Transaction Counter (ATC)");
command = EMVAPDUCommands.getApplicationTransactionCounter();
CardResponse getDataATCResponse = EMVUtil.sendCmd(terminal, command);
SW1 = (byte) getDataATCResponse.getSW1();
SW2 = (byte) getDataATCResponse.getSW2();
if (SW1 == (byte) 0x90 && SW2 == (byte) 0x00) {
BERTLV tlv = TLVUtil.getNextTLV(new ByteArrayInputStream(getDataATCResponse.getData()));
app.setATC(Util.byteToInt(tlv.getValueBytes()[0], tlv.getValueBytes()[1]));
}
Log.commandHeader("Send GET DATA command to find the Last Online ATC Register");
command = EMVAPDUCommands.getLastOnlineATCRegister();
CardResponse getDataLastOnlineATCRegisterResponse = EMVUtil.sendCmd(terminal, command);
SW1 = (byte) getDataLastOnlineATCRegisterResponse.getSW1();
SW2 = (byte) getDataLastOnlineATCRegisterResponse.getSW2();
if (SW1 == (byte) 0x90 && SW2 == (byte) 0x00) {
BERTLV tlv = TLVUtil.getNextTLV(new ByteArrayInputStream(getDataLastOnlineATCRegisterResponse.getData()));
app.setLastOnlineATC(Util.byteToInt(tlv.getValueBytes()[0], tlv.getValueBytes()[1]));
}
int atc = app.getATC();
int lastOnlineAtc = app.getLastOnlineATC();
if (lastOnlineAtc == 0) {
EMVTerminal.getTerminalVerificationResults().setNewCard(true);
}
if (atc == -1 || lastOnlineAtc == -1 || atc <= lastOnlineAtc) {
EMVTerminal.getTerminalVerificationResults().setLowerConsecutiveOfflineLimitExceeded(true);
EMVTerminal.getTerminalVerificationResults().setUpperConsecutiveOfflineLimitExceeded(true);
return;
}
int diff = atc - lastOnlineAtc;
if (diff > app.getLowerConsecutiveOfflineLimit()) {
EMVTerminal.getTerminalVerificationResults().setLowerConsecutiveOfflineLimitExceeded(true);
if (diff > app.getUpperConsecutiveOfflineLimit()) {
EMVTerminal.getTerminalVerificationResults().setUpperConsecutiveOfflineLimitExceeded(true);
}
}
}
|
<DeepExtract>
byte[] command;
int SW1;
int SW2;
Log.commandHeader("Send GET DATA command to find the Application Transaction Counter (ATC)");
command = EMVAPDUCommands.getApplicationTransactionCounter();
CardResponse getDataATCResponse = EMVUtil.sendCmd(terminal, command);
SW1 = (byte) getDataATCResponse.getSW1();
SW2 = (byte) getDataATCResponse.getSW2();
if (SW1 == (byte) 0x90 && SW2 == (byte) 0x00) {
BERTLV tlv = TLVUtil.getNextTLV(new ByteArrayInputStream(getDataATCResponse.getData()));
app.setATC(Util.byteToInt(tlv.getValueBytes()[0], tlv.getValueBytes()[1]));
}
Log.commandHeader("Send GET DATA command to find the Last Online ATC Register");
command = EMVAPDUCommands.getLastOnlineATCRegister();
CardResponse getDataLastOnlineATCRegisterResponse = EMVUtil.sendCmd(terminal, command);
SW1 = (byte) getDataLastOnlineATCRegisterResponse.getSW1();
SW2 = (byte) getDataLastOnlineATCRegisterResponse.getSW2();
if (SW1 == (byte) 0x90 && SW2 == (byte) 0x00) {
BERTLV tlv = TLVUtil.getNextTLV(new ByteArrayInputStream(getDataLastOnlineATCRegisterResponse.getData()));
app.setLastOnlineATC(Util.byteToInt(tlv.getValueBytes()[0], tlv.getValueBytes()[1]));
}
</DeepExtract>
|
javaemvreader
|
positive
|
public static byte[] tropeByte(String str, int type) {
byte[] result = new byte[str.length() / 2];
if (type == 1) {
if (str.indexOf("1002") >= 0) {
str = str.replaceAll("1002", "10100202");
}
if (str.indexOf("1003") >= 0) {
str = str.replaceAll("1003", "10100203");
}
}
StringBuffer des = new StringBuffer();
String s = "";
str = str + " ";
for (int i = 0; i < str.length(); i++) {
if (i % 2 == 0) {
if (s.equals("10")) {
s = "1010";
}
des.append(s);
s = "";
s = s + str.charAt(i);
} else {
s = s + str.charAt(i);
}
}
return des.toString();
if (str.length() < 1)
result = null;
byte[] result = new byte[str.length() / 2];
for (int i = 0; i < str.length() / 2; i++) {
int high = Integer.parseInt(str.substring(i * 2, i * 2 + 1), 16);
int low = Integer.parseInt(str.substring(i * 2 + 1, i * 2 + 2), 16);
result[i] = (byte) (high * 16 + low);
}
return result;
return result;
}
|
<DeepExtract>
StringBuffer des = new StringBuffer();
String s = "";
str = str + " ";
for (int i = 0; i < str.length(); i++) {
if (i % 2 == 0) {
if (s.equals("10")) {
s = "1010";
}
des.append(s);
s = "";
s = s + str.charAt(i);
} else {
s = s + str.charAt(i);
}
}
return des.toString();
</DeepExtract>
<DeepExtract>
if (str.length() < 1)
result = null;
byte[] result = new byte[str.length() / 2];
for (int i = 0; i < str.length() / 2; i++) {
int high = Integer.parseInt(str.substring(i * 2, i * 2 + 1), 16);
int low = Integer.parseInt(str.substring(i * 2 + 1, i * 2 + 2), 16);
result[i] = (byte) (high * 16 + low);
}
return result;
</DeepExtract>
|
Car-eye-pusher-android
|
positive
|
@Override
public void renderTileEntityAt(TileTank tileTank, double x, double y, double z, float time, int breakTime) {
GlStateManager.pushAttrib();
Tessellator tessellator = Tessellator.getInstance();
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
GlStateManager.disableRescaleNormal();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
GlStateManager.disableBlend();
GlStateManager.pushMatrix();
GlStateManager.translate(x, y, z);
bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
World world = tileTank.getWorld();
VertexBuffer buffer = tessellator.getBuffer();
float offset = 0.002f;
int ix = tileTank.getPos().getX(), iy = tileTank.getPos().getY(), iz = tileTank.getPos().getZ();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
TextureAtlasSprite blockIcon = TankSetup.tank.getSideIcon();
if (doRenderToSide(world, ix, iy, iz - 1, tileTank)) {
buffer.pos(1, 0, offset).tex(blockIcon.getMinU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1, 1, offset).tex(blockIcon.getMinU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(0, 1, offset).tex(blockIcon.getMaxU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(0, 0, offset).tex(blockIcon.getMaxU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
}
if (doRenderToSide(world, ix, iy, iz + 1, tileTank)) {
buffer.pos(1, 1, 1 - offset).tex(blockIcon.getMinU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1, 0, 1 - offset).tex(blockIcon.getMinU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(0, 0, 1 - offset).tex(blockIcon.getMaxU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(0, 1, 1 - offset).tex(blockIcon.getMaxU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
}
if (doRenderToSide(world, ix - 1, iy, iz, tileTank)) {
buffer.pos(offset, 1, 1).tex(blockIcon.getMinU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
buffer.pos(offset, 0, 1).tex(blockIcon.getMinU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(offset, 0, 0).tex(blockIcon.getMaxU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(offset, 1, 0).tex(blockIcon.getMaxU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
}
if (doRenderToSide(world, ix + 1, iy, iz, tileTank)) {
buffer.pos(1 - offset, 0, 1).tex(blockIcon.getMinU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1 - offset, 1, 1).tex(blockIcon.getMinU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1 - offset, 1, 0).tex(blockIcon.getMaxU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1 - offset, 0, 0).tex(blockIcon.getMaxU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
}
if (doRenderToSide(world, ix, iy - 1, iz, tileTank)) {
blockIcon = TankSetup.tank.getBottomIcon();
buffer.pos(0, offset, 0).tex(blockIcon.getMinU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
buffer.pos(0, offset, 1).tex(blockIcon.getMinU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1, offset, 1).tex(blockIcon.getMaxU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1, offset, 0).tex(blockIcon.getMaxU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
}
if (doRenderToSide(world, ix, iy + 1, iz, tileTank)) {
blockIcon = TankSetup.tank.getTopIcon();
buffer.pos(0, 1 - offset, 0).tex(blockIcon.getMinU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1, 1 - offset, 0).tex(blockIcon.getMinU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1, 1 - offset, 1).tex(blockIcon.getMaxU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(0, 1 - offset, 1).tex(blockIcon.getMaxU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
}
tessellator.draw();
Fluid renderFluid = tileTank.getClientRenderFluid();
if (renderFluid != null) {
renderFluid(tileTank, tessellator, renderFluid);
}
net.minecraft.client.renderer.RenderHelper.enableStandardItemLighting();
GlStateManager.popMatrix();
GlStateManager.popAttrib();
}
|
<DeepExtract>
VertexBuffer buffer = tessellator.getBuffer();
float offset = 0.002f;
int ix = tileTank.getPos().getX(), iy = tileTank.getPos().getY(), iz = tileTank.getPos().getZ();
buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
TextureAtlasSprite blockIcon = TankSetup.tank.getSideIcon();
if (doRenderToSide(world, ix, iy, iz - 1, tileTank)) {
buffer.pos(1, 0, offset).tex(blockIcon.getMinU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1, 1, offset).tex(blockIcon.getMinU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(0, 1, offset).tex(blockIcon.getMaxU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(0, 0, offset).tex(blockIcon.getMaxU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
}
if (doRenderToSide(world, ix, iy, iz + 1, tileTank)) {
buffer.pos(1, 1, 1 - offset).tex(blockIcon.getMinU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1, 0, 1 - offset).tex(blockIcon.getMinU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(0, 0, 1 - offset).tex(blockIcon.getMaxU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(0, 1, 1 - offset).tex(blockIcon.getMaxU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
}
if (doRenderToSide(world, ix - 1, iy, iz, tileTank)) {
buffer.pos(offset, 1, 1).tex(blockIcon.getMinU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
buffer.pos(offset, 0, 1).tex(blockIcon.getMinU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(offset, 0, 0).tex(blockIcon.getMaxU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(offset, 1, 0).tex(blockIcon.getMaxU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
}
if (doRenderToSide(world, ix + 1, iy, iz, tileTank)) {
buffer.pos(1 - offset, 0, 1).tex(blockIcon.getMinU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1 - offset, 1, 1).tex(blockIcon.getMinU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1 - offset, 1, 0).tex(blockIcon.getMaxU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1 - offset, 0, 0).tex(blockIcon.getMaxU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
}
if (doRenderToSide(world, ix, iy - 1, iz, tileTank)) {
blockIcon = TankSetup.tank.getBottomIcon();
buffer.pos(0, offset, 0).tex(blockIcon.getMinU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
buffer.pos(0, offset, 1).tex(blockIcon.getMinU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1, offset, 1).tex(blockIcon.getMaxU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1, offset, 0).tex(blockIcon.getMaxU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
}
if (doRenderToSide(world, ix, iy + 1, iz, tileTank)) {
blockIcon = TankSetup.tank.getTopIcon();
buffer.pos(0, 1 - offset, 0).tex(blockIcon.getMinU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1, 1 - offset, 0).tex(blockIcon.getMinU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(1, 1 - offset, 1).tex(blockIcon.getMaxU(), blockIcon.getMaxV()).color(255, 255, 255, 128).endVertex();
buffer.pos(0, 1 - offset, 1).tex(blockIcon.getMaxU(), blockIcon.getMinV()).color(255, 255, 255, 128).endVertex();
}
tessellator.draw();
</DeepExtract>
|
DeepResonance
|
positive
|
@Transactional
public void testTx(T t1, T t2) {
return getHibernateTemplate().save(t1);
int i = 1 / 0;
return getHibernateTemplate().save(t2);
}
|
<DeepExtract>
return getHibernateTemplate().save(t1);
</DeepExtract>
<DeepExtract>
return getHibernateTemplate().save(t2);
</DeepExtract>
|
csustRepo
|
positive
|
private void down() {
if (cursor.index < 0)
buttons[-cursor.index - 1].setHover(false);
AudioPlayer.playAudio("cursor", 1, 1);
if (cursor.on) {
boolean above = cursor.index < lordList.size();
cursor.index += lordList.unitsPerRow;
if (cursor.index >= lordList.size() && above) {
cursor.index = lordList.size();
}
} else {
cursor.index = 0;
cursor.instant = true;
cursor.on = true;
}
if (cursor.index >= lordList.size() + vassalList.size()) {
cursor.index = -buttons.length;
}
if (-cursor.index > buttons.length) {
cursor.on = true;
cursor.instant = true;
cursor.index = lordList.size() + vassalList.size() - 1;
vassalList.scrollTo(vassalList.size() - 1);
}
if (cursor.index < 0) {
cursor.on = false;
buttons[-cursor.index - 1].setHover(true);
} else {
cursor.on = true;
if (cursor.index >= lordList.size()) {
vassalList.scrollTo(cursor.index - lordList.size());
}
}
}
|
<DeepExtract>
if (cursor.index >= lordList.size() + vassalList.size()) {
cursor.index = -buttons.length;
}
if (-cursor.index > buttons.length) {
cursor.on = true;
cursor.instant = true;
cursor.index = lordList.size() + vassalList.size() - 1;
vassalList.scrollTo(vassalList.size() - 1);
}
if (cursor.index < 0) {
cursor.on = false;
buttons[-cursor.index - 1].setHover(true);
} else {
cursor.on = true;
if (cursor.index >= lordList.size()) {
vassalList.scrollTo(cursor.index - lordList.size());
}
}
</DeepExtract>
|
FEMultiplayer
|
positive
|
public Criteria andPhoneNotLike(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "phone" + " cannot be null");
}
criteria.add(new Criterion("phone not like", value));
return (Criteria) this;
}
|
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "phone" + " cannot be null");
}
criteria.add(new Criterion("phone not like", value));
</DeepExtract>
|
ssmxiaomi
|
positive
|
@Override
public void run() {
LayoutInflater inflate = (LayoutInflater) Utils.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
sViewWeakReference = new WeakReference<>(inflate.inflate(layoutId, null));
show(Utils.getContext().getResources().getText("").toString(), Toast.LENGTH_LONG);
}
|
<DeepExtract>
LayoutInflater inflate = (LayoutInflater) Utils.getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
sViewWeakReference = new WeakReference<>(inflate.inflate(layoutId, null));
</DeepExtract>
<DeepExtract>
show(Utils.getContext().getResources().getText("").toString(), Toast.LENGTH_LONG);
</DeepExtract>
|
QuickMvp
|
positive
|
public TransactionInput addInput(TransactionInput input) {
super.unCache();
hash = null;
input.setParent(this);
inputs.add(input);
adjustLength(inputs.size(), input.length);
return input;
}
|
<DeepExtract>
super.unCache();
hash = null;
</DeepExtract>
|
ulordj-thin
|
positive
|
public static void syntaxError(int msgID, Grammar grammar, Token token, Object arg, antlr.RecognitionException re) {
getErrorState().errors++;
getErrorState().errorMsgIDs.add(msgID);
String outputMsg = new GrammarSyntaxMessage(msgID, grammar, token, arg, re).toString();
if (formatWantsSingleLineMessage()) {
outputMsg = outputMsg.replaceAll("\n", " ");
}
System.err.println(outputMsg);
}
|
<DeepExtract>
String outputMsg = new GrammarSyntaxMessage(msgID, grammar, token, arg, re).toString();
if (formatWantsSingleLineMessage()) {
outputMsg = outputMsg.replaceAll("\n", " ");
}
System.err.println(outputMsg);
</DeepExtract>
|
org.xtext.antlr.generator
|
positive
|
public Criteria andMobileNotIn(List<String> values) {
if (values == null) {
throw new RuntimeException("Value for " + "mobile" + " cannot be null");
}
criteria.add(new Criterion("mobile not in", values));
return (Criteria) this;
}
|
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "mobile" + " cannot be null");
}
criteria.add(new Criterion("mobile not in", values));
</DeepExtract>
|
Tmall_SSM-master
|
positive
|
void test4(Foo f) {
}
|
<DeepExtract>
</DeepExtract>
<DeepExtract>
</DeepExtract>
|
object-construction-checker
|
positive
|
@Override
public ApiResponse<UserList> getUsersNotInChannel(String teamId, String channelId, Pager pager, String etag) {
String query = new QueryBuilder().set("in_team", teamId).set("not_in_channel", channelId).toString();
return doApiRequest(HttpMethod.GET, apiUrl + getUsersRoute() + query + pager.toQuery(false), null, etag, UserList.class);
}
|
<DeepExtract>
return doApiRequest(HttpMethod.GET, apiUrl + getUsersRoute() + query + pager.toQuery(false), null, etag, UserList.class);
</DeepExtract>
|
mattermost4j
|
positive
|
@Override
public Database getEncryptedWritableDb(char[] password) {
return new StandardDatabase(getWritableDatabase(password));
}
|
<DeepExtract>
return new StandardDatabase(getWritableDatabase(password));
</DeepExtract>
|
DevRing
|
positive
|
private <T> void matchJson(MvcResult result, String jsonPath, Matcher<T> matcher) throws Exception {
matchJson(result, ".policyId", policy.getId().getId().toString());
matchJson(result, ".customer", policy.getCustomerId().getId().toString());
matchJson(result, ".policyLimit.amount", policy.getPolicyLimit().getAmount().intValue());
matchJson(result, ".policyLimit.currency", policy.getPolicyLimit().getCurrency().toString());
matchJson(result, ".insurancePremium.amount", policy.getInsurancePremium().getAmount().intValue());
matchJson(result, ".insurancePremium.currency", policy.getInsurancePremium().getCurrency().toString());
matchJson(result, ".insuringAgreement.agreementItems", hasSize(0));
}
|
<DeepExtract>
matchJson(result, ".policyId", policy.getId().getId().toString());
matchJson(result, ".customer", policy.getCustomerId().getId().toString());
matchJson(result, ".policyLimit.amount", policy.getPolicyLimit().getAmount().intValue());
matchJson(result, ".policyLimit.currency", policy.getPolicyLimit().getCurrency().toString());
matchJson(result, ".insurancePremium.amount", policy.getInsurancePremium().getAmount().intValue());
matchJson(result, ".insurancePremium.currency", policy.getInsurancePremium().getCurrency().toString());
matchJson(result, ".insuringAgreement.agreementItems", hasSize(0));
</DeepExtract>
|
LakesideMutual
|
positive
|
public static MPerm getPermDoor() {
MPerm ret = MPermColl.get().get(ID_DOOR, false);
if (ret != null) {
ret.setRegistered(true);
return ret;
}
ret = new MPerm(PRIORITY_DOOR, ID_DOOR, "use doors", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY), true, true, true);
MPermColl.get().attach(ret, ID_DOOR);
ret.setRegistered(true);
ret.sync();
return ret;
}
|
<DeepExtract>
MPerm ret = MPermColl.get().get(ID_DOOR, false);
if (ret != null) {
ret.setRegistered(true);
return ret;
}
ret = new MPerm(PRIORITY_DOOR, ID_DOOR, "use doors", MUtil.set(Rel.LEADER, Rel.OFFICER, Rel.MEMBER, Rel.RECRUIT, Rel.ALLY), true, true, true);
MPermColl.get().attach(ret, ID_DOOR);
ret.setRegistered(true);
ret.sync();
return ret;
</DeepExtract>
|
Factions
|
positive
|
public void testScalaFuture() {
doTest(true, true, true, TestMeGeneratorJunit4Test.MIN_PERCENT_OF_EXCESSIVE_SETTERS_TO_PREFER_DEFAULT_CTOR, true, true);
}
|
<DeepExtract>
doTest(true, true, true, TestMeGeneratorJunit4Test.MIN_PERCENT_OF_EXCESSIVE_SETTERS_TO_PREFER_DEFAULT_CTOR, true, true);
</DeepExtract>
|
testme-idea
|
positive
|
public void mouseUp(MouseEvent arg0) {
forceVolume(getValFromX(arg0.x));
volume.setCapture(false);
}
|
<DeepExtract>
forceVolume(getValFromX(arg0.x));
</DeepExtract>
|
janos
|
positive
|
public String getSubgroupsAsString() {
StringBuilder sb = new StringBuilder();
for (String s : subgroups) {
sb.append(s);
sb.append("\n");
}
StringBuilder sb = new StringBuilder();
sb.append("Group: " + name + "\n");
sb.append("MaxResults: " + maxResults + "\n");
sb.append("MaxScanRows: " + maxScanRows + "\n");
sb.append("MaxLockTime: " + maxLockTime + "\n");
sb.append("Timeout: " + timeout + "\n");
sb.append("SubGroups:\n" + getSubgroupsAsString() + "\n");
sb.append("Owners:\n" + getOwnersAsString() + "\n");
sb.append("Users:\n" + getUsersAsString() + "\n");
return sb.toString();
}
|
<DeepExtract>
StringBuilder sb = new StringBuilder();
sb.append("Group: " + name + "\n");
sb.append("MaxResults: " + maxResults + "\n");
sb.append("MaxScanRows: " + maxScanRows + "\n");
sb.append("MaxLockTime: " + maxLockTime + "\n");
sb.append("Timeout: " + timeout + "\n");
sb.append("SubGroups:\n" + getSubgroupsAsString() + "\n");
sb.append("Owners:\n" + getOwnersAsString() + "\n");
sb.append("Users:\n" + getUsersAsString() + "\n");
return sb.toString();
</DeepExtract>
|
perforce-plugin
|
positive
|
private void serialize(Element e, XmlSerializer s, int depth, String spaces) throws Exception {
String name = e.getTagName();
if (spaces != null) {
s.text("\n");
for (int i = 0; i < depth; i++) {
s.text(spaces);
}
}
s.startTag("", name);
if (e.hasAttributes()) {
NamedNodeMap nm = e.getAttributes();
for (int i = 0; i < nm.getLength(); i++) {
Attr attr = (Attr) nm.item(i);
s.attribute("", attr.getName(), attr.getValue());
}
}
if (e.hasChildNodes()) {
NodeList nl = e.getChildNodes();
int elements = 0;
for (int i = 0; i < nl.getLength(); i++) {
Node n = nl.item(i);
short type = n.getNodeType();
switch(type) {
case Node.ELEMENT_NODE:
serialize((Element) n, s, depth + 1, spaces);
elements++;
break;
case Node.TEXT_NODE:
s.text(text(n));
break;
case Node.CDATA_SECTION_NODE:
s.cdsect(text(n));
break;
}
}
if (elements > 0) {
writeSpace(s, depth, spaces);
}
}
s.endTag("", name);
}
|
<DeepExtract>
if (spaces != null) {
s.text("\n");
for (int i = 0; i < depth; i++) {
s.text(spaces);
}
}
</DeepExtract>
|
androidquery
|
positive
|
public boolean addLabelById(long labelId, long objectId) throws Exception {
final Object[] args = { (labelId), (objectId) };
return call("addLabelById", args);
}
|
<DeepExtract>
final Object[] args = { (labelId), (objectId) };
return call("addLabelById", args);
</DeepExtract>
|
maven-confluence-plugin
|
positive
|
public void setUserApplicationName(String value) {
setValue(new DataObject(OBJECT_ID_USER_APPLICATION_NAME, value.getBytes(Charset.forName("UTF-8"))));
}
|
<DeepExtract>
setValue(new DataObject(OBJECT_ID_USER_APPLICATION_NAME, value.getBytes(Charset.forName("UTF-8"))));
</DeepExtract>
|
Androidmodbusrtu
|
positive
|
public T withId(String id) {
setAttribute(Attr.ID, id == null ? null : String.valueOf(id));
return self();
}
|
<DeepExtract>
setAttribute(Attr.ID, id == null ? null : String.valueOf(id));
return self();
</DeepExtract>
|
j2html
|
positive
|
private void init() throws Exception {
EventLoopGroup workerGroup = new NioEventLoopGroup();
bstrap = new Bootstrap();
bstrap.group(workerGroup);
bstrap.channel(NioSocketChannel.class);
bstrap.option(ChannelOption.SO_KEEPALIVE, true);
bstrap.handler(new ChannelInitializer<SocketChannel>() {
@Override
public void initChannel(SocketChannel ch) throws Exception {
ch.pipeline().addLast(new HttpResponseDecoder());
ch.pipeline().addLast(new HttpRequestEncoder());
ch.pipeline().addLast(new HttpClientHandler());
}
});
for (int i = 0; i < connConfig.poolSize; i++) {
ChannelFuture future = bstrap.connect(connConfig.host, connConfig.port).sync();
Channel channel = future.channel();
channel.attr(AttributeKey.newInstance(Result.COUNTER)).set(new AtomicLong());
ConcurrentHashMap<Long, Result> resultMap = new ConcurrentHashMap<Long, Result>(100, 0.75f, 16);
channel.attr(AttributeKey.newInstance(Result.RESULT_MAP)).set(resultMap);
connectionPool.add(future);
}
}
|
<DeepExtract>
for (int i = 0; i < connConfig.poolSize; i++) {
ChannelFuture future = bstrap.connect(connConfig.host, connConfig.port).sync();
Channel channel = future.channel();
channel.attr(AttributeKey.newInstance(Result.COUNTER)).set(new AtomicLong());
ConcurrentHashMap<Long, Result> resultMap = new ConcurrentHashMap<Long, Result>(100, 0.75f, 16);
channel.attr(AttributeKey.newInstance(Result.RESULT_MAP)).set(resultMap);
connectionPool.add(future);
}
</DeepExtract>
|
springmore
|
positive
|
public void transportManagerDidConnect(LFXTransportManager transportManager) {
LFXLog.d(TAG, "transportManagerDidConnect()");
for (LFXNetworkContextListener aListener : listeners) {
aListener.networkContextDidConnect(this);
}
LFXMessage lightGet = LFXMessage.messageWithTypeAndTarget(Type.LX_PROTOCOL_LIGHT_GET, LFXTarget.getBroadcastTarget());
sendMessage(lightGet);
Runnable task0 = new Runnable() {
@Override
public void run() {
LFXMessage getTagLabels = LFXMessage.messageWithTypeAndTarget(Type.LX_PROTOCOL_DEVICE_GET_TAG_LABELS, LFXTarget.getBroadcastTarget());
byte[] tags = new byte[8];
tags = LFXByteUtils.inverseByteArrayBits(tags);
LxProtocolDevice.GetTagLabels payload = new LxProtocolDevice.GetTagLabels(new Object(), new UInt64(tags));
getTagLabels.setPayload(payload);
sendMessage(getTagLabels);
}
};
LFXTimerUtils.scheduleDelayedTask(task0, 1500);
Runnable task1 = new Runnable() {
@Override
public void run() {
LFXMessage lightGet = LFXMessage.messageWithTypeAndTarget(Type.LX_PROTOCOL_LIGHT_GET, LFXTarget.getBroadcastTarget());
sendMessage(lightGet);
}
};
LFXTimerUtils.scheduleDelayedTask(task1, 3000);
if (siteScanTimer != null) {
siteScanTimer.cancel();
siteScanTimer.purge();
}
siteScanTimer = LFXTimerUtils.getTimerTaskWithPeriod(getSiteScanTimerTask(), LFXSDKConstants.LFX_SITE_SCAN_TIMER_INTERVAL, false, "SiteScanTimer");
}
|
<DeepExtract>
LFXMessage lightGet = LFXMessage.messageWithTypeAndTarget(Type.LX_PROTOCOL_LIGHT_GET, LFXTarget.getBroadcastTarget());
sendMessage(lightGet);
Runnable task0 = new Runnable() {
@Override
public void run() {
LFXMessage getTagLabels = LFXMessage.messageWithTypeAndTarget(Type.LX_PROTOCOL_DEVICE_GET_TAG_LABELS, LFXTarget.getBroadcastTarget());
byte[] tags = new byte[8];
tags = LFXByteUtils.inverseByteArrayBits(tags);
LxProtocolDevice.GetTagLabels payload = new LxProtocolDevice.GetTagLabels(new Object(), new UInt64(tags));
getTagLabels.setPayload(payload);
sendMessage(getTagLabels);
}
};
LFXTimerUtils.scheduleDelayedTask(task0, 1500);
Runnable task1 = new Runnable() {
@Override
public void run() {
LFXMessage lightGet = LFXMessage.messageWithTypeAndTarget(Type.LX_PROTOCOL_LIGHT_GET, LFXTarget.getBroadcastTarget());
sendMessage(lightGet);
}
};
LFXTimerUtils.scheduleDelayedTask(task1, 3000);
</DeepExtract>
|
lifx-sdk-android
|
positive
|
private void realStartPlay(String mVerifyCode) {
if (!TextUtils.isEmpty(mVerifyCode)) {
mEZPlayer.setPlayVerifyCode(mVerifyCode);
}
mStatus = STATUS_START;
mEZUIPlayerView.showLoading();
mPlayUI.mPlayImg.setImageResource(R.drawable.btn_stop_n);
Log.d(TAG, "startRealPlay mStatus = " + mStatus);
if (mStatus == STATUS_START || mStatus == STATUS_PLAY) {
return;
}
if (!EZOpenUtils.isNetworkAvailable(this)) {
return;
}
if (mPlayPresenter.getOpenDeviceInfo() == null || mPlayPresenter.getOpenCameraInfo() == null) {
return;
}
if (mPlayPresenter.getOpenDeviceInfo().getIsEncrypt() == 0) {
realStartPlay(null);
} else {
String verifyCode = mPlayPresenter.getDeviceEncrypt();
if (!TextUtils.isEmpty(verifyCode)) {
realStartPlay(verifyCode);
} else {
stopRealPlayUI();
CommomAlertDialog.VerifyCodeInputDialog(PlayActivity.this, new CommomAlertDialog.VerifyCodeInputListener() {
@Override
public void onInputVerifyCode(String verifyCode) {
if (!TextUtils.isEmpty(verifyCode)) {
mVerifyCode = verifyCode;
mPlayPresenter.setDeviceEncrypt(mDeviceSerial, mVerifyCode);
realStartPlay(mVerifyCode);
}
}
}).show();
}
}
}
|
<DeepExtract>
mEZUIPlayerView.showLoading();
mPlayUI.mPlayImg.setImageResource(R.drawable.btn_stop_n);
</DeepExtract>
<DeepExtract>
Log.d(TAG, "startRealPlay mStatus = " + mStatus);
if (mStatus == STATUS_START || mStatus == STATUS_PLAY) {
return;
}
if (!EZOpenUtils.isNetworkAvailable(this)) {
return;
}
if (mPlayPresenter.getOpenDeviceInfo() == null || mPlayPresenter.getOpenCameraInfo() == null) {
return;
}
if (mPlayPresenter.getOpenDeviceInfo().getIsEncrypt() == 0) {
realStartPlay(null);
} else {
String verifyCode = mPlayPresenter.getDeviceEncrypt();
if (!TextUtils.isEmpty(verifyCode)) {
realStartPlay(verifyCode);
} else {
stopRealPlayUI();
CommomAlertDialog.VerifyCodeInputDialog(PlayActivity.this, new CommomAlertDialog.VerifyCodeInputListener() {
@Override
public void onInputVerifyCode(String verifyCode) {
if (!TextUtils.isEmpty(verifyCode)) {
mVerifyCode = verifyCode;
mPlayPresenter.setDeviceEncrypt(mDeviceSerial, mVerifyCode);
realStartPlay(mVerifyCode);
}
}
}).show();
}
}
</DeepExtract>
|
EZOpenAPP-Lite-Android
|
positive
|
@Test
public void whenConnecting_onStop_doesNotNotifyErrorConsumer() throws Exception {
engine.setDataConsumer(dataConsumer);
whenRetrievingMessages().thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
new Runnable() {
@Override
public void run() {
engine.stop();
throw new RuntimeException("Error");
}
}.run();
return messageList();
}
});
engine.start();
verifyZeroInteractions(errorConsumer);
}
|
<DeepExtract>
whenRetrievingMessages().thenAnswer(new Answer<Object>() {
@Override
public Object answer(InvocationOnMock invocation) throws Throwable {
new Runnable() {
@Override
public void run() {
engine.stop();
throw new RuntimeException("Error");
}
}.run();
return messageList();
}
});
</DeepExtract>
|
android-radio-t
|
positive
|
@Test
public void canDisableListenerForAnalogPin() {
int pin = 5;
mqttClient.toArduino(mqttMessage.analogListener(pin).disable().getTopic(), mqttMessage.analogListener(pin).disable().getMessage());
assertThat(serialReceived(), is(alpProtocolMessage(STOP_LISTENING_ANALOG).forPin(pin).withoutValue()));
}
|
<DeepExtract>
mqttClient.toArduino(mqttMessage.analogListener(pin).disable().getTopic(), mqttMessage.analogListener(pin).disable().getMessage());
</DeepExtract>
|
Ardulink-1
|
positive
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.