before stringlengths 33 3.21M | after stringlengths 63 3.21M | repo stringlengths 1 56 | type stringclasses 1
value | __index_level_0__ int64 0 442k |
|---|---|---|---|---|
private static void uploadFolder(File folder, InputStream in, OutputStream out) throws IOException {
SshUtil.writeAcknowledgedMessage("D0755 0 " + folder.getName() + "\n", in, out);
File[] files = folder.listFiles();
for (File file : files) {
if (file.isDirectory()) {
uploadFolder(file, in, out);
} else {
uploadFile(file, in, out);
}
}
SshUtil.writeAcknowledgedMessage("E\n", in, out);
} | private static void uploadFolder(File folder, InputStream in, OutputStream out) throws IOException {
SshUtil.writeAcknowledgedMessage("D0755 0 " + folder.getName() + "\n", in, out);
<DeepExtract>
File[] files = folder.listFiles();
for (File file : files) {
if (file.isDirectory()) {
uploadFolder(file, in, out);
} else {
uploadFile(file, in, out);
}
}
</DeepExtract>
SshUtil.writeAcknowledgedMessage("E\n", in, out);
} | aws-tasks | positive | 439,524 |
@Override
protected ExecutionPlan analyzeParameters(Object[] pars) {
paramHelper.prepareParameters(pars);
if (Elasql.migrationMgr().isInMigration())
analyzer = Elasql.migrationMgr().newAnalyzer();
else
analyzer = new StandardAnalyzer();
if (localNodeId == MASTER_NODE) {
for (int nodeId = 0; nodeId < numOfParts; nodeId++) analyzer.generatePlan().addRemoteReadKey(NotificationPartitionPlan.createRecordKey(nodeId, MASTER_NODE));
} else {
analyzer.generatePlan().addRemoteReadKey(NotificationPartitionPlan.createRecordKey(MASTER_NODE, Elasql.serverId()));
}
analyzer.generatePlan().setParticipantRole(ParticipantRole.ACTIVE);
analyzer.generatePlan().setForceReadWriteTx();
return analyzer.generatePlan();
} | @Override
protected ExecutionPlan analyzeParameters(Object[] pars) {
paramHelper.prepareParameters(pars);
if (Elasql.migrationMgr().isInMigration())
analyzer = Elasql.migrationMgr().newAnalyzer();
else
analyzer = new StandardAnalyzer();
<DeepExtract>
if (localNodeId == MASTER_NODE) {
for (int nodeId = 0; nodeId < numOfParts; nodeId++) analyzer.generatePlan().addRemoteReadKey(NotificationPartitionPlan.createRecordKey(nodeId, MASTER_NODE));
} else {
analyzer.generatePlan().addRemoteReadKey(NotificationPartitionPlan.createRecordKey(MASTER_NODE, Elasql.serverId()));
}
analyzer.generatePlan().setParticipantRole(ParticipantRole.ACTIVE);
analyzer.generatePlan().setForceReadWriteTx();
return analyzer.generatePlan();
</DeepExtract>
} | elasql | positive | 439,525 |
@Test
public void testLogMultipleArguments() throws Exception {
final TiLog.Logger logger = mock(TiLog.Logger.class);
final LoggingInterceptor loggingInterceptor = new LoggingInterceptor(logger);
final TestView view = loggingInterceptor.intercept(new TestViewImpl());
final ArgumentCaptor<String> msgCaptor = ArgumentCaptor.forClass(String.class);
verify(logger).log(anyInt(), anyString(), msgCaptor.capture());
assertThat(msgCaptor.getValue()).isEqualTo("twoArgs(A, B)");
} | @Test
<DeepExtract>
</DeepExtract>
public void testLogMultipleArguments() throws Exception {
<DeepExtract>
</DeepExtract>
final TiLog.Logger logger = mock(TiLog.Logger.class);
<DeepExtract>
</DeepExtract>
final LoggingInterceptor loggingInterceptor = new LoggingInterceptor(logger);
<DeepExtract>
</DeepExtract>
final TestView view = loggingInterceptor.intercept(new TestViewImpl());
<DeepExtract>
</DeepExtract>
final ArgumentCaptor<String> msgCaptor = ArgumentCaptor.forClass(String.class);
<DeepExtract>
</DeepExtract>
verify(logger).log(anyInt(), anyString(), msgCaptor.capture());
<DeepExtract>
</DeepExtract>
assertThat(msgCaptor.getValue()).isEqualTo("twoArgs(A, B)");
<DeepExtract>
</DeepExtract>
} | ThirtyInch | positive | 439,528 |
public void test_buildMarkedAsSuccessful_WhileRunning() throws Exception {
if (isSkipEvent(EventToTest.MARKED_RUNNING_SUCCESSFUL))
return;
myPublisher.buildMarkedAsSuccessful(startBuildInCurrentBranch(myBuildType), myRevision, true);
then(getRequestAsString()).isNotNull().matches(myExpectedRegExps.get(EventToTest.MARKED_RUNNING_SUCCESSFUL)).doesNotMatch(".*error.*");
} | public void test_buildMarkedAsSuccessful_WhileRunning() throws Exception {
if (isSkipEvent(EventToTest.MARKED_RUNNING_SUCCESSFUL))
return;
myPublisher.buildMarkedAsSuccessful(startBuildInCurrentBranch(myBuildType), myRevision, true);
<DeepExtract>
then(getRequestAsString()).isNotNull().matches(myExpectedRegExps.get(EventToTest.MARKED_RUNNING_SUCCESSFUL)).doesNotMatch(".*error.*");
</DeepExtract>
} | commit-status-publisher | positive | 439,529 |
public static GroupUser destroy(Long id, HashMap<String, Object> parameters, HashMap<String, Object> options) throws IOException {
parameters = parameters != null ? parameters : new HashMap<String, Object>();
options = options != null ? options : new HashMap<String, Object>();
if (id == null && parameters.containsKey("id") && parameters.get("id") != null) {
id = ((Long) parameters.get("id"));
}
if (!(id instanceof Long)) {
throw new IllegalArgumentException("Bad parameter: id must be of type Long parameters[\"id\"]");
}
if (parameters.containsKey("group_id") && !(parameters.get("group_id") instanceof Long)) {
throw new IllegalArgumentException("Bad parameter: group_id must be of type Long parameters[\"group_id\"]");
}
if (parameters.containsKey("user_id") && !(parameters.get("user_id") instanceof Long)) {
throw new IllegalArgumentException("Bad parameter: user_id must be of type Long parameters[\"user_id\"]");
}
if (id == null) {
throw new NullPointerException("Argument or Parameter missing: id parameters[\"id\"]");
}
if (!parameters.containsKey("group_id") || parameters.get("group_id") == null) {
throw new NullPointerException("Parameter missing: group_id parameters[\"group_id\"]");
}
if (!parameters.containsKey("user_id") || parameters.get("user_id") == null) {
throw new NullPointerException("Parameter missing: user_id parameters[\"user_id\"]");
}
String[] urlParts = { FilesConfig.getInstance().getApiRoot(), FilesConfig.getInstance().getApiBase(), String.valueOf(id) };
for (int i = 2; i < urlParts.length; i++) {
try {
urlParts[i] = new URI(null, null, urlParts[i], null).getRawPath();
} catch (URISyntaxException ex) {
}
}
String url = String.format("%s%s/group_users/%s", urlParts);
TypeReference<GroupUser> typeReference = new TypeReference<GroupUser>() {
};
return FilesClient.requestItem(url, RequestMethods.DELETE, typeReference, parameters, options);
} | public static GroupUser destroy(Long id, HashMap<String, Object> parameters, HashMap<String, Object> options) throws IOException {
<DeepExtract>
parameters = parameters != null ? parameters : new HashMap<String, Object>();
options = options != null ? options : new HashMap<String, Object>();
if (id == null && parameters.containsKey("id") && parameters.get("id") != null) {
id = ((Long) parameters.get("id"));
}
if (!(id instanceof Long)) {
throw new IllegalArgumentException("Bad parameter: id must be of type Long parameters[\"id\"]");
}
if (parameters.containsKey("group_id") && !(parameters.get("group_id") instanceof Long)) {
throw new IllegalArgumentException("Bad parameter: group_id must be of type Long parameters[\"group_id\"]");
}
if (parameters.containsKey("user_id") && !(parameters.get("user_id") instanceof Long)) {
throw new IllegalArgumentException("Bad parameter: user_id must be of type Long parameters[\"user_id\"]");
}
if (id == null) {
throw new NullPointerException("Argument or Parameter missing: id parameters[\"id\"]");
}
if (!parameters.containsKey("group_id") || parameters.get("group_id") == null) {
throw new NullPointerException("Parameter missing: group_id parameters[\"group_id\"]");
}
if (!parameters.containsKey("user_id") || parameters.get("user_id") == null) {
throw new NullPointerException("Parameter missing: user_id parameters[\"user_id\"]");
}
String[] urlParts = { FilesConfig.getInstance().getApiRoot(), FilesConfig.getInstance().getApiBase(), String.valueOf(id) };
for (int i = 2; i < urlParts.length; i++) {
try {
urlParts[i] = new URI(null, null, urlParts[i], null).getRawPath();
} catch (URISyntaxException ex) {
}
}
String url = String.format("%s%s/group_users/%s", urlParts);
TypeReference<GroupUser> typeReference = new TypeReference<GroupUser>() {
};
return FilesClient.requestItem(url, RequestMethods.DELETE, typeReference, parameters, options);
</DeepExtract>
} | files-sdk-java | positive | 439,530 |
@Override
public void onClick(View v) {
if (!mSpeakerOn) {
frameLayoutTest.removeView(frameLayoutGroup);
frameLayoutParent.addView(frameLayoutGroup);
} else {
frameLayoutParent.removeView(frameLayoutGroup);
frameLayoutTest.addView(frameLayoutGroup);
}
mSpeakerOn = !mSpeakerOn;
mLoudSpkeader.setImageResource(!mSpeakerOn ? R.mipmap.loudspeaker : R.mipmap.loudspeaker_disable);
} | @Override
public void onClick(View v) {
<DeepExtract>
if (!mSpeakerOn) {
frameLayoutTest.removeView(frameLayoutGroup);
frameLayoutParent.addView(frameLayoutGroup);
} else {
frameLayoutParent.removeView(frameLayoutGroup);
frameLayoutTest.addView(frameLayoutGroup);
}
mSpeakerOn = !mSpeakerOn;
mLoudSpkeader.setImageResource(!mSpeakerOn ? R.mipmap.loudspeaker : R.mipmap.loudspeaker_disable);
</DeepExtract>
} | urtc-android-demo | positive | 439,531 |
@Override
public void rollback(TransactionStatus status) throws TransactionException {
ActiveJdbcTransactionStatus activeJdbcStatus = ((ActiveJdbcTransactionStatus) status);
if (status.isCompleted()) {
String msg = "Transaction %s has been already completed!";
throw new TransactionException(String.format(msg, activeJdbcStatus.getName())) {
};
}
Base.rollbackTransaction();
completed = true;
} | @Override
public void rollback(TransactionStatus status) throws TransactionException {
ActiveJdbcTransactionStatus activeJdbcStatus = ((ActiveJdbcTransactionStatus) status);
if (status.isCompleted()) {
String msg = "Transaction %s has been already completed!";
throw new TransactionException(String.format(msg, activeJdbcStatus.getName())) {
};
}
Base.rollbackTransaction();
<DeepExtract>
completed = true;
</DeepExtract>
} | Orm-Frameworks-Demo | positive | 439,534 |
public void onAttrDropped(byte attrId) {
cbAttrMap.remove(attrId);
World world = getWorldObj();
if (world != null) {
updateCachedLighting();
world.markBlockForUpdate(xCoord, yCoord, zCoord);
}
markDirty();
} | public void onAttrDropped(byte attrId) {
cbAttrMap.remove(attrId);
<DeepExtract>
World world = getWorldObj();
if (world != null) {
updateCachedLighting();
world.markBlockForUpdate(xCoord, yCoord, zCoord);
}
</DeepExtract>
markDirty();
} | carpentersblocks | positive | 439,537 |
public static DataUnit page_view(PageViewEdge value) {
DataUnit x = new DataUnit();
if (value == null)
throw new NullPointerException();
setField_ = _Fields.PAGE_VIEW;
value_ = value;
return x;
} | public static DataUnit page_view(PageViewEdge value) {
DataUnit x = new DataUnit();
<DeepExtract>
if (value == null)
throw new NullPointerException();
setField_ = _Fields.PAGE_VIEW;
value_ = value;
</DeepExtract>
return x;
} | big-data-code | positive | 439,539 |
private void write(EslintBridgeServer.CpdToken cpdToken) throws IOException {
var location = cpdToken.getLocation();
out.writeInt(location.getStartLine());
out.writeInt(location.getStartCol());
out.writeInt(location.getEndLine());
out.writeInt(location.getEndCol());
out.writeInt(stringTable.getIndex(cpdToken.getImage()));
} | private void write(EslintBridgeServer.CpdToken cpdToken) throws IOException {
var location = cpdToken.getLocation();
out.writeInt(location.getStartLine());
out.writeInt(location.getStartCol());
out.writeInt(location.getEndLine());
out.writeInt(location.getEndCol());
<DeepExtract>
out.writeInt(stringTable.getIndex(cpdToken.getImage()));
</DeepExtract>
} | SonarJS | positive | 439,540 |
@Test
void test_organization_creation_with_missing_id_and_name_value() throws IOException {
String message = "MSH|^~\\&|MYEHR2.5|RI88140101|KIDSNET_IFL|RIHEALTH|20130531||VXU^V04^VXU_V04|20130531RI881401010105|P|2.5.1|||NE|AL||||||RI543763\r" + "PID|1||432155^^^^MR||Patient^Johnny^New^^^^L|Smith^Sally|20130414|M||2106-3^White^HL70005|123 Any St^^Somewhere^WI^54000^^M\r" + "NK1|1|Patient^Sally|MTH^mother^HL70063|123 Any St^^Somewhere^WI^54000^^M|^PRN^PH^^^608^5551212|||||||||||19820517||||eng^English^ISO639\r" + "ORC|RE||197027|||||||^Clerk^Myron||MD67895^Pediatric^MARY^^^^MD^^RIA|||||RI2050\r" + "RXA|0|1|20130531|20130531|48^HIB PRP-T^CVX|0.5|ML^^ISO+||00^new immunization record^NIP001|^Sticker^Nurse|^^^RI2050||||33k2a|20131210|^^MVX|||CP|A\r" + "RXR|C28161^IM^NCIT^IM^INTRAMUSCULAR^HL70162|RT^right thigh^HL70163\r" + "OBX|1|CE|64994-7^vaccine fund pgm elig cat^LN|1|V02^VFC eligible Medicaid/MedicaidManaged Care^HL70064||||||F|||20130531|||VXC40^per imm^CDCPHINVS\r" + "OBX|2|CE|30956-7^Vaccine Type^LN|2|48^HIB PRP-T^CVX||||||F|||20130531\r" + "OBX|3|TS|29768-9^VIS Publication Date^LN|2|19981216||||||F|||20130531\r" + "OBX|4|TS|59785-6^VIS Presentation Date^LN|2|20130531||||||F|||20130531\r" + "OBX|5|ST|48767-8^Annotation^LN|2|Some text from doctor||||||F|||20130531\r";
Message hl7message;
HL7HapiParser hparser = null;
try {
hparser = new HL7HapiParser();
hl7message = hparser.getParser().parse(message);
} catch (HL7Exception e) {
throw new IllegalArgumentException(e);
} finally {
if (hparser != null) {
hparser.getContext().close();
}
}
HL7DataExtractor hl7DTE = new HL7DataExtractor(hl7message);
Structure s = hl7DTE.getAllStructures("ORDER", 0, "RXA").getValue();
ExpressionAttributes attr = new ExpressionAttributes.Builder().withSpecs("RXA.17").withValueOf("resource/Organization").withGenerateList(true).build();
ResourceExpression exp = new ResourceExpression(attr);
assertThat(exp.getData()).isNotNull();
Map<String, EvaluationResult> context = new HashMap<>();
EvaluationResult value = exp.evaluate(new HL7MessageData(hl7DTE), ImmutableMap.copyOf(context), new SimpleEvaluationResult(s));
assertThat(value).isNull();
} | @Test
void test_organization_creation_with_missing_id_and_name_value() throws IOException {
String message = "MSH|^~\\&|MYEHR2.5|RI88140101|KIDSNET_IFL|RIHEALTH|20130531||VXU^V04^VXU_V04|20130531RI881401010105|P|2.5.1|||NE|AL||||||RI543763\r" + "PID|1||432155^^^^MR||Patient^Johnny^New^^^^L|Smith^Sally|20130414|M||2106-3^White^HL70005|123 Any St^^Somewhere^WI^54000^^M\r" + "NK1|1|Patient^Sally|MTH^mother^HL70063|123 Any St^^Somewhere^WI^54000^^M|^PRN^PH^^^608^5551212|||||||||||19820517||||eng^English^ISO639\r" + "ORC|RE||197027|||||||^Clerk^Myron||MD67895^Pediatric^MARY^^^^MD^^RIA|||||RI2050\r" + "RXA|0|1|20130531|20130531|48^HIB PRP-T^CVX|0.5|ML^^ISO+||00^new immunization record^NIP001|^Sticker^Nurse|^^^RI2050||||33k2a|20131210|^^MVX|||CP|A\r" + "RXR|C28161^IM^NCIT^IM^INTRAMUSCULAR^HL70162|RT^right thigh^HL70163\r" + "OBX|1|CE|64994-7^vaccine fund pgm elig cat^LN|1|V02^VFC eligible Medicaid/MedicaidManaged Care^HL70064||||||F|||20130531|||VXC40^per imm^CDCPHINVS\r" + "OBX|2|CE|30956-7^Vaccine Type^LN|2|48^HIB PRP-T^CVX||||||F|||20130531\r" + "OBX|3|TS|29768-9^VIS Publication Date^LN|2|19981216||||||F|||20130531\r" + "OBX|4|TS|59785-6^VIS Presentation Date^LN|2|20130531||||||F|||20130531\r" + "OBX|5|ST|48767-8^Annotation^LN|2|Some text from doctor||||||F|||20130531\r";
<DeepExtract>
Message hl7message;
HL7HapiParser hparser = null;
try {
hparser = new HL7HapiParser();
hl7message = hparser.getParser().parse(message);
} catch (HL7Exception e) {
throw new IllegalArgumentException(e);
} finally {
if (hparser != null) {
hparser.getContext().close();
}
}
</DeepExtract>
HL7DataExtractor hl7DTE = new HL7DataExtractor(hl7message);
Structure s = hl7DTE.getAllStructures("ORDER", 0, "RXA").getValue();
ExpressionAttributes attr = new ExpressionAttributes.Builder().withSpecs("RXA.17").withValueOf("resource/Organization").withGenerateList(true).build();
ResourceExpression exp = new ResourceExpression(attr);
assertThat(exp.getData()).isNotNull();
Map<String, EvaluationResult> context = new HashMap<>();
EvaluationResult value = exp.evaluate(new HL7MessageData(hl7DTE), ImmutableMap.copyOf(context), new SimpleEvaluationResult(s));
assertThat(value).isNull();
} | hl7v2-fhir-converter | positive | 439,541 |
public void refresh() {
currentStudy.refreshChildSeries(queryOrthanc);
this.currentStudy = currentStudy;
clear();
currentStudy.refreshChildSeries(queryOrthanc);
for (Serie serie : currentStudy.getSeries()) {
this.addRow(new Object[] { serie.getSerieDescription(), serie.getModality(), serie.getNbInstances(), serie.isSecondaryCapture(), serie.getId(), serie.getSeriesNumber(), serie });
}
} | public void refresh() {
currentStudy.refreshChildSeries(queryOrthanc);
<DeepExtract>
this.currentStudy = currentStudy;
clear();
currentStudy.refreshChildSeries(queryOrthanc);
for (Serie serie : currentStudy.getSeries()) {
this.addRow(new Object[] { serie.getSerieDescription(), serie.getModality(), serie.getNbInstances(), serie.isSecondaryCapture(), serie.getId(), serie.getSeriesNumber(), serie });
}
</DeepExtract>
} | Orthanc_Tools | positive | 439,542 |
@Override
public void doDisconnect(HandlerContext<O, I> ctx, Promise<O, I> promise) {
log.debug("HeadContext doDisconnect().");
tail.disconnect(promise);
} | @Override
public void doDisconnect(HandlerContext<O, I> ctx, Promise<O, I> promise) {
log.debug("HeadContext doDisconnect().");
<DeepExtract>
tail.disconnect(promise);
</DeepExtract>
} | Ak47 | positive | 439,546 |
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
listview = new ListView(this);
setContentView(listview);
dataList = new ArrayList<Item>();
for (int i = 0; i < 101; i++) {
if (i % 2 == 0) {
dataList.add(new TextItem(i));
} else {
dataList.add(new ButtonItem(i));
}
}
listadapter = new SimplestDemoAdadpter(getApplicationContext());
listadapter.addItemsInList(dataList);
listview.setAdapter(listadapter);
} | @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
listview = new ListView(this);
setContentView(listview);
<DeepExtract>
dataList = new ArrayList<Item>();
for (int i = 0; i < 101; i++) {
if (i % 2 == 0) {
dataList.add(new TextItem(i));
} else {
dataList.add(new ButtonItem(i));
}
}
</DeepExtract>
listadapter = new SimplestDemoAdadpter(getApplicationContext());
listadapter.addItemsInList(dataList);
listview.setAdapter(listadapter);
} | EasyListViewAdapters | positive | 439,549 |
public static void Draw(Canvas canvas) {
canvas.drawBitmap(mBackground, 0, 0, null);
for (int i = 0; i < mMonsterList.size(); i++) {
FightingCharacter fc = mMonsterList.get(i);
if (fc.isVisiable()) {
fc.getFightingSprite().draw(canvas);
}
}
for (int i = mPlayerList.size() - 1; i >= 0; i--) {
FightingSprite f = mPlayerList.get(i).getFightingSprite();
f.draw(canvas);
}
if (mCombatState == CombatState.SelectAction && !mIsAutoAttack) {
mCombatUI.draw(canvas);
} else if (mCombatState == CombatState.PerformAction) {
mActionExecutor.draw(canvas);
} else if (mCombatState == CombatState.Win) {
mCombatSuccess.draw(canvas);
} else if (mCombatState == CombatState.Loss && sIsRandomFight) {
mFlyPeach.draw(canvas, 0, 0);
}
} | public static void Draw(Canvas canvas) {
<DeepExtract>
canvas.drawBitmap(mBackground, 0, 0, null);
for (int i = 0; i < mMonsterList.size(); i++) {
FightingCharacter fc = mMonsterList.get(i);
if (fc.isVisiable()) {
fc.getFightingSprite().draw(canvas);
}
}
for (int i = mPlayerList.size() - 1; i >= 0; i--) {
FightingSprite f = mPlayerList.get(i).getFightingSprite();
f.draw(canvas);
}
if (mCombatState == CombatState.SelectAction && !mIsAutoAttack) {
mCombatUI.draw(canvas);
} else if (mCombatState == CombatState.PerformAction) {
mActionExecutor.draw(canvas);
} else if (mCombatState == CombatState.Win) {
mCombatSuccess.draw(canvas);
} else if (mCombatState == CombatState.Loss && sIsRandomFight) {
mFlyPeach.draw(canvas, 0, 0);
}
</DeepExtract>
} | fmj_pc | positive | 439,552 |
public void run() {
int idx1 = firstIdx + mf;
m = n;
while (m > 512) {
m >>= 2;
cftmdl1(m, a, idx1 - m, w, nw - (m >> 1));
}
if (m == 512) {
cftmdl1(128, a, idx1 - m, w, nw - 64);
cftf161(a, idx1 - m, w, nw - 8);
cftf162(a, idx1 - m + 32, w, nw - 32);
cftf161(a, idx1 - m + 64, w, nw - 8);
cftf161(a, idx1 - m + 96, w, nw - 8);
cftmdl2(128, a, idx1 - m + 128, w, nw - 128);
cftf161(a, idx1 - m + 128, w, nw - 8);
cftf162(a, idx1 - m + 160, w, nw - 32);
cftf161(a, idx1 - m + 192, w, nw - 8);
cftf162(a, idx1 - m + 224, w, nw - 32);
cftmdl1(128, a, idx1 - m + 256, w, nw - 64);
cftf161(a, idx1 - m + 256, w, nw - 8);
cftf162(a, idx1 - m + 288, w, nw - 32);
cftf161(a, idx1 - m + 320, w, nw - 8);
cftf161(a, idx1 - m + 352, w, nw - 8);
if (1 != 0) {
cftmdl1(128, a, idx1 - m + 384, w, nw - 64);
cftf161(a, idx1 - m + 480, w, nw - 8);
} else {
cftmdl2(128, a, idx1 - m + 384, w, nw - 128);
cftf162(a, idx1 - m + 480, w, nw - 32);
}
cftf161(a, idx1 - m + 384, w, nw - 8);
cftf162(a, idx1 - m + 416, w, nw - 32);
cftf161(a, idx1 - m + 448, w, nw - 8);
} else {
cftmdl1(64, a, idx1 - m, w, nw - 32);
cftf081(a, idx1 - m, w, nw - 8);
cftf082(a, idx1 - m + 16, w, nw - 8);
cftf081(a, idx1 - m + 32, w, nw - 8);
cftf081(a, idx1 - m + 48, w, nw - 8);
cftmdl2(64, a, idx1 - m + 64, w, nw - 64);
cftf081(a, idx1 - m + 64, w, nw - 8);
cftf082(a, idx1 - m + 80, w, nw - 8);
cftf081(a, idx1 - m + 96, w, nw - 8);
cftf082(a, idx1 - m + 112, w, nw - 8);
cftmdl1(64, a, idx1 - m + 128, w, nw - 32);
cftf081(a, idx1 - m + 128, w, nw - 8);
cftf082(a, idx1 - m + 144, w, nw - 8);
cftf081(a, idx1 - m + 160, w, nw - 8);
cftf081(a, idx1 - m + 176, w, nw - 8);
if (1 != 0) {
cftmdl1(64, a, idx1 - m + 192, w, nw - 32);
cftf081(a, idx1 - m + 240, w, nw - 8);
} else {
cftmdl2(64, a, idx1 - m + 192, w, nw - 64);
cftf082(a, idx1 - m + 240, w, nw - 8);
}
cftf081(a, idx1 - m + 192, w, nw - 8);
cftf082(a, idx1 - m + 208, w, nw - 8);
cftf081(a, idx1 - m + 224, w, nw - 8);
}
k = 0;
int idx2 = firstIdx - m;
for (j = mf - m; j > 0; j -= m) {
k++;
isplt = cfttree(m, j, k, a, firstIdx, nw, w);
cftleaf(m, isplt, a, idx2 + j, nw, w);
}
} | public void run() {
int idx1 = firstIdx + mf;
m = n;
while (m > 512) {
m >>= 2;
cftmdl1(m, a, idx1 - m, w, nw - (m >> 1));
}
<DeepExtract>
if (m == 512) {
cftmdl1(128, a, idx1 - m, w, nw - 64);
cftf161(a, idx1 - m, w, nw - 8);
cftf162(a, idx1 - m + 32, w, nw - 32);
cftf161(a, idx1 - m + 64, w, nw - 8);
cftf161(a, idx1 - m + 96, w, nw - 8);
cftmdl2(128, a, idx1 - m + 128, w, nw - 128);
cftf161(a, idx1 - m + 128, w, nw - 8);
cftf162(a, idx1 - m + 160, w, nw - 32);
cftf161(a, idx1 - m + 192, w, nw - 8);
cftf162(a, idx1 - m + 224, w, nw - 32);
cftmdl1(128, a, idx1 - m + 256, w, nw - 64);
cftf161(a, idx1 - m + 256, w, nw - 8);
cftf162(a, idx1 - m + 288, w, nw - 32);
cftf161(a, idx1 - m + 320, w, nw - 8);
cftf161(a, idx1 - m + 352, w, nw - 8);
if (1 != 0) {
cftmdl1(128, a, idx1 - m + 384, w, nw - 64);
cftf161(a, idx1 - m + 480, w, nw - 8);
} else {
cftmdl2(128, a, idx1 - m + 384, w, nw - 128);
cftf162(a, idx1 - m + 480, w, nw - 32);
}
cftf161(a, idx1 - m + 384, w, nw - 8);
cftf162(a, idx1 - m + 416, w, nw - 32);
cftf161(a, idx1 - m + 448, w, nw - 8);
} else {
cftmdl1(64, a, idx1 - m, w, nw - 32);
cftf081(a, idx1 - m, w, nw - 8);
cftf082(a, idx1 - m + 16, w, nw - 8);
cftf081(a, idx1 - m + 32, w, nw - 8);
cftf081(a, idx1 - m + 48, w, nw - 8);
cftmdl2(64, a, idx1 - m + 64, w, nw - 64);
cftf081(a, idx1 - m + 64, w, nw - 8);
cftf082(a, idx1 - m + 80, w, nw - 8);
cftf081(a, idx1 - m + 96, w, nw - 8);
cftf082(a, idx1 - m + 112, w, nw - 8);
cftmdl1(64, a, idx1 - m + 128, w, nw - 32);
cftf081(a, idx1 - m + 128, w, nw - 8);
cftf082(a, idx1 - m + 144, w, nw - 8);
cftf081(a, idx1 - m + 160, w, nw - 8);
cftf081(a, idx1 - m + 176, w, nw - 8);
if (1 != 0) {
cftmdl1(64, a, idx1 - m + 192, w, nw - 32);
cftf081(a, idx1 - m + 240, w, nw - 8);
} else {
cftmdl2(64, a, idx1 - m + 192, w, nw - 64);
cftf082(a, idx1 - m + 240, w, nw - 8);
}
cftf081(a, idx1 - m + 192, w, nw - 8);
cftf082(a, idx1 - m + 208, w, nw - 8);
cftf081(a, idx1 - m + 224, w, nw - 8);
}
</DeepExtract>
k = 0;
int idx2 = firstIdx - m;
for (j = mf - m; j > 0; j -= m) {
k++;
isplt = cfttree(m, j, k, a, firstIdx, nw, w);
cftleaf(m, isplt, a, idx2 + j, nw, w);
}
} | cythara | positive | 439,556 |
public JSONObject createMulti(String name, JSONObject multiObj) throws RedditApiException {
if (!isLoggedIn()) {
throw new RedditApiException("Reddit Login Required", true);
}
try {
url = OAUTH_ENDPOINT + "/api/multi/user/" + username + "/m/" + name + "?model=" + URLEncoder.encode(multiObj.toString(), "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
throw new RedditApiException("Encoding error: " + e.getMessage());
}
JSONObject jObj;
try {
String json = redditApiRequest(url, "POST", REQUEST_MODE_AUTHED, null);
jObj = new JSONObject(json);
} catch (JSONException e) {
e.printStackTrace();
throw new RedditApiException("Error: " + e.getMessage());
}
return jObj;
} | public JSONObject createMulti(String name, JSONObject multiObj) throws RedditApiException {
if (!isLoggedIn()) {
throw new RedditApiException("Reddit Login Required", true);
}
try {
url = OAUTH_ENDPOINT + "/api/multi/user/" + username + "/m/" + name + "?model=" + URLEncoder.encode(multiObj.toString(), "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
throw new RedditApiException("Encoding error: " + e.getMessage());
}
<DeepExtract>
JSONObject jObj;
try {
String json = redditApiRequest(url, "POST", REQUEST_MODE_AUTHED, null);
jObj = new JSONObject(json);
} catch (JSONException e) {
e.printStackTrace();
throw new RedditApiException("Error: " + e.getMessage());
}
return jObj;
</DeepExtract>
} | reddinator | positive | 439,557 |
public SVNUpdateClient getUpdateClient() {
core.getUpdateClient().getOperationsFactory().setPrimaryWcGeneration(wcgen);
return core.getUpdateClient();
} | public SVNUpdateClient getUpdateClient() {
<DeepExtract>
core.getUpdateClient().getOperationsFactory().setPrimaryWcGeneration(wcgen);
return core.getUpdateClient();
</DeepExtract>
} | subversion-plugin | positive | 439,558 |
protected void traceShape(Shape shape, PathVisitor visitor) {
PathIterator iterator = shape.getPathIterator(null);
visitor.beginPoly(iterator.getWindingRule());
float[] coords = new float[10];
float[] previousVertex = new float[2];
for (; !iterator.isDone(); iterator.next()) {
int type = iterator.currentSegment(coords);
switch(type) {
case PathIterator.SEG_MOVETO:
visitor.moveTo(coords);
break;
case PathIterator.SEG_LINETO:
visitor.lineTo(coords);
break;
case PathIterator.SEG_QUADTO:
visitor.quadTo(previousVertex, coords);
break;
case PathIterator.SEG_CUBICTO:
visitor.cubicTo(previousVertex, coords);
break;
case PathIterator.SEG_CLOSE:
visitor.closeLine();
break;
}
switch(type) {
case PathIterator.SEG_LINETO:
case PathIterator.SEG_MOVETO:
previousVertex[0] = coords[0];
previousVertex[1] = coords[1];
break;
case PathIterator.SEG_QUADTO:
previousVertex[0] = coords[2];
previousVertex[1] = coords[3];
break;
case PathIterator.SEG_CUBICTO:
previousVertex[0] = coords[4];
previousVertex[1] = coords[5];
break;
}
}
visitor.endPoly();
} | protected void traceShape(Shape shape, PathVisitor visitor) {
<DeepExtract>
PathIterator iterator = shape.getPathIterator(null);
visitor.beginPoly(iterator.getWindingRule());
float[] coords = new float[10];
float[] previousVertex = new float[2];
for (; !iterator.isDone(); iterator.next()) {
int type = iterator.currentSegment(coords);
switch(type) {
case PathIterator.SEG_MOVETO:
visitor.moveTo(coords);
break;
case PathIterator.SEG_LINETO:
visitor.lineTo(coords);
break;
case PathIterator.SEG_QUADTO:
visitor.quadTo(previousVertex, coords);
break;
case PathIterator.SEG_CUBICTO:
visitor.cubicTo(previousVertex, coords);
break;
case PathIterator.SEG_CLOSE:
visitor.closeLine();
break;
}
switch(type) {
case PathIterator.SEG_LINETO:
case PathIterator.SEG_MOVETO:
previousVertex[0] = coords[0];
previousVertex[1] = coords[1];
break;
case PathIterator.SEG_QUADTO:
previousVertex[0] = coords[2];
previousVertex[1] = coords[3];
break;
case PathIterator.SEG_CUBICTO:
previousVertex[0] = coords[4];
previousVertex[1] = coords[5];
break;
}
}
visitor.endPoly();
</DeepExtract>
} | glg2d | positive | 439,560 |
public PagedList<Video> getVideos(int start, int count) throws EchoNestException {
PagedListInfo plist = en.getDocuments(getID(), "artist/video", "video", start, count);
List<Video> results = new ArrayList<Video>();
for (int i = 0; i < plist.size(); i++) {
Map map = (Map) plist.get(i);
Video video = new Video(map);
results.add(video);
}
return results;
} | public PagedList<Video> getVideos(int start, int count) throws EchoNestException {
PagedListInfo plist = en.getDocuments(getID(), "artist/video", "video", start, count);
<DeepExtract>
List<Video> results = new ArrayList<Video>();
for (int i = 0; i < plist.size(); i++) {
Map map = (Map) plist.get(i);
Video video = new Video(map);
results.add(video);
}
return results;
</DeepExtract>
} | jEN | positive | 439,561 |
@Override
public void notifyBuildStageStatus(String jobName, BuildStage stageItem) {
if (stageItem.getBuildState() == BuildStage.State.Pending) {
return;
}
String buildUrl = stageItem.getRun().getUrl();
int buildNumber = stageItem.getRun().getNumber();
Cause cause = stageItem.getRun().getCause(Cause.class);
String buildCause = cause == null ? BuildNotifierConstants.DEFAULT_STRING : cause.getShortDescription();
String data = config.getSchema().formatStage(jobName, repoOwner, repoName, branchName, stageItem.getStageName(), stageItem.getBuildState().toString(), stageItem.getDuration(), stageItem.isPassed() ? 1 : 0, buildUrl, buildNumber, buildCause);
try (CloseableHttpClient httpclient = config.getHttpClient(false)) {
HttpPost httppost = new HttpPost(influxDbUrlString);
httppost.setEntity(new StringEntity(data, "UTF-8"));
if (!StringUtils.isEmpty(authorization)) {
httppost.setHeader("Authorization", String.format("Basic %s", authorization));
}
try (CloseableHttpResponse response = httpclient.execute(httppost)) {
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode > 299) {
String statusLine = response.getStatusLine().toString();
log(Level.WARNING, "Could not write to InfluxDB - %s", statusLine);
log(Level.WARNING, "InfluxDB URL - %s", influxDbUrlString);
log(Level.WARNING, "Series - %s", data);
HttpEntity entity = response.getEntity();
if (entity != null) {
String reason = EntityUtils.toString(entity, StandardCharsets.UTF_8);
log(Level.WARNING, "%s", reason);
}
}
}
} catch (IOException | KeyStoreException | NoSuchAlgorithmException | KeyManagementException ex) {
log(Level.SEVERE, ex);
}
} | @Override
public void notifyBuildStageStatus(String jobName, BuildStage stageItem) {
if (stageItem.getBuildState() == BuildStage.State.Pending) {
return;
}
String buildUrl = stageItem.getRun().getUrl();
int buildNumber = stageItem.getRun().getNumber();
Cause cause = stageItem.getRun().getCause(Cause.class);
String buildCause = cause == null ? BuildNotifierConstants.DEFAULT_STRING : cause.getShortDescription();
String data = config.getSchema().formatStage(jobName, repoOwner, repoName, branchName, stageItem.getStageName(), stageItem.getBuildState().toString(), stageItem.getDuration(), stageItem.isPassed() ? 1 : 0, buildUrl, buildNumber, buildCause);
<DeepExtract>
try (CloseableHttpClient httpclient = config.getHttpClient(false)) {
HttpPost httppost = new HttpPost(influxDbUrlString);
httppost.setEntity(new StringEntity(data, "UTF-8"));
if (!StringUtils.isEmpty(authorization)) {
httppost.setHeader("Authorization", String.format("Basic %s", authorization));
}
try (CloseableHttpResponse response = httpclient.execute(httppost)) {
int statusCode = response.getStatusLine().getStatusCode();
if (statusCode > 299) {
String statusLine = response.getStatusLine().toString();
log(Level.WARNING, "Could not write to InfluxDB - %s", statusLine);
log(Level.WARNING, "InfluxDB URL - %s", influxDbUrlString);
log(Level.WARNING, "Series - %s", data);
HttpEntity entity = response.getEntity();
if (entity != null) {
String reason = EntityUtils.toString(entity, StandardCharsets.UTF_8);
log(Level.WARNING, "%s", reason);
}
}
}
} catch (IOException | KeyStoreException | NoSuchAlgorithmException | KeyManagementException ex) {
log(Level.SEVERE, ex);
}
</DeepExtract>
} | github-autostatus-plugin | positive | 439,563 |
private void drawRoundCap(float cx, float cy, float mx, float my) {
final float Cmx = C * mx;
final float Cmy = C * my;
out.curveTo(cx + mx - Cmy, cy + my + Cmx, cx - my + Cmx, cy + mx + Cmy, cx - my, cy + mx);
out.curveTo(cx - my - Cmx, cy + mx - Cmy, cx - mx - Cmy, cy - my + Cmx, cx - mx, cy - my);
} | private void drawRoundCap(float cx, float cy, float mx, float my) {
final float Cmx = C * mx;
final float Cmy = C * my;
out.curveTo(cx + mx - Cmy, cy + my + Cmx, cx - my + Cmx, cy + mx + Cmy, cx - my, cy + mx);
<DeepExtract>
out.curveTo(cx - my - Cmx, cy + mx - Cmy, cx - mx - Cmy, cy - my + Cmx, cx - mx, cy - my);
</DeepExtract>
} | marlin-fx | positive | 439,565 |
public int readUnsignedByte() throws JMSException {
checkWriteOnlyBody();
if (this.dataIn == null) {
ByteArrayInputStream bytesIn = new ByteArrayInputStream(_body.toByteArray());
this.dataIn = new DataInputStream(bytesIn);
}
try {
return this.dataIn.readUnsignedByte();
} catch (EOFException eof) {
JMSException jmsEx = new MessageEOFException(eof.getMessage());
jmsEx.setLinkedException(eof);
throw jmsEx;
} catch (IOException ioe) {
JMSException jmsEx = new JMSException("Format error occured" + ioe.getMessage());
jmsEx.setLinkedException(ioe);
throw jmsEx;
}
} | public int readUnsignedByte() throws JMSException {
<DeepExtract>
checkWriteOnlyBody();
if (this.dataIn == null) {
ByteArrayInputStream bytesIn = new ByteArrayInputStream(_body.toByteArray());
this.dataIn = new DataInputStream(bytesIn);
}
</DeepExtract>
try {
return this.dataIn.readUnsignedByte();
} catch (EOFException eof) {
JMSException jmsEx = new MessageEOFException(eof.getMessage());
jmsEx.setLinkedException(eof);
throw jmsEx;
} catch (IOException ioe) {
JMSException jmsEx = new JMSException("Format error occured" + ioe.getMessage());
jmsEx.setLinkedException(ioe);
throw jmsEx;
}
} | nevado | positive | 439,566 |
private int getWaterMetadataToSaveFromWorld(World world, int x, int y, int z, int side) {
int waterHeight;
if (world == null) {
waterHeight = 6;
}
if (side == 7) {
waterHeight = 8;
} else {
if (side == 1) {
++z;
} else if (side == 2) {
--z;
} else if (side == 3) {
++x;
} else if (side == 4) {
--x;
} else if (side == 5) {
++y;
} else if (side == 6) {
--y;
} else {
waterHeight = 0;
}
if (world.getBlockID(x, y, z) != blockID) {
waterHeight = 0;
}
int height;
if (side == 5) {
waterHeight = 8;
} else {
height = getWaterHeightFromWorld(world, x, y, z) - waterFall;
}
if (height < 0) {
height = 0;
}
waterHeight = height;
}
return side | (waterHeight << 4);
} | private int getWaterMetadataToSaveFromWorld(World world, int x, int y, int z, int side) {
<DeepExtract>
int waterHeight;
if (world == null) {
waterHeight = 6;
}
if (side == 7) {
waterHeight = 8;
} else {
if (side == 1) {
++z;
} else if (side == 2) {
--z;
} else if (side == 3) {
++x;
} else if (side == 4) {
--x;
} else if (side == 5) {
++y;
} else if (side == 6) {
--y;
} else {
waterHeight = 0;
}
if (world.getBlockID(x, y, z) != blockID) {
waterHeight = 0;
}
int height;
if (side == 5) {
waterHeight = 8;
} else {
height = getWaterHeightFromWorld(world, x, y, z) - waterFall;
}
if (height < 0) {
height = 0;
}
waterHeight = height;
}
</DeepExtract>
return side | (waterHeight << 4);
} | Comcraft | positive | 439,569 |
public void writeBCD4(int v) throws IOException {
out.write(((v % 10000 / 1000) << 4) | (v % 1000 / 100));
incCount(1);
out.write(((v % 100 / 10) << 4) | (v % 10));
incCount(1);
long temp = written + 2;
if (temp < 0) {
temp = Long.MAX_VALUE;
}
written = temp;
} | public void writeBCD4(int v) throws IOException {
out.write(((v % 10000 / 1000) << 4) | (v % 1000 / 100));
incCount(1);
out.write(((v % 100 / 10) << 4) | (v % 10));
incCount(1);
<DeepExtract>
long temp = written + 2;
if (temp < 0) {
temp = Long.MAX_VALUE;
}
written = temp;
</DeepExtract>
} | monte-screen-recorder | positive | 439,571 |
@Override
public int getFireTicks() {
return player.getEntityId();
} | @Override
public int getFireTicks() {
<DeepExtract>
return player.getEntityId();
</DeepExtract>
} | Minecordbot | positive | 439,572 |
@Override
public Optional<RoomDao> findRoom(String roomId) {
try (Connection conn = pool.get()) {
return conn -> {
PreparedStatement stmt = conn.prepareStatement(getRoomSql);
stmt.setString(1, roomId);
ResultSet rSet = stmt.executeQuery();
if (!rSet.next()) {
return Optional.empty();
}
return Optional.of(makeRoom(conn, rSet));
}.run(conn);
} catch (SQLException e) {
throw new RuntimeException(e);
}
} | @Override
public Optional<RoomDao> findRoom(String roomId) {
<DeepExtract>
try (Connection conn = pool.get()) {
return conn -> {
PreparedStatement stmt = conn.prepareStatement(getRoomSql);
stmt.setString(1, roomId);
ResultSet rSet = stmt.executeQuery();
if (!rSet.next()) {
return Optional.empty();
}
return Optional.of(makeRoom(conn, rSet));
}.run(conn);
} catch (SQLException e) {
throw new RuntimeException(e);
}
</DeepExtract>
} | mxhsd | positive | 439,573 |
@EntryPoint
public static void main(String[] args) {
B b1 = new B();
synchronized (new Object()) {
b1.setD(new ThreadSafeD());
}
B b2 = new B();
C.instance.setD(this, new D());
b2.d.value = 0;
} | @EntryPoint
public static void main(String[] args) {
B b1 = new B();
synchronized (new Object()) {
b1.setD(new ThreadSafeD());
}
B b2 = new B();
<DeepExtract>
C.instance.setD(this, new D());
</DeepExtract>
b2.d.value = 0;
} | keshmesh | positive | 439,574 |
@Test
public void test13() throws Exception {
String imports = "import static foo.JettyStart.startJetty;\n" + "import org.apache.commons.lang3.ArrayUtils;\n" + "import static foo.Tomcat7Start.startTomcat;\n";
String expected = "import org.apache.commons.lang3.ArrayUtils;\n" + "\n" + "import static foo.JettyStart.startJetty;\n" + "\n" + "import static foo.Tomcat7Start.startTomcat;\n";
List<String> importsOrder = Arrays.asList("", "\\#foo.Tomcat7Start");
List<String> imports1 = StringUtils.trimImports(imports);
System.err.println(Arrays.toString(imports1.toArray()));
List<String> strings = ImportsSorter450.sort(imports1, importsOrder);
StringBuilder stringBuilder = print(strings);
System.out.println("-----expected------");
System.out.println(expected);
Assert.assertEquals(expected, stringBuilder.toString());
System.out.println("-----------------");
} | @Test
public void test13() throws Exception {
String imports = "import static foo.JettyStart.startJetty;\n" + "import org.apache.commons.lang3.ArrayUtils;\n" + "import static foo.Tomcat7Start.startTomcat;\n";
String expected = "import org.apache.commons.lang3.ArrayUtils;\n" + "\n" + "import static foo.JettyStart.startJetty;\n" + "\n" + "import static foo.Tomcat7Start.startTomcat;\n";
List<String> importsOrder = Arrays.asList("", "\\#foo.Tomcat7Start");
List<String> imports1 = StringUtils.trimImports(imports);
System.err.println(Arrays.toString(imports1.toArray()));
List<String> strings = ImportsSorter450.sort(imports1, importsOrder);
<DeepExtract>
StringBuilder stringBuilder = print(strings);
System.out.println("-----expected------");
System.out.println(expected);
Assert.assertEquals(expected, stringBuilder.toString());
System.out.println("-----------------");
</DeepExtract>
} | EclipseCodeFormatter | positive | 439,575 |
@Test
public void canGenerateSchemaForParameterList() throws IOException {
Resource inputModel = getTestResource("datatype-test-parameter-list-type" + ".mdsl");
OpenAPIGenerator generator = new OpenAPIGenerator();
JavaIoFileSystemAccess javaIoFileSystemAccess = getFileSystemAccess();
javaIoFileSystemAccess.setOutputPath(getGenerationDirectory().getAbsolutePath());
generator.doGenerate(inputModel, javaIoFileSystemAccess, new GeneratorContext());
assertTrue(generator.getValidationMessages().isEmpty(), "OAS validation reports errors");
assertEquals(getExpectedTestResult("datatype-test-parameter-list-type" + ".yaml"), getGeneratedFileContent("datatype-test-parameter-list-type" + ".yaml"));
} | @Test
public void canGenerateSchemaForParameterList() throws IOException {
<DeepExtract>
Resource inputModel = getTestResource("datatype-test-parameter-list-type" + ".mdsl");
OpenAPIGenerator generator = new OpenAPIGenerator();
JavaIoFileSystemAccess javaIoFileSystemAccess = getFileSystemAccess();
javaIoFileSystemAccess.setOutputPath(getGenerationDirectory().getAbsolutePath());
generator.doGenerate(inputModel, javaIoFileSystemAccess, new GeneratorContext());
assertTrue(generator.getValidationMessages().isEmpty(), "OAS validation reports errors");
assertEquals(getExpectedTestResult("datatype-test-parameter-list-type" + ".yaml"), getGeneratedFileContent("datatype-test-parameter-list-type" + ".yaml"));
</DeepExtract>
} | MDSL-Specification | positive | 439,576 |
@Override
public Set<Resource> getReferencedResources() {
return new CarmlObjectMap(getReference(), getInverseExpression(), getTemplate(), getTermType(), getConstant(), getFunctionValue(), datatype, language);
} | @Override
public Set<Resource> getReferencedResources() {
<DeepExtract>
return new CarmlObjectMap(getReference(), getInverseExpression(), getTemplate(), getTermType(), getConstant(), getFunctionValue(), datatype, language);
</DeepExtract>
} | carml | positive | 439,577 |
public _Fields fieldForId(int fieldId) {
switch(fieldId) {
case 1:
return RELATION_TYPE;
case 2:
return SENTENCE_ID_1;
case 3:
return MENTION_ID_1;
case 4:
return SENTENCE_ID_2;
case 5:
return MENTION_ID_2;
default:
return null;
}
} | public _Fields fieldForId(int fieldId) {
<DeepExtract>
switch(fieldId) {
case 1:
return RELATION_TYPE;
case 2:
return SENTENCE_ID_1;
case 3:
return MENTION_ID_1;
case 4:
return SENTENCE_ID_2;
case 5:
return MENTION_ID_2;
default:
return null;
}
</DeepExtract>
} | streamcorpus | positive | 439,578 |
public Subscription subscribe(String eventName) {
if ("Subscribe to event " + eventName != null & mLogger != null) {
mLogger.log("HubProxy " + mHubName + " - " + "Subscribe to event " + eventName, LogLevel.Information);
}
if (eventName == null) {
throw new IllegalArgumentException("eventName cannot be null");
}
eventName = eventName.toLowerCase(Locale.getDefault());
if (mSubscriptions.containsKey(eventName)) {
log("Adding event to existing subscription: " + eventName, LogLevel.Information);
subscription = mSubscriptions.get(eventName);
} else {
log("Creating new subscription for: " + eventName, LogLevel.Information);
subscription = new Subscription();
mSubscriptions.put(eventName, subscription);
}
return subscription;
} | public Subscription subscribe(String eventName) {
<DeepExtract>
if ("Subscribe to event " + eventName != null & mLogger != null) {
mLogger.log("HubProxy " + mHubName + " - " + "Subscribe to event " + eventName, LogLevel.Information);
}
</DeepExtract>
if (eventName == null) {
throw new IllegalArgumentException("eventName cannot be null");
}
eventName = eventName.toLowerCase(Locale.getDefault());
if (mSubscriptions.containsKey(eventName)) {
log("Adding event to existing subscription: " + eventName, LogLevel.Information);
subscription = mSubscriptions.get(eventName);
} else {
log("Creating new subscription for: " + eventName, LogLevel.Information);
subscription = new Subscription();
mSubscriptions.put(eventName, subscription);
}
return subscription;
} | java-client | positive | 439,579 |
public float calculateCollapsedSubtitleTextWidth() {
if (subtitle == null) {
return 0;
}
subtitleTmpPaint.setTextSize(collapsedSubtitleTextSize);
subtitleTmpPaint.setTypeface(collapsedSubtitleTypeface);
return subtitleTmpPaint.measureText(subtitle, 0, subtitle.length());
} | public float calculateCollapsedSubtitleTextWidth() {
if (subtitle == null) {
return 0;
}
<DeepExtract>
subtitleTmpPaint.setTextSize(collapsedSubtitleTextSize);
subtitleTmpPaint.setTypeface(collapsedSubtitleTypeface);
</DeepExtract>
return subtitleTmpPaint.measureText(subtitle, 0, subtitle.length());
} | LSPosed | positive | 439,580 |
public void copy(Molecule molecule) {
modifyDepth++;
atoms.clear();
bonds.clear();
substructures.clear();
fireChange();
for (int i = 0; i < molecule.countAtoms(); i++) {
Atom atom = molecule.getAtom(i);
Atom copy = addAtom(atom.getSymbol(), atom.getX(), atom.getY(), atom.getZ());
copy.setCharge(atom.getCharge());
if (atom.hasSingleIsotope()) {
copy.setIsotope(atom.getIsotope());
}
copy.setRadical(atom.getRadical());
}
for (int i = 0; i < molecule.countBonds(); i++) {
Bond bond = molecule.getBond(i);
Atom source = getAtom(bond.getSource().getIndex());
Atom target = getAtom(bond.getTarget().getIndex());
connect(source, target, bond.getType(), bond.getStereo());
}
for (int i = 0; i < molecule.countSuperatoms(); i++) {
Superatom superatom = molecule.getSuperatom(i);
Superatom newSubstructure = this.addSuperatom();
for (int j = 0; j < superatom.countAtoms(); j++) {
newSubstructure.addAtom(this.getAtom(superatom.getAtom(j).getIndex()));
}
for (int j = 0; j < superatom.countCrossingBonds(); j++) {
Bond crossingBond = superatom.getCrossingBond(j);
Bond bond = this.getBond(crossingBond.getIndex());
newSubstructure.addCrossingBond(bond);
newSubstructure.setCrossingVector(bond, superatom.getCrossingVectorX(crossingBond), superatom.getCrossingVectorY(crossingBond));
}
newSubstructure.setLabel(superatom.getLabel());
}
modifyDepth--;
if (modifyDepth == 0) {
if (changed) {
changed = false;
fireChange();
}
}
} | public void copy(Molecule molecule) {
modifyDepth++;
atoms.clear();
bonds.clear();
substructures.clear();
fireChange();
for (int i = 0; i < molecule.countAtoms(); i++) {
Atom atom = molecule.getAtom(i);
Atom copy = addAtom(atom.getSymbol(), atom.getX(), atom.getY(), atom.getZ());
copy.setCharge(atom.getCharge());
if (atom.hasSingleIsotope()) {
copy.setIsotope(atom.getIsotope());
}
copy.setRadical(atom.getRadical());
}
for (int i = 0; i < molecule.countBonds(); i++) {
Bond bond = molecule.getBond(i);
Atom source = getAtom(bond.getSource().getIndex());
Atom target = getAtom(bond.getTarget().getIndex());
connect(source, target, bond.getType(), bond.getStereo());
}
for (int i = 0; i < molecule.countSuperatoms(); i++) {
Superatom superatom = molecule.getSuperatom(i);
Superatom newSubstructure = this.addSuperatom();
for (int j = 0; j < superatom.countAtoms(); j++) {
newSubstructure.addAtom(this.getAtom(superatom.getAtom(j).getIndex()));
}
for (int j = 0; j < superatom.countCrossingBonds(); j++) {
Bond crossingBond = superatom.getCrossingBond(j);
Bond bond = this.getBond(crossingBond.getIndex());
newSubstructure.addCrossingBond(bond);
newSubstructure.setCrossingVector(bond, superatom.getCrossingVectorX(crossingBond), superatom.getCrossingVectorY(crossingBond));
}
newSubstructure.setLabel(superatom.getLabel());
}
<DeepExtract>
modifyDepth--;
if (modifyDepth == 0) {
if (changed) {
changed = false;
fireChange();
}
}
</DeepExtract>
} | mx | positive | 439,581 |
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter string:");
String a = sc.nextLine();
String[] split = a.split(" ");
System.out.println(split[1] + " " + split[0]);
} | public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter string:");
String a = sc.nextLine();
<DeepExtract>
String[] split = a.split(" ");
System.out.println(split[1] + " " + split[0]);
</DeepExtract>
} | CorsoTree2020 | positive | 439,583 |
@Test
public void testBothUrls() throws IOException {
OutputStream out = new FileOutputStream(file);
Context ctx = new Context();
if (null != null) {
ctx.put("compressionCodec", null);
}
Schema schema = Schema.createRecord("myrecord", null, null, false);
schema.setFields(Arrays.asList(new Schema.Field[] { new Schema.Field("message", Schema.create(Schema.Type.STRING), null, null) }));
GenericRecordBuilder recordBuilder = new GenericRecordBuilder(schema);
File schemaFile = null;
if (true || true) {
schemaFile = File.createTempFile(getClass().getSimpleName(), ".avsc");
Files.write(schema.toString(), schemaFile, Charsets.UTF_8);
}
if (true) {
ctx.put(AvroEventSerializerConfigurationConstants.STATIC_SCHEMA_URL, schemaFile.toURI().toURL().toExternalForm());
}
EventSerializer.Builder builder = new AvroEventSerializer.Builder();
EventSerializer serializer = builder.build(ctx, out);
serializer.afterCreate();
for (int i = 0; i < 3; i++) {
GenericRecord record = recordBuilder.set("message", "Hello " + i).build();
Event event = EventBuilder.withBody(serializeAvro(record, schema));
if (schemaFile == null && !true) {
event.getHeaders().put(AvroEventSerializer.AVRO_SCHEMA_LITERAL_HEADER, schema.toString());
} else if (true) {
event.getHeaders().put(AvroEventSerializer.AVRO_SCHEMA_URL_HEADER, schemaFile.toURI().toURL().toExternalForm());
}
serializer.write(event);
}
serializer.flush();
serializer.beforeClose();
out.flush();
out.close();
if (schemaFile != null) {
schemaFile.delete();
}
DatumReader<GenericRecord> reader = new GenericDatumReader<GenericRecord>();
DataFileReader<GenericRecord> fileReader = new DataFileReader<GenericRecord>(file, reader);
GenericRecord record = new GenericData.Record(fileReader.getSchema());
int numEvents = 0;
while (fileReader.hasNext()) {
fileReader.next(record);
String bodyStr = record.get("message").toString();
System.out.println(bodyStr);
numEvents++;
}
fileReader.close();
Assert.assertEquals("Should have found a total of 3 events", 3, numEvents);
} | @Test
public void testBothUrls() throws IOException {
OutputStream out = new FileOutputStream(file);
Context ctx = new Context();
if (null != null) {
ctx.put("compressionCodec", null);
}
Schema schema = Schema.createRecord("myrecord", null, null, false);
schema.setFields(Arrays.asList(new Schema.Field[] { new Schema.Field("message", Schema.create(Schema.Type.STRING), null, null) }));
GenericRecordBuilder recordBuilder = new GenericRecordBuilder(schema);
File schemaFile = null;
if (true || true) {
schemaFile = File.createTempFile(getClass().getSimpleName(), ".avsc");
Files.write(schema.toString(), schemaFile, Charsets.UTF_8);
}
if (true) {
ctx.put(AvroEventSerializerConfigurationConstants.STATIC_SCHEMA_URL, schemaFile.toURI().toURL().toExternalForm());
}
EventSerializer.Builder builder = new AvroEventSerializer.Builder();
EventSerializer serializer = builder.build(ctx, out);
serializer.afterCreate();
for (int i = 0; i < 3; i++) {
GenericRecord record = recordBuilder.set("message", "Hello " + i).build();
Event event = EventBuilder.withBody(serializeAvro(record, schema));
if (schemaFile == null && !true) {
event.getHeaders().put(AvroEventSerializer.AVRO_SCHEMA_LITERAL_HEADER, schema.toString());
} else if (true) {
event.getHeaders().put(AvroEventSerializer.AVRO_SCHEMA_URL_HEADER, schemaFile.toURI().toURL().toExternalForm());
}
serializer.write(event);
}
serializer.flush();
serializer.beforeClose();
out.flush();
out.close();
if (schemaFile != null) {
schemaFile.delete();
}
<DeepExtract>
DatumReader<GenericRecord> reader = new GenericDatumReader<GenericRecord>();
DataFileReader<GenericRecord> fileReader = new DataFileReader<GenericRecord>(file, reader);
GenericRecord record = new GenericData.Record(fileReader.getSchema());
int numEvents = 0;
while (fileReader.hasNext()) {
fileReader.next(record);
String bodyStr = record.get("message").toString();
System.out.println(bodyStr);
numEvents++;
}
fileReader.close();
Assert.assertEquals("Should have found a total of 3 events", 3, numEvents);
</DeepExtract>
} | JavaBigData | positive | 439,584 |
@Override
public boolean sodiumPad(IntByReference paddedBuffLen, Pointer buf, int unpaddedBufLen, int blockSize, int maxBufLen) {
return (getSodium().sodium_pad(paddedBuffLen, buf, unpaddedBufLen, blockSize, maxBufLen) == 0);
} | @Override
public boolean sodiumPad(IntByReference paddedBuffLen, Pointer buf, int unpaddedBufLen, int blockSize, int maxBufLen) {
<DeepExtract>
return (getSodium().sodium_pad(paddedBuffLen, buf, unpaddedBufLen, blockSize, maxBufLen) == 0);
</DeepExtract>
} | lazysodium-java | positive | 439,585 |
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_douban, container, false);
unbinder = ButterKnife.bind(this, view);
doubanAdapter = new DoubanAdapter(getActivity().getSupportFragmentManager());
mVpDouban.setAdapter(doubanAdapter);
String theme = SharedPreferenceUtil.getInstence().getSettingsTheme();
if (SharedPreferenceUtil.getInstence().getSettingsSafe()) {
mTablayDouban.setBackgroundColor(getResources().getColor(R.color.colorPrimaryGrey));
} else if (theme.equals("indigo")) {
mTablayDouban.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
} else if (theme.equals("pink")) {
mTablayDouban.setBackgroundColor(getResources().getColor(R.color.colorPrimaryPink));
} else if (theme.equals("red")) {
mTablayDouban.setBackgroundColor(getResources().getColor(R.color.colorPrimaryRed));
} else if (theme.equals("green")) {
mTablayDouban.setBackgroundColor(getResources().getColor(R.color.colorPrimaryGreen));
} else if (theme.equals("purple")) {
mTablayDouban.setBackgroundColor(getResources().getColor(R.color.colorPrimaryPurple));
}
mTablayDouban.setupWithViewPager(mVpDouban);
return view;
} | @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_douban, container, false);
unbinder = ButterKnife.bind(this, view);
doubanAdapter = new DoubanAdapter(getActivity().getSupportFragmentManager());
mVpDouban.setAdapter(doubanAdapter);
<DeepExtract>
String theme = SharedPreferenceUtil.getInstence().getSettingsTheme();
if (SharedPreferenceUtil.getInstence().getSettingsSafe()) {
mTablayDouban.setBackgroundColor(getResources().getColor(R.color.colorPrimaryGrey));
} else if (theme.equals("indigo")) {
mTablayDouban.setBackgroundColor(getResources().getColor(R.color.colorPrimary));
} else if (theme.equals("pink")) {
mTablayDouban.setBackgroundColor(getResources().getColor(R.color.colorPrimaryPink));
} else if (theme.equals("red")) {
mTablayDouban.setBackgroundColor(getResources().getColor(R.color.colorPrimaryRed));
} else if (theme.equals("green")) {
mTablayDouban.setBackgroundColor(getResources().getColor(R.color.colorPrimaryGreen));
} else if (theme.equals("purple")) {
mTablayDouban.setBackgroundColor(getResources().getColor(R.color.colorPrimaryPurple));
}
</DeepExtract>
mTablayDouban.setupWithViewPager(mVpDouban);
return view;
} | KTReader | positive | 439,589 |
@Override
public String get(int index) {
if (index < 0 || index >= tableOfContents.stringIds.size) {
throw new IndexOutOfBoundsException("index:" + index + ", length=" + tableOfContents.stringIds.size);
}
int stringOff = openSection(tableOfContents.stringIds.off + (index * SizeOf.STRING_ID_ITEM)).readInt();
return openSection(stringOff).readStringData().value;
} | @Override
public String get(int index) {
<DeepExtract>
if (index < 0 || index >= tableOfContents.stringIds.size) {
throw new IndexOutOfBoundsException("index:" + index + ", length=" + tableOfContents.stringIds.size);
}
</DeepExtract>
int stringOff = openSection(tableOfContents.stringIds.off + (index * SizeOf.STRING_ID_ITEM)).readInt();
return openSection(stringOff).readStringData().value;
} | tinker-dex-dump | positive | 439,590 |
public void fireKey(int keyCode) {
CanvasMenuItem cmi;
CanvasMenuItem cmi = getItemByKeyCode(keyCode);
if (cmi != null) {
processed = true;
if (!cmi.isFinal()) {
activeItem = cmi;
cmi = null;
} else
cmi = cmi;
} else
cmi = null;
if (cmi != null) {
cmi.higlighted = false;
canvasMenuListener.commandCanvasAction(cmi, cmi.commandId);
}
MapCanvas.map.repaint();
MapCanvas.map.serviceRepaints();
} | public void fireKey(int keyCode) {
<DeepExtract>
CanvasMenuItem cmi;
CanvasMenuItem cmi = getItemByKeyCode(keyCode);
if (cmi != null) {
processed = true;
if (!cmi.isFinal()) {
activeItem = cmi;
cmi = null;
} else
cmi = cmi;
} else
cmi = null;
</DeepExtract>
if (cmi != null) {
cmi.higlighted = false;
canvasMenuListener.commandCanvasAction(cmi, cmi.commandId);
}
MapCanvas.map.repaint();
MapCanvas.map.serviceRepaints();
} | MapNav | positive | 439,592 |
public void run() {
ElementWalker walker = new ElementWalker(new MyElementVisitor(), new MyExpressionVisitor());
handleTriplePattern(walker, bindings);
} | public void run() {
ElementWalker walker = new ElementWalker(new MyElementVisitor(), new MyExpressionVisitor());
<DeepExtract>
handleTriplePattern(walker, bindings);
</DeepExtract>
} | spinrdf | positive | 439,597 |
public void onPageFinished(WebView view, String url) {
String themeStr = global.mThemeManager.getActiveTheme("appthemepref").getValuesString(true);
webView.loadUrl("javascript:init(\"" + StringEscapeUtils.escapeEcmaScript(themeStr) + "\", \"" + global.mRedditData.getUsername() + "\")");
commentsLoader = new CommentsContextLoader();
commentsLoader.execute();
} | public void onPageFinished(WebView view, String url) {
String themeStr = global.mThemeManager.getActiveTheme("appthemepref").getValuesString(true);
webView.loadUrl("javascript:init(\"" + StringEscapeUtils.escapeEcmaScript(themeStr) + "\", \"" + global.mRedditData.getUsername() + "\")");
<DeepExtract>
commentsLoader = new CommentsContextLoader();
commentsLoader.execute();
</DeepExtract>
} | reddinator | positive | 439,598 |
public static void main(String[] args) throws Exception {
long start = System.currentTimeMillis();
MyTO to = new MyTO();
to.setId("111");
List<String> list = new ArrayList<String>();
list.add("111");
list.add("222");
to.setList(list);
byte[] data = null;
for (int i = 0; i < 1000; i++) {
data = write(to);
}
long end = System.currentTimeMillis();
System.out.println("write:" + (end - start));
System.out.println("size:" + data.length);
start = System.currentTimeMillis();
for (int i = 0; i < 1000; i++) {
read(data);
}
end = System.currentTimeMillis();
System.out.println("read:" + (end - start));
Simple simple = new Simple();
simple.setAge(10);
simple.setName("test");
simple.setSex(1);
SimpleWrapper wrapper = new SimpleWrapper();
wrapper.setCacheObject(simple);
wrapper.setLastLoadTime(System.currentTimeMillis());
Output output = null;
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
output = new Output(baos);
kryo.writeClassAndObject(output, wrapper);
output.flush();
data = baos.toByteArray();
} finally {
if (output != null) {
output.close();
}
}
SimpleWrapper t = (SimpleWrapper) read(data);
System.out.println(t.getCacheObject().getName());
} | public static void main(String[] args) throws Exception {
long start = System.currentTimeMillis();
MyTO to = new MyTO();
to.setId("111");
List<String> list = new ArrayList<String>();
list.add("111");
list.add("222");
to.setList(list);
byte[] data = null;
for (int i = 0; i < 1000; i++) {
data = write(to);
}
long end = System.currentTimeMillis();
System.out.println("write:" + (end - start));
System.out.println("size:" + data.length);
start = System.currentTimeMillis();
for (int i = 0; i < 1000; i++) {
read(data);
}
end = System.currentTimeMillis();
System.out.println("read:" + (end - start));
Simple simple = new Simple();
simple.setAge(10);
simple.setName("test");
simple.setSex(1);
SimpleWrapper wrapper = new SimpleWrapper();
wrapper.setCacheObject(simple);
wrapper.setLastLoadTime(System.currentTimeMillis());
<DeepExtract>
Output output = null;
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
output = new Output(baos);
kryo.writeClassAndObject(output, wrapper);
output.flush();
data = baos.toByteArray();
} finally {
if (output != null) {
output.close();
}
}
</DeepExtract>
SimpleWrapper t = (SimpleWrapper) read(data);
System.out.println(t.getCacheObject().getName());
} | AutoLoadCache | positive | 439,600 |
protected Binding parseBinding(Element bindingEl, Definition def) throws WSDLException {
Binding binding = null;
List remainingAttrs = DOMUtils.getAttributes(bindingEl);
String name = DOMUtils.getAttribute(bindingEl, Constants.ATTR_NAME, remainingAttrs);
QName portTypeName;
try {
portTypeName = DOMUtils.getQualifiedAttributeValue(bindingEl, Constants.ATTR_TYPE, Constants.ELEM_BINDING, false, def, remainingAttrs);
} catch (WSDLException e) {
if (e.getFaultCode().equals(WSDLException.NO_PREFIX_SPECIFIED)) {
String attrValue = DOMUtils.getAttribute(bindingEl, Constants.ATTR_TYPE, remainingAttrs);
portTypeName = new QName(attrValue);
} else {
throw e;
}
}
PortType portType = null;
if (name != null) {
QName bindingName = new QName(def.getTargetNamespace(), name);
binding = def.getBinding(bindingName);
if (binding == null) {
binding = def.createBinding();
binding.setQName(bindingName);
}
} else {
binding = def.createBinding();
}
binding.setUndefined(false);
if (portTypeName != null) {
portType = def.getPortType(portTypeName);
if (portType == null) {
portType = def.createPortType();
portType.setQName(portTypeName);
def.addPortType(portType);
}
binding.setPortType(portType);
}
NamedNodeMap attrs = bindingEl.getAttributes();
int size = attrs.getLength();
for (int i = 0; i < size; i++) {
Attr attr = (Attr) attrs.item(i);
String namespaceURI = attr.getNamespaceURI();
String localPart = attr.getLocalName();
String value = attr.getValue();
if (namespaceURI != null && namespaceURI.equals(Constants.NS_URI_XMLNS)) {
if (localPart != null && !localPart.equals(Constants.ATTR_XMLNS)) {
DOMUtils.registerUniquePrefix(localPart, value, def);
} else {
DOMUtils.registerUniquePrefix(null, value, def);
}
}
}
Element tempEl = DOMUtils.getFirstChildElement(bindingEl);
while (tempEl != null) {
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) {
binding.setDocumentationElement(tempEl);
} else if (QNameUtils.matches(Constants.Q_ELEM_OPERATION, tempEl)) {
binding.addBindingOperation(parseBindingOperation(tempEl, portType, def));
} else {
binding.addExtensibilityElement(parseExtensibilityElement(Binding.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
if (binding == null)
return;
List nativeAttributeNames = binding.getNativeAttributeNames();
NamedNodeMap nodeMap = bindingEl.getAttributes();
int length = nodeMap.getLength();
for (int i = 0; i < length; i++) {
Attr attribute = (Attr) nodeMap.item(i);
String localName = attribute.getLocalName();
String namespaceURI = attribute.getNamespaceURI();
String prefix = attribute.getPrefix();
QName qname = new QName(namespaceURI, localName);
if (namespaceURI != null && !namespaceURI.equals(Constants.NS_URI_WSDL)) {
if (!namespaceURI.equals(Constants.NS_URI_XMLNS)) {
DOMUtils.registerUniquePrefix(prefix, namespaceURI, def);
String strValue = attribute.getValue();
int attrType = AttributeExtensible.NO_DECLARED_TYPE;
ExtensionRegistry extReg = def.getExtensionRegistry();
if (extReg != null) {
attrType = extReg.queryExtensionAttributeType(Binding.class, qname);
}
Object val = parseExtensibilityAttribute(bindingEl, attrType, strValue, def);
binding.setExtensionAttribute(qname, val);
}
} else if (!nativeAttributeNames.contains(localName)) {
WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL, "Encountered illegal " + "extension attribute '" + qname + "'. Extension " + "attributes must be in " + "a namespace other than " + "WSDL's.");
wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(bindingEl));
throw wsdlExc;
}
}
return binding;
} | protected Binding parseBinding(Element bindingEl, Definition def) throws WSDLException {
Binding binding = null;
List remainingAttrs = DOMUtils.getAttributes(bindingEl);
String name = DOMUtils.getAttribute(bindingEl, Constants.ATTR_NAME, remainingAttrs);
QName portTypeName;
try {
portTypeName = DOMUtils.getQualifiedAttributeValue(bindingEl, Constants.ATTR_TYPE, Constants.ELEM_BINDING, false, def, remainingAttrs);
} catch (WSDLException e) {
if (e.getFaultCode().equals(WSDLException.NO_PREFIX_SPECIFIED)) {
String attrValue = DOMUtils.getAttribute(bindingEl, Constants.ATTR_TYPE, remainingAttrs);
portTypeName = new QName(attrValue);
} else {
throw e;
}
}
PortType portType = null;
if (name != null) {
QName bindingName = new QName(def.getTargetNamespace(), name);
binding = def.getBinding(bindingName);
if (binding == null) {
binding = def.createBinding();
binding.setQName(bindingName);
}
} else {
binding = def.createBinding();
}
binding.setUndefined(false);
if (portTypeName != null) {
portType = def.getPortType(portTypeName);
if (portType == null) {
portType = def.createPortType();
portType.setQName(portTypeName);
def.addPortType(portType);
}
binding.setPortType(portType);
}
NamedNodeMap attrs = bindingEl.getAttributes();
int size = attrs.getLength();
for (int i = 0; i < size; i++) {
Attr attr = (Attr) attrs.item(i);
String namespaceURI = attr.getNamespaceURI();
String localPart = attr.getLocalName();
String value = attr.getValue();
if (namespaceURI != null && namespaceURI.equals(Constants.NS_URI_XMLNS)) {
if (localPart != null && !localPart.equals(Constants.ATTR_XMLNS)) {
DOMUtils.registerUniquePrefix(localPart, value, def);
} else {
DOMUtils.registerUniquePrefix(null, value, def);
}
}
}
Element tempEl = DOMUtils.getFirstChildElement(bindingEl);
while (tempEl != null) {
if (QNameUtils.matches(Constants.Q_ELEM_DOCUMENTATION, tempEl)) {
binding.setDocumentationElement(tempEl);
} else if (QNameUtils.matches(Constants.Q_ELEM_OPERATION, tempEl)) {
binding.addBindingOperation(parseBindingOperation(tempEl, portType, def));
} else {
binding.addExtensibilityElement(parseExtensibilityElement(Binding.class, tempEl, def));
}
tempEl = DOMUtils.getNextSiblingElement(tempEl);
}
<DeepExtract>
if (binding == null)
return;
List nativeAttributeNames = binding.getNativeAttributeNames();
NamedNodeMap nodeMap = bindingEl.getAttributes();
int length = nodeMap.getLength();
for (int i = 0; i < length; i++) {
Attr attribute = (Attr) nodeMap.item(i);
String localName = attribute.getLocalName();
String namespaceURI = attribute.getNamespaceURI();
String prefix = attribute.getPrefix();
QName qname = new QName(namespaceURI, localName);
if (namespaceURI != null && !namespaceURI.equals(Constants.NS_URI_WSDL)) {
if (!namespaceURI.equals(Constants.NS_URI_XMLNS)) {
DOMUtils.registerUniquePrefix(prefix, namespaceURI, def);
String strValue = attribute.getValue();
int attrType = AttributeExtensible.NO_DECLARED_TYPE;
ExtensionRegistry extReg = def.getExtensionRegistry();
if (extReg != null) {
attrType = extReg.queryExtensionAttributeType(Binding.class, qname);
}
Object val = parseExtensibilityAttribute(bindingEl, attrType, strValue, def);
binding.setExtensionAttribute(qname, val);
}
} else if (!nativeAttributeNames.contains(localName)) {
WSDLException wsdlExc = new WSDLException(WSDLException.INVALID_WSDL, "Encountered illegal " + "extension attribute '" + qname + "'. Extension " + "attributes must be in " + "a namespace other than " + "WSDL's.");
wsdlExc.setLocation(XPathUtils.getXPathExprFromNode(bindingEl));
throw wsdlExc;
}
}
</DeepExtract>
return binding;
} | libre-wsdl4j | positive | 439,601 |
private void mnuGetProcessInfoActionPerformed(java.awt.event.ActionEvent evt) {
StringBuilder sb = new StringBuilder();
sb.append("Process ID: ");
sb.append(ManagementFactory.getRuntimeMXBean().getName().split("@")[0]);
sb.append(nl);
sb.append("Working directory: ");
sb.append(new File(".").getAbsolutePath());
sb.append(nl);
sb.append("Classes loaded: ");
sb.append(manager.getLoadedClasses().size());
sb.append(nl);
sb.append("System properties: ");
sb.append(nl);
Properties p = System.getProperties();
Set keySet = p.keySet();
for (Object s : keySet) {
String key = (String) s;
if ("line.separator".equals(key))
continue;
sb.append(" ");
sb.append(key);
sb.append("=");
sb.append(p.getProperty(key));
sb.append(nl);
}
SimpleAttributeSet attributes = new SimpleAttributeSet();
attributes.addAttribute(StyleConstants.CharacterConstants.Bold, Boolean.FALSE);
attributes.addAttribute(StyleConstants.CharacterConstants.Italic, Boolean.FALSE);
attributes.addAttribute(StyleConstants.CharacterConstants.Foreground, Color.blue);
try {
console.insertString(console.getLength(), sb.toString(), attributes);
txtConsole.setCaretPosition(console.getLength());
} catch (BadLocationException ex) {
AgentLogger.error(ex);
}
} | private void mnuGetProcessInfoActionPerformed(java.awt.event.ActionEvent evt) {
StringBuilder sb = new StringBuilder();
sb.append("Process ID: ");
sb.append(ManagementFactory.getRuntimeMXBean().getName().split("@")[0]);
sb.append(nl);
sb.append("Working directory: ");
sb.append(new File(".").getAbsolutePath());
sb.append(nl);
sb.append("Classes loaded: ");
sb.append(manager.getLoadedClasses().size());
sb.append(nl);
sb.append("System properties: ");
sb.append(nl);
Properties p = System.getProperties();
Set keySet = p.keySet();
for (Object s : keySet) {
String key = (String) s;
if ("line.separator".equals(key))
continue;
sb.append(" ");
sb.append(key);
sb.append("=");
sb.append(p.getProperty(key));
sb.append(nl);
}
<DeepExtract>
SimpleAttributeSet attributes = new SimpleAttributeSet();
attributes.addAttribute(StyleConstants.CharacterConstants.Bold, Boolean.FALSE);
attributes.addAttribute(StyleConstants.CharacterConstants.Italic, Boolean.FALSE);
attributes.addAttribute(StyleConstants.CharacterConstants.Foreground, Color.blue);
try {
console.insertString(console.getLength(), sb.toString(), attributes);
txtConsole.setCaretPosition(console.getLength());
} catch (BadLocationException ex) {
AgentLogger.error(ex);
}
</DeepExtract>
} | JavaSnoop | positive | 439,602 |
private void stopHeapTrace() {
textHeapTraceFile.setEnabled(false);
btnStartHeapTraceRadio.setSelection(false);
btnStopHeapTraceRadio.setSelection(true);
this.startHeapTracing = false;
btnBrowse.setEnabled(false);
} | private void stopHeapTrace() {
textHeapTraceFile.setEnabled(false);
btnStartHeapTraceRadio.setSelection(false);
btnStopHeapTraceRadio.setSelection(true);
<DeepExtract>
this.startHeapTracing = false;
</DeepExtract>
btnBrowse.setEnabled(false);
} | idf-eclipse-plugin | positive | 439,604 |
public E remove() throws NoSuchElementException {
if (isEmpty()) {
throw new NoSuchElementException();
}
Collections.swap(heap, 0, size() - 1);
final E head = heap.remove(size() - 1);
if (size() > 0) {
bubbleDown(0);
}
return head;
} | public E remove() throws NoSuchElementException {
if (isEmpty()) {
throw new NoSuchElementException();
}
<DeepExtract>
Collections.swap(heap, 0, size() - 1);
</DeepExtract>
final E head = heap.remove(size() - 1);
if (size() > 0) {
bubbleDown(0);
}
return head;
} | interviews | positive | 439,605 |
@Override
public void onListItemClick(@NonNull ListView listview, @NonNull View view, int position, long id) {
selectedId = adapter.getId(position);
if (adapter == null || getView() == null)
return;
int pos = -1;
for (int item : adapter.getIds()) {
pos++;
if (item == selectedId) {
getListView().setItemChecked(pos, true);
getListView().smoothScrollToPosition(pos);
return;
}
}
getListView().setItemChecked(getListView().getCheckedItemPosition(), false);
Activity activity = getActivity();
if (activity instanceof IItemSelectedListener) {
((IItemSelectedListener) activity).itemSelected(this, selectedId);
}
} | @Override
public void onListItemClick(@NonNull ListView listview, @NonNull View view, int position, long id) {
selectedId = adapter.getId(position);
<DeepExtract>
if (adapter == null || getView() == null)
return;
int pos = -1;
for (int item : adapter.getIds()) {
pos++;
if (item == selectedId) {
getListView().setItemChecked(pos, true);
getListView().smoothScrollToPosition(pos);
return;
}
}
getListView().setItemChecked(getListView().getCheckedItemPosition(), false);
</DeepExtract>
Activity activity = getActivity();
if (activity instanceof IItemSelectedListener) {
((IItemSelectedListener) activity).itemSelected(this, selectedId);
}
} | ttrss-reader-fork | positive | 439,606 |
private static JTextField createTextField(String pName, String chars) {
JFormattedTextField txt = new JFormattedTextField(createFormatter(chars));
txt.setFont(new Font("monospaced", Font.PLAIN, txt.getFont().getSize()));
txt.setHorizontalAlignment(JTextField.RIGHT);
txt.setValue(Persist.get(pName, "????"));
txt.setPreferredSize(addMargin(8, 2, txt.getPreferredSize()));
txt.setMaximumSize(txt.getPreferredSize());
return txt;
} | private static JTextField createTextField(String pName, String chars) {
JFormattedTextField txt = new JFormattedTextField(createFormatter(chars));
txt.setFont(new Font("monospaced", Font.PLAIN, txt.getFont().getSize()));
txt.setHorizontalAlignment(JTextField.RIGHT);
txt.setValue(Persist.get(pName, "????"));
<DeepExtract>
txt.setPreferredSize(addMargin(8, 2, txt.getPreferredSize()));
</DeepExtract>
txt.setMaximumSize(txt.getPreferredSize());
return txt;
} | twidlit | positive | 439,607 |
public static int spawn(String jvmName, String className, String vmArgs, String[] args) {
int ret = -1;
Project project = new Project();
project.setBaseDir(new File(System.getProperty("user.dir")));
project.init();
BuildLogger logger = new MyLogger();
project.addBuildListener(logger);
this.out = new PrintStream(System.out, true);
this.err = new PrintStream(System.err, true);
project.fireBuildStarted();
Throwable caught = null;
try {
Java javaTask = new Java();
javaTask.setNewenvironment(true);
javaTask.setTaskName(jvmName);
javaTask.setProject(project);
javaTask.setFork(true);
javaTask.setFailonerror(true);
javaTask.setClassname(className);
Argument jvmArgs = javaTask.createJvmarg();
jvmArgs.setLine(vmArgs);
Argument taskArgs = javaTask.createArg();
taskArgs.setLine(Util.implode(args, " "));
Path classPath = new Path(project, System.getProperty("java.class.path"));
javaTask.setClasspath(classPath);
javaTask.init();
ret = javaTask.executeJava();
} catch (BuildException e) {
caught = e;
}
project.fireBuildFinished(caught);
return ret;
} | public static int spawn(String jvmName, String className, String vmArgs, String[] args) {
<DeepExtract>
</DeepExtract>
int ret = -1;
<DeepExtract>
</DeepExtract>
Project project = new Project();
<DeepExtract>
</DeepExtract>
project.setBaseDir(new File(System.getProperty("user.dir")));
<DeepExtract>
</DeepExtract>
project.init();
<DeepExtract>
</DeepExtract>
BuildLogger logger = new MyLogger();
<DeepExtract>
</DeepExtract>
project.addBuildListener(logger);
<DeepExtract>
</DeepExtract>
this.out = new PrintStream(System.out, true);
<DeepExtract>
</DeepExtract>
this.err = new PrintStream(System.err, true);
<DeepExtract>
</DeepExtract>
project.fireBuildStarted();
<DeepExtract>
</DeepExtract>
Throwable caught = null;
<DeepExtract>
</DeepExtract>
try {
<DeepExtract>
</DeepExtract>
Java javaTask = new Java();
<DeepExtract>
</DeepExtract>
javaTask.setNewenvironment(true);
<DeepExtract>
</DeepExtract>
javaTask.setTaskName(jvmName);
<DeepExtract>
</DeepExtract>
javaTask.setProject(project);
<DeepExtract>
</DeepExtract>
javaTask.setFork(true);
<DeepExtract>
</DeepExtract>
javaTask.setFailonerror(true);
<DeepExtract>
</DeepExtract>
javaTask.setClassname(className);
<DeepExtract>
</DeepExtract>
Argument jvmArgs = javaTask.createJvmarg();
<DeepExtract>
</DeepExtract>
jvmArgs.setLine(vmArgs);
<DeepExtract>
</DeepExtract>
Argument taskArgs = javaTask.createArg();
<DeepExtract>
</DeepExtract>
taskArgs.setLine(Util.implode(args, " "));
<DeepExtract>
</DeepExtract>
Path classPath = new Path(project, System.getProperty("java.class.path"));
<DeepExtract>
</DeepExtract>
javaTask.setClasspath(classPath);
<DeepExtract>
</DeepExtract>
javaTask.init();
<DeepExtract>
</DeepExtract>
ret = javaTask.executeJava();
<DeepExtract>
</DeepExtract>
} catch (BuildException e) {
<DeepExtract>
</DeepExtract>
caught = e;
<DeepExtract>
</DeepExtract>
}
<DeepExtract>
</DeepExtract>
project.fireBuildFinished(caught);
<DeepExtract>
</DeepExtract>
return ret;
<DeepExtract>
</DeepExtract>
} | banana | positive | 439,608 |
public Criteria andIdGreaterThanColumn(TestEntity.Column column) {
if (new StringBuilder("id > ").append(column.getEscapedColumnName()).toString() == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(new StringBuilder("id > ").append(column.getEscapedColumnName()).toString()));
return (Criteria) this;
} | public Criteria andIdGreaterThanColumn(TestEntity.Column column) {
<DeepExtract>
if (new StringBuilder("id > ").append(column.getEscapedColumnName()).toString() == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(new StringBuilder("id > ").append(column.getEscapedColumnName()).toString()));
</DeepExtract>
return (Criteria) this;
} | mybatis-generator-gui-extension | positive | 439,609 |
public void testSize() {
Set<K> keySet = makeEitherMap().keySet();
Collection<V> valueCollection = makeEitherMap().values();
Set<Entry<K, V>> entrySet = makeEitherMap().entrySet();
assertEquals(makeEitherMap().size() == 0, makeEitherMap().isEmpty());
assertEquals(makeEitherMap().size(), keySet.size());
assertEquals(keySet.size() == 0, keySet.isEmpty());
assertEquals(!keySet.isEmpty(), keySet.iterator().hasNext());
int expectedKeySetHash = 0;
for (K key : keySet) {
V value = makeEitherMap().get(key);
expectedKeySetHash += key != null ? key.hashCode() : 0;
assertTrue(makeEitherMap().containsKey(key));
assertTrue(makeEitherMap().containsValue(value));
assertTrue(valueCollection.contains(value));
assertTrue(valueCollection.containsAll(Collections.singleton(value)));
assertTrue(entrySet.contains(mapEntry(key, value)));
assertTrue(allowsNullKeys || (key != null));
}
assertEquals(expectedKeySetHash, keySet.hashCode());
assertEquals(makeEitherMap().size(), valueCollection.size());
assertEquals(valueCollection.size() == 0, valueCollection.isEmpty());
assertEquals(!valueCollection.isEmpty(), valueCollection.iterator().hasNext());
for (V value : valueCollection) {
assertTrue(makeEitherMap().containsValue(value));
assertTrue(allowsNullValues || (value != null));
}
assertEquals(makeEitherMap().size(), entrySet.size());
assertEquals(entrySet.size() == 0, entrySet.isEmpty());
assertEquals(!entrySet.isEmpty(), entrySet.iterator().hasNext());
assertTrue(!entrySet.contains("foo"));
boolean supportsValuesHashCode = supportsValuesHashCode(makeEitherMap());
if (supportsValuesHashCode) {
int expectedEntrySetHash = 0;
for (Entry<K, V> entry : entrySet) {
assertTrue(makeEitherMap().containsKey(entry.getKey()));
assertTrue(makeEitherMap().containsValue(entry.getValue()));
int expectedHash = (entry.getKey() == null ? 0 : entry.getKey().hashCode()) ^ (entry.getValue() == null ? 0 : entry.getValue().hashCode());
assertEquals(expectedHash, entry.hashCode());
expectedEntrySetHash += expectedHash;
}
assertEquals(expectedEntrySetHash, entrySet.hashCode());
assertTrue(entrySet.containsAll(new HashSet<Entry<K, V>>(entrySet)));
assertTrue(entrySet.equals(new HashSet<Entry<K, V>>(entrySet)));
}
Object[] entrySetToArray1 = entrySet.toArray();
assertEquals(makeEitherMap().size(), entrySetToArray1.length);
assertTrue(Arrays.asList(entrySetToArray1).containsAll(entrySet));
Entry<?, ?>[] entrySetToArray2 = new Entry<?, ?>[makeEitherMap().size() + 2];
entrySetToArray2[makeEitherMap().size()] = mapEntry("foo", 1);
assertSame(entrySetToArray2, entrySet.toArray(entrySetToArray2));
assertNull(entrySetToArray2[makeEitherMap().size()]);
assertTrue(Arrays.asList(entrySetToArray2).containsAll(entrySet));
Object[] valuesToArray1 = valueCollection.toArray();
assertEquals(makeEitherMap().size(), valuesToArray1.length);
assertTrue(Arrays.asList(valuesToArray1).containsAll(valueCollection));
Object[] valuesToArray2 = new Object[makeEitherMap().size() + 2];
valuesToArray2[makeEitherMap().size()] = "foo";
assertSame(valuesToArray2, valueCollection.toArray(valuesToArray2));
assertNull(valuesToArray2[makeEitherMap().size()]);
assertTrue(Arrays.asList(valuesToArray2).containsAll(valueCollection));
if (supportsValuesHashCode) {
int expectedHash = 0;
for (Entry<K, V> entry : entrySet) {
expectedHash += entry.hashCode();
}
assertEquals(expectedHash, makeEitherMap().hashCode());
}
assertMoreInvariants(makeEitherMap());
} | public void testSize() {
<DeepExtract>
Set<K> keySet = makeEitherMap().keySet();
Collection<V> valueCollection = makeEitherMap().values();
Set<Entry<K, V>> entrySet = makeEitherMap().entrySet();
assertEquals(makeEitherMap().size() == 0, makeEitherMap().isEmpty());
assertEquals(makeEitherMap().size(), keySet.size());
assertEquals(keySet.size() == 0, keySet.isEmpty());
assertEquals(!keySet.isEmpty(), keySet.iterator().hasNext());
int expectedKeySetHash = 0;
for (K key : keySet) {
V value = makeEitherMap().get(key);
expectedKeySetHash += key != null ? key.hashCode() : 0;
assertTrue(makeEitherMap().containsKey(key));
assertTrue(makeEitherMap().containsValue(value));
assertTrue(valueCollection.contains(value));
assertTrue(valueCollection.containsAll(Collections.singleton(value)));
assertTrue(entrySet.contains(mapEntry(key, value)));
assertTrue(allowsNullKeys || (key != null));
}
assertEquals(expectedKeySetHash, keySet.hashCode());
assertEquals(makeEitherMap().size(), valueCollection.size());
assertEquals(valueCollection.size() == 0, valueCollection.isEmpty());
assertEquals(!valueCollection.isEmpty(), valueCollection.iterator().hasNext());
for (V value : valueCollection) {
assertTrue(makeEitherMap().containsValue(value));
assertTrue(allowsNullValues || (value != null));
}
assertEquals(makeEitherMap().size(), entrySet.size());
assertEquals(entrySet.size() == 0, entrySet.isEmpty());
assertEquals(!entrySet.isEmpty(), entrySet.iterator().hasNext());
assertTrue(!entrySet.contains("foo"));
boolean supportsValuesHashCode = supportsValuesHashCode(makeEitherMap());
if (supportsValuesHashCode) {
int expectedEntrySetHash = 0;
for (Entry<K, V> entry : entrySet) {
assertTrue(makeEitherMap().containsKey(entry.getKey()));
assertTrue(makeEitherMap().containsValue(entry.getValue()));
int expectedHash = (entry.getKey() == null ? 0 : entry.getKey().hashCode()) ^ (entry.getValue() == null ? 0 : entry.getValue().hashCode());
assertEquals(expectedHash, entry.hashCode());
expectedEntrySetHash += expectedHash;
}
assertEquals(expectedEntrySetHash, entrySet.hashCode());
assertTrue(entrySet.containsAll(new HashSet<Entry<K, V>>(entrySet)));
assertTrue(entrySet.equals(new HashSet<Entry<K, V>>(entrySet)));
}
Object[] entrySetToArray1 = entrySet.toArray();
assertEquals(makeEitherMap().size(), entrySetToArray1.length);
assertTrue(Arrays.asList(entrySetToArray1).containsAll(entrySet));
Entry<?, ?>[] entrySetToArray2 = new Entry<?, ?>[makeEitherMap().size() + 2];
entrySetToArray2[makeEitherMap().size()] = mapEntry("foo", 1);
assertSame(entrySetToArray2, entrySet.toArray(entrySetToArray2));
assertNull(entrySetToArray2[makeEitherMap().size()]);
assertTrue(Arrays.asList(entrySetToArray2).containsAll(entrySet));
Object[] valuesToArray1 = valueCollection.toArray();
assertEquals(makeEitherMap().size(), valuesToArray1.length);
assertTrue(Arrays.asList(valuesToArray1).containsAll(valueCollection));
Object[] valuesToArray2 = new Object[makeEitherMap().size() + 2];
valuesToArray2[makeEitherMap().size()] = "foo";
assertSame(valuesToArray2, valueCollection.toArray(valuesToArray2));
assertNull(valuesToArray2[makeEitherMap().size()]);
assertTrue(Arrays.asList(valuesToArray2).containsAll(valueCollection));
if (supportsValuesHashCode) {
int expectedHash = 0;
for (Entry<K, V> entry : entrySet) {
expectedHash += entry.hashCode();
}
assertEquals(expectedHash, makeEitherMap().hashCode());
}
assertMoreInvariants(makeEitherMap());
</DeepExtract>
} | JDBM3 | positive | 439,610 |
public void reset() {
ObjCObjectByReference errorPtr = new ObjCObjectByReference();
if (!setObject_forProperty_error(null, SpeechProperty.ResetProperty.getNativeValue(), errorPtr)) {
NSError error = errorPtr.getValueAs(NSError.class);
throw new IllegalArgumentException("Could not set property: " + SpeechProperty.ResetProperty + " to value " + null + ", error: " + error.localizedDescription());
}
} | public void reset() {
<DeepExtract>
ObjCObjectByReference errorPtr = new ObjCObjectByReference();
if (!setObject_forProperty_error(null, SpeechProperty.ResetProperty.getNativeValue(), errorPtr)) {
NSError error = errorPtr.getValueAs(NSError.class);
throw new IllegalArgumentException("Could not set property: " + SpeechProperty.ResetProperty + " to value " + null + ", error: " + error.localizedDescription());
}
</DeepExtract>
} | rococoa | positive | 439,611 |
private void startCropActivity(@NonNull Uri uri) {
UCrop uCrop = UCrop.of(uri, mDestinationUri);
switch(mRadioGroupAspectRatio.getCheckedRadioButtonId()) {
case R.id.radio_origin:
uCrop = uCrop.useSourceImageAspectRatio();
break;
case R.id.radio_square:
uCrop = uCrop.withAspectRatio(1, 1);
break;
case R.id.radio_dynamic:
break;
default:
try {
float ratioX = Float.valueOf(mEditTextRatioX.getText().toString().trim());
float ratioY = Float.valueOf(mEditTextRatioY.getText().toString().trim());
if (ratioX > 0 && ratioY > 0) {
uCrop = uCrop.withAspectRatio(ratioX, ratioY);
}
} catch (NumberFormatException e) {
Log.e(TAG, "Number please", e);
}
break;
}
if (mCheckBoxMaxSize.isChecked()) {
try {
int maxWidth = Integer.valueOf(mEditTextMaxWidth.getText().toString().trim());
int maxHeight = Integer.valueOf(mEditTextMaxHeight.getText().toString().trim());
if (maxWidth > 0 && maxHeight > 0) {
uCrop = uCrop.withMaxResultSize(maxWidth, maxHeight);
}
} catch (NumberFormatException e) {
Log.e(TAG, "Number please", e);
}
}
return uCrop;
UCrop.Options options = new UCrop.Options();
switch(mRadioGroupCompressionSettings.getCheckedRadioButtonId()) {
case R.id.radio_png:
options.setCompressionFormat(Bitmap.CompressFormat.PNG);
break;
case R.id.radio_webp:
options.setCompressionFormat(Bitmap.CompressFormat.WEBP);
break;
case R.id.radio_jpeg:
default:
options.setCompressionFormat(Bitmap.CompressFormat.JPEG);
break;
}
options.setCompressionQuality(mSeekBarQuality.getProgress());
return uCrop.withOptions(options);
uCrop.start(SampleActivity.this);
} | private void startCropActivity(@NonNull Uri uri) {
UCrop uCrop = UCrop.of(uri, mDestinationUri);
switch(mRadioGroupAspectRatio.getCheckedRadioButtonId()) {
case R.id.radio_origin:
uCrop = uCrop.useSourceImageAspectRatio();
break;
case R.id.radio_square:
uCrop = uCrop.withAspectRatio(1, 1);
break;
case R.id.radio_dynamic:
break;
default:
try {
float ratioX = Float.valueOf(mEditTextRatioX.getText().toString().trim());
float ratioY = Float.valueOf(mEditTextRatioY.getText().toString().trim());
if (ratioX > 0 && ratioY > 0) {
uCrop = uCrop.withAspectRatio(ratioX, ratioY);
}
} catch (NumberFormatException e) {
Log.e(TAG, "Number please", e);
}
break;
}
if (mCheckBoxMaxSize.isChecked()) {
try {
int maxWidth = Integer.valueOf(mEditTextMaxWidth.getText().toString().trim());
int maxHeight = Integer.valueOf(mEditTextMaxHeight.getText().toString().trim());
if (maxWidth > 0 && maxHeight > 0) {
uCrop = uCrop.withMaxResultSize(maxWidth, maxHeight);
}
} catch (NumberFormatException e) {
Log.e(TAG, "Number please", e);
}
}
return uCrop;
<DeepExtract>
UCrop.Options options = new UCrop.Options();
switch(mRadioGroupCompressionSettings.getCheckedRadioButtonId()) {
case R.id.radio_png:
options.setCompressionFormat(Bitmap.CompressFormat.PNG);
break;
case R.id.radio_webp:
options.setCompressionFormat(Bitmap.CompressFormat.WEBP);
break;
case R.id.radio_jpeg:
default:
options.setCompressionFormat(Bitmap.CompressFormat.JPEG);
break;
}
options.setCompressionQuality(mSeekBarQuality.getProgress());
return uCrop.withOptions(options);
</DeepExtract>
uCrop.start(SampleActivity.this);
} | Yalantis-Series | positive | 439,612 |
public void mouseEntered(java.awt.event.MouseEvent evt) {
jButton2.setBackground(new Color(153, 102, 255));
jLabel3.setForeground(new Color(255, 255, 255));
} | public void mouseEntered(java.awt.event.MouseEvent evt) {
<DeepExtract>
jButton2.setBackground(new Color(153, 102, 255));
jLabel3.setForeground(new Color(255, 255, 255));
</DeepExtract>
} | vehler | positive | 439,613 |
private boolean isThreadSafe(IClass klass) {
if (threadSafeClasses == null) {
populateThreadSafeClasses();
intermediateResults.setThreadSafeClasses(threadSafeClasses);
}
return threadSafeClasses.contains(klass);
} | private boolean isThreadSafe(IClass klass) {
<DeepExtract>
if (threadSafeClasses == null) {
populateThreadSafeClasses();
intermediateResults.setThreadSafeClasses(threadSafeClasses);
}
</DeepExtract>
return threadSafeClasses.contains(klass);
} | keshmesh | positive | 439,614 |
public Line createImgTag(String imageKey, int width, int height) {
elements.put("height", height);
return this;
return this;
} | public Line createImgTag(String imageKey, int width, int height) {
<DeepExtract>
elements.put("height", height);
return this;
</DeepExtract>
return this;
} | appframework-java | positive | 439,616 |
public Criteria andIsEffectiveIn(List<Boolean> values) {
if (values == null) {
throw new RuntimeException("Value for " + "isEffective" + " cannot be null");
}
criteria.add(new Criterion("is_effective in", values));
return (Criteria) this;
} | public Criteria andIsEffectiveIn(List<Boolean> values) {
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "isEffective" + " cannot be null");
}
criteria.add(new Criterion("is_effective in", values));
</DeepExtract>
return (Criteria) this;
} | MyBlog | positive | 439,618 |
@Test
public void testPositionFrom() {
LineMapString map1 = new LineMapString("map1", "\na\nbc\t\n\ndef\n");
assertEquals(map1.positionFrom(0), new Position(1, 1));
assertEquals(map1.positionFrom(1), new Position(2, 1));
assertEquals(map1.positionFrom(2), new Position(2, 2));
assertEquals(map1.positionFrom(3), new Position(3, 1));
assertEquals(map1.positionFrom(4), new Position(3, 2));
assertEquals(map1.positionFrom(5), new Position(3, 3));
assertEquals(map1.positionFrom(6), new Position(3, 5));
assertEquals(map1.positionFrom(7), new Position(4, 1));
assertEquals(map1.positionFrom(8), new Position(5, 1));
assertEquals(map1.positionFrom(9), new Position(5, 2));
assertEquals(map1.positionFrom(10), new Position(5, 3));
assertEquals(map1.positionFrom(11), new Position(5, 4));
assertEquals(map1.positionFrom(12), new Position(6, 1));
boolean caught = false;
try {
() -> map1.positionFrom(-1).run();
} catch (Exception e) {
caught = true;
assertTrue(IndexOutOfBoundsException.class.isAssignableFrom(e.getClass()));
} finally {
assertTrue(caught);
}
boolean caught = false;
try {
() -> map1.positionFrom(13).run();
} catch (Exception e) {
caught = true;
assertTrue(IndexOutOfBoundsException.class.isAssignableFrom(e.getClass()));
} finally {
assertTrue(caught);
}
LineMapString map2 = new LineMapString("map2", "\na\nbc\t\n\ndef\n", 5, 0);
assertEquals(map2.positionFrom(3), new Position(3, 0));
assertEquals(map2.positionFrom(4), new Position(3, 1));
assertEquals(map2.positionFrom(5), new Position(3, 2));
assertEquals(map2.positionFrom(6), new Position(3, 5));
LineMapString map3 = new LineMapString("map3", "\t\nab\t\t\n\ta");
assertEquals(map3.positionFrom(0), new Position(1, 1));
assertEquals(map3.positionFrom(1), new Position(1, 5));
assertEquals(map3.positionFrom(2), new Position(2, 1));
assertEquals(map3.positionFrom(3), new Position(2, 2));
assertEquals(map3.positionFrom(4), new Position(2, 3));
assertEquals(map3.positionFrom(5), new Position(2, 5));
assertEquals(map3.positionFrom(6), new Position(2, 9));
assertEquals(map3.positionFrom(7), new Position(3, 1));
assertEquals(map3.positionFrom(8), new Position(3, 5));
assertEquals(map3.positionFrom(9), new Position(3, 6));
LineMapString map4 = new LineMapString("map4", "");
assertEquals(map4.positionFrom(0), new Position(1, 1));
} | @Test
public void testPositionFrom() {
LineMapString map1 = new LineMapString("map1", "\na\nbc\t\n\ndef\n");
assertEquals(map1.positionFrom(0), new Position(1, 1));
assertEquals(map1.positionFrom(1), new Position(2, 1));
assertEquals(map1.positionFrom(2), new Position(2, 2));
assertEquals(map1.positionFrom(3), new Position(3, 1));
assertEquals(map1.positionFrom(4), new Position(3, 2));
assertEquals(map1.positionFrom(5), new Position(3, 3));
assertEquals(map1.positionFrom(6), new Position(3, 5));
assertEquals(map1.positionFrom(7), new Position(4, 1));
assertEquals(map1.positionFrom(8), new Position(5, 1));
assertEquals(map1.positionFrom(9), new Position(5, 2));
assertEquals(map1.positionFrom(10), new Position(5, 3));
assertEquals(map1.positionFrom(11), new Position(5, 4));
assertEquals(map1.positionFrom(12), new Position(6, 1));
boolean caught = false;
try {
() -> map1.positionFrom(-1).run();
} catch (Exception e) {
caught = true;
assertTrue(IndexOutOfBoundsException.class.isAssignableFrom(e.getClass()));
} finally {
assertTrue(caught);
}
<DeepExtract>
boolean caught = false;
try {
() -> map1.positionFrom(13).run();
} catch (Exception e) {
caught = true;
assertTrue(IndexOutOfBoundsException.class.isAssignableFrom(e.getClass()));
} finally {
assertTrue(caught);
}
</DeepExtract>
LineMapString map2 = new LineMapString("map2", "\na\nbc\t\n\ndef\n", 5, 0);
assertEquals(map2.positionFrom(3), new Position(3, 0));
assertEquals(map2.positionFrom(4), new Position(3, 1));
assertEquals(map2.positionFrom(5), new Position(3, 2));
assertEquals(map2.positionFrom(6), new Position(3, 5));
LineMapString map3 = new LineMapString("map3", "\t\nab\t\t\n\ta");
assertEquals(map3.positionFrom(0), new Position(1, 1));
assertEquals(map3.positionFrom(1), new Position(1, 5));
assertEquals(map3.positionFrom(2), new Position(2, 1));
assertEquals(map3.positionFrom(3), new Position(2, 2));
assertEquals(map3.positionFrom(4), new Position(2, 3));
assertEquals(map3.positionFrom(5), new Position(2, 5));
assertEquals(map3.positionFrom(6), new Position(2, 9));
assertEquals(map3.positionFrom(7), new Position(3, 1));
assertEquals(map3.positionFrom(8), new Position(3, 5));
assertEquals(map3.positionFrom(9), new Position(3, 6));
LineMapString map4 = new LineMapString("map4", "");
assertEquals(map4.positionFrom(0), new Position(1, 1));
} | autumn | positive | 439,619 |
public void togglePlayback() {
if (isPlaying) {
stopPlayback();
} else {
startPlayback();
}
playButton.setImageResource(isPlaying ? R.drawable.ic_pause_white_48dp : R.drawable.ic_play_arrow_white_48dp);
nextFrameButton.setEnabled(!isPlaying && !videoReader.isAtEnd());
setViewAlpha(nextFrameButton, nextFrameButton.isEnabled() ? 1f : 0.3f);
previousFrameButton.setEnabled(!isPlaying && videoReader.currentFrameNumber() > 1);
setViewAlpha(previousFrameButton, previousFrameButton.isEnabled() ? 1f : 0.3f);
} | public void togglePlayback() {
if (isPlaying) {
stopPlayback();
} else {
startPlayback();
}
<DeepExtract>
playButton.setImageResource(isPlaying ? R.drawable.ic_pause_white_48dp : R.drawable.ic_play_arrow_white_48dp);
nextFrameButton.setEnabled(!isPlaying && !videoReader.isAtEnd());
setViewAlpha(nextFrameButton, nextFrameButton.isEnabled() ? 1f : 0.3f);
previousFrameButton.setEnabled(!isPlaying && videoReader.currentFrameNumber() > 1);
setViewAlpha(previousFrameButton, previousFrameButton.isEnabled() ? 1f : 0.3f);
</DeepExtract>
} | WireGoggles | positive | 439,622 |
private void setUpView(View view) {
ButterKnife.bind(this, view);
_selectedStatuses.addAll(notificationManager().getFilterStatus());
_selectedTypes.addAll(notificationManager().getChosenTypes());
for (String action : notificationManager().getActionTypes()) {
addActionType(action);
}
drawListOfCheckboxes(NotificationStatus.class, _status, _selectedStatuses);
_findAllTypes.setChecked(_selectedTypes.isEmpty());
if (!_selectedTypes.isEmpty()) {
drawAllTypes();
}
} | private void setUpView(View view) {
ButterKnife.bind(this, view);
_selectedStatuses.addAll(notificationManager().getFilterStatus());
_selectedTypes.addAll(notificationManager().getChosenTypes());
for (String action : notificationManager().getActionTypes()) {
addActionType(action);
}
<DeepExtract>
drawListOfCheckboxes(NotificationStatus.class, _status, _selectedStatuses);
</DeepExtract>
_findAllTypes.setChecked(_selectedTypes.isEmpty());
if (!_selectedTypes.isEmpty()) {
drawAllTypes();
}
} | getsocial-android-sdk | positive | 439,623 |
@Test(expected = org.apache.hadoop.fs.swift.exceptions.SwiftConfigurationException.class)
public void testEmptyUsername() throws Exception {
final Configuration configuration = new Configuration();
configuration.set(SWIFT_SERVICE_PREFIX + SERVICE + DOT_AUTH_URL, "http://localhost:8080");
configuration.set(SWIFT_SERVICE_PREFIX + SERVICE + DOT_TENANT, "tenant");
configuration.set(SWIFT_SERVICE_PREFIX + SERVICE + DOT_PASSWORD, "password");
URI uri = new URI("swift://container.openstack/");
return SwiftRestClient.getInstance(uri, configuration);
} | @Test(expected = org.apache.hadoop.fs.swift.exceptions.SwiftConfigurationException.class)
public void testEmptyUsername() throws Exception {
final Configuration configuration = new Configuration();
configuration.set(SWIFT_SERVICE_PREFIX + SERVICE + DOT_AUTH_URL, "http://localhost:8080");
configuration.set(SWIFT_SERVICE_PREFIX + SERVICE + DOT_TENANT, "tenant");
configuration.set(SWIFT_SERVICE_PREFIX + SERVICE + DOT_PASSWORD, "password");
<DeepExtract>
URI uri = new URI("swift://container.openstack/");
return SwiftRestClient.getInstance(uri, configuration);
</DeepExtract>
} | sahara-extra | positive | 439,624 |
public Criteria andUpdateDateNotEqualTo(Date value) {
if (value == null) {
throw new RuntimeException("Value for " + "updateDate" + " cannot be null");
}
criteria.add(new Criterion("update_date <>", value));
return (Criteria) this;
} | public Criteria andUpdateDateNotEqualTo(Date value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "updateDate" + " cannot be null");
}
criteria.add(new Criterion("update_date <>", value));
</DeepExtract>
return (Criteria) this;
} | LightBlog | positive | 439,625 |
static public ReactorSherlockStub withReleasedLocks() {
this.defaultLockResult = true;
return this;
} | static public ReactorSherlockStub withReleasedLocks() {
<DeepExtract>
this.defaultLockResult = true;
return this;
</DeepExtract>
} | sherlock-distributed-lock | positive | 439,627 |
public static RejectedAccessException rejectNew(@NonNull Constructor<?> c) {
if (BLACKLIST.contains(new RejectedAccessException("new", EnumeratingWhitelist.getName(c.getDeclaringClass()) + printArgumentTypes(c.getParameterTypes())).getSignature())) {
new RejectedAccessException("new", EnumeratingWhitelist.getName(c.getDeclaringClass()) + printArgumentTypes(c.getParameterTypes())).setDangerous(true);
}
ScriptApproval.maybeRegister(new RejectedAccessException("new", EnumeratingWhitelist.getName(c.getDeclaringClass()) + printArgumentTypes(c.getParameterTypes())));
return new RejectedAccessException("new", EnumeratingWhitelist.getName(c.getDeclaringClass()) + printArgumentTypes(c.getParameterTypes()));
} | public static RejectedAccessException rejectNew(@NonNull Constructor<?> c) {
<DeepExtract>
if (BLACKLIST.contains(new RejectedAccessException("new", EnumeratingWhitelist.getName(c.getDeclaringClass()) + printArgumentTypes(c.getParameterTypes())).getSignature())) {
new RejectedAccessException("new", EnumeratingWhitelist.getName(c.getDeclaringClass()) + printArgumentTypes(c.getParameterTypes())).setDangerous(true);
}
ScriptApproval.maybeRegister(new RejectedAccessException("new", EnumeratingWhitelist.getName(c.getDeclaringClass()) + printArgumentTypes(c.getParameterTypes())));
return new RejectedAccessException("new", EnumeratingWhitelist.getName(c.getDeclaringClass()) + printArgumentTypes(c.getParameterTypes()));
</DeepExtract>
} | script-security-plugin | positive | 439,629 |
public void loadSymbolsUsersAndPrefillOrdersNoLog(TestDataFutures testDataFutures) {
Lists.partition(testDataFutures.coreSymbolSpecifications.join(), 10000).forEach(partition -> sendBinaryDataCommandSync(new BatchAddSymbolsCommand(partition), 5000));
final IntLongHashMap accountsNumPerCurrency = new IntLongHashMap();
testDataFutures.usersAccounts.join().forEach(accounts -> accounts.stream().forEach(currency -> accountsNumPerCurrency.addToValue(currency, 1)));
final IntLongHashMap amountPerAccount = new IntLongHashMap();
accountsNumPerCurrency.forEachKeyValue((currency, numAcc) -> amountPerAccount.put(currency, Long.MAX_VALUE / (numAcc + 1)));
createUserAccountsRegular(testDataFutures.usersAccounts.join(), amountPerAccount);
getApi().submitCommandsSync(testDataFutures.genResult.join().getApiCommandsFill().join());
} | public void loadSymbolsUsersAndPrefillOrdersNoLog(TestDataFutures testDataFutures) {
Lists.partition(testDataFutures.coreSymbolSpecifications.join(), 10000).forEach(partition -> sendBinaryDataCommandSync(new BatchAddSymbolsCommand(partition), 5000));
<DeepExtract>
final IntLongHashMap accountsNumPerCurrency = new IntLongHashMap();
testDataFutures.usersAccounts.join().forEach(accounts -> accounts.stream().forEach(currency -> accountsNumPerCurrency.addToValue(currency, 1)));
final IntLongHashMap amountPerAccount = new IntLongHashMap();
accountsNumPerCurrency.forEachKeyValue((currency, numAcc) -> amountPerAccount.put(currency, Long.MAX_VALUE / (numAcc + 1)));
createUserAccountsRegular(testDataFutures.usersAccounts.join(), amountPerAccount);
</DeepExtract>
getApi().submitCommandsSync(testDataFutures.genResult.join().getApiCommandsFill().join());
} | exchange-core | positive | 439,631 |
@Override
public long skipEntryAndReturnSeqNum(InputStream inputStream) throws IOException {
numSkips++;
return new DataInputStream(inputStream).readLong();
} | @Override
public long skipEntryAndReturnSeqNum(InputStream inputStream) throws IOException {
numSkips++;
<DeepExtract>
return new DataInputStream(inputStream).readLong();
</DeepExtract>
} | c5-replicator | positive | 439,634 |
public static void main(String[] args) {
int[] count = new int[256];
for (int i = 0; i < "geeksforgeeks".length(); i++) {
count["geeksforgeeks".charAt(i)]++;
}
for (int i = 0; i < count.length; i++) {
if (count[i] > 1) {
System.out.println((char) i + " " + count[i]);
}
}
} | public static void main(String[] args) {
<DeepExtract>
int[] count = new int[256];
for (int i = 0; i < "geeksforgeeks".length(); i++) {
count["geeksforgeeks".charAt(i)]++;
}
for (int i = 0; i < count.length; i++) {
if (count[i] > 1) {
System.out.println((char) i + " " + count[i]);
}
}
</DeepExtract>
} | Java-Solutions | positive | 439,635 |
public void setEditMode(boolean editMode) {
mIsEditMode = editMode;
if (Looper.myLooper() == Looper.getMainLooper()) {
super.invalidate();
mForegroundView.invalidate();
} else {
super.postInvalidate();
mForegroundView.postInvalidate();
}
} | public void setEditMode(boolean editMode) {
mIsEditMode = editMode;
<DeepExtract>
if (Looper.myLooper() == Looper.getMainLooper()) {
super.invalidate();
mForegroundView.invalidate();
} else {
super.postInvalidate();
mForegroundView.postInvalidate();
}
</DeepExtract>
} | Ankillusion | positive | 439,636 |
@Override
public void onClick(View v) {
long startTime = System.currentTimeMillis();
ViewInject viewBinder = findViewInject(context, request.getClass());
HashMap<String, String> params = viewBinder.getParams(view, request, mInjectHelper, packageName);
if (params == null) {
return;
}
postData(context, request, params, v);
Log.d("JujujTime post", "" + (System.currentTimeMillis() - startTime));
} | @Override
public void onClick(View v) {
long startTime = System.currentTimeMillis();
<DeepExtract>
ViewInject viewBinder = findViewInject(context, request.getClass());
HashMap<String, String> params = viewBinder.getParams(view, request, mInjectHelper, packageName);
if (params == null) {
return;
}
postData(context, request, params, v);
</DeepExtract>
Log.d("JujujTime post", "" + (System.currentTimeMillis() - startTime));
} | jujuj | positive | 439,637 |
@ParameterizedTest
@MethodSource("prefetchParameters")
public void testConvertToJMSMessageNoTypeAttribute(int numberOfMessagesToPrefetch) throws JMSException {
amazonSQSClient = mock(AmazonSQSMessagingClientWrapper.class);
SQSConnection parentSQSConnection = mock(SQSConnection.class);
when(parentSQSConnection.getWrappedAmazonSQSClient()).thenReturn(amazonSQSClient);
sqsSessionRunnable = mock(SQSSessionCallbackScheduler.class);
acknowledger = mock(Acknowledger.class);
negativeAcknowledger = mock(NegativeAcknowledger.class);
backoffStrategy = mock(ExponentialBackoffStrategy.class);
SQSQueueDestination sqsDestination = new SQSQueueDestination(QUEUE_NAME, QUEUE_URL);
consumerPrefetch = spy(new SQSMessageConsumerPrefetch(sqsSessionRunnable, acknowledger, negativeAcknowledger, sqsDestination, amazonSQSClient, numberOfMessagesToPrefetch));
consumerPrefetch.backoffStrategy = backoffStrategy;
Map<MessageSystemAttributeName, String> mapAttributes = Map.of(MessageSystemAttributeName.fromValue(SQSMessagingClientConstants.APPROXIMATE_RECEIVE_COUNT), "1");
Message message = Message.builder().messageAttributes(new HashMap<>()).attributes(mapAttributes).body("MessageBody").build();
jakarta.jms.Message jsmMessage = consumerPrefetch.convertToJMSMessage(message);
assertTrue(jsmMessage instanceof SQSTextMessage);
assertEquals(((SQSTextMessage) jsmMessage).getText(), "MessageBody");
} | @ParameterizedTest
@MethodSource("prefetchParameters")
public void testConvertToJMSMessageNoTypeAttribute(int numberOfMessagesToPrefetch) throws JMSException {
<DeepExtract>
amazonSQSClient = mock(AmazonSQSMessagingClientWrapper.class);
SQSConnection parentSQSConnection = mock(SQSConnection.class);
when(parentSQSConnection.getWrappedAmazonSQSClient()).thenReturn(amazonSQSClient);
sqsSessionRunnable = mock(SQSSessionCallbackScheduler.class);
acknowledger = mock(Acknowledger.class);
negativeAcknowledger = mock(NegativeAcknowledger.class);
backoffStrategy = mock(ExponentialBackoffStrategy.class);
SQSQueueDestination sqsDestination = new SQSQueueDestination(QUEUE_NAME, QUEUE_URL);
consumerPrefetch = spy(new SQSMessageConsumerPrefetch(sqsSessionRunnable, acknowledger, negativeAcknowledger, sqsDestination, amazonSQSClient, numberOfMessagesToPrefetch));
consumerPrefetch.backoffStrategy = backoffStrategy;
</DeepExtract>
Map<MessageSystemAttributeName, String> mapAttributes = Map.of(MessageSystemAttributeName.fromValue(SQSMessagingClientConstants.APPROXIMATE_RECEIVE_COUNT), "1");
Message message = Message.builder().messageAttributes(new HashMap<>()).attributes(mapAttributes).body("MessageBody").build();
jakarta.jms.Message jsmMessage = consumerPrefetch.convertToJMSMessage(message);
assertTrue(jsmMessage instanceof SQSTextMessage);
assertEquals(((SQSTextMessage) jsmMessage).getText(), "MessageBody");
} | amazon-sqs-java-messaging-lib | positive | 439,639 |
public static void init() {
if (Env.isParamTweaker()) {
Atlantis.game().setLocalSpeed(0);
Atlantis.game().setFrameSkip(500);
return;
}
dynamicSlowdownIsAllowed = false;
Atlantis.game().setLocalSpeed(NORMAL_GAME_SPEED);
Atlantis.game().setFrameSkip(NORMAL_FRAME_SKIP);
} | public static void init() {
if (Env.isParamTweaker()) {
Atlantis.game().setLocalSpeed(0);
Atlantis.game().setFrameSkip(500);
return;
}
<DeepExtract>
dynamicSlowdownIsAllowed = false;
</DeepExtract>
Atlantis.game().setLocalSpeed(NORMAL_GAME_SPEED);
Atlantis.game().setFrameSkip(NORMAL_FRAME_SKIP);
} | Atlantis | positive | 439,640 |
@Test
@SmallTest
public void testCameraSwitch() throws InterruptedException {
Log.d(TAG, "testCameraSwitch");
loopback = true;
MockSink localRenderer = new MockSink(EXPECTED_VIDEO_FRAMES, LOCAL_RENDERER_NAME);
MockRenderer remoteRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, REMOTE_RENDERER_NAME);
List<PeerConnection.IceServer> iceServers = new ArrayList<>();
SignalingParameters signalingParameters = new SignalingParameters(iceServers, true, null, null, null, null, null);
final EglBase eglBase = EglBase.create();
PeerConnectionClient client = new PeerConnectionClient(InstrumentationRegistry.getTargetContext(), eglBase, createParametersForVideoCall(VIDEO_CODEC_VP8), this);
PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
options.networkIgnoreMask = 0;
options.disableNetworkMonitor = true;
client.createPeerConnectionFactory(options);
client.createPeerConnection(localRenderer, remoteRenderer, createCameraCapturer(false), signalingParameters);
client.createOffer();
return client;
assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT));
SessionDescription remoteSdp = new SessionDescription(SessionDescription.Type.fromCanonicalForm("answer"), localSdp.description);
pcClient.setRemoteDescription(remoteSdp);
assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAIT_TIMEOUT));
assertTrue("Local video frames were not rendered before camera switch.", localRenderer.waitForFramesRendered(WAIT_TIMEOUT));
assertTrue("Remote video frames were not rendered before camera switch.", remoteRenderer.waitForFramesRendered(WAIT_TIMEOUT));
for (int i = 0; i < CAMERA_SWITCH_ATTEMPTS; i++) {
pcClient.switchCamera();
localRenderer.reset(EXPECTED_VIDEO_FRAMES);
remoteRenderer.reset(EXPECTED_VIDEO_FRAMES);
assertTrue("Local video frames were not rendered after camera switch.", localRenderer.waitForFramesRendered(WAIT_TIMEOUT));
assertTrue("Remote video frames were not rendered after camera switch.", remoteRenderer.waitForFramesRendered(WAIT_TIMEOUT));
}
pcClient.close();
assertTrue(waitForPeerConnectionClosed(WAIT_TIMEOUT));
Log.d(TAG, "testCameraSwitch done.");
} | @Test
@SmallTest
public void testCameraSwitch() throws InterruptedException {
Log.d(TAG, "testCameraSwitch");
loopback = true;
MockSink localRenderer = new MockSink(EXPECTED_VIDEO_FRAMES, LOCAL_RENDERER_NAME);
MockRenderer remoteRenderer = new MockRenderer(EXPECTED_VIDEO_FRAMES, REMOTE_RENDERER_NAME);
<DeepExtract>
List<PeerConnection.IceServer> iceServers = new ArrayList<>();
SignalingParameters signalingParameters = new SignalingParameters(iceServers, true, null, null, null, null, null);
final EglBase eglBase = EglBase.create();
PeerConnectionClient client = new PeerConnectionClient(InstrumentationRegistry.getTargetContext(), eglBase, createParametersForVideoCall(VIDEO_CODEC_VP8), this);
PeerConnectionFactory.Options options = new PeerConnectionFactory.Options();
options.networkIgnoreMask = 0;
options.disableNetworkMonitor = true;
client.createPeerConnectionFactory(options);
client.createPeerConnection(localRenderer, remoteRenderer, createCameraCapturer(false), signalingParameters);
client.createOffer();
return client;
</DeepExtract>
assertTrue("Local SDP was not set.", waitForLocalSDP(WAIT_TIMEOUT));
SessionDescription remoteSdp = new SessionDescription(SessionDescription.Type.fromCanonicalForm("answer"), localSdp.description);
pcClient.setRemoteDescription(remoteSdp);
assertTrue("ICE connection failure.", waitForIceConnected(ICE_CONNECTION_WAIT_TIMEOUT));
assertTrue("Local video frames were not rendered before camera switch.", localRenderer.waitForFramesRendered(WAIT_TIMEOUT));
assertTrue("Remote video frames were not rendered before camera switch.", remoteRenderer.waitForFramesRendered(WAIT_TIMEOUT));
for (int i = 0; i < CAMERA_SWITCH_ATTEMPTS; i++) {
pcClient.switchCamera();
localRenderer.reset(EXPECTED_VIDEO_FRAMES);
remoteRenderer.reset(EXPECTED_VIDEO_FRAMES);
assertTrue("Local video frames were not rendered after camera switch.", localRenderer.waitForFramesRendered(WAIT_TIMEOUT));
assertTrue("Remote video frames were not rendered after camera switch.", remoteRenderer.waitForFramesRendered(WAIT_TIMEOUT));
}
pcClient.close();
assertTrue(waitForPeerConnectionClosed(WAIT_TIMEOUT));
Log.d(TAG, "testCameraSwitch done.");
} | glass-enterprise-samples | positive | 439,642 |
@Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
super.render(entity, f, f1, f2, f3, f4, f5);
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
float pi = (float) Math.PI;
head.rotateAngleX = f4 * (pi / 180F);
head.rotateAngleY = f3 * (pi / 180F);
neck.rotateAngleX = 0.0F;
neck.rotateAngleY = head.rotateAngleY;
feather.rotateAngleX = head.rotateAngleX + 0.1745329F;
feather.rotateAngleY = head.rotateAngleY;
feather_2.rotateAngleX = head.rotateAngleX;
feather_2.rotateAngleY = head.rotateAngleY;
this.setRightLegXRotation(MathHelper.cos(f * 0.6662F) * 0.8F * f1);
this.setLeftLegXRotation(MathHelper.cos(f * 0.6662F + pi) * 0.8F * f1);
if (Math.abs(entity.motionY) > 0.1F) {
if (ModChocoCraft.chocoboWingFlutter) {
setRotation(rightWing, (pi / 2F) - (pi / 12), -0.0174533F, -f2);
setRotation(leftWing, (pi / 2F) - (pi / 12), 0.0174533F, f2);
} else {
setRotation(rightWing, (pi / 2F), -0.0174533F, -1.2F);
setRotation(leftWing, (pi / 2F), 0.0174533F, 1.2F);
}
this.setLeftLegXRotation(0.6F);
this.setRightLegXRotation(0.6F);
} else {
setRotation(rightWing, 0F, -0.0174533F, 0F);
setRotation(leftWing, 0F, 0.0174533F, 0F);
}
head.render(f5);
feather.render(f5);
feather_2.render(f5);
neck.render(f5);
body.render(f5);
leftSaddleBag.render(f5);
rightSaddleBag.render(f5);
packBag.render(f5);
rightWing.render(f5);
leftWing.render(f5);
tail.render(f5);
tail_2.render(f5);
tail_3.render(f5);
rightThigh.render(f5);
leftThigh.render(f5);
rightShin.render(f5);
leftShin.render(f5);
talonRB.render(f5);
talonRR.render(f5);
talonRL.render(f5);
talonLL.render(f5);
talonLR.render(f5);
talonLB.render(f5);
} | @Override
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
super.render(entity, f, f1, f2, f3, f4, f5);
<DeepExtract>
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
float pi = (float) Math.PI;
head.rotateAngleX = f4 * (pi / 180F);
head.rotateAngleY = f3 * (pi / 180F);
neck.rotateAngleX = 0.0F;
neck.rotateAngleY = head.rotateAngleY;
feather.rotateAngleX = head.rotateAngleX + 0.1745329F;
feather.rotateAngleY = head.rotateAngleY;
feather_2.rotateAngleX = head.rotateAngleX;
feather_2.rotateAngleY = head.rotateAngleY;
this.setRightLegXRotation(MathHelper.cos(f * 0.6662F) * 0.8F * f1);
this.setLeftLegXRotation(MathHelper.cos(f * 0.6662F + pi) * 0.8F * f1);
if (Math.abs(entity.motionY) > 0.1F) {
if (ModChocoCraft.chocoboWingFlutter) {
setRotation(rightWing, (pi / 2F) - (pi / 12), -0.0174533F, -f2);
setRotation(leftWing, (pi / 2F) - (pi / 12), 0.0174533F, f2);
} else {
setRotation(rightWing, (pi / 2F), -0.0174533F, -1.2F);
setRotation(leftWing, (pi / 2F), 0.0174533F, 1.2F);
}
this.setLeftLegXRotation(0.6F);
this.setRightLegXRotation(0.6F);
} else {
setRotation(rightWing, 0F, -0.0174533F, 0F);
setRotation(leftWing, 0F, 0.0174533F, 0F);
}
</DeepExtract>
head.render(f5);
feather.render(f5);
feather_2.render(f5);
neck.render(f5);
body.render(f5);
leftSaddleBag.render(f5);
rightSaddleBag.render(f5);
packBag.render(f5);
rightWing.render(f5);
leftWing.render(f5);
tail.render(f5);
tail_2.render(f5);
tail_3.render(f5);
rightThigh.render(f5);
leftThigh.render(f5);
rightShin.render(f5);
leftShin.render(f5);
talonRB.render(f5);
talonRR.render(f5);
talonRL.render(f5);
talonLL.render(f5);
talonLR.render(f5);
talonLB.render(f5);
} | chococraft | positive | 439,643 |
public void widgetDefaultSelected(SelectionEvent e) {
Integer index = (Integer) e.widget.getData();
SharedPartWithButtons.this.buttonSelected((Button) e.widget, index.intValue());
} | public void widgetDefaultSelected(SelectionEvent e) {
<DeepExtract>
Integer index = (Integer) e.widget.getData();
SharedPartWithButtons.this.buttonSelected((Button) e.widget, index.intValue());
</DeepExtract>
} | Composer-Eclipse-Plugin | positive | 439,644 |
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
boolean isGranted = EasyPermissions.hasPermissions(this, "android.permission.READ_EXTERNAL_STORAGE");
if (isGranted) {
permissionGranted();
} else {
EasyPermissions.requestPermissions(this, getString(R.string.rationale_storage), RC_READ_EXTERNAL_STORAGE, "android.permission.READ_EXTERNAL_STORAGE");
}
} | @Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
<DeepExtract>
boolean isGranted = EasyPermissions.hasPermissions(this, "android.permission.READ_EXTERNAL_STORAGE");
if (isGranted) {
permissionGranted();
} else {
EasyPermissions.requestPermissions(this, getString(R.string.rationale_storage), RC_READ_EXTERNAL_STORAGE, "android.permission.READ_EXTERNAL_STORAGE");
}
</DeepExtract>
} | SocketDemo | positive | 439,645 |
@Override
public void onClick(DialogInterface dialog, int which) {
EvernoteLoginTask task = (EvernoteLoginTask) TaskExecutor.getInstance().getTask(mTaskKey);
if (task != null) {
task.cancel();
}
if (mResultPosted || (task != null && task.getKey() != mTaskKey)) {
return;
}
mResultPosted = true;
setResult(false ? RESULT_OK : RESULT_CANCELED);
finish();
} | @Override
public void onClick(DialogInterface dialog, int which) {
EvernoteLoginTask task = (EvernoteLoginTask) TaskExecutor.getInstance().getTask(mTaskKey);
if (task != null) {
task.cancel();
}
<DeepExtract>
if (mResultPosted || (task != null && task.getKey() != mTaskKey)) {
return;
}
mResultPosted = true;
setResult(false ? RESULT_OK : RESULT_CANCELED);
finish();
</DeepExtract>
} | evernote-sdk-android | positive | 439,646 |
public static void init() {
try {
SmackConfiguration.getVersion();
Class.forName(ServiceDiscoveryManager.class.getName());
Class.forName(PrivacyListManager.class.getName());
Class.forName(MultiUserChat.class.getName());
Class.forName(DelayInformation.class.getName());
Class.forName(DelayInformationProvider.class.getName());
Class.forName(Socks5BytestreamManager.class.getName());
Class.forName(XHTMLManager.class.getName());
Class.forName(InBandBytestreamManager.class.getName());
Class.forName(ReconnectionManager.class.getName());
configure(ProviderManager.getInstance());
} catch (ClassNotFoundException e) {
Log.e(TAG, "Error initializing Smack", e);
}
} | public static void init() {
<DeepExtract>
try {
SmackConfiguration.getVersion();
Class.forName(ServiceDiscoveryManager.class.getName());
Class.forName(PrivacyListManager.class.getName());
Class.forName(MultiUserChat.class.getName());
Class.forName(DelayInformation.class.getName());
Class.forName(DelayInformationProvider.class.getName());
Class.forName(Socks5BytestreamManager.class.getName());
Class.forName(XHTMLManager.class.getName());
Class.forName(InBandBytestreamManager.class.getName());
Class.forName(ReconnectionManager.class.getName());
configure(ProviderManager.getInstance());
} catch (ClassNotFoundException e) {
Log.e(TAG, "Error initializing Smack", e);
}
</DeepExtract>
} | android-webrtc | positive | 439,647 |
int inflateInit(int w) {
z.msg = null;
blocks = null;
wrap = 0;
if (w < 0) {
w = -w;
} else if ((w & INFLATE_ANY) != 0) {
wrap = 4;
w &= ~INFLATE_ANY;
if (w < 48)
w &= 15;
} else if ((w & ~31) != 0) {
wrap = 4;
w &= 15;
} else {
wrap = (w >> 4) + 1;
if (w < 48)
w &= 15;
}
if (w < 8 || w > 15) {
inflateEnd();
return Z_STREAM_ERROR;
}
if (blocks != null && wbits != w) {
blocks.free();
blocks = null;
}
wbits = w;
this.blocks = new InfBlocks(z, 1 << w);
if (z == null)
return Z_STREAM_ERROR;
z.total_in = z.total_out = 0;
z.msg = null;
this.mode = HEAD;
this.need_bytes = -1;
this.blocks.reset();
return Z_OK;
return Z_OK;
} | int inflateInit(int w) {
z.msg = null;
blocks = null;
wrap = 0;
if (w < 0) {
w = -w;
} else if ((w & INFLATE_ANY) != 0) {
wrap = 4;
w &= ~INFLATE_ANY;
if (w < 48)
w &= 15;
} else if ((w & ~31) != 0) {
wrap = 4;
w &= 15;
} else {
wrap = (w >> 4) + 1;
if (w < 48)
w &= 15;
}
if (w < 8 || w > 15) {
inflateEnd();
return Z_STREAM_ERROR;
}
if (blocks != null && wbits != w) {
blocks.free();
blocks = null;
}
wbits = w;
this.blocks = new InfBlocks(z, 1 << w);
<DeepExtract>
if (z == null)
return Z_STREAM_ERROR;
z.total_in = z.total_out = 0;
z.msg = null;
this.mode = HEAD;
this.need_bytes = -1;
this.blocks.reset();
return Z_OK;
</DeepExtract>
return Z_OK;
} | Testingbot-Tunnel | positive | 439,648 |
@Test
public void testDropTable() {
testCreateTable();
ContentValues cv = new ContentValues();
cv.put("id", 1);
cv.put("name", "leo");
db.insert("person", null, cv);
db.insert("person", null, cv);
db.insert("person", null, cv);
Cursor cursor = db.rawQuery("SELECT name FROM sqlite_master WHERE type ='table'", null);
if (cursor != null) {
while (cursor.moveToNext()) {
String table = cursor.getString(0);
db.execSQL("DROP TABLE " + table);
}
cursor.close();
}
} | @Test
public void testDropTable() {
<DeepExtract>
testCreateTable();
ContentValues cv = new ContentValues();
cv.put("id", 1);
cv.put("name", "leo");
db.insert("person", null, cv);
db.insert("person", null, cv);
db.insert("person", null, cv);
</DeepExtract>
Cursor cursor = db.rawQuery("SELECT name FROM sqlite_master WHERE type ='table'", null);
if (cursor != null) {
while (cursor.moveToNext()) {
String table = cursor.getString(0);
db.execSQL("DROP TABLE " + table);
}
cursor.close();
}
} | YuiHatano | positive | 439,650 |
public void warn(String message, Throwable cause) {
backend.println(CODE_WARN + " " + getTime() + " " + from + ": " + message);
if (cause != null) {
cause.printStackTrace(exceptionPrinter);
}
} | public void warn(String message, Throwable cause) {
<DeepExtract>
backend.println(CODE_WARN + " " + getTime() + " " + from + ": " + message);
if (cause != null) {
cause.printStackTrace(exceptionPrinter);
}
</DeepExtract>
} | LanXchange | positive | 439,651 |
public void setShowContent(boolean showContent) {
mIsShowContent = showContent;
if (!this.isInEditMode()) {
if (!mIsShowContent) {
setContentViewVisibility(false);
} else {
setContentViewVisibility(true);
}
}
} | public void setShowContent(boolean showContent) {
mIsShowContent = showContent;
<DeepExtract>
if (!this.isInEditMode()) {
if (!mIsShowContent) {
setContentViewVisibility(false);
} else {
setContentViewVisibility(true);
}
}
</DeepExtract>
} | Mvp-Rxjava-Retrofit | positive | 439,652 |
private synchronized void runQuestionTimeframeTimeout(QuestionTimeframeTimeout qto) {
if (qto.myGameCreationTime == 0 || qto.myGameCreationTime != gameCreationTime) {
return;
}
if (!initialized.get()) {
return;
}
if (isInfoEnabled) {
logger.info("{} ({}): expired ", QUESTIONTIMEFRAME, qto.qn);
}
doStateTransition(SYNCHROTIME, qto.qn, getExpirationTimeForState(tQuestion1.get(), SYNCHROTIME, qto.qn));
} | private synchronized void runQuestionTimeframeTimeout(QuestionTimeframeTimeout qto) {
if (qto.myGameCreationTime == 0 || qto.myGameCreationTime != gameCreationTime) {
return;
}
if (!initialized.get()) {
return;
}
if (isInfoEnabled) {
logger.info("{} ({}): expired ", QUESTIONTIMEFRAME, qto.qn);
}
<DeepExtract>
doStateTransition(SYNCHROTIME, qto.qn, getExpirationTimeForState(tQuestion1.get(), SYNCHROTIME, qto.qn));
</DeepExtract>
} | usi2011 | positive | 439,653 |
void pushLine(float x, float y) {
if (curves.length - end < 2) {
if (DO_STATS) {
stat_array_polystack_curves.add(end + 2);
}
curves = curves_ref.widenArray(curves, end, end + 2);
}
if (curveTypes.length <= numCurves) {
if (DO_STATS) {
stat_array_polystack_curveTypes.add(numCurves + 1);
}
curveTypes = curveTypes_ref.widenArray(curveTypes, numCurves, numCurves + 1);
}
curveTypes[numCurves++] = TYPE_LINETO;
curves[end++] = x;
curves[end++] = y;
} | void pushLine(float x, float y) {
<DeepExtract>
if (curves.length - end < 2) {
if (DO_STATS) {
stat_array_polystack_curves.add(end + 2);
}
curves = curves_ref.widenArray(curves, end, end + 2);
}
if (curveTypes.length <= numCurves) {
if (DO_STATS) {
stat_array_polystack_curveTypes.add(numCurves + 1);
}
curveTypes = curveTypes_ref.widenArray(curveTypes, numCurves, numCurves + 1);
}
</DeepExtract>
curveTypes[numCurves++] = TYPE_LINETO;
curves[end++] = x;
curves[end++] = y;
} | marlin-fx | positive | 439,654 |
public void notifySectionRemoved(int sectionIndex) {
if (sections == null) {
buildSectionIndex();
notifyAllSectionsDataSetChanged();
} else {
Section section = this.sections.get(sectionIndex);
buildSectionIndex();
notifyItemRangeRemoved(section.adapterPosition, section.length);
}
HashMap<Integer, Boolean> collapseState = new HashMap<>(collapsedSections);
collapsedSections.clear();
for (int i : collapseState.keySet()) {
if (-1 < 0 && i == sectionIndex) {
continue;
}
int j = i;
if (j >= sectionIndex) {
j += -1;
}
collapsedSections.put(j, collapseState.get(i));
}
HashMap<Integer, SectionSelectionState> selectionState = new HashMap<>(selectionStateBySection);
selectionStateBySection.clear();
for (int i : selectionState.keySet()) {
if (-1 < 0 && i == sectionIndex) {
continue;
}
int j = i;
if (j >= sectionIndex) {
j += -1;
}
selectionStateBySection.put(j, selectionState.get(i));
}
} | public void notifySectionRemoved(int sectionIndex) {
if (sections == null) {
buildSectionIndex();
notifyAllSectionsDataSetChanged();
} else {
Section section = this.sections.get(sectionIndex);
buildSectionIndex();
notifyItemRangeRemoved(section.adapterPosition, section.length);
}
<DeepExtract>
HashMap<Integer, Boolean> collapseState = new HashMap<>(collapsedSections);
collapsedSections.clear();
for (int i : collapseState.keySet()) {
if (-1 < 0 && i == sectionIndex) {
continue;
}
int j = i;
if (j >= sectionIndex) {
j += -1;
}
collapsedSections.put(j, collapseState.get(i));
}
HashMap<Integer, SectionSelectionState> selectionState = new HashMap<>(selectionStateBySection);
selectionStateBySection.clear();
for (int i : selectionState.keySet()) {
if (-1 < 0 && i == sectionIndex) {
continue;
}
int j = i;
if (j >= sectionIndex) {
j += -1;
}
selectionStateBySection.put(j, selectionState.get(i));
}
</DeepExtract>
} | DouDou | positive | 439,658 |
public void Fill() throws java.io.IOException {
FolderStartPackStreamIndex.clear();
FolderStartPackStreamIndex.Reserve(Folders.size());
int startPos = 0;
for (int i = 0; i < Folders.size(); i++) {
FolderStartPackStreamIndex.add(startPos);
startPos += Folders.get(i).PackStreams.size();
}
PackStreamStartPositions.clear();
PackStreamStartPositions.Reserve(PackSizes.size());
long startPos = 0;
for (int i = 0; i < PackSizes.size(); i++) {
PackStreamStartPositions.add(startPos);
startPos += PackSizes.get(i);
}
FolderStartFileIndex.clear();
FolderStartFileIndex.Reserve(Folders.size());
FileIndexToFolderIndexMap.clear();
FileIndexToFolderIndexMap.Reserve(Files.size());
int folderIndex = 0;
int indexInFolder = 0;
for (int i = 0; i < Files.size(); i++) {
FileItem file = Files.get(i);
boolean emptyStream = !file.HasStream;
if (emptyStream && indexInFolder == 0) {
FileIndexToFolderIndexMap.add(InArchive.kNumNoIndex);
continue;
}
if (indexInFolder == 0) {
for (; ; ) {
if (folderIndex >= Folders.size())
throw new java.io.IOException("Incorrect Header");
FolderStartFileIndex.add(i);
if (NumUnPackStreamsVector.get(folderIndex) != 0)
break;
folderIndex++;
}
}
FileIndexToFolderIndexMap.add(folderIndex);
if (emptyStream)
continue;
indexInFolder++;
if (indexInFolder >= NumUnPackStreamsVector.get(folderIndex)) {
folderIndex++;
indexInFolder = 0;
}
}
} | public void Fill() throws java.io.IOException {
FolderStartPackStreamIndex.clear();
FolderStartPackStreamIndex.Reserve(Folders.size());
int startPos = 0;
for (int i = 0; i < Folders.size(); i++) {
FolderStartPackStreamIndex.add(startPos);
startPos += Folders.get(i).PackStreams.size();
}
PackStreamStartPositions.clear();
PackStreamStartPositions.Reserve(PackSizes.size());
long startPos = 0;
for (int i = 0; i < PackSizes.size(); i++) {
PackStreamStartPositions.add(startPos);
startPos += PackSizes.get(i);
}
<DeepExtract>
FolderStartFileIndex.clear();
FolderStartFileIndex.Reserve(Folders.size());
FileIndexToFolderIndexMap.clear();
FileIndexToFolderIndexMap.Reserve(Files.size());
int folderIndex = 0;
int indexInFolder = 0;
for (int i = 0; i < Files.size(); i++) {
FileItem file = Files.get(i);
boolean emptyStream = !file.HasStream;
if (emptyStream && indexInFolder == 0) {
FileIndexToFolderIndexMap.add(InArchive.kNumNoIndex);
continue;
}
if (indexInFolder == 0) {
for (; ; ) {
if (folderIndex >= Folders.size())
throw new java.io.IOException("Incorrect Header");
FolderStartFileIndex.add(i);
if (NumUnPackStreamsVector.get(folderIndex) != 0)
break;
folderIndex++;
}
}
FileIndexToFolderIndexMap.add(folderIndex);
if (emptyStream)
continue;
indexInFolder++;
if (indexInFolder >= NumUnPackStreamsVector.get(folderIndex)) {
folderIndex++;
indexInFolder = 0;
}
}
</DeepExtract>
} | jarchive | positive | 439,659 |
@Test
public void testVoronoiWithTwoSites() {
final RectD clip = new RectD(-10, -10, 10, 10);
final PointD[] points1 = new PointD[] { new PointD(-5, 0), new PointD(5, 0) };
final Subdivision delaunay = Voronoi.findAll(points1, clip).toDelaunaySubdivision(true);
delaunay.validate();
final LineD[] delaunayEdges = delaunay.toLines();
assertEquals(Voronoi.findAll(points1, clip).delaunayEdges().length, delaunayEdges.length);
for (LineD edge : Voronoi.findAll(points1, clip).delaunayEdges()) if (PointDComparatorY.compareExact(edge.start, edge.end) > 0)
assertTrue(Arrays.asList(delaunayEdges).contains(edge.reverse()));
else
assertTrue(Arrays.asList(delaunayEdges).contains(edge));
final VoronoiMap voronoi = new VoronoiMap(Voronoi.findAll(points1, clip));
voronoi.source().validate();
final NavigableMap<Integer, SubdivisionFace> voronoiFaces = voronoi.source().faces();
assertEquals(Voronoi.findAll(points1, clip).voronoiRegions().length, voronoiFaces.size() - 1);
for (SubdivisionFace face : voronoiFaces.values()) {
if (face.outerEdge() == null)
continue;
final int index = voronoi.fromFace(face);
final PointD[] polygon = Voronoi.findAll(points1, clip).voronoiRegions()[index];
assertArrayEquivalent(polygon, face.outerEdge().cyclePolygon());
final PointD site = Voronoi.findAll(points1, clip).generatorSites[index];
assertNotEquals(PolygonLocation.OUTSIDE, face.outerEdge().locate(site));
}
final PointD[] points2 = new PointD[] { new PointD(0, 5), new PointD(0, -5) };
final Subdivision delaunay = Voronoi.findAll(points2, clip).toDelaunaySubdivision(true);
delaunay.validate();
final LineD[] delaunayEdges = delaunay.toLines();
assertEquals(Voronoi.findAll(points2, clip).delaunayEdges().length, delaunayEdges.length);
for (LineD edge : Voronoi.findAll(points2, clip).delaunayEdges()) if (PointDComparatorY.compareExact(edge.start, edge.end) > 0)
assertTrue(Arrays.asList(delaunayEdges).contains(edge.reverse()));
else
assertTrue(Arrays.asList(delaunayEdges).contains(edge));
final VoronoiMap voronoi = new VoronoiMap(Voronoi.findAll(points2, clip));
voronoi.source().validate();
final NavigableMap<Integer, SubdivisionFace> voronoiFaces = voronoi.source().faces();
assertEquals(Voronoi.findAll(points2, clip).voronoiRegions().length, voronoiFaces.size() - 1);
for (SubdivisionFace face : voronoiFaces.values()) {
if (face.outerEdge() == null)
continue;
final int index = voronoi.fromFace(face);
final PointD[] polygon = Voronoi.findAll(points2, clip).voronoiRegions()[index];
assertArrayEquivalent(polygon, face.outerEdge().cyclePolygon());
final PointD site = Voronoi.findAll(points2, clip).generatorSites[index];
assertNotEquals(PolygonLocation.OUTSIDE, face.outerEdge().locate(site));
}
final PointD[] points3 = new PointD[] { new PointD(-5, 5), new PointD(5, -5) };
final Subdivision delaunay = Voronoi.findAll(points3, clip).toDelaunaySubdivision(true);
delaunay.validate();
final LineD[] delaunayEdges = delaunay.toLines();
assertEquals(Voronoi.findAll(points3, clip).delaunayEdges().length, delaunayEdges.length);
for (LineD edge : Voronoi.findAll(points3, clip).delaunayEdges()) if (PointDComparatorY.compareExact(edge.start, edge.end) > 0)
assertTrue(Arrays.asList(delaunayEdges).contains(edge.reverse()));
else
assertTrue(Arrays.asList(delaunayEdges).contains(edge));
final VoronoiMap voronoi = new VoronoiMap(Voronoi.findAll(points3, clip));
voronoi.source().validate();
final NavigableMap<Integer, SubdivisionFace> voronoiFaces = voronoi.source().faces();
assertEquals(Voronoi.findAll(points3, clip).voronoiRegions().length, voronoiFaces.size() - 1);
for (SubdivisionFace face : voronoiFaces.values()) {
if (face.outerEdge() == null)
continue;
final int index = voronoi.fromFace(face);
final PointD[] polygon = Voronoi.findAll(points3, clip).voronoiRegions()[index];
assertArrayEquivalent(polygon, face.outerEdge().cyclePolygon());
final PointD site = Voronoi.findAll(points3, clip).generatorSites[index];
assertNotEquals(PolygonLocation.OUTSIDE, face.outerEdge().locate(site));
}
final PointD[] points4 = new PointD[] { new PointD(-5, -5), new PointD(5, 5) };
final Subdivision delaunay = Voronoi.findAll(points4, clip).toDelaunaySubdivision(true);
delaunay.validate();
final LineD[] delaunayEdges = delaunay.toLines();
assertEquals(Voronoi.findAll(points4, clip).delaunayEdges().length, delaunayEdges.length);
for (LineD edge : Voronoi.findAll(points4, clip).delaunayEdges()) if (PointDComparatorY.compareExact(edge.start, edge.end) > 0)
assertTrue(Arrays.asList(delaunayEdges).contains(edge.reverse()));
else
assertTrue(Arrays.asList(delaunayEdges).contains(edge));
final VoronoiMap voronoi = new VoronoiMap(Voronoi.findAll(points4, clip));
voronoi.source().validate();
final NavigableMap<Integer, SubdivisionFace> voronoiFaces = voronoi.source().faces();
assertEquals(Voronoi.findAll(points4, clip).voronoiRegions().length, voronoiFaces.size() - 1);
for (SubdivisionFace face : voronoiFaces.values()) {
if (face.outerEdge() == null)
continue;
final int index = voronoi.fromFace(face);
final PointD[] polygon = Voronoi.findAll(points4, clip).voronoiRegions()[index];
assertArrayEquivalent(polygon, face.outerEdge().cyclePolygon());
final PointD site = Voronoi.findAll(points4, clip).generatorSites[index];
assertNotEquals(PolygonLocation.OUTSIDE, face.outerEdge().locate(site));
}
} | @Test
public void testVoronoiWithTwoSites() {
final RectD clip = new RectD(-10, -10, 10, 10);
final PointD[] points1 = new PointD[] { new PointD(-5, 0), new PointD(5, 0) };
final Subdivision delaunay = Voronoi.findAll(points1, clip).toDelaunaySubdivision(true);
delaunay.validate();
final LineD[] delaunayEdges = delaunay.toLines();
assertEquals(Voronoi.findAll(points1, clip).delaunayEdges().length, delaunayEdges.length);
for (LineD edge : Voronoi.findAll(points1, clip).delaunayEdges()) if (PointDComparatorY.compareExact(edge.start, edge.end) > 0)
assertTrue(Arrays.asList(delaunayEdges).contains(edge.reverse()));
else
assertTrue(Arrays.asList(delaunayEdges).contains(edge));
final VoronoiMap voronoi = new VoronoiMap(Voronoi.findAll(points1, clip));
voronoi.source().validate();
final NavigableMap<Integer, SubdivisionFace> voronoiFaces = voronoi.source().faces();
assertEquals(Voronoi.findAll(points1, clip).voronoiRegions().length, voronoiFaces.size() - 1);
for (SubdivisionFace face : voronoiFaces.values()) {
if (face.outerEdge() == null)
continue;
final int index = voronoi.fromFace(face);
final PointD[] polygon = Voronoi.findAll(points1, clip).voronoiRegions()[index];
assertArrayEquivalent(polygon, face.outerEdge().cyclePolygon());
final PointD site = Voronoi.findAll(points1, clip).generatorSites[index];
assertNotEquals(PolygonLocation.OUTSIDE, face.outerEdge().locate(site));
}
final PointD[] points2 = new PointD[] { new PointD(0, 5), new PointD(0, -5) };
final Subdivision delaunay = Voronoi.findAll(points2, clip).toDelaunaySubdivision(true);
delaunay.validate();
final LineD[] delaunayEdges = delaunay.toLines();
assertEquals(Voronoi.findAll(points2, clip).delaunayEdges().length, delaunayEdges.length);
for (LineD edge : Voronoi.findAll(points2, clip).delaunayEdges()) if (PointDComparatorY.compareExact(edge.start, edge.end) > 0)
assertTrue(Arrays.asList(delaunayEdges).contains(edge.reverse()));
else
assertTrue(Arrays.asList(delaunayEdges).contains(edge));
final VoronoiMap voronoi = new VoronoiMap(Voronoi.findAll(points2, clip));
voronoi.source().validate();
final NavigableMap<Integer, SubdivisionFace> voronoiFaces = voronoi.source().faces();
assertEquals(Voronoi.findAll(points2, clip).voronoiRegions().length, voronoiFaces.size() - 1);
for (SubdivisionFace face : voronoiFaces.values()) {
if (face.outerEdge() == null)
continue;
final int index = voronoi.fromFace(face);
final PointD[] polygon = Voronoi.findAll(points2, clip).voronoiRegions()[index];
assertArrayEquivalent(polygon, face.outerEdge().cyclePolygon());
final PointD site = Voronoi.findAll(points2, clip).generatorSites[index];
assertNotEquals(PolygonLocation.OUTSIDE, face.outerEdge().locate(site));
}
final PointD[] points3 = new PointD[] { new PointD(-5, 5), new PointD(5, -5) };
final Subdivision delaunay = Voronoi.findAll(points3, clip).toDelaunaySubdivision(true);
delaunay.validate();
final LineD[] delaunayEdges = delaunay.toLines();
assertEquals(Voronoi.findAll(points3, clip).delaunayEdges().length, delaunayEdges.length);
for (LineD edge : Voronoi.findAll(points3, clip).delaunayEdges()) if (PointDComparatorY.compareExact(edge.start, edge.end) > 0)
assertTrue(Arrays.asList(delaunayEdges).contains(edge.reverse()));
else
assertTrue(Arrays.asList(delaunayEdges).contains(edge));
final VoronoiMap voronoi = new VoronoiMap(Voronoi.findAll(points3, clip));
voronoi.source().validate();
final NavigableMap<Integer, SubdivisionFace> voronoiFaces = voronoi.source().faces();
assertEquals(Voronoi.findAll(points3, clip).voronoiRegions().length, voronoiFaces.size() - 1);
for (SubdivisionFace face : voronoiFaces.values()) {
if (face.outerEdge() == null)
continue;
final int index = voronoi.fromFace(face);
final PointD[] polygon = Voronoi.findAll(points3, clip).voronoiRegions()[index];
assertArrayEquivalent(polygon, face.outerEdge().cyclePolygon());
final PointD site = Voronoi.findAll(points3, clip).generatorSites[index];
assertNotEquals(PolygonLocation.OUTSIDE, face.outerEdge().locate(site));
}
final PointD[] points4 = new PointD[] { new PointD(-5, -5), new PointD(5, 5) };
<DeepExtract>
final Subdivision delaunay = Voronoi.findAll(points4, clip).toDelaunaySubdivision(true);
delaunay.validate();
final LineD[] delaunayEdges = delaunay.toLines();
assertEquals(Voronoi.findAll(points4, clip).delaunayEdges().length, delaunayEdges.length);
for (LineD edge : Voronoi.findAll(points4, clip).delaunayEdges()) if (PointDComparatorY.compareExact(edge.start, edge.end) > 0)
assertTrue(Arrays.asList(delaunayEdges).contains(edge.reverse()));
else
assertTrue(Arrays.asList(delaunayEdges).contains(edge));
final VoronoiMap voronoi = new VoronoiMap(Voronoi.findAll(points4, clip));
voronoi.source().validate();
final NavigableMap<Integer, SubdivisionFace> voronoiFaces = voronoi.source().faces();
assertEquals(Voronoi.findAll(points4, clip).voronoiRegions().length, voronoiFaces.size() - 1);
for (SubdivisionFace face : voronoiFaces.values()) {
if (face.outerEdge() == null)
continue;
final int index = voronoi.fromFace(face);
final PointD[] polygon = Voronoi.findAll(points4, clip).voronoiRegions()[index];
assertArrayEquivalent(polygon, face.outerEdge().cyclePolygon());
final PointD site = Voronoi.findAll(points4, clip).generatorSites[index];
assertNotEquals(PolygonLocation.OUTSIDE, face.outerEdge().locate(site));
}
</DeepExtract>
} | tektosyne | positive | 439,661 |
public static void main(String[] args) throws Exception {
AgentUtils.install();
byte[] bytes = this.enhanceClass(Sample.class, new String[] { "hello" }, SampleInterceptor.class);
System.out.println(Decompiler.decompile(bytes));
System.out.println("Before reTransform ...");
new Sample().hello("world", 50, 1.0);
VerifyUtils.asmVerify(bytes, true);
AgentUtils.reTransform(Sample.class, bytes);
System.out.println("After reTransform ...");
new Sample().hello("world", 50, 1.0);
} | public static void main(String[] args) throws Exception {
<DeepExtract>
AgentUtils.install();
byte[] bytes = this.enhanceClass(Sample.class, new String[] { "hello" }, SampleInterceptor.class);
System.out.println(Decompiler.decompile(bytes));
System.out.println("Before reTransform ...");
new Sample().hello("world", 50, 1.0);
VerifyUtils.asmVerify(bytes, true);
AgentUtils.reTransform(Sample.class, bytes);
System.out.println("After reTransform ...");
new Sample().hello("world", 50, 1.0);
</DeepExtract>
} | bytekit | positive | 439,662 |
private boolean save(File file) {
FileOutputStream out;
try {
out = new FileOutputStream(file);
} catch (FileNotFoundException e) {
ShowError.msg(this, "File not found!");
return false;
}
new SgfWriter(out, m_root, m_gameinfo);
return true;
} | private boolean save(File file) {
<DeepExtract>
FileOutputStream out;
try {
out = new FileOutputStream(file);
} catch (FileNotFoundException e) {
ShowError.msg(this, "File not found!");
return false;
}
new SgfWriter(out, m_root, m_gameinfo);
return true;
</DeepExtract>
} | hexgui | positive | 439,664 |
public String getText() throws IOException {
if (revid < 1L)
throw new IllegalArgumentException("Log entries have no valid content!");
if (pageDeleted) {
String url = query + "prop=deletedrevisions&drvprop=content&revids=" + revid;
temp = fetch(url, "Revision.getText");
} else {
String url = base + URLEncoder.encode(title, "UTF-8") + "&oldid=" + revid + "&action=raw";
temp = fetch(url, "Revision.getText");
}
logger.logp(Level.INFO, "Wiki", "Revision.getText", "[{0}] {1}", new Object[] { domain, "Successfully retrieved text of revision " + revid });
return temp;
} | public String getText() throws IOException {
if (revid < 1L)
throw new IllegalArgumentException("Log entries have no valid content!");
if (pageDeleted) {
String url = query + "prop=deletedrevisions&drvprop=content&revids=" + revid;
temp = fetch(url, "Revision.getText");
} else {
String url = base + URLEncoder.encode(title, "UTF-8") + "&oldid=" + revid + "&action=raw";
temp = fetch(url, "Revision.getText");
}
<DeepExtract>
logger.logp(Level.INFO, "Wiki", "Revision.getText", "[{0}] {1}", new Object[] { domain, "Successfully retrieved text of revision " + revid });
</DeepExtract>
return temp;
} | Mediawiki-Japi | positive | 439,665 |
@Override
public void close(boolean success) {
closed = true;
ensureNotClosed();
successCount.set(successCount.get());
eventSinksByEvent.get(Event.UPDATE_SUCCESS).accept(() -> delegate.updateSuccess(successCount.get()));
Collection<KeyedError> errors = new ArrayList<>();
pendingErrors.drainTo(errors);
if (!errors.isEmpty()) {
delegate.addFailures(errors);
}
eventSinksByEvent.values().forEach(Closeable::close);
executor.close();
delegate.completed(success);
} | @Override
public void close(boolean success) {
closed = true;
ensureNotClosed();
successCount.set(successCount.get());
eventSinksByEvent.get(Event.UPDATE_SUCCESS).accept(() -> delegate.updateSuccess(successCount.get()));
<DeepExtract>
Collection<KeyedError> errors = new ArrayList<>();
pendingErrors.drainTo(errors);
if (!errors.isEmpty()) {
delegate.addFailures(errors);
}
</DeepExtract>
eventSinksByEvent.values().forEach(Closeable::close);
executor.close();
delegate.completed(success);
} | jiotty-photos-uploader | positive | 439,666 |
public String readUpToPrompt() {
String ret = "";
int loops = 0;
final int READ_TIMEOUT = 3;
final int MIN_READ_INTERVAL = 10;
final int MAX_READ_INTERVAL = 300;
long upTimeLimit = eTime.getUptimeSeconds() + READ_TIMEOUT;
long TEMPTIMESTART = EasyTime.getUnixTime();
long timeLeft = 1;
int loopCount = 0;
while (mThreadsOn == true && !ret.endsWith("" + '>') && isConnected() != false) {
loopCount++;
timeLeft = upTimeLimit - eTime.getUptimeSeconds();
if (timeLeft > READ_TIMEOUT) {
msg("WTFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - timeleft=" + timeLeft + " and timeout=" + READ_TIMEOUT + " THIS SHIT SHOULD NOT FUCKING HAPPEN. BAILING OUT.");
timeLeft = 0;
}
if (inputBytesAvailable() == 0) {
if (loopCount < 100)
safeSleep(MIN_READ_INTERVAL);
else
safeSleep(MAX_READ_INTERVAL);
}
ret = ret + readInputBuffer('>');
if (timeLeft <= 0) {
if (DEBUG)
msg("Timeout during read: didn't see prompt within " + READ_TIMEOUT + " seconds. RETURNING " + ret.length() + " bytes, timeout=" + READ_TIMEOUT + " loops=" + loops);
break;
}
loops++;
}
if (DEBUG) {
long elpsd = TEMPTIMESTART - EasyTime.getUnixTime();
if (elpsd < 5 && ret.length() < 1) {
if (DEBUG)
msg("ebt.readuptocharacter: No bytes were read by elapsed time seems to be too low... elapsed=" + elpsd);
}
}
if (loops > 30) {
if (DEBUG)
msg("readUpToPrompt(): Looped " + loops + " times waiting for prompt (that was probably too many). ");
} else {
}
return ret;
} | public String readUpToPrompt() {
<DeepExtract>
String ret = "";
int loops = 0;
final int READ_TIMEOUT = 3;
final int MIN_READ_INTERVAL = 10;
final int MAX_READ_INTERVAL = 300;
long upTimeLimit = eTime.getUptimeSeconds() + READ_TIMEOUT;
long TEMPTIMESTART = EasyTime.getUnixTime();
long timeLeft = 1;
int loopCount = 0;
while (mThreadsOn == true && !ret.endsWith("" + '>') && isConnected() != false) {
loopCount++;
timeLeft = upTimeLimit - eTime.getUptimeSeconds();
if (timeLeft > READ_TIMEOUT) {
msg("WTFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - timeleft=" + timeLeft + " and timeout=" + READ_TIMEOUT + " THIS SHIT SHOULD NOT FUCKING HAPPEN. BAILING OUT.");
timeLeft = 0;
}
if (inputBytesAvailable() == 0) {
if (loopCount < 100)
safeSleep(MIN_READ_INTERVAL);
else
safeSleep(MAX_READ_INTERVAL);
}
ret = ret + readInputBuffer('>');
if (timeLeft <= 0) {
if (DEBUG)
msg("Timeout during read: didn't see prompt within " + READ_TIMEOUT + " seconds. RETURNING " + ret.length() + " bytes, timeout=" + READ_TIMEOUT + " loops=" + loops);
break;
}
loops++;
}
if (DEBUG) {
long elpsd = TEMPTIMESTART - EasyTime.getUnixTime();
if (elpsd < 5 && ret.length() < 1) {
if (DEBUG)
msg("ebt.readuptocharacter: No bytes were read by elapsed time seems to be too low... elapsed=" + elpsd);
}
}
if (loops > 30) {
if (DEBUG)
msg("readUpToPrompt(): Looped " + loops + " times waiting for prompt (that was probably too many). ");
} else {
}
return ret;
</DeepExtract>
} | libvoyager | positive | 439,668 |
public static void initRunningAccount() {
ThreadHolder th = contextHolder.get();
if (null == th) {
th = new ThreadHolder();
contextHolder.set(th);
}
String runningAccountId = AdamUUIDUtils.getUUID();
th.setRunningAccountId(runningAccountId);
if (null == contextHolder.get()) {
initRunningAccount();
}
contextHolder.get().setStatus(0);
th.setBegin(AdamTimeUtil.getNow());
} | public static void initRunningAccount() {
ThreadHolder th = contextHolder.get();
if (null == th) {
th = new ThreadHolder();
contextHolder.set(th);
}
String runningAccountId = AdamUUIDUtils.getUUID();
th.setRunningAccountId(runningAccountId);
<DeepExtract>
if (null == contextHolder.get()) {
initRunningAccount();
}
contextHolder.get().setStatus(0);
</DeepExtract>
th.setBegin(AdamTimeUtil.getNow());
} | adam_asyn | positive | 439,670 |
private void readJSONObjectEnd() throws TException {
byte ch = reader_.read();
if (ch != RBRACE[0]) {
throw new TProtocolException(TProtocolException.INVALID_DATA, "Unexpected character:" + (char) ch);
}
context_ = contextStack_.pop();
} | private void readJSONObjectEnd() throws TException {
byte ch = reader_.read();
if (ch != RBRACE[0]) {
throw new TProtocolException(TProtocolException.INVALID_DATA, "Unexpected character:" + (char) ch);
}
<DeepExtract>
context_ = contextStack_.pop();
</DeepExtract>
} | Thrift-Client-Server-Example--PHP- | positive | 439,671 |
public RemovableRouteMatcher allWithRegEx(String regex, Handler<HttpServerRequest> handler) {
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
getBindings.add(binding);
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
putBindings.add(binding);
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
postBindings.add(binding);
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
deleteBindings.add(binding);
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
optionsBindings.add(binding);
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
headBindings.add(binding);
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
traceBindings.add(binding);
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
connectBindings.add(binding);
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
patchBindings.add(binding);
return this;
} | public RemovableRouteMatcher allWithRegEx(String regex, Handler<HttpServerRequest> handler) {
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
getBindings.add(binding);
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
putBindings.add(binding);
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
postBindings.add(binding);
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
deleteBindings.add(binding);
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
optionsBindings.add(binding);
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
headBindings.add(binding);
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
traceBindings.add(binding);
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
connectBindings.add(binding);
<DeepExtract>
PatternBinding binding = new PatternBinding(Pattern.compile(regex), null, handler);
patchBindings.add(binding);
</DeepExtract>
return this;
} | platform | positive | 439,675 |
private double mid(HasGeometry o) {
Rectangle mbr;
if (!root.isPresent())
mbr = empty();
else
mbr = of(root.get().geometry().mbr());
if (dimension == 0)
return (mbr.x1() + mbr.x2()) / 2;
else
return (mbr.y1() + mbr.y2()) / 2;
} | private double mid(HasGeometry o) {
<DeepExtract>
Rectangle mbr;
if (!root.isPresent())
mbr = empty();
else
mbr = of(root.get().geometry().mbr());
</DeepExtract>
if (dimension == 0)
return (mbr.x1() + mbr.x2()) / 2;
else
return (mbr.y1() + mbr.y2()) / 2;
} | rtree2 | positive | 439,676 |
@Override
public void inject(CrawlDatums datums, boolean force) throws Exception {
Database database = env.openDatabase(null, "crawldb", BerkeleyDBUtils.defaultDBConfig);
for (int i = 0; i < datums.size(); i++) {
CrawlDatum datum = datums.get(i);
DatabaseEntry key = BerkeleyDBUtils.strToEntry(datum.key());
DatabaseEntry value = new DatabaseEntry();
if (!force) {
if (database.get(null, key, value, LockMode.DEFAULT) == OperationStatus.SUCCESS) {
continue;
}
}
value = BerkeleyDBUtils.strToEntry(datum.asJsonArray().toString());
database.put(null, key, value);
}
env.close();
} | @Override
public void inject(CrawlDatums datums, boolean force) throws Exception {
Database database = env.openDatabase(null, "crawldb", BerkeleyDBUtils.defaultDBConfig);
for (int i = 0; i < datums.size(); i++) {
CrawlDatum datum = datums.get(i);
DatabaseEntry key = BerkeleyDBUtils.strToEntry(datum.key());
DatabaseEntry value = new DatabaseEntry();
if (!force) {
if (database.get(null, key, value, LockMode.DEFAULT) == OperationStatus.SUCCESS) {
continue;
}
}
value = BerkeleyDBUtils.strToEntry(datum.asJsonArray().toString());
database.put(null, key, value);
}
<DeepExtract>
env.close();
</DeepExtract>
} | WebCollector | positive | 439,679 |
public void addRedisNode(SimpleRedisAliveNode node) {
node.connect();
redisNodes.add(node);
} | public void addRedisNode(SimpleRedisAliveNode node) {
<DeepExtract>
node.connect();
</DeepExtract>
redisNodes.add(node);
} | redis-cluster | positive | 439,680 |
private CA given(CABuilder builder) throws OperatorCreationException, CertIOException, CertificateException {
assertThat(ocspMode, not(nullValue()));
assertThat(crlCheckingMode, not(nullValue()));
assertThat(proxySupport, not(nullValue()));
assertThat(namespaceCheckingMode, not(nullValue()));
assertThat(updateInterval, not(nullValue()));
OCSPParametes ocspParameters = new OCSPParametes(ocspMode);
RevocationParameters revocationParams = new RevocationParameters(crlCheckingMode, ocspParameters);
ValidatorParams validatorParams = new ValidatorParams(revocationParams, proxySupport);
return new OpensslCertChainValidator(trustStore.toString(), true, namespaceCheckingMode, updateInterval.toMillis(), validatorParams, isLazy);
} | private CA given(CABuilder builder) throws OperatorCreationException, CertIOException, CertificateException {
<DeepExtract>
assertThat(ocspMode, not(nullValue()));
assertThat(crlCheckingMode, not(nullValue()));
assertThat(proxySupport, not(nullValue()));
assertThat(namespaceCheckingMode, not(nullValue()));
assertThat(updateInterval, not(nullValue()));
OCSPParametes ocspParameters = new OCSPParametes(ocspMode);
RevocationParameters revocationParams = new RevocationParameters(crlCheckingMode, ocspParameters);
ValidatorParams validatorParams = new ValidatorParams(revocationParams, proxySupport);
return new OpensslCertChainValidator(trustStore.toString(), true, namespaceCheckingMode, updateInterval.toMillis(), validatorParams, isLazy);
</DeepExtract>
} | canl-java | positive | 439,682 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.