or4cl3ai/Aiden_t5
Text Generation
•
Updated
•
1.62k
•
10
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 |