Dataset Viewer
Auto-converted to Parquet Duplicate
before
stringlengths
12
3.21M
after
stringlengths
41
3.21M
repo
stringlengths
1
56
type
stringclasses
1 value
__index_level_0__
int64
0
442k
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; }
public Criteria andPhoneBetween(String value1, String value2) { <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> return (Criteria) this; }
ssmxiaomi
positive
0
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); }
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; } <DeepExtract> return jjMoveNfa_12(jjStopStringLiteralDfa_12(4, active0), 4 + 1); </DeepExtract> }
dmgextractor
positive
1
public void addGaSolution(ScGaIndividual individual__) { final ScGaIndividual individual = individual__.clone(); try { new ScUiModifier(ScUiThread.this, this).enqueueTo(); } catch (ScUiQueueableInactive e) { e.printStackTrace(); } }
public void addGaSolution(ScGaIndividual individual__) { final ScGaIndividual individual = individual__.clone(); <DeepExtract> try { new ScUiModifier(ScUiThread.this, this).enqueueTo(); } catch (ScUiQueueableInactive e) { e.printStackTrace(); } </DeepExtract> }
skalch
positive
2
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; }
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); <DeepExtract> if (indent.length() == 0) { indent = indent; } return indent.substring(1); </DeepExtract> textDocumentBuilder.append("}"); result.text = textDocumentBuilder.toString(); return result; }
vscode-as3mxml
positive
3
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; } }
private int getTokenType(String s) { int len = s.length(); if (len == 0) { throw new RuntimeException("Syntax error"); } <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
4
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) { } } }
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) { } } <DeepExtract> if (sService != null) { try { if (sService.getQueue().length > 0) { sService.play(); } else { playRandom(mContext, null); } } catch (RemoteException ex) { } } </DeepExtract> }
misound
positive
5
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; }
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"); } <DeepExtract> this.query = query; this.queries = null; return this; </DeepExtract> }
solrwayback
positive
6
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; }
public String getScriptName(int pos) { <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> if (el != null) { return el.getAttributeValue(ATTR_NAME); } return null; }
Relaunch64
positive
7
@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); } }
@Override public void onClick(View v) { <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
8
@Override public void onShow(DialogInterface dialogInterface) { final Button okButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE); okButton.setEnabled(!TextUtils.isEmpty(editText.getText().toString().trim())); }
@Override public void onShow(DialogInterface dialogInterface) { <DeepExtract> final Button okButton = dialog.getButton(AlertDialog.BUTTON_POSITIVE); okButton.setEnabled(!TextUtils.isEmpty(editText.getText().toString().trim())); </DeepExtract> }
smartcard-reader
positive
9
@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); } } }
@Override public void setPixels(int x, int y, int w, int h, int[] iArray) { super.setPixels(x, y, w, h, iArray); <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
10
protected Query makeQueryObject(Session session) { Query query = makeQueryObject(query); populateQuery(query, query); return query; }
protected Query makeQueryObject(Session session) { <DeepExtract> Query query = makeQueryObject(query); populateQuery(query, query); return query; </DeepExtract> }
camel-extra
positive
11
@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()); }
@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()); <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
12
public void setAuthorName(String name) { _name = name; }
public void setAuthorName(String name) { <DeepExtract> _name = name; </DeepExtract> }
006921
positive
13
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); } }
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."); } <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> int glb = greatestLowerBound(classid1, classid2); if (glb == -1) { return NOTHING; } else { return Types.typeName(glb); } }
OOjDREW
positive
14
@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(); }
@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); <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
15
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; } }
private static int getDataPageLength(IPersistentMap options) { <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
16
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); } }
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); <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
17
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; }
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++; <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
18
public String getDescription() { Element el = this.getRoot().getChild("description".toString()); if (el != null) return el.getTextTrim(); else return null; }
public String getDescription() { <DeepExtract> Element el = this.getRoot().getChild("description".toString()); if (el != null) return el.getTextTrim(); else return null; </DeepExtract> }
geoserver-manager
positive
19
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); }
public void swap(int first, int 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> super.swap(first, second); }
NanoUI-win32
positive
20
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); } }
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); <DeepExtract> final int error; if ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) { Log.e(TAG, "glUseProgram" + ": glError " + error); } </DeepExtract> }
videoedit
positive
21
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(); }
public List<IssueFolderBean> getFolders(final TaskListener taskListener) { final TaskListener listener = taskListener != null ? taskListener : new StreamBuildListener(System.out, Charset.defaultCharset()); accessToProject = true; <DeepExtract> return resolve(getAppVersion(), listener); </DeepExtract> 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(); }
fortify-plugin
positive
22
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"); }
final public Axis OXPathAxisSpecifier() throws ParseException { <DeepExtract> jj_consume_token(STYLE); { if (true) a = OXPathAxis.STYLE; } throw new Error("Missing return statement in function"); </DeepExtract> { if (true) return a; } throw new Error("Missing return statement in function"); }
OXPath
positive
23
@Override public ListType previous() { final ListType previous = mIterator.previous(); mFreetalk = mFreetalk; mDB = mFreetalk.getDatabase(); return previous; }
@Override public ListType previous() { final ListType previous = mIterator.previous(); <DeepExtract> mFreetalk = mFreetalk; mDB = mFreetalk.getDatabase(); </DeepExtract> return previous; }
plugin-Freetalk
positive
24
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; }
public static long copy(final InputStream input, final OutputStream output, final int bufferSize) throws IOException { <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
25
@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); }
@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<>(); <DeepExtract> for (HelmChartFile file : fileList) { if (file.getChildren() != null) { dirs.add(file.getInnerPath()); deep(file.getChildren(), files, dirs); } else { files.add(file.getInnerPath()); } } </DeepExtract> 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); }
developer-be
positive
26
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); } }
private void loadImageView(Object object, int placeholderId, int errorId, Transformation transform, ImageView imageView) { <DeepExtract> DrawableRequestBuilder builder; loadImageView(object, PLACEHOLDER_IMAGE, ERROR_IMAGE, null, with()); </DeepExtract> if (builder != null) { if (placeholderId != -1) builder.placeholder(placeholderId); if (errorId != -1) builder.error(errorId); if (transform != null) builder.bitmapTransform(transform); builder.into(imageView); } }
AccountBook
positive
27
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); }
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(); <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
28
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(); } } }
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(); } <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
29
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) { } }
public void toGraphicFile(File file) throws IOException { Image image = createImage(getWidth(), getHeight()); <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> 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) { } }
jmathplot
positive
30
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(); }
public void deleteLabelsRelations() { SQLiteDatabase db = this.getWritableDatabase(); db.execSQL("DROP TABLE IF EXISTS " + TABLE_LABELSRELATIONS); db.execSQL(CREATE_TABLE_LABELSRELATIONS); <DeepExtract> if (null != null) null.close(); if (db != null) db.close(); </DeepExtract> }
Munin-for-Android
positive
31
public void run() { tvTime.setText(TitleViewUtil.getTime()); tvDate.setText(TitleViewUtil.getDate()); timeHandle.postDelayed(this, 1000); }
public void run() { tvTime.setText(TitleViewUtil.getTime()); <DeepExtract> tvDate.setText(TitleViewUtil.getDate()); </DeepExtract> timeHandle.postDelayed(this, 1000); }
android-tv-launcher
positive
32
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"); } }
public Encoder 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
33
public String GetArffFilePath() { return _outputDir + _fileNamePrefix + Extension.ARFF.toString(); }
public String GetArffFilePath() { <DeepExtract> return _outputDir + _fileNamePrefix + Extension.ARFF.toString(); </DeepExtract> }
ML-Flex
positive
34
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(); }
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(); <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> mBorderPaint = new Paint(); mColorPaint = new Paint(); }
OpenUntis
positive
35
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; }
public Criteria andGmtCreateIn(List<Date> values) { <DeepExtract> if (values == null) { throw new RuntimeException("Value for " + "gmtCreate" + " cannot be null"); } criteria.add(new Criterion("gmt_create in", values)); </DeepExtract> return (Criteria) this; }
AnyMock
positive
37
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); }
public GroupInfoResult fetchGroupInfo(String chatId) throws LarkClientException { if (false ^ instanceContext.getApp().getIsIsv()) { throw new UnsupportedOperationException("ISV app send message should use method sendChatMessageIsv"); } <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
38
@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]")); }
@Test public void eventDelegatorsAreGenerated() throws Exception { <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
39
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; } }
private void parseJoinTableFilter(TableFilter top, Select command) throws SQLException { <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> 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; } }
RedQueryBuilder
positive
40
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); } }
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<>(); <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> 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); } }
MASTER
positive
41
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); } }
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); } <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
42
@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()); }
@Override boolean segmentsMatch(final DecisionTreeRule latestSegment, final DecisionTreeRule createdSegment) { <DeepExtract> return latestSegment.getEnd().equals(createdSegment.getStart()) && latestSegment.getOutputs().equals(createdSegment.getOutputs()) && Arrays.equals(latestSegment.getDrivers(), createdSegment.getDrivers()); </DeepExtract> }
swblocks-decisiontree
positive
43
public void crop(Rect cropRect) { container.removeAllViews(); container.removeAllViews(); customPaintView.reset(); invalidate(); invalidate(); }
public void crop(Rect cropRect) { container.removeAllViews(); <DeepExtract> container.removeAllViews(); customPaintView.reset(); invalidate(); </DeepExtract> invalidate(); }
Whatsapp-Like-PhotoEditor
positive
44
@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); }
@Override public String get(final Pokemon p) { <DeepExtract> final int number = (int) Math.round((double) PokeColumn.MOVE_2_RATING.get(p) * Utilities.PERCENTAGE_FACTOR); return pad(number, 2); </DeepExtract> }
BlossomsPokemonGoManager
positive
46
@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); } } }
@Override public void setSubtypeEnablerTitle(CharSequence title) { mSubtypeEnablerTitleRes = 0; mSubtypeEnablerTitle = title; <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
47
protected void setDrawStack(ArrayList<GraphicObject> aDrawStack) { _drawStack.clear(); repaint(); for (int i = 0; i < aDrawStack.size(); ++i) { _drawStack.add(aDrawStack.get(i)); } repaint(); }
protected void setDrawStack(ArrayList<GraphicObject> aDrawStack) { <DeepExtract> _drawStack.clear(); repaint(); </DeepExtract> for (int i = 0; i < aDrawStack.size(); ++i) { _drawStack.add(aDrawStack.get(i)); } repaint(); }
darkFunction-Editor
positive
48
@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; }
@Override public <T> long countImpl(boolean consistentRead, SimpleDbEntityInformation<T, ?> entityInformation) { final String countQuery = new QueryBuilder(entityInformation, true).toString(); <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
49
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(); }
public static Script createMultiSigInputScript(List<TransactionSignature> signatures) { List<byte[]> sigs = new ArrayList<byte[]>(signatures.size()); for (TransactionSignature signature : signatures) { sigs.add(signature.encodeToUlord()); } <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
50
@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; }
@Override public Object visit(ASTIsNumeric node, Object data) throws VisitorException { <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> return data; }
sparqled
positive
51
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; }
public BundleBuilder addValueCreator(@NonNull ValueCreator creator) { if (creator == null) { return this; } <DeepExtract> if (creator.getValue() == null || creator.getKey() == null) { return this; } extras.put(creator.getKey(), creator.getValue()); return this; </DeepExtract> }
ndileber
positive
53
@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); }
@Override public void generate(MethodVisitor visitor, BuildContext 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> if (elseIfs != null) { for (ElseIf elseIf : elseIfs) { branch.setElseBranch(toBranch(elseIf.condition, elseIf.body, branch.getElseBranch())); } } branch.generate(visitor, context); }
lumen
positive
54
public void testValidateMusicAPI() { fullTrack.mMusicAPI = null; try { fullTrack.validate(); fail(); } catch (IllegalArgumentException e) { } }
public void testValidateMusicAPI() { fullTrack.mMusicAPI = null; <DeepExtract> try { fullTrack.validate(); fail(); } catch (IllegalArgumentException e) { } </DeepExtract> }
sls
positive
55
@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); }
@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)); <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> 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); }
Tanks
positive
56
public void restoreCameraPosition() { mCameraPosition.x = 0; mCameraPosition.y = 0; mCameraPosition.z = 0; mCameraPosition = mCameraPosition; synchronized (lockPlugins) { for (GLPlugin plugin : plugins) { plugin.onCameraPositionChanged(mCameraPosition); } } }
public void restoreCameraPosition() { mCameraPosition.x = 0; mCameraPosition.y = 0; mCameraPosition.z = 0; <DeepExtract> mCameraPosition = mCameraPosition; synchronized (lockPlugins) { for (GLPlugin plugin : plugins) { plugin.onCameraPositionChanged(mCameraPosition); } } </DeepExtract> }
beyondar
positive
57
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(); }
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(); } <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> invalidate(); }
MediaEditSDK
positive
58
@Field(value = "STRING:string", setterPolicy = NOT_NULL) public void setSN(String n, Long v) { setLongValue("N" + "-" + n, v); }
@Field(value = "STRING:string", setterPolicy = NOT_NULL) public void setSN(String n, Long v) { <DeepExtract> setLongValue("N" + "-" + n, v); </DeepExtract> }
logparser
positive
59
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); }
public void addMeasurePoint(Point _measurePoint) { if (measurePoint1 == null) { setMeasurePoint1(_measurePoint); return; } if (measurePoint2 != null) { setMeasurePoint1(null); setMeasurePoint2(null); return; } <DeepExtract> Object old = this.measurePoint2; if (_measurePoint != null) { this.measurePoint2 = (Point) _measurePoint.clone(); } else { this.measurePoint2 = null; } fireCheckedPropertyChange("measurePoint2", old, _measurePoint); </DeepExtract> }
swingexplorer
positive
60
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; }
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)); <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> return jpanel1; }
jmkvpropedit
positive
61
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; } }
private void showSkinIndicator(int index) { <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> 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; } }
AndroidSkinAnimator
positive
62
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); }
public boolean postDelayed(Runnable r, long delayMillis) { <DeepExtract> if (mWorkHandler == null) { HandlerThread handlerThread = new HandlerThread("WorkHandler"); handlerThread.start(); mWorkHandler = new Handler(handlerThread.getLooper()); } </DeepExtract> return mWorkHandler.postDelayed(r, delayMillis); }
FaceUnityLegacy
positive
63
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()) { } }
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); } } <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> 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()) { } }
BLIA
positive
64
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(); }
public String print_script(Diff.change script) { <DeepExtract> if (outfile == null) outfile = new PrintWriter(new OutputStreamWriter(System.out)); </DeepExtract> 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(); }
DirBuster
positive
65
@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); } }
@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)); <DeepExtract> try { eventQueue.put(endEvent); } catch (InterruptedException e) { throw new ForexException(e); } </DeepExtract> }
trading-system
positive
66
@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)); }
@Test void testSend() throws Exception { <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
67
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; } } } }
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); <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
68
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(); }
public void actionPerformed(ActionEvent e) { <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
69
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; }
private Stack<Operation> getRedoStack(RTEditText editor) { <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
70
@NonNull public <T> MyStringBuilder withCommaNonEmpty(CharSequence label, T obj) { return obj == null || !MyStringBuilder::nonEmptyObj.test(obj) ? this : withComma(label, obj); }
@NonNull public <T> MyStringBuilder withCommaNonEmpty(CharSequence label, T obj) { <DeepExtract> return obj == null || !MyStringBuilder::nonEmptyObj.test(obj) ? this : withComma(label, obj); </DeepExtract> }
calendar-widget
positive
71
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(); }
public UnaryDoubleEval getUnaryDoubleEval() throws Exception { <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> DynamicClassLoader loader = new DynamicClassLoader(); Class<?> expressionClass = loader.defineClass("expressions.compilation." + className, classWriter.toByteArray()); return (UnaryDoubleEval) expressionClass.newInstance(); }
skinnerdb
positive
72
public synchronized void setServerHostKeyAlgorithms(String[] algos) { if ((algos == null) || (algos.length == 0)) throw new IllegalArgumentException(); if ((algos == null) || (algos.length < 2)) algos = algos; String[] list2 = new String[algos.length]; int count = 0; for (int i = 0; i < algos.length; i++) { boolean duplicate = false; String element = algos[i]; for (int j = 0; j < count; j++) { if (((element == null) && (list2[j] == null)) || ((element != null) && (element.equals(list2[j])))) { duplicate = true; break; } } if (duplicate) continue; list2[count++] = algos[i]; } if (count == list2.length) algos = list2; String[] tmp = new String[count]; System.arraycopy(list2, 0, tmp, 0, count); return tmp; KexManager.checkServerHostkeyAlgorithmsList(algos); cryptoWishList.serverHostKeyAlgorithms = algos; }
public synchronized void setServerHostKeyAlgorithms(String[] algos) { if ((algos == null) || (algos.length == 0)) throw new IllegalArgumentException(); <DeepExtract> if ((algos == null) || (algos.length < 2)) algos = algos; String[] list2 = new String[algos.length]; int count = 0; for (int i = 0; i < algos.length; i++) { boolean duplicate = false; String element = algos[i]; for (int j = 0; j < count; j++) { if (((element == null) && (list2[j] == null)) || ((element != null) && (element.equals(list2[j])))) { duplicate = true; break; } } if (duplicate) continue; list2[count++] = algos[i]; } if (count == list2.length) algos = list2; String[] tmp = new String[count]; System.arraycopy(list2, 0, tmp, 0, count); return tmp; </DeepExtract> KexManager.checkServerHostkeyAlgorithmsList(algos); cryptoWishList.serverHostKeyAlgorithms = algos; }
phantom-app
positive
74
public static OrganizationService getOrganizationService() throws MambuApiException { if (injector == null) { LOGGER.severe("validateFactorySetUp - Failed"); throw new MambuApiException(INVALID_BASIC_AUTHORIZATION, "The factory wasn't set up properly!"); } return injector.getInstance(OrganizationService.class); }
public static OrganizationService getOrganizationService() throws MambuApiException { <DeepExtract> if (injector == null) { LOGGER.severe("validateFactorySetUp - Failed"); throw new MambuApiException(INVALID_BASIC_AUTHORIZATION, "The factory wasn't set up properly!"); } </DeepExtract> return injector.getInstance(OrganizationService.class); }
Mambu-APIs-Java
positive
75
public Criteria andIdIsNull() { if ("id is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("id is null")); return (Criteria) this; }
public Criteria andIdIsNull() { <DeepExtract> if ("id is null" == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion("id is null")); </DeepExtract> return (Criteria) this; }
music
positive
77
@Override public void visitIFGE(IFGE obj) { Expression right = new Resolved(context.getCurrentInstruction(), null, "0"); Expression left = context.getExpressions().pop(); MultiConditional conditional = new MultiConditional(context.getCurrentInstruction(), left, right, OperationType.GREATER_EQUAL); BooleanBranchIntermediate line = new BooleanBranchIntermediate(this.context.getCurrentInstruction(), conditional); BranchHandle branchHandle = (BranchHandle) context.getCurrentInstruction(); int next = branchHandle.getNext().getPosition(); int target = branchHandle.getTarget().getPosition(); if (target > next) { line.getExpression().negate(); } context.pushIntermediateToInstruction(line); }
@Override public void visitIFGE(IFGE obj) { Expression right = new Resolved(context.getCurrentInstruction(), null, "0"); Expression left = context.getExpressions().pop(); <DeepExtract> MultiConditional conditional = new MultiConditional(context.getCurrentInstruction(), left, right, OperationType.GREATER_EQUAL); BooleanBranchIntermediate line = new BooleanBranchIntermediate(this.context.getCurrentInstruction(), conditional); BranchHandle branchHandle = (BranchHandle) context.getCurrentInstruction(); int next = branchHandle.getNext().getPosition(); int target = branchHandle.getTarget().getPosition(); if (target > next) { line.getExpression().negate(); } context.pushIntermediateToInstruction(line); </DeepExtract> }
candle-decompiler
positive
78
public static boolean isOppo() { if (sName != null) { return sName.equals(ROM_OPPO); } if (!TextUtils.isEmpty(getProp(KEY_VERSION_MIUI))) { sName = ROM_MIUI; } else if (!TextUtils.isEmpty(getProp(KEY_VERSION_EMUI))) { sName = ROM_EMUI; } else if (!TextUtils.isEmpty(getProp(KEY_VERSION_OPPO))) { sName = ROM_OPPO; } else if (!TextUtils.isEmpty(getProp(KEY_VERSION_VIVO))) { sName = ROM_VIVO; } else if (!TextUtils.isEmpty(getProp(KEY_VERSION_SMARTISAN))) { sName = ROM_SMARTISAN; } else { if (Build.DISPLAY.toUpperCase().contains(ROM_FLYME)) { sName = ROM_FLYME; } else { sName = Build.MANUFACTURER.toUpperCase(); } } return sName.equals(ROM_OPPO); }
public static boolean isOppo() { <DeepExtract> if (sName != null) { return sName.equals(ROM_OPPO); } if (!TextUtils.isEmpty(getProp(KEY_VERSION_MIUI))) { sName = ROM_MIUI; } else if (!TextUtils.isEmpty(getProp(KEY_VERSION_EMUI))) { sName = ROM_EMUI; } else if (!TextUtils.isEmpty(getProp(KEY_VERSION_OPPO))) { sName = ROM_OPPO; } else if (!TextUtils.isEmpty(getProp(KEY_VERSION_VIVO))) { sName = ROM_VIVO; } else if (!TextUtils.isEmpty(getProp(KEY_VERSION_SMARTISAN))) { sName = ROM_SMARTISAN; } else { if (Build.DISPLAY.toUpperCase().contains(ROM_FLYME)) { sName = ROM_FLYME; } else { sName = Build.MANUFACTURER.toUpperCase(); } } return sName.equals(ROM_OPPO); </DeepExtract> }
Headline_News_Kotlin_App
positive
79
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (_currentKeyBean == null) { _currentKeyBean = new MetaKeyBean(0, 0, MetaKeyBean.allKeys.get(position)); } else { _currentKeyBean.setKeyBase(MetaKeyBean.allKeys.get(position)); } int flags = _currentKeyBean.getMetaFlags(); _checkAlt.setChecked(0 != (flags & VncCanvas.ALT_MASK)); _checkShift.setChecked(0 != (flags & VncCanvas.SHIFT_MASK)); _checkCtrl.setChecked(0 != (flags & VncCanvas.CTRL_MASK)); MetaKeyBase base = null; if (_currentKeyBean.isMouseClick()) { base = MetaKeyBean.keysByMouseButton.get(_currentKeyBean.getMouseButtons()); } else { base = MetaKeyBean.keysByKeySym.get(_currentKeyBean.getKeySym()); } if (base != null) { int index = Collections.binarySearch(MetaKeyBean.allKeys, base); if (index >= 0) { _spinnerKeySelect.setSelection(index); } } _textKeyDesc.setText(_currentKeyBean.getKeyDesc()); }
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { if (_currentKeyBean == null) { _currentKeyBean = new MetaKeyBean(0, 0, MetaKeyBean.allKeys.get(position)); } else { _currentKeyBean.setKeyBase(MetaKeyBean.allKeys.get(position)); } <DeepExtract> int flags = _currentKeyBean.getMetaFlags(); _checkAlt.setChecked(0 != (flags & VncCanvas.ALT_MASK)); _checkShift.setChecked(0 != (flags & VncCanvas.SHIFT_MASK)); _checkCtrl.setChecked(0 != (flags & VncCanvas.CTRL_MASK)); MetaKeyBase base = null; if (_currentKeyBean.isMouseClick()) { base = MetaKeyBean.keysByMouseButton.get(_currentKeyBean.getMouseButtons()); } else { base = MetaKeyBean.keysByKeySym.get(_currentKeyBean.getKeySym()); } if (base != null) { int index = Collections.binarySearch(MetaKeyBean.allKeys, base); if (index >= 0) { _spinnerKeySelect.setSelection(index); } } _textKeyDesc.setText(_currentKeyBean.getKeyDesc()); </DeepExtract> }
android-vnc-viewer
positive
80
public <T extends DataNode> T copy(T node) { node.setNodeName(this.getNodeName()); node.setNodeType(this.getNodeType()); node.setOffset(this.getOffset()); node.setLength(this.getLength()); node.setLine(this.getLine()); node.setClosed(this.getClosed()); node.setParent(this.getParent()); if (this.getTextContent() != null) { this.content = this.getTextContent(); } return node; }
public <T extends DataNode> T copy(T node) { node.setNodeName(this.getNodeName()); node.setNodeType(this.getNodeType()); node.setOffset(this.getOffset()); node.setLength(this.getLength()); node.setLine(this.getLine()); node.setClosed(this.getClosed()); node.setParent(this.getParent()); <DeepExtract> if (this.getTextContent() != null) { this.content = this.getTextContent(); } </DeepExtract> return node; }
nh-micro
positive
81
public static void addAudioTrack(Context context, String projectPath, String id, Uri uri, boolean loop) { final Intent intent = mIntentPool.get(context, ApiService.class); intent.putExtra(PARAM_OP, OP_AUDIO_TRACK_ADD); intent.putExtra(PARAM_PROJECT_PATH, projectPath); intent.putExtra(PARAM_STORYBOARD_ITEM_ID, id); intent.putExtra(PARAM_FILENAME, uri); intent.putExtra(PARAM_LOOP, loop); final String requestId = StringUtils.randomString(8); intent.putExtra(PARAM_REQUEST_ID, requestId); mPendingIntents.put(requestId, intent); context.startService(intent); final String projectPath = intent.getStringExtra(PARAM_PROJECT_PATH); if (projectPath != null) { final boolean projectEdited = isProjectBeingEdited(projectPath); if (projectEdited) { for (ApiServiceListener listener : mListeners) { listener.onProjectEditState(projectPath, projectEdited); } } } return requestId; }
public static void addAudioTrack(Context context, String projectPath, String id, Uri uri, boolean loop) { final Intent intent = mIntentPool.get(context, ApiService.class); intent.putExtra(PARAM_OP, OP_AUDIO_TRACK_ADD); intent.putExtra(PARAM_PROJECT_PATH, projectPath); intent.putExtra(PARAM_STORYBOARD_ITEM_ID, id); intent.putExtra(PARAM_FILENAME, uri); intent.putExtra(PARAM_LOOP, loop); <DeepExtract> final String requestId = StringUtils.randomString(8); intent.putExtra(PARAM_REQUEST_ID, requestId); mPendingIntents.put(requestId, intent); context.startService(intent); final String projectPath = intent.getStringExtra(PARAM_PROJECT_PATH); if (projectPath != null) { final boolean projectEdited = isProjectBeingEdited(projectPath); if (projectEdited) { for (ApiServiceListener listener : mListeners) { listener.onProjectEditState(projectPath, projectEdited); } } } return requestId; </DeepExtract> }
VideoEditor
positive
82
@Test public void between_arguments_tab_after_previous_onespace_before_next() throws Exception { Content content = new Content("*Settings\nDocumentation previous\t<arg><cursor> next<argend>"); ParsedString argument = content.ps("arg-argend", 2, ArgumentType.SETTING_VAL); int lineNo = 1; List<RobotLine> lines = RobotFile.parse(content.c()).getLines(); doTest(content, lines, lineNo, argument); }
@Test public void between_arguments_tab_after_previous_onespace_before_next() throws Exception { Content content = new Content("*Settings\nDocumentation previous\t<arg><cursor> next<argend>"); ParsedString argument = content.ps("arg-argend", 2, ArgumentType.SETTING_VAL); int lineNo = 1; <DeepExtract> List<RobotLine> lines = RobotFile.parse(content.c()).getLines(); doTest(content, lines, lineNo, argument); </DeepExtract> }
RobotFramework-EclipseIDE
positive
83
public static boolean isTrue(Expression<?> expr) { return isConstant(expr, Boolean.valueOf(true)); }
public static boolean isTrue(Expression<?> expr) { <DeepExtract> return isConstant(expr, Boolean.valueOf(true)); </DeepExtract> }
jconstraints
positive
85
public Object getKey() { return _lemma; }
public Object getKey() { <DeepExtract> return _lemma; </DeepExtract> }
WordSimilarity
positive
86
private Regexp[] factor(Regexp[] array, int flags) { if (array.length < 2) { return array; } int s = 0; int lensub = array.length; int lenout = 0; int[] str = null; int strlen = 0; int strflags = 0; int start = 0; for (int i = 0; i <= lensub; i++) { int[] istr = null; int istrlen = 0; int iflags = 0; if (i < lensub) { Regexp re = array[s + i]; if (re.op == Regexp.Op.CONCAT && re.subs.length > 0) { re = re.subs[0]; } if (re.op == Regexp.Op.LITERAL) { istr = re.runes; istrlen = re.runes.length; iflags = re.flags & RE2.FOLD_CASE; } if (iflags == strflags) { int same = 0; while (same < strlen && same < istrlen && str[same] == istr[same]) { same++; } if (same > 0) { strlen = same; continue; } } } if (i == start) { } else if (i == start + 1) { array[lenout++] = array[s + start]; } else { Regexp prefix = newRegexp(Regexp.Op.LITERAL); prefix.flags = strflags; prefix.runes = Utils.subarray(str, 0, strlen); for (int j = start; j < i; j++) { array[s + j] = removeLeadingString(array[s + j], strlen); } Regexp suffix = collapse(subarray(array, s + start, s + i), Regexp.Op.ALTERNATE); Regexp re = newRegexp(Regexp.Op.CONCAT); re.subs = new Regexp[] { prefix, suffix }; array[lenout++] = re; } start = i; str = istr; strlen = istrlen; strflags = iflags; } lensub = lenout; s = 0; start = 0; lenout = 0; Regexp first = null; for (int i = 0; i <= lensub; i++) { Regexp ifirst = null; if (i < lensub) { ifirst = leadingRegexp(array[s + i]); if (first != null && first.equals(ifirst) && (isCharClass(first) || (first.op == Regexp.Op.REPEAT && first.min == first.max && isCharClass(first.subs[0])))) { continue; } } if (i == start) { } else if (i == start + 1) { array[lenout++] = array[s + start]; } else { Regexp prefix = first; for (int j = start; j < i; j++) { boolean reuse = j != start; array[s + j] = removeLeadingRegexp(array[s + j], reuse); } Regexp suffix = collapse(subarray(array, s + start, s + i), Regexp.Op.ALTERNATE); Regexp re = newRegexp(Regexp.Op.CONCAT); re.subs = new Regexp[] { prefix, suffix }; array[lenout++] = re; } start = i; first = ifirst; } lensub = lenout; s = 0; start = 0; lenout = 0; for (int i = 0; i <= lensub; i++) { if (i < lensub && isCharClass(array[s + i])) { continue; } if (i == start) { } else if (i == start + 1) { array[lenout++] = array[s + start]; } else { int max = start; for (int j = start + 1; j < i; j++) { Regexp subMax = array[s + max], subJ = array[s + j]; if (subMax.op.ordinal() < subJ.op.ordinal() || (subMax.op == subJ.op && (subMax.runes != null ? subMax.runes.length : 0) < (subJ.runes != null ? subJ.runes.length : 0))) { max = j; } } Regexp tmp = array[s + start]; array[s + start] = array[s + max]; array[s + max] = tmp; for (int j = start + 1; j < i; j++) { mergeCharClass(array[s + start], array[s + j]); reuse(array[s + j]); } cleanAlt(array[s + start]); array[lenout++] = array[s + start]; } if (i < lensub) { array[lenout++] = array[s + i]; } start = i + 1; } lensub = lenout; s = 0; start = 0; lenout = 0; for (int i = 0; i < lensub; ++i) { if (i + 1 < lensub && array[s + i].op == Regexp.Op.EMPTY_MATCH && array[s + i + 1].op == Regexp.Op.EMPTY_MATCH) { continue; } array[lenout++] = array[s + i]; } lensub = lenout; s = 0; Regexp[] r = new Regexp[lensub - s]; for (int i = s; i < lensub; ++i) { r[i - s] = array[i]; } return r; }
private Regexp[] factor(Regexp[] array, int flags) { if (array.length < 2) { return array; } int s = 0; int lensub = array.length; int lenout = 0; int[] str = null; int strlen = 0; int strflags = 0; int start = 0; for (int i = 0; i <= lensub; i++) { int[] istr = null; int istrlen = 0; int iflags = 0; if (i < lensub) { Regexp re = array[s + i]; if (re.op == Regexp.Op.CONCAT && re.subs.length > 0) { re = re.subs[0]; } if (re.op == Regexp.Op.LITERAL) { istr = re.runes; istrlen = re.runes.length; iflags = re.flags & RE2.FOLD_CASE; } if (iflags == strflags) { int same = 0; while (same < strlen && same < istrlen && str[same] == istr[same]) { same++; } if (same > 0) { strlen = same; continue; } } } if (i == start) { } else if (i == start + 1) { array[lenout++] = array[s + start]; } else { Regexp prefix = newRegexp(Regexp.Op.LITERAL); prefix.flags = strflags; prefix.runes = Utils.subarray(str, 0, strlen); for (int j = start; j < i; j++) { array[s + j] = removeLeadingString(array[s + j], strlen); } Regexp suffix = collapse(subarray(array, s + start, s + i), Regexp.Op.ALTERNATE); Regexp re = newRegexp(Regexp.Op.CONCAT); re.subs = new Regexp[] { prefix, suffix }; array[lenout++] = re; } start = i; str = istr; strlen = istrlen; strflags = iflags; } lensub = lenout; s = 0; start = 0; lenout = 0; Regexp first = null; for (int i = 0; i <= lensub; i++) { Regexp ifirst = null; if (i < lensub) { ifirst = leadingRegexp(array[s + i]); if (first != null && first.equals(ifirst) && (isCharClass(first) || (first.op == Regexp.Op.REPEAT && first.min == first.max && isCharClass(first.subs[0])))) { continue; } } if (i == start) { } else if (i == start + 1) { array[lenout++] = array[s + start]; } else { Regexp prefix = first; for (int j = start; j < i; j++) { boolean reuse = j != start; array[s + j] = removeLeadingRegexp(array[s + j], reuse); } Regexp suffix = collapse(subarray(array, s + start, s + i), Regexp.Op.ALTERNATE); Regexp re = newRegexp(Regexp.Op.CONCAT); re.subs = new Regexp[] { prefix, suffix }; array[lenout++] = re; } start = i; first = ifirst; } lensub = lenout; s = 0; start = 0; lenout = 0; for (int i = 0; i <= lensub; i++) { if (i < lensub && isCharClass(array[s + i])) { continue; } if (i == start) { } else if (i == start + 1) { array[lenout++] = array[s + start]; } else { int max = start; for (int j = start + 1; j < i; j++) { Regexp subMax = array[s + max], subJ = array[s + j]; if (subMax.op.ordinal() < subJ.op.ordinal() || (subMax.op == subJ.op && (subMax.runes != null ? subMax.runes.length : 0) < (subJ.runes != null ? subJ.runes.length : 0))) { max = j; } } Regexp tmp = array[s + start]; array[s + start] = array[s + max]; array[s + max] = tmp; for (int j = start + 1; j < i; j++) { mergeCharClass(array[s + start], array[s + j]); reuse(array[s + j]); } cleanAlt(array[s + start]); array[lenout++] = array[s + start]; } if (i < lensub) { array[lenout++] = array[s + i]; } start = i + 1; } lensub = lenout; s = 0; start = 0; lenout = 0; for (int i = 0; i < lensub; ++i) { if (i + 1 < lensub && array[s + i].op == Regexp.Op.EMPTY_MATCH && array[s + i + 1].op == Regexp.Op.EMPTY_MATCH) { continue; } array[lenout++] = array[s + i]; } lensub = lenout; s = 0; <DeepExtract> Regexp[] r = new Regexp[lensub - s]; for (int i = s; i < lensub; ++i) { r[i - s] = array[i]; } return r; </DeepExtract> }
re2j
positive
87
@Override public Void execute() throws IOException, ApiError { BufferedSource source = createSource(data); sink.readAll(source); if (listener != null) { listener.onProgress(0, 0); } return null; }
@Override public Void execute() throws IOException, ApiError { <DeepExtract> BufferedSource source = createSource(data); sink.readAll(source); if (listener != null) { listener.onProgress(0, 0); } </DeepExtract> return null; }
pcloud-sdk-java
positive
88
@Test public void findAmpleCity1() throws Exception { expected = 3; gallons = Arrays.asList(50, 20, 5, 30, 25, 10, 10); distances = Arrays.asList(900, 600, 200, 400, 600, 200, 100); assertEquals(expected, GasUpProblem.findAmpleCity(gallons, distances)); }
@Test public void findAmpleCity1() throws Exception { expected = 3; gallons = Arrays.asList(50, 20, 5, 30, 25, 10, 10); distances = Arrays.asList(900, 600, 200, 400, 600, 200, 100); <DeepExtract> assertEquals(expected, GasUpProblem.findAmpleCity(gallons, distances)); </DeepExtract> }
Elements-of-programming-interviews
positive
89
public void createPavement() { ArrayList<Lane> oLanes = new ArrayList(); oLanes.clear(); oLanes.add(m_oCenter); oLanes.addAll(m_oLeft); oLanes.addAll(m_oRight); Collections.sort(oLanes, LEFTLANES); int nDriving = XodrUtil.getLaneType("driving"); double[] dEdgeR = null; for (int nIndex = 0; nIndex < oLanes.size(); nIndex++) { Lane oLane = oLanes.get(nIndex); if (oLane.m_nLaneType == nDriving) { dEdgeR = oLane.m_nLaneIndex < 0 ? oLane.m_dOuter : oLane.m_dInner; break; } } double[] dEdgeL = null; for (int nIndex = oLanes.size() - 1; nIndex >= 0; nIndex--) { Lane oLane = oLanes.get(nIndex); if (oLane.m_nLaneType == nDriving) { dEdgeL = oLane.m_nLaneIndex < 0 ? oLane.m_dInner : oLane.m_dOuter; break; } } if (dEdgeL == null || dEdgeR == null) return; double[] dPavementCenter = Arrays.newDoubleArray(Arrays.size(dEdgeL)); dPavementCenter = Arrays.add(dPavementCenter, new double[] { Double.MAX_VALUE, Double.MAX_VALUE, -Double.MAX_VALUE, -Double.MAX_VALUE }); int nLimit = Arrays.size(dEdgeR); m_dEdgeEnds = new double[] { dEdgeR[nLimit - 2], dEdgeR[nLimit - 1], dEdgeL[nLimit - 2], dEdgeL[nLimit - 1] }; if (m_oPrevSect != null && m_oPrevSect.m_dEdgeEnds != null) { double dXr = m_oPrevSect.m_dEdgeEnds[0]; double dYr = m_oPrevSect.m_dEdgeEnds[1]; double dXl = m_oPrevSect.m_dEdgeEnds[2]; double dYl = m_oPrevSect.m_dEdgeEnds[3]; double dPathX = (dXr + dXl) / 2; double dPathY = (dYr + dYl) / 2; double dW = Geo.distance(dXr, dYr, dXl, dYl); dPavementCenter = Arrays.addAndUpdate(dPavementCenter, dPathX, dPathY); dPavementCenter = Arrays.add(dPavementCenter, dW); } for (int nIndex = 5; nIndex < nLimit; nIndex += 2) { double dXr = dEdgeR[nIndex]; double dYr = dEdgeR[nIndex + 1]; double dXl = dEdgeL[nIndex]; double dYl = dEdgeL[nIndex + 1]; double dPathX = (dXr + dXl) / 2; double dPathY = (dYr + dYl) / 2; double dW = Geo.distance(dXr, dYr, dXl, dYl); dPavementCenter = Arrays.addAndUpdate(dPavementCenter, dPathX, dPathY); dPavementCenter = Arrays.add(dPavementCenter, dW); } m_dPavement = dPavementCenter; }
public void createPavement() { ArrayList<Lane> oLanes = new ArrayList(); <DeepExtract> oLanes.clear(); oLanes.add(m_oCenter); oLanes.addAll(m_oLeft); oLanes.addAll(m_oRight); </DeepExtract> Collections.sort(oLanes, LEFTLANES); int nDriving = XodrUtil.getLaneType("driving"); double[] dEdgeR = null; for (int nIndex = 0; nIndex < oLanes.size(); nIndex++) { Lane oLane = oLanes.get(nIndex); if (oLane.m_nLaneType == nDriving) { dEdgeR = oLane.m_nLaneIndex < 0 ? oLane.m_dOuter : oLane.m_dInner; break; } } double[] dEdgeL = null; for (int nIndex = oLanes.size() - 1; nIndex >= 0; nIndex--) { Lane oLane = oLanes.get(nIndex); if (oLane.m_nLaneType == nDriving) { dEdgeL = oLane.m_nLaneIndex < 0 ? oLane.m_dInner : oLane.m_dOuter; break; } } if (dEdgeL == null || dEdgeR == null) return; double[] dPavementCenter = Arrays.newDoubleArray(Arrays.size(dEdgeL)); dPavementCenter = Arrays.add(dPavementCenter, new double[] { Double.MAX_VALUE, Double.MAX_VALUE, -Double.MAX_VALUE, -Double.MAX_VALUE }); int nLimit = Arrays.size(dEdgeR); m_dEdgeEnds = new double[] { dEdgeR[nLimit - 2], dEdgeR[nLimit - 1], dEdgeL[nLimit - 2], dEdgeL[nLimit - 1] }; if (m_oPrevSect != null && m_oPrevSect.m_dEdgeEnds != null) { double dXr = m_oPrevSect.m_dEdgeEnds[0]; double dYr = m_oPrevSect.m_dEdgeEnds[1]; double dXl = m_oPrevSect.m_dEdgeEnds[2]; double dYl = m_oPrevSect.m_dEdgeEnds[3]; double dPathX = (dXr + dXl) / 2; double dPathY = (dYr + dYl) / 2; double dW = Geo.distance(dXr, dYr, dXl, dYl); dPavementCenter = Arrays.addAndUpdate(dPavementCenter, dPathX, dPathY); dPavementCenter = Arrays.add(dPavementCenter, dW); } for (int nIndex = 5; nIndex < nLimit; nIndex += 2) { double dXr = dEdgeR[nIndex]; double dYr = dEdgeR[nIndex + 1]; double dXl = dEdgeL[nIndex]; double dYl = dEdgeL[nIndex + 1]; double dPathX = (dXr + dXl) / 2; double dPathY = (dYr + dYl) / 2; double dW = Geo.distance(dXr, dYr, dXl, dYl); dPavementCenter = Arrays.addAndUpdate(dPavementCenter, dPathX, dPathY); dPavementCenter = Arrays.add(dPavementCenter, dW); } m_dPavement = dPavementCenter; }
carma-cloud
positive
90
@Override protected void buildJavascriptTree(BlockBuilder scriptBlockBuilder) { application.traverseDown(mountedContainer -> { LicketMountPoint mountPoint = mountedContainer.getClass().getAnnotation(LicketMountPoint.class); if (mountPoint == null) { return false; } registerComponentMountPoint(mountedContainer, mountPoint.value()); return false; }); PropertyNameBuilder appRouter = property("app", "router"); scriptBlockBuilder.appendStatement(expressionStatement(assignment().left(appRouter).right(newExpression().target(name("VueRouter")).argument(vueRoutesDefinitions())))); scriptBlockBuilder.appendStatement(expressionStatement(assignment().left(property(name("app"), name("instance"))).right(newExpression().target(name("Vue")).argument(objectLiteral().objectProperty(propertyBuilder().name("router").value(appRouter)))))); scriptBlockBuilder.appendStatement(expressionStatement(functionCall().target(property(property("app", "instance"), "$mount")).argument(applicationRootId()))); }
@Override protected void buildJavascriptTree(BlockBuilder scriptBlockBuilder) { <DeepExtract> application.traverseDown(mountedContainer -> { LicketMountPoint mountPoint = mountedContainer.getClass().getAnnotation(LicketMountPoint.class); if (mountPoint == null) { return false; } registerComponentMountPoint(mountedContainer, mountPoint.value()); return false; }); </DeepExtract> PropertyNameBuilder appRouter = property("app", "router"); scriptBlockBuilder.appendStatement(expressionStatement(assignment().left(appRouter).right(newExpression().target(name("VueRouter")).argument(vueRoutesDefinitions())))); scriptBlockBuilder.appendStatement(expressionStatement(assignment().left(property(name("app"), name("instance"))).right(newExpression().target(name("Vue")).argument(objectLiteral().objectProperty(propertyBuilder().name("router").value(appRouter)))))); scriptBlockBuilder.appendStatement(expressionStatement(functionCall().target(property(property("app", "instance"), "$mount")).argument(applicationRootId()))); }
licket
positive
92
public void run() { if (list == null && currPath == null) { throw new BuildException("You must have a list or path to iterate through"); } if (param == null) { throw new BuildException("You must supply a property name to set on each iteration in param"); } if (target == null) { throw new BuildException("You must supply a target to perform"); } List<Object> values = new ArrayList<Object>(); if (list != null) { StringTokenizer st = new StringTokenizer(list, delimiter); while (st.hasMoreTokens()) { String tok = st.nextToken(); if (trim) { tok = StringTools.trim(tok); } values.add(tok); } } if (currPath != null) { for (String pathElement : currPath.list()) { if (mapper != null) { FileNameMapper m = mapper.getImplementation(); String[] mapped = m.mapFileName(pathElement); Collections.addAll(values, mapped); } else { values.add(new File(pathElement)); } } } List<CallTarget> tasks = new ArrayList<CallTarget>(); for (Object val : values) { CallTarget ct = createCallTarget(); Property p = ct.createParam(); p.setName(param); if (val instanceof File) { p.setLocation((File) val); } else { p.setValue((String) val); } tasks.add(ct); } if (parallel && maxThreads > 1) { executeParallel(tasks); } else { executeSequential(tasks); } }
public void run() { <DeepExtract> if (list == null && currPath == null) { throw new BuildException("You must have a list or path to iterate through"); } if (param == null) { throw new BuildException("You must supply a property name to set on each iteration in param"); } if (target == null) { throw new BuildException("You must supply a target to perform"); } List<Object> values = new ArrayList<Object>(); if (list != null) { StringTokenizer st = new StringTokenizer(list, delimiter); while (st.hasMoreTokens()) { String tok = st.nextToken(); if (trim) { tok = StringTools.trim(tok); } values.add(tok); } } if (currPath != null) { for (String pathElement : currPath.list()) { if (mapper != null) { FileNameMapper m = mapper.getImplementation(); String[] mapped = m.mapFileName(pathElement); Collections.addAll(values, mapped); } else { values.add(new File(pathElement)); } } } List<CallTarget> tasks = new ArrayList<CallTarget>(); for (Object val : values) { CallTarget ct = createCallTarget(); Property p = ct.createParam(); p.setName(param); if (val instanceof File) { p.setLocation((File) val); } else { p.setValue((String) val); } tasks.add(ct); } if (parallel && maxThreads > 1) { executeParallel(tasks); } else { executeSequential(tasks); } </DeepExtract> }
ant-contrib
positive
93
public Date getDate(int columnIndex) { try { return (V) throwIfNull(Date.class, quirks.converterOf(Date.class)).convert(getObject(columnIndex)); } catch (ConverterException ex) { throw new Sql2oException("Error converting value", ex); } }
public Date getDate(int columnIndex) { <DeepExtract> try { return (V) throwIfNull(Date.class, quirks.converterOf(Date.class)).convert(getObject(columnIndex)); } catch (ConverterException ex) { throw new Sql2oException("Error converting value", ex); } </DeepExtract> }
kaixin
positive
94
private void stopTicking() { handler.removeMessages(TICK_TIMER_MSG); long time = getTime(); listener.onTick(time); return time; }
private void stopTicking() { handler.removeMessages(TICK_TIMER_MSG); <DeepExtract> long time = getTime(); listener.onTick(time); return time; </DeepExtract> }
andoku
positive
95
public GUIEditor addElement(GElement child, GElement parent) { if (child instanceof GScreen) { this.currentS = (GScreen) child; this.currentL = null; this.currentlayers.clear(); for (GElement lay : currentS.getElements()) { this.currentlayers.add((GLayer) lay); } this.getGui().addScreen(currentS); this.getGui().goTo(currentS); } else if (child instanceof GLayer) { if (parent instanceof GScreen) { this.getGui().addElement(child, parent); } else throw new IllegalDropException("Can't add a layer to a simple element"); GLayer temp = (GLayer) child; this.currentL = temp; this.currentlayers.add(temp); } else { if (findElement(parent.getID()) == null) { throw new IllegalDropException("Parent is not in the GUI"); } this.getGui().addElement(child, parent); } this.setChanged(); this.notifyObservers(new AddElementEvent(child)); parent.getNiftyElement().layoutElements(); if (this.selected != null && this.selected.equals(child)) { return; } if (child instanceof GScreen) { this.currentS = (GScreen) child; this.currentlayers.clear(); for (GElement lay : currentS.getElements()) { this.currentlayers.add((GLayer) lay); } this.currentL = this.currentlayers.peekLast(); this.getGui().goTo(currentS); } else if (child instanceof GLayer) { this.currentL = (GLayer) child; if (!child.getParent().equals(this.currentS)) { this.currentS = (GScreen) child.getParent(); this.gui.goTo(this.currentS); } } else { GElement temp = child; while (temp != null && !(temp instanceof GLayer)) { temp = temp.getParent(); } if (temp != null && !temp.equals(this.currentL)) { this.currentL = (GLayer) temp; } temp = temp != null ? temp.getParent() : null; if (temp != null && !temp.equals(this.currentS)) { this.currentS = (GScreen) temp; this.gui.goTo(this.currentS); } } this.selected = child; this.gui.getSelection().setSelection(selected); return this; }
public GUIEditor addElement(GElement child, GElement parent) { if (child instanceof GScreen) { this.currentS = (GScreen) child; this.currentL = null; this.currentlayers.clear(); for (GElement lay : currentS.getElements()) { this.currentlayers.add((GLayer) lay); } this.getGui().addScreen(currentS); this.getGui().goTo(currentS); } else if (child instanceof GLayer) { if (parent instanceof GScreen) { this.getGui().addElement(child, parent); } else throw new IllegalDropException("Can't add a layer to a simple element"); GLayer temp = (GLayer) child; this.currentL = temp; this.currentlayers.add(temp); } else { if (findElement(parent.getID()) == null) { throw new IllegalDropException("Parent is not in the GUI"); } this.getGui().addElement(child, parent); } this.setChanged(); this.notifyObservers(new AddElementEvent(child)); parent.getNiftyElement().layoutElements(); <DeepExtract> if (this.selected != null && this.selected.equals(child)) { return; } if (child instanceof GScreen) { this.currentS = (GScreen) child; this.currentlayers.clear(); for (GElement lay : currentS.getElements()) { this.currentlayers.add((GLayer) lay); } this.currentL = this.currentlayers.peekLast(); this.getGui().goTo(currentS); } else if (child instanceof GLayer) { this.currentL = (GLayer) child; if (!child.getParent().equals(this.currentS)) { this.currentS = (GScreen) child.getParent(); this.gui.goTo(this.currentS); } } else { GElement temp = child; while (temp != null && !(temp instanceof GLayer)) { temp = temp.getParent(); } if (temp != null && !temp.equals(this.currentL)) { this.currentL = (GLayer) temp; } temp = temp != null ? temp.getParent() : null; if (temp != null && !temp.equals(this.currentS)) { this.currentS = (GScreen) temp; this.gui.goTo(this.currentS); } } this.selected = child; this.gui.getSelection().setSelection(selected); </DeepExtract> return this; }
niftyeditor
positive
96
public String uploadFile(String content, String fileExtension) { byte[] buff = content.getBytes(Charset.forName("UTF-8")); ByteArrayInputStream stream = new ByteArrayInputStream(buff); StorePath storePath = storageClient.uploadFile(stream, buff.length, fileExtension, null); FDFS_UPLOAD.info("{}", storePath.getFullPath()); String fileRoot = ""; if (isHasFastDfsNginx()) { fileRoot = getFastDfsNginx(); } String filePath = String.format("%s/%s", fileRoot, storePath.getFullPath()); return filePath; }
public String uploadFile(String content, String fileExtension) { byte[] buff = content.getBytes(Charset.forName("UTF-8")); ByteArrayInputStream stream = new ByteArrayInputStream(buff); StorePath storePath = storageClient.uploadFile(stream, buff.length, fileExtension, null); FDFS_UPLOAD.info("{}", storePath.getFullPath()); <DeepExtract> String fileRoot = ""; if (isHasFastDfsNginx()) { fileRoot = getFastDfsNginx(); } String filePath = String.format("%s/%s", fileRoot, storePath.getFullPath()); return filePath; </DeepExtract> }
springcloud-thoth
positive
98
private void changeKeyboardMode() { mKeyboardSwitcher.toggleSymbols(); if (mCapsLock && mKeyboardSwitcher.isAlphabetMode()) { mKeyboardSwitcher.setShiftLocked(mCapsLock); } InputConnection ic = getCurrentInputConnection(); if (ic != null && getCurrentInputEditorInfo() != null && mKeyboardSwitcher.isAlphabetMode()) { mKeyboardSwitcher.setShifted(mShiftKeyState.isMomentary() || mCapsLock || getCursorCapsMode(ic, getCurrentInputEditorInfo()) != 0); } }
private void changeKeyboardMode() { mKeyboardSwitcher.toggleSymbols(); if (mCapsLock && mKeyboardSwitcher.isAlphabetMode()) { mKeyboardSwitcher.setShiftLocked(mCapsLock); } <DeepExtract> InputConnection ic = getCurrentInputConnection(); if (ic != null && getCurrentInputEditorInfo() != null && mKeyboardSwitcher.isAlphabetMode()) { mKeyboardSwitcher.setShifted(mShiftKeyState.isMomentary() || mCapsLock || getCursorCapsMode(ic, getCurrentInputEditorInfo()) != 0); } </DeepExtract> }
Gingerbread-Keyboard
positive
99
@FXML private void onAddSportType(final ActionEvent event) { final SportType newSportType = new SportType(null); newSportType.setSpeedMode(document.getOptions().getPreferredSpeedMode()); prSportTypeDialogController.get().show(getWindow(liSportTypes), newSportType); final ObservableList<SportType> olSportTypes = FXCollections.observableArrayList(); liSportTypes.getItems().clear(); document.getSportTypeList().forEach(sportType -> olSportTypes.add(sportType)); liSportTypes.setItems(olSportTypes); }
@FXML private void onAddSportType(final ActionEvent event) { final SportType newSportType = new SportType(null); newSportType.setSpeedMode(document.getOptions().getPreferredSpeedMode()); prSportTypeDialogController.get().show(getWindow(liSportTypes), newSportType); <DeepExtract> final ObservableList<SportType> olSportTypes = FXCollections.observableArrayList(); liSportTypes.getItems().clear(); document.getSportTypeList().forEach(sportType -> olSportTypes.add(sportType)); liSportTypes.setItems(olSportTypes); </DeepExtract> }
sportstracker
positive
100
public boolean contains(Object o) { while (elems[indexFor(o)] != null) { if (o.equals(elems[indexFor(o)].value)) return true; ; elems[indexFor(o)] = elems[indexFor(o)].next; } return false; }
public boolean contains(Object o) { <DeepExtract> while (elems[indexFor(o)] != null) { if (o.equals(elems[indexFor(o)].value)) return true; ; elems[indexFor(o)] = elems[indexFor(o)].next; } return false; </DeepExtract> }
monqjfa
positive
101
@Override long alignToMegabytes(long a) { if (a == 0L) return 0L; long mask = ~(C6 / C0 - 1L); if (a > 0L) { long filled = a + C6 / C0 - 1L; if (filled > 0L) { return filled & mask; } else { long maxAlignedLong = Long.MAX_VALUE & mask; if (a <= maxAlignedLong) return maxAlignedLong; } } else { long filled = a - C6 / C0 + 1L; if (filled < 0L) { return filled & mask; } else { long minAlignedLong = Long.MIN_VALUE & mask; if (a >= minAlignedLong) return minAlignedLong; } } throw new IllegalArgumentException("Couldn't align " + a + " by " + C6 / C0); }
@Override long alignToMegabytes(long a) { <DeepExtract> if (a == 0L) return 0L; long mask = ~(C6 / C0 - 1L); if (a > 0L) { long filled = a + C6 / C0 - 1L; if (filled > 0L) { return filled & mask; } else { long maxAlignedLong = Long.MAX_VALUE & mask; if (a <= maxAlignedLong) return maxAlignedLong; } } else { long filled = a - C6 / C0 + 1L; if (filled < 0L) { return filled & mask; } else { long minAlignedLong = Long.MIN_VALUE & mask; if (a >= minAlignedLong) return minAlignedLong; } } throw new IllegalArgumentException("Couldn't align " + a + " by " + C6 / C0); </DeepExtract> }
Chronicle-Algorithms
positive
104
public void hideMenu() { int cX = (mFAB.getLeft() + mFAB.getRight()) / 2; int cY = (mFAB.getTop() + mFAB.getBottom()) / 2; SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mContainer, cX, cY, mScreenWidth, 0); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.setDuration(mDuration); if (new ToolbarCollapseListener(false) != null) { animator.addListener(new ToolbarCollapseListener(false)); } animator.start(); }
public void hideMenu() { <DeepExtract> int cX = (mFAB.getLeft() + mFAB.getRight()) / 2; int cY = (mFAB.getTop() + mFAB.getBottom()) / 2; SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mContainer, cX, cY, mScreenWidth, 0); animator.setInterpolator(new AccelerateDecelerateInterpolator()); animator.setDuration(mDuration); if (new ToolbarCollapseListener(false) != null) { animator.addListener(new ToolbarCollapseListener(false)); } animator.start(); </DeepExtract> }
AndroidBlog
positive
105
public void trainInfo(String[] args) { HandleParameters params = new HandleParameters(args); System.out.println("Load .info file from " + params.get("-info")); docs = new SieveDocuments(params.get("-info")); props = StringUtils.argsToProperties(args); if (props != null) { if (props.containsKey("min")) _featMinOccurrence = Integer.parseInt(props.getProperty("min")); if (props.containsKey("edctdet")) _onlyDCTSaid = true; if (props.containsKey("etdet")) _etDeterministic = true; if (props.containsKey("eedet")) _eeDeterministic = true; if (props.containsKey("prob")) _tlinkProbabilityCutoff = Double.parseDouble(props.getProperty("prob")); } featurizer = new TLinkFeaturizer(); trainInfo(docs, null); }
public void trainInfo(String[] args) { HandleParameters params = new HandleParameters(args); System.out.println("Load .info file from " + params.get("-info")); docs = new SieveDocuments(params.get("-info")); props = StringUtils.argsToProperties(args); <DeepExtract> if (props != null) { if (props.containsKey("min")) _featMinOccurrence = Integer.parseInt(props.getProperty("min")); if (props.containsKey("edctdet")) _onlyDCTSaid = true; if (props.containsKey("etdet")) _etDeterministic = true; if (props.containsKey("eedet")) _eeDeterministic = true; if (props.containsKey("prob")) _tlinkProbabilityCutoff = Double.parseDouble(props.getProperty("prob")); } featurizer = new TLinkFeaturizer(); </DeepExtract> trainInfo(docs, null); }
caevo
positive
106
public Builder addUint64Contents(long value) { if (!((bitField0_ & 0x00000010) == 0x00000010)) { uint64Contents_ = new java.util.ArrayList<Long>(uint64Contents_); bitField0_ |= 0x00000010; } uint64Contents_.add(value); onChanged(); return this; }
public Builder addUint64Contents(long value) { <DeepExtract> if (!((bitField0_ & 0x00000010) == 0x00000010)) { uint64Contents_ = new java.util.ArrayList<Long>(uint64Contents_); bitField0_ |= 0x00000010; } </DeepExtract> uint64Contents_.add(value); onChanged(); return this; }
dl_inference
positive
107
public void onClick(DialogInterface di, int id) { mLogger.info("send confirmed"); try { mLogger.info(String.format("send from %d, to %s, amount %s, fee %s starting", mAcctId, mAddr, mBTCFmt.format(mAmount), mBTCFmt.format(mFee))); mWalletService.sendCoinsFromAccount(mAcctId, mAddr, mAmount, mFee, spendUnconfirmed()); mLogger.info("send finished"); Intent intent = new Intent(this, ViewTransactionsActivity.class); Bundle bundle = new Bundle(); bundle.putInt("accountId", mCheckedFromId); intent.putExtras(bundle); startActivity(intent); finish(); } catch (RuntimeException ex) { mLogger.error(ex.toString()); showErrorDialog(ex.getMessage()); return; } }
public void onClick(DialogInterface di, int id) { mLogger.info("send confirmed"); <DeepExtract> try { mLogger.info(String.format("send from %d, to %s, amount %s, fee %s starting", mAcctId, mAddr, mBTCFmt.format(mAmount), mBTCFmt.format(mFee))); mWalletService.sendCoinsFromAccount(mAcctId, mAddr, mAmount, mFee, spendUnconfirmed()); mLogger.info("send finished"); Intent intent = new Intent(this, ViewTransactionsActivity.class); Bundle bundle = new Bundle(); bundle.putInt("accountId", mCheckedFromId); intent.putExtras(bundle); startActivity(intent); finish(); } catch (RuntimeException ex) { mLogger.error(ex.toString()); showErrorDialog(ex.getMessage()); return; } </DeepExtract> }
Wallet32
positive
108
protected HttpRequest closeOutput() throws IOException { if (null == null) progress = UploadProgress.DEFAULT; else progress = null; return this; if (output == null) return this; if (multipart) output.write(CRLF + "--" + BOUNDARY + "--" + CRLF); if (ignoreCloseExceptions) try { output.close(); } catch (IOException ignored) { } else output.close(); output = null; return this; }
protected HttpRequest closeOutput() throws IOException { <DeepExtract> if (null == null) progress = UploadProgress.DEFAULT; else progress = null; return this; </DeepExtract> if (output == null) return this; if (multipart) output.write(CRLF + "--" + BOUNDARY + "--" + CRLF); if (ignoreCloseExceptions) try { output.close(); } catch (IOException ignored) { } else output.close(); output = null; return this; }
nanoleaf-aurora
positive
109
End of preview. Expand in Data Studio

Dataset Card for "8000-java-preprocessed"

More Information needed

Downloads last month
23