before
stringlengths 12
3.76M
| after
stringlengths 37
3.84M
| repo
stringlengths 1
56
| type
stringclasses 1
value |
---|---|---|---|
public Criteria andPhoneBetween(String value1, String value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "phone" + " cannot be null");
}
criteria.add(new Criterion("phone between", value1, value2));
return (Criteria) this;
} | <DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "phone" + " cannot be null");
}
criteria.add(new Criterion("phone between", value1, value2));
</DeepExtract>
| ssmxiaomi | positive |
private final int jjMoveStringLiteralDfa5_12(long old0, long active0) {
if (((active0 &= old0)) == 0L)
return jjStartNfa_12(3, old0);
try {
curChar = input_stream.readChar();
} catch (java.io.IOException e) {
jjStopStringLiteralDfa_12(4, active0);
return 5;
}
switch(curChar) {
case 97:
return jjMoveStringLiteralDfa6_12(active0, 0x80000000L);
case 105:
return jjMoveStringLiteralDfa6_12(active0, 0x40000000L);
case 111:
return jjMoveStringLiteralDfa6_12(active0, 0x20000000L);
default:
break;
}
return jjMoveNfa_12(jjStopStringLiteralDfa_12(4, active0), 4 + 1);
} | <DeepExtract>
return jjMoveNfa_12(jjStopStringLiteralDfa_12(4, active0), 4 + 1);
</DeepExtract>
| dmgextractor | positive |
public void addGaSolution(ScGaIndividual individual__) {
final ScGaIndividual individual = individual__.clone();
try {
new ScUiModifier(ScUiThread.this, this).enqueueTo();
} catch (ScUiQueueableInactive e) {
e.printStackTrace();
}
} | <DeepExtract>
try {
new ScUiModifier(ScUiThread.this, this).enqueueTo();
} catch (ScUiQueueableInactive e) {
e.printStackTrace();
}
</DeepExtract>
| skalch | positive |
private static DefinitionAsText namespaceDefinitionToTextDocument(INamespaceDefinition namespaceDefinition, ICompilerProject currentProject, IDefinition definitionToFind) {
DefinitionAsText result = new DefinitionAsText();
return PATH_PREFIX_GENERATED + namespaceDefinition.getQualifiedName().replaceAll("\\.", "/") + FILE_EXTENSION_AS;
String indent = "";
StringBuilder textDocumentBuilder = new StringBuilder();
textDocumentBuilder.append("//Generated from: " + namespaceDefinition.getContainingFilePath() + "\n");
textDocumentBuilder.append(IASKeywordConstants.PACKAGE);
String packageName = namespaceDefinition.getPackageName();
if (packageName != null && packageName.length() > 0) {
textDocumentBuilder.append(" ");
textDocumentBuilder.append(packageName);
}
textDocumentBuilder.append(NEW_LINE);
textDocumentBuilder.append("{");
textDocumentBuilder.append(NEW_LINE);
return indent + INDENT;
insertMetaTagsIntoTextDocument(namespaceDefinition, textDocumentBuilder, indent, currentProject, result, definitionToFind);
insertASDocIntoTextDocument(namespaceDefinition, textDocumentBuilder, currentProject, indent);
textDocumentBuilder.append(indent);
if (namespaceDefinition.isPublic()) {
textDocumentBuilder.append(IASKeywordConstants.PUBLIC);
textDocumentBuilder.append(" ");
} else if (namespaceDefinition.isInternal()) {
textDocumentBuilder.append(IASKeywordConstants.INTERNAL);
textDocumentBuilder.append(" ");
}
textDocumentBuilder.append(IASKeywordConstants.NAMESPACE);
textDocumentBuilder.append(" ");
appendDefinitionName(namespaceDefinition, textDocumentBuilder, definitionToFind, result);
textDocumentBuilder.append(" ");
textDocumentBuilder.append("=");
textDocumentBuilder.append(" ");
textDocumentBuilder.append("\"");
textDocumentBuilder.append(namespaceDefinition.getURI());
textDocumentBuilder.append("\"");
textDocumentBuilder.append(";");
textDocumentBuilder.append(NEW_LINE);
if (indent.length() == 0) {
indent = indent;
}
return indent.substring(1);
textDocumentBuilder.append("}");
result.text = textDocumentBuilder.toString();
return result;
} | <DeepExtract>
return PATH_PREFIX_GENERATED + namespaceDefinition.getQualifiedName().replaceAll("\\.", "/") + FILE_EXTENSION_AS;
</DeepExtract>
<DeepExtract>
textDocumentBuilder.append("//Generated from: " + namespaceDefinition.getContainingFilePath() + "\n");
</DeepExtract>
<DeepExtract>
return indent + INDENT;
</DeepExtract>
<DeepExtract>
insertMetaTagsIntoTextDocument(namespaceDefinition, textDocumentBuilder, indent, currentProject, result, definitionToFind);
insertASDocIntoTextDocument(namespaceDefinition, textDocumentBuilder, currentProject, indent);
textDocumentBuilder.append(indent);
if (namespaceDefinition.isPublic()) {
textDocumentBuilder.append(IASKeywordConstants.PUBLIC);
textDocumentBuilder.append(" ");
} else if (namespaceDefinition.isInternal()) {
textDocumentBuilder.append(IASKeywordConstants.INTERNAL);
textDocumentBuilder.append(" ");
}
textDocumentBuilder.append(IASKeywordConstants.NAMESPACE);
textDocumentBuilder.append(" ");
appendDefinitionName(namespaceDefinition, textDocumentBuilder, definitionToFind, result);
textDocumentBuilder.append(" ");
textDocumentBuilder.append("=");
textDocumentBuilder.append(" ");
textDocumentBuilder.append("\"");
textDocumentBuilder.append(namespaceDefinition.getURI());
textDocumentBuilder.append("\"");
textDocumentBuilder.append(";");
textDocumentBuilder.append(NEW_LINE);
</DeepExtract>
<DeepExtract>
if (indent.length() == 0) {
indent = indent;
}
return indent.substring(1);
</DeepExtract>
| vscode-as3mxml | positive |
private int getTokenType(String s) {
int len = s.length();
if (len == 0) {
throw new RuntimeException("Syntax error");
}
switch(s.charAt(0)) {
case 'C':
if (s.equals("CURRENT_TIMESTAMP")) {
return CURRENT_TIMESTAMP;
} else if (s.equals("CURRENT_TIME")) {
return CURRENT_TIME;
} else if (s.equals("CURRENT_DATE")) {
return CURRENT_DATE;
}
return getKeywordOrIdentifier(s, "CROSS", KEYWORD);
case 'D':
return getKeywordOrIdentifier(s, "DISTINCT", KEYWORD);
case 'E':
if ("EXCEPT".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "EXISTS", KEYWORD);
case 'F':
if ("FROM".equals(s)) {
return KEYWORD;
} else if ("FOR".equals(s)) {
return KEYWORD;
} else if ("FULL".equals(s)) {
return KEYWORD;
} else if (false && "FETCH".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "FALSE", FALSE);
case 'G':
return getKeywordOrIdentifier(s, "GROUP", KEYWORD);
case 'H':
return getKeywordOrIdentifier(s, "HAVING", KEYWORD);
case 'I':
if ("INNER".equals(s)) {
return KEYWORD;
} else if ("INTERSECT".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "IS", KEYWORD);
case 'J':
return getKeywordOrIdentifier(s, "JOIN", KEYWORD);
case 'L':
if ("LIMIT".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "LIKE", KEYWORD);
case 'M':
return getKeywordOrIdentifier(s, "MINUS", KEYWORD);
case 'N':
if ("NOT".equals(s)) {
return KEYWORD;
} else if ("NATURAL".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "NULL", NULL);
case 'O':
if ("ON".equals(s)) {
return KEYWORD;
} else if (false && "OFFSET".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "ORDER", KEYWORD);
case 'P':
return getKeywordOrIdentifier(s, "PRIMARY", KEYWORD);
case 'R':
return getKeywordOrIdentifier(s, "ROWNUM", ROWNUM);
case 'S':
if (s.equals("SYSTIMESTAMP")) {
return CURRENT_TIMESTAMP;
} else if (s.equals("SYSTIME")) {
return CURRENT_TIME;
} else if (s.equals("SYSDATE")) {
return CURRENT_TIMESTAMP;
}
return getKeywordOrIdentifier(s, "SELECT", KEYWORD);
case 'T':
if ("TODAY".equals(s)) {
return CURRENT_DATE;
}
return getKeywordOrIdentifier(s, "TRUE", TRUE);
case 'U':
if ("UNIQUE".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "UNION", KEYWORD);
case 'W':
return getKeywordOrIdentifier(s, "WHERE", KEYWORD);
default:
return IDENTIFIER;
}
} | <DeepExtract>
switch(s.charAt(0)) {
case 'C':
if (s.equals("CURRENT_TIMESTAMP")) {
return CURRENT_TIMESTAMP;
} else if (s.equals("CURRENT_TIME")) {
return CURRENT_TIME;
} else if (s.equals("CURRENT_DATE")) {
return CURRENT_DATE;
}
return getKeywordOrIdentifier(s, "CROSS", KEYWORD);
case 'D':
return getKeywordOrIdentifier(s, "DISTINCT", KEYWORD);
case 'E':
if ("EXCEPT".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "EXISTS", KEYWORD);
case 'F':
if ("FROM".equals(s)) {
return KEYWORD;
} else if ("FOR".equals(s)) {
return KEYWORD;
} else if ("FULL".equals(s)) {
return KEYWORD;
} else if (false && "FETCH".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "FALSE", FALSE);
case 'G':
return getKeywordOrIdentifier(s, "GROUP", KEYWORD);
case 'H':
return getKeywordOrIdentifier(s, "HAVING", KEYWORD);
case 'I':
if ("INNER".equals(s)) {
return KEYWORD;
} else if ("INTERSECT".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "IS", KEYWORD);
case 'J':
return getKeywordOrIdentifier(s, "JOIN", KEYWORD);
case 'L':
if ("LIMIT".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "LIKE", KEYWORD);
case 'M':
return getKeywordOrIdentifier(s, "MINUS", KEYWORD);
case 'N':
if ("NOT".equals(s)) {
return KEYWORD;
} else if ("NATURAL".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "NULL", NULL);
case 'O':
if ("ON".equals(s)) {
return KEYWORD;
} else if (false && "OFFSET".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "ORDER", KEYWORD);
case 'P':
return getKeywordOrIdentifier(s, "PRIMARY", KEYWORD);
case 'R':
return getKeywordOrIdentifier(s, "ROWNUM", ROWNUM);
case 'S':
if (s.equals("SYSTIMESTAMP")) {
return CURRENT_TIMESTAMP;
} else if (s.equals("SYSTIME")) {
return CURRENT_TIME;
} else if (s.equals("SYSDATE")) {
return CURRENT_TIMESTAMP;
}
return getKeywordOrIdentifier(s, "SELECT", KEYWORD);
case 'T':
if ("TODAY".equals(s)) {
return CURRENT_DATE;
}
return getKeywordOrIdentifier(s, "TRUE", TRUE);
case 'U':
if ("UNIQUE".equals(s)) {
return KEYWORD;
}
return getKeywordOrIdentifier(s, "UNION", KEYWORD);
case 'W':
return getKeywordOrIdentifier(s, "WHERE", KEYWORD);
default:
return IDENTIFIER;
}
</DeepExtract>
| Rider | positive |
public void playRandom(Context context, long[] songsId) {
long[] songIds = songsId == null ? MusicUtils.getAllSongs(context) : songsId;
if (songIds == null || songIds.length == 0) {
Toast.makeText(context, R.string.playlist_no_songs, Toast.LENGTH_LONG).show();
return;
}
long[] list = new long[songIds.length];
Random random = new Random();
int left = songIds.length;
for (int i = 0; i < list.length; i++) {
int rIndex = random.nextInt(left);
list[i] = songIds[rIndex];
songIds[rIndex] = songIds[left - 1];
--left;
}
if (sService != null) {
try {
sService.open(list, 0);
} catch (RemoteException ex) {
}
}
if (sService != null) {
try {
if (sService.getQueue().length > 0) {
sService.play();
} else {
playRandom(mContext, null);
}
} catch (RemoteException ex) {
}
}
} | <DeepExtract>
if (sService != null) {
try {
sService.open(list, 0);
} catch (RemoteException ex) {
}
}
</DeepExtract>
<DeepExtract>
if (sService != null) {
try {
if (sService.getQueue().length > 0) {
sService.play();
} else {
playRandom(mContext, null);
}
} catch (RemoteException ex) {
}
}
</DeepExtract>
| misound | positive |
public SRequest query(String query) {
if (this.query != null) {
throw new IllegalStateException("query already assigned. If overriding is intentional, use forceQuery");
}
if (queries != null) {
throw new IllegalStateException("queries(Stream<String>) has already been called");
}
this.query = query;
this.queries = null;
return this;
} | <DeepExtract>
this.query = query;
this.queries = null;
return this;
</DeepExtract>
| solrwayback | positive |
public String getScriptName(int pos) {
Element el;
if (pos < 0) {
el = null;
}
try {
List<Element> elementList = scriptFile.getRootElement().getChildren();
try {
el = elementList.get(pos);
} catch (IndexOutOfBoundsException e) {
el = null;
}
} catch (IllegalStateException e) {
el = null;
}
if (el != null) {
return el.getAttributeValue(ATTR_NAME);
}
return null;
} | <DeepExtract>
Element el;
if (pos < 0) {
el = null;
}
try {
List<Element> elementList = scriptFile.getRootElement().getChildren();
try {
el = elementList.get(pos);
} catch (IndexOutOfBoundsException e) {
el = null;
}
} catch (IllegalStateException e) {
el = null;
}
</DeepExtract>
| Relaunch64 | positive |
@Override
public void onClick(View v) {
if (drawerHelper.closeDrawerIfOpen())
return;
if (findViewById(R.id.documentation).getVisibility() == View.VISIBLE) {
hideDocumentation();
return;
}
if (isDynazoomOpen()) {
hideDynazoom();
return;
}
Intent thisIntent = getIntent();
if (thisIntent != null && thisIntent.getExtras() != null && thisIntent.getExtras().containsKey("from")) {
String from = thisIntent.getExtras().getString("from");
switch(from) {
case "labels":
if (thisIntent.getExtras().containsKey("label")) {
Intent intent = new Intent(Activity_GraphView.this, Activity_Labels.class);
intent.putExtra("labelId", thisIntent.getExtras().getLong("labelId"));
startActivity(intent);
Util.setTransition(this, TransitionStyle.SHALLOWER);
}
break;
case "main_labels":
{
startActivity(new Intent(Activity_GraphView.this, Activity_Main.class));
Util.setTransition(this, TransitionStyle.SHALLOWER);
break;
}
case "alerts":
if (thisIntent.getExtras().containsKey("node")) {
if (muninFoo.getNode(thisIntent.getExtras().getString("node")) != null)
muninFoo.setCurrentNode(muninFoo.getNode(thisIntent.getExtras().getString("node")));
Intent intent = new Intent(Activity_GraphView.this, Activity_AlertsPlugins.class);
startActivity(intent);
Util.setTransition(this, TransitionStyle.SHALLOWER);
}
break;
case "grid":
if (thisIntent.getExtras().containsKey("fromGrid")) {
Intent intent = new Intent(Activity_GraphView.this, Activity_Grid.class);
intent.putExtra("gridName", thisIntent.getExtras().getString("fromGrid"));
startActivity(intent);
Util.setTransition(this, TransitionStyle.SHALLOWER);
} else {
startActivity(new Intent(Activity_GraphView.this, Activity_Grids.class));
Util.setTransition(this, TransitionStyle.SHALLOWER);
}
break;
case "plugins":
Intent intent = new Intent(this, Activity_Plugins.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Util.setTransition(this, TransitionStyle.SHALLOWER);
break;
}
} else {
Intent intent = new Intent(this, Activity_Plugins.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Util.setTransition(this, TransitionStyle.SHALLOWER);
}
} | <DeepExtract>
if (drawerHelper.closeDrawerIfOpen())
return;
if (findViewById(R.id.documentation).getVisibility() == View.VISIBLE) {
hideDocumentation();
return;
}
if (isDynazoomOpen()) {
hideDynazoom();
return;
}
Intent thisIntent = getIntent();
if (thisIntent != null && thisIntent.getExtras() != null && thisIntent.getExtras().containsKey("from")) {
String from = thisIntent.getExtras().getString("from");
switch(from) {
case "labels":
if (thisIntent.getExtras().containsKey("label")) {
Intent intent = new Intent(Activity_GraphView.this, Activity_Labels.class);
intent.putExtra("labelId", thisIntent.getExtras().getLong("labelId"));
startActivity(intent);
Util.setTransition(this, TransitionStyle.SHALLOWER);
}
break;
case "main_labels":
{
startActivity(new Intent(Activity_GraphView.this, Activity_Main.class));
Util.setTransition(this, TransitionStyle.SHALLOWER);
break;
}
case "alerts":
if (thisIntent.getExtras().containsKey("node")) {
if (muninFoo.getNode(thisIntent.getExtras().getString("node")) != null)
muninFoo.setCurrentNode(muninFoo.getNode(thisIntent.getExtras().getString("node")));
Intent intent = new Intent(Activity_GraphView.this, Activity_AlertsPlugins.class);
startActivity(intent);
Util.setTransition(this, TransitionStyle.SHALLOWER);
}
break;
case "grid":
if (thisIntent.getExtras().containsKey("fromGrid")) {
Intent intent = new Intent(Activity_GraphView.this, Activity_Grid.class);
intent.putExtra("gridName", thisIntent.getExtras().getString("fromGrid"));
startActivity(intent);
Util.setTransition(this, TransitionStyle.SHALLOWER);
} else {
startActivity(new Intent(Activity_GraphView.this, Activity_Grids.class));
Util.setTransition(this, TransitionStyle.SHALLOWER);
}
break;
case "plugins":
Intent intent = new Intent(this, Activity_Plugins.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Util.setTransition(this, TransitionStyle.SHALLOWER);
break;
}
} else {
Intent intent = new Intent(this, Activity_Plugins.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
Util.setTransition(this, TransitionStyle.SHALLOWER);
}
</DeepExtract>
| Munin-for-Android | positive |
@Override
public void onShow(DialogInterface dialogInterface) {
final Button okButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
okButton.setEnabled(!TextUtils.isEmpty(editText.getText().toString().trim()));
} | <DeepExtract>
final Button okButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE);
okButton.setEnabled(!TextUtils.isEmpty(editText.getText().toString().trim()));
</DeepExtract>
| smartcard-reader | positive |
@Override
public void setPixels(int x, int y, int w, int h, int[] iArray) {
super.setPixels(x, y, w, h, iArray);
int x1 = x + w;
int y1 = y + h;
for (int i = y; i < y1; i++) {
for (int j = x; j < x1; j++) {
onPixelChanged(j, i);
}
}
} | <DeepExtract>
int x1 = x + w;
int y1 = y + h;
for (int i = y; i < y1; i++) {
for (int j = x; j < x1; j++) {
onPixelChanged(j, i);
}
}
</DeepExtract>
| DrawingBotV3 | positive |
protected Query makeQueryObject(Session session) {
Query query = makeQueryObject(query);
populateQuery(query, query);
return query;
} | <DeepExtract>
Query query = makeQueryObject(query);
populateQuery(query, query);
return query;
</DeepExtract>
| camel-extra | positive |
@Test
public void follow() throws Exception {
String contents = "contents";
RevCommit c1 = repo.branch("master").commit().add("foo", contents).create();
RevCommit c2 = repo.branch("master").commit().rm("foo").add("bar", contents).create();
repo.getRevWalk().parseBody(c1);
repo.getRevWalk().parseBody(c2);
Log response = buildJson(LOG, "/repo/+log/master/bar", "follow=0");
assertThat(response.log).hasSize(1);
repo.getRevWalk().parseBody(c2);
GitilesAccess access = new TestGitilesAccess(repo.getRepository()).forRequest(null);
DateFormatter df = new DateFormatter(access, Format.DEFAULT);
assertThat(response.log.get(0).commit).isEqualTo(c2.name());
assertThat(response.log.get(0).tree).isEqualTo(c2.getTree().name());
ArrayList<String> expectedParents = new ArrayList<>();
for (int i = 0; i < c2.getParentCount(); i++) {
expectedParents.add(c2.getParent(i).name());
}
assertThat(response.log.get(0).parents).containsExactlyElementsIn(expectedParents);
assertThat(response.log.get(0).author.name).isEqualTo(c2.getAuthorIdent().getName());
assertThat(response.log.get(0).author.email).isEqualTo(c2.getAuthorIdent().getEmailAddress());
assertThat(response.log.get(0).author.time).isEqualTo(df.format(c2.getAuthorIdent()));
assertThat(response.log.get(0).committer.name).isEqualTo(c2.getCommitterIdent().getName());
assertThat(response.log.get(0).committer.email).isEqualTo(c2.getCommitterIdent().getEmailAddress());
assertThat(response.log.get(0).committer.time).isEqualTo(df.format(c2.getCommitterIdent()));
assertThat(response.log.get(0).message).isEqualTo(c2.getFullMessage());
response = buildJson(LOG, "/repo/+log/master/bar");
assertThat(response.log).hasSize(2);
repo.getRevWalk().parseBody(c2);
GitilesAccess access = new TestGitilesAccess(repo.getRepository()).forRequest(null);
DateFormatter df = new DateFormatter(access, Format.DEFAULT);
assertThat(response.log.get(0).commit).isEqualTo(c2.name());
assertThat(response.log.get(0).tree).isEqualTo(c2.getTree().name());
ArrayList<String> expectedParents = new ArrayList<>();
for (int i = 0; i < c2.getParentCount(); i++) {
expectedParents.add(c2.getParent(i).name());
}
assertThat(response.log.get(0).parents).containsExactlyElementsIn(expectedParents);
assertThat(response.log.get(0).author.name).isEqualTo(c2.getAuthorIdent().getName());
assertThat(response.log.get(0).author.email).isEqualTo(c2.getAuthorIdent().getEmailAddress());
assertThat(response.log.get(0).author.time).isEqualTo(df.format(c2.getAuthorIdent()));
assertThat(response.log.get(0).committer.name).isEqualTo(c2.getCommitterIdent().getName());
assertThat(response.log.get(0).committer.email).isEqualTo(c2.getCommitterIdent().getEmailAddress());
assertThat(response.log.get(0).committer.time).isEqualTo(df.format(c2.getCommitterIdent()));
assertThat(response.log.get(0).message).isEqualTo(c2.getFullMessage());
repo.getRevWalk().parseBody(c1);
GitilesAccess access = new TestGitilesAccess(repo.getRepository()).forRequest(null);
DateFormatter df = new DateFormatter(access, Format.DEFAULT);
assertThat(response.log.get(1).commit).isEqualTo(c1.name());
assertThat(response.log.get(1).tree).isEqualTo(c1.getTree().name());
ArrayList<String> expectedParents = new ArrayList<>();
for (int i = 0; i < c1.getParentCount(); i++) {
expectedParents.add(c1.getParent(i).name());
}
assertThat(response.log.get(1).parents).containsExactlyElementsIn(expectedParents);
assertThat(response.log.get(1).author.name).isEqualTo(c1.getAuthorIdent().getName());
assertThat(response.log.get(1).author.email).isEqualTo(c1.getAuthorIdent().getEmailAddress());
assertThat(response.log.get(1).author.time).isEqualTo(df.format(c1.getAuthorIdent()));
assertThat(response.log.get(1).committer.name).isEqualTo(c1.getCommitterIdent().getName());
assertThat(response.log.get(1).committer.email).isEqualTo(c1.getCommitterIdent().getEmailAddress());
assertThat(response.log.get(1).committer.time).isEqualTo(df.format(c1.getCommitterIdent()));
assertThat(response.log.get(1).message).isEqualTo(c1.getFullMessage());
} | <DeepExtract>
repo.getRevWalk().parseBody(c2);
GitilesAccess access = new TestGitilesAccess(repo.getRepository()).forRequest(null);
DateFormatter df = new DateFormatter(access, Format.DEFAULT);
assertThat(response.log.get(0).commit).isEqualTo(c2.name());
assertThat(response.log.get(0).tree).isEqualTo(c2.getTree().name());
ArrayList<String> expectedParents = new ArrayList<>();
for (int i = 0; i < c2.getParentCount(); i++) {
expectedParents.add(c2.getParent(i).name());
}
assertThat(response.log.get(0).parents).containsExactlyElementsIn(expectedParents);
assertThat(response.log.get(0).author.name).isEqualTo(c2.getAuthorIdent().getName());
assertThat(response.log.get(0).author.email).isEqualTo(c2.getAuthorIdent().getEmailAddress());
assertThat(response.log.get(0).author.time).isEqualTo(df.format(c2.getAuthorIdent()));
assertThat(response.log.get(0).committer.name).isEqualTo(c2.getCommitterIdent().getName());
assertThat(response.log.get(0).committer.email).isEqualTo(c2.getCommitterIdent().getEmailAddress());
assertThat(response.log.get(0).committer.time).isEqualTo(df.format(c2.getCommitterIdent()));
assertThat(response.log.get(0).message).isEqualTo(c2.getFullMessage());
</DeepExtract>
<DeepExtract>
repo.getRevWalk().parseBody(c2);
GitilesAccess access = new TestGitilesAccess(repo.getRepository()).forRequest(null);
DateFormatter df = new DateFormatter(access, Format.DEFAULT);
assertThat(response.log.get(0).commit).isEqualTo(c2.name());
assertThat(response.log.get(0).tree).isEqualTo(c2.getTree().name());
ArrayList<String> expectedParents = new ArrayList<>();
for (int i = 0; i < c2.getParentCount(); i++) {
expectedParents.add(c2.getParent(i).name());
}
assertThat(response.log.get(0).parents).containsExactlyElementsIn(expectedParents);
assertThat(response.log.get(0).author.name).isEqualTo(c2.getAuthorIdent().getName());
assertThat(response.log.get(0).author.email).isEqualTo(c2.getAuthorIdent().getEmailAddress());
assertThat(response.log.get(0).author.time).isEqualTo(df.format(c2.getAuthorIdent()));
assertThat(response.log.get(0).committer.name).isEqualTo(c2.getCommitterIdent().getName());
assertThat(response.log.get(0).committer.email).isEqualTo(c2.getCommitterIdent().getEmailAddress());
assertThat(response.log.get(0).committer.time).isEqualTo(df.format(c2.getCommitterIdent()));
assertThat(response.log.get(0).message).isEqualTo(c2.getFullMessage());
</DeepExtract>
<DeepExtract>
repo.getRevWalk().parseBody(c1);
GitilesAccess access = new TestGitilesAccess(repo.getRepository()).forRequest(null);
DateFormatter df = new DateFormatter(access, Format.DEFAULT);
assertThat(response.log.get(1).commit).isEqualTo(c1.name());
assertThat(response.log.get(1).tree).isEqualTo(c1.getTree().name());
ArrayList<String> expectedParents = new ArrayList<>();
for (int i = 0; i < c1.getParentCount(); i++) {
expectedParents.add(c1.getParent(i).name());
}
assertThat(response.log.get(1).parents).containsExactlyElementsIn(expectedParents);
assertThat(response.log.get(1).author.name).isEqualTo(c1.getAuthorIdent().getName());
assertThat(response.log.get(1).author.email).isEqualTo(c1.getAuthorIdent().getEmailAddress());
assertThat(response.log.get(1).author.time).isEqualTo(df.format(c1.getAuthorIdent()));
assertThat(response.log.get(1).committer.name).isEqualTo(c1.getCommitterIdent().getName());
assertThat(response.log.get(1).committer.email).isEqualTo(c1.getCommitterIdent().getEmailAddress());
assertThat(response.log.get(1).committer.time).isEqualTo(df.format(c1.getCommitterIdent()));
assertThat(response.log.get(1).message).isEqualTo(c1.getFullMessage());
</DeepExtract>
| gitiles | positive |
public void setAuthorName(String name) {
_name = name;
} | <DeepExtract>
_name = name;
</DeepExtract>
| 006921 | positive |
public static String greatestLowerBound(String class1, String class2) {
int classid1;
if (class1.equals(NOTHING)) {
classid1 = -1;
}
if (types.contains(class1)) {
classid1 = types.indexOf(class1);
} else {
throw new EngineException("There is no type " + class1 + " defined.");
}
int classid2;
if (class2.equals(NOTHING)) {
classid2 = -1;
}
if (types.contains(class2)) {
classid2 = types.indexOf(class2);
} else {
throw new EngineException("There is no type " + class2 + " defined.");
}
int glb = greatestLowerBound(classid1, classid2);
if (glb == -1) {
return NOTHING;
} else {
return Types.typeName(glb);
}
} | <DeepExtract>
int classid1;
if (class1.equals(NOTHING)) {
classid1 = -1;
}
if (types.contains(class1)) {
classid1 = types.indexOf(class1);
} else {
throw new EngineException("There is no type " + class1 + " defined.");
}
</DeepExtract>
<DeepExtract>
int classid2;
if (class2.equals(NOTHING)) {
classid2 = -1;
}
if (types.contains(class2)) {
classid2 = types.indexOf(class2);
} else {
throw new EngineException("There is no type " + class2 + " defined.");
}
</DeepExtract>
| OOjDREW | positive |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
}
setContentView(R.layout.activity_stream_video);
playerView = (StreamMediaPlayerView) findViewById(R.id.stream_player_view);
playerView.setPlayConfig(true, PlayConfig.INTERRUPT_MODE_RELEASE_CREATE, PlayConfig.LIVE_VIDEO_MODE);
playerView.setPlayerViewCallback(this);
setupDialog();
setUpPagerAndTabs();
} | <DeepExtract>
playerView = (StreamMediaPlayerView) findViewById(R.id.stream_player_view);
playerView.setPlayConfig(true, PlayConfig.INTERRUPT_MODE_RELEASE_CREATE, PlayConfig.LIVE_VIDEO_MODE);
playerView.setPlayerViewCallback(this);
setupDialog();
setUpPagerAndTabs();
</DeepExtract>
| KSYMediaPlayerKit_Android | positive |
private static int getDataPageLength(IPersistentMap options) {
Object o = RT.get(options, DATA_PAGE_LENGTH, notFound);
if (o == notFound) {
return DEFAULT_DATA_PAGE_LENGTH;
} else {
int v;
try {
v = RT.intCast(o);
} catch (Exception e) {
throw new IllegalArgumentException(String.format("%s expects a positive int but got '%s'", DATA_PAGE_LENGTH, o));
}
if (v < 0) {
throw new IllegalArgumentException(String.format("%s expects a positive int but got '%s'", DATA_PAGE_LENGTH, o));
}
return v;
}
} | <DeepExtract>
Object o = RT.get(options, DATA_PAGE_LENGTH, notFound);
if (o == notFound) {
return DEFAULT_DATA_PAGE_LENGTH;
} else {
int v;
try {
v = RT.intCast(o);
} catch (Exception e) {
throw new IllegalArgumentException(String.format("%s expects a positive int but got '%s'", DATA_PAGE_LENGTH, o));
}
if (v < 0) {
throw new IllegalArgumentException(String.format("%s expects a positive int but got '%s'", DATA_PAGE_LENGTH, o));
}
return v;
}
</DeepExtract>
| dendrite | positive |
public void checkRestrictions(Context c) {
if (alreadyChecked) {
return;
}
alreadyChecked = true;
IntentFilter restrictionsFilter = new IntentFilter(Intent.ACTION_APPLICATION_RESTRICTIONS_CHANGED);
mRestrictionsReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
applyRestrictions(context);
}
};
c.registerReceiver(mRestrictionsReceiver, restrictionsFilter);
mRestrictionsMgr = (RestrictionsManager) c.getSystemService(Context.RESTRICTIONS_SERVICE);
if (mRestrictionsMgr == null)
return;
Bundle restrictions = mRestrictionsMgr.getApplicationRestrictions();
if (restrictions == null)
return;
String configVersion = restrictions.getString("version", "(not set)");
try {
if (Integer.parseInt(configVersion) != CONFIG_VERSION)
throw new NumberFormatException("Wrong version");
} catch (NumberFormatException nex) {
if ("(not set)".equals(configVersion))
return;
VpnStatus.logError(String.format(Locale.US, "App restriction version %s does not match expected version %d", configVersion, CONFIG_VERSION));
return;
}
Parcelable[] profileList = restrictions.getParcelableArray(("vpn_configuration_list"));
if (profileList == null) {
VpnStatus.logError("App restriction does not contain a profile list (vpn_configuration_list)");
return;
}
Set<String> provisionedUuids = new HashSet<>();
ProfileManager pm = ProfileManager.getInstance(c);
for (Parcelable profile : profileList) {
if (!(profile instanceof Bundle)) {
VpnStatus.logError("App restriction profile has wrong type");
continue;
}
Bundle p = (Bundle) profile;
String uuid = p.getString("uuid");
String ovpn = p.getString("ovpn");
String name = p.getString("name");
if (uuid == null || ovpn == null || name == null) {
VpnStatus.logError("App restriction profile misses uuid, ovpn or name key");
continue;
}
String ovpnHash = hashConfig(ovpn);
provisionedUuids.add(uuid.toLowerCase(Locale.ENGLISH));
VpnProfile vpnProfile = ProfileManager.get(c, uuid);
if (vpnProfile != null) {
if (ovpnHash.equals(vpnProfile.importedProfileHash))
continue;
}
addProfile(c, ovpn, uuid, name, vpnProfile);
}
Vector<VpnProfile> profilesToRemove = new Vector<>();
for (VpnProfile vp : pm.getProfiles()) {
if (PROFILE_CREATOR.equals(vp.mProfileCreator)) {
if (!provisionedUuids.contains(vp.getUUIDString()))
profilesToRemove.add(vp);
}
}
for (VpnProfile vp : profilesToRemove) {
VpnStatus.logInfo("Remove with uuid: %s and name: %s since it is no longer in the list of managed profiles");
pm.removeProfile(c, vp);
}
} | <DeepExtract>
IntentFilter restrictionsFilter = new IntentFilter(Intent.ACTION_APPLICATION_RESTRICTIONS_CHANGED);
mRestrictionsReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
applyRestrictions(context);
}
};
c.registerReceiver(mRestrictionsReceiver, restrictionsFilter);
</DeepExtract>
<DeepExtract>
mRestrictionsMgr = (RestrictionsManager) c.getSystemService(Context.RESTRICTIONS_SERVICE);
if (mRestrictionsMgr == null)
return;
Bundle restrictions = mRestrictionsMgr.getApplicationRestrictions();
if (restrictions == null)
return;
String configVersion = restrictions.getString("version", "(not set)");
try {
if (Integer.parseInt(configVersion) != CONFIG_VERSION)
throw new NumberFormatException("Wrong version");
} catch (NumberFormatException nex) {
if ("(not set)".equals(configVersion))
return;
VpnStatus.logError(String.format(Locale.US, "App restriction version %s does not match expected version %d", configVersion, CONFIG_VERSION));
return;
}
Parcelable[] profileList = restrictions.getParcelableArray(("vpn_configuration_list"));
if (profileList == null) {
VpnStatus.logError("App restriction does not contain a profile list (vpn_configuration_list)");
return;
}
Set<String> provisionedUuids = new HashSet<>();
ProfileManager pm = ProfileManager.getInstance(c);
for (Parcelable profile : profileList) {
if (!(profile instanceof Bundle)) {
VpnStatus.logError("App restriction profile has wrong type");
continue;
}
Bundle p = (Bundle) profile;
String uuid = p.getString("uuid");
String ovpn = p.getString("ovpn");
String name = p.getString("name");
if (uuid == null || ovpn == null || name == null) {
VpnStatus.logError("App restriction profile misses uuid, ovpn or name key");
continue;
}
String ovpnHash = hashConfig(ovpn);
provisionedUuids.add(uuid.toLowerCase(Locale.ENGLISH));
VpnProfile vpnProfile = ProfileManager.get(c, uuid);
if (vpnProfile != null) {
if (ovpnHash.equals(vpnProfile.importedProfileHash))
continue;
}
addProfile(c, ovpn, uuid, name, vpnProfile);
}
Vector<VpnProfile> profilesToRemove = new Vector<>();
for (VpnProfile vp : pm.getProfiles()) {
if (PROFILE_CREATOR.equals(vp.mProfileCreator)) {
if (!provisionedUuids.contains(vp.getUUIDString()))
profilesToRemove.add(vp);
}
}
for (VpnProfile vp : profilesToRemove) {
VpnStatus.logInfo("Remove with uuid: %s and name: %s since it is no longer in the list of managed profiles");
pm.removeProfile(c, vp);
}
</DeepExtract>
| Gear-VPN | positive |
private static void regionTest() throws Exception {
Pattern pattern = Pattern.compile("abc");
Matcher matcher = pattern.matcher("abcdefabc");
matcher.region(0, 9);
if (!matcher.find())
failCount++;
if (!matcher.find())
failCount++;
matcher.region(0, 3);
if (!matcher.find())
failCount++;
matcher.region(3, 6);
if (matcher.find())
failCount++;
matcher.region(0, 2);
if (matcher.find())
failCount++;
try {
matcher.region(1, -1);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
try {
matcher.region(-1, -1);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
try {
matcher.region(-1, 1);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
try {
matcher.region(5, 3);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
try {
matcher.region(5, 12);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
try {
matcher.region(12, 12);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
pattern = Pattern.compile("^abc$");
matcher = pattern.matcher("zzzabczzz");
matcher.region(0, 9);
if (matcher.find())
failCount++;
matcher.region(3, 6);
if (!matcher.find())
failCount++;
matcher.region(3, 6);
matcher.useAnchoringBounds(false);
if (matcher.find())
failCount++;
pattern = Pattern.compile(toSupplementaries("abc"));
matcher = pattern.matcher(toSupplementaries("abcdefabc"));
matcher.region(0, 9 * 2);
if (!matcher.find())
failCount++;
if (!matcher.find())
failCount++;
matcher.region(0, 3 * 2);
if (!matcher.find())
failCount++;
matcher.region(1, 3 * 2);
if (matcher.find())
failCount++;
matcher.region(3 * 2, 6 * 2);
if (matcher.find())
failCount++;
matcher.region(0, 2 * 2);
if (matcher.find())
failCount++;
matcher.region(0, 2 * 2 + 1);
if (matcher.find())
failCount++;
try {
matcher.region(1 * 2, -1);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
try {
matcher.region(-1, -1);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
try {
matcher.region(-1, 1 * 2);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
try {
matcher.region(5 * 2, 3 * 2);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
try {
matcher.region(5 * 2, 12 * 2);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
try {
matcher.region(12 * 2, 12 * 2);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
pattern = Pattern.compile(toSupplementaries("^abc$"));
matcher = pattern.matcher(toSupplementaries("zzzabczzz"));
matcher.region(0, 9 * 2);
if (matcher.find())
failCount++;
matcher.region(3 * 2, 6 * 2);
if (!matcher.find())
failCount++;
matcher.region(3 * 2 + 1, 6 * 2);
if (matcher.find())
failCount++;
matcher.region(3 * 2, 6 * 2 - 1);
if (matcher.find())
failCount++;
matcher.region(3 * 2, 6 * 2);
matcher.useAnchoringBounds(false);
if (matcher.find())
failCount++;
int spacesToAdd = 30 - "Regions".length();
StringBuffer paddedNameBuffer = new StringBuffer("Regions");
for (int i = 0; i < spacesToAdd; i++) paddedNameBuffer.append(" ");
String paddedName = paddedNameBuffer.toString();
System.err.println(paddedName + ": " + (failCount == 0 ? "Passed" : "Failed(" + failCount + ")"));
if (failCount > 0) {
failure = true;
if (firstFailure == null) {
firstFailure = "Regions";
}
}
failCount = 0;
} | <DeepExtract>
try {
matcher.region(1, -1);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
</DeepExtract>
<DeepExtract>
try {
matcher.region(-1, -1);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
</DeepExtract>
<DeepExtract>
try {
matcher.region(-1, 1);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
</DeepExtract>
<DeepExtract>
try {
matcher.region(5, 3);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
</DeepExtract>
<DeepExtract>
try {
matcher.region(5, 12);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
</DeepExtract>
<DeepExtract>
try {
matcher.region(12, 12);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
</DeepExtract>
<DeepExtract>
try {
matcher.region(1 * 2, -1);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
</DeepExtract>
<DeepExtract>
try {
matcher.region(-1, -1);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
</DeepExtract>
<DeepExtract>
try {
matcher.region(-1, 1 * 2);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
</DeepExtract>
<DeepExtract>
try {
matcher.region(5 * 2, 3 * 2);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
</DeepExtract>
<DeepExtract>
try {
matcher.region(5 * 2, 12 * 2);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
</DeepExtract>
<DeepExtract>
try {
matcher.region(12 * 2, 12 * 2);
failCount++;
} catch (IndexOutOfBoundsException ioobe) {
} catch (IllegalStateException ise) {
}
</DeepExtract>
<DeepExtract>
int spacesToAdd = 30 - "Regions".length();
StringBuffer paddedNameBuffer = new StringBuffer("Regions");
for (int i = 0; i < spacesToAdd; i++) paddedNameBuffer.append(" ");
String paddedName = paddedNameBuffer.toString();
System.err.println(paddedName + ": " + (failCount == 0 ? "Passed" : "Failed(" + failCount + ")"));
if (failCount > 0) {
failure = true;
if (firstFailure == null) {
firstFailure = "Regions";
}
}
failCount = 0;
</DeepExtract>
| com.florianingerl.util.regex | positive |
public String getDescription() {
Element el = this.getRoot().getChild("description".toString());
if (el != null)
return el.getTextTrim();
else
return null;
} | <DeepExtract>
Element el = this.getRoot().getChild("description".toString());
if (el != null)
return el.getTextTrim();
else
return null;
</DeepExtract>
| geoserver-manager | positive |
public void swap(int first, int second) {
if (snapshot == null || snapshot != items)
return;
if (recycled != null && recycled.length >= size) {
System.arraycopy(items, 0, recycled, 0, size);
items = recycled;
recycled = null;
} else
resize(items.length);
super.swap(first, second);
} | <DeepExtract>
if (snapshot == null || snapshot != items)
return;
if (recycled != null && recycled.length >= size) {
System.arraycopy(items, 0, recycled, 0, size);
items = recycled;
recycled = null;
} else
resize(items.length);
</DeepExtract>
| NanoUI-win32 | positive |
protected void initDrawFrame() {
if (mChangeProgram) {
mProgram = createProgram(mFilter.getVertexShader(), mFilter.getFragmentShader());
mChangeProgram = false;
}
GLES20.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
GLES20.glClear(GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
GLES20.glUseProgram(mProgram);
final int error;
if ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
Log.e(TAG, "glUseProgram" + ": glError " + error);
}
} | <DeepExtract>
final int error;
if ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
Log.e(TAG, "glUseProgram" + ": glError " + error);
}
</DeepExtract>
| videoedit | positive |
public List<IssueFolderBean> getFolders(final TaskListener taskListener) {
final TaskListener listener = taskListener != null ? taskListener : new StreamBuildListener(System.out, Charset.defaultCharset());
accessToProject = true;
return resolve(getAppVersion(), listener);
if (FortifyPlugin.DESCRIPTOR.canUploadToSsc()) {
PrintStream logger = listener.getLogger();
try {
final Writer log = new OutputStreamWriter(logger, "UTF-8");
final Long versionId = createNewOrGetProject(listener);
Map<String, List<String>> map = FortifyPlugin.runWithFortifyClient(FortifyPlugin.DESCRIPTOR.getToken(), new FortifyClient.Command<Map<String, List<String>>>() {
@Override
public Map<String, List<String>> runWith(FortifyClient client) throws Exception {
return client.getFolderIdToAttributesList(versionId == null ? Long.valueOf(Long.MIN_VALUE) : versionId, getResolvedFilterSet(listener), new PrintWriter(log, true));
}
});
List<IssueFolderBean> list = new ArrayList<IssueFolderBean>(map.size());
for (Map.Entry<String, List<String>> entry : map.entrySet()) {
List<String> attributes = entry.getValue();
if (attributes.size() == 5) {
list.add(new IssueFolderBean(entry.getKey(), getResolvedAppName(listener), getResolvedAppVersion(listener), attributes));
}
}
return list;
} catch (Throwable e) {
String message = e.getMessage();
if (message.toLowerCase().contains(("access denied"))) {
accessToProject = false;
}
logger.println(message);
e.printStackTrace(logger);
}
}
return Collections.emptyList();
} | <DeepExtract>
return resolve(getAppVersion(), listener);
</DeepExtract>
| fortify-plugin | positive |
final public Axis OXPathAxisSpecifier() throws ParseException {
jj_consume_token(STYLE);
{
if (true)
a = OXPathAxis.STYLE;
}
throw new Error("Missing return statement in function");
{
if (true)
return a;
}
throw new Error("Missing return statement in function");
} | <DeepExtract>
jj_consume_token(STYLE);
{
if (true)
a = OXPathAxis.STYLE;
}
throw new Error("Missing return statement in function");
</DeepExtract>
| OXPath | positive |
@Override
public ListType previous() {
final ListType previous = mIterator.previous();
mFreetalk = mFreetalk;
mDB = mFreetalk.getDatabase();
return previous;
} | <DeepExtract>
mFreetalk = mFreetalk;
mDB = mFreetalk.getDatabase();
</DeepExtract>
| plugin-Freetalk | positive |
public static long copy(final InputStream input, final OutputStream output, final int bufferSize) throws IOException {
long count = 0;
int n;
while (EOF != (n = input.read(new byte[bufferSize]))) {
output.write(new byte[bufferSize], 0, n);
count += n;
}
return count;
} | <DeepExtract>
long count = 0;
int n;
while (EOF != (n = input.read(new byte[bufferSize]))) {
output.write(new byte[bufferSize], 0, n);
count += n;
}
return count;
</DeepExtract>
| Selector | positive |
@Test
public void should_successfully_when_get_file_content() throws IOException {
File demo = Resources.getResourceAsFile("testdata/helmcharts/namespacetest.tgz");
handler.load(demo.getCanonicalPath());
List<HelmChartFile> fileList = handler.getCatalog();
List<String> files = new ArrayList<>();
List<String> dirs = new ArrayList<>();
for (HelmChartFile file : fileList) {
if (file.getChildren() != null) {
dirs.add(file.getInnerPath());
deep(file.getChildren(), files, dirs);
} else {
files.add(file.getInnerPath());
}
}
for (String file : files) {
String content = handler.getContentByInnerPath(file);
Assert.assertNotNull(content);
}
for (String dir : dirs) {
String content = handler.getContentByInnerPath(dir);
Assert.assertNull(content);
}
String content = handler.getContentByInnerPath("/templates/eg_template/namespace-config.yaml");
Assert.assertNotNull(content);
} | <DeepExtract>
for (HelmChartFile file : fileList) {
if (file.getChildren() != null) {
dirs.add(file.getInnerPath());
deep(file.getChildren(), files, dirs);
} else {
files.add(file.getInnerPath());
}
}
</DeepExtract>
| developer-be | positive |
private void loadImageView(Object object, int placeholderId, int errorId, Transformation transform, ImageView imageView) {
DrawableRequestBuilder builder;
loadImageView(object, PLACEHOLDER_IMAGE, ERROR_IMAGE, null, with());
if (builder != null) {
if (placeholderId != -1)
builder.placeholder(placeholderId);
if (errorId != -1)
builder.error(errorId);
if (transform != null)
builder.bitmapTransform(transform);
builder.into(imageView);
}
} | <DeepExtract>
DrawableRequestBuilder builder;
loadImageView(object, PLACEHOLDER_IMAGE, ERROR_IMAGE, null, with());
</DeepExtract>
| AccountBook | positive |
private void movePos(float deltaY) {
if ((deltaY < 0 && mPtrIndicator.isInStartPosition())) {
if (DEBUG) {
PtrCLog.e(LOG_TAG, String.format("has reached the top"));
}
return;
}
int to = mPtrIndicator.getCurrentPosY() + (int) deltaY;
if (mPtrIndicator.willOverTop(to)) {
if (DEBUG) {
PtrCLog.e(LOG_TAG, String.format("over top"));
}
to = PtrIndicator.POS_START;
}
mPtrIndicator.setCurrentPos(to);
int change = to - mPtrIndicator.getLastPosY();
if (change == 0) {
return;
}
boolean isUnderTouch = mPtrIndicator.isUnderTouch();
if (isUnderTouch && !mHasSendCancelEvent && mPtrIndicator.hasMovedAfterPressedDown()) {
mHasSendCancelEvent = true;
sendCancelEvent();
}
if ((mPtrIndicator.hasJustLeftStartPosition() && mStatus == PTR_STATUS_INIT) || (mPtrIndicator.goDownCrossFinishPosition() && mStatus == PTR_STATUS_COMPLETE && isEnabledNextPtrAtOnce())) {
mStatus = PTR_STATUS_PREPARE;
mPtrUIHandlerHolder.onUIRefreshPrepare(this);
if (DEBUG) {
PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIRefreshPrepare, mFlag %s", mFlag);
}
}
if (mPtrIndicator.hasJustBackToStartPosition()) {
tryToNotifyReset();
if (isUnderTouch) {
sendDownEvent();
}
}
if (mStatus == PTR_STATUS_PREPARE) {
if (isUnderTouch && !isAutoRefresh() && mPullToRefresh && mPtrIndicator.crossRefreshLineFromTopToBottom()) {
tryToPerformRefresh();
}
if (performAutoRefreshButLater() && mPtrIndicator.hasJustReachedHeaderHeightFromTopToBottom()) {
tryToPerformRefresh();
}
}
if (DEBUG) {
PtrCLog.v(LOG_TAG, "updatePos: change: %s, current: %s last: %s, top: %s, headerHeight: %s", change, mPtrIndicator.getCurrentPosY(), mPtrIndicator.getLastPosY(), mContent.getTop(), mHeaderHeight);
}
mHeaderView.offsetTopAndBottom(change);
if (!isPinContent()) {
mContent.offsetTopAndBottom(change);
}
invalidate();
if (mPtrUIHandlerHolder.hasHandler()) {
mPtrUIHandlerHolder.onUIPositionChange(this, isUnderTouch, mStatus, mPtrIndicator);
}
onPositionChange(isUnderTouch, mStatus, mPtrIndicator);
} | <DeepExtract>
if (change == 0) {
return;
}
boolean isUnderTouch = mPtrIndicator.isUnderTouch();
if (isUnderTouch && !mHasSendCancelEvent && mPtrIndicator.hasMovedAfterPressedDown()) {
mHasSendCancelEvent = true;
sendCancelEvent();
}
if ((mPtrIndicator.hasJustLeftStartPosition() && mStatus == PTR_STATUS_INIT) || (mPtrIndicator.goDownCrossFinishPosition() && mStatus == PTR_STATUS_COMPLETE && isEnabledNextPtrAtOnce())) {
mStatus = PTR_STATUS_PREPARE;
mPtrUIHandlerHolder.onUIRefreshPrepare(this);
if (DEBUG) {
PtrCLog.i(LOG_TAG, "PtrUIHandler: onUIRefreshPrepare, mFlag %s", mFlag);
}
}
if (mPtrIndicator.hasJustBackToStartPosition()) {
tryToNotifyReset();
if (isUnderTouch) {
sendDownEvent();
}
}
if (mStatus == PTR_STATUS_PREPARE) {
if (isUnderTouch && !isAutoRefresh() && mPullToRefresh && mPtrIndicator.crossRefreshLineFromTopToBottom()) {
tryToPerformRefresh();
}
if (performAutoRefreshButLater() && mPtrIndicator.hasJustReachedHeaderHeightFromTopToBottom()) {
tryToPerformRefresh();
}
}
if (DEBUG) {
PtrCLog.v(LOG_TAG, "updatePos: change: %s, current: %s last: %s, top: %s, headerHeight: %s", change, mPtrIndicator.getCurrentPosY(), mPtrIndicator.getLastPosY(), mContent.getTop(), mHeaderHeight);
}
mHeaderView.offsetTopAndBottom(change);
if (!isPinContent()) {
mContent.offsetTopAndBottom(change);
}
invalidate();
if (mPtrUIHandlerHolder.hasHandler()) {
mPtrUIHandlerHolder.onUIPositionChange(this, isUnderTouch, mStatus, mPtrIndicator);
}
onPositionChange(isUnderTouch, mStatus, mPtrIndicator);
</DeepExtract>
| cygmodule | positive |
public static void clearImageAllCache() {
try {
if (Looper.myLooper() == Looper.getMainLooper()) {
new Thread(new Runnable() {
@Override
public void run() {
Glide.get(BaseApplication.getInstance()).clearDiskCache();
}
}).start();
} else {
Glide.get(BaseApplication.getInstance()).clearDiskCache();
}
} catch (Exception e) {
e.printStackTrace();
}
try {
if (Looper.myLooper() == Looper.getMainLooper()) {
Glide.get(BaseApplication.getInstance()).clearMemory();
}
} catch (Exception e) {
e.printStackTrace();
}
if (!TextUtils.isEmpty(getGlideCacheDir().getPath())) {
try {
File file = new File(getGlideCacheDir().getPath());
if (file.isDirectory()) {
File[] files = file.listFiles();
for (File file1 : files) {
deleteFolderFile(file1.getAbsolutePath(), true);
}
}
if (true) {
if (!file.isDirectory()) {
file.delete();
} else {
if (file.listFiles().length == 0) {
file.delete();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
} | <DeepExtract>
try {
if (Looper.myLooper() == Looper.getMainLooper()) {
new Thread(new Runnable() {
@Override
public void run() {
Glide.get(BaseApplication.getInstance()).clearDiskCache();
}
}).start();
} else {
Glide.get(BaseApplication.getInstance()).clearDiskCache();
}
} catch (Exception e) {
e.printStackTrace();
}
</DeepExtract>
<DeepExtract>
try {
if (Looper.myLooper() == Looper.getMainLooper()) {
Glide.get(BaseApplication.getInstance()).clearMemory();
}
} catch (Exception e) {
e.printStackTrace();
}
</DeepExtract>
<DeepExtract>
if (!TextUtils.isEmpty(getGlideCacheDir().getPath())) {
try {
File file = new File(getGlideCacheDir().getPath());
if (file.isDirectory()) {
File[] files = file.listFiles();
for (File file1 : files) {
deleteFolderFile(file1.getAbsolutePath(), true);
}
}
if (true) {
if (!file.isDirectory()) {
file.delete();
} else {
if (file.listFiles().length == 0) {
file.delete();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
</DeepExtract>
| BaseLibrary | positive |
public void toGraphicFile(File file) throws IOException {
Image image = createImage(getWidth(), getHeight());
Graphics2D gcomp2D = (Graphics2D) image.getGraphics();
gcomp2D.addRenderingHints(AALIAS);
gcomp2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
gcomp2D.setColor(getBackground());
gcomp2D.fillRect(0, 0, getSize().width, getSize().height);
draw.initGraphics(gcomp2D);
grid.plot(draw);
for (int i = 0; i < plots.size(); i++) {
getPlot(i).plot(draw);
if (linkedLegendPanel != null) {
linkedLegendPanel.nonote(i);
}
}
for (int i = 0; i < objects.size(); i++) {
getPlotable(i).plot(draw);
}
if (drawRect != null) {
gcomp2D.setColor(Color.black);
gcomp2D.setStroke(rectStroke);
gcomp2D.drawRect(drawRect[0], drawRect[1], drawRect[2], drawRect[3]);
}
if (allowNote) {
for (int i = 0; i < plots.size(); i++) {
if (getPlot(i).noted) {
if (linkedLegendPanel != null) {
linkedLegendPanel.note(i);
}
getPlot(i).note(draw);
}
if (allowNoteCoord && getPlot(i).coordNoted != null) {
getPlot(i).noteCoord(draw, getPlot(i).coordNoted);
}
}
}
image = new ImageIcon(image).getImage();
BufferedImage bufferedImage = new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_RGB);
Graphics g = bufferedImage.createGraphics();
g.drawImage(image, 0, 0, Color.WHITE, null);
g.dispose();
try {
ImageIO.write((RenderedImage) bufferedImage, "PNG", file);
} catch (IllegalArgumentException ex) {
}
} | <DeepExtract>
Graphics2D gcomp2D = (Graphics2D) image.getGraphics();
gcomp2D.addRenderingHints(AALIAS);
gcomp2D.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
gcomp2D.setColor(getBackground());
gcomp2D.fillRect(0, 0, getSize().width, getSize().height);
draw.initGraphics(gcomp2D);
grid.plot(draw);
for (int i = 0; i < plots.size(); i++) {
getPlot(i).plot(draw);
if (linkedLegendPanel != null) {
linkedLegendPanel.nonote(i);
}
}
for (int i = 0; i < objects.size(); i++) {
getPlotable(i).plot(draw);
}
if (drawRect != null) {
gcomp2D.setColor(Color.black);
gcomp2D.setStroke(rectStroke);
gcomp2D.drawRect(drawRect[0], drawRect[1], drawRect[2], drawRect[3]);
}
if (allowNote) {
for (int i = 0; i < plots.size(); i++) {
if (getPlot(i).noted) {
if (linkedLegendPanel != null) {
linkedLegendPanel.note(i);
}
getPlot(i).note(draw);
}
if (allowNoteCoord && getPlot(i).coordNoted != null) {
getPlot(i).noteCoord(draw, getPlot(i).coordNoted);
}
}
}
</DeepExtract>
| jmathplot | positive |
public void deleteLabelsRelations() {
SQLiteDatabase db = this.getWritableDatabase();
db.execSQL("DROP TABLE IF EXISTS " + TABLE_LABELSRELATIONS);
db.execSQL(CREATE_TABLE_LABELSRELATIONS);
if (null != null)
null.close();
if (db != null)
db.close();
} | <DeepExtract>
if (null != null)
null.close();
if (db != null)
db.close();
</DeepExtract>
| Munin-for-Android | positive |
public void run() {
tvTime.setText(TitleViewUtil.getTime());
tvDate.setText(TitleViewUtil.getDate());
timeHandle.postDelayed(this, 1000);
} | <DeepExtract>
tvTime.setText(TitleViewUtil.getTime());
</DeepExtract>
<DeepExtract>
tvDate.setText(TitleViewUtil.getDate());
</DeepExtract>
| android-tv-launcher | positive |
public Encoder md5() {
try {
MessageDigest md = MessageDigest.getInstance("MD5");
data = md.digest(data);
return this;
} catch (NoSuchAlgorithmException e) {
throw new BaseException(e, "'%s' MessageDigest algorithm unavailable", "MD5");
}
} | <DeepExtract>
try {
MessageDigest md = MessageDigest.getInstance("MD5");
data = md.digest(data);
return this;
} catch (NoSuchAlgorithmException e) {
throw new BaseException(e, "'%s' MessageDigest algorithm unavailable", "MD5");
}
</DeepExtract>
| AppleSeed | positive |
public String GetArffFilePath() {
return _outputDir + _fileNamePrefix + Extension.ARFF.toString();
} | <DeepExtract>
return _outputDir + _fileNamePrefix + Extension.ARFF.toString();
</DeepExtract>
| ML-Flex | positive |
private void init(Context context, AttributeSet attrs) {
@SuppressLint("CustomViewStyleable")
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.colorpickerview__ColorPanelView);
mBorderColor = a.getColor(R.styleable.colorpickerview__ColorPanelView_colorpickerview__borderColor, 0xFF6E6E6E);
a.recycle();
final TypedValue value = new TypedValue();
TypedArray a = context.obtainStyledAttributes(value.data, new int[] { android.R.attr.textColorSecondary });
if (mBorderColor == DEFAULT_BORDER_COLOR) {
mBorderColor = a.getColor(0, DEFAULT_BORDER_COLOR);
}
a.recycle();
mBorderPaint = new Paint();
mColorPaint = new Paint();
} | <DeepExtract>
final TypedValue value = new TypedValue();
TypedArray a = context.obtainStyledAttributes(value.data, new int[] { android.R.attr.textColorSecondary });
if (mBorderColor == DEFAULT_BORDER_COLOR) {
mBorderColor = a.getColor(0, DEFAULT_BORDER_COLOR);
}
a.recycle();
</DeepExtract>
| OpenUntis | positive |
public CanvasTransformer zoom(final int openedX, final int closedX, final int openedY, final int closedY, final int px, final int py, final Interpolator interp) {
if (mTrans == null)
mTrans = new CanvasTransformer() {
public void transformCanvas(Canvas canvas, float percentOpen) {
}
};
mTrans = new CanvasTransformer() {
public void transformCanvas(Canvas canvas, float percentOpen) {
mTrans.transformCanvas(canvas, percentOpen);
float f = interp.getInterpolation(percentOpen);
canvas.scale((openedX - closedX) * f + closedX, (openedY - closedY) * f + closedY, px, py);
}
};
return mTrans;
} | <DeepExtract>
if (mTrans == null)
mTrans = new CanvasTransformer() {
public void transformCanvas(Canvas canvas, float percentOpen) {
}
};
</DeepExtract>
| instabtbu | positive |
public Criteria andGmtCreateIn(List<Date> values) {
if (values == null) {
throw new RuntimeException("Value for " + "gmtCreate" + " cannot be null");
}
criteria.add(new Criterion("gmt_create in", values));
return (Criteria) this;
} | <DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "gmtCreate" + " cannot be null");
}
criteria.add(new Criterion("gmt_create in", values));
</DeepExtract>
| AnyMock | positive |
public GroupInfoResult fetchGroupInfo(String chatId) throws LarkClientException {
if (false ^ instanceContext.getApp().getIsIsv()) {
throw new UnsupportedOperationException("ISV app send message should use method sendChatMessageIsv");
}
return retryIfTenantAccessTokenInvalid(() -> {
final String tenantAccessToken = getTenantAccessTokenOrException(null);
FetchChatInfoRequest req = new FetchChatInfoRequest();
req.setChatId(chatId);
FetchChatInfoResponse resp = openApiClient.fetchChatInfo(tenantAccessToken, req);
GroupInfoResult result = new GroupInfoResult();
result.setAvatar(resp.getData().getAvatar());
result.setChatId(resp.getData().getChatId());
result.setDescription(resp.getData().getDescription());
result.setI18nNames(resp.getData().getI18nNames());
result.setMembers(resp.getData().getMembers());
result.setName(resp.getData().getName());
result.setOwnerOpenId(resp.getData().getOwnerOpenId());
result.setOwnerUserId(resp.getData().getOwnerUserId());
return result;
}, null);
} | <DeepExtract>
if (false ^ instanceContext.getApp().getIsIsv()) {
throw new UnsupportedOperationException("ISV app send message should use method sendChatMessageIsv");
}
</DeepExtract>
<DeepExtract>
return retryIfTenantAccessTokenInvalid(() -> {
final String tenantAccessToken = getTenantAccessTokenOrException(null);
FetchChatInfoRequest req = new FetchChatInfoRequest();
req.setChatId(chatId);
FetchChatInfoResponse resp = openApiClient.fetchChatInfo(tenantAccessToken, req);
GroupInfoResult result = new GroupInfoResult();
result.setAvatar(resp.getData().getAvatar());
result.setChatId(resp.getData().getChatId());
result.setDescription(resp.getData().getDescription());
result.setI18nNames(resp.getData().getI18nNames());
result.setMembers(resp.getData().getMembers());
result.setName(resp.getData().getName());
result.setOwnerOpenId(resp.getData().getOwnerOpenId());
result.setOwnerUserId(resp.getData().getOwnerUserId());
return result;
}, null);
</DeepExtract>
| appframework-java | positive |
@Test
public void eventDelegatorsAreGenerated() throws Exception {
OptimizedStateMachine sm = headerAndSttToSm(stdHead, "" + "{" + " I e1 S a1 " + " I e2 - a2" + " S e1 I a3" + " S e2 - a4" + "}");
generator.generate(sm).accept(implementer);
assertThat(output, equalTo("delegators [e1, e2]"));
} | <DeepExtract>
OptimizedStateMachine sm = headerAndSttToSm(stdHead, "" + "{" + " I e1 S a1 " + " I e2 - a2" + " S e1 I a3" + " S e2 - a4" + "}");
generator.generate(sm).accept(implementer);
assertThat(output, equalTo("delegators [e1, e2]"));
</DeepExtract>
| CC_SMC | positive |
private void parseJoinTableFilter(TableFilter top, Select command) throws SQLException {
TableFilter last = top;
while (true) {
if (readIf("RIGHT")) {
readIf("OUTER");
read("JOIN");
TableFilter newTop = readTableFilter(top.isJoinOuter());
newTop = readJoin(newTop, command, true);
Expression on = null;
if (readIf("ON")) {
on = readExpression();
}
newTop.addJoin(top, true, on);
top = newTop;
last = newTop;
} else if (readIf("LEFT")) {
readIf("OUTER");
read("JOIN");
TableFilter join = readTableFilter(true);
top = readJoin(top, command, true);
Expression on = null;
if (readIf("ON")) {
on = readExpression();
}
top.addJoin(join, true, on);
last = join;
} else if (readIf("FULL")) {
throw this.getSyntaxError();
} else if (readIf("INNER")) {
read("JOIN");
TableFilter join = readTableFilter(top.isJoinOuter());
top = readJoin(top, command, false);
Expression on = null;
if (readIf("ON")) {
on = readExpression();
}
top.addJoin(join, top.isJoinOuter(), on);
last = join;
} else if (readIf("JOIN")) {
TableFilter join = readTableFilter(top.isJoinOuter());
top = readJoin(top, command, false);
Expression on = null;
if (readIf("ON")) {
on = readExpression();
}
top.addJoin(join, top.isJoinOuter(), on);
last = join;
} else if (readIf("CROSS")) {
read("JOIN");
TableFilter join = readTableFilter(top.isJoinOuter());
top.addJoin(join, top.isJoinOuter(), null);
last = join;
} else if (readIf("NATURAL")) {
read("JOIN");
TableFilter join = readTableFilter(top.isJoinOuter());
Column[] tableCols = last.getTable().getColumns().toArray(new Column[0]);
Column[] joinCols = join.getTable().getColumns().toArray(new Column[0]);
String tableSchema = last.getTable().getSchema().getName();
String joinSchema = join.getTable().getSchema().getName();
Expression on = null;
for (Column tc : tableCols) {
String tableColumnName = tc.getName();
for (Column c : joinCols) {
String joinColumnName = c.getName();
if (tableColumnName.equals(joinColumnName)) {
Expression tableExpr = new ExpressionColumn(session, tableSchema, last.getTableAlias(), tableColumnName);
Expression joinExpr = new ExpressionColumn(session, joinSchema, join.getTableAlias(), joinColumnName);
Expression equal = new Comparison(session, Operator.EQUAL, tableExpr, joinExpr);
if (on == null) {
on = equal;
} else {
on = new ConditionAndOr(session, ConditionAndOr.AND, on, equal);
}
}
}
}
top.addJoin(join, top.isJoinOuter(), on);
last = join;
} else {
break;
}
}
return top;
command.addTableFilter(top, true);
boolean isOuter = false;
while (true) {
TableFilter join = top.getJoin();
if (join == null) {
break;
}
isOuter = isOuter | join.isJoinOuter();
if (isOuter) {
command.addTableFilter(join, false);
} else {
command.addTableFilter(join, true);
}
top = join;
}
} | <DeepExtract>
TableFilter last = top;
while (true) {
if (readIf("RIGHT")) {
readIf("OUTER");
read("JOIN");
TableFilter newTop = readTableFilter(top.isJoinOuter());
newTop = readJoin(newTop, command, true);
Expression on = null;
if (readIf("ON")) {
on = readExpression();
}
newTop.addJoin(top, true, on);
top = newTop;
last = newTop;
} else if (readIf("LEFT")) {
readIf("OUTER");
read("JOIN");
TableFilter join = readTableFilter(true);
top = readJoin(top, command, true);
Expression on = null;
if (readIf("ON")) {
on = readExpression();
}
top.addJoin(join, true, on);
last = join;
} else if (readIf("FULL")) {
throw this.getSyntaxError();
} else if (readIf("INNER")) {
read("JOIN");
TableFilter join = readTableFilter(top.isJoinOuter());
top = readJoin(top, command, false);
Expression on = null;
if (readIf("ON")) {
on = readExpression();
}
top.addJoin(join, top.isJoinOuter(), on);
last = join;
} else if (readIf("JOIN")) {
TableFilter join = readTableFilter(top.isJoinOuter());
top = readJoin(top, command, false);
Expression on = null;
if (readIf("ON")) {
on = readExpression();
}
top.addJoin(join, top.isJoinOuter(), on);
last = join;
} else if (readIf("CROSS")) {
read("JOIN");
TableFilter join = readTableFilter(top.isJoinOuter());
top.addJoin(join, top.isJoinOuter(), null);
last = join;
} else if (readIf("NATURAL")) {
read("JOIN");
TableFilter join = readTableFilter(top.isJoinOuter());
Column[] tableCols = last.getTable().getColumns().toArray(new Column[0]);
Column[] joinCols = join.getTable().getColumns().toArray(new Column[0]);
String tableSchema = last.getTable().getSchema().getName();
String joinSchema = join.getTable().getSchema().getName();
Expression on = null;
for (Column tc : tableCols) {
String tableColumnName = tc.getName();
for (Column c : joinCols) {
String joinColumnName = c.getName();
if (tableColumnName.equals(joinColumnName)) {
Expression tableExpr = new ExpressionColumn(session, tableSchema, last.getTableAlias(), tableColumnName);
Expression joinExpr = new ExpressionColumn(session, joinSchema, join.getTableAlias(), joinColumnName);
Expression equal = new Comparison(session, Operator.EQUAL, tableExpr, joinExpr);
if (on == null) {
on = equal;
} else {
on = new ConditionAndOr(session, ConditionAndOr.AND, on, equal);
}
}
}
}
top.addJoin(join, top.isJoinOuter(), on);
last = join;
} else {
break;
}
}
return top;
</DeepExtract>
| RedQueryBuilder | positive |
private void parseAssignmentString(String assignmentString, List<PopulationType> populationTypes, Map<String, Function> functionMap) {
ANTLRInputStream inputStream = new ANTLRInputStream(assignmentString);
BaseErrorListener errorListener = new BaseErrorListener() {
@Override
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) {
throw new RuntimeException("Error parsing character " + charPositionInLine + " of line " + line + " of population size assignment: " + msg);
}
};
MASTERGrammarLexer lexer = new MASTERGrammarLexer(inputStream);
lexer.removeErrorListeners();
lexer.addErrorListener(errorListener);
CommonTokenStream tokens = new CommonTokenStream(lexer);
MASTERGrammarParser parser = new MASTERGrammarParser(tokens);
parser.removeErrorListeners();
parser.addErrorListener(errorListener);
ParseTree assignmentParseTree = parser.assignment();
ParseTreeWalker walker = new ParseTreeWalker();
PreprocessingListener listener = new PreprocessingListener(populationTypes);
walker.walk(listener, assignmentParseTree);
List<String> scalarVarNames = new ArrayList<>(listener.getVarNameBoundsMap().keySet());
int[] scalarVarBounds = new int[scalarVarNames.size()];
for (int i = 0; i < scalarVarNames.size(); i++) scalarVarBounds[i] = listener.getVarNameBoundsMap().get(scalarVarNames.get(i));
List<int[]> variableValuesList = new ArrayList<>();
if (0 == new int[scalarVarNames.size()].length) {
variableValuesList.add(Arrays.copyOf(new int[scalarVarNames.size()], new int[scalarVarNames.size()].length));
} else {
for (int i = 0; i < scalarVarBounds[0]; i++) {
new int[scalarVarNames.size()][0] = i;
variableLoop(0 + 1, scalarVarBounds, new int[scalarVarNames.size()], variableValuesList);
}
}
List<String> vectorVarNames = new ArrayList<>();
List<Double[]> vectorVarVals = new ArrayList<>();
for (int i = 0; i < populationTypes.size(); i++) {
PopulationType popType = populationTypes.get(i);
vectorVarNames.add(popType.getName() + "_dim");
vectorVarVals.add(new Double[popType.getDims().length]);
for (int j = 0; j < popType.getDims().length; j++) {
vectorVarVals.get(i)[j] = (double) popType.getDims()[j];
}
}
ExpressionEvaluator evaluator = new ExpressionEvaluator(listener.getExpressionParseTree(), scalarVarNames, functionMap);
PopulationType popType = listener.getSeenPopulationTypes().get(0);
for (int[] scalarVarVals : variableValuesList) {
boolean include = true;
for (Predicate pred : predicatesInput.get()) {
if (!pred.isTrue(scalarVarNames, scalarVarVals, vectorVarNames, vectorVarVals, functionMap)) {
include = false;
break;
}
}
if (!include)
continue;
Double[] sizeExprValue = evaluator.evaluate(scalarVarVals);
if (sizeExprValue.length != 1)
throw new IllegalArgumentException("Population size expression " + "must evaluate to scalar.");
double popSize = sizeExprValue[0];
walker.walk(new MASTERGrammarBaseListener() {
@Override
public void exitAssignment(@NotNull MASTERGrammarParser.AssignmentContext ctx) {
List<Integer> locList = new ArrayList<>();
if (ctx.loc() != null) {
for (MASTERGrammarParser.LocelContext locelCtx : ctx.loc().locel()) {
if (locelCtx.IDENT() == null) {
locList.add(Integer.parseInt(locelCtx.getText()));
} else {
String varName = locelCtx.IDENT().getText();
int varIdx = scalarVarNames.indexOf(varName);
locList.add(scalarVarVals[varIdx]);
}
}
}
int[] loc = new int[locList.size()];
for (int i = 0; i < loc.length; i++) loc[i] = locList.get(i);
popSizes.put(new Population(popType, loc), popSize);
}
}, assignmentParseTree);
}
} | <DeepExtract>
if (0 == new int[scalarVarNames.size()].length) {
variableValuesList.add(Arrays.copyOf(new int[scalarVarNames.size()], new int[scalarVarNames.size()].length));
} else {
for (int i = 0; i < scalarVarBounds[0]; i++) {
new int[scalarVarNames.size()][0] = i;
variableLoop(0 + 1, scalarVarBounds, new int[scalarVarNames.size()], variableValuesList);
}
}
</DeepExtract>
| MASTER | positive |
void refresh() throws OpenAS2Exception {
try (FileInputStream inputStream = new FileInputStream(getFilename())) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder parser = factory.newDocumentBuilder();
Document document = parser.parse(inputStream);
setPartnershipsXml(document);
} catch (Exception e) {
throw new WrappedException(e);
}
getSession().destroyPartnershipPollers(Session.PARTNERSHIP_POLLER);
try {
Element root = getPartnershipsXml().getDocumentElement();
NodeList rootNodes = root.getChildNodes();
Node rootNode;
String nodeName;
Map<String, Object> newPartners = new HashMap<String, Object>();
List<Partnership> newPartnerships = new ArrayList<Partnership>();
for (int i = 0; i < rootNodes.getLength(); i++) {
rootNode = rootNodes.item(i);
nodeName = rootNode.getNodeName();
if (nodeName.equals("partner")) {
loadPartner(newPartners, rootNode);
} else if (nodeName.equals("partnership")) {
loadPartnership(newPartners, newPartnerships, rootNode);
}
}
synchronized (this) {
setPartners(newPartners);
setPartnerships(newPartnerships);
}
} catch (Exception e) {
throw new WrappedException(e);
}
} | <DeepExtract>
try (FileInputStream inputStream = new FileInputStream(getFilename())) {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder parser = factory.newDocumentBuilder();
Document document = parser.parse(inputStream);
setPartnershipsXml(document);
} catch (Exception e) {
throw new WrappedException(e);
}
</DeepExtract>
<DeepExtract>
getSession().destroyPartnershipPollers(Session.PARTNERSHIP_POLLER);
try {
Element root = getPartnershipsXml().getDocumentElement();
NodeList rootNodes = root.getChildNodes();
Node rootNode;
String nodeName;
Map<String, Object> newPartners = new HashMap<String, Object>();
List<Partnership> newPartnerships = new ArrayList<Partnership>();
for (int i = 0; i < rootNodes.getLength(); i++) {
rootNode = rootNodes.item(i);
nodeName = rootNode.getNodeName();
if (nodeName.equals("partner")) {
loadPartner(newPartners, rootNode);
} else if (nodeName.equals("partnership")) {
loadPartnership(newPartners, newPartnerships, rootNode);
}
}
synchronized (this) {
setPartners(newPartners);
setPartnerships(newPartnerships);
}
} catch (Exception e) {
throw new WrappedException(e);
}
</DeepExtract>
| OpenAs2App | positive |
@Override
boolean segmentsMatch(final DecisionTreeRule latestSegment, final DecisionTreeRule createdSegment) {
return latestSegment.getEnd().equals(createdSegment.getStart()) && latestSegment.getOutputs().equals(createdSegment.getOutputs()) && Arrays.equals(latestSegment.getDrivers(), createdSegment.getDrivers());
} | <DeepExtract>
return latestSegment.getEnd().equals(createdSegment.getStart()) && latestSegment.getOutputs().equals(createdSegment.getOutputs()) && Arrays.equals(latestSegment.getDrivers(), createdSegment.getDrivers());
</DeepExtract>
| swblocks-decisiontree | positive |
public void crop(Rect cropRect) {
container.removeAllViews();
container.removeAllViews();
customPaintView.reset();
invalidate();
invalidate();
} | <DeepExtract>
container.removeAllViews();
customPaintView.reset();
invalidate();
</DeepExtract>
| Whatsapp-Like-PhotoEditor | positive |
@SuppressWarnings("unused")
protected void doLaunch(HttpServletRequest request, HttpServletResponse response, HttpSession session, Map<String, Object> payload, ServletContext application, StringBuffer outTrace) throws ServletException, IOException {
LTIServletUtils.oauthValidate(request, payload, application);
outTrace.append("\n").append(new Date()).append(" DEBUG ").append("doLaunch()");
LTIServletUtils.handleLaunch(payload, application, response, session, outTrace);
} | <DeepExtract>
outTrace.append("\n").append(new Date()).append(" DEBUG ").append("doLaunch()");
</DeepExtract>
| karuta-backend_legacy | positive |
@Override
public String get(final Pokemon p) {
final int number = (int) Math.round((double) PokeColumn.MOVE_2_RATING.get(p) * Utilities.PERCENTAGE_FACTOR);
return pad(number, 2);
} | <DeepExtract>
final int number = (int) Math.round((double) PokeColumn.MOVE_2_RATING.get(p) * Utilities.PERCENTAGE_FACTOR);
return pad(number, 2);
</DeepExtract>
| BlossomsPokemonGoManager | positive |
@Override
public void setSubtypeEnablerTitle(CharSequence title) {
mSubtypeEnablerTitleRes = 0;
mSubtypeEnablerTitle = title;
if (mSubtypeEnablerPreference != null) {
if (mSubtypeEnablerTitleRes != 0) {
mSubtypeEnablerPreference.setTitle(mSubtypeEnablerTitleRes);
} else if (!TextUtils.isEmpty(mSubtypeEnablerTitle)) {
mSubtypeEnablerPreference.setTitle(mSubtypeEnablerTitle);
}
final String summary = getEnabledSubtypesLabel(mContext, mImm, mImi);
if (!TextUtils.isEmpty(summary)) {
mSubtypeEnablerPreference.setSummary(summary);
}
if (mSubtypeEnablerIconRes != 0) {
mSubtypeEnablerPreference.setIcon(mSubtypeEnablerIconRes);
} else if (mSubtypeEnablerIcon != null) {
mSubtypeEnablerPreference.setIcon(mSubtypeEnablerIcon);
}
}
} | <DeepExtract>
if (mSubtypeEnablerPreference != null) {
if (mSubtypeEnablerTitleRes != 0) {
mSubtypeEnablerPreference.setTitle(mSubtypeEnablerTitleRes);
} else if (!TextUtils.isEmpty(mSubtypeEnablerTitle)) {
mSubtypeEnablerPreference.setTitle(mSubtypeEnablerTitle);
}
final String summary = getEnabledSubtypesLabel(mContext, mImm, mImi);
if (!TextUtils.isEmpty(summary)) {
mSubtypeEnablerPreference.setSummary(summary);
}
if (mSubtypeEnablerIconRes != 0) {
mSubtypeEnablerPreference.setIcon(mSubtypeEnablerIconRes);
} else if (mSubtypeEnablerIcon != null) {
mSubtypeEnablerPreference.setIcon(mSubtypeEnablerIcon);
}
}
</DeepExtract>
| LokiBoard-Android-Keylogger | positive |
protected void setDrawStack(ArrayList<GraphicObject> aDrawStack) {
_drawStack.clear();
repaint();
for (int i = 0; i < aDrawStack.size(); ++i) {
_drawStack.add(aDrawStack.get(i));
}
repaint();
} | <DeepExtract>
_drawStack.clear();
repaint();
</DeepExtract>
| darkFunction-Editor | positive |
@Override
public <T> long countImpl(boolean consistentRead, SimpleDbEntityInformation<T, ?> entityInformation) {
final String countQuery = new QueryBuilder(entityInformation, true).toString();
LOGGER.debug("Count items for query " + countQuery);
validateSelectQuery(countQuery);
final String escapedQuery = getEscapedQuery(countQuery, entityInformation);
final SelectResult selectResult = invokeFindImpl(consistentRead, escapedQuery);
for (Item item : selectResult.getItems()) {
if (item.getName().equals("Domain")) {
for (Attribute attribute : item.getAttributes()) {
if (attribute.getName().equals("Count")) {
return Long.parseLong(attribute.getValue());
}
}
}
}
return 0;
} | <DeepExtract>
LOGGER.debug("Count items for query " + countQuery);
validateSelectQuery(countQuery);
final String escapedQuery = getEscapedQuery(countQuery, entityInformation);
final SelectResult selectResult = invokeFindImpl(consistentRead, escapedQuery);
for (Item item : selectResult.getItems()) {
if (item.getName().equals("Domain")) {
for (Attribute attribute : item.getAttributes()) {
if (attribute.getName().equals("Count")) {
return Long.parseLong(attribute.getValue());
}
}
}
}
return 0;
</DeepExtract>
| spring-data-simpledb | positive |
public static Script createMultiSigInputScript(List<TransactionSignature> signatures) {
List<byte[]> sigs = new ArrayList<byte[]>(signatures.size());
for (TransactionSignature signature : signatures) {
sigs.add(signature.encodeToUlord());
}
checkArgument(sigs.size() <= 16);
ScriptBuilder builder = new ScriptBuilder();
builder.smallNum(0);
for (byte[] signature : sigs) builder.data(signature);
if (null != null)
builder.data(null);
return builder.build();
} | <DeepExtract>
checkArgument(sigs.size() <= 16);
ScriptBuilder builder = new ScriptBuilder();
builder.smallNum(0);
for (byte[] signature : sigs) builder.data(signature);
if (null != null)
builder.data(null);
return builder.build();
</DeepExtract>
| ulordj-thin | positive |
@Override
public Object visit(ASTIsNumeric node, Object data) throws VisitorException {
final StringBuilder sb = (StringBuilder) data;
sb.append("isNUMERIC" + "(");
if (node != null) {
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
node.jjtGetChild(i).jjtAccept(this, data);
if (i + 1 != node.jjtGetNumChildren()) {
sb.append(',');
}
}
}
sb.append(")");
return data;
} | <DeepExtract>
final StringBuilder sb = (StringBuilder) data;
sb.append("isNUMERIC" + "(");
if (node != null) {
for (int i = 0; i < node.jjtGetNumChildren(); i++) {
node.jjtGetChild(i).jjtAccept(this, data);
if (i + 1 != node.jjtGetNumChildren()) {
sb.append(',');
}
}
}
sb.append(")");
</DeepExtract>
| sparqled | positive |
private void droneStatusMouseReleased(java.awt.event.MouseEvent evt) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
updateLoop();
}
});
thread.setName("ARDrone Control Loop");
thread.start();
} | <DeepExtract>
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
updateLoop();
}
});
thread.setName("ARDrone Control Loop");
thread.start();
</DeepExtract>
| javadrone | positive |
public BundleBuilder addValueCreator(@NonNull ValueCreator creator) {
if (creator == null) {
return this;
}
if (creator.getValue() == null || creator.getKey() == null) {
return this;
}
extras.put(creator.getKey(), creator.getValue());
return this;
} | <DeepExtract>
if (creator.getValue() == null || creator.getKey() == null) {
return this;
}
extras.put(creator.getKey(), creator.getValue());
return this;
</DeepExtract>
| ndileber | positive |
@Override
public void generate(MethodVisitor visitor, BuildContext context) {
Branch branch;
if (condition instanceof Conditional) {
branch = ((Conditional) condition).branch(trueBody, elseBody);
} else if (condition.expressionType().getSort() == Type.BOOLEAN) {
branch = Branch.branchBoolean(condition, trueBody, elseBody);
} else {
throw new IllegalArgumentException("Incompatible types.");
}
if (elseIfs != null) {
for (ElseIf elseIf : elseIfs) {
branch.setElseBranch(toBranch(elseIf.condition, elseIf.body, branch.getElseBranch()));
}
}
branch.generate(visitor, context);
} | <DeepExtract>
Branch branch;
if (condition instanceof Conditional) {
branch = ((Conditional) condition).branch(trueBody, elseBody);
} else if (condition.expressionType().getSort() == Type.BOOLEAN) {
branch = Branch.branchBoolean(condition, trueBody, elseBody);
} else {
throw new IllegalArgumentException("Incompatible types.");
}
</DeepExtract>
| lumen | positive |
public void testValidateMusicAPI() {
fullTrack.mMusicAPI = null;
try {
fullTrack.validate();
fail();
} catch (IllegalArgumentException e) {
}
} | <DeepExtract>
try {
fullTrack.validate();
fail();
} catch (IllegalArgumentException e) {
}
</DeepExtract>
| sls | positive |
@Override
public void draw(RendererContext context) {
Data data = dataProvider.get();
Vector3 color = data.colorCoefficients;
ShaderSprite shader = (ShaderSprite) Shader.getCurrent();
Image image = GameContext.resources.getImage(new FileImageSource(data.imageName));
Texture textureData = GameContext.resources.getTexture(new FileTextureSource(image.getTextureName(), false));
float x = image.getCoordinates()[0];
float y = image.getCoordinates()[1];
float width = image.getCoordinates()[2];
float height = image.getCoordinates()[3];
textureMatrix.loadIdentity();
textureMatrix.translate(x, y);
textureMatrix.scale(width, height);
Matrix.multiplyMM(modelViewMatrix, 0, context.getOrthoMatrix(), 0, data.modelMatrix, 0);
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, textureData.getHandle());
GLES20.glUniform1i(shader.uniformTextureHandle, 0);
GLES20.glUniformMatrix3fv(shader.uniformTextureMatrixHandle, 1, false, textureMatrix.getArray(), 0);
GLES20.glUniformMatrix4fv(shader.uniformModelViewMatrixHandle, 1, false, modelViewMatrix, 0);
GLES20.glUniform4f(shader.uniformColorCoefficients, color.getX(), color.getY(), color.getZ(), 1);
GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, geometryData.getHandle());
switch(geometryData.getMode()) {
case Static:
GLES20.glVertexAttribPointer(shader.attributePositionHandle, 2, GLES20.GL_FLOAT, false, 16, 0);
GLES20.glVertexAttribPointer(shader.attributeTexCoordHandle, 2, GLES20.GL_FLOAT, false, 16, 8);
break;
case Dynamic:
FloatBuffer buffer = geometryData.getData();
buffer.position(0);
GLES20.glVertexAttribPointer(shader.attributePositionHandle, 2, GLES20.GL_FLOAT, false, 16, buffer);
buffer.position(2);
GLES20.glVertexAttribPointer(shader.attributeTexCoordHandle, 2, GLES20.GL_FLOAT, false, 16, buffer);
break;
}
GLES20.glEnableVertexAttribArray(shader.attributePositionHandle);
GLES20.glEnableVertexAttribArray(shader.attributeTexCoordHandle);
shader.validate();
geometryData.validate();
textureData.validate();
GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, geometryData.getPointsCount());
GLES20.glDisableVertexAttribArray(shader.attributePositionHandle);
GLES20.glDisableVertexAttribArray(shader.attributeTexCoordHandle);
GameContext.resources.release(image);
GameContext.resources.release(textureData);
} | <DeepExtract>
float x = image.getCoordinates()[0];
float y = image.getCoordinates()[1];
float width = image.getCoordinates()[2];
float height = image.getCoordinates()[3];
textureMatrix.loadIdentity();
textureMatrix.translate(x, y);
textureMatrix.scale(width, height);
</DeepExtract>
| Tanks | positive |
public void restoreCameraPosition() {
mCameraPosition.x = 0;
mCameraPosition.y = 0;
mCameraPosition.z = 0;
mCameraPosition = mCameraPosition;
synchronized (lockPlugins) {
for (GLPlugin plugin : plugins) {
plugin.onCameraPositionChanged(mCameraPosition);
}
}
} | <DeepExtract>
mCameraPosition = mCameraPosition;
synchronized (lockPlugins) {
for (GLPlugin plugin : plugins) {
plugin.onCameraPositionChanged(mCameraPosition);
}
}
</DeepExtract>
| beyondar | positive |
public void setProgress(long currentPosition, long frozonTime) {
if (mDuration <= SdkConfig.maxSelection) {
float ratio = currentPosition * 1f / mDuration;
mProgressStart = (int) (getFrameFixLeftX() + ratio * mFrameWidth);
} else {
float millsecs = currentPosition - mStartMillSec;
if (millsecs < 0) {
millsecs = 0f;
}
if (millsecs > SdkConfig.maxSelection) {
millsecs = SdkConfig.maxSelection;
}
float ratio = millsecs * 1f / SdkConfig.maxSelection;
mProgressStart = (int) (getCutLeftX() + ratio * mFrameWidth);
}
if (mProgressStart < getCutLeftX()) {
mProgressStart = getCutLeftX();
}
if (mProgressStart > getCutRightX()) {
mProgressStart = getCutRightX();
}
if ((float) mProgressStart + mRealProgressBarWidth > mRightFrameLeft) {
(float) mProgressStart = mRightFrameLeft - mRealProgressBarWidth;
}
if ((float) mProgressStart < getCutLeftX()) {
(float) mProgressStart = getCutLeftX();
}
if ((float) mProgressStart < mMinProgressBarX) {
(float) mProgressStart = mMinProgressBarX;
}
mPlayProgressBar.setTranslationX((float) mProgressStart);
invalidate();
} | <DeepExtract>
if ((float) mProgressStart + mRealProgressBarWidth > mRightFrameLeft) {
(float) mProgressStart = mRightFrameLeft - mRealProgressBarWidth;
}
if ((float) mProgressStart < getCutLeftX()) {
(float) mProgressStart = getCutLeftX();
}
if ((float) mProgressStart < mMinProgressBarX) {
(float) mProgressStart = mMinProgressBarX;
}
mPlayProgressBar.setTranslationX((float) mProgressStart);
</DeepExtract>
| MediaEditSDK | positive |
@Field(value = "STRING:string", setterPolicy = NOT_NULL)
public void setSN(String n, Long v) {
setLongValue("N" + "-" + n, v);
} | <DeepExtract>
setLongValue("N" + "-" + n, v);
</DeepExtract>
| logparser | positive |
public void addMeasurePoint(Point _measurePoint) {
if (measurePoint1 == null) {
setMeasurePoint1(_measurePoint);
return;
}
if (measurePoint2 != null) {
setMeasurePoint1(null);
setMeasurePoint2(null);
return;
}
Object old = this.measurePoint2;
if (_measurePoint != null) {
this.measurePoint2 = (Point) _measurePoint.clone();
} else {
this.measurePoint2 = null;
}
fireCheckedPropertyChange("measurePoint2", old, _measurePoint);
} | <DeepExtract>
Object old = this.measurePoint2;
if (_measurePoint != null) {
this.measurePoint2 = (Point) _measurePoint.clone();
} else {
this.measurePoint2 = null;
}
fireCheckedPropertyChange("measurePoint2", old, _measurePoint);
</DeepExtract>
| swingexplorer | positive |
public JPanel createPanel() {
JPanel jpanel1 = new JPanel();
FormLayout formlayout1 = new FormLayout("FILL:7DLU:NONE,FILL:DEFAULT:GROW(1.0),FILL:7DLU:NONE", "CENTER:3DLU:NONE,FILL:DEFAULT:NONE,CENTER:3DLU:NONE,CENTER:DEFAULT:NONE,CENTER:3DLU:NONE,FILL:DEFAULT:GROW(1.0),CENTER:9DLU:NONE");
CellConstraints cc = new CellConstraints();
jpanel1.setLayout(formlayout1);
_logTextArea.setName("logTextArea");
JScrollPane jscrollpane1 = new JScrollPane();
jscrollpane1.setViewportView(_logTextArea);
jscrollpane1.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
jscrollpane1.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
jpanel1.add(jscrollpane1, cc.xy(2, 6));
_logSeparator.setName("logSeparator");
_logSeparator.setText(Messages.getString("log"));
jpanel1.add(_logSeparator, cc.xy(2, 4));
_tab.setName("tab");
jpanel1.add(_tab, cc.xywh(1, 2, 3, 1));
Dimension filler = new Dimension(10, 10);
boolean filled_cell_11 = false;
CellConstraints cc = new CellConstraints();
if (new int[] { 1, 2, 3 }.length > 0 && new int[] { 1, 3, 4, 5, 6, 7 }.length > 0) {
if (new int[] { 1, 2, 3 }[0] == 1 && new int[] { 1, 3, 4, 5, 6, 7 }[0] == 1) {
jpanel1.add(Box.createRigidArea(filler), cc.xy(1, 1));
filled_cell_11 = true;
}
}
for (int index = 0; index < new int[] { 1, 2, 3 }.length; index++) {
if (new int[] { 1, 2, 3 }[index] == 1 && filled_cell_11) {
continue;
}
jpanel1.add(Box.createRigidArea(filler), cc.xy(new int[] { 1, 2, 3 }[index], 1));
}
for (int index = 0; index < new int[] { 1, 3, 4, 5, 6, 7 }.length; index++) {
if (new int[] { 1, 3, 4, 5, 6, 7 }[index] == 1 && filled_cell_11) {
continue;
}
jpanel1.add(Box.createRigidArea(filler), cc.xy(1, new int[] { 1, 3, 4, 5, 6, 7 }[index]));
}
return jpanel1;
} | <DeepExtract>
Dimension filler = new Dimension(10, 10);
boolean filled_cell_11 = false;
CellConstraints cc = new CellConstraints();
if (new int[] { 1, 2, 3 }.length > 0 && new int[] { 1, 3, 4, 5, 6, 7 }.length > 0) {
if (new int[] { 1, 2, 3 }[0] == 1 && new int[] { 1, 3, 4, 5, 6, 7 }[0] == 1) {
jpanel1.add(Box.createRigidArea(filler), cc.xy(1, 1));
filled_cell_11 = true;
}
}
for (int index = 0; index < new int[] { 1, 2, 3 }.length; index++) {
if (new int[] { 1, 2, 3 }[index] == 1 && filled_cell_11) {
continue;
}
jpanel1.add(Box.createRigidArea(filler), cc.xy(new int[] { 1, 2, 3 }[index], 1));
}
for (int index = 0; index < new int[] { 1, 3, 4, 5, 6, 7 }.length; index++) {
if (new int[] { 1, 3, 4, 5, 6, 7 }[index] == 1 && filled_cell_11) {
continue;
}
jpanel1.add(Box.createRigidArea(filler), cc.xy(1, new int[] { 1, 3, 4, 5, 6, 7 }[index]));
}
</DeepExtract>
| jmkvpropedit | positive |
private void showSkinIndicator(int index) {
mCurSkin = -1;
switch(mCurSkin) {
case 0:
mHeaderBinding.red.indicator.setVisibility(View.INVISIBLE);
mHeaderBinding.red.description.setVisibility(View.INVISIBLE);
break;
case 1:
mHeaderBinding.white.indicator.setVisibility(View.INVISIBLE);
mHeaderBinding.white.description.setVisibility(View.INVISIBLE);
break;
case 2:
mHeaderBinding.color.indicator.setVisibility(View.INVISIBLE);
mHeaderBinding.color.description.setVisibility(View.INVISIBLE);
break;
}
switch(index) {
case 0:
mHeaderBinding.red.description.setText("使用ä¸");
mHeaderBinding.red.indicator.setVisibility(View.VISIBLE);
mHeaderBinding.red.description.setVisibility(View.VISIBLE);
mCurSkin = 0;
break;
case 1:
mHeaderBinding.white.description.setText("使用ä¸");
mHeaderBinding.white.indicator.setVisibility(View.VISIBLE);
mHeaderBinding.white.description.setVisibility(View.VISIBLE);
mCurSkin = 1;
break;
case 2:
mHeaderBinding.color.description.setText("使用ä¸");
mHeaderBinding.color.indicator.setVisibility(View.VISIBLE);
mHeaderBinding.color.description.setVisibility(View.VISIBLE);
mCurSkin = 2;
break;
}
} | <DeepExtract>
mCurSkin = -1;
switch(mCurSkin) {
case 0:
mHeaderBinding.red.indicator.setVisibility(View.INVISIBLE);
mHeaderBinding.red.description.setVisibility(View.INVISIBLE);
break;
case 1:
mHeaderBinding.white.indicator.setVisibility(View.INVISIBLE);
mHeaderBinding.white.description.setVisibility(View.INVISIBLE);
break;
case 2:
mHeaderBinding.color.indicator.setVisibility(View.INVISIBLE);
mHeaderBinding.color.description.setVisibility(View.INVISIBLE);
break;
}
</DeepExtract>
| AndroidSkinAnimator | positive |
public boolean postDelayed(Runnable r, long delayMillis) {
if (mWorkHandler == null) {
HandlerThread handlerThread = new HandlerThread("WorkHandler");
handlerThread.start();
mWorkHandler = new Handler(handlerThread.getLooper());
}
return mWorkHandler.postDelayed(r, delayMillis);
} | <DeepExtract>
if (mWorkHandler == null) {
HandlerThread handlerThread = new HandlerThread("WorkHandler");
handlerThread.start();
mWorkHandler = new Handler(handlerThread.getLooper());
}
</DeepExtract>
| FaceUnityLegacy | positive |
public void analyze() throws Exception {
BugDAO bugDAO = new BugDAO();
HashMap<Integer, ArrayList<AnalysisValue>> bugVectorsExceptComments = getVectorsExceptComments();
HashMap<Integer, ArrayList<AnalysisValue>> bugVectors = getVectors();
for (int i = 0; i < bugs.size(); i++) {
Bug bug = bugs.get(i);
int firstBugID = bug.getID();
ArrayList<AnalysisValue> firstBugVector = bugVectorsExceptComments.get(firstBugID);
String openDateString = bug.getOpenDateString();
ArrayList<Bug> targetBugs = null;
int targetIndex = 0;
if (1 < bugDAO.getBugCountWithDate(openDateString)) {
targetBugs = bugDAO.getPreviousFixedBugs(openDateString, firstBugID);
targetIndex = targetBugs.size();
} else {
targetBugs = bugs;
targetIndex = i;
}
for (int j = 0; j < targetIndex; j++) {
int secondBugID = targetBugs.get(j).getID();
ArrayList<AnalysisValue> secondBugVector = bugVectors.get(secondBugID);
double similarityScore = getCosineValue(firstBugVector, secondBugVector);
bugDAO.insertSimilarBugInfo(firstBugID, secondBugID, similarityScore);
}
}
BugDAO bugDAO = new BugDAO();
fixedFilesMap = new HashMap<Integer, HashSet<SourceFile>>();
similarBugInfosMap = new HashMap<Integer, HashSet<SimilarBugInfo>>();
for (int i = 0; i < bugs.size(); i++) {
Bug bug = bugs.get(i);
int bugID = bug.getID();
HashSet<SourceFile> fixedFiles = bugDAO.getFixedFiles(bugID);
fixedFilesMap.put(bugID, fixedFiles);
HashSet<SimilarBugInfo> similarBugInfos = bugDAO.getSimilarBugInfos(bugID);
similarBugInfosMap.put(bugID, similarBugInfos);
}
ExecutorService executor = Executors.newFixedThreadPool(Property.THREAD_COUNT);
for (int i = 0; i < bugs.size(); i++) {
Runnable worker = new WorkerThread(bugs.get(i));
executor.execute(worker);
}
executor.shutdown();
while (!executor.isTerminated()) {
}
} | <DeepExtract>
BugDAO bugDAO = new BugDAO();
HashMap<Integer, ArrayList<AnalysisValue>> bugVectorsExceptComments = getVectorsExceptComments();
HashMap<Integer, ArrayList<AnalysisValue>> bugVectors = getVectors();
for (int i = 0; i < bugs.size(); i++) {
Bug bug = bugs.get(i);
int firstBugID = bug.getID();
ArrayList<AnalysisValue> firstBugVector = bugVectorsExceptComments.get(firstBugID);
String openDateString = bug.getOpenDateString();
ArrayList<Bug> targetBugs = null;
int targetIndex = 0;
if (1 < bugDAO.getBugCountWithDate(openDateString)) {
targetBugs = bugDAO.getPreviousFixedBugs(openDateString, firstBugID);
targetIndex = targetBugs.size();
} else {
targetBugs = bugs;
targetIndex = i;
}
for (int j = 0; j < targetIndex; j++) {
int secondBugID = targetBugs.get(j).getID();
ArrayList<AnalysisValue> secondBugVector = bugVectors.get(secondBugID);
double similarityScore = getCosineValue(firstBugVector, secondBugVector);
bugDAO.insertSimilarBugInfo(firstBugID, secondBugID, similarityScore);
}
}
</DeepExtract>
<DeepExtract>
BugDAO bugDAO = new BugDAO();
fixedFilesMap = new HashMap<Integer, HashSet<SourceFile>>();
similarBugInfosMap = new HashMap<Integer, HashSet<SimilarBugInfo>>();
for (int i = 0; i < bugs.size(); i++) {
Bug bug = bugs.get(i);
int bugID = bug.getID();
HashSet<SourceFile> fixedFiles = bugDAO.getFixedFiles(bugID);
fixedFilesMap.put(bugID, fixedFiles);
HashSet<SimilarBugInfo> similarBugInfos = bugDAO.getSimilarBugInfos(bugID);
similarBugInfosMap.put(bugID, similarBugInfos);
}
</DeepExtract>
| BLIA | positive |
public String print_script(Diff.change script) {
if (outfile == null)
outfile = new PrintWriter(new OutputStreamWriter(System.out));
Diff.change next = script;
while (next != null) {
Diff.change t, end;
t = next;
end = hunkfun(next);
next = end.link;
end.link = null;
print_hunk(t);
end.link = next;
}
outfile.flush();
return stringOut.toString();
} | <DeepExtract>
if (outfile == null)
outfile = new PrintWriter(new OutputStreamWriter(System.out));
</DeepExtract>
| DirBuster | positive |
@Override
public void start(LocalDateTime start, LocalDateTime end) {
LocalDateTime current = start;
LocalDate lastDayProcessed = start.toLocalDate().minusDays(1);
boolean trading = true;
while (current.compareTo(end) <= 0) {
if (TradingHelper.hasEndedTradingTime(current) && trading) {
addToQueue(new EndedTradingDayEvent(current, priceFeedHandler.getPriceSymbolMapped(current)));
trading = false;
}
if (!TradingHelper.isTradingTime(current)) {
current = current.plusSeconds(1L);
continue;
}
trading = true;
if (lastDayProcessed.compareTo(current.toLocalDate()) < 0) {
lastDayProcessed = current.toLocalDate();
}
PriceChangedEvent event = new PriceChangedEvent(current, priceFeedHandler.getPriceSymbolMapped(current));
addToQueue(event);
current = current.plusSeconds(1L);
}
SessionFinishedEvent endEvent = new SessionFinishedEvent(current, priceFeedHandler.getPriceSymbolMapped(current));
try {
eventQueue.put(endEvent);
} catch (InterruptedException e) {
throw new ForexException(e);
}
} | <DeepExtract>
try {
eventQueue.put(endEvent);
} catch (InterruptedException e) {
throw new ForexException(e);
}
</DeepExtract>
| trading-system | positive |
@Test
void testSend() throws Exception {
MockTCPServerWithMetrics server = new MockTCPServerWithMetrics(false);
server.start();
int concurency = 20;
final int reqNum = 5000;
final CountDownLatch latch = new CountDownLatch(concurency);
TCPSender sender = port -> {
TCPSender.Config senderConfig = new TCPSender.Config();
senderConfig.setPort(port);
return new TCPSender(senderConfig);
}.create(server.getLocalPort());
TimeUnit.MILLISECONDS.sleep(500);
final ExecutorService senderExecutorService = Executors.newCachedThreadPool();
for (int i = 0; i < concurency; i++) {
senderExecutorService.execute(() -> {
try {
byte[] bytes = "0123456789".getBytes(Charset.forName("UTF-8"));
for (int j = 0; j < reqNum; j++) {
sender.send(ByteBuffer.wrap(bytes));
}
latch.countDown();
} catch (IOException e) {
e.printStackTrace();
}
});
}
assertTrue(latch.await(4, TimeUnit.SECONDS));
sender.close();
server.waitUntilEventsStop();
server.stop();
int connectCount = 0;
int closeCount = 0;
long recvCount = 0;
long recvLen = 0;
for (Tuple<MockTCPServerWithMetrics.Type, Integer> event : server.getEvents()) {
switch(event.getFirst()) {
case CONNECT:
connectCount++;
break;
case CLOSE:
closeCount++;
break;
case RECEIVE:
recvCount++;
recvLen += event.getSecond();
break;
}
}
LOG.debug("recvCount={}", recvCount);
assertThat(connectCount, is(1));
assertThat(recvLen, is((long) concurency * reqNum * 10));
assertThat(closeCount, is(1));
} | <DeepExtract>
MockTCPServerWithMetrics server = new MockTCPServerWithMetrics(false);
server.start();
int concurency = 20;
final int reqNum = 5000;
final CountDownLatch latch = new CountDownLatch(concurency);
TCPSender sender = port -> {
TCPSender.Config senderConfig = new TCPSender.Config();
senderConfig.setPort(port);
return new TCPSender(senderConfig);
}.create(server.getLocalPort());
TimeUnit.MILLISECONDS.sleep(500);
final ExecutorService senderExecutorService = Executors.newCachedThreadPool();
for (int i = 0; i < concurency; i++) {
senderExecutorService.execute(() -> {
try {
byte[] bytes = "0123456789".getBytes(Charset.forName("UTF-8"));
for (int j = 0; j < reqNum; j++) {
sender.send(ByteBuffer.wrap(bytes));
}
latch.countDown();
} catch (IOException e) {
e.printStackTrace();
}
});
}
assertTrue(latch.await(4, TimeUnit.SECONDS));
sender.close();
server.waitUntilEventsStop();
server.stop();
int connectCount = 0;
int closeCount = 0;
long recvCount = 0;
long recvLen = 0;
for (Tuple<MockTCPServerWithMetrics.Type, Integer> event : server.getEvents()) {
switch(event.getFirst()) {
case CONNECT:
connectCount++;
break;
case CLOSE:
closeCount++;
break;
case RECEIVE:
recvCount++;
recvLen += event.getSecond();
break;
}
}
LOG.debug("recvCount={}", recvCount);
assertThat(connectCount, is(1));
assertThat(recvLen, is((long) concurency * reqNum * 10));
assertThat(closeCount, is(1));
</DeepExtract>
| fluency | positive |
public static void main(String[] args) {
Graph g = new Graph(6);
adj[0].add(1);
adj[0].add(3);
adj[1].add(4);
adj[1].add(2);
adj[2].add(5);
adj[5].add(0);
LinkedList<Integer> Queue = new LinkedList<Integer>();
boolean[] visited = new boolean[V];
visited[0] = true;
Queue.add(0);
while (Queue.size() != 0) {
int i = Queue.poll();
System.out.print(i + " ");
Iterator<Integer> iterator = adj[i].listIterator();
while (iterator.hasNext()) {
int n = iterator.next();
if (!visited[n]) {
Queue.add(n);
visited[n] = true;
}
}
}
} | <DeepExtract>
adj[0].add(1);
</DeepExtract>
<DeepExtract>
adj[0].add(3);
</DeepExtract>
<DeepExtract>
adj[1].add(4);
</DeepExtract>
<DeepExtract>
adj[1].add(2);
</DeepExtract>
<DeepExtract>
adj[2].add(5);
</DeepExtract>
<DeepExtract>
adj[5].add(0);
</DeepExtract>
<DeepExtract>
LinkedList<Integer> Queue = new LinkedList<Integer>();
boolean[] visited = new boolean[V];
visited[0] = true;
Queue.add(0);
while (Queue.size() != 0) {
int i = Queue.poll();
System.out.print(i + " ");
Iterator<Integer> iterator = adj[i].listIterator();
while (iterator.hasNext()) {
int n = iterator.next();
if (!visited[n]) {
Queue.add(n);
visited[n] = true;
}
}
}
</DeepExtract>
| Cracking-The-Coding-Interview-Solutions | positive |
public void actionPerformed(ActionEvent e) {
var selectedRowIndexs = Arrays.stream(table.getSelectedRows()).mapToObj(Integer::valueOf).collect(Collectors.toList());
Collections.reverse(selectedRowIndexs);
for (var rowIndex : selectedRowIndexs) {
if (pluginInfos.get(rowIndex).getLoadInfo().isLoaded()) {
loadOrUnloadPlugin(rowIndex, false);
}
removePluginInfo(rowIndex);
}
saveAsUserOption();
} | <DeepExtract>
var selectedRowIndexs = Arrays.stream(table.getSelectedRows()).mapToObj(Integer::valueOf).collect(Collectors.toList());
Collections.reverse(selectedRowIndexs);
for (var rowIndex : selectedRowIndexs) {
if (pluginInfos.get(rowIndex).getLoadInfo().isLoaded()) {
loadOrUnloadPlugin(rowIndex, false);
}
removePluginInfo(rowIndex);
}
saveAsUserOption();
</DeepExtract>
| integrated-security-testing-environment | positive |
private Stack<Operation> getRedoStack(RTEditText editor) {
Stack<Operation> stack = mRedoStacks.get(editor.getId());
if (stack == null) {
stack = new Stack<>();
mRedoStacks.put(editor.getId(), stack);
}
return stack;
} | <DeepExtract>
Stack<Operation> stack = mRedoStacks.get(editor.getId());
if (stack == null) {
stack = new Stack<>();
mRedoStacks.put(editor.getId(), stack);
}
return stack;
</DeepExtract>
| Android-RTEditor | positive |
@NonNull
public <T> MyStringBuilder withCommaNonEmpty(CharSequence label, T obj) {
return obj == null || !MyStringBuilder::nonEmptyObj.test(obj) ? this : withComma(label, obj);
} | <DeepExtract>
return obj == null || !MyStringBuilder::nonEmptyObj.test(obj) ? this : withComma(label, obj);
</DeepExtract>
| calendar-widget | positive |
public UnaryDoubleEval getUnaryDoubleEval() throws Exception {
if (!sqlExceptions.isEmpty()) {
throw sqlExceptions.get(0);
}
SQLtype type = expressionInfo.resultType;
JavaType jType = TypeUtil.toJavaType(type);
smartSwap(jType, JavaType.INT);
evaluationVisitor.visitVarInsn(Opcodes.ALOAD, 2);
smartSwap(jType, JavaType.INT);
evaluationVisitor.visitInsn(Opcodes.ICONST_0);
smartSwap(jType, JavaType.INT);
switch(jType) {
case INT:
evaluationVisitor.visitInsn(Opcodes.IASTORE);
break;
case LONG:
evaluationVisitor.visitInsn(Opcodes.LASTORE);
break;
case DOUBLE:
evaluationVisitor.visitInsn(Opcodes.DASTORE);
break;
case STRING:
evaluationVisitor.visitInsn(Opcodes.AASTORE);
break;
}
evaluationVisitor.visitInsn(Opcodes.IRETURN);
if (LoggingConfig.COMPILATION_VERBOSE) {
outputBytecode(classWriter);
}
evaluationVisitor.visitMaxs(-1, -1);
evaluationVisitor.visitEnd();
classWriter.visitEnd();
DynamicClassLoader loader = new DynamicClassLoader();
Class<?> expressionClass = loader.defineClass("expressions.compilation." + className, classWriter.toByteArray());
return (UnaryDoubleEval) expressionClass.newInstance();
} | <DeepExtract>
if (!sqlExceptions.isEmpty()) {
throw sqlExceptions.get(0);
}
SQLtype type = expressionInfo.resultType;
JavaType jType = TypeUtil.toJavaType(type);
smartSwap(jType, JavaType.INT);
evaluationVisitor.visitVarInsn(Opcodes.ALOAD, 2);
smartSwap(jType, JavaType.INT);
evaluationVisitor.visitInsn(Opcodes.ICONST_0);
smartSwap(jType, JavaType.INT);
switch(jType) {
case INT:
evaluationVisitor.visitInsn(Opcodes.IASTORE);
break;
case LONG:
evaluationVisitor.visitInsn(Opcodes.LASTORE);
break;
case DOUBLE:
evaluationVisitor.visitInsn(Opcodes.DASTORE);
break;
case STRING:
evaluationVisitor.visitInsn(Opcodes.AASTORE);
break;
}
evaluationVisitor.visitInsn(Opcodes.IRETURN);
if (LoggingConfig.COMPILATION_VERBOSE) {
outputBytecode(classWriter);
}
evaluationVisitor.visitMaxs(-1, -1);
evaluationVisitor.visitEnd();
classWriter.visitEnd();
</DeepExtract>
| skinnerdb | positive |
public final boolean matchesPrefix() {
wOffset = offset + 0;
wEnd = -1;
called = false;
flush();
called = true;
final int end = this.end;
int offset = this.offset;
char[] data = this.data;
int wOffset = this.wOffset;
int wEnd = this.wEnd;
MemReg[] memregs = this.memregs;
int[] counters = this.counters;
LAEntry[] lookaheads = this.lookaheads;
SearchEntry defaultEntry = this.defaultEntry;
SearchEntry first = this.first;
SearchEntry top = this.top;
SearchEntry actual;
int cnt, regLen;
int i;
final boolean matchEnd = (ANCHOR_START | ACCEPT_INCOMPLETE | ANCHOR_END & ANCHOR_END) > 0;
final boolean allowIncomplete = (ANCHOR_START | ACCEPT_INCOMPLETE | ANCHOR_END & ACCEPT_INCOMPLETE) > 0;
Pattern re = this.re;
Term root = re.root;
Term term;
if (top == null) {
if ((ANCHOR_START | ACCEPT_INCOMPLETE | ANCHOR_END & ANCHOR_START) > 0) {
term = re.root0;
root = startAnchor;
} else if ((ANCHOR_START | ACCEPT_INCOMPLETE | ANCHOR_END & ANCHOR_LASTMATCH) > 0) {
term = re.root0;
root = lastMatchAnchor;
} else {
term = root;
}
i = wOffset;
actual = first;
SearchEntry.popState(defaultEntry, memregs, counters);
} else {
top = (actual = top).sub;
term = actual.term;
i = actual.index;
SearchEntry.popState(actual, memregs, counters);
}
cnt = actual.cnt;
regLen = actual.regLen;
main: while (wOffset <= end) {
matchHere: for (; ; ) {
int memreg, cntreg;
char c;
if (term != null) {
switch(term.type) {
case Term.FIND:
{
int jump = find(data, i + term.distance, end, term.target);
if (jump < 0)
break main;
i += jump;
wOffset = i;
if (term.eat) {
if (i == end)
break;
i++;
}
term = term.next;
continue matchHere;
}
case Term.FINDREG:
{
MemReg mr = memregs[term.target.memreg];
int sampleOff = mr.in;
int sampleLen = mr.out - sampleOff;
if (sampleOff < 0 || sampleLen < 0) {
break;
} else if (sampleLen == 0) {
term = term.next;
continue matchHere;
}
int jump = findReg(data, i + term.distance, sampleOff, sampleLen, term.target, end);
if (jump < 0)
break main;
i += jump;
wOffset = i;
if (term.eat) {
i += sampleLen;
if (i > end)
break;
}
term = term.next;
continue matchHere;
}
case Term.VOID:
term = term.next;
continue matchHere;
case Term.CHAR:
if (i >= end || (re.caseless ? Category.caseFold(data[i]) : data[i]) != term.c)
break;
i++;
term = term.next;
continue matchHere;
case Term.ANY_CHAR:
if (i >= end)
break;
i++;
term = term.next;
continue matchHere;
case Term.ANY_CHAR_NE:
if (i >= end || (c = data[i]) == '\r' || c == '\n')
break;
i++;
term = term.next;
continue matchHere;
case Term.END:
if (i >= end) {
term = term.next;
continue matchHere;
}
break;
case Term.END_EOL:
if (i >= end) {
term = term.next;
continue matchHere;
} else {
boolean matches = i >= end | ((i + 1) == end && data[i] == '\n') | ((i + 2) == end && data[i] == '\r' && data[i + 1] == '\n');
if (matches) {
term = term.next;
continue matchHere;
} else
break;
}
case Term.LINE_END:
if (i >= end) {
term = term.next;
continue matchHere;
} else {
if ((c = data[i]) == '\n' || c == '\u0085' || c == '\u2028' || c == '\u2029' || (i < data.length - 1 && data[i + 1] == '\n' && c == '\r') || c == '\r') {
term = term.next;
continue matchHere;
}
}
break;
case Term.START:
if (i == offset) {
term = term.next;
continue matchHere;
}
if (top != null)
break;
if (term != startAnchor)
break;
else
break main;
case Term.LAST_MATCH_END:
if (i == wEnd || (wEnd == -1 && i == offset)) {
term = term.next;
continue matchHere;
}
break main;
case Term.LINE_START:
if (i == offset) {
term = term.next;
continue matchHere;
} else if (i < end) {
if ((c = data[i - 1]) == '\n' || c == '\u0085' || c == '\u2028' || c == '\u2029' || (data[i] == '\n' && c == '\r') || c == '\r') {
term = term.next;
continue matchHere;
}
}
break;
case Term.BITSET:
{
if (i >= end)
break;
c = re.caseless ? Category.caseFold(data[i]) : data[i];
if (!(c <= 255 && term.bitset.get(c)) ^ term.inverse)
break;
i++;
term = term.next;
continue matchHere;
}
case Term.BITSET2:
{
if (i >= end)
break;
c = re.caseless ? Category.caseFold(data[i]) : data[i];
IntBitSet arr = term.bitset2[c >> 8];
if (arr == null || !arr.get(c & 255) ^ term.inverse)
break;
i++;
term = term.next;
continue matchHere;
}
case Term.BOUNDARY:
{
boolean ch1Meets = false, ch2Meets = false;
IntBitSet bitset = term.bitset;
test1: {
int j = i - 1;
if (j < offset)
break test1;
c = re.caseless ? Category.caseFold(data[j]) : data[j];
ch1Meets = (c < 256 && bitset.get(c));
}
test2: {
if (i >= end)
break test2;
c = re.caseless ? Category.caseFold(data[i]) : data[i];
ch2Meets = (c < 256 && bitset.get(c));
}
if (ch1Meets ^ ch2Meets ^ term.inverse) {
term = term.next;
continue matchHere;
} else
break;
}
case Term.UBOUNDARY:
{
boolean ch1Meets = false, ch2Meets = false;
IntBitSet[] bitset2 = term.bitset2;
test1: {
int j = i - 1;
if (j < offset)
break test1;
c = re.caseless ? Category.caseFold(data[j]) : data[j];
IntBitSet bits = bitset2[c >> 8];
ch1Meets = bits != null && bits.get(c & 0xff);
}
test2: {
if (i >= end)
break test2;
c = re.caseless ? Category.caseFold(data[i]) : data[i];
IntBitSet bits = bitset2[c >> 8];
ch2Meets = bits != null && bits.get(c & 0xff);
}
if (ch1Meets ^ ch2Meets ^ term.inverse) {
term = term.next;
continue matchHere;
} else
break;
}
case Term.DIRECTION:
{
boolean ch1Meets = false, ch2Meets = false;
IntBitSet bitset = term.bitset;
boolean inv = term.inverse;
int j = i - 1;
if (j >= offset) {
c = re.caseless ? Category.caseFold(data[j]) : data[j];
ch1Meets = c < 256 && bitset.get(c);
}
if (ch1Meets ^ inv)
break;
if (i < end) {
c = re.caseless ? Category.caseFold(data[i]) : data[i];
ch2Meets = c < 256 && bitset.get(c);
}
if (!ch2Meets ^ inv)
break;
term = term.next;
continue matchHere;
}
case Term.UDIRECTION:
{
boolean ch1Meets = false, ch2Meets = false;
IntBitSet[] bitset2 = term.bitset2;
boolean inv = term.inverse;
int j = i - 1;
if (j >= offset) {
c = re.caseless ? Category.caseFold(data[j]) : data[j];
IntBitSet bits = bitset2[c >> 8];
ch1Meets = bits != null && bits.get(c & 0xff);
}
if (ch1Meets ^ inv)
break;
if (i < end) {
c = re.caseless ? Category.caseFold(data[i]) : data[i];
IntBitSet bits = bitset2[c >> 8];
ch2Meets = bits != null && bits.get(c & 0xff);
}
if (!ch2Meets ^ inv)
break;
term = term.next;
continue matchHere;
}
case Term.REG:
case Term.REG_I:
{
if (term.memreg >= memregs.length)
break;
MemReg mr = memregs[term.memreg];
int sampleOffset = mr.in;
int sampleOutside = mr.out;
int rLen;
if (sampleOffset < 0 || (rLen = sampleOutside - sampleOffset) < 0) {
break;
} else if (rLen == 0) {
term = term.next;
continue matchHere;
}
if ((i + rLen) > end)
break;
if (compareRegions(data, sampleOffset, i, rLen, end, term)) {
i += rLen;
term = term.next;
continue matchHere;
}
break;
}
case Term.REPEAT_0_INF:
{
if ((cnt = repeat(data, i, end, term.target)) <= 0) {
term = term.next;
continue;
}
i += cnt;
actual.cnt = cnt;
actual.term = term.failNext;
actual.index = i;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
}
case Term.REPEAT_MIN_INF:
{
cnt = repeat(data, i, end, term.target);
if (cnt < term.minCount)
break;
i += cnt;
actual.cnt = cnt;
actual.term = term.failNext;
actual.index = i;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
}
case Term.REPEAT_MIN_MAX:
{
int out2 = i + term.maxCount;
cnt = repeat(data, i, end < out2 ? end : out2, term.target);
if (cnt < term.minCount)
break;
i += cnt;
actual.cnt = cnt;
actual.term = term.failNext;
actual.index = i;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
}
case Term.REPEAT_REG_MIN_INF:
{
MemReg mr = memregs[term.memreg];
int sampleOffset = mr.in;
int sampleOutside = mr.out;
int bitset;
if (sampleOffset < 0 || (bitset = sampleOutside - sampleOffset) < 0) {
break;
} else if (bitset == 0) {
term = term.next;
continue matchHere;
}
cnt = 0;
while (compareRegions(data, i, sampleOffset, bitset, end, term)) {
cnt++;
i += bitset;
}
if (cnt < term.minCount)
break;
actual.cnt = cnt;
actual.term = term.failNext;
actual.index = i;
actual.regLen = bitset;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
}
case Term.REPEAT_REG_MIN_MAX:
{
MemReg mr = memregs[term.memreg];
int sampleOffset = mr.in;
int sampleOutside = mr.out;
int bitset;
if (sampleOffset < 0 || (bitset = sampleOutside - sampleOffset) < 0) {
break;
} else if (bitset == 0) {
term = term.next;
continue matchHere;
}
cnt = 0;
int countBack = term.maxCount;
while (countBack > 0 && compareRegions(data, i, sampleOffset, bitset, end, term)) {
cnt++;
i += bitset;
countBack--;
}
if (cnt < term.minCount)
break;
actual.cnt = cnt;
actual.term = term.failNext;
actual.index = i;
actual.regLen = bitset;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
}
case Term.BACKTRACK_0:
cnt = actual.cnt;
if (cnt > 0) {
cnt--;
i--;
actual.cnt = cnt;
actual.index = i;
actual.term = term;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
} else
break;
case Term.BACKTRACK_MIN:
cnt = actual.cnt;
if (cnt > term.minCount) {
cnt--;
i--;
actual.cnt = cnt;
actual.index = i;
actual.term = term;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
} else
break;
case Term.BACKTRACK_FIND_MIN:
{
cnt = actual.cnt;
int minCnt;
if (cnt > (minCnt = term.minCount)) {
int start = i + term.distance;
if (start > end) {
int exceed = start - end;
cnt -= exceed;
if (cnt <= minCnt)
break;
i -= exceed;
}
int back = findBack(data, i + term.distance, cnt - minCnt, term.target);
if (back < 0)
break;
if ((cnt -= back) <= minCnt) {
i -= back;
if (term.eat)
i++;
term = term.next;
continue;
}
i -= back;
actual.cnt = cnt;
actual.index = i;
if (term.eat)
i++;
actual.term = term;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
} else
break;
}
case Term.BACKTRACK_FINDREG_MIN:
{
cnt = actual.cnt;
int minCnt;
if (cnt > (minCnt = term.minCount)) {
int start = i + term.distance;
if (start > end) {
int exceed = start - end;
cnt -= exceed;
if (cnt <= minCnt)
break;
i -= exceed;
}
MemReg mr = memregs[term.target.memreg];
int sampleOff = mr.in;
int sampleLen = mr.out - sampleOff;
int back;
if (sampleOff < 0 || sampleLen < 0) {
cnt--;
i--;
actual.cnt = cnt;
actual.index = i;
actual.term = term;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
} else if (sampleLen == 0) {
back = -1;
} else {
back = findBackReg(data, i + term.distance, sampleOff, sampleLen, cnt - minCnt, term.target, end);
if (back < 0)
break;
}
cnt -= back;
i -= back;
actual.cnt = cnt;
actual.index = i;
if (term.eat)
i += sampleLen;
actual.term = term;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
} else
break;
}
case Term.BACKTRACK_REG_MIN:
cnt = actual.cnt;
if (cnt > term.minCount) {
regLen = actual.regLen;
cnt--;
i -= regLen;
actual.cnt = cnt;
actual.index = i;
actual.term = term;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
} else
break;
case Term.GROUP_IN:
{
memreg = term.memreg;
if (memreg > 0) {
memregs[memreg].tmp = i;
}
term = term.next;
continue;
}
case Term.GROUP_OUT:
memreg = term.memreg;
if (memreg > 0) {
MemReg mr = memregs[memreg];
SearchEntry.saveMemregState((top != null) ? top : defaultEntry, memreg, mr);
mr.in = mr.tmp;
mr.out = i;
}
term = term.next;
continue;
case Term.PLOOKBEHIND_IN:
{
int tmp = i - term.distance;
if (tmp < offset)
break;
LAEntry le = lookaheads[term.lookaheadId];
le.index = i;
i = tmp;
le.actual = actual;
le.top = top;
term = term.next;
continue;
}
case Term.INDEPENDENT_IN:
case Term.PLOOKAHEAD_IN:
{
LAEntry le = lookaheads[term.lookaheadId];
le.index = i;
le.actual = actual;
le.top = top;
term = term.next;
continue;
}
case Term.LOOKBEHIND_CONDITION_OUT:
case Term.LOOKAHEAD_CONDITION_OUT:
case Term.PLOOKAHEAD_OUT:
case Term.PLOOKBEHIND_OUT:
{
LAEntry le = lookaheads[term.lookaheadId];
i = le.index;
actual = le.actual;
top = le.top;
term = term.next;
continue;
}
case Term.INDEPENDENT_OUT:
{
LAEntry le = lookaheads[term.lookaheadId];
actual = le.actual;
top = le.top;
term = term.next;
continue;
}
case Term.NLOOKBEHIND_IN:
{
int tmp = i - term.distance;
if (tmp < offset) {
term = term.failNext;
continue;
}
LAEntry le = lookaheads[term.lookaheadId];
le.actual = actual;
le.top = top;
actual.term = term.failNext;
actual.index = i;
i = tmp;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
}
case Term.NLOOKAHEAD_IN:
{
LAEntry le = lookaheads[term.lookaheadId];
le.actual = actual;
le.top = top;
actual.term = term.failNext;
actual.index = i;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
}
case Term.NLOOKBEHIND_OUT:
case Term.NLOOKAHEAD_OUT:
{
LAEntry le = lookaheads[term.lookaheadId];
actual = le.actual;
top = le.top;
break;
}
case Term.LOOKBEHIND_CONDITION_IN:
{
int tmp = i - term.distance;
if (tmp < offset) {
term = term.failNext;
continue;
}
LAEntry le = lookaheads[term.lookaheadId];
le.index = i;
le.actual = actual;
le.top = top;
actual.term = term.failNext;
actual.index = i;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
i = tmp;
term = term.next;
continue;
}
case Term.LOOKAHEAD_CONDITION_IN:
{
LAEntry le = lookaheads[term.lookaheadId];
le.index = i;
le.actual = actual;
le.top = top;
actual.term = term.failNext;
actual.index = i;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
}
case Term.MEMREG_CONDITION:
{
MemReg mr = memregs[term.memreg];
int sampleOffset = mr.in;
int sampleOutside = mr.out;
if (sampleOffset >= 0 && sampleOutside >= 0 && sampleOutside >= sampleOffset) {
term = term.next;
} else {
term = term.failNext;
}
continue;
}
case Term.BRANCH_STORE_CNT_AUX1:
actual.regLen = regLen;
case Term.BRANCH_STORE_CNT:
actual.cnt = cnt;
case Term.BRANCH:
actual.term = term.failNext;
actual.index = i;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
case Term.SUCCESS:
if (!matchEnd || i == end) {
this.wOffset = memregs[0].in = wOffset;
this.wEnd = memregs[0].out = i;
this.top = top;
return true;
} else
break;
case Term.CNT_SET_0:
cnt = 0;
term = term.next;
continue;
case Term.CNT_INC:
cnt++;
term = term.next;
continue;
case Term.CNT_GT_EQ:
if (cnt >= term.maxCount) {
term = term.next;
continue;
} else
break;
case Term.READ_CNT_LT:
cnt = actual.cnt;
if (cnt < term.maxCount) {
term = term.next;
continue;
} else
break;
case Term.CRSTORE_CRINC:
{
int cntvalue = counters[cntreg = term.cntreg];
SearchEntry.saveCntState((top != null) ? top : defaultEntry, cntreg, cntvalue);
counters[cntreg] = ++cntvalue;
term = term.next;
continue;
}
case Term.CR_SET_0:
counters[term.cntreg] = 0;
term = term.next;
continue;
case Term.CR_LT:
if (counters[term.cntreg] < term.maxCount) {
term = term.next;
continue;
} else
break;
case Term.CR_GT_EQ:
if (counters[term.cntreg] >= term.maxCount) {
term = term.next;
continue;
} else
break;
default:
throw new Error("unknown term type: " + term.type);
}
} else {
this.wOffset = memregs[0].in = wOffset;
this.wEnd = memregs[0].out = i;
this.top = top;
return true;
}
if (allowIncomplete && i == end) {
this.wOffset = memregs[0].in = wOffset;
this.wEnd = memregs[0].out = i;
this.top = top;
return true;
}
if (top == null) {
break;
}
top = (actual = top).sub;
term = actual.term;
i = actual.index;
if (actual.isState) {
SearchEntry.popState(actual, memregs, counters);
}
}
if (defaultEntry.isState)
SearchEntry.popState(defaultEntry, memregs, counters);
term = root;
i = ++wOffset;
}
this.wOffset = wOffset;
this.top = top;
return false;
} | <DeepExtract>
wOffset = offset + 0;
wEnd = -1;
called = false;
flush();
</DeepExtract>
<DeepExtract>
called = true;
final int end = this.end;
int offset = this.offset;
char[] data = this.data;
int wOffset = this.wOffset;
int wEnd = this.wEnd;
MemReg[] memregs = this.memregs;
int[] counters = this.counters;
LAEntry[] lookaheads = this.lookaheads;
SearchEntry defaultEntry = this.defaultEntry;
SearchEntry first = this.first;
SearchEntry top = this.top;
SearchEntry actual;
int cnt, regLen;
int i;
final boolean matchEnd = (ANCHOR_START | ACCEPT_INCOMPLETE | ANCHOR_END & ANCHOR_END) > 0;
final boolean allowIncomplete = (ANCHOR_START | ACCEPT_INCOMPLETE | ANCHOR_END & ACCEPT_INCOMPLETE) > 0;
Pattern re = this.re;
Term root = re.root;
Term term;
if (top == null) {
if ((ANCHOR_START | ACCEPT_INCOMPLETE | ANCHOR_END & ANCHOR_START) > 0) {
term = re.root0;
root = startAnchor;
} else if ((ANCHOR_START | ACCEPT_INCOMPLETE | ANCHOR_END & ANCHOR_LASTMATCH) > 0) {
term = re.root0;
root = lastMatchAnchor;
} else {
term = root;
}
i = wOffset;
actual = first;
SearchEntry.popState(defaultEntry, memregs, counters);
} else {
top = (actual = top).sub;
term = actual.term;
i = actual.index;
SearchEntry.popState(actual, memregs, counters);
}
cnt = actual.cnt;
regLen = actual.regLen;
main: while (wOffset <= end) {
matchHere: for (; ; ) {
int memreg, cntreg;
char c;
if (term != null) {
switch(term.type) {
case Term.FIND:
{
int jump = find(data, i + term.distance, end, term.target);
if (jump < 0)
break main;
i += jump;
wOffset = i;
if (term.eat) {
if (i == end)
break;
i++;
}
term = term.next;
continue matchHere;
}
case Term.FINDREG:
{
MemReg mr = memregs[term.target.memreg];
int sampleOff = mr.in;
int sampleLen = mr.out - sampleOff;
if (sampleOff < 0 || sampleLen < 0) {
break;
} else if (sampleLen == 0) {
term = term.next;
continue matchHere;
}
int jump = findReg(data, i + term.distance, sampleOff, sampleLen, term.target, end);
if (jump < 0)
break main;
i += jump;
wOffset = i;
if (term.eat) {
i += sampleLen;
if (i > end)
break;
}
term = term.next;
continue matchHere;
}
case Term.VOID:
term = term.next;
continue matchHere;
case Term.CHAR:
if (i >= end || (re.caseless ? Category.caseFold(data[i]) : data[i]) != term.c)
break;
i++;
term = term.next;
continue matchHere;
case Term.ANY_CHAR:
if (i >= end)
break;
i++;
term = term.next;
continue matchHere;
case Term.ANY_CHAR_NE:
if (i >= end || (c = data[i]) == '\r' || c == '\n')
break;
i++;
term = term.next;
continue matchHere;
case Term.END:
if (i >= end) {
term = term.next;
continue matchHere;
}
break;
case Term.END_EOL:
if (i >= end) {
term = term.next;
continue matchHere;
} else {
boolean matches = i >= end | ((i + 1) == end && data[i] == '\n') | ((i + 2) == end && data[i] == '\r' && data[i + 1] == '\n');
if (matches) {
term = term.next;
continue matchHere;
} else
break;
}
case Term.LINE_END:
if (i >= end) {
term = term.next;
continue matchHere;
} else {
if ((c = data[i]) == '\n' || c == '\u0085' || c == '\u2028' || c == '\u2029' || (i < data.length - 1 && data[i + 1] == '\n' && c == '\r') || c == '\r') {
term = term.next;
continue matchHere;
}
}
break;
case Term.START:
if (i == offset) {
term = term.next;
continue matchHere;
}
if (top != null)
break;
if (term != startAnchor)
break;
else
break main;
case Term.LAST_MATCH_END:
if (i == wEnd || (wEnd == -1 && i == offset)) {
term = term.next;
continue matchHere;
}
break main;
case Term.LINE_START:
if (i == offset) {
term = term.next;
continue matchHere;
} else if (i < end) {
if ((c = data[i - 1]) == '\n' || c == '\u0085' || c == '\u2028' || c == '\u2029' || (data[i] == '\n' && c == '\r') || c == '\r') {
term = term.next;
continue matchHere;
}
}
break;
case Term.BITSET:
{
if (i >= end)
break;
c = re.caseless ? Category.caseFold(data[i]) : data[i];
if (!(c <= 255 && term.bitset.get(c)) ^ term.inverse)
break;
i++;
term = term.next;
continue matchHere;
}
case Term.BITSET2:
{
if (i >= end)
break;
c = re.caseless ? Category.caseFold(data[i]) : data[i];
IntBitSet arr = term.bitset2[c >> 8];
if (arr == null || !arr.get(c & 255) ^ term.inverse)
break;
i++;
term = term.next;
continue matchHere;
}
case Term.BOUNDARY:
{
boolean ch1Meets = false, ch2Meets = false;
IntBitSet bitset = term.bitset;
test1: {
int j = i - 1;
if (j < offset)
break test1;
c = re.caseless ? Category.caseFold(data[j]) : data[j];
ch1Meets = (c < 256 && bitset.get(c));
}
test2: {
if (i >= end)
break test2;
c = re.caseless ? Category.caseFold(data[i]) : data[i];
ch2Meets = (c < 256 && bitset.get(c));
}
if (ch1Meets ^ ch2Meets ^ term.inverse) {
term = term.next;
continue matchHere;
} else
break;
}
case Term.UBOUNDARY:
{
boolean ch1Meets = false, ch2Meets = false;
IntBitSet[] bitset2 = term.bitset2;
test1: {
int j = i - 1;
if (j < offset)
break test1;
c = re.caseless ? Category.caseFold(data[j]) : data[j];
IntBitSet bits = bitset2[c >> 8];
ch1Meets = bits != null && bits.get(c & 0xff);
}
test2: {
if (i >= end)
break test2;
c = re.caseless ? Category.caseFold(data[i]) : data[i];
IntBitSet bits = bitset2[c >> 8];
ch2Meets = bits != null && bits.get(c & 0xff);
}
if (ch1Meets ^ ch2Meets ^ term.inverse) {
term = term.next;
continue matchHere;
} else
break;
}
case Term.DIRECTION:
{
boolean ch1Meets = false, ch2Meets = false;
IntBitSet bitset = term.bitset;
boolean inv = term.inverse;
int j = i - 1;
if (j >= offset) {
c = re.caseless ? Category.caseFold(data[j]) : data[j];
ch1Meets = c < 256 && bitset.get(c);
}
if (ch1Meets ^ inv)
break;
if (i < end) {
c = re.caseless ? Category.caseFold(data[i]) : data[i];
ch2Meets = c < 256 && bitset.get(c);
}
if (!ch2Meets ^ inv)
break;
term = term.next;
continue matchHere;
}
case Term.UDIRECTION:
{
boolean ch1Meets = false, ch2Meets = false;
IntBitSet[] bitset2 = term.bitset2;
boolean inv = term.inverse;
int j = i - 1;
if (j >= offset) {
c = re.caseless ? Category.caseFold(data[j]) : data[j];
IntBitSet bits = bitset2[c >> 8];
ch1Meets = bits != null && bits.get(c & 0xff);
}
if (ch1Meets ^ inv)
break;
if (i < end) {
c = re.caseless ? Category.caseFold(data[i]) : data[i];
IntBitSet bits = bitset2[c >> 8];
ch2Meets = bits != null && bits.get(c & 0xff);
}
if (!ch2Meets ^ inv)
break;
term = term.next;
continue matchHere;
}
case Term.REG:
case Term.REG_I:
{
if (term.memreg >= memregs.length)
break;
MemReg mr = memregs[term.memreg];
int sampleOffset = mr.in;
int sampleOutside = mr.out;
int rLen;
if (sampleOffset < 0 || (rLen = sampleOutside - sampleOffset) < 0) {
break;
} else if (rLen == 0) {
term = term.next;
continue matchHere;
}
if ((i + rLen) > end)
break;
if (compareRegions(data, sampleOffset, i, rLen, end, term)) {
i += rLen;
term = term.next;
continue matchHere;
}
break;
}
case Term.REPEAT_0_INF:
{
if ((cnt = repeat(data, i, end, term.target)) <= 0) {
term = term.next;
continue;
}
i += cnt;
actual.cnt = cnt;
actual.term = term.failNext;
actual.index = i;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
}
case Term.REPEAT_MIN_INF:
{
cnt = repeat(data, i, end, term.target);
if (cnt < term.minCount)
break;
i += cnt;
actual.cnt = cnt;
actual.term = term.failNext;
actual.index = i;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
}
case Term.REPEAT_MIN_MAX:
{
int out2 = i + term.maxCount;
cnt = repeat(data, i, end < out2 ? end : out2, term.target);
if (cnt < term.minCount)
break;
i += cnt;
actual.cnt = cnt;
actual.term = term.failNext;
actual.index = i;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
}
case Term.REPEAT_REG_MIN_INF:
{
MemReg mr = memregs[term.memreg];
int sampleOffset = mr.in;
int sampleOutside = mr.out;
int bitset;
if (sampleOffset < 0 || (bitset = sampleOutside - sampleOffset) < 0) {
break;
} else if (bitset == 0) {
term = term.next;
continue matchHere;
}
cnt = 0;
while (compareRegions(data, i, sampleOffset, bitset, end, term)) {
cnt++;
i += bitset;
}
if (cnt < term.minCount)
break;
actual.cnt = cnt;
actual.term = term.failNext;
actual.index = i;
actual.regLen = bitset;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
}
case Term.REPEAT_REG_MIN_MAX:
{
MemReg mr = memregs[term.memreg];
int sampleOffset = mr.in;
int sampleOutside = mr.out;
int bitset;
if (sampleOffset < 0 || (bitset = sampleOutside - sampleOffset) < 0) {
break;
} else if (bitset == 0) {
term = term.next;
continue matchHere;
}
cnt = 0;
int countBack = term.maxCount;
while (countBack > 0 && compareRegions(data, i, sampleOffset, bitset, end, term)) {
cnt++;
i += bitset;
countBack--;
}
if (cnt < term.minCount)
break;
actual.cnt = cnt;
actual.term = term.failNext;
actual.index = i;
actual.regLen = bitset;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
}
case Term.BACKTRACK_0:
cnt = actual.cnt;
if (cnt > 0) {
cnt--;
i--;
actual.cnt = cnt;
actual.index = i;
actual.term = term;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
} else
break;
case Term.BACKTRACK_MIN:
cnt = actual.cnt;
if (cnt > term.minCount) {
cnt--;
i--;
actual.cnt = cnt;
actual.index = i;
actual.term = term;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
} else
break;
case Term.BACKTRACK_FIND_MIN:
{
cnt = actual.cnt;
int minCnt;
if (cnt > (minCnt = term.minCount)) {
int start = i + term.distance;
if (start > end) {
int exceed = start - end;
cnt -= exceed;
if (cnt <= minCnt)
break;
i -= exceed;
}
int back = findBack(data, i + term.distance, cnt - minCnt, term.target);
if (back < 0)
break;
if ((cnt -= back) <= minCnt) {
i -= back;
if (term.eat)
i++;
term = term.next;
continue;
}
i -= back;
actual.cnt = cnt;
actual.index = i;
if (term.eat)
i++;
actual.term = term;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
} else
break;
}
case Term.BACKTRACK_FINDREG_MIN:
{
cnt = actual.cnt;
int minCnt;
if (cnt > (minCnt = term.minCount)) {
int start = i + term.distance;
if (start > end) {
int exceed = start - end;
cnt -= exceed;
if (cnt <= minCnt)
break;
i -= exceed;
}
MemReg mr = memregs[term.target.memreg];
int sampleOff = mr.in;
int sampleLen = mr.out - sampleOff;
int back;
if (sampleOff < 0 || sampleLen < 0) {
cnt--;
i--;
actual.cnt = cnt;
actual.index = i;
actual.term = term;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
} else if (sampleLen == 0) {
back = -1;
} else {
back = findBackReg(data, i + term.distance, sampleOff, sampleLen, cnt - minCnt, term.target, end);
if (back < 0)
break;
}
cnt -= back;
i -= back;
actual.cnt = cnt;
actual.index = i;
if (term.eat)
i += sampleLen;
actual.term = term;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
} else
break;
}
case Term.BACKTRACK_REG_MIN:
cnt = actual.cnt;
if (cnt > term.minCount) {
regLen = actual.regLen;
cnt--;
i -= regLen;
actual.cnt = cnt;
actual.index = i;
actual.term = term;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
} else
break;
case Term.GROUP_IN:
{
memreg = term.memreg;
if (memreg > 0) {
memregs[memreg].tmp = i;
}
term = term.next;
continue;
}
case Term.GROUP_OUT:
memreg = term.memreg;
if (memreg > 0) {
MemReg mr = memregs[memreg];
SearchEntry.saveMemregState((top != null) ? top : defaultEntry, memreg, mr);
mr.in = mr.tmp;
mr.out = i;
}
term = term.next;
continue;
case Term.PLOOKBEHIND_IN:
{
int tmp = i - term.distance;
if (tmp < offset)
break;
LAEntry le = lookaheads[term.lookaheadId];
le.index = i;
i = tmp;
le.actual = actual;
le.top = top;
term = term.next;
continue;
}
case Term.INDEPENDENT_IN:
case Term.PLOOKAHEAD_IN:
{
LAEntry le = lookaheads[term.lookaheadId];
le.index = i;
le.actual = actual;
le.top = top;
term = term.next;
continue;
}
case Term.LOOKBEHIND_CONDITION_OUT:
case Term.LOOKAHEAD_CONDITION_OUT:
case Term.PLOOKAHEAD_OUT:
case Term.PLOOKBEHIND_OUT:
{
LAEntry le = lookaheads[term.lookaheadId];
i = le.index;
actual = le.actual;
top = le.top;
term = term.next;
continue;
}
case Term.INDEPENDENT_OUT:
{
LAEntry le = lookaheads[term.lookaheadId];
actual = le.actual;
top = le.top;
term = term.next;
continue;
}
case Term.NLOOKBEHIND_IN:
{
int tmp = i - term.distance;
if (tmp < offset) {
term = term.failNext;
continue;
}
LAEntry le = lookaheads[term.lookaheadId];
le.actual = actual;
le.top = top;
actual.term = term.failNext;
actual.index = i;
i = tmp;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
}
case Term.NLOOKAHEAD_IN:
{
LAEntry le = lookaheads[term.lookaheadId];
le.actual = actual;
le.top = top;
actual.term = term.failNext;
actual.index = i;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
}
case Term.NLOOKBEHIND_OUT:
case Term.NLOOKAHEAD_OUT:
{
LAEntry le = lookaheads[term.lookaheadId];
actual = le.actual;
top = le.top;
break;
}
case Term.LOOKBEHIND_CONDITION_IN:
{
int tmp = i - term.distance;
if (tmp < offset) {
term = term.failNext;
continue;
}
LAEntry le = lookaheads[term.lookaheadId];
le.index = i;
le.actual = actual;
le.top = top;
actual.term = term.failNext;
actual.index = i;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
i = tmp;
term = term.next;
continue;
}
case Term.LOOKAHEAD_CONDITION_IN:
{
LAEntry le = lookaheads[term.lookaheadId];
le.index = i;
le.actual = actual;
le.top = top;
actual.term = term.failNext;
actual.index = i;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
}
case Term.MEMREG_CONDITION:
{
MemReg mr = memregs[term.memreg];
int sampleOffset = mr.in;
int sampleOutside = mr.out;
if (sampleOffset >= 0 && sampleOutside >= 0 && sampleOutside >= sampleOffset) {
term = term.next;
} else {
term = term.failNext;
}
continue;
}
case Term.BRANCH_STORE_CNT_AUX1:
actual.regLen = regLen;
case Term.BRANCH_STORE_CNT:
actual.cnt = cnt;
case Term.BRANCH:
actual.term = term.failNext;
actual.index = i;
actual = (top = actual).on;
if (actual == null) {
actual = new SearchEntry();
top.on = actual;
actual.sub = top;
}
term = term.next;
continue;
case Term.SUCCESS:
if (!matchEnd || i == end) {
this.wOffset = memregs[0].in = wOffset;
this.wEnd = memregs[0].out = i;
this.top = top;
return true;
} else
break;
case Term.CNT_SET_0:
cnt = 0;
term = term.next;
continue;
case Term.CNT_INC:
cnt++;
term = term.next;
continue;
case Term.CNT_GT_EQ:
if (cnt >= term.maxCount) {
term = term.next;
continue;
} else
break;
case Term.READ_CNT_LT:
cnt = actual.cnt;
if (cnt < term.maxCount) {
term = term.next;
continue;
} else
break;
case Term.CRSTORE_CRINC:
{
int cntvalue = counters[cntreg = term.cntreg];
SearchEntry.saveCntState((top != null) ? top : defaultEntry, cntreg, cntvalue);
counters[cntreg] = ++cntvalue;
term = term.next;
continue;
}
case Term.CR_SET_0:
counters[term.cntreg] = 0;
term = term.next;
continue;
case Term.CR_LT:
if (counters[term.cntreg] < term.maxCount) {
term = term.next;
continue;
} else
break;
case Term.CR_GT_EQ:
if (counters[term.cntreg] >= term.maxCount) {
term = term.next;
continue;
} else
break;
default:
throw new Error("unknown term type: " + term.type);
}
} else {
this.wOffset = memregs[0].in = wOffset;
this.wEnd = memregs[0].out = i;
this.top = top;
return true;
}
if (allowIncomplete && i == end) {
this.wOffset = memregs[0].in = wOffset;
this.wEnd = memregs[0].out = i;
this.top = top;
return true;
}
if (top == null) {
break;
}
top = (actual = top).sub;
term = actual.term;
i = actual.index;
if (actual.isState) {
SearchEntry.popState(actual, memregs, counters);
}
}
if (defaultEntry.isState)
SearchEntry.popState(defaultEntry, memregs, counters);
term = root;
i = ++wOffset;
}
this.wOffset = wOffset;
this.top = top;
return false;
</DeepExtract>
| RegExodus | positive |
public synchronized void setServerHostKeyAlgorithms(String[] algos) {
if ((algos == null) || (algos.length == 0))
throw new IllegalArgumentException();
if ((algos == null) || (algos.length < 2))
algos = algos;
String[] list2 = new String[algos.length];
int count = 0;
for (int i = 0; i < algos.length; i++) {
boolean duplicate = false;
String element = algos[i];
for (int j = 0; j < count; j++) {
if (((element == null) && (list2[j] == null)) || ((element != null) && (element.equals(list2[j])))) {
duplicate = true;
break;
}
}
if (duplicate)
continue;
list2[count++] = algos[i];
}
if (count == list2.length)
algos = list2;
String[] tmp = new String[count];
System.arraycopy(list2, 0, tmp, 0, count);
return tmp;
KexManager.checkServerHostkeyAlgorithmsList(algos);
cryptoWishList.serverHostKeyAlgorithms = algos;
} | <DeepExtract>
if ((algos == null) || (algos.length < 2))
algos = algos;
String[] list2 = new String[algos.length];
int count = 0;
for (int i = 0; i < algos.length; i++) {
boolean duplicate = false;
String element = algos[i];
for (int j = 0; j < count; j++) {
if (((element == null) && (list2[j] == null)) || ((element != null) && (element.equals(list2[j])))) {
duplicate = true;
break;
}
}
if (duplicate)
continue;
list2[count++] = algos[i];
}
if (count == list2.length)
algos = list2;
String[] tmp = new String[count];
System.arraycopy(list2, 0, tmp, 0, count);
return tmp;
</DeepExtract>
| phantom-app | positive |
public static OrganizationService getOrganizationService() throws MambuApiException {
if (injector == null) {
LOGGER.severe("validateFactorySetUp - Failed");
throw new MambuApiException(INVALID_BASIC_AUTHORIZATION, "The factory wasn't set up properly!");
}
return injector.getInstance(OrganizationService.class);
} | <DeepExtract>
if (injector == null) {
LOGGER.severe("validateFactorySetUp - Failed");
throw new MambuApiException(INVALID_BASIC_AUTHORIZATION, "The factory wasn't set up properly!");
}
</DeepExtract>
| Mambu-APIs-Java | positive |
@Override
protected void initView() {
super.initView();
View view = View.inflate(getActivity(), R.layout.fragment_contact_head, null);
ButterKnife.bind(this, view);
listView.addHeaderView(view);
titleBar.setRightImageResource(R.mipmap.em_add);
titleBar.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(getActivity(), InviteActivity.class);
startActivity(intent);
}
});
boolean isShow = SpUtils.getInstace().getBoolean(SpUtils.NEW_INVITE, false);
contanctIvInvite.setVisibility(isShow ? View.VISIBLE : View.GONE);
manager = LocalBroadcastManager.getInstance(getActivity());
manager.registerReceiver(recevier, new IntentFilter(Constant.NEW_INVITE_CHANGE));
manager.registerReceiver(contactRecevier, new IntentFilter(Constant.CONTACT_CHANGE));
manager.registerReceiver(groupRecevier, new IntentFilter(Constant.GROUP_INVITE_CHAGE));
Modle.getInstance().getGlobalThread().execute(new Runnable() {
@Override
public void run() {
try {
List<String> contacts = EMClient.getInstance().contactManager().getAllContactsFromServer();
List<UserInfo> userinfos = new ArrayList<UserInfo>();
for (int i = 0; i < contacts.size(); i++) {
userinfos.add(new UserInfo(contacts.get(i)));
}
Modle.getInstance().getDbManager().getContactDao().saveContacts(userinfos, true);
if (getActivity() == null) {
return;
}
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
refreshContact();
}
});
} catch (HyphenateException e) {
e.printStackTrace();
}
}
});
setContactListItemClickListener(new EaseContactListItemClickListener() {
@Override
public void onListItemClicked(EaseUser user) {
Intent intent = new Intent(getActivity(), ChatActivity.class);
intent.putExtra(EaseConstant.EXTRA_USER_ID, user.getUsername());
startActivity(intent);
}
});
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
if (position == 0) {
return false;
}
showDialog(position);
return true;
}
});
} | <DeepExtract>
boolean isShow = SpUtils.getInstace().getBoolean(SpUtils.NEW_INVITE, false);
contanctIvInvite.setVisibility(isShow ? View.VISIBLE : View.GONE);
</DeepExtract>
<DeepExtract>
Modle.getInstance().getGlobalThread().execute(new Runnable() {
@Override
public void run() {
try {
List<String> contacts = EMClient.getInstance().contactManager().getAllContactsFromServer();
List<UserInfo> userinfos = new ArrayList<UserInfo>();
for (int i = 0; i < contacts.size(); i++) {
userinfos.add(new UserInfo(contacts.get(i)));
}
Modle.getInstance().getDbManager().getContactDao().saveContacts(userinfos, true);
if (getActivity() == null) {
return;
}
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
refreshContact();
}
});
} catch (HyphenateException e) {
e.printStackTrace();
}
}
});
</DeepExtract>
<DeepExtract>
setContactListItemClickListener(new EaseContactListItemClickListener() {
@Override
public void onListItemClicked(EaseUser user) {
Intent intent = new Intent(getActivity(), ChatActivity.class);
intent.putExtra(EaseConstant.EXTRA_USER_ID, user.getUsername());
startActivity(intent);
}
});
listView.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
if (position == 0) {
return false;
}
showDialog(position);
return true;
}
});
</DeepExtract>
| Im1020 | positive |
public Criteria andIdIsNull() {
if ("id is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("id is null"));
return (Criteria) this;
} | <DeepExtract>
if ("id is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("id is null"));
</DeepExtract>
| music | positive |
@Override
public void visitIFGE(IFGE obj) {
Expression right = new Resolved(context.getCurrentInstruction(), null, "0");
Expression left = context.getExpressions().pop();
MultiConditional conditional = new MultiConditional(context.getCurrentInstruction(), left, right, OperationType.GREATER_EQUAL);
BooleanBranchIntermediate line = new BooleanBranchIntermediate(this.context.getCurrentInstruction(), conditional);
BranchHandle branchHandle = (BranchHandle) context.getCurrentInstruction();
int next = branchHandle.getNext().getPosition();
int target = branchHandle.getTarget().getPosition();
if (target > next) {
line.getExpression().negate();
}
context.pushIntermediateToInstruction(line);
} | <DeepExtract>
MultiConditional conditional = new MultiConditional(context.getCurrentInstruction(), left, right, OperationType.GREATER_EQUAL);
BooleanBranchIntermediate line = new BooleanBranchIntermediate(this.context.getCurrentInstruction(), conditional);
BranchHandle branchHandle = (BranchHandle) context.getCurrentInstruction();
int next = branchHandle.getNext().getPosition();
int target = branchHandle.getTarget().getPosition();
if (target > next) {
line.getExpression().negate();
}
context.pushIntermediateToInstruction(line);
</DeepExtract>
| candle-decompiler | positive |
public static boolean isOppo() {
if (sName != null) {
return sName.equals(ROM_OPPO);
}
if (!TextUtils.isEmpty(getProp(KEY_VERSION_MIUI))) {
sName = ROM_MIUI;
} else if (!TextUtils.isEmpty(getProp(KEY_VERSION_EMUI))) {
sName = ROM_EMUI;
} else if (!TextUtils.isEmpty(getProp(KEY_VERSION_OPPO))) {
sName = ROM_OPPO;
} else if (!TextUtils.isEmpty(getProp(KEY_VERSION_VIVO))) {
sName = ROM_VIVO;
} else if (!TextUtils.isEmpty(getProp(KEY_VERSION_SMARTISAN))) {
sName = ROM_SMARTISAN;
} else {
if (Build.DISPLAY.toUpperCase().contains(ROM_FLYME)) {
sName = ROM_FLYME;
} else {
sName = Build.MANUFACTURER.toUpperCase();
}
}
return sName.equals(ROM_OPPO);
} | <DeepExtract>
if (sName != null) {
return sName.equals(ROM_OPPO);
}
if (!TextUtils.isEmpty(getProp(KEY_VERSION_MIUI))) {
sName = ROM_MIUI;
} else if (!TextUtils.isEmpty(getProp(KEY_VERSION_EMUI))) {
sName = ROM_EMUI;
} else if (!TextUtils.isEmpty(getProp(KEY_VERSION_OPPO))) {
sName = ROM_OPPO;
} else if (!TextUtils.isEmpty(getProp(KEY_VERSION_VIVO))) {
sName = ROM_VIVO;
} else if (!TextUtils.isEmpty(getProp(KEY_VERSION_SMARTISAN))) {
sName = ROM_SMARTISAN;
} else {
if (Build.DISPLAY.toUpperCase().contains(ROM_FLYME)) {
sName = ROM_FLYME;
} else {
sName = Build.MANUFACTURER.toUpperCase();
}
}
return sName.equals(ROM_OPPO);
</DeepExtract>
| Headline_News_Kotlin_App | positive |
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
if (_currentKeyBean == null) {
_currentKeyBean = new MetaKeyBean(0, 0, MetaKeyBean.allKeys.get(position));
} else {
_currentKeyBean.setKeyBase(MetaKeyBean.allKeys.get(position));
}
int flags = _currentKeyBean.getMetaFlags();
_checkAlt.setChecked(0 != (flags & VncCanvas.ALT_MASK));
_checkShift.setChecked(0 != (flags & VncCanvas.SHIFT_MASK));
_checkCtrl.setChecked(0 != (flags & VncCanvas.CTRL_MASK));
MetaKeyBase base = null;
if (_currentKeyBean.isMouseClick()) {
base = MetaKeyBean.keysByMouseButton.get(_currentKeyBean.getMouseButtons());
} else {
base = MetaKeyBean.keysByKeySym.get(_currentKeyBean.getKeySym());
}
if (base != null) {
int index = Collections.binarySearch(MetaKeyBean.allKeys, base);
if (index >= 0) {
_spinnerKeySelect.setSelection(index);
}
}
_textKeyDesc.setText(_currentKeyBean.getKeyDesc());
} | <DeepExtract>
int flags = _currentKeyBean.getMetaFlags();
_checkAlt.setChecked(0 != (flags & VncCanvas.ALT_MASK));
_checkShift.setChecked(0 != (flags & VncCanvas.SHIFT_MASK));
_checkCtrl.setChecked(0 != (flags & VncCanvas.CTRL_MASK));
MetaKeyBase base = null;
if (_currentKeyBean.isMouseClick()) {
base = MetaKeyBean.keysByMouseButton.get(_currentKeyBean.getMouseButtons());
} else {
base = MetaKeyBean.keysByKeySym.get(_currentKeyBean.getKeySym());
}
if (base != null) {
int index = Collections.binarySearch(MetaKeyBean.allKeys, base);
if (index >= 0) {
_spinnerKeySelect.setSelection(index);
}
}
_textKeyDesc.setText(_currentKeyBean.getKeyDesc());
</DeepExtract>
| android-vnc-viewer | positive |
public <T extends DataNode> T copy(T node) {
node.setNodeName(this.getNodeName());
node.setNodeType(this.getNodeType());
node.setOffset(this.getOffset());
node.setLength(this.getLength());
node.setLine(this.getLine());
node.setClosed(this.getClosed());
node.setParent(this.getParent());
if (this.getTextContent() != null) {
this.content = this.getTextContent();
}
return node;
} | <DeepExtract>
if (this.getTextContent() != null) {
this.content = this.getTextContent();
}
</DeepExtract>
| nh-micro | positive |
public static void addAudioTrack(Context context, String projectPath, String id, Uri uri, boolean loop) {
final Intent intent = mIntentPool.get(context, ApiService.class);
intent.putExtra(PARAM_OP, OP_AUDIO_TRACK_ADD);
intent.putExtra(PARAM_PROJECT_PATH, projectPath);
intent.putExtra(PARAM_STORYBOARD_ITEM_ID, id);
intent.putExtra(PARAM_FILENAME, uri);
intent.putExtra(PARAM_LOOP, loop);
final String requestId = StringUtils.randomString(8);
intent.putExtra(PARAM_REQUEST_ID, requestId);
mPendingIntents.put(requestId, intent);
context.startService(intent);
final String projectPath = intent.getStringExtra(PARAM_PROJECT_PATH);
if (projectPath != null) {
final boolean projectEdited = isProjectBeingEdited(projectPath);
if (projectEdited) {
for (ApiServiceListener listener : mListeners) {
listener.onProjectEditState(projectPath, projectEdited);
}
}
}
return requestId;
} | <DeepExtract>
final String requestId = StringUtils.randomString(8);
intent.putExtra(PARAM_REQUEST_ID, requestId);
mPendingIntents.put(requestId, intent);
context.startService(intent);
final String projectPath = intent.getStringExtra(PARAM_PROJECT_PATH);
if (projectPath != null) {
final boolean projectEdited = isProjectBeingEdited(projectPath);
if (projectEdited) {
for (ApiServiceListener listener : mListeners) {
listener.onProjectEditState(projectPath, projectEdited);
}
}
}
return requestId;
</DeepExtract>
| VideoEditor | positive |
@Test
public void between_arguments_tab_after_previous_onespace_before_next() throws Exception {
Content content = new Content("*Settings\nDocumentation previous\t<arg><cursor> next<argend>");
ParsedString argument = content.ps("arg-argend", 2, ArgumentType.SETTING_VAL);
int lineNo = 1;
List<RobotLine> lines = RobotFile.parse(content.c()).getLines();
doTest(content, lines, lineNo, argument);
} | <DeepExtract>
List<RobotLine> lines = RobotFile.parse(content.c()).getLines();
doTest(content, lines, lineNo, argument);
</DeepExtract>
| RobotFramework-EclipseIDE | positive |
public String post(Object url, String postData) throws IOException {
StringEntity entity = new StringEntity(postData);
if (!Utils.isOnline(mContext)) {
return null;
}
Log.d("***************************** Sending HTTP request *****************************" + url.toString());
HttpURLConnection connection = null;
try {
connection = (HttpURLConnection) new URL(url.toString()).openConnection();
connection.setConnectTimeout(90 * 1000);
connection.setReadTimeout(90 * 1000);
connection.setRequestProperty("User-Agent", String.format("ExpenseTracker" + mContext.getString(R.string.version) + " Android(%s/%s)", Build.VERSION.RELEASE, Build.VERSION.INCREMENTAL));
connection.setRequestMethod("POST");
StringBuilder requestBuilder = new StringBuilder(connection.getURL().toString() + "\n");
for (Entry<String, List<String>> header : connection.getRequestProperties().entrySet()) {
requestBuilder.append(header.getKey() + " = " + header.getValue());
}
Log.d(requestBuilder);
if (entity != null) {
String postParams = Strings.InputStreamToString(entity.getContent());
Log.d("POST" + " Data: " + postParams);
connection.setDoOutput(true);
OutputStream outputStream = connection.getOutputStream();
outputStream.write(postParams.getBytes("UTF-8"));
outputStream.flush();
outputStream.close();
}
Log.d("getting response with status " + connection.getResponseCode());
responseCode = connection.getResponseCode();
if (connection.getURL().toString().equals(url.toString()) && responseCode == 200) {
String response = Strings.InputStreamToString(connection.getInputStream());
Log.d("response " + response);
return response;
}
if (connection.getURL().toString().equals(url.toString()) && responseCode == 422) {
String response = Strings.InputStreamToString(connection.getErrorStream());
Log.d("response error " + response);
return response;
}
} catch (MalformedURLException e) {
e.printStackTrace();
} finally {
connection.disconnect();
}
return null;
} | <DeepExtract>
if (!Utils.isOnline(mContext)) {
return null;
}
Log.d("***************************** Sending HTTP request *****************************" + url.toString());
HttpURLConnection connection = null;
try {
connection = (HttpURLConnection) new URL(url.toString()).openConnection();
connection.setConnectTimeout(90 * 1000);
connection.setReadTimeout(90 * 1000);
connection.setRequestProperty("User-Agent", String.format("ExpenseTracker" + mContext.getString(R.string.version) + " Android(%s/%s)", Build.VERSION.RELEASE, Build.VERSION.INCREMENTAL));
connection.setRequestMethod("POST");
StringBuilder requestBuilder = new StringBuilder(connection.getURL().toString() + "\n");
for (Entry<String, List<String>> header : connection.getRequestProperties().entrySet()) {
requestBuilder.append(header.getKey() + " = " + header.getValue());
}
Log.d(requestBuilder);
if (entity != null) {
String postParams = Strings.InputStreamToString(entity.getContent());
Log.d("POST" + " Data: " + postParams);
connection.setDoOutput(true);
OutputStream outputStream = connection.getOutputStream();
outputStream.write(postParams.getBytes("UTF-8"));
outputStream.flush();
outputStream.close();
}
Log.d("getting response with status " + connection.getResponseCode());
responseCode = connection.getResponseCode();
if (connection.getURL().toString().equals(url.toString()) && responseCode == 200) {
String response = Strings.InputStreamToString(connection.getInputStream());
Log.d("response " + response);
return response;
}
if (connection.getURL().toString().equals(url.toString()) && responseCode == 422) {
String response = Strings.InputStreamToString(connection.getErrorStream());
Log.d("response error " + response);
return response;
}
} catch (MalformedURLException e) {
e.printStackTrace();
} finally {
connection.disconnect();
}
return null;
</DeepExtract>
| expense-tracker | positive |
public static boolean isTrue(Expression<?> expr) {
return isConstant(expr, Boolean.valueOf(true));
} | <DeepExtract>
return isConstant(expr, Boolean.valueOf(true));
</DeepExtract>
| jconstraints | positive |
public Object getKey() {
return _lemma;
} | <DeepExtract>
return _lemma;
</DeepExtract>
| WordSimilarity | positive |
private Regexp[] factor(Regexp[] array, int flags) {
if (array.length < 2) {
return array;
}
int s = 0;
int lensub = array.length;
int lenout = 0;
int[] str = null;
int strlen = 0;
int strflags = 0;
int start = 0;
for (int i = 0; i <= lensub; i++) {
int[] istr = null;
int istrlen = 0;
int iflags = 0;
if (i < lensub) {
Regexp re = array[s + i];
if (re.op == Regexp.Op.CONCAT && re.subs.length > 0) {
re = re.subs[0];
}
if (re.op == Regexp.Op.LITERAL) {
istr = re.runes;
istrlen = re.runes.length;
iflags = re.flags & RE2.FOLD_CASE;
}
if (iflags == strflags) {
int same = 0;
while (same < strlen && same < istrlen && str[same] == istr[same]) {
same++;
}
if (same > 0) {
strlen = same;
continue;
}
}
}
if (i == start) {
} else if (i == start + 1) {
array[lenout++] = array[s + start];
} else {
Regexp prefix = newRegexp(Regexp.Op.LITERAL);
prefix.flags = strflags;
prefix.runes = Utils.subarray(str, 0, strlen);
for (int j = start; j < i; j++) {
array[s + j] = removeLeadingString(array[s + j], strlen);
}
Regexp suffix = collapse(subarray(array, s + start, s + i), Regexp.Op.ALTERNATE);
Regexp re = newRegexp(Regexp.Op.CONCAT);
re.subs = new Regexp[] { prefix, suffix };
array[lenout++] = re;
}
start = i;
str = istr;
strlen = istrlen;
strflags = iflags;
}
lensub = lenout;
s = 0;
start = 0;
lenout = 0;
Regexp first = null;
for (int i = 0; i <= lensub; i++) {
Regexp ifirst = null;
if (i < lensub) {
ifirst = leadingRegexp(array[s + i]);
if (first != null && first.equals(ifirst) && (isCharClass(first) || (first.op == Regexp.Op.REPEAT && first.min == first.max && isCharClass(first.subs[0])))) {
continue;
}
}
if (i == start) {
} else if (i == start + 1) {
array[lenout++] = array[s + start];
} else {
Regexp prefix = first;
for (int j = start; j < i; j++) {
boolean reuse = j != start;
array[s + j] = removeLeadingRegexp(array[s + j], reuse);
}
Regexp suffix = collapse(subarray(array, s + start, s + i), Regexp.Op.ALTERNATE);
Regexp re = newRegexp(Regexp.Op.CONCAT);
re.subs = new Regexp[] { prefix, suffix };
array[lenout++] = re;
}
start = i;
first = ifirst;
}
lensub = lenout;
s = 0;
start = 0;
lenout = 0;
for (int i = 0; i <= lensub; i++) {
if (i < lensub && isCharClass(array[s + i])) {
continue;
}
if (i == start) {
} else if (i == start + 1) {
array[lenout++] = array[s + start];
} else {
int max = start;
for (int j = start + 1; j < i; j++) {
Regexp subMax = array[s + max], subJ = array[s + j];
if (subMax.op.ordinal() < subJ.op.ordinal() || (subMax.op == subJ.op && (subMax.runes != null ? subMax.runes.length : 0) < (subJ.runes != null ? subJ.runes.length : 0))) {
max = j;
}
}
Regexp tmp = array[s + start];
array[s + start] = array[s + max];
array[s + max] = tmp;
for (int j = start + 1; j < i; j++) {
mergeCharClass(array[s + start], array[s + j]);
reuse(array[s + j]);
}
cleanAlt(array[s + start]);
array[lenout++] = array[s + start];
}
if (i < lensub) {
array[lenout++] = array[s + i];
}
start = i + 1;
}
lensub = lenout;
s = 0;
start = 0;
lenout = 0;
for (int i = 0; i < lensub; ++i) {
if (i + 1 < lensub && array[s + i].op == Regexp.Op.EMPTY_MATCH && array[s + i + 1].op == Regexp.Op.EMPTY_MATCH) {
continue;
}
array[lenout++] = array[s + i];
}
lensub = lenout;
s = 0;
Regexp[] r = new Regexp[lensub - s];
for (int i = s; i < lensub; ++i) {
r[i - s] = array[i];
}
return r;
} | <DeepExtract>
Regexp[] r = new Regexp[lensub - s];
for (int i = s; i < lensub; ++i) {
r[i - s] = array[i];
}
return r;
</DeepExtract>
| re2j | positive |
@Override
public Void execute() throws IOException, ApiError {
BufferedSource source = createSource(data);
sink.readAll(source);
if (listener != null) {
listener.onProgress(0, 0);
}
return null;
} | <DeepExtract>
BufferedSource source = createSource(data);
sink.readAll(source);
if (listener != null) {
listener.onProgress(0, 0);
}
</DeepExtract>
| pcloud-sdk-java | positive |
@Test
public void findAmpleCity1() throws Exception {
expected = 3;
gallons = Arrays.asList(50, 20, 5, 30, 25, 10, 10);
distances = Arrays.asList(900, 600, 200, 400, 600, 200, 100);
assertEquals(expected, GasUpProblem.findAmpleCity(gallons, distances));
} | <DeepExtract>
assertEquals(expected, GasUpProblem.findAmpleCity(gallons, distances));
</DeepExtract>
| Elements-of-programming-interviews | positive |
public void createPavement() {
ArrayList<Lane> oLanes = new ArrayList();
oLanes.clear();
oLanes.add(m_oCenter);
oLanes.addAll(m_oLeft);
oLanes.addAll(m_oRight);
Collections.sort(oLanes, LEFTLANES);
int nDriving = XodrUtil.getLaneType("driving");
double[] dEdgeR = null;
for (int nIndex = 0; nIndex < oLanes.size(); nIndex++) {
Lane oLane = oLanes.get(nIndex);
if (oLane.m_nLaneType == nDriving) {
dEdgeR = oLane.m_nLaneIndex < 0 ? oLane.m_dOuter : oLane.m_dInner;
break;
}
}
double[] dEdgeL = null;
for (int nIndex = oLanes.size() - 1; nIndex >= 0; nIndex--) {
Lane oLane = oLanes.get(nIndex);
if (oLane.m_nLaneType == nDriving) {
dEdgeL = oLane.m_nLaneIndex < 0 ? oLane.m_dInner : oLane.m_dOuter;
break;
}
}
if (dEdgeL == null || dEdgeR == null)
return;
double[] dPavementCenter = Arrays.newDoubleArray(Arrays.size(dEdgeL));
dPavementCenter = Arrays.add(dPavementCenter, new double[] { Double.MAX_VALUE, Double.MAX_VALUE, -Double.MAX_VALUE, -Double.MAX_VALUE });
int nLimit = Arrays.size(dEdgeR);
m_dEdgeEnds = new double[] { dEdgeR[nLimit - 2], dEdgeR[nLimit - 1], dEdgeL[nLimit - 2], dEdgeL[nLimit - 1] };
if (m_oPrevSect != null && m_oPrevSect.m_dEdgeEnds != null) {
double dXr = m_oPrevSect.m_dEdgeEnds[0];
double dYr = m_oPrevSect.m_dEdgeEnds[1];
double dXl = m_oPrevSect.m_dEdgeEnds[2];
double dYl = m_oPrevSect.m_dEdgeEnds[3];
double dPathX = (dXr + dXl) / 2;
double dPathY = (dYr + dYl) / 2;
double dW = Geo.distance(dXr, dYr, dXl, dYl);
dPavementCenter = Arrays.addAndUpdate(dPavementCenter, dPathX, dPathY);
dPavementCenter = Arrays.add(dPavementCenter, dW);
}
for (int nIndex = 5; nIndex < nLimit; nIndex += 2) {
double dXr = dEdgeR[nIndex];
double dYr = dEdgeR[nIndex + 1];
double dXl = dEdgeL[nIndex];
double dYl = dEdgeL[nIndex + 1];
double dPathX = (dXr + dXl) / 2;
double dPathY = (dYr + dYl) / 2;
double dW = Geo.distance(dXr, dYr, dXl, dYl);
dPavementCenter = Arrays.addAndUpdate(dPavementCenter, dPathX, dPathY);
dPavementCenter = Arrays.add(dPavementCenter, dW);
}
m_dPavement = dPavementCenter;
} | <DeepExtract>
oLanes.clear();
oLanes.add(m_oCenter);
oLanes.addAll(m_oLeft);
oLanes.addAll(m_oRight);
</DeepExtract>
| carma-cloud | positive |
public void closeAndFillAndStroke() throws IOException {
if (inTextMode) {
throw new IllegalStateException("Error: closeAndFillAndStroke is not allowed within a text block.");
}
System.out.println("b");
output.write("b".getBytes(Charsets.US_ASCII));
output.write('\n');
} | <DeepExtract>
System.out.println("b");
output.write("b".getBytes(Charsets.US_ASCII));
output.write('\n');
</DeepExtract>
| pint-publisher | positive |
@Override
protected void buildJavascriptTree(BlockBuilder scriptBlockBuilder) {
application.traverseDown(mountedContainer -> {
LicketMountPoint mountPoint = mountedContainer.getClass().getAnnotation(LicketMountPoint.class);
if (mountPoint == null) {
return false;
}
registerComponentMountPoint(mountedContainer, mountPoint.value());
return false;
});
PropertyNameBuilder appRouter = property("app", "router");
scriptBlockBuilder.appendStatement(expressionStatement(assignment().left(appRouter).right(newExpression().target(name("VueRouter")).argument(vueRoutesDefinitions()))));
scriptBlockBuilder.appendStatement(expressionStatement(assignment().left(property(name("app"), name("instance"))).right(newExpression().target(name("Vue")).argument(objectLiteral().objectProperty(propertyBuilder().name("router").value(appRouter))))));
scriptBlockBuilder.appendStatement(expressionStatement(functionCall().target(property(property("app", "instance"), "$mount")).argument(applicationRootId())));
} | <DeepExtract>
application.traverseDown(mountedContainer -> {
LicketMountPoint mountPoint = mountedContainer.getClass().getAnnotation(LicketMountPoint.class);
if (mountPoint == null) {
return false;
}
registerComponentMountPoint(mountedContainer, mountPoint.value());
return false;
});
</DeepExtract>
| licket | positive |
public void run() {
if (list == null && currPath == null) {
throw new BuildException("You must have a list or path to iterate through");
}
if (param == null) {
throw new BuildException("You must supply a property name to set on each iteration in param");
}
if (target == null) {
throw new BuildException("You must supply a target to perform");
}
List<Object> values = new ArrayList<Object>();
if (list != null) {
StringTokenizer st = new StringTokenizer(list, delimiter);
while (st.hasMoreTokens()) {
String tok = st.nextToken();
if (trim) {
tok = StringTools.trim(tok);
}
values.add(tok);
}
}
if (currPath != null) {
for (String pathElement : currPath.list()) {
if (mapper != null) {
FileNameMapper m = mapper.getImplementation();
String[] mapped = m.mapFileName(pathElement);
Collections.addAll(values, mapped);
} else {
values.add(new File(pathElement));
}
}
}
List<CallTarget> tasks = new ArrayList<CallTarget>();
for (Object val : values) {
CallTarget ct = createCallTarget();
Property p = ct.createParam();
p.setName(param);
if (val instanceof File) {
p.setLocation((File) val);
} else {
p.setValue((String) val);
}
tasks.add(ct);
}
if (parallel && maxThreads > 1) {
executeParallel(tasks);
} else {
executeSequential(tasks);
}
} | <DeepExtract>
if (list == null && currPath == null) {
throw new BuildException("You must have a list or path to iterate through");
}
if (param == null) {
throw new BuildException("You must supply a property name to set on each iteration in param");
}
if (target == null) {
throw new BuildException("You must supply a target to perform");
}
List<Object> values = new ArrayList<Object>();
if (list != null) {
StringTokenizer st = new StringTokenizer(list, delimiter);
while (st.hasMoreTokens()) {
String tok = st.nextToken();
if (trim) {
tok = StringTools.trim(tok);
}
values.add(tok);
}
}
if (currPath != null) {
for (String pathElement : currPath.list()) {
if (mapper != null) {
FileNameMapper m = mapper.getImplementation();
String[] mapped = m.mapFileName(pathElement);
Collections.addAll(values, mapped);
} else {
values.add(new File(pathElement));
}
}
}
List<CallTarget> tasks = new ArrayList<CallTarget>();
for (Object val : values) {
CallTarget ct = createCallTarget();
Property p = ct.createParam();
p.setName(param);
if (val instanceof File) {
p.setLocation((File) val);
} else {
p.setValue((String) val);
}
tasks.add(ct);
}
if (parallel && maxThreads > 1) {
executeParallel(tasks);
} else {
executeSequential(tasks);
}
</DeepExtract>
| ant-contrib | positive |
public Date getDate(int columnIndex) {
try {
return (V) throwIfNull(Date.class, quirks.converterOf(Date.class)).convert(getObject(columnIndex));
} catch (ConverterException ex) {
throw new Sql2oException("Error converting value", ex);
}
} | <DeepExtract>
try {
return (V) throwIfNull(Date.class, quirks.converterOf(Date.class)).convert(getObject(columnIndex));
} catch (ConverterException ex) {
throw new Sql2oException("Error converting value", ex);
}
</DeepExtract>
| kaixin | positive |
private void stopTicking() {
handler.removeMessages(TICK_TIMER_MSG);
long time = getTime();
listener.onTick(time);
return time;
} | <DeepExtract>
long time = getTime();
listener.onTick(time);
return time;
</DeepExtract>
| andoku | positive |
public GUIEditor addElement(GElement child, GElement parent) {
if (child instanceof GScreen) {
this.currentS = (GScreen) child;
this.currentL = null;
this.currentlayers.clear();
for (GElement lay : currentS.getElements()) {
this.currentlayers.add((GLayer) lay);
}
this.getGui().addScreen(currentS);
this.getGui().goTo(currentS);
} else if (child instanceof GLayer) {
if (parent instanceof GScreen) {
this.getGui().addElement(child, parent);
} else
throw new IllegalDropException("Can't add a layer to a simple element");
GLayer temp = (GLayer) child;
this.currentL = temp;
this.currentlayers.add(temp);
} else {
if (findElement(parent.getID()) == null) {
throw new IllegalDropException("Parent is not in the GUI");
}
this.getGui().addElement(child, parent);
}
this.setChanged();
this.notifyObservers(new AddElementEvent(child));
parent.getNiftyElement().layoutElements();
if (this.selected != null && this.selected.equals(child)) {
return;
}
if (child instanceof GScreen) {
this.currentS = (GScreen) child;
this.currentlayers.clear();
for (GElement lay : currentS.getElements()) {
this.currentlayers.add((GLayer) lay);
}
this.currentL = this.currentlayers.peekLast();
this.getGui().goTo(currentS);
} else if (child instanceof GLayer) {
this.currentL = (GLayer) child;
if (!child.getParent().equals(this.currentS)) {
this.currentS = (GScreen) child.getParent();
this.gui.goTo(this.currentS);
}
} else {
GElement temp = child;
while (temp != null && !(temp instanceof GLayer)) {
temp = temp.getParent();
}
if (temp != null && !temp.equals(this.currentL)) {
this.currentL = (GLayer) temp;
}
temp = temp != null ? temp.getParent() : null;
if (temp != null && !temp.equals(this.currentS)) {
this.currentS = (GScreen) temp;
this.gui.goTo(this.currentS);
}
}
this.selected = child;
this.gui.getSelection().setSelection(selected);
return this;
} | <DeepExtract>
if (this.selected != null && this.selected.equals(child)) {
return;
}
if (child instanceof GScreen) {
this.currentS = (GScreen) child;
this.currentlayers.clear();
for (GElement lay : currentS.getElements()) {
this.currentlayers.add((GLayer) lay);
}
this.currentL = this.currentlayers.peekLast();
this.getGui().goTo(currentS);
} else if (child instanceof GLayer) {
this.currentL = (GLayer) child;
if (!child.getParent().equals(this.currentS)) {
this.currentS = (GScreen) child.getParent();
this.gui.goTo(this.currentS);
}
} else {
GElement temp = child;
while (temp != null && !(temp instanceof GLayer)) {
temp = temp.getParent();
}
if (temp != null && !temp.equals(this.currentL)) {
this.currentL = (GLayer) temp;
}
temp = temp != null ? temp.getParent() : null;
if (temp != null && !temp.equals(this.currentS)) {
this.currentS = (GScreen) temp;
this.gui.goTo(this.currentS);
}
}
this.selected = child;
this.gui.getSelection().setSelection(selected);
</DeepExtract>
| niftyeditor | positive |
public static void i(String flag, String msg, Throwable throwable) {
if (DEBUG) {
msg + '\n' + Log.getStackTraceString(throwable) = makeMessage(flag, msg + '\n' + Log.getStackTraceString(throwable));
while (msg + '\n' + Log.getStackTraceString(throwable).length() > LOG_MAX_LENGTH) {
log(msg + '\n' + Log.getStackTraceString(throwable).substring(0, LOG_MAX_LENGTH), LEVEL_I);
msg + '\n' + Log.getStackTraceString(throwable) = msg + '\n' + Log.getStackTraceString(throwable).substring(LOG_MAX_LENGTH);
}
log(msg + '\n' + Log.getStackTraceString(throwable), LEVEL_I);
}
} | <DeepExtract>
if (DEBUG) {
msg + '\n' + Log.getStackTraceString(throwable) = makeMessage(flag, msg + '\n' + Log.getStackTraceString(throwable));
while (msg + '\n' + Log.getStackTraceString(throwable).length() > LOG_MAX_LENGTH) {
log(msg + '\n' + Log.getStackTraceString(throwable).substring(0, LOG_MAX_LENGTH), LEVEL_I);
msg + '\n' + Log.getStackTraceString(throwable) = msg + '\n' + Log.getStackTraceString(throwable).substring(LOG_MAX_LENGTH);
}
log(msg + '\n' + Log.getStackTraceString(throwable), LEVEL_I);
}
</DeepExtract>
| SLWidget | positive |
public String uploadFile(String content, String fileExtension) {
byte[] buff = content.getBytes(Charset.forName("UTF-8"));
ByteArrayInputStream stream = new ByteArrayInputStream(buff);
StorePath storePath = storageClient.uploadFile(stream, buff.length, fileExtension, null);
FDFS_UPLOAD.info("{}", storePath.getFullPath());
String fileRoot = "";
if (isHasFastDfsNginx()) {
fileRoot = getFastDfsNginx();
}
String filePath = String.format("%s/%s", fileRoot, storePath.getFullPath());
return filePath;
} | <DeepExtract>
String fileRoot = "";
if (isHasFastDfsNginx()) {
fileRoot = getFastDfsNginx();
}
String filePath = String.format("%s/%s", fileRoot, storePath.getFullPath());
return filePath;
</DeepExtract>
| springcloud-thoth | positive |
private void changeKeyboardMode() {
mKeyboardSwitcher.toggleSymbols();
if (mCapsLock && mKeyboardSwitcher.isAlphabetMode()) {
mKeyboardSwitcher.setShiftLocked(mCapsLock);
}
InputConnection ic = getCurrentInputConnection();
if (ic != null && getCurrentInputEditorInfo() != null && mKeyboardSwitcher.isAlphabetMode()) {
mKeyboardSwitcher.setShifted(mShiftKeyState.isMomentary() || mCapsLock || getCursorCapsMode(ic, getCurrentInputEditorInfo()) != 0);
}
} | <DeepExtract>
InputConnection ic = getCurrentInputConnection();
if (ic != null && getCurrentInputEditorInfo() != null && mKeyboardSwitcher.isAlphabetMode()) {
mKeyboardSwitcher.setShifted(mShiftKeyState.isMomentary() || mCapsLock || getCursorCapsMode(ic, getCurrentInputEditorInfo()) != 0);
}
</DeepExtract>
| Gingerbread-Keyboard | positive |