before stringlengths 33 3.21M | after stringlengths 63 3.21M | repo stringlengths 1 56 | type stringclasses 1
value | __index_level_0__ int64 0 442k |
|---|---|---|---|---|
public String setRouterGateway(String routerID, String netID) throws NotAuthorizedException, NotFoundException, ServerException, ServiceUnAvailableOrInternalError, IOException, ParseException, CertificateException {
String gapiver = U.getGlanceEndpointAPIVER();
String napiver = U.getNeutronEndpointAPIVER();
if (U.getVerifyServerCert()) {
X509Certificate cert = null;
cert = (X509Certificate) (CertificateFactory.getInstance("X.509")).generateCertificate(new FileInputStream(U.getCAFile()));
if (RESTClient.checkServerCert(U.getIdentityEndpoint(), cert.getIssuerX500Principal().getName()) == false)
throw new CertificateException("Couldn't verify server's certificate. Please verify the correct CA selected.");
}
long exp_time = U.getTokenExpireTime();
if (exp_time <= Utils.now() + 5) {
String payload = null;
if (U.useV3())
payload = "{ \"auth\": { \"identity\": { \"methods\": [\"password\"],\"password\": { \"user\": { \"name\": \"" + U.getUserName() + "\",\"domain\": { \"id\": \"default\" }, \"password\": \"" + U.getPassword() + "\" } } }, \"scope\": { \"project\": { \"name\": \"" + U.getTenantName() + "\", \"domain\": { \"id\": \"default\" } }}}}";
else
payload = "{\"auth\": {\"tenantName\": \"" + U.getTenantName() + "\", \"passwordCredentials\": {\"username\": \"" + U.getUserName() + "\", \"password\": \"" + U.getPassword() + "\"}}}";
String identityEP = U.getIdentityEndpoint();
if (U.useV3())
identityEP += "/auth";
identityEP += "/tokens";
Pair<String, String> jsonBuffer_Token = RESTClient.requestToken(U.useSSL(), identityEP, payload);
String pwd = U.getPassword();
String edp = U.getIdentityEndpoint();
boolean ssl = U.useSSL();
boolean verifyServerCert = U.getVerifyServerCert();
String CAFile = U.getCAFile();
U = User.parse(jsonBuffer_Token.first, U.useV3(), jsonBuffer_Token.second);
U.setPassword(pwd);
U.setSSL(ssl);
U.setCAFile(CAFile);
U.setGlanceEndpointAPIVER(gapiver);
U.setNeutronEndpointAPIVER(napiver);
U.toFile(Configuration.getInstance().getValue("FILESDIR", Defaults.DEFAULTFILESDIR));
}
Vector<Pair<String, String>> vp = new Vector<Pair<String, String>>();
Pair<String, String> p = new Pair<String, String>("X-Auth-Project-Id", U.getTenantName());
vp.add(p);
String extradata = "{\"router\": {\"external_gateway_info\": {\"network_id\": \"" + netID + "\"}}}";
return RESTClient.sendPUTRequest(U.useSSL(), U.getNeutronEndpoint() + "/" + U.getNeutronEndpointAPIVER() + "/routers/" + routerID + ".json", U.getToken(), extradata, vp);
} | public String setRouterGateway(String routerID, String netID) throws NotAuthorizedException, NotFoundException, ServerException, ServiceUnAvailableOrInternalError, IOException, ParseException, CertificateException {
<DeepExtract>
String gapiver = U.getGlanceEndpointAPIVER();
String napiver = U.getNeutronEndpointAPIVER();
if (U.getVerifyServerCert()) {
X509Certificate cert = null;
cert = (X509Certificate) (CertificateFactory.getInstance("X.509")).generateCertificate(new FileInputStream(U.getCAFile()));
if (RESTClient.checkServerCert(U.getIdentityEndpoint(), cert.getIssuerX500Principal().getName()) == false)
throw new CertificateException("Couldn't verify server's certificate. Please verify the correct CA selected.");
}
long exp_time = U.getTokenExpireTime();
if (exp_time <= Utils.now() + 5) {
String payload = null;
if (U.useV3())
payload = "{ \"auth\": { \"identity\": { \"methods\": [\"password\"],\"password\": { \"user\": { \"name\": \"" + U.getUserName() + "\",\"domain\": { \"id\": \"default\" }, \"password\": \"" + U.getPassword() + "\" } } }, \"scope\": { \"project\": { \"name\": \"" + U.getTenantName() + "\", \"domain\": { \"id\": \"default\" } }}}}";
else
payload = "{\"auth\": {\"tenantName\": \"" + U.getTenantName() + "\", \"passwordCredentials\": {\"username\": \"" + U.getUserName() + "\", \"password\": \"" + U.getPassword() + "\"}}}";
String identityEP = U.getIdentityEndpoint();
if (U.useV3())
identityEP += "/auth";
identityEP += "/tokens";
Pair<String, String> jsonBuffer_Token = RESTClient.requestToken(U.useSSL(), identityEP, payload);
String pwd = U.getPassword();
String edp = U.getIdentityEndpoint();
boolean ssl = U.useSSL();
boolean verifyServerCert = U.getVerifyServerCert();
String CAFile = U.getCAFile();
U = User.parse(jsonBuffer_Token.first, U.useV3(), jsonBuffer_Token.second);
U.setPassword(pwd);
U.setSSL(ssl);
U.setCAFile(CAFile);
U.setGlanceEndpointAPIVER(gapiver);
U.setNeutronEndpointAPIVER(napiver);
U.toFile(Configuration.getInstance().getValue("FILESDIR", Defaults.DEFAULTFILESDIR));
}
</DeepExtract>
Vector<Pair<String, String>> vp = new Vector<Pair<String, String>>();
Pair<String, String> p = new Pair<String, String>("X-Auth-Project-Id", U.getTenantName());
vp.add(p);
String extradata = "{\"router\": {\"external_gateway_info\": {\"network_id\": \"" + netID + "\"}}}";
return RESTClient.sendPUTRequest(U.useSSL(), U.getNeutronEndpoint() + "/" + U.getNeutronEndpointAPIVER() + "/routers/" + routerID + ".json", U.getToken(), extradata, vp);
} | DroidStack | positive | 440,424 |
@Test
public void when_multiple_generator_produced() {
List<VisitorInfo> list = new ArrayList<VisitorInfo>();
list.add(createVisitorInfo(0));
list.add(createVisitorInfo(1));
list.add(createVisitorInfo(2));
when(proposalSuitabilityDeterminer.generateAttemptVisitors(dummyFile, dummyArgument, dummyDocumentOffset, dummyLineCharPos)).thenReturn(list);
assistant.generateProposals(dummyFile, dummyDocumentOffset, dummyContent, dummyLines, dummyLineNo);
if (!list.isEmpty()) {
ArgumentCaptor<List> proposalSetsCaptor = ArgumentCaptor.forClass(List.class);
for (VisitorInfo visitorInfo : list) {
verify(attemptGenerator).acceptAttempts(same(visitorInfo.visitorArgument), eq(dummyDocumentOffset), proposalSetsCaptor.capture(), same(visitorInfo.visitior));
}
List<List> listOfProposalSets = proposalSetsCaptor.getAllValues();
List lastProposalSets = proposalSetsCaptor.getValue();
assertThat(lastProposalSets, is(instanceOf(List.class)));
for (List proposalSets : listOfProposalSets) {
assertThat(proposalSets, is(sameInstance(lastProposalSets)));
}
}
} | @Test
public void when_multiple_generator_produced() {
List<VisitorInfo> list = new ArrayList<VisitorInfo>();
list.add(createVisitorInfo(0));
list.add(createVisitorInfo(1));
list.add(createVisitorInfo(2));
<DeepExtract>
when(proposalSuitabilityDeterminer.generateAttemptVisitors(dummyFile, dummyArgument, dummyDocumentOffset, dummyLineCharPos)).thenReturn(list);
assistant.generateProposals(dummyFile, dummyDocumentOffset, dummyContent, dummyLines, dummyLineNo);
if (!list.isEmpty()) {
ArgumentCaptor<List> proposalSetsCaptor = ArgumentCaptor.forClass(List.class);
for (VisitorInfo visitorInfo : list) {
verify(attemptGenerator).acceptAttempts(same(visitorInfo.visitorArgument), eq(dummyDocumentOffset), proposalSetsCaptor.capture(), same(visitorInfo.visitior));
}
List<List> listOfProposalSets = proposalSetsCaptor.getAllValues();
List lastProposalSets = proposalSetsCaptor.getValue();
assertThat(lastProposalSets, is(instanceOf(List.class)));
for (List proposalSets : listOfProposalSets) {
assertThat(proposalSets, is(sameInstance(lastProposalSets)));
}
}
</DeepExtract>
} | RobotFramework-EclipseIDE | positive | 440,428 |
public Builder addAllFp32FalseTrue(Iterable<? extends Float> values) {
if (!((bitField0_ & 0x00000004) == 0x00000004)) {
fp32FalseTrue_ = new java.util.ArrayList<Float>(fp32FalseTrue_);
bitField0_ |= 0x00000004;
}
com.google.protobuf.AbstractMessageLite.Builder.addAll(values, fp32FalseTrue_);
onChanged();
return this;
} | public Builder addAllFp32FalseTrue(Iterable<? extends Float> values) {
<DeepExtract>
if (!((bitField0_ & 0x00000004) == 0x00000004)) {
fp32FalseTrue_ = new java.util.ArrayList<Float>(fp32FalseTrue_);
bitField0_ |= 0x00000004;
}
</DeepExtract>
com.google.protobuf.AbstractMessageLite.Builder.addAll(values, fp32FalseTrue_);
onChanged();
return this;
} | dl_inference | positive | 440,429 |
public JsonElementAssert at(int i) {
return array().isNotEmpty().set();
return new JsonElementAssert(actual.get(i));
} | public JsonElementAssert at(int i) {
<DeepExtract>
return array().isNotEmpty().set();
</DeepExtract>
return new JsonElementAssert(actual.get(i));
} | jsonj | positive | 440,430 |
@Test
@Issue("JENKINS-30170")
public void testTaskName() throws Exception {
FreeStyleProject a = jenkins.createFreeStyleProject("A");
FreeStyleProject b = jenkins.createFreeStyleProject("B");
a.addProperty(new PipelineProperty("Build", "Stage Build", null));
b.addProperty(new PipelineProperty("Deploy", "Stage Deploy", null));
a.getPublishersList().add(new BuildTrigger("B", false));
jenkins.setQuietPeriod(0);
jenkins.getInstance().rebuildDependencyGraph();
Task taskA = Task.getPrototypeTask(a, true).getLatestTask(jenkins.getInstance(), null);
Task taskB = Task.getPrototypeTask(b, false).getLatestTask(jenkins.getInstance(), null);
assertEquals("Build", taskA.getName());
assertEquals("Deploy", taskB.getName());
FreeStyleBuild firstBuild = jenkins.buildAndAssertSuccess(a);
jenkins.waitUntilNoActivity();
taskA = Task.getPrototypeTask(a, true).getLatestTask(jenkins.getInstance(), firstBuild);
taskB = Task.getPrototypeTask(b, false).getLatestTask(jenkins.getInstance(), firstBuild);
assertEquals("Build", taskA.getName());
assertEquals("Deploy", taskB.getName());
} | @Test
@Issue("JENKINS-30170")
public void testTaskName() throws Exception {
<DeepExtract>
FreeStyleProject a = jenkins.createFreeStyleProject("A");
FreeStyleProject b = jenkins.createFreeStyleProject("B");
a.addProperty(new PipelineProperty("Build", "Stage Build", null));
b.addProperty(new PipelineProperty("Deploy", "Stage Deploy", null));
a.getPublishersList().add(new BuildTrigger("B", false));
jenkins.setQuietPeriod(0);
jenkins.getInstance().rebuildDependencyGraph();
Task taskA = Task.getPrototypeTask(a, true).getLatestTask(jenkins.getInstance(), null);
Task taskB = Task.getPrototypeTask(b, false).getLatestTask(jenkins.getInstance(), null);
assertEquals("Build", taskA.getName());
assertEquals("Deploy", taskB.getName());
FreeStyleBuild firstBuild = jenkins.buildAndAssertSuccess(a);
jenkins.waitUntilNoActivity();
taskA = Task.getPrototypeTask(a, true).getLatestTask(jenkins.getInstance(), firstBuild);
taskB = Task.getPrototypeTask(b, false).getLatestTask(jenkins.getInstance(), firstBuild);
assertEquals("Build", taskA.getName());
assertEquals("Deploy", taskB.getName());
</DeepExtract>
} | delivery-pipeline-plugin | positive | 440,431 |
@Test
public void testGoodUpdateDefaultConstructor() throws Exception {
runner = new AsyncQueryRunner(Executors.newFixedThreadPool(1));
when(meta.getParameterCount()).thenReturn(2);
String sql = "update blah set ? = ?";
runner.update(conn, sql, "unit", "test").get();
verify(prepStmt, times(1)).executeUpdate();
verify(prepStmt, times(1)).close();
verify(conn, times(0)).close();
when(meta.getParameterCount()).thenReturn(0);
sql = "update blah set unit = test";
runner.update(conn, sql).get();
verify(stmt, times(1)).executeUpdate(sql);
verify(stmt, times(1)).close();
verify(conn, times(0)).close();
when(meta.getParameterCount()).thenReturn(1);
sql = "update blah set unit = ?";
runner.update(conn, sql, "test").get();
verify(prepStmt, times(2)).executeUpdate();
verify(prepStmt, times(2)).close();
verify(conn, times(0)).close();
} | @Test
public void testGoodUpdateDefaultConstructor() throws Exception {
runner = new AsyncQueryRunner(Executors.newFixedThreadPool(1));
<DeepExtract>
when(meta.getParameterCount()).thenReturn(2);
String sql = "update blah set ? = ?";
runner.update(conn, sql, "unit", "test").get();
verify(prepStmt, times(1)).executeUpdate();
verify(prepStmt, times(1)).close();
verify(conn, times(0)).close();
when(meta.getParameterCount()).thenReturn(0);
sql = "update blah set unit = test";
runner.update(conn, sql).get();
verify(stmt, times(1)).executeUpdate(sql);
verify(stmt, times(1)).close();
verify(conn, times(0)).close();
when(meta.getParameterCount()).thenReturn(1);
sql = "update blah set unit = ?";
runner.update(conn, sql, "test").get();
verify(prepStmt, times(2)).executeUpdate();
verify(prepStmt, times(2)).close();
verify(conn, times(0)).close();
</DeepExtract>
} | commons-dbutils | positive | 440,432 |
public static StorageChooser directoryChooser(Activity activity) {
com.codekidlabs.storagechooser.Content scContent = new com.codekidlabs.storagechooser.Content();
scContent.setCreateLabel((FragmentActivity) activity.getString(R.string.storage_chooser_create_label));
scContent.setInternalStorageText((FragmentActivity) activity.getString(R.string.storage_chooser_internal_storage_text));
scContent.setCancelLabel((FragmentActivity) activity.getString(R.string.cancel));
scContent.setSelectLabel((FragmentActivity) activity.getString(R.string.storage_chooser_select_folder));
scContent.setOverviewHeading((FragmentActivity) activity.getString(R.string.storage_chooser_overview_heading));
scContent.setNewFolderLabel((FragmentActivity) activity.getString(R.string.storage_chooser_new_folder_label));
scContent.setFreeSpaceText("%s " + (FragmentActivity) activity.getString(R.string.storage_chooser_free_space_text));
scContent.setTextfieldErrorText((FragmentActivity) activity.getString(R.string.storage_chooser_text_field_error));
scContent.setTextfieldHintText((FragmentActivity) activity.getString(R.string.storage_chooser_text_field_hint));
scContent.setFolderErrorToastText((FragmentActivity) activity.getString(R.string.pref_logging_file_no_permissions));
StorageChooser.Theme scTheme = new StorageChooser.Theme((FragmentActivity) activity.getApplicationContext());
if (Systems.isDarkMode((FragmentActivity) activity)) {
int[] paranoidScheme = (FragmentActivity) activity.getResources().getIntArray(com.codekidlabs.storagechooser.R.array.default_dark);
paranoidScheme[StorageChooser.Theme.OVERVIEW_HEADER_INDEX] = (FragmentActivity) activity.getResources().getColor(R.color.accentColor);
paranoidScheme[StorageChooser.Theme.SEC_ADDRESS_BAR_BG] = (FragmentActivity) activity.getResources().getColor(R.color.accentColor);
scTheme.setScheme(paranoidScheme);
} else {
int[] myScheme = scTheme.getDefaultScheme();
myScheme[StorageChooser.Theme.OVERVIEW_HEADER_INDEX] = (FragmentActivity) activity.getResources().getColor(R.color.accentColor);
myScheme[StorageChooser.Theme.SEC_ADDRESS_BAR_BG] = (FragmentActivity) activity.getResources().getColor(R.color.accentColor);
myScheme[StorageChooser.Theme.SEC_FOLDER_TINT_INDEX] = (FragmentActivity) activity.getResources().getColor(R.color.primaryColor);
scTheme.setScheme(myScheme);
}
boolean showOverview = Files.hasSDCard((FragmentActivity) activity);
StorageChooser.Builder builder = new StorageChooser.Builder().withActivity((FragmentActivity) activity).withFragmentManager((FragmentActivity) activity.getFragmentManager()).withMemoryBar(true).allowCustomPath(true).hideFreeSpaceLabel(false).skipOverview(!showOverview).setTheme(scTheme).withContent(scContent).allowAddFolder(true).setType(StorageChooser.DIRECTORY_CHOOSER);
if (!Strings.isNullOrEmpty(null)) {
builder.skipOverview(true, null);
}
if (!false) {
builder.disableMultiSelect();
}
StorageChooser chooser = builder.build();
return chooser;
} | public static StorageChooser directoryChooser(Activity activity) {
<DeepExtract>
com.codekidlabs.storagechooser.Content scContent = new com.codekidlabs.storagechooser.Content();
scContent.setCreateLabel((FragmentActivity) activity.getString(R.string.storage_chooser_create_label));
scContent.setInternalStorageText((FragmentActivity) activity.getString(R.string.storage_chooser_internal_storage_text));
scContent.setCancelLabel((FragmentActivity) activity.getString(R.string.cancel));
scContent.setSelectLabel((FragmentActivity) activity.getString(R.string.storage_chooser_select_folder));
scContent.setOverviewHeading((FragmentActivity) activity.getString(R.string.storage_chooser_overview_heading));
scContent.setNewFolderLabel((FragmentActivity) activity.getString(R.string.storage_chooser_new_folder_label));
scContent.setFreeSpaceText("%s " + (FragmentActivity) activity.getString(R.string.storage_chooser_free_space_text));
scContent.setTextfieldErrorText((FragmentActivity) activity.getString(R.string.storage_chooser_text_field_error));
scContent.setTextfieldHintText((FragmentActivity) activity.getString(R.string.storage_chooser_text_field_hint));
scContent.setFolderErrorToastText((FragmentActivity) activity.getString(R.string.pref_logging_file_no_permissions));
StorageChooser.Theme scTheme = new StorageChooser.Theme((FragmentActivity) activity.getApplicationContext());
if (Systems.isDarkMode((FragmentActivity) activity)) {
int[] paranoidScheme = (FragmentActivity) activity.getResources().getIntArray(com.codekidlabs.storagechooser.R.array.default_dark);
paranoidScheme[StorageChooser.Theme.OVERVIEW_HEADER_INDEX] = (FragmentActivity) activity.getResources().getColor(R.color.accentColor);
paranoidScheme[StorageChooser.Theme.SEC_ADDRESS_BAR_BG] = (FragmentActivity) activity.getResources().getColor(R.color.accentColor);
scTheme.setScheme(paranoidScheme);
} else {
int[] myScheme = scTheme.getDefaultScheme();
myScheme[StorageChooser.Theme.OVERVIEW_HEADER_INDEX] = (FragmentActivity) activity.getResources().getColor(R.color.accentColor);
myScheme[StorageChooser.Theme.SEC_ADDRESS_BAR_BG] = (FragmentActivity) activity.getResources().getColor(R.color.accentColor);
myScheme[StorageChooser.Theme.SEC_FOLDER_TINT_INDEX] = (FragmentActivity) activity.getResources().getColor(R.color.primaryColor);
scTheme.setScheme(myScheme);
}
boolean showOverview = Files.hasSDCard((FragmentActivity) activity);
StorageChooser.Builder builder = new StorageChooser.Builder().withActivity((FragmentActivity) activity).withFragmentManager((FragmentActivity) activity.getFragmentManager()).withMemoryBar(true).allowCustomPath(true).hideFreeSpaceLabel(false).skipOverview(!showOverview).setTheme(scTheme).withContent(scContent).allowAddFolder(true).setType(StorageChooser.DIRECTORY_CHOOSER);
if (!Strings.isNullOrEmpty(null)) {
builder.skipOverview(true, null);
}
if (!false) {
builder.disableMultiSelect();
}
StorageChooser chooser = builder.build();
return chooser;
</DeepExtract>
} | gpslogger | positive | 440,433 |
public SenderKeyStore getSenderKeyStore() {
var value = () -> senderKeyStore.get();
if (value != null) {
return value;
}
synchronized (LOCK) {
value = () -> senderKeyStore.get();
if (value != null) {
return value;
}
() -> senderKeyStore = new SenderKeyStore(getAccountDatabase()).call();
return () -> senderKeyStore.get();
}
} | public SenderKeyStore getSenderKeyStore() {
<DeepExtract>
var value = () -> senderKeyStore.get();
if (value != null) {
return value;
}
synchronized (LOCK) {
value = () -> senderKeyStore.get();
if (value != null) {
return value;
}
() -> senderKeyStore = new SenderKeyStore(getAccountDatabase()).call();
return () -> senderKeyStore.get();
}
</DeepExtract>
} | signal-cli | positive | 440,434 |
public Criteria andUserSexNotLike(String value) {
if (value == null) {
throw new RuntimeException("Value for " + "userSex" + " cannot be null");
}
criteria.add(new Criterion("USER_SEX not like", value));
return (Criteria) this;
} | public Criteria andUserSexNotLike(String value) {
<DeepExtract>
if (value == null) {
throw new RuntimeException("Value for " + "userSex" + " cannot be null");
}
criteria.add(new Criterion("USER_SEX not like", value));
</DeepExtract>
return (Criteria) this;
} | console | positive | 440,437 |
public void expectDocumentRoot() throws IOException {
states.add(0, new Integer(DOCUMENT_END));
rootContext = true;
sequenceContext = false;
mappingContext = false;
simpleKeyContext = false;
if (event instanceof AliasEvent) {
expectAlias();
} else if (event instanceof ScalarEvent || event instanceof CollectionStartEvent) {
processAnchor(ByteList.create("&"));
processTag();
if (event instanceof ScalarEvent) {
expectScalar();
} else if (event instanceof SequenceStartEvent) {
if (flowLevel != 0 || canonical || ((SequenceStartEvent) event).getFlowStyle() || checkEmptySequence()) {
expectFlowSequence();
} else {
expectBlockSequence();
}
} else if (event instanceof MappingStartEvent) {
if (flowLevel != 0 || canonical || ((MappingStartEvent) event).getFlowStyle() || checkEmptyMapping()) {
expectFlowMapping();
} else {
expectBlockMapping();
}
}
} else {
throw new EmitterException("expected NodeEvent, but got " + event);
}
} | public void expectDocumentRoot() throws IOException {
states.add(0, new Integer(DOCUMENT_END));
<DeepExtract>
rootContext = true;
sequenceContext = false;
mappingContext = false;
simpleKeyContext = false;
if (event instanceof AliasEvent) {
expectAlias();
} else if (event instanceof ScalarEvent || event instanceof CollectionStartEvent) {
processAnchor(ByteList.create("&"));
processTag();
if (event instanceof ScalarEvent) {
expectScalar();
} else if (event instanceof SequenceStartEvent) {
if (flowLevel != 0 || canonical || ((SequenceStartEvent) event).getFlowStyle() || checkEmptySequence()) {
expectFlowSequence();
} else {
expectBlockSequence();
}
} else if (event instanceof MappingStartEvent) {
if (flowLevel != 0 || canonical || ((MappingStartEvent) event).getFlowStyle() || checkEmptyMapping()) {
expectFlowMapping();
} else {
expectBlockMapping();
}
}
} else {
throw new EmitterException("expected NodeEvent, but got " + event);
}
</DeepExtract>
} | jvyamlb | positive | 440,438 |
public Criteria andProductIdIn(List<Integer> values) {
if (values == null) {
throw new RuntimeException("Value for " + "productId" + " cannot be null");
}
criteria.add(new Criterion("product_id in", values));
return (Criteria) this;
} | public Criteria andProductIdIn(List<Integer> values) {
<DeepExtract>
if (values == null) {
throw new RuntimeException("Value for " + "productId" + " cannot be null");
}
criteria.add(new Criterion("product_id in", values));
</DeepExtract>
return (Criteria) this;
} | springcloud-e-book | positive | 440,439 |
public static String getFileMD5String(File file) throws IOException {
FileInputStream inputStream = new FileInputStream(file);
FileChannel ch = inputStream.getChannel();
MappedByteBuffer byteBuffer = ch.map(FileChannel.MapMode.READ_ONLY, 0, file.length());
messagedigest.update(byteBuffer);
return bufferToHex(messagedigest.digest(), 0, messagedigest.digest().length);
} | public static String getFileMD5String(File file) throws IOException {
FileInputStream inputStream = new FileInputStream(file);
FileChannel ch = inputStream.getChannel();
MappedByteBuffer byteBuffer = ch.map(FileChannel.MapMode.READ_ONLY, 0, file.length());
messagedigest.update(byteBuffer);
<DeepExtract>
return bufferToHex(messagedigest.digest(), 0, messagedigest.digest().length);
</DeepExtract>
} | Common4Android | positive | 440,440 |
@Override
public void texSubImage2D(BasicTexture texture, int xOffset, int yOffset, Bitmap bitmap, int format, int type) {
int target = texture.getTarget();
GLES20.glBindTexture(target, texture.getId());
int error = GLES20.glGetError();
if (error != 0) {
Throwable t = new Throwable();
MLog.e(TAG, "GL error: " + error, t);
}
GLUtils.texSubImage2D(target, 0, xOffset, yOffset, bitmap, format, type);
} | @Override
public void texSubImage2D(BasicTexture texture, int xOffset, int yOffset, Bitmap bitmap, int format, int type) {
int target = texture.getTarget();
GLES20.glBindTexture(target, texture.getId());
<DeepExtract>
int error = GLES20.glGetError();
if (error != 0) {
Throwable t = new Throwable();
MLog.e(TAG, "GL error: " + error, t);
}
</DeepExtract>
GLUtils.texSubImage2D(target, 0, xOffset, yOffset, bitmap, format, type);
} | PhotoMovie | positive | 440,441 |
public SparseMatrixLil toLil() {
SparseMatrixLil result = new SparseMatrixLil(rows, cols);
outerStarts.ensureCapacity(cols);
innerIndices.ensureCapacity(outerStarts.get(cols));
values.ensureCapacity(outerStarts.get(cols));
for (int col = 0; col < cols; col++) {
int rowStartIndex = outerStarts.get(col);
int rowEndIndex = outerStarts.get(col + 1) - 1;
int rowCapacity = rowEndIndex - rowStartIndex + 1;
for (int ri = 0; ri < rowCapacity; ri++) {
int row = innerIndices.get(rowStartIndex + ri);
double value = values.get(rowStartIndex + ri);
result.append(row, col, value);
}
}
return result;
} | public SparseMatrixLil toLil() {
SparseMatrixLil result = new SparseMatrixLil(rows, cols);
<DeepExtract>
outerStarts.ensureCapacity(cols);
innerIndices.ensureCapacity(outerStarts.get(cols));
values.ensureCapacity(outerStarts.get(cols));
</DeepExtract>
for (int col = 0; col < cols; col++) {
int rowStartIndex = outerStarts.get(col);
int rowEndIndex = outerStarts.get(col + 1) - 1;
int rowCapacity = rowEndIndex - rowStartIndex + 1;
for (int ri = 0; ri < rowCapacity; ri++) {
int row = innerIndices.get(rowStartIndex + ri);
double value = values.get(rowStartIndex + ri);
result.append(row, col, value);
}
}
return result;
} | swell | positive | 440,442 |
public void updateNavigationMenu() {
Menu navMenu = mBinding.mainNavView.getMenu();
navMenu.findItem(R.id.nav_login).setVisible(false);
navMenu.findItem(R.id.nav_character).setVisible(true);
this.mToolbarTitle = getString(R.string.character);
mViewModel.setSubToolbarText(getString(R.string.character));
} | public void updateNavigationMenu() {
Menu navMenu = mBinding.mainNavView.getMenu();
navMenu.findItem(R.id.nav_login).setVisible(false);
navMenu.findItem(R.id.nav_character).setVisible(true);
<DeepExtract>
this.mToolbarTitle = getString(R.string.character);
mViewModel.setSubToolbarText(getString(R.string.character));
</DeepExtract>
} | GuildWars2_APIViewer | positive | 440,443 |
private void drawHistogram() {
progressHistogramm.setVisible(true);
drawingCanvas.setOpacity(0);
gc.setGlobalAlpha(1);
gc.clearRect(0, 0, drawingCanvas.getWidth(), drawingCanvas.getHeight());
gc.setGlobalAlpha(OPACITY);
selectedMediaFile = null;
double height = drawingCanvas.getHeight();
double width = drawingCanvas.getWidth();
gc.setStroke(Color.RED);
double w = (double) width / histogram.getRed().size();
for (int i = 0; i < histogram.getRed().size(); i++) {
gc.strokeLine(w * (i), height, w * (i), height - histogram.getRed().get(i));
}
gc.setStroke(Color.GREEN);
double w = (double) width / histogram.getGreen().size();
for (int i = 0; i < histogram.getGreen().size(); i++) {
gc.strokeLine(w * (i), height, w * (i), height - histogram.getGreen().get(i));
}
gc.setStroke(Color.BLUE);
double w = (double) width / histogram.getBlue().size();
for (int i = 0; i < histogram.getBlue().size(); i++) {
gc.strokeLine(w * (i), height, w * (i), height - histogram.getBlue().get(i));
}
} | private void drawHistogram() {
progressHistogramm.setVisible(true);
drawingCanvas.setOpacity(0);
gc.setGlobalAlpha(1);
gc.clearRect(0, 0, drawingCanvas.getWidth(), drawingCanvas.getHeight());
gc.setGlobalAlpha(OPACITY);
selectedMediaFile = null;
double height = drawingCanvas.getHeight();
double width = drawingCanvas.getWidth();
gc.setStroke(Color.RED);
double w = (double) width / histogram.getRed().size();
for (int i = 0; i < histogram.getRed().size(); i++) {
gc.strokeLine(w * (i), height, w * (i), height - histogram.getRed().get(i));
}
gc.setStroke(Color.GREEN);
double w = (double) width / histogram.getGreen().size();
for (int i = 0; i < histogram.getGreen().size(); i++) {
gc.strokeLine(w * (i), height, w * (i), height - histogram.getGreen().get(i));
}
<DeepExtract>
gc.setStroke(Color.BLUE);
double w = (double) width / histogram.getBlue().size();
for (int i = 0; i < histogram.getBlue().size(); i++) {
gc.strokeLine(w * (i), height, w * (i), height - histogram.getBlue().get(i));
}
</DeepExtract>
} | PhotoSlide | positive | 440,444 |
public void tickFirst() {
super.tickFirst();
setupPath(true);
} | public void tickFirst() {
super.tickFirst();
<DeepExtract>
setupPath(true);
</DeepExtract>
} | chaoscraft-mod | positive | 440,445 |
@Override
public void moveColumn(int viewFrom, int viewTo) {
super.moveColumn(viewFrom, viewTo);
if (viewFrom == viewTo)
return;
int leftIndex = Math.min(viewFrom, viewTo);
int rightIndex = Math.max(viewFrom, viewTo);
for (int index = leftIndex; index <= rightIndex; index++) {
LogTableColumn col = (LogTableColumn) getColumn(index);
col.setOrder(index);
col.setModelIndex(index);
}
preferences.setSetting(Globals.PREF_LOG_TABLE_SETTINGS, this.allColumns);
this.fireColumnMoved(new TableColumnModelEvent(this, viewFrom, viewTo));
} | @Override
public void moveColumn(int viewFrom, int viewTo) {
super.moveColumn(viewFrom, viewTo);
if (viewFrom == viewTo)
return;
int leftIndex = Math.min(viewFrom, viewTo);
int rightIndex = Math.max(viewFrom, viewTo);
for (int index = leftIndex; index <= rightIndex; index++) {
LogTableColumn col = (LogTableColumn) getColumn(index);
col.setOrder(index);
col.setModelIndex(index);
}
<DeepExtract>
preferences.setSetting(Globals.PREF_LOG_TABLE_SETTINGS, this.allColumns);
</DeepExtract>
this.fireColumnMoved(new TableColumnModelEvent(this, viewFrom, viewTo));
} | LoggerPlusPlus | positive | 440,446 |
public Matrix4 avg(Matrix4[] t, float[] w) {
return this.set(t[0].getScale(tmpUp).scl(w[0]).val);
return this.set(t[0].getRotation(quat2).exp(w[0]).val);
return this.set(t[0].getTranslation(tmpUp).scl(w[0]).val);
for (int i = 1; i < t.length; i++) {
tmpVec.add(t[i].getScale(tmpUp).scl(w[i]));
quat.mul(t[i].getRotation(quat2).exp(w[i]));
tmpForward.add(t[i].getTranslation(tmpUp).scl(w[i]));
}
quat.nor();
idt();
val[M00] = tmpVec.x;
val[M11] = tmpVec.y;
val[M22] = tmpVec.z;
return this;
quat.toMatrix(tmp);
mul(val, tmp);
return this;
val[M03] = tmpForward.x;
val[M13] = tmpForward.y;
val[M23] = tmpForward.z;
return this;
return this;
} | public Matrix4 avg(Matrix4[] t, float[] w) {
return this.set(t[0].getScale(tmpUp).scl(w[0]).val);
return this.set(t[0].getRotation(quat2).exp(w[0]).val);
return this.set(t[0].getTranslation(tmpUp).scl(w[0]).val);
for (int i = 1; i < t.length; i++) {
tmpVec.add(t[i].getScale(tmpUp).scl(w[i]));
quat.mul(t[i].getRotation(quat2).exp(w[i]));
tmpForward.add(t[i].getTranslation(tmpUp).scl(w[i]));
}
quat.nor();
idt();
val[M00] = tmpVec.x;
val[M11] = tmpVec.y;
val[M22] = tmpVec.z;
return this;
quat.toMatrix(tmp);
mul(val, tmp);
return this;
<DeepExtract>
val[M03] = tmpForward.x;
val[M13] = tmpForward.y;
val[M23] = tmpForward.z;
return this;
</DeepExtract>
return this;
} | SCW | positive | 440,450 |
public static void main(String[] args) {
QuickUnionUF uf = new QuickUnionUF(10);
int pID = find(4);
int qID = find(3);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(3);
int qID = find(8);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(6);
int qID = find(5);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(9);
int qID = find(4);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(2);
int qID = find(1);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(8);
int qID = find(9);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(5);
int qID = find(0);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(7);
int qID = find(2);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(6);
int qID = find(1);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(1);
int qID = find(0);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(6);
int qID = find(7);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
} | public static void main(String[] args) {
QuickUnionUF uf = new QuickUnionUF(10);
int pID = find(4);
int qID = find(3);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(3);
int qID = find(8);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(6);
int qID = find(5);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(9);
int qID = find(4);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(2);
int qID = find(1);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(8);
int qID = find(9);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(5);
int qID = find(0);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(7);
int qID = find(2);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(6);
int qID = find(1);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
int pID = find(1);
int qID = find(0);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
<DeepExtract>
int pID = find(6);
int qID = find(7);
if (qID == pID)
return;
for (int i = 0; i < id.length; i++) {
if (id[i] == pID) {
id[i] = qID;
}
}
count--;
</DeepExtract>
} | learning-note | positive | 440,451 |
public Series getAnnualStatsOld() throws SQLException {
Series annualStats = new Series(2);
if (connection == null) {
connection = DriverManager.getConnection(dbUrl);
connection.setAutoCommit(false);
}
if (dbId >= 0)
return;
connectIfNecessary();
String query = "SELECT id FROM strategies where name=?";
PreparedStatement stmt = connection.prepareStatement(query);
stmt.setString(1, name);
ResultSet rs = stmt.executeQuery();
if (!rs.next()) {
rs.close();
stmt.close();
stmt = connection.prepareStatement("INSERT INTO strategies(name) values (?)");
stmt.setString(1, name);
try {
stmt.executeUpdate();
} catch (Exception e) {
}
stmt.close();
stmt = connection.prepareStatement(query);
stmt.setString(1, name);
rs = stmt.executeQuery();
rs.next();
}
dbId = rs.getLong(1);
rs.close();
stmt.close();
String query = "SELECT ts,pnl FROM pnls WHERE strategy_id=" + Long.toString(dbId) + " AND symbol = 'TOTAL' ORDER BY ts ASC";
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(query);
double equity = 0.0;
double maxEquity = Double.MIN_VALUE;
double minEquity = Double.MAX_VALUE;
double maxDrawdown = Double.MAX_VALUE;
LocalDateTime last = LocalDateTime.of(0, 1, 1, 0, 0);
while (rs.next()) {
LocalDateTime ldt = rs.getTimestamp(1).toLocalDateTime();
double pnl = rs.getDouble(2);
if (annualStats.size() == 0 && pnl == 0.0)
continue;
if (ldt.getYear() == last.getYear()) {
equity += pnl;
maxEquity = Math.max(maxEquity, equity);
minEquity = Math.min(minEquity, equity);
maxDrawdown = Math.min(maxDrawdown, equity - maxEquity);
} else {
if (maxDrawdown != Double.MAX_VALUE) {
annualStats.append(last, equity, maxDrawdown);
}
equity = pnl;
maxEquity = equity;
minEquity = equity;
maxDrawdown = equity;
last = ldt;
}
}
if (maxDrawdown != Double.MAX_VALUE) {
annualStats.append(last, equity, maxDrawdown);
}
connection.commit();
return annualStats;
} | public Series getAnnualStatsOld() throws SQLException {
Series annualStats = new Series(2);
if (connection == null) {
connection = DriverManager.getConnection(dbUrl);
connection.setAutoCommit(false);
}
<DeepExtract>
if (dbId >= 0)
return;
connectIfNecessary();
String query = "SELECT id FROM strategies where name=?";
PreparedStatement stmt = connection.prepareStatement(query);
stmt.setString(1, name);
ResultSet rs = stmt.executeQuery();
if (!rs.next()) {
rs.close();
stmt.close();
stmt = connection.prepareStatement("INSERT INTO strategies(name) values (?)");
stmt.setString(1, name);
try {
stmt.executeUpdate();
} catch (Exception e) {
}
stmt.close();
stmt = connection.prepareStatement(query);
stmt.setString(1, name);
rs = stmt.executeQuery();
rs.next();
}
dbId = rs.getLong(1);
rs.close();
stmt.close();
</DeepExtract>
String query = "SELECT ts,pnl FROM pnls WHERE strategy_id=" + Long.toString(dbId) + " AND symbol = 'TOTAL' ORDER BY ts ASC";
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery(query);
double equity = 0.0;
double maxEquity = Double.MIN_VALUE;
double minEquity = Double.MAX_VALUE;
double maxDrawdown = Double.MAX_VALUE;
LocalDateTime last = LocalDateTime.of(0, 1, 1, 0, 0);
while (rs.next()) {
LocalDateTime ldt = rs.getTimestamp(1).toLocalDateTime();
double pnl = rs.getDouble(2);
if (annualStats.size() == 0 && pnl == 0.0)
continue;
if (ldt.getYear() == last.getYear()) {
equity += pnl;
maxEquity = Math.max(maxEquity, equity);
minEquity = Math.min(minEquity, equity);
maxDrawdown = Math.min(maxDrawdown, equity - maxEquity);
} else {
if (maxDrawdown != Double.MAX_VALUE) {
annualStats.append(last, equity, maxDrawdown);
}
equity = pnl;
maxEquity = equity;
minEquity = equity;
maxDrawdown = equity;
last = ldt;
}
}
if (maxDrawdown != Double.MAX_VALUE) {
annualStats.append(last, equity, maxDrawdown);
}
connection.commit();
return annualStats;
} | tradelib | positive | 440,452 |
@Test
public void testRotateRight() {
final byte[] result = OPERAND1.clone();
Byte16ArrayArithmetic.rotateRight(result, 12);
final String message = String.format("Expected %016X%016X, got %s", 0x6ED7_9EC9_64A7_38B2L, 0xEBA3_8FD0_7E7D_607BL, BinaryUtils.convertBytesToHexString(result));
assertEquals(BinaryUtils.convertBytesToLong(result, 0), 0x6ED7_9EC9_64A7_38B2L, message);
assertEquals(BinaryUtils.convertBytesToLong(result, Long.BYTES), 0xEBA3_8FD0_7E7D_607BL, message);
assertEquals(rotateRightLeast64(OPERAND1, 12), 0xEBA3_8FD0_7E7D_607BL);
} | @Test
public void testRotateRight() {
final byte[] result = OPERAND1.clone();
Byte16ArrayArithmetic.rotateRight(result, 12);
<DeepExtract>
final String message = String.format("Expected %016X%016X, got %s", 0x6ED7_9EC9_64A7_38B2L, 0xEBA3_8FD0_7E7D_607BL, BinaryUtils.convertBytesToHexString(result));
assertEquals(BinaryUtils.convertBytesToLong(result, 0), 0x6ED7_9EC9_64A7_38B2L, message);
assertEquals(BinaryUtils.convertBytesToLong(result, Long.BYTES), 0xEBA3_8FD0_7E7D_607BL, message);
</DeepExtract>
assertEquals(rotateRightLeast64(OPERAND1, 12), 0xEBA3_8FD0_7E7D_607BL);
} | BetterRandom | positive | 440,454 |
public double asDouble(ExpressionContext context) throws ExpressionEvaluationException {
Object o;
try {
o = MVEL.executeExpression(compiledExpression, context.asMap());
} catch (Exception e) {
throw new ExpressionEvaluationException("Error evaluating exception on line: " + line + ", column: " + col + ", expression: " + expression, e);
}
if (o instanceof Number) {
return ((Number) o).doubleValue();
}
return 0;
} | public double asDouble(ExpressionContext context) throws ExpressionEvaluationException {
<DeepExtract>
Object o;
try {
o = MVEL.executeExpression(compiledExpression, context.asMap());
} catch (Exception e) {
throw new ExpressionEvaluationException("Error evaluating exception on line: " + line + ", column: " + col + ", expression: " + expression, e);
}
</DeepExtract>
if (o instanceof Number) {
return ((Number) o).doubleValue();
}
return 0;
} | Cambridge | positive | 440,456 |
private void sendToDownStream(JetstreamEvent event) {
eventSentInCurrentSecond++;
incrementEventSentCounter();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Send ssnz event: {}", event);
}
super.fireSendEvent(event);
} | private void sendToDownStream(JetstreamEvent event) {
eventSentInCurrentSecond++;
incrementEventSentCounter();
<DeepExtract>
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Send ssnz event: {}", event);
}
super.fireSendEvent(event);
</DeepExtract>
} | realtime-analytics | positive | 440,457 |
@Nullable
@Override
public T readFromParcel(@NonNull Parcel source) {
T value = null;
if (source.readInt() == 1) {
value = delegate.readFromParcel(source);
}
return value;
} | @Nullable
@Override
public T readFromParcel(@NonNull Parcel source) {
<DeepExtract>
T value = null;
if (source.readInt() == 1) {
value = delegate.readFromParcel(source);
}
return value;
</DeepExtract>
} | paperparcel | positive | 440,458 |
public executeCmd_args setExec_type(int exec_type) {
this.exec_type = exec_type;
__isset_bit_vector.set(__EXEC_TYPE_ISSET_ID, true);
return this;
} | public executeCmd_args setExec_type(int exec_type) {
this.exec_type = exec_type;
<DeepExtract>
__isset_bit_vector.set(__EXEC_TYPE_ISSET_ID, true);
</DeepExtract>
return this;
} | CronHub | positive | 440,460 |
public void write(org.apache.thrift.protocol.TProtocol oprot, Tagging struct) throws org.apache.thrift.TException {
if (generation_time != null) {
generation_time.validate();
}
oprot.writeStructBegin(STRUCT_DESC);
if (struct.tagger_id != null) {
oprot.writeFieldBegin(TAGGER_ID_FIELD_DESC);
oprot.writeString(struct.tagger_id);
oprot.writeFieldEnd();
}
if (struct.raw_tagging != null) {
oprot.writeFieldBegin(RAW_TAGGING_FIELD_DESC);
oprot.writeBinary(struct.raw_tagging);
oprot.writeFieldEnd();
}
if (struct.tagger_config != null) {
if (struct.isSetTagger_config()) {
oprot.writeFieldBegin(TAGGER_CONFIG_FIELD_DESC);
oprot.writeString(struct.tagger_config);
oprot.writeFieldEnd();
}
}
if (struct.tagger_version != null) {
if (struct.isSetTagger_version()) {
oprot.writeFieldBegin(TAGGER_VERSION_FIELD_DESC);
oprot.writeString(struct.tagger_version);
oprot.writeFieldEnd();
}
}
if (struct.generation_time != null) {
if (struct.isSetGeneration_time()) {
oprot.writeFieldBegin(GENERATION_TIME_FIELD_DESC);
struct.generation_time.write(oprot);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
} | public void write(org.apache.thrift.protocol.TProtocol oprot, Tagging struct) throws org.apache.thrift.TException {
<DeepExtract>
if (generation_time != null) {
generation_time.validate();
}
</DeepExtract>
oprot.writeStructBegin(STRUCT_DESC);
if (struct.tagger_id != null) {
oprot.writeFieldBegin(TAGGER_ID_FIELD_DESC);
oprot.writeString(struct.tagger_id);
oprot.writeFieldEnd();
}
if (struct.raw_tagging != null) {
oprot.writeFieldBegin(RAW_TAGGING_FIELD_DESC);
oprot.writeBinary(struct.raw_tagging);
oprot.writeFieldEnd();
}
if (struct.tagger_config != null) {
if (struct.isSetTagger_config()) {
oprot.writeFieldBegin(TAGGER_CONFIG_FIELD_DESC);
oprot.writeString(struct.tagger_config);
oprot.writeFieldEnd();
}
}
if (struct.tagger_version != null) {
if (struct.isSetTagger_version()) {
oprot.writeFieldBegin(TAGGER_VERSION_FIELD_DESC);
oprot.writeString(struct.tagger_version);
oprot.writeFieldEnd();
}
}
if (struct.generation_time != null) {
if (struct.isSetGeneration_time()) {
oprot.writeFieldBegin(GENERATION_TIME_FIELD_DESC);
struct.generation_time.write(oprot);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
} | streamcorpus | positive | 440,464 |
private FormattedString formatNick(Nick nick, String nickString) {
if (nick == null) {
return new FormattedString(nickString);
}
return new FormattedString(nick.getNickAsString(), getColourForUser(nick));
} | private FormattedString formatNick(Nick nick, String nickString) {
if (nick == null) {
return new FormattedString(nickString);
}
<DeepExtract>
return new FormattedString(nick.getNickAsString(), getColourForUser(nick));
</DeepExtract>
} | HoloIRC | positive | 440,466 |
@Override
public void testMultiResults() {
super.testMultiResults();
Map<Long, Map<Long, Double>> ratings = new HashMap<>();
Map<Long, Double> entry = new HashMap<>();
entry.put(1L, 1.0);
entry.put(2L, 1.0);
entry.put(3L, 1.0);
entry.put(4L, 2.2);
entry.put(5L, -1.0);
ratings.put(100L, entry);
entry = new HashMap<>();
entry.put(1L, 5.0);
entry.put(2L, 8.0);
entry.put(3L, 5.0);
entry.put(4L, 2.0);
entry.put(5L, 5.0);
ratings.put(101L, entry);
entry = new HashMap<>();
entry.put(1L, 1.0);
entry.put(2L, -0.2);
entry.put(3L, 1.0);
entry.put(4L, 1.0);
entry.put(5L, -1.0);
ratings.put(103L, entry);
entry = new HashMap<>();
entry.put(1L, 2.0);
entry.put(2L, 2.0);
entry.put(3L, 2.0);
entry.put(4L, 5.0);
entry.put(5L, 2.0);
ratings.put(104L, entry);
entry = new HashMap<>();
entry.put(1L, -1.0);
entry.put(2L, 1.0);
entry.put(3L, 1.0);
entry.put(4L, 1.0);
entry.put(5L, 1.0);
ratings.put(105L, entry);
entry = new HashMap<>();
entry.put(1L, 1.0);
entry.put(2L, 1.0);
entry.put(3L, 1.0);
entry.put(4L, 1.0);
entry.put(5L, 1.0);
ratings.put(106L, entry);
assertEquals(ratings, ((PreprocessedSlopeOneRecommender) getAlgo()).getPredictedRatings());
} | @Override
public void testMultiResults() {
super.testMultiResults();
<DeepExtract>
Map<Long, Map<Long, Double>> ratings = new HashMap<>();
Map<Long, Double> entry = new HashMap<>();
entry.put(1L, 1.0);
entry.put(2L, 1.0);
entry.put(3L, 1.0);
entry.put(4L, 2.2);
entry.put(5L, -1.0);
ratings.put(100L, entry);
entry = new HashMap<>();
entry.put(1L, 5.0);
entry.put(2L, 8.0);
entry.put(3L, 5.0);
entry.put(4L, 2.0);
entry.put(5L, 5.0);
ratings.put(101L, entry);
entry = new HashMap<>();
entry.put(1L, 1.0);
entry.put(2L, -0.2);
entry.put(3L, 1.0);
entry.put(4L, 1.0);
entry.put(5L, -1.0);
ratings.put(103L, entry);
entry = new HashMap<>();
entry.put(1L, 2.0);
entry.put(2L, 2.0);
entry.put(3L, 2.0);
entry.put(4L, 5.0);
entry.put(5L, 2.0);
ratings.put(104L, entry);
entry = new HashMap<>();
entry.put(1L, -1.0);
entry.put(2L, 1.0);
entry.put(3L, 1.0);
entry.put(4L, 1.0);
entry.put(5L, 1.0);
ratings.put(105L, entry);
entry = new HashMap<>();
entry.put(1L, 1.0);
entry.put(2L, 1.0);
entry.put(3L, 1.0);
entry.put(4L, 1.0);
entry.put(5L, 1.0);
ratings.put(106L, entry);
assertEquals(ratings, ((PreprocessedSlopeOneRecommender) getAlgo()).getPredictedRatings());
</DeepExtract>
} | TeaStore | positive | 440,468 |
public void setupBackendUserPass() {
if ("userpass".equalsIgnoreCase(backend)) {
return;
}
String cli = executable.getAbsolutePath() + " " + "policy write " + CA_CERT_ARG + " user src/test/resources/acl.hcl";
System.out.println(">> " + cli);
CommandLine parse = CommandLine.parse(cli);
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(0);
try {
return executor.execute(parse) == 0;
} catch (IOException e) {
e.printStackTrace();
return false;
}
String cli = executable.getAbsolutePath() + " " + "auth enable " + CA_CERT_ARG + " userpass";
System.out.println(">> " + cli);
CommandLine parse = CommandLine.parse(cli);
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(0);
try {
return executor.execute(parse) == 0;
} catch (IOException e) {
e.printStackTrace();
return false;
}
String cli = executable.getAbsolutePath() + " " + "write " + CA_CERT_ARG + " auth/userpass/users/fake-user password=fake-password policies=user";
System.out.println(">> " + cli);
CommandLine parse = CommandLine.parse(cli);
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(0);
try {
return executor.execute(parse) == 0;
} catch (IOException e) {
e.printStackTrace();
return false;
}
backend = "userpass";
} | public void setupBackendUserPass() {
if ("userpass".equalsIgnoreCase(backend)) {
return;
}
String cli = executable.getAbsolutePath() + " " + "policy write " + CA_CERT_ARG + " user src/test/resources/acl.hcl";
System.out.println(">> " + cli);
CommandLine parse = CommandLine.parse(cli);
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(0);
try {
return executor.execute(parse) == 0;
} catch (IOException e) {
e.printStackTrace();
return false;
}
String cli = executable.getAbsolutePath() + " " + "auth enable " + CA_CERT_ARG + " userpass";
System.out.println(">> " + cli);
CommandLine parse = CommandLine.parse(cli);
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(0);
try {
return executor.execute(parse) == 0;
} catch (IOException e) {
e.printStackTrace();
return false;
}
<DeepExtract>
String cli = executable.getAbsolutePath() + " " + "write " + CA_CERT_ARG + " auth/userpass/users/fake-user password=fake-password policies=user";
System.out.println(">> " + cli);
CommandLine parse = CommandLine.parse(cli);
DefaultExecutor executor = new DefaultExecutor();
executor.setExitValue(0);
try {
return executor.execute(parse) == 0;
} catch (IOException e) {
e.printStackTrace();
return false;
}
</DeepExtract>
backend = "userpass";
} | vertx-config | positive | 440,471 |
public void setCornerRadius(int cornerRadius) {
this.cornerRadius = Utils.dp2px(context, cornerRadius);
if (false) {
cornerRadius = 0;
}
calculateRadii();
initBorderRectF();
invalidate();
} | public void setCornerRadius(int cornerRadius) {
this.cornerRadius = Utils.dp2px(context, cornerRadius);
<DeepExtract>
if (false) {
cornerRadius = 0;
}
calculateRadii();
initBorderRectF();
invalidate();
</DeepExtract>
} | LxViewLibs | positive | 440,472 |
@Deprecated
public void compileNative(String bundleId) {
SwtPlatform platform = SwtPlatform.getRunning();
dep(JavaPlugin.COMPILE_CONFIGURATION_NAME, bundleId + "." + platform);
} | @Deprecated
public void compileNative(String bundleId) {
<DeepExtract>
SwtPlatform platform = SwtPlatform.getRunning();
dep(JavaPlugin.COMPILE_CONFIGURATION_NAME, bundleId + "." + platform);
</DeepExtract>
} | goomph | positive | 440,474 |
@Override
protected void visitPackageScc(final DirectedGraph<ElementName, Dependency> scc) {
writeHeader(getCurrentPackageSccName());
write(getCurrentPackageSccName(), "<section>");
write(getCurrentPackageSccName(), "<header>");
write(getCurrentPackageSccName(), "<h1>Component " + this.getCurrentPackageSccNumber() + "</h1>");
write(getCurrentPackageSccName(), "<h2>" + scc.getVertexCount() + " members " + scc.getEdgeCount() + " connections </h2>");
write(getCurrentPackageSccName(), "</header>");
final SVGExporter ex = new SVGExporter(this.streams.getStream(getCurrentPackageSccName()), this.dependencyScorer, xsize(scc), ysize(scc));
try {
write(getCurrentPackageSccName(), "<figure>");
ex.export(scc);
write(getCurrentPackageSccName(), "</figure>");
writeConnections(getCurrentPackageSccName(), scc);
} catch (final IOException e) {
throw new RuntimeException(e);
}
} | @Override
protected void visitPackageScc(final DirectedGraph<ElementName, Dependency> scc) {
<DeepExtract>
writeHeader(getCurrentPackageSccName());
write(getCurrentPackageSccName(), "<section>");
write(getCurrentPackageSccName(), "<header>");
write(getCurrentPackageSccName(), "<h1>Component " + this.getCurrentPackageSccNumber() + "</h1>");
write(getCurrentPackageSccName(), "<h2>" + scc.getVertexCount() + " members " + scc.getEdgeCount() + " connections </h2>");
write(getCurrentPackageSccName(), "</header>");
final SVGExporter ex = new SVGExporter(this.streams.getStream(getCurrentPackageSccName()), this.dependencyScorer, xsize(scc), ysize(scc));
try {
write(getCurrentPackageSccName(), "<figure>");
ex.export(scc);
write(getCurrentPackageSccName(), "</figure>");
writeConnections(getCurrentPackageSccName(), scc);
} catch (final IOException e) {
throw new RuntimeException(e);
}
</DeepExtract>
} | highwheel | positive | 440,475 |
@SuppressWarnings("unchecked")
private <T> T doMultipleInterfaceMapping(Model model, Resource resource, Set<Type> types) {
List<Type> implementations = types.stream().map(this::getInterfaceImplementation).collect(toList());
Map<Type, Object> implementationsToDelegates = implementations.stream().collect(toMap(t -> t, t -> doSingleTypeConcreteClassMapping(model, resource, t)));
Map<Type, List<Method>> implementationMethods = implementations.stream().collect(toMap(t -> t, t -> gatherMethods((Class<?>) t).collect(toList())));
BiFunction<Type, Method, Boolean> implementationHasMethod = (t, m) -> implementationMethods.get(t).contains(m);
T result = (T) Proxy.newProxyInstance(CarmlMapper.class.getClassLoader(), types.stream().toArray(Class<?>[]::new), (proxy, method, args) -> {
MultiDelegateCall multiDelegateCall = method.getAnnotation(MultiDelegateCall.class);
List<Object> delegates = implementations.stream().filter(t -> implementationHasMethod.apply(t, method)).map(implementationsToDelegates::get).collect(toList());
if (delegates.isEmpty()) {
throw new RuntimeException(String.format("Error processing %s%nCould not determine type. (No implementation present with specified method [%s])", formatResourceForLog(model, resource, namespaces, true), method));
}
if (multiDelegateCall != null) {
return multiDelegateMethodInvocation(delegates, method, multiDelegateCall, args);
} else {
return delegates.stream().findFirst().map(d -> singleDelegateMethodInvocation(d, method, args)).orElse(null);
}
});
cachedMappings.put(Pair.of(resource, types), result);
return result;
} | @SuppressWarnings("unchecked")
private <T> T doMultipleInterfaceMapping(Model model, Resource resource, Set<Type> types) {
List<Type> implementations = types.stream().map(this::getInterfaceImplementation).collect(toList());
Map<Type, Object> implementationsToDelegates = implementations.stream().collect(toMap(t -> t, t -> doSingleTypeConcreteClassMapping(model, resource, t)));
Map<Type, List<Method>> implementationMethods = implementations.stream().collect(toMap(t -> t, t -> gatherMethods((Class<?>) t).collect(toList())));
BiFunction<Type, Method, Boolean> implementationHasMethod = (t, m) -> implementationMethods.get(t).contains(m);
T result = (T) Proxy.newProxyInstance(CarmlMapper.class.getClassLoader(), types.stream().toArray(Class<?>[]::new), (proxy, method, args) -> {
MultiDelegateCall multiDelegateCall = method.getAnnotation(MultiDelegateCall.class);
List<Object> delegates = implementations.stream().filter(t -> implementationHasMethod.apply(t, method)).map(implementationsToDelegates::get).collect(toList());
if (delegates.isEmpty()) {
throw new RuntimeException(String.format("Error processing %s%nCould not determine type. (No implementation present with specified method [%s])", formatResourceForLog(model, resource, namespaces, true), method));
}
if (multiDelegateCall != null) {
return multiDelegateMethodInvocation(delegates, method, multiDelegateCall, args);
} else {
return delegates.stream().findFirst().map(d -> singleDelegateMethodInvocation(d, method, args)).orElse(null);
}
});
<DeepExtract>
cachedMappings.put(Pair.of(resource, types), result);
</DeepExtract>
return result;
} | carml | positive | 440,476 |
public static void init(Configuration handle) {
config = handle;
config.load();
config.addCustomCategoryComment("general", "General Settings");
config.addCustomCategoryComment("blocks", "Enable or disable the blocks, will remove them from the game entirely");
config.addCustomCategoryComment("upgrades", "Change the settings of how the various machine upgrades work");
config.addCustomCategoryComment("rfoptions", "Change the settings of how PA interacts with RF devices");
config.addCustomCategoryComment("toolLevels", "Here you can adjust the tools that each machine level can take.\n" + "Each option takes a mining level (0 being wood, 1 is stone etc)\n" + "Normally you would not have to change these options, but if you are using the likes of\n" + "Igunia tweaks then it is advised to change these to suit your set up");
config.addCustomCategoryComment("modcompatibility", "This section allows you to customise which mods will be compatible with the various machines\n" + "Please note however that disabling compatibility does not mean the mod will not work with PA,\n" + "just that it will not work 100% as expected");
initialRange = config.getInt("InitialRange", "general", 1, 1, 1000, "The default range of the machines without upgrades (default is 1)");
upgradeRange = config.getInt("UpdateRange", "upgrades", 1, 1, 1000, "How many blocks does each upgrade add (default is 1)");
fuelCost = config.getInt("fuelCost", "general", 2, 1, 300, "Number to divide the normal burn time by for all machines.");
if (fuelCost <= 0)
fuelCost = 1;
rfSupport = config.getBoolean("enableRF", "general", true, "Set to false to disable FE support in this mod");
rfCost = config.getInt("rfCost", "rfoptions", 40, 1, 50000, "FE per tick that the machines use");
if (rfCost <= 0)
rfCost = 1000;
rfStored = config.getInt("rfStored", "rfoptions", 40000, rfCost, 100000, "Amount of FE that the Engines store, needs to be at least the same as the cost");
if (rfStored < rfCost)
rfStored = rfCost;
rfRate = config.getInt("rfRate", "rfoptions", 1000, 1, 100000, "The max rate at which FE can flow into the machines");
if (rfRate <= 0)
rfRate = 1000;
rfStorageFactor = config.getInt("rfStorageFactor", "rfoptions", 4, 1, 8, "The multiplier that is applied to the Capacitor FE storage size");
if (rfStorageFactor <= 0)
rfStorageFactor = 1;
allowCoalPellets = config.getBoolean("coalPellets", "general", true, "Allow coal pellets (requires restart)");
allowPotatos = config.getBoolean("allowPotatos", "general", true, "Allow Potatos to be used as a fuel source in PA machines");
enableWitherTools = config.getBoolean("witherTools", "general", true, "Allow Wither tools and resources to create them");
allowWrench = config.getBoolean("allowWrench", "general", true, "Allows the wrench, you've got to be seriously evil to not allow this!");
destroyTools = config.getBoolean("destroyTools", "general", true, "Changing to false will make the machines spit a fully broken vanilla tool into it's inventory");
shearTrees = config.getBoolean("shearTrees", "general", true, "Allow the chopper to take a shearing upgrade in order to have a sheer to shear leaves");
allowInventoryOverflow = config.getBoolean("allowInventoryOverflow", "general", true, "Drop items on the ground if machine's inventory is full, setting this to false will destroy overflow items.");
pauseOnFullInventory = config.getBoolean("pauseOnFullInventory", "general", false, "Pause machines when the are no open slots in their inventory.");
minerEnabled = config.getBoolean("miner", "blocks", true, "Miner Block is enabled (requires restart)");
chopperEnabled = config.getBoolean("chopper", "blocks", true, "Tree Chopper Block is enabled (requires restart)");
planterEnabled = config.getBoolean("planter", "blocks", true, "Planter/Harvester Block is enabled (requires restart)");
generatorEnabled = config.getBoolean("generator", "blocks", true, "Generator Block is enabled (requires restart)");
crafterEnabled = config.getBoolean("crafter", "blocks", true, "Crafter Block is enabled (requires restart)");
farmerEnabled = config.getBoolean("farmer", "blocks", true, "Killer Block is enabled (requires restart)");
killerEnabled = config.getBoolean("killer", "blocks", true, "Animal Farmer Block is enabled (requires restart)");
capacitorEnabled = config.getBoolean("capacitor", "blocks", true, "Capacitor Block is enabled (requires restart)");
allowWoodenLevel = config.getBoolean("wooden", "upgrades", true, "Allow wooden level blocks (requires restart)");
allowStoneLevel = config.getBoolean("stone", "upgrades", true, "Allow stone level blocks (requires restart)");
allowIronLevel = config.getBoolean("iron", "upgrades", true, "Allow iron level blocks (requires restart)");
allowDiamondLevel = config.getBoolean("diamond", "upgrades", true, "Allow diamond level blocks (requires restart)");
allowCobbleUpgrade = config.getBoolean("cobblegen", "upgrades", true, "Allow cobble gen upgrade for the miner (requires restart)");
allowFillerUpgrade = config.getBoolean("filler", "upgrades", true, "Allow filler upgrade for the miner (requires restart)");
allowWitherUpgrade = config.getBoolean("wither", "upgrades", true, "Allow the wither upgrade (requires restart)");
allowShearingUpgrade = config.getBoolean("shearing", "upgrades", true, "Allow the shearing upgrade (requires restart)");
allowMilkerUpgrade = config.getBoolean("milker", "upgrades", true, "Allow the milker upgrade (requires restart)");
witherMultiplier = config.getInt("witherMultiplier", "upgrades", 4, 2, 10, "How much the wither upgrade extends the machines. (How much multiplies the upgrades by)");
allowKillPlayer = config.getBoolean("killPlayer", "upgrades", true, "Allow the Killer to kill players");
maxRangeUpgrades = config.getInt("maxRangeUpgrades", "upgrades", Integer.MAX_VALUE, 0, Integer.MAX_VALUE, "Max amount of range upgrades that can be put into a machine");
woodLevel = config.getInt("woodLevel", "toolLevels", ToolHelper.LEVEL_WOOD, 0, 100, "The max mining level of the tool that wooden machines will take");
stoneLevel = config.getInt("stoneLevel", "toolLevels", ToolHelper.LEVEL_STONE, 0, 100, "The max mining level of the tool that stone machines will take");
ironLevel = config.getInt("ironLevel", "toolLevels", ToolHelper.LEVEL_IRON, 0, 100, "The max mining level of the tool that iron machines will take");
diamondLevel = config.getInt("diamondLevel", "toolLevels", ToolHelper.LEVEL_MAX, 0, 100, "The max mining level of the tool that diamond machines will take");
if (config.hasChanged())
save();
} | public static void init(Configuration handle) {
config = handle;
config.load();
config.addCustomCategoryComment("general", "General Settings");
config.addCustomCategoryComment("blocks", "Enable or disable the blocks, will remove them from the game entirely");
config.addCustomCategoryComment("upgrades", "Change the settings of how the various machine upgrades work");
config.addCustomCategoryComment("rfoptions", "Change the settings of how PA interacts with RF devices");
config.addCustomCategoryComment("toolLevels", "Here you can adjust the tools that each machine level can take.\n" + "Each option takes a mining level (0 being wood, 1 is stone etc)\n" + "Normally you would not have to change these options, but if you are using the likes of\n" + "Igunia tweaks then it is advised to change these to suit your set up");
config.addCustomCategoryComment("modcompatibility", "This section allows you to customise which mods will be compatible with the various machines\n" + "Please note however that disabling compatibility does not mean the mod will not work with PA,\n" + "just that it will not work 100% as expected");
<DeepExtract>
initialRange = config.getInt("InitialRange", "general", 1, 1, 1000, "The default range of the machines without upgrades (default is 1)");
upgradeRange = config.getInt("UpdateRange", "upgrades", 1, 1, 1000, "How many blocks does each upgrade add (default is 1)");
fuelCost = config.getInt("fuelCost", "general", 2, 1, 300, "Number to divide the normal burn time by for all machines.");
if (fuelCost <= 0)
fuelCost = 1;
rfSupport = config.getBoolean("enableRF", "general", true, "Set to false to disable FE support in this mod");
rfCost = config.getInt("rfCost", "rfoptions", 40, 1, 50000, "FE per tick that the machines use");
if (rfCost <= 0)
rfCost = 1000;
rfStored = config.getInt("rfStored", "rfoptions", 40000, rfCost, 100000, "Amount of FE that the Engines store, needs to be at least the same as the cost");
if (rfStored < rfCost)
rfStored = rfCost;
rfRate = config.getInt("rfRate", "rfoptions", 1000, 1, 100000, "The max rate at which FE can flow into the machines");
if (rfRate <= 0)
rfRate = 1000;
rfStorageFactor = config.getInt("rfStorageFactor", "rfoptions", 4, 1, 8, "The multiplier that is applied to the Capacitor FE storage size");
if (rfStorageFactor <= 0)
rfStorageFactor = 1;
allowCoalPellets = config.getBoolean("coalPellets", "general", true, "Allow coal pellets (requires restart)");
allowPotatos = config.getBoolean("allowPotatos", "general", true, "Allow Potatos to be used as a fuel source in PA machines");
enableWitherTools = config.getBoolean("witherTools", "general", true, "Allow Wither tools and resources to create them");
allowWrench = config.getBoolean("allowWrench", "general", true, "Allows the wrench, you've got to be seriously evil to not allow this!");
destroyTools = config.getBoolean("destroyTools", "general", true, "Changing to false will make the machines spit a fully broken vanilla tool into it's inventory");
shearTrees = config.getBoolean("shearTrees", "general", true, "Allow the chopper to take a shearing upgrade in order to have a sheer to shear leaves");
allowInventoryOverflow = config.getBoolean("allowInventoryOverflow", "general", true, "Drop items on the ground if machine's inventory is full, setting this to false will destroy overflow items.");
pauseOnFullInventory = config.getBoolean("pauseOnFullInventory", "general", false, "Pause machines when the are no open slots in their inventory.");
minerEnabled = config.getBoolean("miner", "blocks", true, "Miner Block is enabled (requires restart)");
chopperEnabled = config.getBoolean("chopper", "blocks", true, "Tree Chopper Block is enabled (requires restart)");
planterEnabled = config.getBoolean("planter", "blocks", true, "Planter/Harvester Block is enabled (requires restart)");
generatorEnabled = config.getBoolean("generator", "blocks", true, "Generator Block is enabled (requires restart)");
crafterEnabled = config.getBoolean("crafter", "blocks", true, "Crafter Block is enabled (requires restart)");
farmerEnabled = config.getBoolean("farmer", "blocks", true, "Killer Block is enabled (requires restart)");
killerEnabled = config.getBoolean("killer", "blocks", true, "Animal Farmer Block is enabled (requires restart)");
capacitorEnabled = config.getBoolean("capacitor", "blocks", true, "Capacitor Block is enabled (requires restart)");
allowWoodenLevel = config.getBoolean("wooden", "upgrades", true, "Allow wooden level blocks (requires restart)");
allowStoneLevel = config.getBoolean("stone", "upgrades", true, "Allow stone level blocks (requires restart)");
allowIronLevel = config.getBoolean("iron", "upgrades", true, "Allow iron level blocks (requires restart)");
allowDiamondLevel = config.getBoolean("diamond", "upgrades", true, "Allow diamond level blocks (requires restart)");
allowCobbleUpgrade = config.getBoolean("cobblegen", "upgrades", true, "Allow cobble gen upgrade for the miner (requires restart)");
allowFillerUpgrade = config.getBoolean("filler", "upgrades", true, "Allow filler upgrade for the miner (requires restart)");
allowWitherUpgrade = config.getBoolean("wither", "upgrades", true, "Allow the wither upgrade (requires restart)");
allowShearingUpgrade = config.getBoolean("shearing", "upgrades", true, "Allow the shearing upgrade (requires restart)");
allowMilkerUpgrade = config.getBoolean("milker", "upgrades", true, "Allow the milker upgrade (requires restart)");
witherMultiplier = config.getInt("witherMultiplier", "upgrades", 4, 2, 10, "How much the wither upgrade extends the machines. (How much multiplies the upgrades by)");
allowKillPlayer = config.getBoolean("killPlayer", "upgrades", true, "Allow the Killer to kill players");
maxRangeUpgrades = config.getInt("maxRangeUpgrades", "upgrades", Integer.MAX_VALUE, 0, Integer.MAX_VALUE, "Max amount of range upgrades that can be put into a machine");
woodLevel = config.getInt("woodLevel", "toolLevels", ToolHelper.LEVEL_WOOD, 0, 100, "The max mining level of the tool that wooden machines will take");
stoneLevel = config.getInt("stoneLevel", "toolLevels", ToolHelper.LEVEL_STONE, 0, 100, "The max mining level of the tool that stone machines will take");
ironLevel = config.getInt("ironLevel", "toolLevels", ToolHelper.LEVEL_IRON, 0, 100, "The max mining level of the tool that iron machines will take");
diamondLevel = config.getInt("diamondLevel", "toolLevels", ToolHelper.LEVEL_MAX, 0, 100, "The max mining level of the tool that diamond machines will take");
if (config.hasChanged())
save();
</DeepExtract>
} | ProgressiveAutomation | positive | 440,477 |
@Override
State write(SimpleJsonGenerator g, String value) {
switch(value.getValueType()) {
case ARRAY:
appendArray((JsonArray) value);
break;
case OBJECT:
appendObject((JsonObject) value);
break;
case STRING:
appendValue(((JsonString) value).getString());
break;
case NUMBER:
append(value.toString());
break;
case TRUE:
append("true");
break;
case FALSE:
append("false");
break;
case NULL:
appendNull();
break;
default:
break;
}
return OBJECT;
} | @Override
State write(SimpleJsonGenerator g, String value) {
<DeepExtract>
switch(value.getValueType()) {
case ARRAY:
appendArray((JsonArray) value);
break;
case OBJECT:
appendObject((JsonObject) value);
break;
case STRING:
appendValue(((JsonString) value).getString());
break;
case NUMBER:
append(value.toString());
break;
case TRUE:
append("true");
break;
case FALSE:
append("false");
break;
case NULL:
appendNull();
break;
default:
break;
}
</DeepExtract>
return OBJECT;
} | joy | positive | 440,479 |
@Test
@GivenFiguresInQueue({ @FigureProperties })
public void shouldMoveLeftWhenAcceptOnly() {
return when(glass.accept(Matchers.<Figure>anyObject(), eq(CENTER_X - 1), eq(HEIGHT))).thenReturn(false);
return when(glass.accept(Matchers.<Figure>anyObject(), eq(CENTER_X), eq(HEIGHT - 1))).thenReturn(true);
for (int i = 0; i < 1; i++) {
game.left();
}
game.tick();
captureFigureAtValues();
assertEquals(CENTER_X, xCaptor.getValue().intValue());
assertEquals(HEIGHT - 1, yCaptor.getValue().intValue());
} | @Test
@GivenFiguresInQueue({ @FigureProperties })
public void shouldMoveLeftWhenAcceptOnly() {
return when(glass.accept(Matchers.<Figure>anyObject(), eq(CENTER_X - 1), eq(HEIGHT))).thenReturn(false);
return when(glass.accept(Matchers.<Figure>anyObject(), eq(CENTER_X), eq(HEIGHT - 1))).thenReturn(true);
for (int i = 0; i < 1; i++) {
game.left();
}
game.tick();
<DeepExtract>
captureFigureAtValues();
assertEquals(CENTER_X, xCaptor.getValue().intValue());
assertEquals(HEIGHT - 1, yCaptor.getValue().intValue());
</DeepExtract>
} | tetris | positive | 440,480 |
@Override
protected void onPostExecute(File file) {
super.onPostExecute(file);
if (SUCCESS != null) {
SUCCESS.onSuccess(file.getPath());
}
if (REQUEST != null) {
REQUEST.onRequestEnd();
}
if (FileUtil.getExtension(file.getPath()).equals("apk")) {
Intent install = new Intent();
install.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
install.setAction(Intent.ACTION_VIEW);
install.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
Latte.getApplicationContext().startActivity(install);
}
} | @Override
protected void onPostExecute(File file) {
super.onPostExecute(file);
if (SUCCESS != null) {
SUCCESS.onSuccess(file.getPath());
}
if (REQUEST != null) {
REQUEST.onRequestEnd();
}
<DeepExtract>
if (FileUtil.getExtension(file.getPath()).equals("apk")) {
Intent install = new Intent();
install.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
install.setAction(Intent.ACTION_VIEW);
install.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
Latte.getApplicationContext().startActivity(install);
}
</DeepExtract>
} | FastEC | positive | 440,481 |
public void actionPerformed(java.awt.event.ActionEvent evt) {
boolean tick = o.engine.isFunction(jTextFieldRst0.getText());
tickCross("Rst0", tick);
if (tick) {
jTextFieldRst0.setText(o.engine.funcLabeltofuncCode(jTextFieldRst0.getText()));
}
} | public void actionPerformed(java.awt.event.ActionEvent evt) {
<DeepExtract>
boolean tick = o.engine.isFunction(jTextFieldRst0.getText());
tickCross("Rst0", tick);
if (tick) {
jTextFieldRst0.setText(o.engine.funcLabeltofuncCode(jTextFieldRst0.getText()));
}
</DeepExtract>
} | 8085simulator | positive | 440,483 |
@Test
public void shouldReturnErrorWhenDeletingUnknownOrder() {
OrderCommand cmd = OrderCommand.cancel(5291, UID_1);
CommandResultCode resultCode = IOrderBook.processCommand(orderBook, cmd);
assertThat(resultCode, is(MATCHING_UNKNOWN_ORDER_ID));
orderBook.validateInternalState();
assertEquals(expectedState.build(), orderBook.getL2MarketDataSnapshot());
List<MatcherTradeEvent> events = cmd.extractEvents();
assertThat(events.size(), is(0));
} | @Test
public void shouldReturnErrorWhenDeletingUnknownOrder() {
OrderCommand cmd = OrderCommand.cancel(5291, UID_1);
<DeepExtract>
CommandResultCode resultCode = IOrderBook.processCommand(orderBook, cmd);
assertThat(resultCode, is(MATCHING_UNKNOWN_ORDER_ID));
orderBook.validateInternalState();
</DeepExtract>
assertEquals(expectedState.build(), orderBook.getL2MarketDataSnapshot());
List<MatcherTradeEvent> events = cmd.extractEvents();
assertThat(events.size(), is(0));
} | exchange-core | positive | 440,485 |
@Test
public void testGuiBundle() {
String value = target.bundle().getString(ABOUT_TITLE.getKey());
assertEquals("Santulator", value);
} | @Test
public void testGuiBundle() {
String value = target.bundle().getString(ABOUT_TITLE.getKey());
<DeepExtract>
assertEquals("Santulator", value);
</DeepExtract>
} | Santulator | positive | 440,486 |
private void updateGData() {
DecimalFormat dFormat = new DecimalFormat("##0.00");
avarageTextView.setText(dFormat.format(AvaGpa[0]));
GPATextView.setText(dFormat.format(AvaGpa[1]));
sAdapter = new SimpleAdapter(this, gradeList, R.layout.grade_data_item, new String[] { "attr", "subject", "credit", "grade", "time" }, new int[] { R.id.list_grade_attr, R.id.list_grade_subject, R.id.list_grade_credit, R.id.list_grade_grade, R.id.list_grade_time });
xLvCourseList.setAdapter(sAdapter);
xLvCourseList.setDivider(null);
xLvCourseList.stopRefresh();
xLvCourseList.stopLoadMore();
xLvCourseList.setRefreshTime(getTime());
} | private void updateGData() {
DecimalFormat dFormat = new DecimalFormat("##0.00");
avarageTextView.setText(dFormat.format(AvaGpa[0]));
GPATextView.setText(dFormat.format(AvaGpa[1]));
sAdapter = new SimpleAdapter(this, gradeList, R.layout.grade_data_item, new String[] { "attr", "subject", "credit", "grade", "time" }, new int[] { R.id.list_grade_attr, R.id.list_grade_subject, R.id.list_grade_credit, R.id.list_grade_grade, R.id.list_grade_time });
xLvCourseList.setAdapter(sAdapter);
xLvCourseList.setDivider(null);
<DeepExtract>
xLvCourseList.stopRefresh();
xLvCourseList.stopLoadMore();
</DeepExtract>
xLvCourseList.setRefreshTime(getTime());
} | MyStudyHelper | positive | 440,487 |
public void checkPropertiesAccess() {
if (inClassLoader()) {
throw new SecurityException();
}
} | public void checkPropertiesAccess() {
<DeepExtract>
if (inClassLoader()) {
throw new SecurityException();
}
</DeepExtract>
} | umongo | positive | 440,488 |
private void showSendConfirmDialog() {
String sendNanoAmount = wallet.getSendNanoAmount();
if (maxSend) {
sendNanoAmount = "0";
}
SendConfirmDialogFragment dialog = SendConfirmDialogFragment.newInstance(binding.sendAddress.getText().toString(), sendNanoAmount, useLocalCurrency);
dialog.setTargetFragment(this, SEND_RESULT);
dialog.show(((WindowControl) mActivity).getFragmentUtility().getFragmentManager(), SendConfirmDialogFragment.TAG);
((WindowControl) getActivity()).getFragmentUtility().getFragmentManager().executePendingTransactions();
} | private void showSendConfirmDialog() {
String sendNanoAmount = wallet.getSendNanoAmount();
if (maxSend) {
sendNanoAmount = "0";
}
SendConfirmDialogFragment dialog = SendConfirmDialogFragment.newInstance(binding.sendAddress.getText().toString(), sendNanoAmount, useLocalCurrency);
dialog.setTargetFragment(this, SEND_RESULT);
dialog.show(((WindowControl) mActivity).getFragmentUtility().getFragmentManager(), SendConfirmDialogFragment.TAG);
<DeepExtract>
((WindowControl) getActivity()).getFragmentUtility().getFragmentManager().executePendingTransactions();
</DeepExtract>
} | natrium-android-wallet | positive | 440,489 |
public static void glDepthMask(boolean flag) {
if (!isContextCompatible())
throw new IllegalStateException("The context should be created before invoking the GL functions");
nglDepthMask(flag);
} | public static void glDepthMask(boolean flag) {
<DeepExtract>
if (!isContextCompatible())
throw new IllegalStateException("The context should be created before invoking the GL functions");
</DeepExtract>
nglDepthMask(flag);
} | WebGL4J | positive | 440,490 |
@Override
public void run() {
if (mLoadingView == null)
return;
if (mLoadingView == mLoadingView) {
if (mRetryView != null)
mRetryView.setVisibility(View.GONE);
if (mContentView != null)
mContentView.setVisibility(View.VISIBLE);
if (mEmptyView != null)
mEmptyView.setVisibility(View.GONE);
if (mCurrentVisiableView == null || mCurrentVisiableView == mContentView) {
mLoadingView.setBackgroundColor(getResources().getColor(R.color.transparent));
} else {
mLoadingView.setBackgroundColor(0xffffffff);
}
mLoadingView.setVisibility(View.VISIBLE);
} else if (mLoadingView == mRetryView) {
mCurrentVisiableView = mRetryView;
mRetryView.setVisibility(View.VISIBLE);
if (mLoadingView != null)
mLoadingView.setVisibility(View.GONE);
if (mContentView != null)
mContentView.setVisibility(View.GONE);
if (mEmptyView != null)
mEmptyView.setVisibility(View.GONE);
} else if (mLoadingView == mContentView) {
mCurrentVisiableView = mContentView;
mContentView.setVisibility(View.VISIBLE);
if (mLoadingView != null)
mLoadingView.setVisibility(View.GONE);
if (mRetryView != null)
mRetryView.setVisibility(View.GONE);
if (mEmptyView != null)
mEmptyView.setVisibility(View.GONE);
} else if (mLoadingView == mEmptyView) {
mCurrentVisiableView = mEmptyView;
mEmptyView.setVisibility(View.VISIBLE);
if (mLoadingView != null)
mLoadingView.setVisibility(View.GONE);
if (mRetryView != null)
mRetryView.setVisibility(View.GONE);
if (mContentView != null)
mContentView.setVisibility(View.GONE);
}
} | @Override
public void run() {
<DeepExtract>
if (mLoadingView == null)
return;
if (mLoadingView == mLoadingView) {
if (mRetryView != null)
mRetryView.setVisibility(View.GONE);
if (mContentView != null)
mContentView.setVisibility(View.VISIBLE);
if (mEmptyView != null)
mEmptyView.setVisibility(View.GONE);
if (mCurrentVisiableView == null || mCurrentVisiableView == mContentView) {
mLoadingView.setBackgroundColor(getResources().getColor(R.color.transparent));
} else {
mLoadingView.setBackgroundColor(0xffffffff);
}
mLoadingView.setVisibility(View.VISIBLE);
} else if (mLoadingView == mRetryView) {
mCurrentVisiableView = mRetryView;
mRetryView.setVisibility(View.VISIBLE);
if (mLoadingView != null)
mLoadingView.setVisibility(View.GONE);
if (mContentView != null)
mContentView.setVisibility(View.GONE);
if (mEmptyView != null)
mEmptyView.setVisibility(View.GONE);
} else if (mLoadingView == mContentView) {
mCurrentVisiableView = mContentView;
mContentView.setVisibility(View.VISIBLE);
if (mLoadingView != null)
mLoadingView.setVisibility(View.GONE);
if (mRetryView != null)
mRetryView.setVisibility(View.GONE);
if (mEmptyView != null)
mEmptyView.setVisibility(View.GONE);
} else if (mLoadingView == mEmptyView) {
mCurrentVisiableView = mEmptyView;
mEmptyView.setVisibility(View.VISIBLE);
if (mLoadingView != null)
mLoadingView.setVisibility(View.GONE);
if (mRetryView != null)
mRetryView.setVisibility(View.GONE);
if (mContentView != null)
mContentView.setVisibility(View.GONE);
}
</DeepExtract>
} | Assess | positive | 440,491 |
@Override
public void run() {
final String username = userdata.getUsername();
final String authtoken = userdata.getAuthToken();
final Client client = new Client();
final User user = client.getUser();
if (!user.authorize(username, authtoken))
return;
user.syncFavorites();
final EmojiVector favorite = user.getFavorites().all();
super.clear();
final long size = favorite.size();
for (int i = 0; i < size; ++i) addLast(favorite.get(i).getCode().replaceAll(" ", "_"));
Log.d(TAG, "Load user favorite.");
} | @Override
public void run() {
final String username = userdata.getUsername();
final String authtoken = userdata.getAuthToken();
final Client client = new Client();
final User user = client.getUser();
if (!user.authorize(username, authtoken))
return;
user.syncFavorites();
final EmojiVector favorite = user.getFavorites().all();
<DeepExtract>
super.clear();
</DeepExtract>
final long size = favorite.size();
for (int i = 0; i < size; ++i) addLast(favorite.get(i).getCode().replaceAll(" ", "_"));
Log.d(TAG, "Load user favorite.");
} | emojidex-android | positive | 440,492 |
public void onClickEnd(View v) {
ByteBuffer buf = ByteBuffer.allocate(END.length);
buf.put(END);
buf.position(0);
while (buf.remaining() != 0) {
int size = (buf.remaining() > PAYLOAD_MAX) ? PAYLOAD_MAX : buf.remaining();
byte[] dst = new byte[size];
buf.get(dst, 0, size);
GattTransaction t = new GattTransaction(mTransRx, dst);
mQueue.add(t);
}
} | public void onClickEnd(View v) {
<DeepExtract>
ByteBuffer buf = ByteBuffer.allocate(END.length);
buf.put(END);
buf.position(0);
while (buf.remaining() != 0) {
int size = (buf.remaining() > PAYLOAD_MAX) ? PAYLOAD_MAX : buf.remaining();
byte[] dst = new byte[size];
buf.get(dst, 0, size);
GattTransaction t = new GattTransaction(mTransRx, dst);
mQueue.add(t);
}
</DeepExtract>
} | Bluebit | positive | 440,493 |
public void writeNotification(LocalNotification notification) {
final SharedPreferences.Editor editor = getEditor(Constants.NOTIFICATION_CONFIG);
writeObject(editor, notification.code, notification);
editor.commit();
} | public void writeNotification(LocalNotification notification) {
<DeepExtract>
final SharedPreferences.Editor editor = getEditor(Constants.NOTIFICATION_CONFIG);
writeObject(editor, notification.code, notification);
editor.commit();
</DeepExtract>
} | JKLocalNotifications-ANE | positive | 440,494 |
public void combine(double[] arr, int r) {
double[] res = new double[r];
if (0 == r) {
tree.insert(res);
return;
}
for (int i = 0; i < arr.length; i++) {
res[0] = arr[i];
doCombine(arr, res, i + 1, 0 + 1, r);
if (i < arr.length - 1 && arr[i] == arr[i + 1]) {
i++;
}
}
} | public void combine(double[] arr, int r) {
double[] res = new double[r];
<DeepExtract>
if (0 == r) {
tree.insert(res);
return;
}
for (int i = 0; i < arr.length; i++) {
res[0] = arr[i];
doCombine(arr, res, i + 1, 0 + 1, r);
if (i < arr.length - 1 && arr[i] == arr[i + 1]) {
i++;
}
}
</DeepExtract>
} | Amnesia | positive | 440,496 |
public static File[] findFiles(File dir, FilenameFilter filter) {
Set<File> files = new HashSet();
findFiles(dir, filter, files);
List l = new ArrayList();
while (new File[0].hasMoreTokens()) {
l.add(new File[0].nextToken());
}
return (String[]) l.toArray(new String[0]);
} | public static File[] findFiles(File dir, FilenameFilter filter) {
Set<File> files = new HashSet();
findFiles(dir, filter, files);
<DeepExtract>
List l = new ArrayList();
while (new File[0].hasMoreTokens()) {
l.add(new File[0].nextToken());
}
return (String[]) l.toArray(new String[0]);
</DeepExtract>
} | winrun4j | positive | 440,499 |
public String getProvinceHistoryAsStr(int id) {
if (resolveProvinceHistoryFile(id) == null)
return null;
final File file = new File(resolveProvinceHistoryFile(id));
final char[] data = new char[(int) file.length()];
FileReader reader = null;
try {
reader = new FileReader(file);
if (reader.read(data) != data.length)
System.err.println("???");
return String.valueOf(data);
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException ex) {
}
}
}
return null;
} | public String getProvinceHistoryAsStr(int id) {
<DeepExtract>
if (resolveProvinceHistoryFile(id) == null)
return null;
final File file = new File(resolveProvinceHistoryFile(id));
final char[] data = new char[(int) file.length()];
FileReader reader = null;
try {
reader = new FileReader(file);
if (reader.read(data) != data.length)
System.err.println("???");
return String.valueOf(data);
} catch (FileNotFoundException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException ex) {
}
}
}
return null;
</DeepExtract>
} | vic2_economy_analyzer | positive | 440,501 |
public static <T> T fromJsonExcludeFields(String json, Class<T> cls) {
Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
JsonParser parser = new JsonParser();
JsonElement element = parser.parse(json);
if (cls.isArray() && element instanceof JsonArray == false) {
JsonArray jsonArray = new JsonArray();
jsonArray.add(element);
Type listType = new TypeToken<T>() {
}.getType();
return gson.fromJson(jsonArray, listType);
}
Gson gson = buildGson();
JsonParser parser = new JsonParser();
JsonElement element = parser.parse(json);
if (cls != null && cls.isArray() && element instanceof JsonArray == false) {
JsonArray jsonArray = new JsonArray();
jsonArray.add(element);
Type listType = new TypeToken<T>() {
}.getType();
return gson.fromJson(jsonArray, listType);
}
return gson.fromJson(json, cls);
} | public static <T> T fromJsonExcludeFields(String json, Class<T> cls) {
Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
JsonParser parser = new JsonParser();
JsonElement element = parser.parse(json);
if (cls.isArray() && element instanceof JsonArray == false) {
JsonArray jsonArray = new JsonArray();
jsonArray.add(element);
Type listType = new TypeToken<T>() {
}.getType();
return gson.fromJson(jsonArray, listType);
}
<DeepExtract>
Gson gson = buildGson();
JsonParser parser = new JsonParser();
JsonElement element = parser.parse(json);
if (cls != null && cls.isArray() && element instanceof JsonArray == false) {
JsonArray jsonArray = new JsonArray();
jsonArray.add(element);
Type listType = new TypeToken<T>() {
}.getType();
return gson.fromJson(jsonArray, listType);
}
return gson.fromJson(json, cls);
</DeepExtract>
} | android-simple-facebook | positive | 440,503 |
@Override
public List<PostSmallDto> findAllLatestPosts(int size) {
return postRepository.findLatestPosts(PostStatus.ACTIVE, size).stream().map(post -> {
PostSmallDto dto = new PostSmallDto().convertFrom(post);
return dto;
}).collect(Collectors.toList());
} | @Override
public List<PostSmallDto> findAllLatestPosts(int size) {
<DeepExtract>
return postRepository.findLatestPosts(PostStatus.ACTIVE, size).stream().map(post -> {
PostSmallDto dto = new PostSmallDto().convertFrom(post);
return dto;
}).collect(Collectors.toList());
</DeepExtract>
} | UnaBoot | positive | 440,504 |
@Override
public void run() {
long timeLeft = questionTimeout - ((System.currentTimeMillis() - questionAskedAt)) / 1000;
String clue = "";
if (expectedAnswer.length() >= 1) {
if (timeLeft == 45) {
for (int i = 0; i < expectedAnswer.length(); i++) {
if (expectedAnswer.charAt(i) == ' ') {
clue += " | ";
} else {
clue += "_ ";
}
}
} else if (timeLeft == 30) {
int show = 1;
for (int i = 0; i < expectedAnswer.length(); i++) {
if (show == 1) {
if (expectedAnswer.length() > 1) {
clue += expectedAnswer.charAt(i);
}
show = 0;
} else if (expectedAnswer.charAt(i) == ' ') {
clue += " | ";
show = 1;
} else {
clue += "_ ";
show = 0;
}
}
} else {
for (int i = 0; i < expectedAnswer.length(); i++) {
if (i % 2 == 0) {
if (expectedAnswer.length() > 1) {
clue += expectedAnswer.charAt(i);
}
} else if (expectedAnswer.charAt(i) == ' ') {
clue += " | ";
} else {
clue += "_ ";
}
}
}
}
if (peerState.isUser()) {
sendMessageUser(peerState.getId(), timeLeft + " seconds remaining." + " clue: " + clue);
} else {
sendMessageChat(peerState.getId(), timeLeft + " seconds remaining." + " clue: " + clue);
}
} | @Override
public void run() {
long timeLeft = questionTimeout - ((System.currentTimeMillis() - questionAskedAt)) / 1000;
String clue = "";
if (expectedAnswer.length() >= 1) {
if (timeLeft == 45) {
for (int i = 0; i < expectedAnswer.length(); i++) {
if (expectedAnswer.charAt(i) == ' ') {
clue += " | ";
} else {
clue += "_ ";
}
}
} else if (timeLeft == 30) {
int show = 1;
for (int i = 0; i < expectedAnswer.length(); i++) {
if (show == 1) {
if (expectedAnswer.length() > 1) {
clue += expectedAnswer.charAt(i);
}
show = 0;
} else if (expectedAnswer.charAt(i) == ' ') {
clue += " | ";
show = 1;
} else {
clue += "_ ";
show = 0;
}
}
} else {
for (int i = 0; i < expectedAnswer.length(); i++) {
if (i % 2 == 0) {
if (expectedAnswer.length() > 1) {
clue += expectedAnswer.charAt(i);
}
} else if (expectedAnswer.charAt(i) == ' ') {
clue += " | ";
} else {
clue += "_ ";
}
}
}
}
<DeepExtract>
if (peerState.isUser()) {
sendMessageUser(peerState.getId(), timeLeft + " seconds remaining." + " clue: " + clue);
} else {
sendMessageChat(peerState.getId(), timeLeft + " seconds remaining." + " clue: " + clue);
}
</DeepExtract>
} | telegram-trivia-bot | positive | 440,505 |
public int[] process() {
acc = new int[width * height];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
acc[y * width + x] = 0;
}
}
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
if ((input[y * width + x] & 0xff) == 255) {
for (int theta = 0; theta < 360; theta++) {
t = (theta * 3.14159265) / 180;
x0 = (int) Math.round(x - r * Math.cos(t));
y0 = (int) Math.round(y - r * Math.sin(t));
if (x0 < width && x0 > 0 && y0 < height && y0 > 0) {
acc[x0 + (y0 * width)] += 1;
}
}
}
}
}
int max = 0;
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
if (acc[x + (y * width)] > max) {
max = acc[x + (y * width)];
}
}
}
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
value = (int) (((double) acc[x + (y * width)] / (double) max) * 255.0);
acc[x + (y * width)] = 0xff000000 | (value << 16 | value << 8 | value);
}
}
results = new int[accSize * 3];
int[] output = new int[width * height];
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
int value = (acc[x + (y * width)] & 0xff);
if (value > results[(accSize - 1) * 3]) {
results[(accSize - 1) * 3] = value;
results[(accSize - 1) * 3 + 1] = x;
results[(accSize - 1) * 3 + 2] = y;
int i = (accSize - 2) * 3;
while ((i >= 0) && (results[i + 3] > results[i])) {
for (int j = 0; j < 3; j++) {
int temp = results[i + j];
results[i + j] = results[i + 3 + j];
results[i + 3 + j] = temp;
}
i = i - 3;
if (i < 0)
break;
}
}
}
}
System.out.println("top " + accSize + " matches:");
for (int i = accSize - 1; i >= 0; i--) {
drawCircle(results[i * 3], results[i * 3 + 1], results[i * 3 + 2]);
}
return output;
System.out.println("done");
return output;
} | public int[] process() {
acc = new int[width * height];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
acc[y * width + x] = 0;
}
}
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
if ((input[y * width + x] & 0xff) == 255) {
for (int theta = 0; theta < 360; theta++) {
t = (theta * 3.14159265) / 180;
x0 = (int) Math.round(x - r * Math.cos(t));
y0 = (int) Math.round(y - r * Math.sin(t));
if (x0 < width && x0 > 0 && y0 < height && y0 > 0) {
acc[x0 + (y0 * width)] += 1;
}
}
}
}
}
int max = 0;
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
if (acc[x + (y * width)] > max) {
max = acc[x + (y * width)];
}
}
}
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
value = (int) (((double) acc[x + (y * width)] / (double) max) * 255.0);
acc[x + (y * width)] = 0xff000000 | (value << 16 | value << 8 | value);
}
}
<DeepExtract>
results = new int[accSize * 3];
int[] output = new int[width * height];
for (int x = 0; x < width; x++) {
for (int y = 0; y < height; y++) {
int value = (acc[x + (y * width)] & 0xff);
if (value > results[(accSize - 1) * 3]) {
results[(accSize - 1) * 3] = value;
results[(accSize - 1) * 3 + 1] = x;
results[(accSize - 1) * 3 + 2] = y;
int i = (accSize - 2) * 3;
while ((i >= 0) && (results[i + 3] > results[i])) {
for (int j = 0; j < 3; j++) {
int temp = results[i + j];
results[i + j] = results[i + 3 + j];
results[i + 3 + j] = temp;
}
i = i - 3;
if (i < 0)
break;
}
}
}
}
System.out.println("top " + accSize + " matches:");
for (int i = accSize - 1; i >= 0; i--) {
drawCircle(results[i * 3], results[i * 3 + 1], results[i * 3 + 2]);
}
return output;
</DeepExtract>
System.out.println("done");
return output;
} | mybook-java-imageprocess | positive | 440,506 |
public String uploadFile(MultipartFile file) throws IOException {
StorePath storePath = storageClient.uploadFile(file.getInputStream(), file.getSize(), FilenameUtils.getExtension(file.getOriginalFilename()), null);
logger.debug("uploadFile fullPath:{}", storePath.getFullPath());
FDFS_UPLOAD.info("{}", storePath.getFullPath());
String fileRoot = "";
if (isHasFastDfsNginx()) {
fileRoot = getFastDfsNginx();
}
String filePath = String.format("%s/%s", fileRoot, storePath.getFullPath());
return filePath;
} | public String uploadFile(MultipartFile file) throws IOException {
StorePath storePath = storageClient.uploadFile(file.getInputStream(), file.getSize(), FilenameUtils.getExtension(file.getOriginalFilename()), null);
logger.debug("uploadFile fullPath:{}", storePath.getFullPath());
FDFS_UPLOAD.info("{}", storePath.getFullPath());
<DeepExtract>
String fileRoot = "";
if (isHasFastDfsNginx()) {
fileRoot = getFastDfsNginx();
}
String filePath = String.format("%s/%s", fileRoot, storePath.getFullPath());
return filePath;
</DeepExtract>
} | springcloud-thoth | positive | 440,507 |
public void parseDCFile(String filename) throws FileNotFoundException, RecognitionException, TokenStreamException {
FileReader fr = new FileReader(filename);
POSLLexer lex = new POSLLexer(fr);
org.ruleml.oojdrew.parsing.generated.POSLParser pp = new org.ruleml.oojdrew.parsing.generated.POSLParser(lex);
pp.rulebase(this.clauses);
} | public void parseDCFile(String filename) throws FileNotFoundException, RecognitionException, TokenStreamException {
FileReader fr = new FileReader(filename);
<DeepExtract>
POSLLexer lex = new POSLLexer(fr);
org.ruleml.oojdrew.parsing.generated.POSLParser pp = new org.ruleml.oojdrew.parsing.generated.POSLParser(lex);
pp.rulebase(this.clauses);
</DeepExtract>
} | OOjDREW | positive | 440,511 |
public void write(DeviceContact contact) throws IOException {
SignalServiceProtos.ContactDetails.Builder contactDetails = SignalServiceProtos.ContactDetails.newBuilder();
if (contact.getAddress().getUuid().isPresent()) {
contactDetails.setUuid(contact.getAddress().getUuid().get().toString());
}
if (contact.getAddress().getNumber().isPresent()) {
contactDetails.setNumber(contact.getAddress().getNumber().get());
}
if (contact.getName().isPresent()) {
contactDetails.setName(contact.getName().get());
}
if (contact.getAvatar().isPresent()) {
SignalServiceProtos.ContactDetails.Avatar.Builder avatarBuilder = SignalServiceProtos.ContactDetails.Avatar.newBuilder();
avatarBuilder.setContentType(contact.getAvatar().get().getContentType());
avatarBuilder.setLength((int) contact.getAvatar().get().getLength());
contactDetails.setAvatar(avatarBuilder);
}
if (contact.getColor().isPresent()) {
contactDetails.setColor(contact.getColor().get());
}
if (contact.getVerified().isPresent()) {
SignalServiceProtos.Verified.State state;
switch(contact.getVerified().get().getVerified()) {
case VERIFIED:
state = SignalServiceProtos.Verified.State.VERIFIED;
break;
case UNVERIFIED:
state = SignalServiceProtos.Verified.State.UNVERIFIED;
break;
default:
state = SignalServiceProtos.Verified.State.DEFAULT;
break;
}
SignalServiceProtos.Verified.Builder verifiedBuilder = SignalServiceProtos.Verified.newBuilder().setIdentityKey(ByteString.copyFrom(contact.getVerified().get().getIdentityKey().serialize())).setState(state);
if (contact.getVerified().get().getDestination().getUuid().isPresent()) {
verifiedBuilder.setDestinationUuid(contact.getVerified().get().getDestination().getUuid().get().toString());
}
if (contact.getVerified().get().getDestination().getNumber().isPresent()) {
verifiedBuilder.setDestinationE164(contact.getVerified().get().getDestination().getNumber().get());
}
contactDetails.setVerified(verifiedBuilder.build());
}
if (contact.getProfileKey().isPresent()) {
contactDetails.setProfileKey(ByteString.copyFrom(contact.getProfileKey().get()));
}
if (contact.getExpirationTimer().isPresent()) {
contactDetails.setExpireTimer(contact.getExpirationTimer().get());
}
contactDetails.setBlocked(contact.isBlocked());
byte[] serializedContactDetails = contactDetails.build().toByteArray();
writeVarint32(serializedContactDetails.length);
out.write(serializedContactDetails);
if (contact.getAvatar().isPresent()) {
writeStream(contact.getAvatar().get().getInputStream());
}
} | public void write(DeviceContact contact) throws IOException {
SignalServiceProtos.ContactDetails.Builder contactDetails = SignalServiceProtos.ContactDetails.newBuilder();
if (contact.getAddress().getUuid().isPresent()) {
contactDetails.setUuid(contact.getAddress().getUuid().get().toString());
}
if (contact.getAddress().getNumber().isPresent()) {
contactDetails.setNumber(contact.getAddress().getNumber().get());
}
if (contact.getName().isPresent()) {
contactDetails.setName(contact.getName().get());
}
if (contact.getAvatar().isPresent()) {
SignalServiceProtos.ContactDetails.Avatar.Builder avatarBuilder = SignalServiceProtos.ContactDetails.Avatar.newBuilder();
avatarBuilder.setContentType(contact.getAvatar().get().getContentType());
avatarBuilder.setLength((int) contact.getAvatar().get().getLength());
contactDetails.setAvatar(avatarBuilder);
}
if (contact.getColor().isPresent()) {
contactDetails.setColor(contact.getColor().get());
}
if (contact.getVerified().isPresent()) {
SignalServiceProtos.Verified.State state;
switch(contact.getVerified().get().getVerified()) {
case VERIFIED:
state = SignalServiceProtos.Verified.State.VERIFIED;
break;
case UNVERIFIED:
state = SignalServiceProtos.Verified.State.UNVERIFIED;
break;
default:
state = SignalServiceProtos.Verified.State.DEFAULT;
break;
}
SignalServiceProtos.Verified.Builder verifiedBuilder = SignalServiceProtos.Verified.newBuilder().setIdentityKey(ByteString.copyFrom(contact.getVerified().get().getIdentityKey().serialize())).setState(state);
if (contact.getVerified().get().getDestination().getUuid().isPresent()) {
verifiedBuilder.setDestinationUuid(contact.getVerified().get().getDestination().getUuid().get().toString());
}
if (contact.getVerified().get().getDestination().getNumber().isPresent()) {
verifiedBuilder.setDestinationE164(contact.getVerified().get().getDestination().getNumber().get());
}
contactDetails.setVerified(verifiedBuilder.build());
}
if (contact.getProfileKey().isPresent()) {
contactDetails.setProfileKey(ByteString.copyFrom(contact.getProfileKey().get()));
}
if (contact.getExpirationTimer().isPresent()) {
contactDetails.setExpireTimer(contact.getExpirationTimer().get());
}
contactDetails.setBlocked(contact.isBlocked());
byte[] serializedContactDetails = contactDetails.build().toByteArray();
writeVarint32(serializedContactDetails.length);
out.write(serializedContactDetails);
<DeepExtract>
if (contact.getAvatar().isPresent()) {
writeStream(contact.getAvatar().get().getInputStream());
}
</DeepExtract>
} | libsignal-service-java | positive | 440,512 |
@Override
protected void configurationChanged() {
StructuredViewer viewer = queryStructuredViewer.get(QueryField.PROJECT);
viewer.setInput(getConfiguration().getProjects());
viewer = queryStructuredViewer.get(QueryField.STATUS);
viewer.setInput(getConfiguration().getIssueStatuses());
viewer = queryStructuredViewer.get(QueryField.PRIORITY);
viewer.setInput(getConfiguration().getIssuePriorities());
viewer = queryStructuredViewer.get(QueryField.AUTHOR);
viewer.setInput(getConfiguration().getUsers());
List<Composite> oldComposites = new ArrayList<Composite>(2);
for (Control child : itemComposite.getChildren()) {
if (child instanceof Composite) {
oldComposites.add((Composite) child);
}
}
Assert.isTrue(oldComposites.size() == 2);
customFields.clear();
createCustomItemGroup(itemComposite);
LayoutHelper.placeTextElements(itemComposite, queryText, searchOperators);
LayoutHelper.placeListElements(itemComposite, 4, queryStructuredViewer, searchOperators);
oldComposites.get(0).dispose();
oldComposites.get(1).dispose();
itemComposite.layout();
pageComposite.layout();
pageScroll.setMinSize(pageComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
for (CustomField customField : configuration.getCustomFields().getIssueCustomFields()) {
QueryField queryField = customField.getQueryField();
if (!customField.isFilter() || queryField == null || !queryField.isListType())
continue;
StructuredViewer viewer = queryStructuredViewer.get(customField);
if (viewer == null)
continue;
viewer.setInput(customField.getPossibleValues());
}
} | @Override
protected void configurationChanged() {
StructuredViewer viewer = queryStructuredViewer.get(QueryField.PROJECT);
viewer.setInput(getConfiguration().getProjects());
viewer = queryStructuredViewer.get(QueryField.STATUS);
viewer.setInput(getConfiguration().getIssueStatuses());
viewer = queryStructuredViewer.get(QueryField.PRIORITY);
viewer.setInput(getConfiguration().getIssuePriorities());
viewer = queryStructuredViewer.get(QueryField.AUTHOR);
viewer.setInput(getConfiguration().getUsers());
List<Composite> oldComposites = new ArrayList<Composite>(2);
for (Control child : itemComposite.getChildren()) {
if (child instanceof Composite) {
oldComposites.add((Composite) child);
}
}
Assert.isTrue(oldComposites.size() == 2);
customFields.clear();
createCustomItemGroup(itemComposite);
LayoutHelper.placeTextElements(itemComposite, queryText, searchOperators);
LayoutHelper.placeListElements(itemComposite, 4, queryStructuredViewer, searchOperators);
oldComposites.get(0).dispose();
oldComposites.get(1).dispose();
itemComposite.layout();
pageComposite.layout();
pageScroll.setMinSize(pageComposite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
<DeepExtract>
for (CustomField customField : configuration.getCustomFields().getIssueCustomFields()) {
QueryField queryField = customField.getQueryField();
if (!customField.isFilter() || queryField == null || !queryField.isListType())
continue;
StructuredViewer viewer = queryStructuredViewer.get(customField);
if (viewer == null)
continue;
viewer.setInput(customField.getPossibleValues());
}
</DeepExtract>
} | redmine-mylyn-plugin | positive | 440,514 |
public static void main(String[] args) {
String s = "E A S Y Q U E S T I O N";
String[] a = s.split("\\s+");
int N = a.length;
aux = new Comparable[N];
for (int sz = 1; sz < N; sz = sz + sz) {
for (int lo = 0; lo < N - sz; lo += sz + sz) {
merge(a, lo, lo + sz - 1, Math.min(lo + sz + sz - 1, N - 1));
System.out.printf("merge(a, %2d, %2d, %2d) ", lo, lo + sz - 1, Math.min(lo + sz + sz - 1, N - 1));
for (int i = lo; i <= Math.min(lo + sz + sz - 1, N - 1); i++) {
System.out.printf("%3s", a[i]);
}
System.out.println();
}
}
} | public static void main(String[] args) {
String s = "E A S Y Q U E S T I O N";
String[] a = s.split("\\s+");
<DeepExtract>
int N = a.length;
aux = new Comparable[N];
for (int sz = 1; sz < N; sz = sz + sz) {
for (int lo = 0; lo < N - sz; lo += sz + sz) {
merge(a, lo, lo + sz - 1, Math.min(lo + sz + sz - 1, N - 1));
System.out.printf("merge(a, %2d, %2d, %2d) ", lo, lo + sz - 1, Math.min(lo + sz + sz - 1, N - 1));
for (int i = lo; i <= Math.min(lo + sz + sz - 1, N - 1); i++) {
System.out.printf("%3s", a[i]);
}
System.out.println();
}
}
</DeepExtract>
} | Algorithms | positive | 440,515 |
public static int countNumberOne(int n) {
Preconditions.checkArgument(n >= 0);
int first = String.valueOf(n).charAt(0) - '0';
if (String.valueOf(n).length() == 1) {
if (first == 0) {
return 0;
} else {
return 1;
}
}
int firstDigitCount;
if (first > 0) {
firstDigitCount = (int) Math.round(Math.pow(10, String.valueOf(n).length() - 1));
} else {
firstDigitCount = Integer.valueOf(String.valueOf(n).substring(1)) + 1;
}
int otherDigitCount = first * (String.valueOf(n).length() - 1) * (int) Math.round(Math.pow(10, String.valueOf(n).length() - 2));
return firstDigitCount + otherDigitCount + countNumberOneCore(String.valueOf(n).substring(1));
} | public static int countNumberOne(int n) {
Preconditions.checkArgument(n >= 0);
<DeepExtract>
int first = String.valueOf(n).charAt(0) - '0';
if (String.valueOf(n).length() == 1) {
if (first == 0) {
return 0;
} else {
return 1;
}
}
int firstDigitCount;
if (first > 0) {
firstDigitCount = (int) Math.round(Math.pow(10, String.valueOf(n).length() - 1));
} else {
firstDigitCount = Integer.valueOf(String.valueOf(n).substring(1)) + 1;
}
int otherDigitCount = first * (String.valueOf(n).length() - 1) * (int) Math.round(Math.pow(10, String.valueOf(n).length() - 2));
return firstDigitCount + otherDigitCount + countNumberOneCore(String.valueOf(n).substring(1));
</DeepExtract>
} | javaalgorithm | positive | 440,516 |
public Criteria andSDepartmentBetween(String value1, String value2) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "sDepartment" + " cannot be null");
}
criteria.add(new Criterion("s_department between", value1, value2));
return (Criteria) this;
} | public Criteria andSDepartmentBetween(String value1, String value2) {
<DeepExtract>
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + "sDepartment" + " cannot be null");
}
criteria.add(new Criterion("s_department between", value1, value2));
</DeepExtract>
return (Criteria) this;
} | webike | positive | 440,517 |
public void setUserInfo(UserInfo userInfo) {
if (!isConnected()) {
Log.e(TAG, "Not connected... Waiting for new connection...");
btConnectionManager.connect();
}
BluetoothDevice device = btConnectionManager.getDevice();
if (userInfo == null) {
userInfo = UserInfo.getDefault(device.getAddress(), context);
}
final List<BLEAction> list = new ArrayList<>();
list.add(new WriteAction(Profile.UUID_CHAR_USER_INFO, userInfo.getData()));
list.add(new WaitAction(100));
final BLETask task = new BLETask(list);
try {
io.queueTask(task);
} catch (NullPointerException ignored) {
}
} | public void setUserInfo(UserInfo userInfo) {
if (!isConnected()) {
Log.e(TAG, "Not connected... Waiting for new connection...");
btConnectionManager.connect();
}
BluetoothDevice device = btConnectionManager.getDevice();
if (userInfo == null) {
userInfo = UserInfo.getDefault(device.getAddress(), context);
}
final List<BLEAction> list = new ArrayList<>();
list.add(new WriteAction(Profile.UUID_CHAR_USER_INFO, userInfo.getData()));
list.add(new WaitAction(100));
<DeepExtract>
final BLETask task = new BLETask(list);
try {
io.queueTask(task);
} catch (NullPointerException ignored) {
}
</DeepExtract>
} | redalert-android | positive | 440,519 |
public static void init() {
random = RandomData.getInstance(RandomData.ALG_SECURE_RANDOM);
generatingPair = new KeyPair(KeyPair.ALG_EC_FP, KeyBuilder.LENGTH_EC_FP_256);
try {
transientPrivate = (ECPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PRIVATE_TRANSIENT_DESELECT, KeyBuilder.LENGTH_EC_FP_256, false);
transientPrivateTransient = true;
} catch (CryptoException e) {
try {
transientPrivate = (ECPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PRIVATE_TRANSIENT_RESET, KeyBuilder.LENGTH_EC_FP_256, false);
transientPrivateTransient = true;
} catch (CryptoException e1) {
transientPrivate = (ECPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PRIVATE, KeyBuilder.LENGTH_EC_FP_256, false);
initKeyCurve(transientPrivate);
}
}
(ECKey) generatingPair.getPublic().setA(SECP256K1_A, (short) 0, (short) SECP256K1_A.length);
(ECKey) generatingPair.getPublic().setB(SECP256K1_B, (short) 0, (short) SECP256K1_B.length);
(ECKey) generatingPair.getPublic().setFieldFP(SECP256K1_FP, (short) 0, (short) SECP256K1_FP.length);
(ECKey) generatingPair.getPublic().setG(SECP256K1_G, (short) 0, (short) SECP256K1_G.length);
(ECKey) generatingPair.getPublic().setR(SECP256K1_R, (short) 0, (short) SECP256K1_R.length);
(ECKey) generatingPair.getPublic().setK(SECP256K1_K);
(ECKey) generatingPair.getPrivate().setA(SECP256K1_A, (short) 0, (short) SECP256K1_A.length);
(ECKey) generatingPair.getPrivate().setB(SECP256K1_B, (short) 0, (short) SECP256K1_B.length);
(ECKey) generatingPair.getPrivate().setFieldFP(SECP256K1_FP, (short) 0, (short) SECP256K1_FP.length);
(ECKey) generatingPair.getPrivate().setG(SECP256K1_G, (short) 0, (short) SECP256K1_G.length);
(ECKey) generatingPair.getPrivate().setR(SECP256K1_R, (short) 0, (short) SECP256K1_R.length);
(ECKey) generatingPair.getPrivate().setK(SECP256K1_K);
digestFull = MessageDigest.getInstance(MessageDigest.ALG_SHA_256, false);
digestAuthorization = MessageDigest.getInstance(MessageDigest.ALG_SHA_256, false);
digestScratch = MessageDigest.getInstance(MessageDigest.ALG_SHA_256, false);
blobEncryptDecrypt = Cipher.getInstance(Cipher.ALG_DES_CBC_NOPAD, false);
signature = Signature.getInstance(Signature.ALG_ECDSA_SHA_256, false);
try {
digestRipemd = MessageDigest.getInstance(MessageDigest.ALG_RIPEMD160, false);
} catch (CryptoException e) {
Ripemd160.init();
}
} | public static void init() {
random = RandomData.getInstance(RandomData.ALG_SECURE_RANDOM);
generatingPair = new KeyPair(KeyPair.ALG_EC_FP, KeyBuilder.LENGTH_EC_FP_256);
try {
transientPrivate = (ECPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PRIVATE_TRANSIENT_DESELECT, KeyBuilder.LENGTH_EC_FP_256, false);
transientPrivateTransient = true;
} catch (CryptoException e) {
try {
transientPrivate = (ECPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PRIVATE_TRANSIENT_RESET, KeyBuilder.LENGTH_EC_FP_256, false);
transientPrivateTransient = true;
} catch (CryptoException e1) {
transientPrivate = (ECPrivateKey) KeyBuilder.buildKey(KeyBuilder.TYPE_EC_FP_PRIVATE, KeyBuilder.LENGTH_EC_FP_256, false);
initKeyCurve(transientPrivate);
}
}
(ECKey) generatingPair.getPublic().setA(SECP256K1_A, (short) 0, (short) SECP256K1_A.length);
(ECKey) generatingPair.getPublic().setB(SECP256K1_B, (short) 0, (short) SECP256K1_B.length);
(ECKey) generatingPair.getPublic().setFieldFP(SECP256K1_FP, (short) 0, (short) SECP256K1_FP.length);
(ECKey) generatingPair.getPublic().setG(SECP256K1_G, (short) 0, (short) SECP256K1_G.length);
(ECKey) generatingPair.getPublic().setR(SECP256K1_R, (short) 0, (short) SECP256K1_R.length);
(ECKey) generatingPair.getPublic().setK(SECP256K1_K);
<DeepExtract>
(ECKey) generatingPair.getPrivate().setA(SECP256K1_A, (short) 0, (short) SECP256K1_A.length);
(ECKey) generatingPair.getPrivate().setB(SECP256K1_B, (short) 0, (short) SECP256K1_B.length);
(ECKey) generatingPair.getPrivate().setFieldFP(SECP256K1_FP, (short) 0, (short) SECP256K1_FP.length);
(ECKey) generatingPair.getPrivate().setG(SECP256K1_G, (short) 0, (short) SECP256K1_G.length);
(ECKey) generatingPair.getPrivate().setR(SECP256K1_R, (short) 0, (short) SECP256K1_R.length);
(ECKey) generatingPair.getPrivate().setK(SECP256K1_K);
</DeepExtract>
digestFull = MessageDigest.getInstance(MessageDigest.ALG_SHA_256, false);
digestAuthorization = MessageDigest.getInstance(MessageDigest.ALG_SHA_256, false);
digestScratch = MessageDigest.getInstance(MessageDigest.ALG_SHA_256, false);
blobEncryptDecrypt = Cipher.getInstance(Cipher.ALG_DES_CBC_NOPAD, false);
signature = Signature.getInstance(Signature.ALG_ECDSA_SHA_256, false);
try {
digestRipemd = MessageDigest.getInstance(MessageDigest.ALG_RIPEMD160, false);
} catch (CryptoException e) {
Ripemd160.init();
}
} | AppletPlayground | positive | 440,521 |
@Override
public void setImageResource(@DrawableRes int resId) {
super.setImageResource(resId);
Bitmap image = drawableToBitmap(getDrawable());
int canvasSize = Math.min(canvasWidth, canvasHeight);
if (canvasSize > 0 && image != null) {
BitmapShader shader = new BitmapShader(ThumbnailUtils.extractThumbnail(image, canvasSize, canvasSize), Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
mPaint.setShader(shader);
}
invalidate();
} | @Override
public void setImageResource(@DrawableRes int resId) {
super.setImageResource(resId);
<DeepExtract>
Bitmap image = drawableToBitmap(getDrawable());
int canvasSize = Math.min(canvasWidth, canvasHeight);
if (canvasSize > 0 && image != null) {
BitmapShader shader = new BitmapShader(ThumbnailUtils.extractThumbnail(image, canvasSize, canvasSize), Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
mPaint.setShader(shader);
}
</DeepExtract>
invalidate();
} | BaseMyProject | positive | 440,526 |
public void save() throws IOException {
File playerFile = new File(playerFolder, fileName);
FileConfiguration playerData = new YamlConfiguration();
playerData.set("avatar", avatarAchievements);
for (Entry<String, Integer> entry : groupAchievements.entrySet()) {
playerData.set("groups." + entry.getKey(), entry.getValue());
}
for (Entry<String, Integer> entry : postCountAchievements.entrySet()) {
playerData.set("post-counts." + entry.getKey(), entry.getValue());
}
for (Entry<SectionPostCount, Integer> entry : sectionPostCountAchievements.entrySet()) {
String path = "section-post-counts." + entry.getKey().getSectionID() + "." + entry.getKey().getPostCount();
playerData.set(path, entry.getValue());
}
playerData.save(playerFile);
} | public void save() throws IOException {
File playerFile = new File(playerFolder, fileName);
FileConfiguration playerData = new YamlConfiguration();
playerData.set("avatar", avatarAchievements);
for (Entry<String, Integer> entry : groupAchievements.entrySet()) {
playerData.set("groups." + entry.getKey(), entry.getValue());
}
for (Entry<String, Integer> entry : postCountAchievements.entrySet()) {
playerData.set("post-counts." + entry.getKey(), entry.getValue());
}
<DeepExtract>
for (Entry<SectionPostCount, Integer> entry : sectionPostCountAchievements.entrySet()) {
String path = "section-post-counts." + entry.getKey().getSectionID() + "." + entry.getKey().getPostCount();
playerData.set(path, entry.getValue());
}
</DeepExtract>
playerData.save(playerFile);
} | CommunityBridge | positive | 440,527 |
public int getParameterValue(int code) {
if (!parameters.containsKey(code)) {
return 0;
}
return value;
} | public int getParameterValue(int code) {
if (!parameters.containsKey(code)) {
return 0;
}
<DeepExtract>
return value;
</DeepExtract>
} | OBD2 | positive | 440,528 |
public static Bitmap getimage(String srcPath) {
BitmapFactory.Options newOpts = new BitmapFactory.Options();
newOpts.inJustDecodeBounds = true;
Bitmap bitmap = BitmapFactory.decodeFile(srcPath, newOpts);
newOpts.inJustDecodeBounds = false;
int w = newOpts.outWidth;
int h = newOpts.outHeight;
float hh = 800f;
float ww = 480f;
int be = 1;
if (w > h && w > ww) {
be = (int) (newOpts.outWidth / ww);
} else if (w < h && h > hh) {
be = (int) (newOpts.outHeight / hh);
}
if (be <= 0)
be = 1;
newOpts.inSampleSize = be;
bitmap = BitmapFactory.decodeFile(srcPath, newOpts);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
int options = 100;
while (baos.toByteArray().length / 1024 > 100) {
baos.reset();
options -= 10;
bitmap.compress(Bitmap.CompressFormat.JPEG, options, baos);
}
ByteArrayInputStream isBm = new ByteArrayInputStream(baos.toByteArray());
Bitmap bitmap = BitmapFactory.decodeStream(isBm, null, null);
return bitmap;
} | public static Bitmap getimage(String srcPath) {
BitmapFactory.Options newOpts = new BitmapFactory.Options();
newOpts.inJustDecodeBounds = true;
Bitmap bitmap = BitmapFactory.decodeFile(srcPath, newOpts);
newOpts.inJustDecodeBounds = false;
int w = newOpts.outWidth;
int h = newOpts.outHeight;
float hh = 800f;
float ww = 480f;
int be = 1;
if (w > h && w > ww) {
be = (int) (newOpts.outWidth / ww);
} else if (w < h && h > hh) {
be = (int) (newOpts.outHeight / hh);
}
if (be <= 0)
be = 1;
newOpts.inSampleSize = be;
bitmap = BitmapFactory.decodeFile(srcPath, newOpts);
<DeepExtract>
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
int options = 100;
while (baos.toByteArray().length / 1024 > 100) {
baos.reset();
options -= 10;
bitmap.compress(Bitmap.CompressFormat.JPEG, options, baos);
}
ByteArrayInputStream isBm = new ByteArrayInputStream(baos.toByteArray());
Bitmap bitmap = BitmapFactory.decodeStream(isBm, null, null);
return bitmap;
</DeepExtract>
} | xmpp | positive | 440,530 |
public void onTestReady(Test test) {
if (suiteListener == null) {
if (getType() == null) {
throw new IllegalStateException("type of the mask retriver can't be null");
}
suiteListener = new Instantiator<SuiteListener>().getInstance(getType());
suiteListener.setProperties(this);
}
suiteListener.onTestReady(test);
} | public void onTestReady(Test test) {
<DeepExtract>
if (suiteListener == null) {
if (getType() == null) {
throw new IllegalStateException("type of the mask retriver can't be null");
}
suiteListener = new Instantiator<SuiteListener>().getInstance(getType());
suiteListener.setProperties(this);
}
</DeepExtract>
suiteListener.onTestReady(test);
} | arquillian-rusheye | positive | 440,532 |
public boolean addWordToDictionary(String word) {
mUserDictionary.addWord(word, 128);
mHandler.removeMessages(MSG_UPDATE_SUGGESTIONS);
mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_UPDATE_SUGGESTIONS), 100);
return true;
} | public boolean addWordToDictionary(String word) {
mUserDictionary.addWord(word, 128);
<DeepExtract>
mHandler.removeMessages(MSG_UPDATE_SUGGESTIONS);
mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_UPDATE_SUGGESTIONS), 100);
</DeepExtract>
return true;
} | Gingerbread-Keyboard | positive | 440,533 |
public Criteria andWeightIsNull() {
if ("weight is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("weight is null"));
return (Criteria) this;
} | public Criteria andWeightIsNull() {
<DeepExtract>
if ("weight is null" == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion("weight is null"));
</DeepExtract>
return (Criteria) this;
} | Whome | positive | 440,534 |
private int partition(int left, int right, int pivot) {
T pivotValue = array[pivot];
T tmp = array[right];
array[right] = array[pivot];
array[pivot] = tmp;
int storage = left;
for (int i = left; i < right; i++) {
if (comp.compare(array[i], pivotValue) < 0) {
swap(storage, i);
storage++;
}
}
T tmp = array[right];
array[right] = array[storage];
array[storage] = tmp;
return storage;
} | private int partition(int left, int right, int pivot) {
T pivotValue = array[pivot];
T tmp = array[right];
array[right] = array[pivot];
array[pivot] = tmp;
int storage = left;
for (int i = left; i < right; i++) {
if (comp.compare(array[i], pivotValue) < 0) {
swap(storage, i);
storage++;
}
}
<DeepExtract>
T tmp = array[right];
array[right] = array[storage];
array[storage] = tmp;
</DeepExtract>
return storage;
} | NanoUI-win32 | positive | 440,536 |
private void updateBracketUI() {
this.bracketHighlightingCheckbox.setSelection(matchingBrackets);
this.enclosingBracketsRadioButton.setSelection(enclosingBrackets);
if (!(enclosingBrackets)) {
this.matchingBracketRadioButton.setSelection(!(highlightBracketAtCaretLocation));
this.matchingBracketAndCaretLocationRadioButton.setSelection(highlightBracketAtCaretLocation);
}
for (MasterButtonSlaveSelectionListener listener : masterSlaveListeners) {
listener.updateSlaveComponent();
}
} | private void updateBracketUI() {
this.bracketHighlightingCheckbox.setSelection(matchingBrackets);
this.enclosingBracketsRadioButton.setSelection(enclosingBrackets);
if (!(enclosingBrackets)) {
this.matchingBracketRadioButton.setSelection(!(highlightBracketAtCaretLocation));
this.matchingBracketAndCaretLocationRadioButton.setSelection(highlightBracketAtCaretLocation);
}
<DeepExtract>
for (MasterButtonSlaveSelectionListener listener : masterSlaveListeners) {
listener.updateSlaveComponent();
}
</DeepExtract>
} | eclipse-yaml-editor | positive | 440,537 |
public static void main(String[] args) throws SolrServerException, IOException {
String id = "sha1:P566LTRHGUBUAQ7I7FFPNKWESWNXVL3I/fYJsnswpD+25KXMfiuOAlA==";
String server = "http://localhost:8080/discovery";
String collection = "Health and Social Care Act 2012 - NHS Reforms";
String collections = "Health and Social Care Act 2012 - NHS Reforms" + "|" + "NHS" + "|" + "Acute Trusts";
SolrClient ss = new HttpSolrClient.Builder(server).build();
SolrParams p = new SolrQuery("id:\"" + id + "\"");
QueryResponse r = ss.query(p);
System.out.println("GOT collection " + r.getResults().get(0).getFieldValue("collection"));
System.out.println("GOT collections " + r.getResults().get(0).getFieldValue("collections"));
System.out.println("STILL GOT crawl_date " + r.getResults().get(0).getFieldValue("crawl_date"));
ss.add(createUpdateDocument(id, collection, collections));
ss.commit(true, true);
System.out.println("Updated.");
SolrParams p = new SolrQuery("id:\"" + id + "\"");
QueryResponse r = ss.query(p);
System.out.println("GOT collection " + r.getResults().get(0).getFieldValue("collection"));
System.out.println("GOT collections " + r.getResults().get(0).getFieldValue("collections"));
System.out.println("STILL GOT crawl_date " + r.getResults().get(0).getFieldValue("crawl_date"));
ss.add(createUpdateDocument(id, null, null));
ss.commit(true, true);
System.out.println("Updated.");
SolrParams p = new SolrQuery("id:\"" + id + "\"");
QueryResponse r = ss.query(p);
System.out.println("GOT collection " + r.getResults().get(0).getFieldValue("collection"));
System.out.println("GOT collections " + r.getResults().get(0).getFieldValue("collections"));
System.out.println("STILL GOT crawl_date " + r.getResults().get(0).getFieldValue("crawl_date"));
} | public static void main(String[] args) throws SolrServerException, IOException {
String id = "sha1:P566LTRHGUBUAQ7I7FFPNKWESWNXVL3I/fYJsnswpD+25KXMfiuOAlA==";
String server = "http://localhost:8080/discovery";
String collection = "Health and Social Care Act 2012 - NHS Reforms";
String collections = "Health and Social Care Act 2012 - NHS Reforms" + "|" + "NHS" + "|" + "Acute Trusts";
SolrClient ss = new HttpSolrClient.Builder(server).build();
<DeepExtract>
SolrParams p = new SolrQuery("id:\"" + id + "\"");
QueryResponse r = ss.query(p);
System.out.println("GOT collection " + r.getResults().get(0).getFieldValue("collection"));
System.out.println("GOT collections " + r.getResults().get(0).getFieldValue("collections"));
System.out.println("STILL GOT crawl_date " + r.getResults().get(0).getFieldValue("crawl_date"));
</DeepExtract>
ss.add(createUpdateDocument(id, collection, collections));
ss.commit(true, true);
System.out.println("Updated.");
<DeepExtract>
SolrParams p = new SolrQuery("id:\"" + id + "\"");
QueryResponse r = ss.query(p);
System.out.println("GOT collection " + r.getResults().get(0).getFieldValue("collection"));
System.out.println("GOT collections " + r.getResults().get(0).getFieldValue("collections"));
System.out.println("STILL GOT crawl_date " + r.getResults().get(0).getFieldValue("crawl_date"));
</DeepExtract>
ss.add(createUpdateDocument(id, null, null));
ss.commit(true, true);
System.out.println("Updated.");
<DeepExtract>
SolrParams p = new SolrQuery("id:\"" + id + "\"");
QueryResponse r = ss.query(p);
System.out.println("GOT collection " + r.getResults().get(0).getFieldValue("collection"));
System.out.println("GOT collections " + r.getResults().get(0).getFieldValue("collections"));
System.out.println("STILL GOT crawl_date " + r.getResults().get(0).getFieldValue("crawl_date"));
</DeepExtract>
} | webarchive-discovery | positive | 440,539 |
public static PopTip build(OnBindView<PopTip> onBindView) {
this.onBindView = onBindView;
refreshUI();
return this;
} | public static PopTip build(OnBindView<PopTip> onBindView) {
<DeepExtract>
this.onBindView = onBindView;
refreshUI();
return this;
</DeepExtract>
} | DialogX | positive | 440,540 |
public long getTotalFilesSent() {
Iterable<ProgressInfo> completed = Iterables.filter(sendingFiles.values(), input -> input.isCompleted());
return Iterables.size(completed);
} | public long getTotalFilesSent() {
<DeepExtract>
Iterable<ProgressInfo> completed = Iterables.filter(sendingFiles.values(), input -> input.isCompleted());
return Iterables.size(completed);
</DeepExtract>
} | scylla-jmx | positive | 440,541 |
public Node balancedbst(Node parent) {
ArrayList<Integer> list = new ArrayList<>();
if (parent == null) {
return;
}
inorder(parent.left, list);
list.add(parent.data);
inorder(parent.right, list);
if (0 > list.size() - 1) {
return null;
}
int mid = 0 + (list.size() - 1 - 0) / 2;
Node parent = new Node(list.get(mid), null, null);
parent.left = makeBST(list, 0, mid - 1);
parent.right = makeBST(list, mid + 1, list.size() - 1);
return parent;
} | public Node balancedbst(Node parent) {
ArrayList<Integer> list = new ArrayList<>();
if (parent == null) {
return;
}
inorder(parent.left, list);
list.add(parent.data);
inorder(parent.right, list);
<DeepExtract>
if (0 > list.size() - 1) {
return null;
}
int mid = 0 + (list.size() - 1 - 0) / 2;
Node parent = new Node(list.get(mid), null, null);
parent.left = makeBST(list, 0, mid - 1);
parent.right = makeBST(list, mid + 1, list.size() - 1);
return parent;
</DeepExtract>
} | Java-Solutions | positive | 440,543 |
public Builder mergeFrom(protoc.ServiceProto.PlayerGameState other) {
if (other == protoc.ServiceProto.PlayerGameState.getDefaultInstance())
return this;
if (other.stateFlag_ != 0) {
setStateFlagValue(other.getStateFlagValue());
}
if (other.getIsControl() != false) {
setIsControl(other.getIsControl());
}
if (other.hasFrameData()) {
mergeFrameData(other.getFrameData());
}
if (other.hasNonDelayFrameData()) {
mergeNonDelayFrameData(other.getNonDelayFrameData());
}
if (other.hasScreenData()) {
mergeScreenData(other.getScreenData());
}
if (other.hasAudioData()) {
mergeAudioData(other.getAudioData());
}
if (other.hasGameData()) {
mergeGameData(other.getGameData());
}
if (other.hasRoundResult()) {
mergeRoundResult(other.getRoundResult());
}
return super.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
} | public Builder mergeFrom(protoc.ServiceProto.PlayerGameState other) {
if (other == protoc.ServiceProto.PlayerGameState.getDefaultInstance())
return this;
if (other.stateFlag_ != 0) {
setStateFlagValue(other.getStateFlagValue());
}
if (other.getIsControl() != false) {
setIsControl(other.getIsControl());
}
if (other.hasFrameData()) {
mergeFrameData(other.getFrameData());
}
if (other.hasNonDelayFrameData()) {
mergeNonDelayFrameData(other.getNonDelayFrameData());
}
if (other.hasScreenData()) {
mergeScreenData(other.getScreenData());
}
if (other.hasAudioData()) {
mergeAudioData(other.getAudioData());
}
if (other.hasGameData()) {
mergeGameData(other.getGameData());
}
if (other.hasRoundResult()) {
mergeRoundResult(other.getRoundResult());
}
<DeepExtract>
return super.mergeUnknownFields(other.getUnknownFields());
</DeepExtract>
onChanged();
return this;
} | FightingICE | positive | 440,544 |
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
final var user = User.getUser(event.getPlayer().getUniqueId());
if (User.isUserInvalid(user, this) || event.getItem() == null || !isIllegalStack(event.getItem()))
return;
event.setCancelled(true);
removeItem(user.getPlayer(), event.getItem());
simpleDetection.accept(user);
} | @EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
<DeepExtract>
final var user = User.getUser(event.getPlayer().getUniqueId());
if (User.isUserInvalid(user, this) || event.getItem() == null || !isIllegalStack(event.getItem()))
return;
event.setCancelled(true);
removeItem(user.getPlayer(), event.getItem());
simpleDetection.accept(user);
</DeepExtract>
} | AACAdditionPro | positive | 440,546 |
public static int writeReverseLexVarInt64(ByteBuffer buf, long value) {
boolean negate = -(value + 1) < 0;
if (negate) {
-(value + 1) = -(-(value + 1) + 1);
}
int size = encodedLength(-(value + 1));
int remaining = size - 1;
byte b0;
if (size == 9) {
buf.put((byte) (negate ? 0 : 0xff));
b0 = (byte) (0x80 | (-(value + 1) >>> 56));
remaining--;
} else {
b0 = (byte) (0xff << (8 - size));
byte mask = (byte) ~b0;
b0 = (byte) (b0 | ((-(value + 1) >>> (8 * remaining)) & mask));
}
if (negate) {
b0 = (byte) ~b0;
buf.put(b0);
for (int i = remaining; i > 0; i--) {
byte b = (byte) (-(value + 1) >>> (8 * (i - 1)));
buf.put((byte) ~b);
}
} else {
buf.put(b0);
for (; remaining > 0; remaining--) {
byte b = (byte) (-(value + 1) >>> (8 * (remaining - 1)));
buf.put(b);
}
}
return size;
} | public static int writeReverseLexVarInt64(ByteBuffer buf, long value) {
<DeepExtract>
boolean negate = -(value + 1) < 0;
if (negate) {
-(value + 1) = -(-(value + 1) + 1);
}
int size = encodedLength(-(value + 1));
int remaining = size - 1;
byte b0;
if (size == 9) {
buf.put((byte) (negate ? 0 : 0xff));
b0 = (byte) (0x80 | (-(value + 1) >>> 56));
remaining--;
} else {
b0 = (byte) (0xff << (8 - size));
byte mask = (byte) ~b0;
b0 = (byte) (b0 | ((-(value + 1) >>> (8 * remaining)) & mask));
}
if (negate) {
b0 = (byte) ~b0;
buf.put(b0);
for (int i = remaining; i > 0; i--) {
byte b = (byte) (-(value + 1) >>> (8 * (i - 1)));
buf.put((byte) ~b);
}
} else {
buf.put(b0);
for (; remaining > 0; remaining--) {
byte b = (byte) (-(value + 1) >>> (8 * (remaining - 1)));
buf.put(b);
}
}
return size;
</DeepExtract>
} | tracingplane-java | positive | 440,548 |
@Nullable
@Override
public String getPresentableText() {
String name = getQualifiedName();
if (name == null) {
return "";
}
int lastDot = name.lastIndexOf('.');
if (lastDot < 0) {
return name;
}
return name.substring(lastDot + 1);
} | @Nullable
@Override
public String getPresentableText() {
<DeepExtract>
String name = getQualifiedName();
if (name == null) {
return "";
}
int lastDot = name.lastIndexOf('.');
if (lastDot < 0) {
return name;
}
return name.substring(lastDot + 1);
</DeepExtract>
} | smalidea | positive | 440,549 |
public void testSignalWithCalcBelowMinMaxLimit() {
Model m = buildModelWithCalculationATimeBAndMinMaxLimits(-0.5, 23.5, -1., +1.);
try {
m.initialize();
} catch (DAVEException e) {
fail("Exception thrown while initializing model in buildAndTestModelWithCalcAndMinMaxLimits: " + e.getMessage());
}
SignalArrayList sal = m.getSignals();
Signal dv = sal.findByID("dv");
assertNotNull(dv);
try {
assertTrue(dv.sourceReady());
assertEquals(-1., dv.sourceValue(), 0.0000001);
} catch (DAVEException e) {
fail("Exception thrown while getting value of signal source in buildAndTestModelWithCalcAndMinMaxLimits: " + e.getMessage());
}
} | public void testSignalWithCalcBelowMinMaxLimit() {
<DeepExtract>
Model m = buildModelWithCalculationATimeBAndMinMaxLimits(-0.5, 23.5, -1., +1.);
try {
m.initialize();
} catch (DAVEException e) {
fail("Exception thrown while initializing model in buildAndTestModelWithCalcAndMinMaxLimits: " + e.getMessage());
}
SignalArrayList sal = m.getSignals();
Signal dv = sal.findByID("dv");
assertNotNull(dv);
try {
assertTrue(dv.sourceReady());
assertEquals(-1., dv.sourceValue(), 0.0000001);
} catch (DAVEException e) {
fail("Exception thrown while getting value of signal source in buildAndTestModelWithCalcAndMinMaxLimits: " + e.getMessage());
}
</DeepExtract>
} | DAVEtools | positive | 440,550 |
public final String boolean_type(AST _t) throws RecognitionException {
String TypeName = "BOOLEAN";
AST boolean_type_AST_in;
if (_t == ASTNULL) {
boolean_type_AST_in = null;
} else {
boolean_type_AST_in = _t;
}
returnAST = null;
ASTPair currentAST = new ASTPair();
AST boolean_type_AST = null;
try {
AST __t52 = _t;
AST tmp40_AST = null;
AST tmp40_AST_in = null;
tmp40_AST = astFactory.create((AST) _t);
tmp40_AST_in = (AST) _t;
astFactory.addASTChild(currentAST, tmp40_AST);
ASTPair __currentAST52 = currentAST.copy();
currentAST.root = currentAST.child;
currentAST.child = null;
match(_t, Express2DictWalkerTokenTypes.BOOLEAN_TYPE);
_t = _t.getFirstChild();
nothing(_t);
_t = _retTree;
astFactory.addASTChild(currentAST, returnAST);
currentAST = __currentAST52;
_t = __t52;
_t = _t.getNextSibling();
boolean_type_AST = (AST) currentAST.root;
} catch (RecognitionException ex) {
reportError(ex);
if (_t != null) {
_t = _t.getNextSibling();
}
}
returnAST = boolean_type_AST;
_retTree = _t;
return TypeName;
} | public final String boolean_type(AST _t) throws RecognitionException {
String TypeName = "BOOLEAN";
<DeepExtract>
AST boolean_type_AST_in;
if (_t == ASTNULL) {
boolean_type_AST_in = null;
} else {
boolean_type_AST_in = _t;
}
</DeepExtract>
returnAST = null;
ASTPair currentAST = new ASTPair();
AST boolean_type_AST = null;
try {
AST __t52 = _t;
AST tmp40_AST = null;
AST tmp40_AST_in = null;
tmp40_AST = astFactory.create((AST) _t);
tmp40_AST_in = (AST) _t;
astFactory.addASTChild(currentAST, tmp40_AST);
ASTPair __currentAST52 = currentAST.copy();
currentAST.root = currentAST.child;
currentAST.child = null;
match(_t, Express2DictWalkerTokenTypes.BOOLEAN_TYPE);
_t = _t.getFirstChild();
nothing(_t);
_t = _retTree;
astFactory.addASTChild(currentAST, returnAST);
currentAST = __currentAST52;
_t = __t52;
_t = _t.getNextSibling();
boolean_type_AST = (AST) currentAST.root;
} catch (RecognitionException ex) {
reportError(ex);
if (_t != null) {
_t = _t.getNextSibling();
}
}
returnAST = boolean_type_AST;
_retTree = _t;
return TypeName;
} | BuildingSMARTLibrary | positive | 440,553 |
static DropInEvent createAddCardSubmitEvent(String cardNumber) {
DropInEvent event = new DropInEvent(DropInEventType.ADD_CARD_SUBMIT);
bundle.putString(DropInEventProperty.CARD_NUMBER.getBundleKey(), cardNumber);
return event;
} | static DropInEvent createAddCardSubmitEvent(String cardNumber) {
DropInEvent event = new DropInEvent(DropInEventType.ADD_CARD_SUBMIT);
<DeepExtract>
bundle.putString(DropInEventProperty.CARD_NUMBER.getBundleKey(), cardNumber);
</DeepExtract>
return event;
} | braintree-android-drop-in | positive | 440,554 |
private static void testIFrames() throws Exception {
_driver.switchTo().frame("iframe001");
String content = _driver.findElement(By.className("iframe-content")).getText();
String expected = "content in iframe 001";
System.out.println(content);
if (!expected.equals(content))
throw new Exception("content should be " + expected);
_driver.switchTo().frame("iframe002");
content = _driver.findElement(By.className("iframe-content")).getText();
expected = "content in iframe 002";
System.out.println(content);
if (!expected.equals(content))
throw new Exception("content should be " + expected);
_driver.switchTo().defaultContent();
_driver.switchTo().frame("iframe003");
content = _driver.findElement(By.className("iframe-content")).getText();
expected = "content in iframe 003";
System.out.println(content);
if (!expected.equals(content))
throw new Exception("content should be " + expected);
_driver.switchTo().defaultContent();
} | private static void testIFrames() throws Exception {
_driver.switchTo().frame("iframe001");
String content = _driver.findElement(By.className("iframe-content")).getText();
String expected = "content in iframe 001";
System.out.println(content);
<DeepExtract>
if (!expected.equals(content))
throw new Exception("content should be " + expected);
</DeepExtract>
_driver.switchTo().frame("iframe002");
content = _driver.findElement(By.className("iframe-content")).getText();
expected = "content in iframe 002";
System.out.println(content);
<DeepExtract>
if (!expected.equals(content))
throw new Exception("content should be " + expected);
</DeepExtract>
_driver.switchTo().defaultContent();
_driver.switchTo().frame("iframe003");
content = _driver.findElement(By.className("iframe-content")).getText();
expected = "content in iframe 003";
System.out.println(content);
<DeepExtract>
if (!expected.equals(content))
throw new Exception("content should be " + expected);
</DeepExtract>
_driver.switchTo().defaultContent();
} | JSP_Servlet_Practice | positive | 440,555 |
@Override
public void addUrlAttachmentToCard(String idCard, String url) {
logger.debug("PostForObject request on Trello API at url {} for class {} with params {}", createUrl(ADD_ATTACHMENT_TO_CARD).asString(), Attachment.class.getCanonicalName(), idCard);
return httpClient.postForObject(createUrl(ADD_ATTACHMENT_TO_CARD).asString(), new Attachment(url), Attachment.class, enrichParams(idCard));
} | @Override
public void addUrlAttachmentToCard(String idCard, String url) {
<DeepExtract>
logger.debug("PostForObject request on Trello API at url {} for class {} with params {}", createUrl(ADD_ATTACHMENT_TO_CARD).asString(), Attachment.class.getCanonicalName(), idCard);
return httpClient.postForObject(createUrl(ADD_ATTACHMENT_TO_CARD).asString(), new Attachment(url), Attachment.class, enrichParams(idCard));
</DeepExtract>
} | trello-java-wrapper | positive | 440,556 |
@Override
protected final void configure() {
super.configure();
bindConstant().annotatedWith(named(ChatUtil.SERVER_PORT_KEY)).to(ChatUtil.SERVER_PORT);
bind(ChatServer.class).to(ChatServerImpl.class).in(Singleton.class);
bind(ChatChannelInitializer.class).to(ChatChannelInitializerImpl.class);
bind(ChatHandler.class).to(ServerChatHandlerImpl.class);
bind(CommandEncoder.class).to(CommandEncoderImpl.class);
bind(CommandDecoder.class).to(CommandDecoderImpl.class);
bind(ObjectMapper.class).toProvider(ObjectMapperProvider.class).in(Singleton.class);
} | @Override
protected final void configure() {
super.configure();
bindConstant().annotatedWith(named(ChatUtil.SERVER_PORT_KEY)).to(ChatUtil.SERVER_PORT);
bind(ChatServer.class).to(ChatServerImpl.class).in(Singleton.class);
bind(ChatChannelInitializer.class).to(ChatChannelInitializerImpl.class);
bind(ChatHandler.class).to(ServerChatHandlerImpl.class);
bind(CommandEncoder.class).to(CommandEncoderImpl.class);
bind(CommandDecoder.class).to(CommandDecoderImpl.class);
<DeepExtract>
bind(ObjectMapper.class).toProvider(ObjectMapperProvider.class).in(Singleton.class);
</DeepExtract>
} | javatrove | positive | 440,557 |
@Test
public void textConcurrentLinkedQueue() {
int count = (length / threadCount);
for (int i = 0; i < threadCount; i++) {
int index = i * count;
new Thread(() -> {
for (int j = 0; j < count; j++) {
new ConcurrentLinkedQueue<>().add(index + j);
}
}).start();
}
testSingleConsumer(new ConcurrentLinkedQueue<>());
} | @Test
public void textConcurrentLinkedQueue() {
<DeepExtract>
int count = (length / threadCount);
for (int i = 0; i < threadCount; i++) {
int index = i * count;
new Thread(() -> {
for (int j = 0; j < count; j++) {
new ConcurrentLinkedQueue<>().add(index + j);
}
}).start();
}
testSingleConsumer(new ConcurrentLinkedQueue<>());
</DeepExtract>
} | Okra | positive | 440,558 |
public static boolean isLinked(@Nonnull UUID uuid) {
MutablePair<ResultType, Object> pair = MutablePair.of(ResultType.BOOLEAN, false);
int id = generator++;
TeamSpeakAPI.results.put(id, pair);
Jedis jedis = null;
try {
jedis = SamaGamesAPI.get().getBungeeResource();
if (jedis != null)
jedis.publish("tsbot", SamaGamesAPI.get().getServerName() + "/" + id + ":" + "linked:" + uuid);
} catch (Exception exception) {
SamaGamesAPI.get().getPlugin().getLogger().log(Level.SEVERE, "Jedis error", exception);
} finally {
if (jedis != null)
jedis.close();
}
try {
synchronized (pair) {
pair.wait(TeamSpeakAPI.TIMEOUT);
}
} catch (Exception ignored) {
}
return (boolean) pair.getRight();
} | public static boolean isLinked(@Nonnull UUID uuid) {
MutablePair<ResultType, Object> pair = MutablePair.of(ResultType.BOOLEAN, false);
int id = generator++;
TeamSpeakAPI.results.put(id, pair);
<DeepExtract>
Jedis jedis = null;
try {
jedis = SamaGamesAPI.get().getBungeeResource();
if (jedis != null)
jedis.publish("tsbot", SamaGamesAPI.get().getServerName() + "/" + id + ":" + "linked:" + uuid);
} catch (Exception exception) {
SamaGamesAPI.get().getPlugin().getLogger().log(Level.SEVERE, "Jedis error", exception);
} finally {
if (jedis != null)
jedis.close();
}
</DeepExtract>
try {
synchronized (pair) {
pair.wait(TeamSpeakAPI.TIMEOUT);
}
} catch (Exception ignored) {
}
return (boolean) pair.getRight();
} | SamaGamesAPI | positive | 440,559 |
@Test
public void testBasicMethodAndConstructor() throws IOException {
final Hack.HackedMethod1<Simple, Void, IOException, Unchecked, Unchecked, Integer> constructor = Hack.into(Simple.class).constructor().throwing(IOException.class).withParam(int.class);
assertNotNull(constructor);
final Simple simple = constructor.invoke(0).statically();
assertNotNull(simple);
final Hack.HackedMethod0<Integer, Simple, Unchecked, Unchecked, Unchecked> foo = Hack.into(Simple.class).method("foo").returning(int.class).withoutParams();
assertNotNull(foo);
assertEquals(7, (int) foo.invoke().on(simple));
final Hack.HackedMethod0<Integer, Simple, RuntimeException, Unchecked, Unchecked> foo_rt_ex = Hack.into(Simple.class).method("foo").returning(int.class).throwing(RuntimeException.class).withoutParams();
assertNotNull(foo_rt_ex);
assertEquals(7, (int) foo_rt_ex.invoke().on(simple));
final Hack.HackedMethod0<Integer, Simple, IOException, Unchecked, Unchecked> foo_ex = Hack.into(Simple.class).method("foo").returning(int.class).throwing(IOException.class).withoutParams();
assertNotNull(foo_ex);
assertEquals(7, (int) foo_ex.invoke().on(simple));
final Hack.HackedMethod3<Void, Void, IOException, Unchecked, Unchecked, Integer, String, Simple> bar = Hack.into(Simple.class).staticMethod("bar").throwing(IOException.class).withParams(int.class, String.class, Simple.class);
assertNotNull(bar);
bar.invoke(-1, "xyz", simple).statically();
assertNull(Hack.into(Simple.class).method("bar").throwing(UnsupportedOperationException.class, FileNotFoundException.class).withParams(int.class, String.class, Simple.class));
assertNotNull(mFailure);
if (null != null) {
assertNotNull(mFailure.getCause());
assertEquals(null, mFailure.getCause().getClass());
}
mFailure = null;
assertNull(Hack.into(Simple.class).method("notExist").withoutParams());
assertNotNull(mFailure);
if (NoSuchMethodException.class != null) {
assertNotNull(mFailure.getCause());
assertEquals(NoSuchMethodException.class, mFailure.getCause().getClass());
}
mFailure = null;
assertNull(Hack.into(Simple.class).method("foo").withParam(int.class));
assertNotNull(mFailure);
if (NoSuchMethodException.class != null) {
assertNotNull(mFailure.getCause());
assertEquals(NoSuchMethodException.class, mFailure.getCause().getClass());
}
mFailure = null;
assertNull(Hack.into(Simple.class).staticMethod("foo").withoutParams());
assertNotNull(mFailure);
if (null != null) {
assertNotNull(mFailure.getCause());
assertEquals(null, mFailure.getCause().getClass());
}
mFailure = null;
assertNull(Hack.into(Simple.class).method("foo").returning(Void.class).withoutParams());
assertNotNull(mFailure);
if (null != null) {
assertNotNull(mFailure.getCause());
assertEquals(null, mFailure.getCause().getClass());
}
mFailure = null;
} | @Test
public void testBasicMethodAndConstructor() throws IOException {
final Hack.HackedMethod1<Simple, Void, IOException, Unchecked, Unchecked, Integer> constructor = Hack.into(Simple.class).constructor().throwing(IOException.class).withParam(int.class);
assertNotNull(constructor);
final Simple simple = constructor.invoke(0).statically();
assertNotNull(simple);
final Hack.HackedMethod0<Integer, Simple, Unchecked, Unchecked, Unchecked> foo = Hack.into(Simple.class).method("foo").returning(int.class).withoutParams();
assertNotNull(foo);
assertEquals(7, (int) foo.invoke().on(simple));
final Hack.HackedMethod0<Integer, Simple, RuntimeException, Unchecked, Unchecked> foo_rt_ex = Hack.into(Simple.class).method("foo").returning(int.class).throwing(RuntimeException.class).withoutParams();
assertNotNull(foo_rt_ex);
assertEquals(7, (int) foo_rt_ex.invoke().on(simple));
final Hack.HackedMethod0<Integer, Simple, IOException, Unchecked, Unchecked> foo_ex = Hack.into(Simple.class).method("foo").returning(int.class).throwing(IOException.class).withoutParams();
assertNotNull(foo_ex);
assertEquals(7, (int) foo_ex.invoke().on(simple));
final Hack.HackedMethod3<Void, Void, IOException, Unchecked, Unchecked, Integer, String, Simple> bar = Hack.into(Simple.class).staticMethod("bar").throwing(IOException.class).withParams(int.class, String.class, Simple.class);
assertNotNull(bar);
bar.invoke(-1, "xyz", simple).statically();
assertNull(Hack.into(Simple.class).method("bar").throwing(UnsupportedOperationException.class, FileNotFoundException.class).withParams(int.class, String.class, Simple.class));
assertNotNull(mFailure);
if (null != null) {
assertNotNull(mFailure.getCause());
assertEquals(null, mFailure.getCause().getClass());
}
mFailure = null;
assertNull(Hack.into(Simple.class).method("notExist").withoutParams());
assertNotNull(mFailure);
if (NoSuchMethodException.class != null) {
assertNotNull(mFailure.getCause());
assertEquals(NoSuchMethodException.class, mFailure.getCause().getClass());
}
mFailure = null;
assertNull(Hack.into(Simple.class).method("foo").withParam(int.class));
assertNotNull(mFailure);
if (NoSuchMethodException.class != null) {
assertNotNull(mFailure.getCause());
assertEquals(NoSuchMethodException.class, mFailure.getCause().getClass());
}
mFailure = null;
assertNull(Hack.into(Simple.class).staticMethod("foo").withoutParams());
assertNotNull(mFailure);
if (null != null) {
assertNotNull(mFailure.getCause());
assertEquals(null, mFailure.getCause().getClass());
}
mFailure = null;
<DeepExtract>
assertNull(Hack.into(Simple.class).method("foo").returning(Void.class).withoutParams());
assertNotNull(mFailure);
if (null != null) {
assertNotNull(mFailure.getCause());
assertEquals(null, mFailure.getCause().getClass());
}
mFailure = null;
</DeepExtract>
} | deagle | positive | 440,560 |
@Override
public void config(DataSerializer serializer) {
if (serializer.currentToken() == null) {
serializer.initToken();
}
serializer.setParserFeature(segmentParserFeature);
} | @Override
public void config(DataSerializer serializer) {
<DeepExtract>
if (serializer.currentToken() == null) {
serializer.initToken();
}
serializer.setParserFeature(segmentParserFeature);
</DeepExtract>
} | hj212 | positive | 440,561 |
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case MENU_SETTINGS:
startActivity(new Intent(this, ActivitySettings.class));
return true;
case MENU_CLEAR_LOGS:
switch(logTypeSelected) {
case KEY_EVENT_LOGS:
UIDbHelperStore.instance().db().deleteEventLogs();
break;
case KEY_ACTION_LOGS:
UIDbHelperStore.instance().db().deleteActionLogs();
break;
case KEY_GENERAL_LOGS:
UIDbHelperStore.instance().db().deleteGeneralLogs();
break;
case KEY_ALL_LOGS:
UIDbHelperStore.instance().db().deleteAllLogs();
break;
}
}
LogAdapter logAdapter = new LogAdapter(this);
listView = (ListView) findViewById(R.id.activity_logs_listview);
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
listView.setAdapter(logAdapter);
state = getSharedPreferences(KEY_STATE, Context.MODE_WORLD_READABLE | Context.MODE_WORLD_WRITEABLE);
listView.setItemChecked(state.getInt(KEY_STATE_SELECTED_LOG, -1), true);
return super.onOptionsItemSelected(item);
} | @Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()) {
case MENU_SETTINGS:
startActivity(new Intent(this, ActivitySettings.class));
return true;
case MENU_CLEAR_LOGS:
switch(logTypeSelected) {
case KEY_EVENT_LOGS:
UIDbHelperStore.instance().db().deleteEventLogs();
break;
case KEY_ACTION_LOGS:
UIDbHelperStore.instance().db().deleteActionLogs();
break;
case KEY_GENERAL_LOGS:
UIDbHelperStore.instance().db().deleteGeneralLogs();
break;
case KEY_ALL_LOGS:
UIDbHelperStore.instance().db().deleteAllLogs();
break;
}
}
<DeepExtract>
LogAdapter logAdapter = new LogAdapter(this);
listView = (ListView) findViewById(R.id.activity_logs_listview);
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
listView.setAdapter(logAdapter);
state = getSharedPreferences(KEY_STATE, Context.MODE_WORLD_READABLE | Context.MODE_WORLD_WRITEABLE);
listView.setItemChecked(state.getInt(KEY_STATE_SELECTED_LOG, -1), true);
</DeepExtract>
return super.onOptionsItemSelected(item);
} | LibreTasks | positive | 440,563 |
public static void loadDefault(Object loadObj, ImageView imageView, Boolean asGif, DecodeFormat format, DiskCacheStrategy diskcacheStrategy) {
final RequestManager manager = Glide.with(imageView.getContext());
DrawableTypeRequest request = null;
if (loadObj instanceof Integer) {
request = manager.load((Integer) loadObj);
} else if (loadObj instanceof String) {
request = manager.load((String) loadObj);
} else if (loadObj instanceof Uri) {
request = manager.load((Uri) loadObj);
} else if (loadObj instanceof File) {
request = manager.load((File) loadObj);
}
if (request == null) {
return;
}
if (asGif != null) {
if (asGif) {
final GifTypeRequest gifTypeRequest = request.asGif();
load(gifTypeRequest, imageView, 0, 0, R.drawable.ic_loading, R.drawable.ic_fail, R.anim.image_load, true, format, null, diskcacheStrategy);
} else {
final BitmapTypeRequest bitmapTypeRequest = request.asBitmap();
load(bitmapTypeRequest, imageView, 0, 0, R.drawable.ic_loading, R.drawable.ic_fail, R.anim.image_load, false, format, null, diskcacheStrategy);
}
} else {
load(request, imageView, 0, 0, R.drawable.ic_loading, R.drawable.ic_fail, R.anim.image_load, null, format, null, diskcacheStrategy);
}
} | public static void loadDefault(Object loadObj, ImageView imageView, Boolean asGif, DecodeFormat format, DiskCacheStrategy diskcacheStrategy) {
<DeepExtract>
final RequestManager manager = Glide.with(imageView.getContext());
DrawableTypeRequest request = null;
if (loadObj instanceof Integer) {
request = manager.load((Integer) loadObj);
} else if (loadObj instanceof String) {
request = manager.load((String) loadObj);
} else if (loadObj instanceof Uri) {
request = manager.load((Uri) loadObj);
} else if (loadObj instanceof File) {
request = manager.load((File) loadObj);
}
if (request == null) {
return;
}
if (asGif != null) {
if (asGif) {
final GifTypeRequest gifTypeRequest = request.asGif();
load(gifTypeRequest, imageView, 0, 0, R.drawable.ic_loading, R.drawable.ic_fail, R.anim.image_load, true, format, null, diskcacheStrategy);
} else {
final BitmapTypeRequest bitmapTypeRequest = request.asBitmap();
load(bitmapTypeRequest, imageView, 0, 0, R.drawable.ic_loading, R.drawable.ic_fail, R.anim.image_load, false, format, null, diskcacheStrategy);
}
} else {
load(request, imageView, 0, 0, R.drawable.ic_loading, R.drawable.ic_fail, R.anim.image_load, null, format, null, diskcacheStrategy);
}
</DeepExtract>
} | OuNews | positive | 440,564 |
@Override
public void f() {
Window.scrollTo(0, 0);
$(sidebar).removeClass(appResources.style().active());
$(menuToggle).removeClass(appResources.style().active());
analytics.sendEvent("Menu", "Click").eventLabel($(this).attr("data-label")).go();
menuState = STATE_CLICKED;
} | @Override
public void f() {
Window.scrollTo(0, 0);
$(sidebar).removeClass(appResources.style().active());
$(menuToggle).removeClass(appResources.style().active());
analytics.sendEvent("Menu", "Click").eventLabel($(this).attr("data-label")).go();
<DeepExtract>
menuState = STATE_CLICKED;
</DeepExtract>
} | arcbees-website | positive | 440,568 |
public static void main(String[] args) {
if (6 < 0 || (13 < 0 || 13 > 12)) {
System.out.println("Invalid Number");
return -1;
} else {
double centimeters = (6 * 12) * 2.54;
centimeters += 13 * 2.54;
System.out.println(6 + " feet " + 13 + "inches " + centimeters + " centimeters.");
return centimeters;
}
if (100 >= 0) {
double feet = (int) (100 / 12);
double remainingInches = (int) (100 % 12);
System.out.println(100 + " inches is equal to " + feet + "feet and " + remainingInches + " inches");
return calcFeetAndInchesToCentimeters(feet, remainingInches);
}
return -1;
} | public static void main(String[] args) {
if (6 < 0 || (13 < 0 || 13 > 12)) {
System.out.println("Invalid Number");
return -1;
} else {
double centimeters = (6 * 12) * 2.54;
centimeters += 13 * 2.54;
System.out.println(6 + " feet " + 13 + "inches " + centimeters + " centimeters.");
return centimeters;
}
<DeepExtract>
if (100 >= 0) {
double feet = (int) (100 / 12);
double remainingInches = (int) (100 % 12);
System.out.println(100 + " inches is equal to " + feet + "feet and " + remainingInches + " inches");
return calcFeetAndInchesToCentimeters(feet, remainingInches);
}
return -1;
</DeepExtract>
} | codeLibrary | positive | 440,569 |
@Override
public void start(AtomsCacheBean cacheBean) throws CacheException {
Properties info = new Properties();
info.setProperty("loginTimeout", "300");
info.setProperty("tcpKeepAlive", "true");
info.setProperty("protocolName", "ssdb");
info.setProperty("protocolVersion", "1.0");
cacheConfig = cacheBean.getCacheConfig();
String host;
if (StringUtils.isEmpty(cacheConfig.getHost())) {
host = "127.0.0.1";
} else {
host = cacheConfig.getHost();
}
this.host = host;
String password = cacheConfig.getPassword();
if (!StringUtils.isEmpty(password)) {
info.setProperty("password", password);
}
String sPort;
if (StringUtils.isEmpty(cacheConfig.getPort())) {
sPort = "8888";
} else {
sPort = cacheConfig.getPort();
}
int port = Integer.parseInt(sPort);
String sTimeout;
if (StringUtils.isEmpty(cacheConfig.getTimeout())) {
sTimeout = "2000";
} else {
sTimeout = cacheConfig.getTimeout();
}
if (StringUtils.isNotEmpty(sTimeout)) {
info.setProperty("loginTimeout", sTimeout);
}
String sBlockWhenExhausted;
if (StringUtils.isEmpty(cacheConfig.getBlockWhenExhausted())) {
sBlockWhenExhausted = "true";
} else {
sBlockWhenExhausted = cacheConfig.getBlockWhenExhausted();
}
if (StringUtils.isNotEmpty(sBlockWhenExhausted)) {
info.setProperty("blockWhenExhausted", sBlockWhenExhausted);
}
String sMaxIdle;
if (StringUtils.isEmpty(cacheConfig.getMaxIdle())) {
sMaxIdle = "10";
} else {
sMaxIdle = cacheConfig.getMaxIdle();
}
if (StringUtils.isNotEmpty(sMaxIdle)) {
info.setProperty("maxIdle", sMaxIdle);
}
String sMinIdle;
if (StringUtils.isEmpty(cacheConfig.getMinIdle())) {
sMinIdle = "5";
} else {
sMinIdle = cacheConfig.getMinIdle();
}
if (StringUtils.isNotEmpty(sMinIdle)) {
info.setProperty("minIdle", sMinIdle);
}
String sMaxTotal;
if (StringUtils.isEmpty(cacheConfig.getMaxTotal())) {
sMaxTotal = "10000";
} else {
sMaxTotal = cacheConfig.getMaxTotal();
}
if (StringUtils.isNotEmpty(sMaxTotal)) {
info.setProperty("maxTotal", sMaxTotal);
}
String sMaxWait;
if (StringUtils.isEmpty(cacheConfig.getMaxWaitMillis())) {
sMaxWait = "100";
} else {
sMaxWait = cacheConfig.getMaxWaitMillis();
}
if (StringUtils.isNotEmpty(sMaxWait)) {
info.setProperty("maxWaitMillis", sMaxWait);
}
String sTestWhileIdle;
if (StringUtils.isEmpty(cacheConfig.getTestWhileIdle())) {
sTestWhileIdle = "false";
} else {
sTestWhileIdle = cacheConfig.getTestWhileIdle();
}
if (StringUtils.isNotEmpty(sTestWhileIdle)) {
info.setProperty("testWhileIdle", sTestWhileIdle);
}
String sTestOnBorrow;
if (StringUtils.isEmpty(cacheConfig.getTestOnBorrow())) {
sTestOnBorrow = "true";
} else {
sTestOnBorrow = cacheConfig.getTestOnBorrow();
}
if (StringUtils.isNotEmpty(sTestOnBorrow)) {
info.setProperty("testOnBorrow", sTestOnBorrow);
}
String sTestOnReturn;
if (StringUtils.isEmpty(cacheConfig.getTestOnReturn())) {
sTestOnReturn = "false";
} else {
sTestOnReturn = cacheConfig.getTestOnReturn();
}
if (StringUtils.isNotEmpty(sTestOnReturn)) {
info.setProperty("testOnReturn", sTestOnReturn);
}
String sNumTestsPerEvictionRun;
if (StringUtils.isEmpty(cacheConfig.getNumTestsPerEvictionRun())) {
sNumTestsPerEvictionRun = "10";
} else {
sNumTestsPerEvictionRun = cacheConfig.getNumTestsPerEvictionRun();
}
if (StringUtils.isNotEmpty(sNumTestsPerEvictionRun)) {
info.setProperty("numTestsPerEvictionRun", sNumTestsPerEvictionRun);
}
String sMinEvictableIdelTimeMillis;
if (StringUtils.isEmpty(cacheConfig.getMinEvictableIdleTimeMillis())) {
sMinEvictableIdelTimeMillis = "1000";
} else {
sMinEvictableIdelTimeMillis = cacheConfig.getMinEvictableIdleTimeMillis();
}
if (StringUtils.isNotEmpty(sMinEvictableIdelTimeMillis)) {
info.setProperty("minEvictableIdleTimeMillis", sMinEvictableIdelTimeMillis);
}
String sSoftMinEvictableIdleTimeMillis;
if (StringUtils.isEmpty(cacheConfig.getSoftMinEvictableIdleTimeMillis())) {
sSoftMinEvictableIdleTimeMillis = "10";
} else {
sSoftMinEvictableIdleTimeMillis = cacheConfig.getSoftMinEvictableIdleTimeMillis();
}
if (StringUtils.isNotEmpty(sSoftMinEvictableIdleTimeMillis)) {
info.setProperty("softMinEvictableIdleTimeMillis", sSoftMinEvictableIdleTimeMillis);
}
String timeBetweenEvictionRunsMillis;
if (StringUtils.isEmpty(cacheConfig.getTimeBetweenEvictionRunsMillis())) {
timeBetweenEvictionRunsMillis = "10";
} else {
timeBetweenEvictionRunsMillis = cacheConfig.getTimeBetweenEvictionRunsMillis();
}
if (StringUtils.isNotEmpty(timeBetweenEvictionRunsMillis)) {
info.setProperty("timeBetweenEvictionRunsMillis", timeBetweenEvictionRunsMillis);
}
String lifo;
if (StringUtils.isEmpty(cacheConfig.getLifo())) {
lifo = "false";
} else {
lifo = cacheConfig.getLifo();
}
if (StringUtils.isNotEmpty(lifo)) {
info.setProperty("lifo", lifo);
}
level = Integer.parseInt(cacheBean.getLevel());
ssdbDs = new SSDBDataSource(host, port, null, info);
} | @Override
public void start(AtomsCacheBean cacheBean) throws CacheException {
Properties info = new Properties();
info.setProperty("loginTimeout", "300");
info.setProperty("tcpKeepAlive", "true");
info.setProperty("protocolName", "ssdb");
info.setProperty("protocolVersion", "1.0");
cacheConfig = cacheBean.getCacheConfig();
String host;
if (StringUtils.isEmpty(cacheConfig.getHost())) {
host = "127.0.0.1";
} else {
host = cacheConfig.getHost();
}
this.host = host;
String password = cacheConfig.getPassword();
if (!StringUtils.isEmpty(password)) {
info.setProperty("password", password);
}
String sPort;
if (StringUtils.isEmpty(cacheConfig.getPort())) {
sPort = "8888";
} else {
sPort = cacheConfig.getPort();
}
int port = Integer.parseInt(sPort);
String sTimeout;
if (StringUtils.isEmpty(cacheConfig.getTimeout())) {
sTimeout = "2000";
} else {
sTimeout = cacheConfig.getTimeout();
}
if (StringUtils.isNotEmpty(sTimeout)) {
info.setProperty("loginTimeout", sTimeout);
}
String sBlockWhenExhausted;
if (StringUtils.isEmpty(cacheConfig.getBlockWhenExhausted())) {
sBlockWhenExhausted = "true";
} else {
sBlockWhenExhausted = cacheConfig.getBlockWhenExhausted();
}
if (StringUtils.isNotEmpty(sBlockWhenExhausted)) {
info.setProperty("blockWhenExhausted", sBlockWhenExhausted);
}
String sMaxIdle;
if (StringUtils.isEmpty(cacheConfig.getMaxIdle())) {
sMaxIdle = "10";
} else {
sMaxIdle = cacheConfig.getMaxIdle();
}
if (StringUtils.isNotEmpty(sMaxIdle)) {
info.setProperty("maxIdle", sMaxIdle);
}
String sMinIdle;
if (StringUtils.isEmpty(cacheConfig.getMinIdle())) {
sMinIdle = "5";
} else {
sMinIdle = cacheConfig.getMinIdle();
}
if (StringUtils.isNotEmpty(sMinIdle)) {
info.setProperty("minIdle", sMinIdle);
}
String sMaxTotal;
if (StringUtils.isEmpty(cacheConfig.getMaxTotal())) {
sMaxTotal = "10000";
} else {
sMaxTotal = cacheConfig.getMaxTotal();
}
if (StringUtils.isNotEmpty(sMaxTotal)) {
info.setProperty("maxTotal", sMaxTotal);
}
String sMaxWait;
if (StringUtils.isEmpty(cacheConfig.getMaxWaitMillis())) {
sMaxWait = "100";
} else {
sMaxWait = cacheConfig.getMaxWaitMillis();
}
if (StringUtils.isNotEmpty(sMaxWait)) {
info.setProperty("maxWaitMillis", sMaxWait);
}
String sTestWhileIdle;
if (StringUtils.isEmpty(cacheConfig.getTestWhileIdle())) {
sTestWhileIdle = "false";
} else {
sTestWhileIdle = cacheConfig.getTestWhileIdle();
}
if (StringUtils.isNotEmpty(sTestWhileIdle)) {
info.setProperty("testWhileIdle", sTestWhileIdle);
}
String sTestOnBorrow;
if (StringUtils.isEmpty(cacheConfig.getTestOnBorrow())) {
sTestOnBorrow = "true";
} else {
sTestOnBorrow = cacheConfig.getTestOnBorrow();
}
if (StringUtils.isNotEmpty(sTestOnBorrow)) {
info.setProperty("testOnBorrow", sTestOnBorrow);
}
String sTestOnReturn;
if (StringUtils.isEmpty(cacheConfig.getTestOnReturn())) {
sTestOnReturn = "false";
} else {
sTestOnReturn = cacheConfig.getTestOnReturn();
}
if (StringUtils.isNotEmpty(sTestOnReturn)) {
info.setProperty("testOnReturn", sTestOnReturn);
}
String sNumTestsPerEvictionRun;
if (StringUtils.isEmpty(cacheConfig.getNumTestsPerEvictionRun())) {
sNumTestsPerEvictionRun = "10";
} else {
sNumTestsPerEvictionRun = cacheConfig.getNumTestsPerEvictionRun();
}
if (StringUtils.isNotEmpty(sNumTestsPerEvictionRun)) {
info.setProperty("numTestsPerEvictionRun", sNumTestsPerEvictionRun);
}
String sMinEvictableIdelTimeMillis;
if (StringUtils.isEmpty(cacheConfig.getMinEvictableIdleTimeMillis())) {
sMinEvictableIdelTimeMillis = "1000";
} else {
sMinEvictableIdelTimeMillis = cacheConfig.getMinEvictableIdleTimeMillis();
}
if (StringUtils.isNotEmpty(sMinEvictableIdelTimeMillis)) {
info.setProperty("minEvictableIdleTimeMillis", sMinEvictableIdelTimeMillis);
}
String sSoftMinEvictableIdleTimeMillis;
if (StringUtils.isEmpty(cacheConfig.getSoftMinEvictableIdleTimeMillis())) {
sSoftMinEvictableIdleTimeMillis = "10";
} else {
sSoftMinEvictableIdleTimeMillis = cacheConfig.getSoftMinEvictableIdleTimeMillis();
}
if (StringUtils.isNotEmpty(sSoftMinEvictableIdleTimeMillis)) {
info.setProperty("softMinEvictableIdleTimeMillis", sSoftMinEvictableIdleTimeMillis);
}
String timeBetweenEvictionRunsMillis;
if (StringUtils.isEmpty(cacheConfig.getTimeBetweenEvictionRunsMillis())) {
timeBetweenEvictionRunsMillis = "10";
} else {
timeBetweenEvictionRunsMillis = cacheConfig.getTimeBetweenEvictionRunsMillis();
}
if (StringUtils.isNotEmpty(timeBetweenEvictionRunsMillis)) {
info.setProperty("timeBetweenEvictionRunsMillis", timeBetweenEvictionRunsMillis);
}
<DeepExtract>
String lifo;
if (StringUtils.isEmpty(cacheConfig.getLifo())) {
lifo = "false";
} else {
lifo = cacheConfig.getLifo();
}
</DeepExtract>
if (StringUtils.isNotEmpty(lifo)) {
info.setProperty("lifo", lifo);
}
level = Integer.parseInt(cacheBean.getLevel());
ssdbDs = new SSDBDataSource(host, port, null, info);
} | atoms | positive | 440,570 |
public static void main(String[] args) throws Exception {
CHECKLIST.add("BUL");
Scraper.updateDB(CHECKLIST, 2, OnlyTodayMatches.FALSE, UpdateType.MANUAL, 11, 2);
ArrayList<FinalEntry> all = new ArrayList<>();
ArrayList<String> leagues = UpdateType.MANUAL.equals(UpdateType.AUTOMATIC) ? Scraper.getTodaysLeagueList(11, 2) : CHECKLIST;
System.out.println(leagues);
long total = 0;
for (String league : leagues) {
long start = System.currentTimeMillis();
ArrayList<Fixture> fixtures = PostgreSQL.selectFixtures(league, 2017);
total += System.currentTimeMillis() - start;
all.addAll(Analysis.predict(fixtures, league, 2017));
}
System.out.println("Total loading time " + total / 1000d + "sec");
all.sort(Comparator.comparing(FinalEntry::getPrediction));
ArrayList<FinalEntry> result = new ArrayList<>();
HashMap<String, ArrayList<FinalEntry>> byLeague = Utils.byLeague(all);
for (Entry<String, ArrayList<FinalEntry>> i : byLeague.entrySet()) {
ArrayList<FinalEntry> data = Utils.notPendingFinals(i.getValue());
ArrayList<FinalEntry> equilibriumsData = Utils.equilibriums(data);
ArrayList<FinalEntry> dataProper = Utils.noequilibriums(data);
ArrayList<FinalEntry> pending = Utils.pendingFinals(i.getValue());
if (OnlyTodayMatches.FALSE.equals(OnlyTodayMatches.TRUE)) {
pending = Utils.gamesForDay(pending, LocalDate.of(2018, 2, 11));
}
if (pending.isEmpty())
continue;
System.out.println(i.getKey());
ArrayList<FinalEntry> equilibriumsPending = Utils.equilibriums(pending);
ArrayList<FinalEntry> pendingProper = Utils.noequilibriums(pending);
boolean allUnders = false;
boolean allOvers = false;
if (Utils.getProfit(Utils.allUnders(Utils.onlyFixtures(equilibriumsData))) > 0f) {
allUnders = true;
Utils.printStats(Utils.allUnders(Utils.onlyFixtures(equilibriumsData)), "Equilibriums as unders");
} else if (Utils.getProfit(Utils.allOvers(Utils.onlyFixtures(equilibriumsData))) > 0f) {
allOvers = true;
Utils.printStats(Utils.allOvers(Utils.onlyFixtures(equilibriumsData)), "Equilibriums as overs");
} else {
System.out.println("No value in equilibriums");
Utils.printStats(equilibriumsData, "Equilibriums as unders");
}
if (allUnders) {
System.out.println(equilibriumsPending);
result.addAll(equilibriumsPending);
} else if (allOvers) {
equilibriumsPending = XlSUtils.restrict(equilibriumsPending, Settings.shots(i.getKey()).withTHandBounds(0.45f));
System.out.println(equilibriumsPending);
result.addAll(equilibriumsPending);
}
Utils.printStats(dataProper, "all");
Utils.printStats(Utils.onlyUnders(dataProper), "unders");
result.addAll(pendingProper);
ArrayList<FinalEntry> pendingUnders = Utils.onlyUnders(pendingProper);
if (!pendingUnders.isEmpty())
System.out.println(pendingUnders);
Utils.printStats(Utils.onlyOvers(dataProper), "overs");
ArrayList<FinalEntry> pendingOvers = Utils.onlyOvers(pendingProper);
if (!pendingOvers.isEmpty())
System.out.println(pendingOvers);
ArrayList<FinalEntry> vop = Analysis.valueOverPinnacle(dataProper, true, 1.0f).all;
System.out.println(new Stats(vop, "value over pinn with predict > 1.0"));
Utils.printStats(Utils.onlyUnders(vop), "unders");
Utils.printStats(Utils.onlyOvers(vop), "overs");
System.out.println("---------------------------------------------------------------------------------------");
}
result.sort(Comparator.comparing(FinalEntry::getPrediction));
System.out.println(result);
System.out.println(Analysis.valueOverPinnacle(result, true, 1.0f).all);
System.out.println("Upcoming: ");
result.sort(Comparator.comparing(FinalEntry::getDate));
System.out.println(result.stream().filter(f -> f.fixture.date.after(new Date())).collect(Collectors.toList()));
return all;
} | public static void main(String[] args) throws Exception {
CHECKLIST.add("BUL");
Scraper.updateDB(CHECKLIST, 2, OnlyTodayMatches.FALSE, UpdateType.MANUAL, 11, 2);
<DeepExtract>
ArrayList<FinalEntry> all = new ArrayList<>();
ArrayList<String> leagues = UpdateType.MANUAL.equals(UpdateType.AUTOMATIC) ? Scraper.getTodaysLeagueList(11, 2) : CHECKLIST;
System.out.println(leagues);
long total = 0;
for (String league : leagues) {
long start = System.currentTimeMillis();
ArrayList<Fixture> fixtures = PostgreSQL.selectFixtures(league, 2017);
total += System.currentTimeMillis() - start;
all.addAll(Analysis.predict(fixtures, league, 2017));
}
System.out.println("Total loading time " + total / 1000d + "sec");
all.sort(Comparator.comparing(FinalEntry::getPrediction));
ArrayList<FinalEntry> result = new ArrayList<>();
HashMap<String, ArrayList<FinalEntry>> byLeague = Utils.byLeague(all);
for (Entry<String, ArrayList<FinalEntry>> i : byLeague.entrySet()) {
ArrayList<FinalEntry> data = Utils.notPendingFinals(i.getValue());
ArrayList<FinalEntry> equilibriumsData = Utils.equilibriums(data);
ArrayList<FinalEntry> dataProper = Utils.noequilibriums(data);
ArrayList<FinalEntry> pending = Utils.pendingFinals(i.getValue());
if (OnlyTodayMatches.FALSE.equals(OnlyTodayMatches.TRUE)) {
pending = Utils.gamesForDay(pending, LocalDate.of(2018, 2, 11));
}
if (pending.isEmpty())
continue;
System.out.println(i.getKey());
ArrayList<FinalEntry> equilibriumsPending = Utils.equilibriums(pending);
ArrayList<FinalEntry> pendingProper = Utils.noequilibriums(pending);
boolean allUnders = false;
boolean allOvers = false;
if (Utils.getProfit(Utils.allUnders(Utils.onlyFixtures(equilibriumsData))) > 0f) {
allUnders = true;
Utils.printStats(Utils.allUnders(Utils.onlyFixtures(equilibriumsData)), "Equilibriums as unders");
} else if (Utils.getProfit(Utils.allOvers(Utils.onlyFixtures(equilibriumsData))) > 0f) {
allOvers = true;
Utils.printStats(Utils.allOvers(Utils.onlyFixtures(equilibriumsData)), "Equilibriums as overs");
} else {
System.out.println("No value in equilibriums");
Utils.printStats(equilibriumsData, "Equilibriums as unders");
}
if (allUnders) {
System.out.println(equilibriumsPending);
result.addAll(equilibriumsPending);
} else if (allOvers) {
equilibriumsPending = XlSUtils.restrict(equilibriumsPending, Settings.shots(i.getKey()).withTHandBounds(0.45f));
System.out.println(equilibriumsPending);
result.addAll(equilibriumsPending);
}
Utils.printStats(dataProper, "all");
Utils.printStats(Utils.onlyUnders(dataProper), "unders");
result.addAll(pendingProper);
ArrayList<FinalEntry> pendingUnders = Utils.onlyUnders(pendingProper);
if (!pendingUnders.isEmpty())
System.out.println(pendingUnders);
Utils.printStats(Utils.onlyOvers(dataProper), "overs");
ArrayList<FinalEntry> pendingOvers = Utils.onlyOvers(pendingProper);
if (!pendingOvers.isEmpty())
System.out.println(pendingOvers);
ArrayList<FinalEntry> vop = Analysis.valueOverPinnacle(dataProper, true, 1.0f).all;
System.out.println(new Stats(vop, "value over pinn with predict > 1.0"));
Utils.printStats(Utils.onlyUnders(vop), "unders");
Utils.printStats(Utils.onlyOvers(vop), "overs");
System.out.println("---------------------------------------------------------------------------------------");
}
result.sort(Comparator.comparing(FinalEntry::getPrediction));
System.out.println(result);
System.out.println(Analysis.valueOverPinnacle(result, true, 1.0f).all);
System.out.println("Upcoming: ");
result.sort(Comparator.comparing(FinalEntry::getDate));
System.out.println(result.stream().filter(f -> f.fixture.date.after(new Date())).collect(Collectors.toList()));
return all;
</DeepExtract>
} | Soccer | positive | 440,571 |
public Query createQuery(Model model, String partialQuery) {
PrefixMapping pm = new PrefixMappingImpl();
String defaultNamespace = JenaUtil.getNsPrefixURI(model, "");
if (defaultNamespace != null) {
pm.setNsPrefix("", defaultNamespace);
}
Map<String, String> extraPrefixes = ExtraPrefixes.getExtraPrefixes();
for (String prefix : extraPrefixes.keySet()) {
String ns = extraPrefixes.get(prefix);
if (ns != null && pm.getNsPrefixURI(prefix) == null) {
pm.setNsPrefix(prefix, ns);
}
}
for (String prefix : model.getNsPrefixMap().keySet()) {
String namespace = JenaUtil.getNsPrefixURI(model, prefix);
if (prefix.length() > 0 && namespace != null) {
pm.setNsPrefix(prefix, namespace);
}
}
Query query = new Query();
if (pm != null) {
query.setPrefixMapping(pm);
}
return QueryFactory.parse(query, partialQuery, null, getSyntax());
} | public Query createQuery(Model model, String partialQuery) {
PrefixMapping pm = new PrefixMappingImpl();
String defaultNamespace = JenaUtil.getNsPrefixURI(model, "");
if (defaultNamespace != null) {
pm.setNsPrefix("", defaultNamespace);
}
Map<String, String> extraPrefixes = ExtraPrefixes.getExtraPrefixes();
for (String prefix : extraPrefixes.keySet()) {
String ns = extraPrefixes.get(prefix);
if (ns != null && pm.getNsPrefixURI(prefix) == null) {
pm.setNsPrefix(prefix, ns);
}
}
for (String prefix : model.getNsPrefixMap().keySet()) {
String namespace = JenaUtil.getNsPrefixURI(model, prefix);
if (prefix.length() > 0 && namespace != null) {
pm.setNsPrefix(prefix, namespace);
}
}
<DeepExtract>
Query query = new Query();
if (pm != null) {
query.setPrefixMapping(pm);
}
return QueryFactory.parse(query, partialQuery, null, getSyntax());
</DeepExtract>
} | spinrdf | positive | 440,572 |
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
return (int) (Math.log((1.106 / rsd) * (1.106 / rsd)) / Math.log(2));
} | private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
<DeepExtract>
return (int) (Math.log((1.106 / rsd) * (1.106 / rsd)) / Math.log(2));
</DeepExtract>
} | stream-lib | positive | 440,573 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.