blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 132 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 28 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 352 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7ce07f167e511dd2b247516ca24d67a416d089fe | 44e7adc9a1c5c0a1116097ac99c2a51692d4c986 | /aws-java-sdk-redshift/src/main/java/com/amazonaws/services/redshift/model/transform/ReservedNodeAlreadyMigratedExceptionUnmarshaller.java | 66748d7d2987cf31b63740b2a5cc122971a0684b | [
"Apache-2.0"
] | permissive | QiAnXinCodeSafe/aws-sdk-java | f93bc97c289984e41527ae5bba97bebd6554ddbe | 8251e0a3d910da4f63f1b102b171a3abf212099e | refs/heads/master | 2023-01-28T14:28:05.239019 | 2020-12-03T22:09:01 | 2020-12-03T22:09:01 | 318,460,751 | 1 | 0 | Apache-2.0 | 2020-12-04T10:06:51 | 2020-12-04T09:05:03 | null | UTF-8 | Java | false | false | 1,659 | java | /*
* Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.redshift.model.transform;
import org.w3c.dom.Node;
import javax.annotation.Generated;
import com.amazonaws.AmazonServiceException;
import com.amazonaws.transform.StandardErrorUnmarshaller;
import com.amazonaws.services.redshift.model.ReservedNodeAlreadyMigratedException;
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class ReservedNodeAlreadyMigratedExceptionUnmarshaller extends StandardErrorUnmarshaller {
public ReservedNodeAlreadyMigratedExceptionUnmarshaller() {
super(ReservedNodeAlreadyMigratedException.class);
}
@Override
public AmazonServiceException unmarshall(Node node) throws Exception {
// Bail out if this isn't the right error code that this
// marshaller understands
String errorCode = parseErrorCode(node);
if (errorCode == null || !errorCode.equals("ReservedNodeAlreadyMigrated"))
return null;
ReservedNodeAlreadyMigratedException e = (ReservedNodeAlreadyMigratedException) super.unmarshall(node);
return e;
}
}
| [
""
] | |
2c49bc4488eee7841e0b036eb0f1ba53f4713956 | ae729bbf1ab55b177cf3aec4804b40c949851bb5 | /ejemplos/clase_4/PersonaTica.java | 392895d8eab8158966cc3c1034af23f51280e22c | [] | no_license | keua/WorkshopJavaBDG | 38c98f93f193a21582c5301273fdc116ff20bcb4 | b4f032d4d8de99c419ee50f7d3e50489b24fbefb | refs/heads/master | 2021-04-29T08:02:09.651190 | 2017-01-11T02:42:09 | 2017-01-11T02:42:09 | 77,970,727 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 308 | java | public class PersonaTica extends Persona {
public String getNacionalidad(){
return "Tica";
}
public String saludo(){
return "Que onda mae";
}
public String despedida(){
return "Orale mae";
}
public int getAntecedentesPenales(){
return 0;
}
} | [
"blopez@bdgsa.net"
] | blopez@bdgsa.net |
98d8a766b8c22c5cd597be37af9b63551d7d094e | c18071eb80e8c11af4fe514aeefaba526877ab9a | /new_job/app/src/androidTest/java/com/example/icecream/new_job/ExampleInstrumentedTest.java | 0e5bb6684ca1a345037b47bd12ad8891efa54dc5 | [] | no_license | hoden1023/google_place | cbf654c03ff3f10e98c325cc7d6a5d0228e1844e | 54d17a07b7f7fdefdd19aa50a30af9fe38fb0b41 | refs/heads/master | 2021-05-01T05:52:38.883466 | 2018-02-11T14:32:43 | 2018-02-11T14:32:43 | 121,131,583 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 757 | java | package com.example.icecream.new_job;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.icecream.new_job", appContext.getPackageName());
}
}
| [
"tuananhnguyen.bka@gmail.com"
] | tuananhnguyen.bka@gmail.com |
88163a66ba5370c9dce16d9dc6bd04166c92cd6b | bd015d05930b962390b10fdf2f36272139c623f3 | /FibonacciRecursive.java | 68fa3f0c6659d0e04ad4f17d585fa208122b8aa8 | [] | no_license | USF-CS245-09-2018/practice-assignment-01-mattjchin | e0399dd3704893b0ba1c3ffeaa4946c8933a2a06 | 30389f4a301854d4b1cdf1081f151e9cbb6a8aad | refs/heads/master | 2020-03-27T05:42:15.611102 | 2018-08-30T04:13:31 | 2018-08-30T04:13:31 | 146,041,145 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 663 | java | public class FibonacciRecursive implements Fibonacci{
/**
* Function represents the Fibonacci sequence of the number used with recursion
* Function fibonacci will be called multiple times
*
* If n is 0 or 1 the sum of n using the fibonacci sequence is respectively 0 or 1
*
* @param n the integer used to calculate the fibonacci sum of the number
* @return the sum of the number used for the fibonacci sequence via recursion
*/
public int fibonacci(int n){
if(n==0)
return n;
else if(n==1)
return n;
else
return fibonacci(n-1) + fibonacci(n-2);
}
}
| [
"mattjchin@Matthews-MacBook-Pro.local"
] | mattjchin@Matthews-MacBook-Pro.local |
2721e324c3bcc3e877b9d4205a25137956157de8 | b49caf02ed393bb34074296c211e763cdcab2ef4 | /LoanRequestSpring/src/main/java/activity/spring/tender/serviceTasks/UpisPonudjacaUListu.java | 149309ac215e5d3bdd0d6890ea8ef367d2f80118 | [] | no_license | salac91/Upp2016 | 50c67cbde44891d06036ee1b49abffc3f0ee9d53 | 211c58350c2dc266602eab20ac36f7fff8b38314 | refs/heads/master | 2021-01-10T03:58:44.841796 | 2016-03-17T15:13:15 | 2016-03-17T15:13:15 | 52,792,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,335 | java | package activity.spring.tender.serviceTasks;
import java.util.ArrayList;
import java.util.List;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;
import activiti.spring.tender.entity.Ponudjac;
public class UpisPonudjacaUListu implements JavaDelegate {
@Override
public void execute(DelegateExecution execute) throws Exception {
//boolean var1 = (Boolean) execute.getVariable("dokumentacija");
String var2 = "ne";
Boolean var3=false;
boolean upisi=false;
try{
var2 = (String)execute.getVariable("potvrdaKomisije");
}catch(Exception e){
}
try{
var3 = (Boolean)execute.getVariable("ubazi");
}catch(Exception e){
}
if(var2==null) var2="ne";
if(var3==null) var3=false;
if(var2.equals("da") || var3) upisi=true;
if(upisi){
List<Ponudjac> ponudjaci=(List<Ponudjac>) execute.getVariable("ponudjaci");
Ponudjac ponudjac = new Ponudjac();
ponudjac.setNaziv((String)execute.getVariable("nazivPonudjaca"));
ponudjac.setEmail((String)execute.getVariable("emailPonudjaca"));
ponudjac.setPonuda((Long)execute.getVariable("ponuda"));
ponudjac.setDokumentacija(true);
ponudjaci.add(ponudjac);
execute.setVariable("ponudjaci", ponudjaci);
}
}
}
| [
"jovan.popov.88@gmail.com"
] | jovan.popov.88@gmail.com |
94d3e4a42e397de59001a6fb3e598a9219344eee | fa7f4c8c8c376b56c12e9f6256304dff71556928 | /src/map/Countries.java | 147ce08d7b4080eb0abed816a60ef5ae1dc7c78e | [] | no_license | manuelcarriernunes/risk | 16e28f5a4c4a14a6baf249d3e0269ecae21bf682 | 0a11f72a94c2279ef8a26bd8cc6750bb0f1a7474 | refs/heads/master | 2021-07-08T08:05:06.505146 | 2017-09-29T02:07:28 | 2017-09-29T02:07:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,153 | java | /*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package map;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
/**
* Countries stores a list of countries that make up the map.
*/
public class Countries implements Serializable
{
/**
* Stores references to the different countries.
*/
private volatile ArrayList<Country> countries;
/**
* Stores references to the country.
*/
private volatile Country country;
/**
* Allows a user to change the list of countries.
* @param countries An ArrayList of countries.
*/
public Countries()
{
this.countries = new ArrayList<Country>();
}
/**
* Allows a user to change the list of countries.
* @param countries An ArrayList of countries.
*/
public synchronized void setCountries(ArrayList<Country> countries)
{
this.countries = countries;
}
/**
* Returns a list of the countries that make up the map.
* @return Returns a reference to the list of countries.
*/
public synchronized ArrayList<Country> getCountries()
{
return countries;
}
/**
* Given the name of a country, this method returns a reference to that country.
* @param name The name of the country.
* @return Returns a reference to the country.
*/
public synchronized Country getCountry(String name)
{
for(Country c: getCountries())
{
if(c.getName().equalsIgnoreCase(name))
{
country = c;
}
}
return country;
}
/**
* Adds country to the list of countries.
* @param country The country to be added.
*/
public synchronized void addCountry(Country country)
{
this.countries.add(country);
}
/**
* Removes country from the list of countries.
* @param country The country to remove from the list of countries.
*/
public synchronized void deleteCountry(Country country)
{
countries.remove(country);
}
}
| [
"brane.dmg@gmail.com"
] | brane.dmg@gmail.com |
1316118a9d95b70629aba2402d2d42f7742e23a4 | e9affefd4e89b3c7e2064fee8833d7838c0e0abc | /aws-java-sdk-medicalimaging/src/main/java/com/amazonaws/services/medicalimaging/model/GetDatastoreRequest.java | 9272ccdbe6caadd1c15312ba27aa314f686dc16f | [
"Apache-2.0"
] | permissive | aws/aws-sdk-java | 2c6199b12b47345b5d3c50e425dabba56e279190 | bab987ab604575f41a76864f755f49386e3264b4 | refs/heads/master | 2023-08-29T10:49:07.379135 | 2023-08-28T21:05:55 | 2023-08-28T21:05:55 | 574,877 | 3,695 | 3,092 | Apache-2.0 | 2023-09-13T23:35:28 | 2010-03-22T23:34:58 | null | UTF-8 | Java | false | false | 3,514 | java | /*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package com.amazonaws.services.medicalimaging.model;
import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.AmazonWebServiceRequest;
/**
*
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/medical-imaging-2023-07-19/GetDatastore" target="_top">AWS API
* Documentation</a>
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class GetDatastoreRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {
/**
* <p>
* The data store identifier.
* </p>
*/
private String datastoreId;
/**
* <p>
* The data store identifier.
* </p>
*
* @param datastoreId
* The data store identifier.
*/
public void setDatastoreId(String datastoreId) {
this.datastoreId = datastoreId;
}
/**
* <p>
* The data store identifier.
* </p>
*
* @return The data store identifier.
*/
public String getDatastoreId() {
return this.datastoreId;
}
/**
* <p>
* The data store identifier.
* </p>
*
* @param datastoreId
* The data store identifier.
* @return Returns a reference to this object so that method calls can be chained together.
*/
public GetDatastoreRequest withDatastoreId(String datastoreId) {
setDatastoreId(datastoreId);
return this;
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*
* @return A string representation of this object.
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("{");
if (getDatastoreId() != null)
sb.append("DatastoreId: ").append(getDatastoreId());
sb.append("}");
return sb.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (obj instanceof GetDatastoreRequest == false)
return false;
GetDatastoreRequest other = (GetDatastoreRequest) obj;
if (other.getDatastoreId() == null ^ this.getDatastoreId() == null)
return false;
if (other.getDatastoreId() != null && other.getDatastoreId().equals(this.getDatastoreId()) == false)
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int hashCode = 1;
hashCode = prime * hashCode + ((getDatastoreId() == null) ? 0 : getDatastoreId().hashCode());
return hashCode;
}
@Override
public GetDatastoreRequest clone() {
return (GetDatastoreRequest) super.clone();
}
}
| [
""
] | |
9dde7c8d71634a7f762f0cb2483b4dc6332ca0db | ce2099ea42beb2c5fe6a5ce56bf2cb4c1714a3f9 | /src/integration-test/java/uk/co/mruoc/wso2/ApiStoreClientIntegrationTest.java | aaa77a7c09ecf61c3c496c699e8a02c259df0c01 | [] | no_license | michaelruocco/wso2-api-manager-client | b9cc868701c1d058033d83b5c6199804a9d1eb90 | 1e36167ec48b6e4f902e49ea413102d89e142d9c | refs/heads/master | 2022-02-28T07:39:04.466427 | 2019-10-09T22:43:55 | 2019-10-09T22:43:55 | 81,636,587 | 5 | 3 | null | null | null | null | UTF-8 | Java | false | false | 8,475 | java | package uk.co.mruoc.wso2;
import org.junit.*;
import org.testcontainers.containers.GenericContainer;
import uk.co.mruoc.wso2.publisher.*;
import uk.co.mruoc.wso2.publisher.addapi.AddApiParams;
import uk.co.mruoc.wso2.store.*;
import uk.co.mruoc.wso2.store.addapplication.AddApplicationParams;
import uk.co.mruoc.wso2.store.addapplication.DefaultAddApplicationParams;
import uk.co.mruoc.wso2.store.addsubscription.DefaultAddSubscriptionParams;
import uk.co.mruoc.wso2.store.generateapplicationkey.ApplicationKey;
import uk.co.mruoc.wso2.store.generateapplicationkey.DefaultGenerateApplicationKeyParams;
import uk.co.mruoc.wso2.store.getsubscription.ApiSubscription;
import uk.co.mruoc.wso2.store.listallapplications.ApiApplication;
import uk.co.mruoc.wso2.store.listallapplications.DefaultApplication;
import uk.co.mruoc.wso2.store.listallapplications.TestApplication;
import uk.co.mruoc.wso2.store.removesubscription.DefaultRemoveSubscriptionParams;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
import static uk.co.mruoc.wso2.publisher.ApiStatus.*;
public class ApiStoreClientIntegrationTest {
private static final String DOCKER_IMAGE = "michaelruocco/wso2am:1.9.1";
private static final int PORT = 9443;
private final StartupCheckLogConsumer logConsumer = new Wso2StartupCheckLogConsumer();
private final Credentials credentials = new TestCredentials();
private final TestUrlBuilder urlBuilder = new TestUrlBuilder();
@Rule
public final GenericContainer container = new GenericContainer(DOCKER_IMAGE)
.withExposedPorts(PORT)
.withLogConsumer(logConsumer);
private ApiPublisherClient publisherClient;
private ApiStoreClient storeClient;
@Before
public void setUp() {
logConsumer.waitForStartupMessageInLog(90000, 1000);
publisherClient = new DefaultApiPublisherClient(urlBuilder.build(container, PORT));
storeClient = new DefaultApiStoreClient(urlBuilder.build(container, PORT));
publisherClient.login(credentials);
storeClient.login(credentials);
}
@After
public void tearDown() {
publisherClient.logout();
storeClient.logout();
}
@Test
public void shouldAddApplication() {
DefaultAddApplicationParams params = new FakeAddApplicationParams();
assertThat(storeClient.addApplication(params)).isTrue();
}
@Test
public void listAllShouldReturnDeployedApplications() {
givenApplicationHasBeenAdded();
List<ApiApplication> applications = storeClient.listAllApplications();
assertThat(applications.size()).isEqualTo(2);
assertThat(applications.get(0)).isEqualToComparingFieldByField(new DefaultApplication());
assertThat(applications.get(1)).isEqualToComparingFieldByField(new TestApplication());
}
@Test
public void shouldRemoveApplication() {
AddApplicationParams params = givenApplicationHasBeenAdded();
assertThat(storeClient.removeApplication(params.getApplicationName())).isTrue();
}
@Test
public void shouldAddSubscription() {
AddApiParams addApiParams = givenApiHasBeenAdded();
givenApiHasBeenPublished(addApiParams);
AddApplicationParams addApplicationParams = givenApplicationHasBeenAdded();
DefaultAddSubscriptionParams addSubscriptionParams = toAddSubscriptionParams(addApiParams, addApplicationParams);
assertThat(storeClient.addSubscription(addSubscriptionParams)).isTrue();
}
@Test
public void shouldRemoveSubscription() {
AddApiParams addApiParams = givenApiHasBeenAdded();
givenApiHasBeenPublished(addApiParams);
AddApplicationParams addApplicationParams = givenApplicationHasBeenAdded();
DefaultRemoveSubscriptionParams removeSubscriptionParams = toRemoveSubscriptionParams(addApiParams, addApplicationParams);
assertThat(storeClient.removeSubscription(removeSubscriptionParams)).isTrue();
}
@Test
public void shouldListSubscriptions() {
AddApiParams addApiParams = givenApiHasBeenAdded();
givenApiHasBeenPublished(addApiParams);
AddApplicationParams addApplicationParams = givenApplicationHasBeenAdded();
DefaultAddSubscriptionParams addSubscriptionParams = toAddSubscriptionParams(addApiParams, addApplicationParams);
storeClient.addSubscription(addSubscriptionParams);
List<ApiSubscription> subscriptions = storeClient.getSubscriptionsByApi(addApiParams);
assertThat(subscriptions.size()).isEqualTo(1);
assertThat(subscriptions.get(0).getApplicationName()).isEqualTo(addApplicationParams.getApplicationName());
}
@Test
public void shouldGenerateApplicationKey() {
AddApiParams addApiParams = givenApiHasBeenAdded();
givenApiHasBeenPublished(addApiParams);
AddApplicationParams addApplicationParams = givenApplicationHasBeenAdded();
DefaultAddSubscriptionParams addSubscriptionParams = toAddSubscriptionParams(addApiParams, addApplicationParams);
givenApplicationHasBeenSubscribedToApi(addSubscriptionParams);
DefaultGenerateApplicationKeyParams generateApplicationKeyParams = toGenerateApplicationKeyParams(addApplicationParams);
ApplicationKey key = storeClient.generateApplicationKey(generateApplicationKeyParams);
assertThat(key.getConsumerKey()).isNotBlank();
assertThat(key.getConsumerSecret()).isNotBlank();
assertThat(key.getAccessToken()).isNotBlank();
assertThat(key.getValidityTime().getMillis()).isPositive();
}
private void givenApplicationHasBeenSubscribedToApi(DefaultAddSubscriptionParams addSubscriptionParams) {
storeClient.addSubscription(addSubscriptionParams);
}
private AddApplicationParams givenApplicationHasBeenAdded() {
AddApplicationParams params = new FakeAddApplicationParams();
storeClient.addApplication(params);
return params;
}
private AddApiParams givenApiHasBeenAdded() {
AddApiParams addApiParams = StubAddApiParamsBuilder.build();
publisherClient.addApi(addApiParams);
return addApiParams;
}
private void givenApiHasBeenPublished(AddApiParams addApiParams) {
DefaultSetStatusParams setStatusParams = toSetStatusParams(addApiParams);
setStatusParams.setStatus(PUBLISHED);
publisherClient.setStatus(setStatusParams);
}
private DefaultSetStatusParams toSetStatusParams(AddApiParams addApiParams) {
DefaultSetStatusParams setStatusParams = new DefaultSetStatusParams();
setStatusParams.setApiName(addApiParams.getApiName());
setStatusParams.setApiVersion(addApiParams.getApiVersion());
setStatusParams.setProvider(addApiParams.getProvider());
return setStatusParams;
}
private DefaultAddSubscriptionParams toAddSubscriptionParams(AddApiParams addApiParams, AddApplicationParams addApplicationParams) {
DefaultAddSubscriptionParams addSubscriptionParams = new DefaultAddSubscriptionParams();
addSubscriptionParams.setApplicationName(addApplicationParams.getApplicationName());
addSubscriptionParams.setApiName(addApiParams.getApiName());
addSubscriptionParams.setApiVersion(addApiParams.getApiVersion());
addSubscriptionParams.setProvider(addApiParams.getProvider());
return addSubscriptionParams;
}
private DefaultRemoveSubscriptionParams toRemoveSubscriptionParams(AddApiParams addApiParams, AddApplicationParams addApplicationParams) {
DefaultRemoveSubscriptionParams removeSubscriptionParams = new DefaultRemoveSubscriptionParams();
removeSubscriptionParams.setApplicationName(addApplicationParams.getApplicationName());
removeSubscriptionParams.setApiName(addApiParams.getApiName());
removeSubscriptionParams.setApiVersion(addApiParams.getApiVersion());
removeSubscriptionParams.setProvider(addApiParams.getProvider());
return removeSubscriptionParams;
}
private DefaultGenerateApplicationKeyParams toGenerateApplicationKeyParams(AddApplicationParams addApplicationParams) {
DefaultGenerateApplicationKeyParams generateApplicationKeyParams = new DefaultGenerateApplicationKeyParams();
generateApplicationKeyParams.setApplicationName(addApplicationParams.getApplicationName());
return generateApplicationKeyParams;
}
}
| [
"michael.ruocco@hotmail.com"
] | michael.ruocco@hotmail.com |
51d0b3a546855967714f02fd3eb37f80ff91e840 | 6a8192447e50272d6231ae0d228142123bdaf772 | /app/src/test/java/com/geek/a3l4hwork4/ExampleUnitTest.java | a9062db2f117b0944402a1fd1b2c189df1a8fdd8 | [] | no_license | baibigroot/A3L4Hwork4 | fed1b70b7fd2025d978817a30800595a1eb9a99f | e5bab6ebe1323ac5045779c307efd1fa213b2d32 | refs/heads/master | 2023-08-26T10:40:37.683768 | 2021-11-01T15:03:41 | 2021-11-01T15:03:41 | 423,508,376 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 380 | java | package com.geek.a3l4hwork4;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"karlygachbekmurzaeva@gmail.com"
] | karlygachbekmurzaeva@gmail.com |
c4b51db7a2d5f85aba97a73a262919864b365f5a | d4d2092695913ea488daf2dd54fd6edce706b3f7 | /ClientGestureStatic/src/com/example/client/BaseActivity.java | 24e1134e2f70123cc3d8eae4bd00f6fbd11ed129 | [] | no_license | ramshasank/codebak | 2a8e87be5359bd64fb712ff3eba842960bdcb4f0 | f38a4a24c9591f321ba796b74ff676dd82061909 | refs/heads/master | 2016-09-06T09:40:59.810719 | 2015-07-24T23:43:39 | 2015-07-24T23:43:39 | 39,646,621 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,051 | java | package com.example.client;
import android.annotation.SuppressLint;
import android.app.Activity;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.net.Socket;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.List;
import android.content.Context;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
@SuppressLint("NewApi")
public class BaseActivity extends Activity implements SensorEventListener {
TextView textResponse, gestureText;
Button buttonConnect, buttonPress, buttonClear, buttonSubmit,
buttonGesture;
List<Float> xPoints;
List<Float> yPoints;
List<Float> zPoints;
Sensor sensor = null;
SensorManager sensorManager = null;
SensorEventListener sListener;
TestGesture testGesture;
static int checkUpdate = 0;
static String resultGesture = null;
MyClientTask connectServer = null;
MainActivity mainActivity = null;
SelectGesture selectGesture = null;
PlayFragment playFragment = null;
float x1, y1, z1;
int check = 0;
float[] gravity = new float[3];
@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mainActivity = new MainActivity();
playFragment = new PlayFragment();
selectGesture = new SelectGesture();
if (savedInstanceState == null) {
getFragmentManager().beginTransaction()
.add(R.id.linearFrag, mainActivity).commit();
}
testGesture = new TestGesture();
sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
sensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
sListener = this;
sensorManager.unregisterListener(sListener, sensor);
xPoints = new ArrayList<Float>();
yPoints = new ArrayList<Float>();
zPoints = new ArrayList<Float>();
}
@SuppressLint("NewApi")
public void playGameSubmit(View v) {
// TODO Auto-generated method stub
getFragmentManager().beginTransaction()
.replace(R.id.linearFrag, playFragment).commit();
}
public void goToGestures(View v) {
// TODO Auto-generated method stub
getFragmentManager().beginTransaction()
.replace(R.id.linearFrag, selectGesture).commit();
}
public void clearClick(View v) {
// TODO Auto-generated method stub
if (connectServer != null) {
connectServer = null;
textResponse.setText("Connection closed");
}
}
public void connectToServer(View arg0) {
if (mainActivity.editTextAddress != null) {
Log.d("Server IP", mainActivity.editTextAddress.getText()
.toString());
connectServer = new MyClientTask(mainActivity.editTextAddress
.getText().toString(), 8080);
Log.d("Server IP", mainActivity.editTextAddress.getText()
.toString());
connectServer.execute();
} else {
Log.d("Server IP", "NULL");
}
}
public class MyClientTask extends AsyncTask<Void, Void, Void> {
String dstAddress;
int dstPort;
String response = "";
MainActivity mainActivity = new MainActivity();
MyClientTask(String addr, int port) {
dstAddress = addr;
dstPort = port;
}
@Override
protected Void doInBackground(Void... arg0) {
OutputStream outputStream;
Socket socket = null;
try {
socket = new Socket(dstAddress, dstPort);
Log.d("MyClient Task", "Destination Address : " + dstAddress);
Log.d("MyClient Task", "Destination Port : " + dstPort + "");
outputStream = socket.getOutputStream();
PrintStream printStream = new PrintStream(outputStream);
while (true) {
if (BaseActivity.checkUpdate == 1) {
Log.d("Gesture Sent", BaseActivity.resultGesture);
System.out.println("Gesture Sent : "
+ BaseActivity.resultGesture);
printStream.print(BaseActivity.resultGesture);
printStream.flush();
BaseActivity.checkUpdate = 0;
BaseActivity.resultGesture = null;
}
}
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
response = "UnknownHostException: " + e.toString();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
response = "IOException: " + e.toString();
} finally {
if (socket != null) {
try {
socket.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
return null;
}
@Override
protected void onPostExecute(Void result) {
// textResponse.setText(response);
super.onPostExecute(result);
}
}
@Override
public void onSensorChanged(SensorEvent event) {
// TODO Auto-generated method stub
if (event.sensor == sensor) {
final float alpha = (float) 0.8;
gravity[0] = alpha * gravity[0] + (1 - alpha) * event.values[0];
gravity[1] = alpha * gravity[1] + (1 - alpha) * event.values[1];
gravity[2] = alpha * gravity[2] + (1 - alpha) * event.values[2];
// Log.d("Event sensor Name", event.sensor.toString());
// Log.d("Accelerometer sensor Name", sensor.toString());
/*
* check++; Log.d("Check Value", check + ""); if (check >= 5 &&
* dataPoints.size() <= 20) { if ((xPoint - x1 >= 0.1 || yPoint - y1
* >= 0.1 || zPoint - z1 >= 0.1) || (xPoint - x1 <= -0.1 || yPoint -
* y1 <= -0.1 || zPoint - z1 <= -0.1)) { dataPoints.add("[ " +
* xPoint + " " + yPoint + " " + zPoint + " ] ;"); } }
*/
xPoints.add(event.values[0] - gravity[0]);
yPoints.add(event.values[1] - gravity[1]);
zPoints.add(event.values[2] - gravity[2]);
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
// TODO Auto-generated method stub
}
public void checkGesture() throws Exception {
gestureText = (TextView) findViewById(R.id.gestureText);
ArrayList<String> dataPoints = new ArrayList<String>();
int i = 5;
if (xPoints.size() >= 5 && yPoints.size() >= 5
&& zPoints.size() >= 5) {
float xAvg, yAvg, zAvg;
xAvg = getAvg(xPoints);
yAvg = getAvg(yPoints);
zAvg = getAvg(zPoints);
if (getAbs(xAvg) > getAbs(yAvg) && getAbs(xAvg) > getAbs(zAvg)) {
if (xAvg < 0) {
resultGesture = "right";
} else {
resultGesture = "left";
}
} else if (getAbs(yAvg) > getAbs(xAvg)
&& getAbs(yAvg) > getAbs(zAvg)) {
if (zAvg < 0) {
resultGesture = "up";
} else {
resultGesture = "down";
}
} else if (getAbs(zAvg) > getAbs(xAvg)
&& getAbs(zAvg) > getAbs(yAvg)) {
if (zAvg < 0) {
resultGesture = "up";
} else {
resultGesture = "down";
}
} else {
resultGesture = "others";
}
checkUpdate = 1;
Log.d("Result Gesture", resultGesture);
gestureText.setText(resultGesture);
xPoints = new ArrayList<Float>();
yPoints = new ArrayList<Float>();
zPoints = new ArrayList<Float>();
} else {
xPoints = new ArrayList<Float>();
yPoints = new ArrayList<Float>();
zPoints = new ArrayList<Float>();
gestureText.setText("Gesture not recognized(Hold for more time to collect more data)");
}
}
public float getAvg(List<Float> temp) {
int i = 0;
float avg = 0;
for (i = 0; i < temp.size(); i++) {
avg += temp.get(i);
}
avg = avg / (temp.size() - 1);
float sum = 0;
for (i = 0; i < temp.size(); i++) {
sum += temp.get(i) - avg;
}
// return sum;
Log.d("Average : " , avg+"");
return (temp.get(temp.size() - 1) - temp.get(0));
}
public float getAbs(float temp) {
if (temp < 0) {
return temp * (-1);
} else {
return temp;
}
}
}
| [
"pathath.ram@gmail.com"
] | pathath.ram@gmail.com |
ff4c42cde34d7e50f181cc53385d9a6cf7c9b500 | 00fb9218e12d06b6d3e4aeff96ec48a030d23a57 | /ruoyi-exam/src/main/java/com/ruoyi/exam/mapper/PaperMapper.java | 771d4b2460153e6fd6cdbfaed5013852f34b544b | [
"MIT"
] | permissive | shilang/ruoyi | 480e5d2faca2f8845e001d48c5420db16b50026a | 5119e5578072918acafaa82d49b20b826cc00f70 | refs/heads/master | 2022-04-08T10:21:37.243016 | 2019-10-25T01:09:40 | 2019-10-25T01:09:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,173 | java | package com.ruoyi.exam.mapper;
import com.ruoyi.exam.domain.Paper;
import java.util.List;
/**
* 试卷 数据层
*
* @author ruoyi
* @date 2019-06-19
*/
public interface PaperMapper
{
/**
* 查询试卷信息
*
* @param id 试卷ID
* @return 试卷信息
*/
public Paper selectPaperById(String id);
/**
* 查询试卷列表
*
* @param paper 试卷信息
* @return 试卷集合
*/
public List<Paper> selectPaperList(Paper paper);
/**
* 新增试卷
*
* @param paper 试卷信息
* @return 结果
*/
public int insertPaper(Paper paper);
/**
* 修改试卷
*
* @param paper 试卷信息
* @return 结果
*/
public int updatePaper(Paper paper);
/**
* 删除试卷
*
* @param id 试卷ID
* @return 结果
*/
public int deletePaperById(String id);
/**
* 批量删除试卷
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deletePaperByIds(String[] ids);
/**
* 更新试卷分数和总分
* @param paper
* @return
*/
public int updatePaperScore(Paper paper);
} | [
"mzy620524"
] | mzy620524 |
8a1377d5cac62e8d990246118703ccfe6d60aa5b | 3a1f09a06ab0c6aa729a099618251af2f0dd67f1 | /src/com/company/DecryptData.java | d0feae515727dfa5e782a12f6df9508374e528e9 | [] | no_license | dferrero92/MP09-UF1A5-Keystore_KeyPair_WrappedKey | 74d0db0e7967f25913f74a015df9d5a8c25691cf | f6c5efbc1644a186291eed95391620df37771470 | refs/heads/master | 2020-04-07T17:49:50.867319 | 2018-11-21T17:49:00 | 2018-11-21T17:49:00 | 158,585,432 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 584 | java | package com.company;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import java.security.PrivateKey;
public class DecryptData {
public byte[] decryptData(byte[] data, PrivateKey sec) {
byte[] decryptedData = null;
try {
Cipher cipher = Cipher.getInstance("RSA/ECB/PKCS1Padding","SunJCE");
cipher.init(Cipher.DECRYPT_MODE, sec);
decryptedData = cipher.doFinal(data);
}
catch (Exception ex) {
System.err.println("Error xifrant: " + ex);
}
return decryptedData;
}
}
| [
"dferrerol92@elpuig.xeill.net"
] | dferrerol92@elpuig.xeill.net |
9744a4b86896e2d89ee4883ef2bd0436f89e572b | ed3cb95dcc590e98d09117ea0b4768df18e8f99e | /project_1_1/src/b/d/j/e/Calc_1_1_13948.java | dc37592b273f4f0924d479f72e64ffd36f3d263f | [] | no_license | chalstrick/bigRepo1 | ac7fd5785d475b3c38f1328e370ba9a85a751cff | dad1852eef66fcec200df10083959c674fdcc55d | refs/heads/master | 2016-08-11T17:59:16.079541 | 2015-12-18T14:26:49 | 2015-12-18T14:26:49 | 48,244,030 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package b.d.j.e;
public class Calc_1_1_13948 {
/** @return the sum of a and b */
public int add(int a, int b) {
return a+b;
}
}
| [
"christian.halstrick@sap.com"
] | christian.halstrick@sap.com |
7c35bb1c6dbaf8ce801e7094db15f075db2b208a | af9077c9cab68b80e3547aed05b83722288f117f | /app/src/androidTest/java/com/example/brian/test01/ApplicationTest.java | ce25d68de634bbcc10b3b6e3a5005022d689d872 | [] | no_license | briansfma/UI-Test1 | 9f722d48968cdde3fa85417c8df1518a2f4224ee | 3a9f448d9f1bc232db48746b2f143fa2662a366c | refs/heads/master | 2016-09-05T09:59:35.259448 | 2014-12-03T05:08:14 | 2014-12-03T05:08:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 355 | java | package com.example.brian.test01;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
} | [
"briansfma@gmail.com"
] | briansfma@gmail.com |
c3e71f3c800c024fac7490c49f323ad3ea479178 | 131a338b2304b3193f91aa92fc817e4ea71c699d | /Spade.java | 28e6a81d1d49decdcd57215e3732c64087bed805 | [] | no_license | Drakhnite/Poker | 8229b121119a2e1c84d7c17c68ff31e513032648 | 3327792c3f5b7a2a93364c29d899be90a25ef067 | refs/heads/master | 2020-03-22T09:14:39.049711 | 2018-07-05T13:21:24 | 2018-07-05T13:21:24 | 139,824,814 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 475 | java | package tp18bis;
public class Spade extends Color {
// char a = '\u2660';
@Override
public String getArt() {
StringBuilder card = new StringBuilder();
card.append(" _____ ");
card.append("\n");
card.append("|%s. |");
card.append("\n");
card.append("| /.\\ |");
card.append("\n");
card.append("|(_._)|");
card.append("\n");
card.append("| | |");
card.append("\n");
card.append("|___%s|");
card.append("\n");
return card.toString();
}
}
| [
"0671472668@orange.fr"
] | 0671472668@orange.fr |
397da9818dbde0ab9ec630d400dadd35363f7660 | 54052eb96a6e7bc2b54f6b3d08fed2ec09d2de16 | /fullstack-server/src/main/java/sg/edu/iss/fullstack/FullstackApplication.java | 7daf94e9e5bc39b609f60378f5750022b84788ee | [
"MIT"
] | permissive | ZT4188/ISSSA52 | fc0a2063696116bc0d5a8b94751d3ad5c1e97fe9 | 68b8819e9775f3becfcdef511a89fcd52df5497f | refs/heads/main | 2023-06-08T13:25:37.437370 | 2021-06-29T05:11:01 | 2021-06-29T05:11:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 933 | java | package sg.edu.iss.fullstack;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import sg.edu.iss.fullstack.student.Student;
import sg.edu.iss.fullstack.student.StudentRepository;
@SpringBootApplication
public class FullstackApplication {
@Autowired
StudentRepository srepo;
public static void main(String[] args) {
SpringApplication.run(FullstackApplication.class, args);
}
@Bean
CommandLineRunner runner() {
return args -> {
Student s1 = new Student("S1", "William", "Willy", 100);
srepo.save(s1);
Student s2 = new Student("S2", "Zerita", "Zen", 100);
srepo.save(s2);
Student s3 = new Student("S3", "Lee Yiquan", "Lee", 100);
srepo.save(s3);
};
}
}
| [
"suria.r.asai@gmail.com"
] | suria.r.asai@gmail.com |
5ecc9dfa1489a5815e5dcca1b2563afec3bd323a | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/27/27_a00d4689d11fc68559273cff9a12704c3c033189/AirTest/27_a00d4689d11fc68559273cff9a12704c3c033189_AirTest_t.java | dd5997f59628f4de7719162036108610e506b6ad | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 3,651 | java | package cn.org.rapid_framework.generator.ext.tableconfig.model;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.sql.SQLException;
import cn.org.rapid_framework.generator.Generator;
import cn.org.rapid_framework.generator.GeneratorConstants;
import cn.org.rapid_framework.generator.GeneratorProperties;
import cn.org.rapid_framework.generator.GeneratorTestCase;
import cn.org.rapid_framework.generator.Generator.GeneratorModel;
import cn.org.rapid_framework.generator.ext.tableconfig.builder.TableConfigXmlBuilder;
import cn.org.rapid_framework.generator.provider.db.sql.model.Sql;
import cn.org.rapid_framework.generator.util.FileHelper;
import cn.org.rapid_framework.generator.util.GLogger;
public class AirTest extends GeneratorTestCase {
public void setUp() throws Exception {
GLogger.perfLogLevel = GLogger.DEBUG;
GLogger.logLevel = GLogger.DEBUG;
System.setProperty(GeneratorConstants.GG_IS_OVERRIDE.code, "true");
System.setProperty(GeneratorConstants.GENERATOR_SQL_RESULTCLASS_SUFFIX.code, "DO");
GeneratorProperties.setProperty(GeneratorConstants.JDBC_URL, "jdbc:mysql://mypay1.devdb.alipay.net:3306/mcenter?useUnicode=true&characterEncoding=UTF-8");
GeneratorProperties.setProperty(GeneratorConstants.JDBC_DRIVER, "com.mysql.jdbc.Driver");
GeneratorProperties.setProperty(GeneratorConstants.JDBC_USERNAME, "merchant");
GeneratorProperties.setProperty(GeneratorConstants.JDBC_PASSWORD, "merchant");
GeneratorProperties.setProperty("basepackage", "com.alipay.mquery.common.dal.air");
GeneratorProperties.setProperty("appName", "rapid");
g = new Generator();
g.setSourceEncoding("GBK");
g.setOutputEncoding("GBK");
g.setOutRootDir("./target/temp/generate_by_sql_config");
}
public void test_genereate_by_sql_config() throws Exception {
// genereate_by_table_config("trade_base.xml");
// genereate_by_table_config("mcenter_air_ext.xml");
// genereate_by_table_config("mcenter_creditpay.xml");
// genereate_by_table_config("mcenter_account_log.xml");
// genereate_by_table_config("system_partner_query_trade_base.xml");
// genereate_by_table_config("trade_fund_bill.xml");
// genereate_by_table_config("mcenter_air_ext.xml");
}
private void genereate_by_table_config(String tableConfigFilename)
throws IOException,
FileNotFoundException,
Exception,
SQLException {
g.setTemplateRootDir(FileHelper.getFileByClassLoader("for_generate_by_sql_config"));
File file = FileHelper.getFileByClassLoader("cn/org/rapid_framework/generator/ext/tableconfig/"+tableConfigFilename);
TableConfig t = new TableConfigXmlBuilder().parseFromXML(file);
GeneratorModel gm = MetaTableTest.newFromTable(t);
g.generateBy(gm.templateModel, gm.filePathModel);
g.setTemplateRootDir(FileHelper.getFileByClassLoader("for_generate_by_sql"));
for(Sql sql : t.getSqls()) {
GeneratorModel sqlGM = MetaTableTest.newFromSql(sql,t);
g.generateBy(sqlGM.templateModel, sqlGM.filePathModel);
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
5cc42fca5ce6db1b0f39d1da3bc66b7cd0900b4f | ce9956e7be7e167b76220e92148d5186d6a34353 | /Paint/src/ru/nsu/cg/gui/SettingLabel.java | a87b43725a360b7292b891afa5e8a2c0c8160759 | [] | no_license | neemogu/graphics | 251e34d92d88c491633d98c27b250cf4bb2ff797 | db5dbbe5f8107797a35da5532c7a61dfb71e9b13 | refs/heads/master | 2023-07-12T20:34:41.053146 | 2021-08-20T12:34:57 | 2021-08-20T12:34:57 | 398,267,756 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 258 | java | package ru.nsu.cg.gui;
import javafx.scene.control.Label;
import javafx.scene.text.Font;
public class SettingLabel extends Label {
public SettingLabel(String setting, int fontSize) {
super(setting);
setFont(new Font(fontSize));
}
}
| [
"nik180101@gmail.com"
] | nik180101@gmail.com |
c9862aa8f8066a13294d5a4d74e3234a58e0a432 | 8358717b853f240843ffa56784773a29b1efc19e | /service-impl-wms/src/main/java/com/jumbo/dao/authorization/UserGroupRelationDao.java | 2febe8d499851214dfda4e915288dc096c52ad26 | [] | no_license | huanglongf/enterprise_project | 65ec3e2c56e4a2909f0881a9276a9966857bb9c7 | de1865e638c9620e702818124f0b2deac04028c9 | refs/heads/master | 2020-05-07T13:25:07.223338 | 2018-10-21T08:44:33 | 2018-10-21T08:44:33 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,437 | java | /**
* Copyright (c) 2010 Jumbomart All Rights Reserved.
*
* This software is the confidential and proprietary information of Jumbomart. You shall not
* disclose such Confidential Information and shall use it only in accordance with the terms of the
* license agreement you entered into with Jumbo.
*
* JUMBOMART MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF THE SOFTWARE, EITHER
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. JUMBOMART SHALL NOT BE LIABLE FOR ANY
* DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THIS SOFTWARE OR ITS
* DERIVATIVES.
*
*/
package com.jumbo.dao.authorization;
import loxia.annotation.NativeQuery;
import loxia.annotation.QueryParam;
import loxia.dao.GenericEntityDao;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.transaction.annotation.Transactional;
import com.jumbo.wms.model.authorization.UserGroup;
import com.jumbo.wms.model.authorization.UserGroupRelation;
@Transactional
public interface UserGroupRelationDao extends GenericEntityDao<UserGroupRelation, Long> {
/**
* @param id
* @param beanPropertyRowMapper
* @return
*/
@NativeQuery
UserGroup findUserGroupByUser(@QueryParam("id") Long id, BeanPropertyRowMapper<UserGroup> beanPropertyRowMapper);
}
| [
"lijg@many-it.com"
] | lijg@many-it.com |
654fd49419eb6c36b572df25862001170b6157bf | bc1531b9ddb31c0996d25539da73e6befdee65cd | /src/main/java/com/ecomflutter/demo/beans/Invoice.java | 2278b3cf6d0becefafe8a8f011820ca15ca8142d | [] | no_license | AmineLAHRIM/EcomFlutter | cdbde889c0ffe437b021b4ce00cad261c0e55861 | 7c91ff82efc5f1098fb7540cef78d98ed5dded0d | refs/heads/master | 2023-04-17T10:04:18.862832 | 2021-01-15T17:54:41 | 2021-01-15T17:54:41 | 266,015,983 | 2 | 0 | null | 2021-04-26T20:26:33 | 2020-05-22T04:14:29 | Java | UTF-8 | Java | false | false | 1,658 | java | package com.ecomflutter.demo.beans;
import org.hibernate.annotations.Filter;
import org.hibernate.annotations.FilterDef;
import org.hibernate.annotations.ParamDef;
import org.hibernate.annotations.SQLDelete;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
@SQLDelete(sql = "UPDATE invoice SET deleted=true WHERE id=?")
@FilterDef(
name = "deletedFilter",
parameters = @ParamDef(name = "isDeleted", type = "boolean")
)
@Filter(
name = "deletedFilter",
condition = "deleted = :isDeleted"
)
@Entity
public class Invoice implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private Date paymentDate;
private double totalAmount;
private double amountBilled;
@Column(columnDefinition = "boolean default false")
private boolean deleted;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getPaymentDate() {
return paymentDate;
}
public void setPaymentDate(Date paymentDate) {
this.paymentDate = paymentDate;
}
public double getTotalAmount() {
return totalAmount;
}
public void setTotalAmount(double totalAmount) {
this.totalAmount = totalAmount;
}
public double getAmountBilled() {
return amountBilled;
}
public void setAmountBilled(double amountBilled) {
this.amountBilled = amountBilled;
}
public boolean isDeleted() {
return deleted;
}
public void setDeleted(boolean deleted) {
this.deleted = deleted;
}
}
| [
"aminelahrimdev@gmail.com"
] | aminelahrimdev@gmail.com |
98df47a1cd23737caadc9feac6f4df348947e522 | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipseswt_cluster/17347/src_0.java | b36b3f224d74a6bfc385397dbd8b9d18e85210fe | [] | no_license | martinezmatias/GenPat-data-C3 | 63cfe27efee2946831139747e6c20cf952f1d6f6 | b360265a6aa3bb21bd1d64f1fc43c3b37d0da2a4 | refs/heads/master | 2022-04-25T17:59:03.905613 | 2020-04-15T14:41:34 | 2020-04-15T14:41:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 116,765 | java | /*******************************************************************************
* Copyright (c) 2000, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.swt.accessibility;
import java.util.*;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.accessibility.gtk.*;
import org.eclipse.swt.internal.gtk.*;
class AccessibleObject {
int /*long*/ handle;
int index = -1, id = ACC.CHILDID_SELF;
Accessible accessible;
AccessibleObject parent;
AccessibleObject[] children;
/*
* a lightweight object does not correspond to a concrete gtk widget, but
* to a logical child of a widget (eg.- a CTabItem, which is simply drawn)
*/
boolean isLightweight = false;
static int /*long*/ actionNamePtr = -1;
static int /*long*/ descriptionPtr = -1;
static int /*long*/ keybindingPtr = -1;
static int /*long*/ namePtr = -1;
static final Hashtable AccessibleObjects = new Hashtable (9);
static final boolean DEBUG = Device.DEBUG;
AccessibleObject (int /*long*/ type, int /*long*/ widget, Accessible accessible, boolean isLightweight) {
super ();
handle = ATK.g_object_new (type, 0);
ATK.atk_object_initialize (handle, widget);
this.accessible = accessible;
this.isLightweight = isLightweight;
AccessibleObjects.put (new LONG (handle), this);
if (DEBUG) print("new AccessibleObject: " + handle + " control=" + accessible.control + " lw=" + isLightweight);
}
static void print (String str) {
System.out.println (str);
}
static AtkActionIface getActionIface (int /*long*/ atkObject) {
if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_ACTION())) {
AtkActionIface iface = new AtkActionIface ();
ATK.memmove (iface, ATK.g_type_interface_peek_parent (ATK.ATK_ACTION_GET_IFACE (atkObject)));
return iface;
}
return null;
}
static int /*long*/ atkAction_do_action (int /*long*/ atkObject, int /*long*/ index) {
if (DEBUG) print ("-->atkAction_do_action");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleActionListeners;
int length = listeners.size();
if (length > 0) {
AccessibleActionEvent event = new AccessibleActionEvent(accessible);
event.index = (int)/*64*/index;
for (int i = 0; i < length; i++) {
AccessibleActionListener listener = (AccessibleActionListener) listeners.elementAt(i);
listener.doAction(event);
}
return 0;
}
}
int /*long*/ parentResult = 0;
AtkActionIface iface = getActionIface (atkObject);
if (iface != null && iface.do_action != 0) {
parentResult = ATK.call (iface.do_action, atkObject, index);
}
return parentResult;
}
static int /*long*/ atkAction_get_n_actions (int /*long*/ atkObject) {
if (DEBUG) print ("-->atkAction_get_n_actions");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleActionListeners;
int length = listeners.size();
if (length > 0) {
AccessibleActionEvent event = new AccessibleActionEvent(accessible);
for (int i = 0; i < length; i++) {
AccessibleActionListener listener = (AccessibleActionListener) listeners.elementAt(i);
listener.getActionCount(event);
}
return event.count;
}
}
int /*long*/ parentResult = 0;
AtkActionIface iface = getActionIface (atkObject);
if (iface != null && iface.get_n_actions != 0) {
parentResult = ATK.call (iface.get_n_actions, atkObject);
}
return parentResult;
}
static int /*long*/ atkAction_get_description (int /*long*/ atkObject, int /*long*/ index) {
if (DEBUG) print ("-->atkAction_get_description");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleActionListeners;
int length = listeners.size();
if (length > 0) {
AccessibleActionEvent event = new AccessibleActionEvent(accessible);
event.index = (int)/*64*/index;
for (int i = 0; i < length; i++) {
AccessibleActionListener listener = (AccessibleActionListener) listeners.elementAt(i);
listener.getDescription(event);
}
if (event.result == null) return 0;
if (descriptionPtr != -1) OS.g_free (descriptionPtr);
return descriptionPtr = getStringPtr (event.result);
}
}
int /*long*/ parentResult = 0;
AtkActionIface iface = getActionIface (atkObject);
if (iface != null && iface.get_description != 0) {
parentResult = ATK.call (iface.get_description, atkObject, index);
}
return parentResult;
}
static int /*long*/ atkAction_get_keybinding (int /*long*/ atkObject, int /*long*/ index) {
if (DEBUG) print ("-->atkAction_get_keybinding");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkActionIface iface = getActionIface (atkObject);
if (iface != null && iface.get_keybinding != 0) {
parentResult = ATK.call (iface.get_keybinding, atkObject, index);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleActionListeners;
int length = listeners.size();
if (length > 0) {
AccessibleActionEvent event = new AccessibleActionEvent(accessible);
event.index = (int)/*64*/index;
for (int i = 0; i < length; i++) {
AccessibleActionListener listener = (AccessibleActionListener) listeners.elementAt(i);
listener.getKeyBinding(event);
}
if (event.result != null) {
if (keybindingPtr != -1) OS.g_free (keybindingPtr);
return keybindingPtr = getStringPtr (event.result);
}
}
listeners = accessible.accessibleListeners;
length = listeners.size();
if (length > 0) {
AccessibleEvent event = new AccessibleEvent (accessible);
event.childID = object.id;
if (parentResult != 0) event.result = getString (parentResult);
for (int i = 0; i < length; i++) {
AccessibleListener listener = (AccessibleListener) listeners.elementAt(i);
listener.getKeyboardShortcut (event);
}
if (event.result != null) {
if (keybindingPtr != -1) OS.g_free (keybindingPtr);
return keybindingPtr = getStringPtr (event.result);
}
}
}
return parentResult;
}
static int /*long*/ atkAction_get_name (int /*long*/ atkObject, int /*long*/ index) {
if (DEBUG) print ("-->atkAction_get_name");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkActionIface iface = getActionIface (atkObject);
if (iface != null && iface.get_name != 0) {
parentResult = ATK.call (iface.get_name, atkObject, index);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleActionListeners;
int length = listeners.size();
if (length > 0) {
AccessibleActionEvent event = new AccessibleActionEvent(accessible);
event.index = (int)/*64*/index;
for (int i = 0; i < length; i++) {
AccessibleActionListener listener = (AccessibleActionListener) listeners.elementAt(i);
listener.getName(event);
}
if (event.result != null) {
if (actionNamePtr != -1) OS.g_free (actionNamePtr);
return actionNamePtr = getStringPtr (event.result);
}
}
if (index == 0) {
listeners = accessible.accessibleControlListeners;
length = listeners.size();
if (length > 0) {
AccessibleControlEvent event = new AccessibleControlEvent (accessible);
event.childID = object.id;
if (parentResult != 0) event.result = getString (parentResult);
for (int i = 0; i < length; i++) {
AccessibleControlListener listener = (AccessibleControlListener) listeners.elementAt(i);
listener.getDefaultAction (event);
}
if (event.result != null) {
if (actionNamePtr != -1) OS.g_free (actionNamePtr);
return actionNamePtr = getStringPtr (event.result);
}
}
}
}
return parentResult;
}
static AtkComponentIface getComponentIface (int /*long*/ atkObject) {
if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_COMPONENT())) {
AtkComponentIface iface = new AtkComponentIface ();
ATK.memmove (iface, ATK.g_type_interface_peek_parent (ATK.ATK_COMPONENT_GET_IFACE (atkObject)));
return iface;
}
return null;
}
static int /*long*/ atkComponent_get_extents (int /*long*/ atkObject, int /*long*/ x, int /*long*/ y, int /*long*/ width, int /*long*/ height, int /*long*/ coord_type) {
if (DEBUG) print ("-->atkComponent_get_extents: " + atkObject);
AccessibleObject object = getAccessibleObject (atkObject);
OS.memmove (x, new int[] {0}, 4);
OS.memmove (y, new int[] {0}, 4);
OS.memmove (width, new int[] {0}, 4);
OS.memmove (height, new int[] {0}, 4);
AtkComponentIface iface = getComponentIface (atkObject);
if (iface != null && iface.get_extents != 0) {
ATK.call (iface.get_extents, atkObject, x, y, width, height, coord_type);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleControlListeners;
int length = listeners.size();
if (length > 0) {
int[] parentX = new int [1], parentY = new int [1];
int[] parentWidth = new int [1], parentHeight = new int [1];
OS.memmove (parentX, x, 4);
OS.memmove (parentY, y, 4);
OS.memmove (parentWidth, width, 4);
OS.memmove (parentHeight, height, 4);
AccessibleControlEvent event = new AccessibleControlEvent (object.accessible);
event.childID = object.id;
event.x = parentX [0]; event.y = parentY [0];
event.width = parentWidth [0]; event.height = parentHeight [0];
int[] topWindowX = new int [1], topWindowY = new int [1];
if (coord_type == ATK.ATK_XY_WINDOW) {
windowPoint (object, topWindowX, topWindowY);
event.x += topWindowX [0];
event.y += topWindowY [0];
}
for (int i = 0; i < length; i++) {
AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i);
listener.getLocation (event);
}
if (coord_type == ATK.ATK_XY_WINDOW) {
event.x -= topWindowX [0];
event.y -= topWindowY [0];
}
OS.memmove (x, new int[] {event.x}, 4);
OS.memmove (y, new int[] {event.y}, 4);
OS.memmove (width, new int[] {event.width}, 4);
OS.memmove (height, new int[] {event.height}, 4);
if (DEBUG) print("--->" + event.x + "," + event.y + "," + event.width + "x" + event.height);
}
}
return 0;
}
static int /*long*/ atkComponent_get_position (int /*long*/ atkObject, int /*long*/ x, int /*long*/ y, int /*long*/ coord_type) {
if (DEBUG) print ("-->atkComponent_get_position, object: " + atkObject + " x: " + x + " y: " + y + " coord: " + coord_type);
AccessibleObject object = getAccessibleObject (atkObject);
OS.memmove (x, new int[] {0}, 4);
OS.memmove (y, new int[] {0}, 4);
AtkComponentIface iface = getComponentIface (atkObject);
if (iface != null && iface.get_position != 0) {
ATK.call (iface.get_position, atkObject, x, y, coord_type);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleControlListeners;
int length = listeners.size();
if (length > 0) {
int[] parentX = new int [1], parentY = new int [1];
OS.memmove (parentX, x, 4);
OS.memmove (parentY, y, 4);
AccessibleControlEvent event = new AccessibleControlEvent (object.accessible);
event.childID = object.id;
event.x = parentX [0]; event.y = parentY [0];
int[] topWindowX = new int [1], topWindowY = new int [1];
if (coord_type == ATK.ATK_XY_WINDOW) {
windowPoint (object, topWindowX, topWindowY);
event.x += topWindowX [0];
event.y += topWindowY [0];
}
for (int i = 0; i < length; i++) {
AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i);
listener.getLocation (event);
}
if (coord_type == ATK.ATK_XY_WINDOW) {
event.x -= topWindowX [0];
event.y -= topWindowY [0];
}
OS.memmove (x, new int[] {event.x}, 4);
OS.memmove (y, new int[] {event.y}, 4);
}
}
return 0;
}
static int /*long*/ atkComponent_get_size (int /*long*/ atkObject, int /*long*/ width, int /*long*/ height, int /*long*/ coord_type) {
if (DEBUG) print ("-->atkComponent_get_size");
AccessibleObject object = getAccessibleObject (atkObject);
OS.memmove (width, new int[] {0}, 4);
OS.memmove (height, new int[] {0}, 4);
AtkComponentIface iface = getComponentIface (atkObject);
if (iface != null && iface.get_size != 0) {
ATK.call (iface.get_size, atkObject, width, height, coord_type);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleControlListeners;
int length = listeners.size();
if (length > 0) {
int[] parentWidth = new int [1], parentHeight = new int [1];
OS.memmove (parentWidth, width, 4);
OS.memmove (parentHeight, height, 4);
AccessibleControlEvent event = new AccessibleControlEvent (object.accessible);
event.childID = object.id;
event.width = parentWidth [0]; event.height = parentHeight [0];
for (int i = 0; i < length; i++) {
AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i);
listener.getLocation (event);
}
OS.memmove (width, new int[] {event.width}, 4);
OS.memmove (height, new int[] {event.height}, 4);
}
}
return 0;
}
static int /*long*/ atkComponent_ref_accessible_at_point (int /*long*/ atkObject, int /*long*/ x, int /*long*/ y, int /*long*/ coord_type) {
if (DEBUG) print ("-->atkComponent_ref_accessible_at_point: " + atkObject + " " + x + "," + y);
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleControlListeners;
int length = listeners.size();
if (length > 0) {
AccessibleControlEvent event = new AccessibleControlEvent (object.accessible);
event.childID = object.id;
event.x = (int)/*64*/x; event.y = (int)/*64*/y;
int[] topWindowX = new int [1], topWindowY = new int [1];
if (coord_type == ATK.ATK_XY_WINDOW) {
windowPoint (object, topWindowX, topWindowY);
event.x += topWindowX [0];
event.y += topWindowY [0];
}
for (int i = 0; i < length; i++) {
AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i);
listener.getChildAtPoint (event);
}
if (event.childID == object.id) event.childID = ACC.CHILDID_SELF;
Accessible result = event.accessible;
AccessibleObject accObj = result != null ? result.getAccessibleObject() : object.getChildByID (event.childID);
if (accObj != null) {
return OS.g_object_ref (accObj.handle);
}
}
}
int /*long*/ parentResult = 0;
AtkComponentIface iface = getComponentIface (atkObject);
if (iface != null && iface.ref_accessible_at_point != 0) {
parentResult = ATK.call (iface.ref_accessible_at_point, atkObject, x, y, coord_type);
}
return parentResult;
}
static AtkHypertextIface getHypertextIface (int /*long*/ atkObject) {
if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_HYPERTEXT())) {
AtkHypertextIface iface = new AtkHypertextIface ();
ATK.memmove (iface, ATK.g_type_interface_peek_parent (ATK.ATK_HYPERTEXT_GET_IFACE (atkObject)));
return iface;
}
return null;
}
static int /*long*/ atkHypertext_get_link (int /*long*/ atkObject, int /*long*/ link_index) {
if (DEBUG) print ("-->atkHypertext_get_link");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
event.index = (int)/*int*/link_index;
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getHyperlink(event);
}
Accessible result = event.accessible;
return result != null ? result.getAccessibleObject().handle : 0;
}
}
int /*long*/ parentResult = 0;
AtkHypertextIface iface = getHypertextIface (atkObject);
if (iface != null && iface.get_link != 0) {
parentResult = ATK.call (iface.get_link, atkObject, link_index);
}
return parentResult;
}
static int /*long*/ atkHypertext_get_n_links (int /*long*/ atkObject) {
if (DEBUG) print ("-->atkHypertext_get_n_links");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getHyperlinkCount(event);
}
return event.count;
}
}
int /*long*/ parentResult = 0;
AtkHypertextIface iface = getHypertextIface (atkObject);
if (iface != null && iface.get_n_links != 0) {
parentResult = ATK.call (iface.get_n_links, atkObject);
}
return parentResult;
}
static int /*long*/ atkHypertext_get_link_index (int /*long*/ atkObject, int /*long*/ char_index) {
if (DEBUG) print ("-->atkHypertext_get_link_index");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
event.offset = (int)/*int*/char_index;
event.index = -1;
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getHyperlinkIndex(event);
}
return event.index;
}
}
int /*long*/ parentResult = 0;
AtkHypertextIface iface = getHypertextIface (atkObject);
if (iface != null && iface.get_link != 0) {
parentResult = ATK.call (iface.get_link, atkObject, char_index);
}
return parentResult;
}
static AtkObjectClass getObjectClass (int /*long*/ atkObject) {
AtkObjectClass objectClass = new AtkObjectClass ();
ATK.memmove (objectClass, ATK.g_type_class_peek (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject))));
return objectClass;
}
static int /*long*/ atkObject_get_description (int /*long*/ atkObject) {
if (DEBUG) print ("-->atkObject_get_description: " + atkObject);
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkObjectClass objectClass = getObjectClass (atkObject);
if (objectClass.get_description != 0) {
parentResult = ATK.call (objectClass.get_description, atkObject);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleListeners;
int length = listeners.size();
if (length > 0) {
AccessibleEvent event = new AccessibleEvent (object.accessible);
event.childID = object.id;
if (parentResult != 0) event.result = getString (parentResult);
for (int i = 0; i < length; i++) {
AccessibleListener listener = (AccessibleListener)listeners.elementAt (i);
listener.getDescription (event);
}
if (DEBUG) print ("---> " + event.result);
if (event.result == null) return parentResult;
if (descriptionPtr != -1) OS.g_free (descriptionPtr);
return descriptionPtr = getStringPtr (event.result);
}
}
return parentResult;
}
static int /*long*/ atkObject_get_name (int /*long*/ atkObject) {
if (DEBUG) print ("-->atkObject_get_name: " + atkObject);
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkObjectClass objectClass = getObjectClass (atkObject);
if (objectClass.get_name != 0) {
parentResult = ATK.call (objectClass.get_name, atkObject);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleListeners;
int length = listeners.size();
if (length > 0) {
AccessibleEvent event = new AccessibleEvent (object.accessible);
event.childID = object.id;
if (parentResult != 0) event.result = getString (parentResult);
for (int i = 0; i < length; i++) {
AccessibleListener listener = (AccessibleListener)listeners.elementAt (i);
listener.getName (event);
}
if (DEBUG) print ("---> " + event.result);
if (event.result == null) return parentResult;
if (namePtr != -1) OS.g_free (namePtr);
return namePtr = getStringPtr (event.result);
}
}
return parentResult;
}
static int /*long*/ atkObject_get_n_children (int /*long*/ atkObject) {
if (DEBUG) print ("-->atkObject_get_n_children: " + atkObject);
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkObjectClass objectClass = getObjectClass (atkObject);
if (objectClass.get_n_children != 0) {
parentResult = ATK.call (objectClass.get_n_children, atkObject);
}
if (object != null && object.id == ACC.CHILDID_SELF) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleControlListeners;
int length = listeners.size();
if (length > 0) {
AccessibleControlEvent event = new AccessibleControlEvent (object.accessible);
event.childID = object.id;
event.detail = (int)/*64*/parentResult;
for (int i = 0; i < length; i++) {
AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i);
listener.getChildCount (event);
}
if (DEBUG) print ("--->" + event.detail);
return event.detail;
}
}
return parentResult;
}
static int /*long*/ atkObject_get_index_in_parent (int /*long*/ atkObject) {
if (DEBUG) print ("-->atkObjectCB_get_index_in_parent: " + atkObject);
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
if (object.index != -1) {
if (DEBUG) print ("---> " + object.index);
return object.index;
}
}
AtkObjectClass objectClass = getObjectClass (atkObject);
if (objectClass.get_index_in_parent == 0) return 0;
return ATK.call (objectClass.get_index_in_parent, atkObject);
}
static int /*long*/ atkObject_get_parent (int /*long*/ atkObject) {
if (DEBUG) print ("-->atkObject_get_parent: " + atkObject);
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
if (object.parent != null) {
if (DEBUG) print ("---> " + object.parent.accessible.accessibleObject.handle);
return object.parent.handle;
}
}
AtkObjectClass objectClass = getObjectClass (atkObject);
if (objectClass.get_parent == 0) return 0;
int /*long*/ parentResult = ATK.call (objectClass.get_parent, atkObject);
if (DEBUG) print ("---> " + parentResult);
return parentResult;
}
static int /*long*/ atkObject_get_role (int /*long*/ atkObject) {
if (DEBUG) print ("-->atkObject_get_role: " + atkObject);
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleControlListeners;
int length = listeners.size();
if (length > 0) {
AccessibleControlEvent event = new AccessibleControlEvent (object.accessible);
event.childID = object.id;
event.detail = -1;
for (int i = 0; i < length; i++) {
AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i);
listener.getRole (event);
}
if (DEBUG) print ("---> " + event.detail);
if (event.detail != -1) {
switch (event.detail) {
/* Convert from win32 role values to atk role values */
case ACC.ROLE_CHECKBUTTON: return ATK.ATK_ROLE_CHECK_BOX;
case ACC.ROLE_CLIENT_AREA: return ATK.ATK_ROLE_DRAWING_AREA;
case ACC.ROLE_COMBOBOX: return ATK.ATK_ROLE_COMBO_BOX;
case ACC.ROLE_DIALOG: return ATK.ATK_ROLE_DIALOG;
case ACC.ROLE_LABEL: return ATK.ATK_ROLE_LABEL;
case ACC.ROLE_LINK: return ATK.ATK_ROLE_TEXT;
case ACC.ROLE_LIST: return ATK.ATK_ROLE_LIST;
case ACC.ROLE_LISTITEM: return ATK.ATK_ROLE_LIST_ITEM;
case ACC.ROLE_MENU: return ATK.ATK_ROLE_MENU;
case ACC.ROLE_MENUBAR: return ATK.ATK_ROLE_MENU_BAR;
case ACC.ROLE_MENUITEM: return ATK.ATK_ROLE_MENU_ITEM;
case ACC.ROLE_PROGRESSBAR: return ATK.ATK_ROLE_PROGRESS_BAR;
case ACC.ROLE_PUSHBUTTON: return ATK.ATK_ROLE_PUSH_BUTTON;
case ACC.ROLE_SCROLLBAR: return ATK.ATK_ROLE_SCROLL_BAR;
case ACC.ROLE_SEPARATOR: return ATK.ATK_ROLE_SEPARATOR;
case ACC.ROLE_SLIDER: return ATK.ATK_ROLE_SLIDER;
case ACC.ROLE_TABLE: return ATK.ATK_ROLE_TABLE;
case ACC.ROLE_TABLECELL: return ATK.ATK_ROLE_TABLE_CELL;
case ACC.ROLE_TABLECOLUMNHEADER: return ATK.ATK_ROLE_TABLE_COLUMN_HEADER;
case ACC.ROLE_TABLEROWHEADER: return ATK.ATK_ROLE_TABLE_ROW_HEADER;
case ACC.ROLE_TABFOLDER: return ATK.ATK_ROLE_PAGE_TAB_LIST;
case ACC.ROLE_TABITEM: return ATK.ATK_ROLE_PAGE_TAB;
case ACC.ROLE_TEXT: return ATK.ATK_ROLE_TEXT;
case ACC.ROLE_TOOLBAR: return ATK.ATK_ROLE_TOOL_BAR;
case ACC.ROLE_TOOLTIP: return ATK.ATK_ROLE_TOOL_TIP;
case ACC.ROLE_TREE: return ATK.ATK_ROLE_TREE;
case ACC.ROLE_TREEITEM: return ATK.ATK_ROLE_LIST_ITEM;
case ACC.ROLE_RADIOBUTTON: return ATK.ATK_ROLE_RADIO_BUTTON;
case ACC.ROLE_SPLITBUTTON: return ATK.ATK_ROLE_PUSH_BUTTON;
case ACC.ROLE_WINDOW: return ATK.ATK_ROLE_WINDOW;
case ACC.ROLE_ROW: return ATK.ATK_ROLE_TABLE_CELL;
}
}
}
}
AtkObjectClass objectClass = getObjectClass (atkObject);
if (objectClass.get_role == 0) return 0;
return ATK.call (objectClass.get_role, atkObject);
}
static int /*long*/ atkObject_ref_child (int /*long*/ atkObject, int /*long*/ index) {
if (DEBUG) print ("-->atkObject_ref_child: " + index + " of: " + atkObject);
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null && object.id == ACC.CHILDID_SELF) {
object.updateChildren ();
AccessibleObject accObject = object.getChildByIndex ((int)/*64*/index);
if (accObject != null) {
return OS.g_object_ref (accObject.handle);
}
}
AtkObjectClass objectClass = getObjectClass (atkObject);
if (objectClass.ref_child == 0) return 0;
return ATK.call (objectClass.ref_child, atkObject, index);
}
static int /*long*/ atkObject_ref_state_set (int /*long*/ atkObject) {
if (DEBUG) print ("-->atkObject_ref_state_set: " + atkObject);
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkObjectClass objectClass = getObjectClass (atkObject);
if (objectClass.ref_state_set != 0) {
parentResult = ATK.call (objectClass.ref_state_set, atkObject);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleControlListeners;
int length = listeners.size();
if (length > 0) {
int /*long*/ set = parentResult;
AccessibleControlEvent event = new AccessibleControlEvent (object.accessible);
event.childID = object.id;
event.detail = -1;
for (int i = 0; i < length; i++) {
AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i);
listener.getState (event);
}
if (event.detail != -1) {
/* Convert from win32 state values to atk state values */
int state = event.detail;
if ((state & ACC.STATE_BUSY) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_BUSY);
if ((state & ACC.STATE_CHECKED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_CHECKED);
if ((state & ACC.STATE_ENABLED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_ENABLED);
if ((state & ACC.STATE_EXPANDED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_EXPANDED);
if ((state & ACC.STATE_FOCUSABLE) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_FOCUSABLE);
if ((state & ACC.STATE_FOCUSED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_FOCUSED);
if ((state & ACC.STATE_HOTTRACKED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_ARMED);
if ((state & ACC.STATE_INVISIBLE) == 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_VISIBLE);
if ((state & ACC.STATE_MULTISELECTABLE) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_MULTISELECTABLE);
if ((state & ACC.STATE_OFFSCREEN) == 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_SHOWING);
if ((state & ACC.STATE_PRESSED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_PRESSED);
if ((state & ACC.STATE_READONLY) == 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_EDITABLE);
if ((state & ACC.STATE_SELECTABLE) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_SELECTABLE);
if ((state & ACC.STATE_SELECTED) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_SELECTED);
if ((state & ACC.STATE_SIZEABLE) != 0) ATK.atk_state_set_add_state (set, ATK.ATK_STATE_RESIZABLE);
/* Note: STATE_COLLAPSED, STATE_LINKED and STATE_NORMAL have no ATK equivalents */
}
return set;
}
}
return parentResult;
}
static AtkSelectionIface getSelectionIface (int /*long*/ atkObject) {
if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_SELECTION())) {
AtkSelectionIface iface = new AtkSelectionIface ();
ATK.memmove (iface, ATK.g_type_interface_peek_parent (ATK.ATK_SELECTION_GET_IFACE (atkObject)));
return iface;
}
return null;
}
static int /*long*/ atkSelection_is_child_selected (int /*long*/ atkObject, int /*long*/ index) {
if (DEBUG) print ("-->atkSelection_is_child_selected");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkSelectionIface iface = getSelectionIface (atkObject);
if (iface != null && iface.is_child_selected != 0) {
parentResult = ATK.call (iface.is_child_selected, atkObject, index);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleControlListeners;
int length = listeners.size();
if (length > 0) {
AccessibleControlEvent event = new AccessibleControlEvent (object.accessible);
event.childID = object.id;
for (int i = 0; i < length; i++) {
AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i);
listener.getSelection (event);
}
Accessible result = event.accessible;
AccessibleObject accessibleObject = result != null ? result.getAccessibleObject() : object.getChildByID (event.childID);
if (accessibleObject != null) {
return accessibleObject.index == index ? 1 : 0;
}
}
}
return parentResult;
}
static int /*long*/ atkSelection_ref_selection (int /*long*/ atkObject, int /*long*/ index) {
if (DEBUG) print ("-->atkSelection_ref_selection");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkSelectionIface iface = getSelectionIface (atkObject);
if (iface != null && iface.ref_selection != 0) {
parentResult = ATK.call (iface.ref_selection, atkObject, index);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleControlListeners;
int length = listeners.size();
if (length > 0) {
AccessibleControlEvent event = new AccessibleControlEvent (object.accessible);
event.childID = object.id;
for (int i = 0; i < length; i++) {
AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i);
listener.getSelection (event);
}
AccessibleObject accObj = object.getChildByID (event.childID);
if (accObj != null) {
if (parentResult != 0) OS.g_object_unref (parentResult);
OS.g_object_ref (accObj.handle);
return accObj.handle;
}
}
}
return parentResult;
}
static AtkTableIface getTableIface (int /*long*/ atkObject) {
if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_TABLE())) {
AtkTableIface iface = new AtkTableIface ();
ATK.memmove (iface, ATK.g_type_interface_peek_parent (ATK.ATK_TABLE_GET_IFACE (atkObject)));
return iface;
}
return null;
}
static int /*long*/ atkTable_ref_at (int /*long*/ atkObject, int /*long*/ row, int /*long*/ column) {
if (DEBUG) print ("-->atkTable_ref_at");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.ref_at != 0) {
parentResult = ATK.call (iface.ref_at, atkObject, row, column);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
event.row = (int)/*64*/row;
event.column = (int)/*64*/column;
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getCell(event);
}
Accessible result = event.accessible;
if (result != null) {
if (parentResult != 0) OS.g_object_unref(parentResult);
AccessibleObject accessibleObject = result.getAccessibleObject();
OS.g_object_ref(accessibleObject.handle);
return accessibleObject.handle;
}
}
return parentResult;
}
static int /*long*/ atkTable_get_index_at (int /*long*/ atkObject, int /*long*/ row, int /*long*/ column) {
if (DEBUG) print ("-->atkTable_get_index_at");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
event.row = (int)/*64*/row;
event.column = (int)/*64*/column;
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getCell(event);
}
Accessible result = event.accessible;
if (result == null) return -1;
event = new AccessibleTableEvent(accessible);
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getColumnCount(event);
}
return row * event.count + column;
}
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.get_index_at != 0) {
parentResult = ATK.call (iface.get_index_at, atkObject, row, column);
}
return parentResult;
}
static int /*long*/ atkTable_get_column_at_index (int /*long*/ atkObject, int /*long*/ index) {
if (DEBUG) print ("-->atkTable_get_column_at_index");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getColumnCount(event);
}
return index % event.count;
}
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.get_column_at_index != 0) {
parentResult = ATK.call (iface.get_column_at_index, atkObject, index);
}
return parentResult;
}
static int /*long*/ atkTable_get_row_at_index (int /*long*/ atkObject, int /*long*/ index) {
if (DEBUG) print ("-->atkTable_get_row_at_index");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getColumnCount(event);
}
return event.count == 0 ? -1 : index / event.count;
}
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.get_row_at_index != 0) {
parentResult = ATK.call (iface.get_row_at_index, atkObject, index);
}
return parentResult;
}
static int /*long*/ atkTable_get_n_columns (int /*long*/ atkObject) {
if (DEBUG) print ("-->atkTable_get_n_columns");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.get_n_columns != 0) {
parentResult = ATK.call (iface.get_n_columns, atkObject);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
event.count = (int)/*64*/parentResult;
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getColumnCount(event);
parentResult = event.count;
}
}
return parentResult;
}
static int /*long*/ atkTable_get_n_rows (int /*long*/ atkObject) {
if (DEBUG) print ("-->atkTable_get_n_rows");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.get_n_rows != 0) {
parentResult = ATK.call (iface.get_n_rows, atkObject);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
event.count = (int)/*64*/parentResult;
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getRowCount(event);
parentResult = event.count;
}
}
return parentResult;
}
static int /*long*/ atkTable_get_column_extent_at (int /*long*/ atkObject, int /*long*/ row, int /*long*/ column) {
if (DEBUG) print ("-->atkTable_get_column_extent_at");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.get_column_extent_at != 0) {
parentResult = ATK.call (iface.get_column_extent_at, atkObject, row, column);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
event.row = (int)/*64*/row;
event.column = (int)/*64*/column;
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getCell(event);
}
Accessible result = event.accessible;
if (result != null) {
listeners = result.accessibleTableCellListeners;
AccessibleTableCellEvent cellEvent = new AccessibleTableCellEvent(result);
cellEvent.count = (int)/*64*/parentResult;
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleTableCellListener listener = (AccessibleTableCellListener) listeners.elementAt(i);
listener.getColumnSpan(cellEvent);
}
return cellEvent.count;
}
}
return parentResult;
}
static int /*long*/ atkTable_get_row_extent_at (int /*long*/ atkObject, int /*long*/ row, int /*long*/ column) {
if (DEBUG) print ("-->atkTable_get_row_extent_at");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.get_row_extent_at != 0) {
parentResult = ATK.call (iface.get_row_extent_at, atkObject, row, column);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
event.row = (int)/*64*/row;
event.column = (int)/*64*/column;
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getCell(event);
}
Accessible result = event.accessible;
if (result != null) {
listeners = result.accessibleTableCellListeners;
AccessibleTableCellEvent cellEvent = new AccessibleTableCellEvent(result);
cellEvent.count = (int)/*64*/parentResult;
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleTableCellListener listener = (AccessibleTableCellListener) listeners.elementAt(i);
listener.getRowSpan(cellEvent);
}
return cellEvent.count;
}
}
return parentResult;
}
static int /*long*/ atkTable_get_caption (int /*long*/ atkObject) {
if (DEBUG) print ("-->atkTable_get_caption");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.get_caption != 0) {
parentResult = ATK.call (iface.get_caption, atkObject);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
for (int i = 0; i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getCaption(event);
}
Accessible result = event.accessible;
if (result != null) return result.getAccessibleObject().handle;
}
}
return parentResult;
}
static int /*long*/ atkTable_get_summary (int /*long*/ atkObject) {
if (DEBUG) print ("-->atkTable_get_summary");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.get_summary != 0) {
parentResult = ATK.call (iface.get_summary, atkObject);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
for (int i = 0; i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getSummary(event);
}
Accessible result = event.accessible;
if (result != null) return result.getAccessibleObject().handle;
}
}
return parentResult;
}
static int /*long*/ atkTable_get_column_description (int /*long*/ atkObject, int /*long*/ column) {
if (DEBUG) print ("-->atkTable_get_column_description");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.get_column_description != 0) {
parentResult = ATK.call (iface.get_column_description, atkObject, column);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
event.column = (int)/*64*/column;
if (parentResult != 0) event.result = getString (parentResult);
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getColumnDescription(event);
}
if (event.result == null) return parentResult;
if (descriptionPtr != -1) OS.g_free (descriptionPtr);
return descriptionPtr = getStringPtr (event.result);
}
return parentResult;
}
static int /*long*/ atkTable_get_column_header (int /*long*/ atkObject, int /*long*/ column) {
if (DEBUG) print ("-->atkTable_get_column_header");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.get_column_header != 0) {
parentResult = ATK.call (iface.get_column_header, atkObject, column);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
for (int i = 0; i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getRowHeaderCells(event);
}
Accessible[] accessibles = event.accessibles;
if (accessibles != null) {
if (0 <= column && column < accessibles.length) {
return accessibles[(int)/*64*/column].getAccessibleObject().handle;
}
}
}
}
return parentResult;
}
static int /*long*/ atkTable_get_row_description (int /*long*/ atkObject, int /*long*/ row) {
if (DEBUG) print ("-->atkTable_get_row_description");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.get_row_description != 0) {
parentResult = ATK.call (iface.get_row_description, atkObject, row);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
event.row = (int)/*64*/row;
if (parentResult != 0) event.result = getString (parentResult);
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getRowDescription(event);
}
if (event.result == null) return parentResult;
if (descriptionPtr != -1) OS.g_free (descriptionPtr);
return descriptionPtr = getStringPtr (event.result);
}
return parentResult;
}
static int /*long*/ atkTable_get_row_header (int /*long*/ atkObject, int /*long*/ row) {
if (DEBUG) print ("-->atkTable_get_row_header");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.get_row_header != 0) {
parentResult = ATK.call (iface.get_row_header, atkObject, row);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
for (int i = 0; i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getRowHeaderCells(event);
}
Accessible[] accessibles = event.accessibles;
if (accessibles != null) {
if (0 <= row && row < accessibles.length) {
return accessibles[(int)/*64*/row].getAccessibleObject().handle;
}
}
}
}
return parentResult;
}
static int /*long*/ atkTable_get_selected_columns (int /*long*/ atkObject, int /*long*/ selected) {
if (DEBUG) print ("-->atkTable_get_selected_columns");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
for (int i = 0; i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getSelectedColumns(event);
}
int count = event.selected != null ? event.selected.length : 0;
int /*long*/ result = OS.g_malloc(count * 4);
if (event.selected != null) OS.memmove(result, event.selected, count * 4);
if (selected != 0) OS.memmove(selected, new int /*long*/[]{result}, C.PTR_SIZEOF);
return count;
}
}
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.get_selected_columns != 0) {
parentResult = ATK.call (iface.get_selected_columns, atkObject, selected);
}
return parentResult;
}
static int /*long*/ atkTable_get_selected_rows (int /*long*/ atkObject, int /*long*/ selected) {
if (DEBUG) print ("-->atkTable_get_selected_rows");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
for (int i = 0; i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getSelectedRows(event);
}
int count = event.selected != null ? event.selected.length : 0;
int /*long*/ result = OS.g_malloc(count * 4);
if (event.selected != null) OS.memmove(result, event.selected, count * 4);
if (selected != 0) OS.memmove(selected, new int /*long*/[]{result}, C.PTR_SIZEOF);
return count;
}
}
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.get_selected_rows != 0) {
parentResult = ATK.call (iface.get_selected_rows, atkObject, selected);
}
return parentResult;
}
static int /*long*/ atkTable_is_column_selected (int /*long*/ atkObject, int /*long*/ column) {
if (DEBUG) print ("-->atkTable_is_column_selected");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.is_column_selected != 0) {
parentResult = ATK.call (iface.is_column_selected, atkObject, column);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
event.isSelected = parentResult != 0;
event.column = (int)/*64*/column;
for (int i = 0; i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.isColumnSelected(event);
}
return event.isSelected ? 1 : 0;
}
}
return parentResult;
}
static int /*long*/ atkTable_is_row_selected (int /*long*/ atkObject, int /*long*/ row) {
if (DEBUG) print ("-->atkTable_is_row_selected");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.is_row_selected != 0) {
parentResult = ATK.call (iface.is_row_selected, atkObject, row);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
event.isSelected = parentResult != 0;
event.row = (int)/*64*/row;
for (int i = 0; i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.isRowSelected(event);
}
return event.isSelected ? 1 : 0;
}
}
return parentResult;
}
static int /*long*/ atkTable_is_selected (int /*long*/ atkObject, int /*long*/ row, int /*long*/ column) {
if (DEBUG) print ("-->atkTable_is_selected");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.is_selected != 0) {
parentResult = ATK.call (iface.is_selected, atkObject, row, column);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
event.row = (int)/*64*/row;
event.column = (int)/*64*/column;
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.getCell(event);
}
Accessible result = event.accessible;
if (result != null) {
listeners = result.accessibleTableCellListeners;
AccessibleTableCellEvent cellEvent = new AccessibleTableCellEvent(result);
cellEvent.isSelected = parentResult != 0;
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleTableCellListener listener = (AccessibleTableCellListener) listeners.elementAt(i);
listener.isSelected(cellEvent);
}
return cellEvent.isSelected ? 1 : 0;
}
}
return parentResult;
}
static int /*long*/ atkTable_add_row_selection (int /*long*/ atkObject, int /*long*/ row) {
if (DEBUG) print ("-->atkTable_add_row_selection");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
event.row = (int)/*64*/row;
for (int i = 0; i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.selectRow(event);
}
//TODO should listener return if it did it or not
return 1;
}
}
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.add_row_selection != 0) {
parentResult = ATK.call (iface.add_row_selection, atkObject, row);
}
return parentResult;
}
static int /*long*/ atkTable_remove_row_selection (int /*long*/ atkObject, int /*long*/ row) {
if (DEBUG) print ("-->atkTable_remove_row_selection");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
event.row = (int)/*64*/row;
for (int i = 0; i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.deselectRow(event);
}
//TODO should listener return if it did it or not
return 1;
}
}
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.remove_row_selection != 0) {
parentResult = ATK.call (iface.remove_row_selection, atkObject, row);
}
return parentResult;
}
static int /*long*/ atkTable_add_column_selection (int /*long*/ atkObject, int /*long*/ column) {
if (DEBUG) print ("-->atkTable_add_column_selection");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
event.column = (int)/*64*/column;
for (int i = 0; i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.selectColumn(event);
}
//TODO should listener return if it did it or not
return 1;
}
}
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.add_column_selection != 0) {
parentResult = ATK.call (iface.add_column_selection, atkObject, column);
}
return parentResult;
}
static int /*long*/ atkTable_remove_column_selection (int /*long*/ atkObject, int /*long*/ column) {
if (DEBUG) print ("-->atkTable_remove_column_selection");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTableListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTableEvent event = new AccessibleTableEvent(accessible);
event.column = (int)/*64*/column;
for (int i = 0; i < length; i++) {
AccessibleTableListener listener = (AccessibleTableListener) listeners.elementAt(i);
listener.deselectColumn(event);
}
//TODO should listener return if it did it or not
return 1;
}
}
int /*long*/ parentResult = 0;
AtkTableIface iface = getTableIface (atkObject);
if (iface != null && iface.remove_column_selection != 0) {
parentResult = ATK.call (iface.remove_column_selection, atkObject, column);
}
return parentResult;
}
static AtkTextIface getTextIface (int /*long*/ atkObject) {
if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_TEXT())) {
AtkTextIface iface = new AtkTextIface ();
ATK.memmove (iface, ATK.g_type_interface_peek_parent (ATK.ATK_TEXT_GET_IFACE (atkObject)));
return iface;
}
return null;
}
static int /*long*/ atkText_get_character_extents (int /*long*/ atkObject, int /*long*/ offset, int /*long*/ x, int /*long*/ y, int /*long*/ width, int /*long*/ height, int /*long*/ coords) {
if (DEBUG) print ("-->atkText_get_character_extents");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
event.start = (int)/*64*/offset;
event.end = (int)/*64*/(offset + 1);
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getTextBounds(event);
}
int[] topWindowX = new int [1], topWindowY = new int [1];
if (coords == ATK.ATK_XY_WINDOW) {
windowPoint (object, topWindowX, topWindowY);
event.x -= topWindowX [0];
event.y -= topWindowY [0];
}
OS.memmove (x, new int[]{event.x}, 4);
OS.memmove (y, new int[]{event.y}, 4);
OS.memmove (width, new int[]{event.width}, 4);
OS.memmove (height, new int[]{event.height}, 4);
return 0;
}
}
AtkTextIface iface = getTextIface (atkObject);
if (iface != null && iface.get_character_extents != 0) {
ATK.call (iface.get_character_extents, atkObject, offset, x, y, width, height, coords);
}
return 0;
}
static String getString (int /*long*/ strPtr) {
int length = OS.strlen (strPtr);
byte [] buffer = new byte [length];
OS.memmove (buffer, strPtr, length);
return new String (Converter.mbcsToWcs (null, buffer));
}
static int /*long*/ getStringPtr (String str) {
byte [] buffer = Converter.wcsToMbcs(null, str != null ? str : "", true);
int /*long*/ ptr = OS.g_malloc(buffer.length);
OS.memmove(ptr, buffer, buffer.length);
return ptr;
}
static int /*long*/ atkText_get_range_extents (int /*long*/ atkObject, int /*long*/ start_offset, int /*long*/ end_offset, int /*long*/ coord_type, int /*long*/ rect) {
if (DEBUG) print ("-->atkText_get_range_extents");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
event.start = (int)/*64*/start_offset;
event.end = (int)/*64*/end_offset;
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getTextBounds(event);
}
int[] topWindowX = new int [1], topWindowY = new int [1];
if (coord_type == ATK.ATK_XY_WINDOW) {
windowPoint (object, topWindowX, topWindowY);
event.x -= topWindowX [0];
event.y -= topWindowY [0];
}
AtkTextRectangle atkRect = new AtkTextRectangle();
atkRect.x = event.x;
atkRect.y = event.y;
atkRect.width = event.width;
atkRect.height = event.height;
ATK.memmove (rect, atkRect, AtkTextRectangle.sizeof);
return 0;
}
}
AtkTextIface iface = getTextIface (atkObject);
if (iface != null && iface.get_range_extents != 0) {
ATK.call (iface.get_range_extents, atkObject, start_offset, end_offset, coord_type, rect);
}
return 0;
}
static int /*long*/ atkText_get_run_attributes (int /*long*/ atkObject, int /*long*/ offset, int /*long*/ start_offset, int /*long*/ end_offset) {
if (DEBUG) print ("-->atkText_get_run_attributes");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleAttributeListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextAttributeEvent event = new AccessibleTextAttributeEvent(accessible);
event.offset = (int)/*64*/offset;
for (int i = 0; i < length; i++) {
AccessibleAttributeListener listener = (AccessibleAttributeListener) listeners.elementAt(i);
listener.getTextAttributes(event);
}
OS.memmove (start_offset, new int []{event.start}, 4);
OS.memmove (end_offset, new int []{event.end}, 4);
TextStyle style = event.textStyle;
if (style == null) return 0;
int /*long*/ result = 0;
AtkAttribute attr = new AtkAttribute();
if (style.rise != 0) {
int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof);
attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_RISE));
attr.value = getStringPtr (String.valueOf(style.rise));
ATK.memmove(attrPtr, attr, AtkAttribute.sizeof);
result = OS.g_list_append(result, attrPtr);
}
if (style.underline) {
int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof);
attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_UNDERLINE));
String str = "none";
switch (style.underlineStyle) {
case SWT.UNDERLINE_DOUBLE: str = "double"; break;
case SWT.UNDERLINE_SINGLE: str = "single"; break;
case SWT.UNDERLINE_ERROR: str = "error"; break;
case SWT.UNDERLINE_SQUIGGLE: str = "squiggle"; break;
}
attr.value = getStringPtr (str);
ATK.memmove(attrPtr, attr, AtkAttribute.sizeof);
result = OS.g_list_append(result, attrPtr);
}
if (style.strikeout) {
int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof);
attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_STRIKETHROUGH));
attr.value = getStringPtr ("1");
ATK.memmove(attrPtr, attr, AtkAttribute.sizeof);
result = OS.g_list_append(result, attrPtr);
}
Font font = style.font;
if (font != null && !font.isDisposed()) {
//TODO language and direction
int /*long*/ attrPtr;
attrPtr = OS.g_malloc(AtkAttribute.sizeof);
attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_FAMILY_NAME));
attr.value = ATK.g_strdup (OS.pango_font_description_get_family (font.handle));
ATK.memmove(attrPtr, attr, AtkAttribute.sizeof);
result = OS.g_list_append(result, attrPtr);
attrPtr = OS.g_malloc(AtkAttribute.sizeof);
attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_SIZE));
attr.value = getStringPtr (String.valueOf (OS.pango_font_description_get_size(font.handle) / OS.PANGO_SCALE));
ATK.memmove(attrPtr, attr, AtkAttribute.sizeof);
result = OS.g_list_append(result, attrPtr);
attrPtr = OS.g_malloc(AtkAttribute.sizeof);
attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_STYLE));
attr.value = ATK.g_strdup (ATK.atk_text_attribute_get_value(ATK.ATK_TEXT_ATTR_STYLE, OS.pango_font_description_get_style(font.handle)));
ATK.memmove(attrPtr, attr, AtkAttribute.sizeof);
result = OS.g_list_append(result, attrPtr);
attrPtr = OS.g_malloc(AtkAttribute.sizeof);
attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_VARIANT));
attr.value = ATK.g_strdup (ATK.atk_text_attribute_get_value(ATK.ATK_TEXT_ATTR_VARIANT, OS.pango_font_description_get_variant(font.handle)));
ATK.memmove(attrPtr, attr, AtkAttribute.sizeof);
result = OS.g_list_append(result, attrPtr);
attrPtr = OS.g_malloc(AtkAttribute.sizeof);
attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_STRETCH));
attr.value = ATK.g_strdup (ATK.atk_text_attribute_get_value(ATK.ATK_TEXT_ATTR_STRETCH, OS.pango_font_description_get_stretch(font.handle)));
ATK.memmove(attrPtr, attr, AtkAttribute.sizeof);
result = OS.g_list_append(result, attrPtr);
attrPtr = OS.g_malloc(AtkAttribute.sizeof);
attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_WEIGHT));
attr.value = getStringPtr (String.valueOf (OS.pango_font_description_get_weight(font.handle)));
ATK.memmove(attrPtr, attr, AtkAttribute.sizeof);
result = OS.g_list_append(result, attrPtr);
}
Color color = style.foreground;
if (color != null && !color.isDisposed()) {
int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof);
attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_FG_COLOR));
attr.value = getStringPtr ((color.handle.red & 0xFFFF) + "," + (color.handle.blue & 0xFFFF) + "," + (color.handle.blue & 0xFFFF));
ATK.memmove(attrPtr, attr, AtkAttribute.sizeof);
result = OS.g_list_append(result, attrPtr);
}
color = style.background;
if (color != null && !color.isDisposed()) {
int /*long*/ attrPtr = OS.g_malloc(AtkAttribute.sizeof);
attr.name = ATK.g_strdup (ATK.atk_text_attribute_get_name(ATK.ATK_TEXT_ATTR_BG_COLOR));
attr.value = getStringPtr ((color.handle.red & 0xFFFF) + "," + (color.handle.blue & 0xFFFF) + "," + (color.handle.blue & 0xFFFF));
ATK.memmove(attrPtr, attr, AtkAttribute.sizeof);
result = OS.g_list_append(result, attrPtr);
}
return result;
}
}
int /*long*/ parentResult = 0;
AtkTextIface iface = getTextIface (atkObject);
if (iface != null && iface.get_run_attributes != 0) {
parentResult = ATK.call (iface.get_run_attributes, atkObject, offset, start_offset, end_offset);
}
return parentResult;
}
static int /*long*/ atkText_get_offset_at_point (int /*long*/ atkObject, int /*long*/ x, int /*long*/ y, int /*long*/ coords) {
if (DEBUG) print ("-->atkText_get_offset_at_point");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
event.x = (int)/*64*/x;
event.y = (int)/*64*/y;
int[] topWindowX = new int [1], topWindowY = new int [1];
if (coords == ATK.ATK_XY_WINDOW) {
windowPoint (object, topWindowX, topWindowY);
event.x += topWindowX [0];
event.y += topWindowY [0];
}
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getOffsetAtPoint(event);
}
return event.offset;
}
}
int /*long*/ parentResult = 0;
AtkTextIface iface = getTextIface (atkObject);
if (iface != null && iface.get_offset_at_point != 0) {
parentResult = ATK.call (iface.get_offset_at_point, atkObject, x, y, coords);
}
return parentResult;
}
static int /*long*/ atkText_add_selection (int /*long*/ atkObject, int /*long*/ start_offset, int /*long*/ end_offset) {
if (DEBUG) print ("-->atkText_add_selection");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
event.start = (int)/*64*/start_offset;
event.end = (int)/*64*/end_offset;
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.addSelection(event);
}
//TODO should listener say it did or not
return 1;
}
}
int /*long*/ parentResult = 0;
AtkTextIface iface = getTextIface (atkObject);
if (iface != null && iface.add_selection != 0) {
parentResult = ATK.call (iface.add_selection, atkObject, start_offset, end_offset);
}
return parentResult;
}
static int /*long*/ atkText_remove_selection (int /*long*/ atkObject, int /*long*/ selection_num) {
if (DEBUG) print ("-->atkText_remove_selection");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
event.index = (int)/*64*/selection_num;
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.removeSelection(event);
}
//TODO should listener say it did or not
return 1;
}
}
int /*long*/ parentResult = 0;
AtkTextIface iface = getTextIface (atkObject);
if (iface != null && iface.remove_selection != 0) {
parentResult = ATK.call (iface.remove_selection, atkObject, selection_num);
}
return parentResult;
}
static int /*long*/ atkText_set_caret_offset (int /*long*/ atkObject, int /*long*/ offset) {
if (DEBUG) print ("-->atkText_gset_character_offset");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
event.offset = (int)/*64*/offset;
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.setCaretOffset(event);
}
//TODO should listener say it did or not
return 1;
}
}
AtkTextIface iface = getTextIface (atkObject);
if (iface != null && iface.get_character_at_offset != 0) {
return ATK.call (iface.get_character_at_offset, atkObject, offset);
}
return 0;
}
static int /*long*/ atkText_set_selection (int /*long*/ atkObject, int /*long*/ selection_num, int /*long*/ start_offset, int /*long*/ end_offset) {
if (DEBUG) print ("-->atkText_set_selection");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
event.index = (int)/*64*/selection_num;
event.start = (int)/*64*/start_offset;
event.end = (int)/*64*/end_offset;
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.setSelection(event);
}
//TODO should listener say it did or not
return 1;
}
}
int /*long*/ parentResult = 0;
AtkTextIface iface = getTextIface (atkObject);
if (iface != null && iface.set_selection != 0) {
parentResult = ATK.call (iface.set_selection, atkObject, selection_num, start_offset, end_offset);
}
return parentResult;
}
static int /*long*/ atkText_get_caret_offset (int /*long*/ atkObject) {
if (DEBUG) print ("-->atkText_get_caret_offset");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
AtkTextIface iface = getTextIface (atkObject);
if (iface != null && iface.get_caret_offset != 0) {
parentResult = ATK.call (iface.get_caret_offset, atkObject);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getCaretOffset (event);
}
return event.offset;
}
listeners = accessible.accessibleTextListeners;
length = listeners.size();
if (length > 0) {
AccessibleTextEvent event = new AccessibleTextEvent (object.accessible);
event.childID = object.id;
event.offset = (int)/*64*/parentResult;
for (int i = 0; i < length; i++) {
AccessibleTextListener listener = (AccessibleTextListener) listeners.elementAt(i);
listener.getCaretOffset (event);
}
return event.offset;
}
}
return parentResult;
}
static int /*long*/ atkText_get_bounded_ranges (int /*long*/ atkObject, int /*long*/ rect, int /*long*/ coord_type, int /*long*/ x_clip_type, int /*long*/ y_clip_type) {
if (DEBUG) print ("-->atkText_get_bounded_ranges");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
AtkTextRectangle atkRect = new AtkTextRectangle();
ATK.memmove (atkRect, rect, AtkTextRectangle.sizeof);
event.x = atkRect.x;
event.y = atkRect.y;
event.width = atkRect.width;
event.height = atkRect.height;
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getRanges (event);
}
int [] ranges = event.ranges;
int size = ranges == null ? 1 : ranges.length / 2;
int /*long*/ result = OS.malloc(size * AtkTextRange.sizeof);
AtkTextRange range = new AtkTextRange();
for (int j = 0, end = (ranges != null ? ranges.length / 2 : 1); j < end; j++) {
if (ranges != null) {
int index = j * 2;
event.start = ranges[index];
event.end = ranges[index+1];
}
event.count = 0;
event.type = ACC.TEXT_BOUNDARY_ALL;
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getText(event);
}
range.start_offset = event.start;
range.end_offset = event.end;
range.content = getStringPtr (event.result);
event.result = null;
event.count = event.type = event.x = event.y = event.width = event.height = 0;
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getTextBounds(event);
}
range.bounds.x = event.x;
range.bounds.y = event.y;
range.bounds.width = event.width;
range.bounds.height = event.height;
ATK.memmove(result + j * AtkTextRange.sizeof, range, AtkTextRange.sizeof);
}
return result;
}
}
int /*long*/ parentResult = 0;
AtkTextIface iface = getTextIface (atkObject);
if (iface != null && iface.get_bounded_ranges != 0) {
parentResult = ATK.call (iface.get_bounded_ranges, atkObject);
}
return parentResult;
}
static int /*long*/ atkText_get_character_at_offset (int /*long*/ atkObject, int /*long*/ offset) {
if (DEBUG) print ("-->atkText_get_character_at_offset");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
event.start = (int)/*64*/offset;
event.end = (int)/*64*/(offset + 1);
event.type = ACC.TEXT_BOUNDARY_CHAR;
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getText(event);
}
String text = event.result;
if (text != null && text.length() > 0) return text.charAt(0);
}
String text = object.getText ();
if (text != null) return text.charAt ((int)/*64*/offset);
}
AtkTextIface iface = getTextIface (atkObject);
if (iface != null && iface.get_character_at_offset != 0) {
return ATK.call (iface.get_character_at_offset, atkObject, offset);
}
return 0;
}
static int /*long*/ atkText_get_character_count (int /*long*/ atkObject) {
if (DEBUG) print ("-->atkText_get_character_count");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getCharacterCount(event);
}
return event.count;
}
String text = object.getText ();
if (text != null) return text.length ();
}
AtkTextIface iface = getTextIface (atkObject);
if (iface != null && iface.get_character_count != 0) {
return ATK.call (iface.get_character_count, atkObject);
}
return 0;
}
static int /*long*/ atkText_get_n_selections (int /*long*/ atkObject) {
if (DEBUG) print ("-->atkText_get_n_selections");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getSelectionCount (event);
}
return event.count;
}
listeners = accessible.accessibleTextListeners;
length = listeners.size();
if (length > 0) {
AccessibleTextEvent event = new AccessibleTextEvent (object.accessible);
event.childID = object.id;
for (int i = 0; i < length; i++) {
AccessibleTextListener listener = (AccessibleTextListener) listeners.elementAt(i);
listener.getSelectionRange (event);
}
if (event.length > 0) return 1;
}
}
int /*long*/ parentResult = 0;
AtkTextIface iface = getTextIface (atkObject);
if (iface != null && iface.get_n_selections != 0) {
parentResult = ATK.call (iface.get_n_selections, atkObject);
}
return parentResult;
}
static int /*long*/ atkText_get_selection (int /*long*/ atkObject, int /*long*/ selection_num, int /*long*/ start_offset, int /*long*/ end_offset) {
if (DEBUG) print ("-->atkText_get_selection");
AccessibleObject object = getAccessibleObject (atkObject);
int /*long*/ parentResult = 0;
OS.memmove (start_offset, new int[] {0}, 4);
OS.memmove (end_offset, new int[] {0}, 4);
AtkTextIface iface = getTextIface (atkObject);
if (iface != null && iface.get_selection != 0) {
parentResult = ATK.call (iface.get_selection, atkObject, selection_num, start_offset, end_offset);
}
if (object != null) {
int[] parentStart = new int [1];
int[] parentEnd = new int [1];
OS.memmove (parentStart, start_offset, 4);
OS.memmove (parentEnd, end_offset, 4);
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
event.index = (int)/*64*/selection_num;
event.start = parentStart[0];
event.end = parentEnd[0];
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getSelection (event);
}
parentStart [0] = event.start;
parentEnd [0] = event.end;
OS.memmove (start_offset, parentStart, 4);
OS.memmove (end_offset, parentEnd, 4);
event.count = event.index = 0;
event.type = ACC.TEXT_BOUNDARY_ALL;
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getText(event);
}
return getStringPtr (event.result);
}
if (selection_num == 0) {
listeners = accessible.accessibleTextListeners;
length = listeners.size();
if (length > 0) {
AccessibleTextEvent event = new AccessibleTextEvent (accessible);
event.childID = object.id;
event.offset = parentStart [0];
event.length = parentEnd [0] - parentStart [0];
for (int i = 0; i < length; i++) {
AccessibleTextListener listener = (AccessibleTextListener) listeners.elementAt(i);
listener.getSelectionRange (event);
}
OS.memmove (start_offset, new int[] {event.offset}, 4);
OS.memmove (end_offset, new int[] {event.offset + event.length}, 4);
//TODO return the selected text, should we free parent result
return 0;
}
}
}
return parentResult;
}
static int /*long*/ atkText_get_text (int /*long*/ atkObject, int /*long*/ start_offset, int /*long*/ end_offset) {
if (DEBUG) print ("-->atkText_get_text: " + atkObject + " " + start_offset + "," + end_offset);
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
event.start = (int)/*64*/start_offset;
event.end = (int)/*64*/end_offset;
event.type = ACC.TEXT_BOUNDARY_ALL;
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getText(event);
}
return getStringPtr (event.result);
}
String text = object.getText ();
if (text != null && text.length () > 0) {
if (end_offset == -1) {
end_offset = text.length ();
} else {
end_offset = Math.min (end_offset, text.length ());
}
start_offset = Math.min (start_offset, end_offset);
text = text.substring ((int)/*64*/start_offset, (int)/*64*/end_offset);
return getStringPtr (text);
}
}
return 0;
}
static int /*long*/ atkText_get_text_after_offset (int /*long*/ atkObject, int /*long*/ offset_value, int /*long*/ boundary_type, int /*long*/ start_offset, int /*long*/ end_offset) {
if (DEBUG) print ("-->atkText_get_text_after_offset");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
event.start = event.end = (int)/*64*/offset_value;
event.count = 1;
switch ((int)/*64*/boundary_type) {
case ATK.ATK_TEXT_BOUNDARY_CHAR: event.type = ACC.TEXT_BOUNDARY_CHAR; break;
case ATK.ATK_TEXT_BOUNDARY_WORD_START: event.type = ACC.TEXT_BOUNDARY_WORD; break;
case ATK.ATK_TEXT_BOUNDARY_WORD_END: event.type = ACC.TEXT_BOUNDARY_WORD; break;
case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break;
case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break;
case ATK.ATK_TEXT_BOUNDARY_LINE_START: event.type = ACC.TEXT_BOUNDARY_LINE; break;
case ATK.ATK_TEXT_BOUNDARY_LINE_END: event.type = ACC.TEXT_BOUNDARY_LINE; break;
}
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getText(event);
}
OS.memmove (start_offset, new int[] {event.start}, 4);
OS.memmove (end_offset, new int[] {event.end}, 4);
return getStringPtr (event.result);
}
int offset = (int)/*64*/offset_value;
String text = object.getText ();
if (text != null && text.length () > 0) {
length = text.length ();
offset = Math.min (offset, length - 1);
int startBounds = offset;
int endBounds = offset;
switch ((int)/*64*/boundary_type) {
case ATK.ATK_TEXT_BOUNDARY_CHAR: {
if (length > offset) endBounds++;
break;
}
case ATK.ATK_TEXT_BOUNDARY_WORD_START: {
int wordStart1 = nextIndexOfChar (text, " !?.\n", offset - 1);
if (wordStart1 == -1) {
startBounds = endBounds = length;
break;
}
wordStart1 = nextIndexOfNotChar (text, " !?.\n", wordStart1);
if (wordStart1 == length) {
startBounds = endBounds = length;
break;
}
startBounds = wordStart1;
int wordStart2 = nextIndexOfChar (text, " !?.\n", wordStart1);
if (wordStart2 == -1) {
endBounds = length;
break;
}
endBounds = nextIndexOfNotChar (text, " !?.\n", wordStart2);
break;
}
case ATK.ATK_TEXT_BOUNDARY_WORD_END: {
int previousWordEnd = previousIndexOfNotChar (text, " \n", offset);
if (previousWordEnd == -1 || previousWordEnd != offset - 1) {
offset = nextIndexOfNotChar (text, " \n", offset);
}
if (offset == -1) {
startBounds = endBounds = length;
break;
}
int wordEnd1 = nextIndexOfChar (text, " !?.\n", (int)/*64*/offset);
if (wordEnd1 == -1) {
startBounds = endBounds = length;
break;
}
wordEnd1 = nextIndexOfNotChar (text, "!?.", wordEnd1);
if (wordEnd1 == length) {
startBounds = endBounds = length;
break;
}
startBounds = wordEnd1;
int wordEnd2 = nextIndexOfNotChar (text, " \n", wordEnd1);
if (wordEnd2 == length) {
startBounds = endBounds = length;
break;
}
wordEnd2 = nextIndexOfChar (text, " !?.\n", wordEnd2);
if (wordEnd2 == -1) {
endBounds = length;
break;
}
endBounds = nextIndexOfNotChar (text, "!?.", wordEnd2);
break;
}
case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: {
int previousSentenceEnd = previousIndexOfChar (text, "!?.", offset);
int previousText = previousIndexOfNotChar (text, " !?.\n", offset);
int sentenceStart1 = 0;
if (previousSentenceEnd >= previousText) {
sentenceStart1 = nextIndexOfNotChar (text, " !?.\n", offset);
} else {
sentenceStart1 = nextIndexOfChar (text, "!?.", offset);
if (sentenceStart1 == -1) {
startBounds = endBounds = length;
break;
}
sentenceStart1 = nextIndexOfNotChar (text, " !?.\n", sentenceStart1);
}
if (sentenceStart1 == length) {
startBounds = endBounds = length;
break;
}
startBounds = sentenceStart1;
int sentenceStart2 = nextIndexOfChar (text, "!?.", sentenceStart1);
if (sentenceStart2 == -1) {
endBounds = length;
break;
}
endBounds = nextIndexOfNotChar (text, " !?.\n", sentenceStart2);
break;
}
case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: {
int sentenceEnd1 = nextIndexOfChar (text, "!?.", offset);
if (sentenceEnd1 == -1) {
startBounds = endBounds = length;
break;
}
sentenceEnd1 = nextIndexOfNotChar (text, "!?.", sentenceEnd1);
if (sentenceEnd1 == length) {
startBounds = endBounds = length;
break;
}
startBounds = sentenceEnd1;
int sentenceEnd2 = nextIndexOfNotChar (text, " \n", sentenceEnd1);
if (sentenceEnd2 == length) {
startBounds = endBounds = length;
break;
}
sentenceEnd2 = nextIndexOfChar (text, "!?.", sentenceEnd2);
if (sentenceEnd2 == -1) {
endBounds = length;
break;
}
endBounds = nextIndexOfNotChar (text, "!?.", sentenceEnd2);
break;
}
case ATK.ATK_TEXT_BOUNDARY_LINE_START: {
int lineStart1 = text.indexOf ('\n', offset - 1);
if (lineStart1 == -1) {
startBounds = endBounds = length;
break;
}
lineStart1 = nextIndexOfNotChar (text, "\n", lineStart1);
if (lineStart1 == length) {
startBounds = endBounds = length;
break;
}
startBounds = lineStart1;
int lineStart2 = text.indexOf ('\n', lineStart1);
if (lineStart2 == -1) {
endBounds = length;
break;
}
lineStart2 = nextIndexOfNotChar (text, "\n", lineStart2);
endBounds = lineStart2;
break;
}
case ATK.ATK_TEXT_BOUNDARY_LINE_END: {
int lineEnd1 = nextIndexOfChar (text, "\n", offset);
if (lineEnd1 == -1) {
startBounds = endBounds = length;
break;
}
startBounds = lineEnd1;
if (startBounds == length) {
endBounds = length;
break;
}
int lineEnd2 = nextIndexOfChar (text, "\n", lineEnd1 + 1);
if (lineEnd2 == -1) {
endBounds = length;
break;
}
endBounds = lineEnd2;
break;
}
}
OS.memmove (start_offset, new int[] {startBounds}, 4);
OS.memmove (end_offset, new int[] {endBounds}, 4);
text = text.substring (startBounds, endBounds);
return getStringPtr (text);
}
}
return 0;
}
static int /*long*/ atkText_get_text_at_offset (int /*long*/ atkObject, int /*long*/ offset_value, int /*long*/ boundary_type, int /*long*/ start_offset, int /*long*/ end_offset) {
if (DEBUG) print ("-->atkText_get_text_at_offset: " + offset_value + " start: " + start_offset + " end: " + end_offset);
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
event.start = event.end = (int)/*64*/offset_value;
event.count = 0;
switch ((int)/*64*/boundary_type) {
case ATK.ATK_TEXT_BOUNDARY_CHAR: event.type = ACC.TEXT_BOUNDARY_CHAR; break;
case ATK.ATK_TEXT_BOUNDARY_WORD_START: event.type = ACC.TEXT_BOUNDARY_WORD; break;
case ATK.ATK_TEXT_BOUNDARY_WORD_END: event.type = ACC.TEXT_BOUNDARY_WORD; break;
case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break;
case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break;
case ATK.ATK_TEXT_BOUNDARY_LINE_START: event.type = ACC.TEXT_BOUNDARY_LINE; break;
case ATK.ATK_TEXT_BOUNDARY_LINE_END: event.type = ACC.TEXT_BOUNDARY_LINE; break;
}
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getText(event);
}
OS.memmove (start_offset, new int[] {event.start}, 4);
OS.memmove (end_offset, new int[] {event.end}, 4);
return getStringPtr (event.result);
}
int offset = (int)/*64*/offset_value;
String text = object.getText ();
if (text != null && text.length () > 0) {
length = text.length ();
offset = Math.min (offset, length - 1);
int startBounds = offset;
int endBounds = offset;
switch ((int)/*64*/boundary_type) {
case ATK.ATK_TEXT_BOUNDARY_CHAR: {
if (length > offset) endBounds++;
break;
}
case ATK.ATK_TEXT_BOUNDARY_WORD_START: {
int wordStart1 = previousIndexOfNotChar (text, " !?.\n", offset);
if (wordStart1 == -1) {
startBounds = endBounds = 0;
break;
}
wordStart1 = previousIndexOfChar (text, " !?.\n", wordStart1) + 1;
if (wordStart1 == -1) {
startBounds = 0;
break;
}
startBounds = wordStart1;
int wordStart2 = nextIndexOfChar (text, " !?.\n", wordStart1);
endBounds = nextIndexOfNotChar (text, " !?.\n", wordStart2);
break;
}
case ATK.ATK_TEXT_BOUNDARY_WORD_END: {
int wordEnd1 = previousIndexOfNotChar (text, "!?.", offset + 1);
wordEnd1 = previousIndexOfChar (text, " !?.\n", wordEnd1);
wordEnd1 = previousIndexOfNotChar (text, " \n", wordEnd1 + 1);
if (wordEnd1 == -1) {
startBounds = endBounds = 0;
break;
}
startBounds = wordEnd1 + 1;
int wordEnd2 = nextIndexOfNotChar (text, " \n", startBounds);
if (wordEnd2 == length) {
endBounds = startBounds;
break;
}
wordEnd2 = nextIndexOfChar (text, " !?.\n", wordEnd2);
if (wordEnd2 == -1) {
endBounds = startBounds;
break;
}
endBounds = nextIndexOfNotChar (text, "!?.", wordEnd2);
break;
}
case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: {
int sentenceStart1 = previousIndexOfNotChar (text, " !?.\n", offset + 1);
if (sentenceStart1 == -1) {
startBounds = endBounds = 0;
break;
}
sentenceStart1 = previousIndexOfChar (text, "!?.", sentenceStart1) + 1;
startBounds = nextIndexOfNotChar (text, " \n", sentenceStart1);
int sentenceStart2 = nextIndexOfChar (text, "!?.", startBounds);
endBounds = nextIndexOfNotChar (text, " !?.\n", sentenceStart2);
break;
}
case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: {
int sentenceEnd1 = previousIndexOfNotChar (text, "!?.", offset + 1);
sentenceEnd1 = previousIndexOfChar (text, "!?.", sentenceEnd1);
sentenceEnd1 = previousIndexOfNotChar (text, " \n", sentenceEnd1 + 1);
if (sentenceEnd1 == -1) {
startBounds = endBounds = 0;
break;
}
startBounds = sentenceEnd1 + 1;
int sentenceEnd2 = nextIndexOfNotChar (text, " \n", startBounds);
if (sentenceEnd2 == length) {
endBounds = startBounds;
break;
}
sentenceEnd2 = nextIndexOfChar (text, "!?.", sentenceEnd2);
if (sentenceEnd2 == -1) {
endBounds = startBounds;
break;
}
endBounds = nextIndexOfNotChar (text, "!?.", sentenceEnd2);
break;
}
case ATK.ATK_TEXT_BOUNDARY_LINE_START: {
startBounds = previousIndexOfChar (text, "\n", offset) + 1;
int lineEnd2 = nextIndexOfChar (text, "\n", startBounds);
if (lineEnd2 < length) lineEnd2++;
endBounds = lineEnd2;
break;
}
case ATK.ATK_TEXT_BOUNDARY_LINE_END: {
int lineEnd1 = previousIndexOfChar (text, "\n", offset);
if (lineEnd1 == -1) {
startBounds = endBounds = 0;
break;
}
startBounds = lineEnd1;
endBounds = nextIndexOfChar (text, "\n", lineEnd1 + 1);
}
}
OS.memmove (start_offset, new int[] {startBounds}, 4);
OS.memmove (end_offset, new int[] {endBounds}, 4);
text = text.substring (startBounds, endBounds);
return getStringPtr (text);
}
}
return 0;
}
static int /*long*/ atkText_get_text_before_offset (int /*long*/ atkObject, int /*long*/ offset_value, int /*long*/ boundary_type, int /*long*/ start_offset, int /*long*/ end_offset) {
if (DEBUG) print ("-->atkText_get_text_before_offset");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleTextExtendedListeners;
int length = listeners.size();
if (length > 0) {
AccessibleTextExtendedEvent event = new AccessibleTextExtendedEvent(accessible);
event.start = event.end = (int)/*64*/offset_value;
event.count = -1;
switch ((int)/*64*/boundary_type) {
case ATK.ATK_TEXT_BOUNDARY_CHAR: event.type = ACC.TEXT_BOUNDARY_CHAR; break;
case ATK.ATK_TEXT_BOUNDARY_WORD_START: event.type = ACC.TEXT_BOUNDARY_WORD; break;
case ATK.ATK_TEXT_BOUNDARY_WORD_END: event.type = ACC.TEXT_BOUNDARY_WORD; break;
case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break;
case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: event.type = ACC.TEXT_BOUNDARY_SENTENCE; break;
case ATK.ATK_TEXT_BOUNDARY_LINE_START: event.type = ACC.TEXT_BOUNDARY_LINE; break;
case ATK.ATK_TEXT_BOUNDARY_LINE_END: event.type = ACC.TEXT_BOUNDARY_LINE; break;
}
for (int i = 0; i < length; i++) {
AccessibleTextExtendedListener listener = (AccessibleTextExtendedListener) listeners.elementAt(i);
listener.getText(event);
}
OS.memmove (start_offset, new int[] {event.start}, 4);
OS.memmove (end_offset, new int[] {event.end}, 4);
return getStringPtr (event.result);
}
int offset = (int)/*64*/offset_value;
String text = object.getText ();
if (text != null && text.length () > 0) {
length = text.length ();
offset = Math.min (offset, length - 1);
int startBounds = offset;
int endBounds = offset;
switch ((int)/*64*/boundary_type) {
case ATK.ATK_TEXT_BOUNDARY_CHAR: {
if (length >= offset && offset > 0) startBounds--;
break;
}
case ATK.ATK_TEXT_BOUNDARY_WORD_START: {
int wordStart1 = previousIndexOfChar (text, " !?.\n", offset - 1);
if (wordStart1 == -1) {
startBounds = endBounds = 0;
break;
}
int wordStart2 = previousIndexOfNotChar (text, " !?.\n", wordStart1);
if (wordStart2 == -1) {
startBounds = endBounds = 0;
break;
}
endBounds = wordStart1 + 1;
startBounds = previousIndexOfChar (text, " !?.\n", wordStart2) + 1;
break;
}
case ATK.ATK_TEXT_BOUNDARY_WORD_END: {
int wordEnd1 =previousIndexOfChar (text, " !?.\n", offset);
if (wordEnd1 == -1) {
startBounds = endBounds = 0;
break;
}
wordEnd1 = previousIndexOfNotChar (text, " \n", wordEnd1 + 1);
if (wordEnd1 == -1) {
startBounds = endBounds = 0;
break;
}
endBounds = wordEnd1 + 1;
int wordEnd2 = previousIndexOfNotChar (text, " !?.\n", endBounds);
wordEnd2 = previousIndexOfChar (text, " !?.\n", wordEnd2);
if (wordEnd2 == -1) {
startBounds = 0;
break;
}
startBounds = previousIndexOfNotChar (text, " \n", wordEnd2 + 1) + 1;
break;
}
case ATK.ATK_TEXT_BOUNDARY_SENTENCE_START: {
int sentenceStart1 = previousIndexOfChar (text, "!?.", offset);
if (sentenceStart1 == -1) {
startBounds = endBounds = 0;
break;
}
int sentenceStart2 = previousIndexOfNotChar (text, "!?.", sentenceStart1);
if (sentenceStart2 == -1) {
startBounds = endBounds = 0;
break;
}
endBounds = sentenceStart1 + 1;
startBounds = previousIndexOfChar (text, "!?.", sentenceStart2) + 1;
break;
}
case ATK.ATK_TEXT_BOUNDARY_SENTENCE_END: {
int sentenceEnd1 = previousIndexOfChar (text, "!?.", offset);
if (sentenceEnd1 == -1) {
startBounds = endBounds = 0;
break;
}
sentenceEnd1 = previousIndexOfNotChar (text, " \n", sentenceEnd1 + 1);
if (sentenceEnd1 == -1) {
startBounds = endBounds = 0;
break;
}
endBounds = sentenceEnd1 + 1;
int sentenceEnd2 = previousIndexOfNotChar (text, "!?.", endBounds);
sentenceEnd2 = previousIndexOfChar (text, "!?.", sentenceEnd2);
if (sentenceEnd2 == -1) {
startBounds = 0;
break;
}
startBounds = previousIndexOfNotChar (text, " \n", sentenceEnd2 + 1) + 1;
break;
}
case ATK.ATK_TEXT_BOUNDARY_LINE_START: {
int lineStart1 = previousIndexOfChar (text, "\n", offset);
if (lineStart1 == -1) {
startBounds = endBounds = 0;
break;
}
endBounds = lineStart1 + 1;
startBounds = previousIndexOfChar (text, "\n", lineStart1) + 1;
break;
}
case ATK.ATK_TEXT_BOUNDARY_LINE_END: {
int lineEnd1 = previousIndexOfChar (text, "\n", offset);
if (lineEnd1 == -1) {
startBounds = endBounds = 0;
break;
}
endBounds = lineEnd1;
startBounds = previousIndexOfChar (text, "\n", lineEnd1);
if (startBounds == -1) startBounds = 0;
break;
}
}
OS.memmove (start_offset, new int[] {startBounds}, 4);
OS.memmove (end_offset, new int[] {endBounds}, 4);
text = text.substring (startBounds, endBounds);
return getStringPtr (text);
}
}
return 0;
}
static void setGValue (int /*long*/ value, Number number) {
if (number == null) return;
OS.g_value_unset(value);
if (number instanceof Double) {
OS.g_value_init(value, OS.G_TYPE_DOUBLE());
OS.g_value_set_double(value, number.doubleValue());
} else if (number instanceof Float) {
OS.g_value_init(value, OS.G_TYPE_FLOAT());
OS.g_value_set_float(value, number.floatValue());
} else if (number instanceof Long) {
OS.g_value_init(value, OS.G_TYPE_INT64());
OS.g_value_set_int64(value, number.longValue());
} else {
OS.g_value_init(value, OS.G_TYPE_INT());
OS.g_value_set_int(value, number.intValue());
}
}
static Number getGValue (int /*long*/ value) {
int /*long*/ type = OS.G_VALUE_TYPE(value);
if (type == 0) return null;
if (type == OS.G_TYPE_DOUBLE()) return new Double(OS.g_value_get_double(value));
if (type == OS.G_TYPE_FLOAT()) return new Float(OS.g_value_get_float(value));
if (type == OS.G_TYPE_INT64()) return new Long(OS.g_value_get_int64(value));
return new Integer(OS.g_value_get_int(value));
}
static AtkValueIface getValueIface (int /*long*/ atkObject) {
if (ATK.g_type_is_a (OS.g_type_parent (OS.G_OBJECT_TYPE (atkObject)), ATK.ATK_TYPE_VALUE())) {
AtkValueIface iface = new AtkValueIface ();
ATK.memmove (iface, ATK.g_type_interface_peek_parent (ATK.ATK_VALUE_GET_IFACE (atkObject)));
return iface;
}
return null;
}
static int /*long*/ atkValue_get_current_value (int /*long*/ atkObject, int /*long*/ value) {
if (DEBUG) print ("-->atkValue_get_current_value");
AccessibleObject object = getAccessibleObject (atkObject);
AtkValueIface iface = getValueIface (atkObject);
if (iface != null && iface.get_current_value != 0) {
ATK.call (iface.get_current_value, atkObject, value);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleValueListeners;
AccessibleValueEvent event = new AccessibleValueEvent(accessible);
event.value = getGValue(value);
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleValueListener listener = (AccessibleValueListener) listeners.elementAt(i);
listener.getCurrentValue(event);
}
setGValue(value, event.value);
}
return 0;
}
static int /*long*/ atkValue_get_maximum_value (int /*long*/ atkObject, int /*long*/ value) {
if (DEBUG) print ("-->atkValue_get_maximum_value");
AccessibleObject object = getAccessibleObject (atkObject);
AtkValueIface iface = getValueIface (atkObject);
if (iface != null && iface.get_maximum_value != 0) {
ATK.call (iface.get_maximum_value, atkObject, value);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleValueListeners;
AccessibleValueEvent event = new AccessibleValueEvent(accessible);
event.value = getGValue(value);
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleValueListener listener = (AccessibleValueListener) listeners.elementAt(i);
listener.getMaximumValue(event);
}
setGValue(value, event.value);
}
return 0;
}
static int /*long*/ atkValue_get_minimum_value (int /*long*/ atkObject, int /*long*/ value) {
if (DEBUG) print ("-->atkValue_get_minimum_value");
AccessibleObject object = getAccessibleObject (atkObject);
AtkValueIface iface = getValueIface (atkObject);
if (iface != null && iface.get_minimum_value != 0) {
ATK.call (iface.get_minimum_value, atkObject, value);
}
if (object != null) {
Accessible accessible = object.accessible;
Vector listeners = accessible.accessibleValueListeners;
AccessibleValueEvent event = new AccessibleValueEvent(accessible);
event.value = getGValue(value);
for (int i = 0, length = listeners.size(); i < length; i++) {
AccessibleValueListener listener = (AccessibleValueListener) listeners.elementAt(i);
listener.getMinimumValue(event);
}
setGValue(value, event.value);
}
return 0;
}
static int /*long*/ atkValue_set_current_value (int /*long*/ atkObject, int /*long*/ value) {
if (DEBUG) print ("-->atkValue_set_current_value");
AccessibleObject object = getAccessibleObject (atkObject);
if (object != null) {
Accessible accessible = object.accessible;
if (accessible != null) {
Vector listeners = accessible.accessibleValueListeners;
int length = listeners.size();
if (length > 0) {
AccessibleValueEvent event = new AccessibleValueEvent(accessible);
event.value = getGValue(value);
for (int i = 0; i < length; i++) {
AccessibleValueListener listener = (AccessibleValueListener) listeners.elementAt(i);
listener.setCurrentValue(event);
}
return 0;
}
}
}
int /*long*/ parentResult = 0;
AtkValueIface iface = getValueIface (atkObject);
if (iface != null && iface.set_current_value != 0) {
parentResult = ATK.call (iface.set_current_value, atkObject, value);
}
return parentResult;
}
static AccessibleObject getAccessibleObject (int /*long*/ atkObject) {
AccessibleObject object = (AccessibleObject)AccessibleObjects.get (new LONG (atkObject));
if (object == null) return null;
if (object.accessible == null) return null;
Control control = object.accessible.control;
if (control == null || control.isDisposed()) return null;
return object;
}
AccessibleObject getChildByID (int childId) {
if (childId == ACC.CHILDID_SELF) return this;
if (childId == ACC.CHILDID_NONE || childId == ACC.CHILDID_MULTIPLE) return null;
if (children != null) {
for (int i = 0; i < children.length; i++) {
if (children[i] != null && children[i].id == childId) return children [0];
}
}
return null;
}
AccessibleObject getChildByIndex (int childIndex) {
if (children != null && childIndex < children.length) return children [childIndex];
return null;
}
String getText () {
int /*long*/ parentResult = 0;
String parentText = ""; //$NON-NLS-1$
AtkTextIface iface = getTextIface (handle);
if (iface != null && iface.get_character_count != 0) {
int /*long*/ characterCount = ATK.call (iface.get_character_count, handle);
if (characterCount > 0 && iface.get_text != 0) {
parentResult = ATK.call (iface.get_text, handle, 0, characterCount);
if (parentResult != 0) {
parentText = getString (parentResult);
OS.g_free(parentResult);
}
}
}
Vector listeners = accessible.accessibleControlListeners;
int length = listeners.size();
if (length > 0) {
AccessibleControlEvent event = new AccessibleControlEvent (accessible);
event.childID = id;
event.result = parentText;
for (int i = 0; i < length; i++) {
AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i);
listener.getValue (event);
}
return event.result;
}
return null;
}
static int /*long*/ gObjectClass_finalize (int /*long*/ atkObject) {
if (DEBUG) print ("-->gObjectClass_finalize: " + atkObject);
int /*long*/ superType = ATK.g_type_class_peek_parent (ATK.G_OBJECT_GET_CLASS (atkObject));
int /*long*/ gObjectClass = ATK.G_OBJECT_CLASS (superType);
GObjectClass objectClassStruct = new GObjectClass ();
ATK.memmove (objectClassStruct, gObjectClass);
ATK.call (objectClassStruct.finalize, atkObject);
AccessibleObject object = (AccessibleObject)AccessibleObjects.get (new LONG (atkObject));
if (object != null) {
AccessibleObjects.remove (new LONG (atkObject));
}
return 0;
}
static int toATKRelation (int relation) {
switch (relation) {
case ACC.RELATION_CONTROLLED_BY: return ATK.ATK_RELATION_CONTROLLED_BY;
case ACC.RELATION_CONTROLLER_FOR: return ATK.ATK_RELATION_CONTROLLER_FOR;
case ACC.RELATION_DESCRIBED_BY: return ATK.ATK_RELATION_DESCRIBED_BY;
case ACC.RELATION_DESCRIPTION_FOR: return ATK.ATK_RELATION_DESCRIPTION_FOR;
case ACC.RELATION_EMBEDDED_BY: return ATK.ATK_RELATION_EMBEDDED_BY;
case ACC.RELATION_EMBEDS: return ATK.ATK_RELATION_EMBEDS;
case ACC.RELATION_FLOWS_FROM: return ATK.ATK_RELATION_FLOWS_FROM;
case ACC.RELATION_FLOWS_TO: return ATK.ATK_RELATION_FLOWS_TO;
case ACC.RELATION_LABEL_FOR: return ATK.ATK_RELATION_LABEL_FOR;
case ACC.RELATION_LABELLED_BY: return ATK.ATK_RELATION_LABELLED_BY;
case ACC.RELATION_MEMBER_OF: return ATK.ATK_RELATION_MEMBER_OF;
case ACC.RELATION_NODE_CHILD_OF: return ATK.ATK_RELATION_NODE_CHILD_OF;
case ACC.RELATION_PARENT_WINDOW_OF: return ATK.ATK_RELATION_PARENT_WINDOW_OF;
case ACC.RELATION_POPUP_FOR: return ATK.ATK_RELATION_POPUP_FOR;
case ACC.RELATION_SUBWINDOW_OF: return ATK.ATK_RELATION_SUBWINDOW_OF;
}
return 0;
}
static void windowPoint (AccessibleObject object, int [] x, int [] y) {
GtkAccessible gtkAccessible = new GtkAccessible ();
ATK.memmove (gtkAccessible, object.handle);
while (gtkAccessible.widget == 0 && object.parent != null) {
object = object.parent;
ATK.memmove (gtkAccessible, object.handle);
}
if (gtkAccessible.widget == 0) return;
int /*long*/ topLevel = ATK.gtk_widget_get_toplevel (gtkAccessible.widget);
int /*long*/ window = OS.GTK_WIDGET_WINDOW (topLevel);
OS.gdk_window_get_origin (window, x, y);
}
static int nextIndexOfChar (String string, String searchChars, int startIndex) {
int result = string.length ();
for (int i = 0; i < searchChars.length (); i++) {
char current = searchChars.charAt (i);
int index = string.indexOf (current, startIndex);
if (index != -1) result = Math.min (result, index);
}
return result;
}
static int nextIndexOfNotChar (String string, String searchChars, int startIndex) {
int length = string.length ();
int index = startIndex;
while (index < length) {
char current = string.charAt (index);
if (searchChars.indexOf (current) == -1) break;
index++;
}
return index;
}
static int previousIndexOfChar (String string, String searchChars, int startIndex) {
int result = -1;
if (startIndex < 0) return result;
string = string.substring (0, startIndex);
for (int i = 0; i < searchChars.length (); i++) {
char current = searchChars.charAt (i);
int index = string.lastIndexOf (current);
if (index != -1) result = Math.max (result, index);
}
return result;
}
static int previousIndexOfNotChar (String string, String searchChars, int startIndex) {
if (startIndex < 0) return -1;
int index = startIndex - 1;
while (index >= 0) {
char current = string.charAt (index);
if (searchChars.indexOf (current) == -1) break;
index--;
}
return index;
}
void addRelation (int type, Accessible target) {
OS.atk_object_add_relationship(handle, toATKRelation(type), target.getAccessibleObject().handle);
}
void release () {
if (DEBUG) print("AccessibleObject.release: " + handle);
accessible = null;
if (children != null) {
for (int i = 0; i < children.length; i++) {
AccessibleObject child = children [i];
if (child != null) OS.g_object_unref(child.handle);
}
children = null;
}
// TODO remove from children from parent?
if (isLightweight) {
OS.g_object_unref(handle);
}
}
void removeRelation (int type, Accessible target) {
OS.atk_object_remove_relationship (handle, toATKRelation(type), target.getAccessibleObject().handle);
}
void selectionChanged () {
OS.g_signal_emit_by_name (handle, ATK.selection_changed);
}
void setFocus (int childID) {
updateChildren ();
AccessibleObject accObject = getChildByID (childID);
if (accObject != null) {
ATK.atk_focus_tracker_notify (accObject.handle);
}
}
void textCaretMoved(int index) {
OS.g_signal_emit_by_name (handle, ATK.text_caret_moved, index);
}
void textChanged(int type, int startIndex, int length) {
if (type == ACC.TEXT_DELETE) {
OS.g_signal_emit_by_name (handle, ATK.text_changed_delete, startIndex, length);
} else {
OS.g_signal_emit_by_name (handle, ATK.text_changed_insert, startIndex, length);
}
}
void textSelectionChanged() {
OS.g_signal_emit_by_name (handle, ATK.text_selection_changed);
}
void updateChildren () {
Vector listeners = accessible.accessibleControlListeners;
int length = listeners.size();
AccessibleControlEvent event = new AccessibleControlEvent (accessible);
event.childID = id;
for (int i = 0; i < length; i++) {
AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (i);
listener.getChildren (event);
}
Object[] children = event.children;
AccessibleObject[] oldChildren = this.children;
int count = children != null ? children.length : 0;
AccessibleObject[] newChildren = new AccessibleObject[count];
for (int i = 0; i < count; i++) {
Object child = children [i];
AccessibleObject object = null;
if (child instanceof Integer) {
int id = ((Integer)child).intValue();
object = oldChildren != null && i < oldChildren.length ? oldChildren [i] : null;
if (object == null || object.id != id) {
event = new AccessibleControlEvent (accessible);
event.childID = id;
for (int j = 0; j < length; j++) {
AccessibleControlListener listener = (AccessibleControlListener)listeners.elementAt (j);
listener.getChild (event);
}
if (event.accessible != null) {
object = event.accessible.getAccessibleObject();
if (object != null) OS.g_object_ref(object.handle);
} else {
object = AccessibleFactory.createChildAccessible (accessible, id);
}
object.id = id;
} else {
OS.g_object_ref(object.handle);
}
} else if (child instanceof Accessible) {
object = ((Accessible)child).getAccessibleObject();
if (object != null) OS.g_object_ref(object.handle);
}
if (object != null) {
object.index = i;
object.parent = this;
newChildren[i] = object;
}
}
if (oldChildren != null) {
for (int i = 0; i < oldChildren.length; i++) {
AccessibleObject object = oldChildren [i];
if (object != null) OS.g_object_unref(object.handle);
}
}
this.children = newChildren;
}
}
| [
"375833274@qq.com"
] | 375833274@qq.com |
6508830993a7dc47caaceefb510aaa794956f0a8 | 7a227ec06841676eb0eec188612224051b1918b9 | /Week_12/sunday/code/rabbitmq-demo/springboot-cluster/src/main/java/com/xiaowenhou/springboot/cluster/producer/ProducerController.java | 02ec0c1ad5c580169c313f7600764a5179b6dd9f | [] | no_license | xiaowenhou/JAVA-01 | 50272b268e293bd5c4b39bab6bf1a2f03c0ddf0c | 8d68e487823c8d16d0f9d46b1ee2f880cc20dbf9 | refs/heads/main | 2023-05-30T13:44:41.194878 | 2021-06-21T12:00:39 | 2021-06-21T12:00:39 | 326,154,373 | 1 | 0 | null | 2021-01-02T10:02:23 | 2021-01-02T10:02:22 | null | UTF-8 | Java | false | false | 1,288 | java | package com.xiaowenhou.springboot.cluster.producer;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.core.MessagePropertiesBuilder;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.nio.charset.StandardCharsets;
@RestController
public class ProducerController {
private final RabbitTemplate rabbitTemplate;
@Autowired
public ProducerController(RabbitTemplate rabbitTemplate) {
this.rabbitTemplate = rabbitTemplate;
}
@GetMapping("/rabbit/cluster")
public String testCluster() {
final MessageProperties properties = MessagePropertiesBuilder.newInstance().setHeader("HeaderKey", "HeaderValue").build();
final Message message = MessageBuilder.withBody("Hello, Cluster".getBytes(StandardCharsets.UTF_8))
.andProperties(properties)
.build();
rabbitTemplate.convertAndSend("cluster.exchange", "cluster.queue", message);
return "success";
}
}
| [
"zhang00100520@163.com"
] | zhang00100520@163.com |
356175f1873d8e5af42d3c8b041ae838ca7d7fa2 | b741dc9c58e0bd35ab92e5a8f662ae7b92c9ef88 | /src/com/etascioglu/controller/Cikis.java | c492b786c1a0c43894323b8a3fab86216be5d552 | [] | no_license | Team21/E-Commerce-with-JDBC | a5e8e4bab89af7a4757064dfbf2b8faa9438f145 | b14a49b41e9733b50a15cfc8e0109b05273a63fa | refs/heads/master | 2020-04-02T03:34:47.093091 | 2017-06-15T06:22:32 | 2017-06-15T06:22:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 936 | java | package com.etascioglu.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
* Servlet implementation class Cikis
*/
@WebServlet("/Cikis")
public class Cikis extends HttpServlet {
private static final long serialVersionUID = 1L;
public Cikis() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession session = request.getSession(false);
session.invalidate();
response.sendRedirect("index.jsp");
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doGet(request, response);
}
}
| [
"emre.tascioglu@bil.omu.edu.tr"
] | emre.tascioglu@bil.omu.edu.tr |
97765936364b01dfddfe095c6683e7e111edbdf5 | 8d90fcb08ca8e3512f37a61d73081bd612ed10cf | /app/src/main/java/net/silentbyte/ratedm/Match.java | f041d3af62027e14eddc49fcd3c0124c7f2cf601 | [] | no_license | TwistedMetalGear/Rated-M | fe3f055bec3912e044073055647b54caf98c3820 | 713738f58ca5de6fa784047dbbd9474bb13bdbe8 | refs/heads/master | 2020-04-09T05:58:37.591850 | 2018-12-03T01:23:00 | 2018-12-03T01:23:00 | 160,064,458 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,190 | java | package net.silentbyte.ratedm;
import android.os.Parcel;
import android.os.Parcelable;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class Match implements Parcelable
{
public static final String KEY_MATCH = "match";
public static final String KEY_MATCH_ID = "match_id";
public static final String JSON_ID = "_id";
public static final String JSON_NAME = "name";
public static final String JSON_CREATOR_ID = "creator_id";
public static final String JSON_STATE = "state";
public static final String JSON_VERSION = "version";
public static final String JSON_AUTO_MATCH_SLOTS = "auto_match_slots";
public static final String JSON_BLACK_CARD_TYPE = "black_card_type";
public static final String JSON_WHITE_CARD_TYPE = "white_card_type";
public static final String JSON_INACTIVE_MODE = "inactive_mode";
public static final String JSON_AUTO_PICK_SKIP_TIMEOUT = "auto_pick_skip_timeout";
public static final String JSON_EXCLUDE_HOURS_BEGIN = "exclude_hours_begin";
public static final String JSON_EXCLUDE_HOURS_END = "exclude_hours_end";
public static final String JSON_ROUND = "round";
public static final String JSON_STATE_START_TIME = "state_start_time";
public static final String JSON_UPDATED_AT = "updated_at";
public static final String JSON_REMATCHED = "rematched";
public static final String JSON_DECKS = "decks";
public static final String JSON_PENDING_JOIN_IDS = "pending_join_ids";
public static final String JSON_PENDING_LEAVE_IDS = "pending_leave_ids";
public static final String JSON_PENDING_INVITEE_IDS = "pending_invitee_ids";
public static final String JSON_INVITEE_IDS = "invitee_ids";
public static final String JSON_PLAYER_IDS = "player_ids";
public static final String JSON_NAMES = "names";
public static final String JSON_PICTURE_URLS = "picture_urls";
public static final String JSON_DEALT_CARDS = "dealt_cards";
public static final String JSON_ROUNDS = "rounds";
public static final String JSON_LAST_CHAT_MESSAGE_ID = "last_chat_message_id";
public static final int BLACK_CARD_TYPE_STANDARD = 0;
public static final int BLACK_CARD_TYPE_CUSTOM = 1;
public static final int WHITE_CARD_TYPE_STANDARD = 0;
public static final int WHITE_CARD_TYPE_CUSTOM = 1;
public static final int INACTIVE_MODE_AUTO_PICK = 0;
public static final int INACTIVE_MODE_SKIP = 1;
public static final int INACTIVE_MODE_WAIT = 2;
public static final int MATCH_STATE_PICKING = 0;
public static final int MATCH_STATE_JUDGING = 1;
public static final int MATCH_STATE_COMPLETE = 2;
public static final int MATCH_STATE_CANCELED = 3;
public static final int MATCH_STATE_EXPIRED = 4;
public static final int MATCH_STATE_WRITING_CARD = 5;
private String mId;
private String mName;
private String mCreatorId;
private int mState;
private int mVersion;
private int mAutoMatchSlots;
private int mBlackCardType;
private int mWhiteCardType;
private int mInactiveMode;
private int mAutoPickSkipTimeout;
private int mExcludeHoursBegin;
private int mExcludeHoursEnd;
private int mRound;
private long mStateStartTime;
private long mUpdatedAt;
private boolean mRematched;
private List<String> mDecks;
private List<String> mPendingJoinIds;
private List<String> mPendingLeaveIds;
private List<String> mPendingInviteeIds;
private List<String> mInviteeIds;
private List<String> mPlayerIds;
private List<String> mNames;
private List<String> mPictureUrls;
private Map<String, List<Card>> mDealtCards;
private List<Round> mRounds;
private String mLastChatMessageId;
private String mPictureUrl;
private String mStateText;
private String mDividerText;
public Match(JSONObject match) throws JSONException
{
fromJSON(match);
}
public Match(String dividerText)
{
mDividerText = dividerText;
}
public Match(Parcel in)
{
if (mDividerText == null)
{
mId = in.readString();
mName = in.readString();
mCreatorId = in.readString();
mState = in.readInt();
mVersion = in.readInt();
mAutoMatchSlots = in.readInt();
mBlackCardType = in.readInt();
mWhiteCardType = in.readInt();
mInactiveMode = in.readInt();
mAutoPickSkipTimeout = in.readInt();
mExcludeHoursBegin = in.readInt();
mExcludeHoursEnd = in.readInt();
mRound = in.readInt();
mStateStartTime = in.readLong();
mUpdatedAt = in.readLong();
mRematched = in.readByte() != 0;
mDecks = new ArrayList<String>();
mPendingJoinIds = new ArrayList<String>();
mPendingLeaveIds = new ArrayList<String>();
mPendingInviteeIds = new ArrayList<String>();
mInviteeIds = new ArrayList<String>();
mPlayerIds = new ArrayList<String>();
mNames = new ArrayList<String>();
mPictureUrls = new ArrayList<String>();
in.readStringList(mDecks);
in.readStringList(mPendingJoinIds);
in.readStringList(mPendingLeaveIds);
in.readStringList(mPendingInviteeIds);
in.readStringList(mInviteeIds);
in.readStringList(mPlayerIds);
in.readStringList(mNames);
in.readStringList(mPictureUrls);
mDealtCards = new HashMap<String, List<Card>>();
readCardMap(mDealtCards, in);
mRounds = in.createTypedArrayList(Round.CREATOR);
mLastChatMessageId = in.readString();
if (in.readByte() != 0)
mPictureUrl = in.readString();
if (in.readByte() != 0)
mStateText = in.readString();
}
else
mDividerText = in.readString();
}
private void fromJSON(JSONObject match) throws JSONException
{
mId = match.getString(JSON_ID);
mName = match.getString(JSON_NAME);
mCreatorId = match.getString(JSON_CREATOR_ID);
mState = match.getInt(JSON_STATE);
mVersion = match.getInt(JSON_VERSION);
mAutoMatchSlots = match.getInt(JSON_AUTO_MATCH_SLOTS);
mBlackCardType = match.getInt(JSON_BLACK_CARD_TYPE);
mWhiteCardType = match.getInt(JSON_WHITE_CARD_TYPE);
mInactiveMode = match.getInt(JSON_INACTIVE_MODE);
mAutoPickSkipTimeout = match.getInt(JSON_AUTO_PICK_SKIP_TIMEOUT);
mExcludeHoursBegin = match.getInt(JSON_EXCLUDE_HOURS_BEGIN);
mExcludeHoursEnd = match.getInt(JSON_EXCLUDE_HOURS_END);
mRound = match.getInt(JSON_ROUND);
mStateStartTime = match.getLong(JSON_STATE_START_TIME);
mUpdatedAt = match.getLong(JSON_UPDATED_AT);
mRematched = match.getBoolean(JSON_REMATCHED);
mDecks = jsonToStringList(match.getJSONArray(JSON_DECKS));
mPendingJoinIds = jsonToStringList(match.getJSONArray(JSON_PENDING_JOIN_IDS));
mPendingLeaveIds = jsonToStringList(match.getJSONArray(JSON_PENDING_LEAVE_IDS));
mPendingInviteeIds = jsonToStringList(match.getJSONArray(JSON_PENDING_INVITEE_IDS));
mInviteeIds = jsonToStringList(match.getJSONArray(JSON_INVITEE_IDS));
mPlayerIds = jsonToStringList(match.getJSONArray(JSON_PLAYER_IDS));
mNames = jsonToStringList(match.getJSONArray(JSON_NAMES));
mPictureUrls = jsonToStringList(match.getJSONArray(JSON_PICTURE_URLS));
mDealtCards = dealtCardsToMap(match.getJSONObject(JSON_DEALT_CARDS));
mRounds = roundsToList(match.getJSONArray(JSON_ROUNDS));
mLastChatMessageId = match.getString(JSON_LAST_CHAT_MESSAGE_ID);
}
private List<String> jsonToStringList(JSONArray jsonArray) throws JSONException
{
List<String> list = new ArrayList<String>();
for (int i = 0; i < jsonArray.length(); i++)
{
list.add(jsonArray.getString(i));
}
return list;
}
private Map dealtCardsToMap(JSONObject jsonCardMap) throws JSONException
{
HashMap<String, List<Card>> cardMap = new HashMap<String, List<Card>>();
addCardsToMap(cardMap, jsonCardMap);
return cardMap;
}
private void addCardsToMap(Map cardMap, JSONObject jsonCardMap) throws JSONException
{
Iterator it = jsonCardMap.keys();
while (it.hasNext())
{
String playerId = (String)it.next();
JSONArray jsonCards = jsonCardMap.getJSONArray(playerId);
List<Card> cards = new ArrayList<Card>();
for (int i = 0; i < jsonCards.length(); i++)
{
JSONObject jsonCard = jsonCards.getJSONObject(i);
cards.add(new Card(jsonCard));
}
cardMap.put(playerId, cards);
}
}
private void readCardMap(Map cardMap, Parcel in)
{
int size = in.readInt();
for (int i = 0; i < size; i++)
{
String key = in.readString();
List<Card> cards = new ArrayList<Card>();
in.readList(cards, Card.class.getClassLoader());
cardMap.put(key, cards);
}
}
private void writeCardMap(Map<String, List<Card>> cardMap, Parcel dest)
{
dest.writeInt(cardMap.size());
for (String key : cardMap.keySet())
{
dest.writeString(key);
dest.writeList(cardMap.get(key));
}
}
private List<Round> roundsToList(JSONArray jsonRounds) throws JSONException
{
List<Round> rounds = new ArrayList<Round>();
for (int i = 0; i < jsonRounds.length(); i++)
{
JSONObject jsonRound = jsonRounds.getJSONObject(i);
Round round = new Round(jsonRound);
rounds.add(round);
}
return rounds;
}
public String getId()
{
return mId;
}
public String getName()
{
return mName;
}
public String getCreatorId()
{
return mCreatorId;
}
public int getState()
{
return mState;
}
public int getVersion()
{
return mVersion;
}
public int getAutoMatchSlots()
{
return mAutoMatchSlots;
}
public int getBlackCardType()
{
return mBlackCardType;
}
public int getWhiteCardType()
{
return mWhiteCardType;
}
public int getInactiveMode()
{
return mInactiveMode;
}
public int getAutoPickSkipTimeout()
{
return mAutoPickSkipTimeout;
}
public int getExcludeHoursBegin()
{
return mExcludeHoursBegin;
}
public int getExcludeHoursEnd()
{
return mExcludeHoursEnd;
}
public int getRound()
{
return mRound;
}
public long getStateStartTime()
{
return mStateStartTime;
}
public long getUpdatedAt()
{
return mUpdatedAt;
}
public boolean hasRematched()
{
return mRematched;
}
public List<String> getDecks()
{
return mDecks;
}
public List<String> getPendingJoinIds()
{
return mPendingJoinIds;
}
public List<String> getPendingLeaveIds()
{
return mPendingLeaveIds;
}
public List<String> getPendingInviteeIds()
{
return mPendingInviteeIds;
}
public List<String> getInviteeIds()
{
return mInviteeIds;
}
public List<String> getPlayerIds()
{
return mPlayerIds;
}
public List<String> getNames()
{
return mNames;
}
public List<String> getPictureUrls()
{
return mPictureUrls;
}
public Map<String, List<Card>> getDealtCards()
{
return mDealtCards;
}
public List<Round> getRounds()
{
return mRounds;
}
public Round getRound(int round)
{
if (round - 1 >= mRounds.size())
return null;
return mRounds.get(round - 1);
}
public Round getCurrentRound()
{
return mRounds.get(mRounds.size() - 1);
}
public String getLastChatMessageId()
{
return mLastChatMessageId;
}
public String getPictureUrl()
{
return mPictureUrl;
}
public void setPictureUrl(String url)
{
mPictureUrl = url;
}
public String getStateText()
{
return mStateText;
}
public void setStateText(String stateText)
{
mStateText = stateText;
}
public boolean isDivider()
{
return mDividerText != null;
}
public String getDividerText()
{
return mDividerText;
}
public void setDividerText(String dividerText)
{
mDividerText = dividerText;
}
@Override
public int describeContents()
{
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags)
{
if (mDividerText == null)
{
dest.writeString(mId);
dest.writeString(mName);
dest.writeString(mCreatorId);
dest.writeInt(mState);
dest.writeInt(mVersion);
dest.writeInt(mAutoMatchSlots);
dest.writeInt(mBlackCardType);
dest.writeInt(mWhiteCardType);
dest.writeInt(mInactiveMode);
dest.writeInt(mAutoPickSkipTimeout);
dest.writeInt(mExcludeHoursBegin);
dest.writeInt(mExcludeHoursEnd);
dest.writeInt(mRound);
dest.writeLong(mStateStartTime);
dest.writeLong(mUpdatedAt);
dest.writeByte((byte) (mRematched ? 1 : 0));
dest.writeStringList(mDecks);
dest.writeStringList(mPendingJoinIds);
dest.writeStringList(mPendingLeaveIds);
dest.writeStringList(mPendingInviteeIds);
dest.writeStringList(mInviteeIds);
dest.writeStringList(mPlayerIds);
dest.writeStringList(mNames);
dest.writeStringList(mPictureUrls);
writeCardMap(mDealtCards, dest);
Round[] rounds = new Round[mRounds.size()];
rounds = mRounds.toArray(rounds);
dest.writeTypedArray(rounds, 0);
dest.writeString(mLastChatMessageId);
dest.writeByte((byte) (mPictureUrl != null ? 1 : 0));
if (mPictureUrl != null)
dest.writeString(mPictureUrl);
dest.writeByte((byte) (mStateText != null ? 1 : 0));
if (mStateText != null)
dest.writeString(mStateText);
}
else
dest.writeString(mDividerText);
}
public static final Creator CREATOR = new Creator()
{
public Match createFromParcel(Parcel in)
{
return new Match(in);
}
public Match[] newArray(int size)
{
return new Match[size];
}
};
}
| [
"dev@silentbyte.net"
] | dev@silentbyte.net |
9a56b433f7b685eb72e9c343b67268e6afa8c925 | 2a35d84ab8dd47daaed2882837d065b7d7d0cfbd | /JJXTWeb/src/main/java/com/jjxt/ssm/controller/BillingController.java | 6b42dfe56024e69996c78de04f8427afe6df69b1 | [] | no_license | zhiyuan818/Test | 0696a712f126519d9ce7c034acca15f9b764075a | 648eeca4a0f4f66f6ab3717f511e2473aa4710e1 | refs/heads/master | 2022-12-01T12:14:31.844660 | 2020-08-17T13:36:26 | 2020-08-17T13:36:26 | 288,150,512 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,343 | java | package com.jjxt.ssm.controller;
import java.beans.IntrospectionException;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.InvocationTargetException;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONObject;
import com.google.protobuf.TextFormat.ParseException;
import com.jjxt.ssm.common.HttpService;
import com.jjxt.ssm.entity.Application;
import com.jjxt.ssm.entity.BaseCompany;
import com.jjxt.ssm.entity.Statistics;
import com.jjxt.ssm.entity.UcenterManager;
import com.jjxt.ssm.service.ApplicationService;
import com.jjxt.ssm.service.BaseCompanyService;
import com.jjxt.ssm.service.BillingService;
import com.jjxt.ssm.utils.Bussiness;
import com.jjxt.ssm.utils.Constant;
import com.jjxt.ssm.utils.DataOperate;
import com.jjxt.ssm.utils.DateUtil;
import com.jjxt.ssm.utils.ExcelUtils;
import com.jjxt.ssm.utils.Operate;
import com.jjxt.ssm.utils.ResponseResult;
import com.jjxt.ssm.utils.ResultData;
import com.jjxt.ssm.utils.StringUtil;
/**
*
* @author yhhou
* 出账
*/
@Controller
@RequestMapping("/billing")
public class BillingController {
private static Logger logger = Logger.getLogger(AccountController.class);
private static final String PATH = "billing/";
@Autowired
private ApplicationService applicationService;
@Autowired
private BillingService billingService;
@Autowired
private HttpService httpService;
@Value("${rrdBillUrl}")
private String rrdBillUrl;
@Autowired
private BaseCompanyService companyService;
@RequestMapping("/goBilling.action")
public String goBilling(HttpServletRequest request) {
Map<String, Object> map=new HashMap<>();
UcenterManager ucenterManager = (UcenterManager) request.getSession()
.getAttribute(Constant.SERVER_USER_SESSION);
if(ucenterManager != null) {
map.put("chineseName", ucenterManager.getChineseName());
map.put("title", ucenterManager.getTitle());
map.put("isAllCustomer", ucenterManager.getIsAllCustomer());
map.put("isAllChannel", ucenterManager.getIsAllChannel());
}
List<Application> apps=new ArrayList<>();
try {
apps = applicationService.findAppNameBySort(map);
} catch (Exception e) {
logger.error("[ERR][STATISTIC] ", e);
}
List<BaseCompany> companys = new ArrayList<>();
try {
companys = companyService.findCompanyKeyBySort(map);
} catch (Exception e) {
logger.error("[ERR][STATISTIC] ", e);
}
request.setAttribute("apps", apps);
request.setAttribute("companys", companys);
return PATH+"billing";
}
@RequestMapping(value="/billing.action",method=RequestMethod.GET)
@ResponseBody
public void billing(String companyId,String appId,String startTime,String endTime,String[] settlement,String selectType,HttpServletResponse response) {
logger.debug("[BING][BILLING] companyId="+companyId+",appId="+appId+",startTime="+startTime+",endTime="+endTime+",selectType="+selectType+",settlement="+Arrays.toString(settlement));
if(StringUtil.isEmpty(companyId)&&StringUtil.isEmpty(appId)) {
return ;
}
boolean isProvider = false;
if ("2".equals(selectType)) {
isProvider = true;
}
Map<String, String> map=new HashMap<>();
map.put("appId", appId);
map.put("startTime", startTime);
map.put("endTime", endTime);
map.put("companyId", companyId);
map.put("selectType", selectType);
List<Statistics> findStatisticSum = billingService.findStatisticSum(map);
Set<String> set=new HashSet<>();
if(StringUtil.isEmpty(appId)) {
try {
set=applicationService.findAppIdByCompanyId(companyId);
} catch (Exception e) {
logger.error("[ERR][APP] EX="+e);
}
}else {
set.add(appId);
}
Map<String, String> param=new HashMap<>();
Map<String, List<Statistics>> statics=new HashMap<>();
for(String id:set) {
param.put("startTime", startTime);
param.put("endTime", endTime);
param.put("appId", id);
param.put("selectType", selectType);
List<Statistics> stats=billingService.findStatistic(param);
if (stats.size() > 1) {
logger.debug(stats.get(0).toString());
}
if(stats!=null && stats.size()>0) {
statics.put(stats.get(0).getAppName(), stats);
}
}
//公司名称
String companyName="";
if(findStatisticSum.size()>0) {
companyName=findStatisticSum.get(0).getCompanyName();
}
for(Statistics stat:findStatisticSum) {
int sum=0;
for(String ment:settlement) {
if("success".equals(ment)) {
sum+=Integer.parseInt(stat.getReportDelivrdCharge());
}else if("fail".equals(ment)){
sum+=Integer.parseInt(stat.getReportUndelivCharge());
}else if("unknow".equals(ment)) {
sum+=Integer.parseInt(stat.getReportUnknownCharge());
}
}
if(settlement.length!=0 && !settlement[0].equals("null")) {
stat.setReportDelivrdCharge(String.valueOf(sum));
}
}
boolean lement=false;
for(String ment:settlement) {
if("unknow".equals(ment)) {
lement=true;
}
}
//日期2018.11.11
String billingDate=DateUtil.getbillingDate(startTime, endTime);
//日期2018年11月11日
String billingTime=DateUtil.getbillingTime(startTime, endTime);
// 2018年9月账单
String billingString=DateUtil.getbillingString(startTime, endTime);
Map<String, Object> parammap=new HashMap<String, Object>();
parammap.put("companyName", companyName);
parammap.put("billingTime", billingTime);
parammap.put("billingDate", billingDate);
parammap.put("billingString", billingString);
parammap.put("lement", lement);
parammap.put("isProvider", isProvider);
XSSFWorkbook workbook = null;
try {
workbook=ExcelUtils.createExcelBillFile(findStatisticSum,statics,parammap,"对账单");
} catch (IllegalArgumentException | IllegalAccessException | InvocationTargetException | ClassNotFoundException
| ParseException | IntrospectionException e) {
e.printStackTrace();
}
OutputStream output;
try {
response.setHeader("Content-Disposition", "attachment;filename="+URLEncoder.encode(("久佳信通.xlsx"),"UTF-8"));
response.setContentType("application/vnd.ms-excel;charset=UTF-8");
response.setHeader("Pragma", "no-cache");
response.setHeader("Cache-Control", "no-cache");
response.setDateHeader("Expires", 0);
output = response.getOutputStream();
BufferedOutputStream bufferedOutPut = new BufferedOutputStream(output);
bufferedOutPut.flush();
workbook.write(bufferedOutPut);
bufferedOutPut.close();
} catch (IOException e) {
e.printStackTrace();
}
}
@RequestMapping("/goSubmitBill.action")
public String goSubmitBill(HttpServletRequest request) {
List<Application> apps=new ArrayList<>();
try {
apps = applicationService.findAppName();
} catch (Exception e) {
logger.error("[ERR][STATISTIC] ", e);
}
request.setAttribute("apps", apps);
return PATH+"submitBill";
}
@ResponseBody
@RequestMapping("/validatorBillAccount.action")
public ResultData validatorBillAccount(Integer companyId,String appName) {
ResultData result = new ResultData();
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("companyId", companyId);
paramMap.put("appName", appName);
int total = 0;
try {
total = billingService.validatorBillAccount(paramMap);
} catch (Exception e) {
logger.error("[ERROR][validatorBillAccount] ", e);
}
if (total > 0) {
result.setValid(true);
} else {
result.setValid(false);
}
return result;
}
@DataOperate(bussiness = Bussiness.bill, operation = Operate.SUBMIT)
@RequestMapping(value="/submitBill.action")
@ResponseBody
public ResponseResult submitBill(Integer companyId,String appName,String providerName,String billDate,Long successCount,Long unknownCount,Long count,Double cost) {
logger.debug("[BING][SUBMITBILL] companyId="+companyId+",appName="+appName+",providerName="+providerName+",billDate="+billDate+",successCount="+successCount+",unknownCount="+unknownCount+",count="+count+",cost="+cost);
if (companyId == null||appName==null||billDate == null||successCount == null||unknownCount == null||count == null||cost == null) {
return new ResponseResult(3,null,null);
}
billDate = billDate.trim();
appName = appName.trim();
providerName = providerName.trim();
Integer status = -1;
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("companyId", companyId);
paramMap.put("appName", appName);
int total = 0;
try {
total = billingService.validatorBillAccount(paramMap);
} catch (Exception e) {
logger.error("[ERROR][validatorBillAccount] ", e);
}
JSONObject json = new JSONObject();
json.put("account", appName);
json.put("providerName", providerName);
json.put("month", billDate);
json.put("successCount", successCount);
json.put("unknownCount", unknownCount);
json.put("count", count);
json.put("cost", cost);
if (total == 0) {
return new ResponseResult(2,null,json.toJSONString());
}
String httpResult = httpService.httpClientPostJson(rrdBillUrl, json.toJSONString());
if (httpResult == null) {
return new ResponseResult(4,null,json.toJSONString());
}
JSONObject jsonObject = JSONObject.parseObject(httpResult);
ResponseResult result = new ResponseResult();
result.setNewData(jsonObject.toJSONString());
result.setOldData(json.toJSONString());
status = jsonObject.get("status") == null ? -1 :Integer.valueOf(String.valueOf(jsonObject.get("status")));
if(status == 0){
result.setResult(0);
}else {
result.setResult(1);
}
return result;
}
}
| [
"zhangjie@jj-mobile.com"
] | zhangjie@jj-mobile.com |
9d13c80118e0bb84abc7da84d9320bf1b616eb1d | 3bf8c3ef0aa031f6dda02b48c12fd53d3b291313 | /src/ecs/Components/ModelData.java | 108ffcf2cd571c45bf4e4241241219fda1f3a828 | [] | no_license | keensworth/VoxelEngine | 8ffa51f47f617777b6190501efee4af4f81ac85b | 905355f2e4fec1040f0c4b1790a066dc8d4dc8ab | refs/heads/master | 2023-04-23T02:39:15.634675 | 2021-05-10T23:44:59 | 2021-05-10T23:44:59 | 366,197,663 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 517 | java | package ecs.Components;
import ecs.Component;
import util.Container;
public class ModelData extends Component {
private Container models;
public ModelData(){
models = new Container();
}
public int getModel(int index){
return (int) models.get(index);
}
public void setModel(int index, int modelId){
this.models.set(index, modelId);
}
public ModelData add(int modelId){
super.setLastWriteIndex(this.models.add(modelId));
return this;
}
} | [
"keene077@umn.edu"
] | keene077@umn.edu |
9380ec2b114e15f17d2a5d1cc4c48b6408b50884 | 38ed7332242a5fdec38d5e8f4331d6390ebab012 | /IteratorsAndComparators/Exercises/T04Froggy/Lake.java | 11ead038aa799dbf369312cbecfcb2357e82d503 | [] | no_license | ValeriDimov/JavaProgrammingAdvanced | 6dd5e0883edb5bb7c502b77c29267de817e57e1b | e8acd89efcf4f26ce4987e9b5fd0f454ce7dd98e | refs/heads/main | 2023-08-22T08:55:54.456720 | 2021-10-25T17:51:43 | 2021-10-25T17:51:43 | 402,118,240 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 969 | java | package IteratorsAndComparators.Exercises.T04Froggy;
import java.util.Iterator;
import java.util.List;
public class Lake implements Iterable<Integer>{
private List<Integer> lake;
public Lake(List<Integer> lake) {
this.lake = lake;
}
public void setLake(List<Integer> lake) {
this.lake = lake;
}
@Override
public Iterator<Integer> iterator() {
return new Frog();
}
class Frog implements Iterator<Integer> {
int index = 0;
boolean firstRoundIsFinished = false;
@Override
public boolean hasNext() {
return index < lake.size();
}
@Override
public Integer next() {
int currentIndex = index;
index += 2;
if(index >= lake.size() && !firstRoundIsFinished){
index = 1;
firstRoundIsFinished = true;
}
return lake.get(currentIndex);
}
}
}
| [
"valeri.dimov@abv.bg"
] | valeri.dimov@abv.bg |
271eb481d2dda077d2ed82bf94aff4034b355875 | f9f8df5fe0fca77f4eb908f5fcf58470bc0226f5 | /src/main/java/org/apache/ibatis/mapping/MappedStatement.java | 016c08ae8f1fae3a0479aa91a6a1e8f0faeb2c99 | [] | no_license | raindows/mybatis3 | 46a68b2b2348b7de0808c1b6f542569980a7830e | 9bd8630fa61c3aa6c28abaf0723f40a26023dfe1 | refs/heads/master | 2020-03-27T08:12:45.487965 | 2018-04-12T01:41:53 | 2018-04-12T01:41:53 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 8,868 | java | /**
* Copyright 2009-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ibatis.mapping;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.apache.ibatis.cache.Cache;
import org.apache.ibatis.executor.keygen.Jdbc3KeyGenerator;
import org.apache.ibatis.executor.keygen.KeyGenerator;
import org.apache.ibatis.executor.keygen.NoKeyGenerator;
import org.apache.ibatis.logging.Log;
import org.apache.ibatis.logging.LogFactory;
import org.apache.ibatis.scripting.LanguageDriver;
import org.apache.ibatis.session.Configuration;
/**
* @author Clinton Begin
* 用来存储SQL statement
*/
public final class MappedStatement {
private String resource;
private Configuration configuration;
private String id;
private Integer fetchSize;
private Integer timeout;
private StatementType statementType;
private ResultSetType resultSetType;
private SqlSource sqlSource;
private Cache cache;
private ParameterMap parameterMap;
private List<ResultMap> resultMaps;
private boolean flushCacheRequired;
private boolean useCache;
private boolean resultOrdered;
private SqlCommandType sqlCommandType;
private KeyGenerator keyGenerator;
private String[] keyProperties;
private String[] keyColumns;
private boolean hasNestedResultMaps;
private String databaseId;
private Log statementLog;
private LanguageDriver lang;
private String[] resultSets;
MappedStatement() {
// constructor disabled
}
public static class Builder {
private MappedStatement mappedStatement = new MappedStatement();
public Builder(Configuration configuration, String id, SqlSource sqlSource, SqlCommandType sqlCommandType) {
mappedStatement.configuration = configuration;
mappedStatement.id = id;
mappedStatement.sqlSource = sqlSource;
mappedStatement.statementType = StatementType.PREPARED;
mappedStatement.parameterMap = new ParameterMap.Builder(configuration, "defaultParameterMap", null, new ArrayList<ParameterMapping>()).build();
mappedStatement.resultMaps = new ArrayList<ResultMap>();
mappedStatement.sqlCommandType = sqlCommandType;
mappedStatement.keyGenerator = configuration.isUseGeneratedKeys() && SqlCommandType.INSERT.equals(sqlCommandType) ? Jdbc3KeyGenerator.INSTANCE : NoKeyGenerator.INSTANCE;
String logId = id;
if (configuration.getLogPrefix() != null) {
logId = configuration.getLogPrefix() + id;
}
mappedStatement.statementLog = LogFactory.getLog(logId);
mappedStatement.lang = configuration.getDefaultScriptingLanguageInstance();
}
public Builder resource(String resource) {
mappedStatement.resource = resource;
return this;
}
public String id() {
return mappedStatement.id;
}
public Builder parameterMap(ParameterMap parameterMap) {
mappedStatement.parameterMap = parameterMap;
return this;
}
public Builder resultMaps(List<ResultMap> resultMaps) {
mappedStatement.resultMaps = resultMaps;
for (ResultMap resultMap : resultMaps) {
mappedStatement.hasNestedResultMaps = mappedStatement.hasNestedResultMaps || resultMap.hasNestedResultMaps();
}
return this;
}
public Builder fetchSize(Integer fetchSize) {
mappedStatement.fetchSize = fetchSize;
return this;
}
public Builder timeout(Integer timeout) {
mappedStatement.timeout = timeout;
return this;
}
public Builder statementType(StatementType statementType) {
mappedStatement.statementType = statementType;
return this;
}
public Builder resultSetType(ResultSetType resultSetType) {
mappedStatement.resultSetType = resultSetType;
return this;
}
public Builder cache(Cache cache) {
mappedStatement.cache = cache;
return this;
}
public Builder flushCacheRequired(boolean flushCacheRequired) {
mappedStatement.flushCacheRequired = flushCacheRequired;
return this;
}
public Builder useCache(boolean useCache) {
mappedStatement.useCache = useCache;
return this;
}
public Builder resultOrdered(boolean resultOrdered) {
mappedStatement.resultOrdered = resultOrdered;
return this;
}
public Builder keyGenerator(KeyGenerator keyGenerator) {
mappedStatement.keyGenerator = keyGenerator;
return this;
}
public Builder keyProperty(String keyProperty) {
mappedStatement.keyProperties = delimitedStringToArray(keyProperty);
return this;
}
public Builder keyColumn(String keyColumn) {
mappedStatement.keyColumns = delimitedStringToArray(keyColumn);
return this;
}
public Builder databaseId(String databaseId) {
mappedStatement.databaseId = databaseId;
return this;
}
public Builder lang(LanguageDriver driver) {
mappedStatement.lang = driver;
return this;
}
public Builder resultSets(String resultSet) {
mappedStatement.resultSets = delimitedStringToArray(resultSet);
return this;
}
/** @deprecated Use {@link #resultSets} */
@Deprecated
public Builder resulSets(String resultSet) {
mappedStatement.resultSets = delimitedStringToArray(resultSet);
return this;
}
public MappedStatement build() {
assert mappedStatement.configuration != null;
assert mappedStatement.id != null;
assert mappedStatement.sqlSource != null;
assert mappedStatement.lang != null;
mappedStatement.resultMaps = Collections.unmodifiableList(mappedStatement.resultMaps);
return mappedStatement;
}
}
public KeyGenerator getKeyGenerator() {
return keyGenerator;
}
public SqlCommandType getSqlCommandType() {
return sqlCommandType;
}
public String getResource() {
return resource;
}
public Configuration getConfiguration() {
return configuration;
}
public String getId() {
return id;
}
public boolean hasNestedResultMaps() {
return hasNestedResultMaps;
}
public Integer getFetchSize() {
return fetchSize;
}
public Integer getTimeout() {
return timeout;
}
public StatementType getStatementType() {
return statementType;
}
public ResultSetType getResultSetType() {
return resultSetType;
}
public SqlSource getSqlSource() {
return sqlSource;
}
public ParameterMap getParameterMap() {
return parameterMap;
}
public List<ResultMap> getResultMaps() {
return resultMaps;
}
public Cache getCache() {
return cache;
}
public boolean isFlushCacheRequired() {
return flushCacheRequired;
}
public boolean isUseCache() {
return useCache;
}
public boolean isResultOrdered() {
return resultOrdered;
}
public String getDatabaseId() {
return databaseId;
}
public String[] getKeyProperties() {
return keyProperties;
}
public String[] getKeyColumns() {
return keyColumns;
}
public Log getStatementLog() {
return statementLog;
}
public LanguageDriver getLang() {
return lang;
}
public String[] getResultSets() {
return resultSets;
}
/** @deprecated Use {@link #getResultSets()} */
@Deprecated
public String[] getResulSets() {
return resultSets;
}
public BoundSql getBoundSql(Object parameterObject) {
BoundSql boundSql = sqlSource.getBoundSql(parameterObject);
List<ParameterMapping> parameterMappings = boundSql.getParameterMappings();
if (parameterMappings == null || parameterMappings.isEmpty()) {
boundSql = new BoundSql(configuration, boundSql.getSql(), parameterMap.getParameterMappings(), parameterObject);
}
// check for nested result maps in parameter mappings (issue #30)
for (ParameterMapping pm : boundSql.getParameterMappings()) {
String rmId = pm.getResultMapId();
if (rmId != null) {
ResultMap rm = configuration.getResultMap(rmId);
if (rm != null) {
hasNestedResultMaps |= rm.hasNestedResultMaps();
}
}
}
return boundSql;
}
private static String[] delimitedStringToArray(String in) {
if (in == null || in.trim().length() == 0) {
return null;
} else {
return in.split(",");
}
}
}
| [
"hujie@wkbins.com"
] | hujie@wkbins.com |
d7e14e60df0d5a86a1b01ab5963cac4026804c1a | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/20/20_73238f195e1b936be881c1c35192e4de1df0cc85/JPagination/20_73238f195e1b936be881c1c35192e4de1df0cc85_JPagination_s.java | aa7d2c3e4b9b524625cdd3d719a28c9ea2517f37 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 21,780 | java | package edu.wustl.cab2b.client.ui.pagination;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Vector;
import javax.swing.event.EventListenerList;
import org.jdesktop.swingx.JXHyperlink;
import org.jdesktop.swingx.JXPanel;
import edu.wustl.cab2b.client.ui.RiverLayout;
import edu.wustl.cab2b.client.ui.controls.Cab2bHyperlink;
import edu.wustl.cab2b.client.ui.controls.Cab2bPanel;
/**
* A Swing component to perform pagination of long list of user data.
* This component is designed to simulate the Browser kind of pagination
* of search results.
*
* This component can be an alternative the ScrollPane component, with different
* technique to display a long list of user data.
*
* List of Property Change Listeners implemented and working.
* 1) isSelectable
* 2) isGroupActionEnabled // TODO this should automatically get disabled if isSelectable is disabled.
* 3) elementsPerPage
*
* @author chetan_bh
*/
public class JPagination extends Cab2bPanel implements PropertyChangeListener, MouseWheelListener {
private static final long serialVersionUID = 1L;
/**
* A boolean to set selection feature enabled or disabled.
*/
private boolean isSelectable = true;
/**
* A boolean to set group actions set displayed or not displayed.
*/
private boolean isGroupActionEnabled = true;
/**
* A model to hold user data.
*/
private PaginationModel paginationModel;
/**
* A Panel to display some common action elements like "Select All", "Clear All", etc.
*/
private JGroupActionPanel groupActionPanel;
/**
* A Panel to display the page indexes, for user to navigate through the data using
* these indices.
*/
private JPageBar pageBar;
/**
* A Panel to display the page elements.
*/
private JXPanel pagePanel;
/**
* S actionListenerList, so that many listener can register
* to listen for page element actions.
*/
private Vector<ActionListener> pageElementActionListenerList = new Vector<ActionListener>();
/**
* A selection model for the entire <code>JPagination</code> component.
*/
private PageSelectionModel pageSelectionModel;
/**
* A selection listener for the page element selections.
*/
private Vector<PageSelectionListener> pageSelectionListenerList = new Vector<PageSelectionListener>();
@Deprecated
protected EventListenerList listenerList = new EventListenerList();
private Component parentComponent;
/**
* Auto-Resize will not work for Alphabetic Pager.
*/
boolean automaticPageResize = true;
boolean mouseWheelEnabled = true;
private JPageElement selectedJPageElement;
private Cab2bHyperlink selectAllHyperlink;
private Cab2bHyperlink clearAllHyperlink;
private Cab2bHyperlink invertSelectionHyperlink;
public JPagination() {
this(null);
}
public JPagination(Vector<PageElement> data) {
this(data, new NumericPager(data));
}
public JPagination(Vector<PageElement> data, Pager pager) {
this(data, pager, null, false);
}
public JPagination(Vector<PageElement> data, Pager pager, Component parentComponent, boolean autoPageResize) {
paginationModel = new PaginationModel(data, pager);
pageSelectionModel = new DefaultPageSelectionModel(this);
this.addPropertyChangeListener(this);
if (parentComponent == null) {
automaticPageResize = false;
} else {
this.automaticPageResize = autoPageResize;
this.parentComponent = parentComponent;
parentComponent.addComponentListener(new PaginationComponentListener());
}
initGUI();
addNewMouseWheelListener();
}
private void initGUI() {
this.removeAll();
pageBar = new JPageBar(paginationModel.pager.getAllPageIndices(), new Vector(), this);
setLayout(new BorderLayout());
if (isGroupActionEnabled) {
groupActionPanel = new JGroupActionPanel();
add(groupActionPanel, BorderLayout.NORTH);
}
pagePanel = getPagePanel(paginationModel.firstPage());
if (automaticPageResize)
pagePanel.addComponentListener(new PaginationComponentListener());
add(pagePanel, BorderLayout.CENTER);
add(pageBar, BorderLayout.SOUTH);
}
private void addNewMouseWheelListener() {
MouseWheelListener[] mouseWheelListeners = this.getMouseWheelListeners();
for (int i = 0; i < mouseWheelListeners.length; i++) {
MouseWheelListener mouseWheelListener = mouseWheelListeners[i];
this.removeMouseWheelListener(mouseWheelListener);
}
addMouseWheelListener(this);
this.validateTree();
}
public void setPrefSize(Dimension preferredSize) {
super.setPreferredSize(preferredSize);
}
public Dimension getPrefSize() {
return this.getPreferredSize();
}
/**
* Returns a Panel which is embedded with page element components represneting the a page.
* @param pageElements a vector of page elements also called as page.
* @return a page panel.
*
* TODO this function should now take into account pageLayoutOrientation and pageDimension
* attributes into account while laying out page elements in the page panel.
*
*/
public JXPanel getPagePanel(Vector<PageElement> pageElements) {
JXPanel pagePanel = new Cab2bPanel();
String currentPageIndex = paginationModel.getCurrentPageIndex();
pagePanel.setLayout(new RiverLayout(0, 8));
for (PageElement element : pageElements) {
int indexInPage = pageElements.indexOf(element);
PageElementIndex pageElementIndex = new PageElementIndex(currentPageIndex, indexInPage);
JPageElement pageElementPanel = new JPageElement(this, element, isSelectable, pageElementIndex);
pageElementPanel.addHyperlinkActionListeners(this.pageElementActionListenerList);
pagePanel.add("br", pageElementPanel);
}
if (automaticPageResize) {
pagePanel.addComponentListener(new PaginationComponentListener());
}
return pagePanel;
}
public void addPageElementActionListener(ActionListener actionListener) {
for (int i = 0; i < pagePanel.getComponentCount(); i++) {
JPageElement pageElementComp = (JPageElement) pagePanel.getComponent(i);
pageElementComp.addHyperlinkActionListener(actionListener);
}
pageElementActionListenerList.add(actionListener);
}
//TODO This looks like not conforming to JavaBeans standards
// This should set actionlisteners of each pageelements actionlistener to null
// Just like previous function.
public void removePageElementActionListener(ActionListener actionListener) {
pageElementActionListenerList.remove(actionListener);
for (int i = 0; i < pagePanel.getComponentCount(); i++) {
JPageElement pageElementComp = (JPageElement) pagePanel.getComponent(i);
pageElementComp.removeHyperlinkActionListener(actionListener);
}
}
/**
* Gets the current action listener.
* @return
*/
public Vector<ActionListener> getPageElementActionListners() {
return this.pageElementActionListenerList;
}
/**
* A method to change the current page panel to a new page panel.
* @param newPagePanel
*/
public void changePagePanel(JXPanel newPagePanel) {
this.remove(pagePanel);
this.pagePanel = newPagePanel;
this.add(pagePanel);
this.updateUI();
}
/**
* Returns the current pagination model.
* @return
*/
public PaginationModel getPaginationModel() {
return paginationModel;
}
/**
* Sets the pagination model to new one.
* @param paginationModel new pagination model
*/
public void setPaginationModel(PaginationModel paginationModel) {
PaginationModel oldValue = this.paginationModel;
this.paginationModel = paginationModel;
firePropertyChange("paginationModel", oldValue, this.paginationModel);
}
/**
* Changes the pager in the pagination model.
* @param newPager new pager.
*/
public void changePager(Pager newPager) {
Pager oldValue = null; //paginationModel.getPa
paginationModel.changePager(newPager);
firePropertyChange("pager", oldValue, newPager);
}
/**
* Returns the current <code>PageSelectionModel</code>.
* @return
*/
public PageSelectionModel getPageSelectionModel() {
return pageSelectionModel;
}
/**
* Sets a new <code>PageSelectionModel</code>.
* @param pageSelectionModel new page selection model.
*/
public void setPageSelectionModel(PageSelectionModel pageSelectionModel) {
PageSelectionModel oldValue = this.pageSelectionModel;
this.pageSelectionModel = pageSelectionModel;
firePropertyChange("pageSelectionModel", oldValue, pageSelectionModel);
}
/**
* Returns true if selection is enabled, else false.
* @return
*/
public boolean isSelectable() {
return isSelectable;
}
/**
* Enables/Diables selections of the page elements.
* @param newValue
*/
public void setSelectableEnabled(boolean newValue) {
if (newValue != this.isSelectable) {
Boolean oldValue = isSelectable;
this.isSelectable = newValue;
firePropertyChange("isSelectable", oldValue, new Boolean(newValue));
}
}
/**
* Enables/Disables group action panel.
* @param newValue
*/
public void setGroupActionEnabled(boolean newValue) {
if (newValue != this.isGroupActionEnabled) {
Boolean oldValue = this.isGroupActionEnabled;
this.isGroupActionEnabled = newValue;
firePropertyChange("isGroupActionEnabled", oldValue, new Boolean(newValue));
}
}
/**
* Sets element per page parameter.
* @param newValue
*/
public void setElementsPerPage(int newValue) {
int oldValue = paginationModel.getElementsPerPage();
if (newValue != oldValue && newValue > 0) {
firePropertyChange("elementsPerPage", new Integer(oldValue), new Integer(newValue));
}
}
/**
* Returns elements per page parameter.
* @return
*/
public int getElementsPerPage() {
return paginationModel.getElementsPerPage();
}
/**
* Returns true if group actions are eanbled, else false.
* @return
*/
public boolean isGroupActionEnabled() {
return isGroupActionEnabled;
}
/**
* This function propagates the selectionEvent to selectionModel, where all the selections
* are maintained by selectionModels datastructure.
* @param pageSelectionEvent
*/
protected void fireSelectionValueChanged(PageSelectionEvent pageSelectionEvent) {
for (PageSelectionListener pageSelectionListener : pageSelectionListenerList) {
pageSelectionListener.selectionChanged(pageSelectionEvent);
}
}
/**
* Returns a collection of selected page elements user object.
* @return
*/
public Vector getSelectedPageElementsUserObjects() {
Vector<Object> selectedUserObjects = new Vector<Object>();
Vector<PageElementIndex> selectedPageIndices = pageSelectionModel.getSelectedPageIndices();
for (int i = 0; i < selectedPageIndices.size(); i++) {
PageElementIndex pageElementIndex = selectedPageIndices.get(i);
PageElement selectedPageElement = paginationModel.getPageElement(pageElementIndex);
if (selectedPageElement == null)
continue;
Object userObjectOfSelectedPageElement = selectedPageElement.getUserObject();
selectedUserObjects.add(userObjectOfSelectedPageElement);
}
return selectedUserObjects;
}
/**
* Property change listener method.
*/
public void propertyChange(PropertyChangeEvent pcEvent) {
String propertyName = pcEvent.getPropertyName();
Object newValue = pcEvent.getNewValue();
if (propertyName.equals("isGroupActionEnabled")) {
Boolean newBoolValue = (Boolean) newValue;
if (newBoolValue) {
this.isGroupActionEnabled = newBoolValue;
groupActionPanel = new JGroupActionPanel();
add(groupActionPanel, BorderLayout.NORTH);
} else {
this.isGroupActionEnabled = newBoolValue;
this.remove(groupActionPanel);
}
this.revalidate();
} else if (propertyName.equals("elementsPerPage")) {
int newElementsPerPage = ((Integer) newValue).intValue();
if (getElementsPerPage() != newElementsPerPage) {
paginationModel.setElementsPerPage(newElementsPerPage);
initGUI();
this.revalidate();
this.updateUI();
}
}
}
public void addPageSelectionListener(PageSelectionListener pageSelectionListener) {
if (pageSelectionListener != null)
pageSelectionListenerList.add(pageSelectionListener);
}
public void removePageSelectionListener(PageSelectionListener pageSelectionListener) {
if (pageSelectionListener != null)
pageSelectionListenerList.remove(pageSelectionListener);
}
/**
* A Panel to hold common page action hyperlinks.
*
* @author chetan_bh
*/
private class JGroupActionPanel extends Cab2bPanel implements ActionListener {
private static final long serialVersionUID = 1L;
private String selectAllText = PaginationConstants.SELECT_ALL_TEXT;
private String clearAllText = PaginationConstants.CLEAR_ALL_TEXT;
private String invertSelectionText = PaginationConstants.INVERT_SELECTION_TEXT;
public JGroupActionPanel() {
this(PaginationConstants.SELECT_ALL_TEXT, PaginationConstants.CLEAR_ALL_TEXT,
PaginationConstants.INVERT_SELECTION_TEXT);
}
public JGroupActionPanel(String selectAllText, String clearAllText, String invertSelectionText) {
if (selectAllText != null && !(selectAllText.trim().equals("")))
this.selectAllText = selectAllText;
if (clearAllText != null && !(clearAllText.trim().equals("")))
this.clearAllText = clearAllText;
if (invertSelectionText != null && !(invertSelectionText.trim().equals("")))
this.invertSelectionText = invertSelectionText;
initGUI();
}
/**
* Initialize the GUI for Group Action panel.
*/
private void initGUI() {
selectAllHyperlink = new Cab2bHyperlink();
selectAllHyperlink.setText(selectAllText);
selectAllHyperlink.addActionListener(this);
this.add("br", selectAllHyperlink);
clearAllHyperlink = new Cab2bHyperlink();
clearAllHyperlink.setText(clearAllText);
clearAllHyperlink.addActionListener(this);
this.add("tab", clearAllHyperlink);
invertSelectionHyperlink = new Cab2bHyperlink();
invertSelectionHyperlink.setText(invertSelectionText);
invertSelectionHyperlink.addActionListener(this);
this.add("tab", invertSelectionHyperlink);
}
/**
* Action listener for Group action hyperlinks.
*/
public void actionPerformed(ActionEvent e) {
JXHyperlink source = (JXHyperlink) e.getSource();
String sourceText = source.getText();
String currentPageIndex = paginationModel.getCurrentPageIndex();
if (sourceText.equals(selectAllText)) {
pageSelectionModel.selectAll();
} else if (sourceText.equals(clearAllText)) {
pageSelectionModel.clearAll();
} else {
pageSelectionModel.invertAll();
}
JXPanel currentPagePanel = getPagePanel(paginationModel.getPage(currentPageIndex));
changePagePanel(currentPagePanel);
}
}
/**
* This is a component listener for page panel as well as a parent component.
* TODO Needs to do some more work on this.
*
* @author chetan_bh
*/
class PaginationComponentListener extends ComponentAdapter {
public void componentResized(ComponentEvent e) {
/**
* There are many conditions that needs to be checked before starting rezise.
* 1) automaticPageResize should be enabled.
* 2) No page resize for last numeric pager.
* 3) No page resize for non-numeric level-1 pager.
*/
// For Condition 1.
if (automaticPageResize == false)
return;
// For Condition 3.
if (!paginationModel.getPagerName().equals(PaginationConstants.NUMERIC_PAGER))
return;
Dimension pagePanelSize = pagePanel.getSize();
Dimension pagePanelPreferredSize = pagePanel.getPreferredSize();
if (pagePanelSize.height == 0 && pagePanelSize.width == 0)
return;
/*
* On an approximate page elements need 47 pixels each; <<-- this is a kind of assumption which may not be correct all the time.
* TODO Need to find proper solution.
*/
int difference = Math.round(Math.round(pagePanelSize.getHeight() - pagePanelPreferredSize.getHeight()));
int currentElementsPerPage = getElementsPerPage();
// For Condition 2.
if (!paginationModel.hasNextPage() && difference > 50)
return;
// TODO Need to remove these hardcoding like 50, -10.
if (difference > 55) {
int increment = difference / 50;
setElementsPerPage(currentElementsPerPage + increment);
} else if (difference < -1) {
int decrement = difference / 50;
decrement -= 1;
setElementsPerPage(currentElementsPerPage + decrement);
}
}
}
public void mouseWheelMoved(MouseWheelEvent e) {
/* Return without doing nothing, if the mouse wheel support is not enabled for JPagination. */
if (!mouseWheelEnabled)
return;
if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
/* Wheel rotation is either 1 or -1. */
int wheelRotation = e.getWheelRotation();
String currentPageIndex = "";
if (wheelRotation == 1) {/* If mouse wheel is rotated down/toward the user. -> move behind, decrease the page index. */
currentPageIndex = pageBar.sequentialNavigation(pageBar.getPreviousPageText());
} else if (wheelRotation == -1) {/* If mouse wheel is rotated up/away from the user. -> move forward, increase the page index. */
currentPageIndex = pageBar.sequentialNavigation(pageBar.getNextPageText());
}
pageBar.displayLinkColor(currentPageIndex);
}
}
/**
* @return the selectedJPageElement
*/
public JPageElement getSelectedJPageElement() {
return selectedJPageElement;
}
/**
* @param selectedJPageElement the selectedJPageElement to set
*/
public void setSelectedJPageElement(JPageElement selectedJPageElement) {
this.selectedJPageElement = selectedJPageElement;
}
public void setPageLinksDisabled() {
selectAllHyperlink.setEnabled(false);
clearAllHyperlink.setEnabled(false);
invertSelectionHyperlink.setEnabled(false);
}
/**
* @return the parentComponent
*/
public Component getParentComponent() {
return parentComponent;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
795aa460a46dfd974f25d6cd825895deae8baf97 | ae0138621cb048b963ed68cdec4ad9a3c513018e | /src/test/java/com/masonpohler/api/source/SourceControllerTest.java | 6e57c350a4c0e5a4b9a41ffc4c0999baa2f78ad7 | [] | no_license | mpohler1/projects-api | f33078949532b840554519f25c18570206306ee7 | 6f8202620676171c5fe6942be759ba59f1e016bb | refs/heads/master | 2022-11-08T21:18:58.244650 | 2020-06-25T23:25:33 | 2020-06-25T23:25:33 | 271,907,684 | 0 | 0 | null | 2020-06-25T23:25:34 | 2020-06-12T23:30:42 | Java | UTF-8 | Java | false | false | 6,336 | java | package com.masonpohler.api.source;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.stubbing.Answer;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.when;
class SourceControllerTest {
@Mock
private SourceRepository mockedRepository;
@InjectMocks
private SourceController controller;
@BeforeEach
void set_up() {
MockitoAnnotations.initMocks(this);
}
// getAllSources
@Test
void get_all_sources_returns_an_empty_list_when_no_sources_are_in_repository() {
mockFindAll(new LinkedList<>());
List<Source> actualSourceList = controller.getAllSources();
assert actualSourceList.size() == 0;
}
@Test
void get_all_sources_returns_list_of_all_sources() {
List<Source> expectedSourceList = createDummySourceList();
mockFindAll(expectedSourceList);
List<Source> actualSourceList = controller.getAllSources();
assertEquals(expectedSourceList, actualSourceList);
}
// getSourceById
@Test
void get_source_by_id_throws_source_not_found_exception_when_source_not_in_repostiory() {
mockFindById(new LinkedList<>());
assertThrows(SourceNotFoundException.class, () -> controller.getSourceById(0));
}
@Test
void get_source_by_id_returns_source_when_source_is_in_repository() {
List<Source> dummySourceList = createDummySourceList();
mockFindById(dummySourceList);
Source expectedSource = dummySourceList.get(0);
Source actualSource = controller.getSourceById(expectedSource.getId());
assertEquals(expectedSource, actualSource);
}
// createSource
@Test
void create_source_returns_created_source() {
List<Source> dummySourceList = createDummySourceList();
mockSave(dummySourceList);
Source expectedSource = createDummySource();
Source actualSource = controller.createSource(expectedSource);
assertEquals(expectedSource, actualSource);
}
@Test
void create_source_adds_source_to_repository() {
List<Source> dummySourceList = createDummySourceList();
mockFindAll(dummySourceList);
mockSave(dummySourceList);
Source dummySource = createDummySource();
List<Source> expectedSourceList = new LinkedList<>(dummySourceList);
expectedSourceList.add(dummySource);
controller.createSource(dummySource);
List<Source> actualSourceList = mockedRepository.findAll();
assertEquals(expectedSourceList, actualSourceList);
}
// deleteSource
@Test
void delete_source_removes_source_from_repository() {
List<Source> dummySourceList = createDummySourceList();
mockFindAll(dummySourceList);
mockFindById(dummySourceList);
mockDelete(dummySourceList);
Source dummySource = dummySourceList.get(0);
List<Source> expectedSourceList = new LinkedList<>(dummySourceList);
expectedSourceList.remove(dummySource);
controller.deleteSource(dummySource.getId());
List<Source> actualSourceList = mockedRepository.findAll();
assertEquals(expectedSourceList, actualSourceList);
}
// helper functions
void mockFindAll(List<Source> sourceList) {
when(mockedRepository.findAll()).thenReturn(sourceList);
}
void mockFindById(List<Source> sourceList) {
when(mockedRepository.findById(any(Long.class)))
.thenAnswer((Answer<Optional<Source>>) invocationOnMock -> {
long id = invocationOnMock.getArgument(0);
Source source = findSourceInListById(sourceList, id);
return Optional.ofNullable(source);
});
}
void mockSave(List<Source> sourceList) {
when(mockedRepository.save(any(Source.class)))
.thenAnswer((Answer<Source>) invocationOnMock -> {
Source source = invocationOnMock.getArgument(0);
sourceList.add(source);
return source;
});
}
void mockDelete(List<Source> sourceList) {
doAnswer((Answer<List<Source>>) invocationOnMock -> {
Source source = invocationOnMock.getArgument(0);
sourceList.remove(source);
return sourceList;
}).when(mockedRepository).delete(any(Source.class));
}
private Source createDummySource() {
Source dummySource = new Source();
dummySource.setId(4);
dummySource.setName("Dummy Source");
dummySource.setUrl("https://example.com/dummy-source");
return dummySource;
}
private List<Source> createDummySourceList() {
Source loginAPI = new Source();
loginAPI.setId(0);
loginAPI.setName("Login API");
loginAPI.setUrl("https://example.com/login-api");
Source productAPI = new Source();
productAPI.setId(1);
productAPI.setName("Product API");
productAPI.setUrl("https://example.com/product-api");
Source locationAPI = new Source();
locationAPI.setId(2);
locationAPI.setName("Location API");
locationAPI.setUrl("https://example.com/location-api");
Source ecommerceApp = new Source();
ecommerceApp.setId(3);
ecommerceApp.setName("Ecommerce App");
ecommerceApp.setUrl("https://example.com/ecommerce-app");
List<Source> dummySourceList = new LinkedList<>();
dummySourceList.add(loginAPI);
dummySourceList.add(productAPI);
dummySourceList.add(locationAPI);
dummySourceList.add(ecommerceApp);
return dummySourceList;
}
private Source findSourceInListById(List<Source> sourceList, long id) {
for (Source source : sourceList) {
if (source.getId() == id) {
return source;
}
}
return null;
}
}
| [
"masonpohler@gmail.com"
] | masonpohler@gmail.com |
8438d4f2292932bac30eee950d15857af26b43ae | ce5ab857d1c9c7bce2f98100b0dbcc9bda26b58f | /plugins/OpenSHAFaultPlugins/src/org/scec/vtk/plugins/opensha/simulators/EQSimsDepthColorer.java | 68bf5f6bae0f6aaa47dd6f9eac58626abccb3099 | [
"Apache-2.0"
] | permissive | kevinmilner/scec-vdo | ef6d71a2c2eacdac0003702b08889ec9825b0cbc | bf36d3f9aa5cda1d8d5cb9843a4c764030556799 | refs/heads/master | 2020-03-27T04:03:26.762919 | 2018-10-15T23:44:29 | 2018-10-15T23:44:29 | 145,909,056 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,095 | java | package org.scec.vtk.plugins.opensha.simulators;
import java.awt.Color;
import org.opensha.commons.param.ParameterList;
import org.opensha.commons.util.cpt.CPT;
import org.scec.vtk.commons.opensha.faults.AbstractFaultSection;
import org.scec.vtk.commons.opensha.faults.colorers.CPTBasedColorer;
import org.scec.vtk.commons.opensha.faults.colorers.ColorerChangeListener;
import org.scec.vtk.commons.opensha.faults.colorers.FaultColorer;
import org.scec.vtk.commons.opensha.faults.faultSectionImpl.SimulatorElementFault;
import com.google.common.base.Preconditions;
public class EQSimsDepthColorer extends CPTBasedColorer {
private static CPT getDefaultCPT() {
CPT cpt = new CPT(0d, 15d, Color.BLUE, Color.RED);
return cpt;
}
public EQSimsDepthColorer() {
super(getDefaultCPT(), false);
}
@Override
public String getName() {
return "Depth (km)";
}
@Override
public double getValue(AbstractFaultSection fault) {
Preconditions.checkState(fault instanceof SimulatorElementFault);
return ((SimulatorElementFault)fault).getElement().getCenterLocation().getDepth();
}
}
| [
"kmilner@usc.edu"
] | kmilner@usc.edu |
d23cf3c91960d96f0ba5b2e0083899b7b20e5f67 | dd76d0b680549acb07278b2ecd387cb05ec84d64 | /divestory-CFR/com/google/android/gms/drive/DriveContents.java | cf9f726d8cdff8f4fab4748ca86ece99cd305007 | [] | no_license | ryangardner/excursion-decompiling | 43c99a799ce75a417e636da85bddd5d1d9a9109c | 4b6d11d6f118cdab31328c877c268f3d56b95c58 | refs/heads/master | 2023-07-02T13:32:30.872241 | 2021-08-09T19:33:37 | 2021-08-09T19:33:37 | 299,657,052 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,414 | java | /*
* Decompiled with CFR <Could not determine version>.
*
* Could not load the following classes:
* android.os.ParcelFileDescriptor
*/
package com.google.android.gms.drive;
import android.os.ParcelFileDescriptor;
import com.google.android.gms.common.api.GoogleApiClient;
import com.google.android.gms.common.api.PendingResult;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.drive.Contents;
import com.google.android.gms.drive.DriveApi;
import com.google.android.gms.drive.DriveId;
import com.google.android.gms.drive.ExecutionOptions;
import com.google.android.gms.drive.MetadataChangeSet;
import java.io.InputStream;
import java.io.OutputStream;
public interface DriveContents {
@Deprecated
public PendingResult<Status> commit(GoogleApiClient var1, MetadataChangeSet var2);
@Deprecated
public PendingResult<Status> commit(GoogleApiClient var1, MetadataChangeSet var2, ExecutionOptions var3);
@Deprecated
public void discard(GoogleApiClient var1);
public DriveId getDriveId();
public InputStream getInputStream();
public int getMode();
public OutputStream getOutputStream();
public ParcelFileDescriptor getParcelFileDescriptor();
@Deprecated
public PendingResult<DriveApi.DriveContentsResult> reopenForWrite(GoogleApiClient var1);
public Contents zzi();
public void zzj();
public boolean zzk();
}
| [
"ryan.gardner@coxautoinc.com"
] | ryan.gardner@coxautoinc.com |
2b6a5d05c95caeefd67cdc06c9204fa813d5284f | bbee1790b4e9432f3b2ae0e84ce0d0125b9044fd | /app/src/main/java/com/diligroup/UserSet/activity/ReportSpecial.java | f49aceb8933b9aa4bf201f4bcd10b1964eb32688 | [] | no_license | wtjandjay/JAY | eca109fe003c43f176e659e00466b1193bca009f | 9b32dcb982be86e26f99b3624be8fc885057b6a4 | refs/heads/master | 2021-01-17T20:52:48.630981 | 2016-07-27T09:38:21 | 2016-07-27T09:38:21 | 62,706,961 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,769 | java | package com.diligroup.UserSet.activity;
import android.view.View;
import android.widget.AdapterView;
import android.widget.CheckBox;
import android.widget.ListView;
import com.diligroup.R;
import com.diligroup.UserSet.HistoryAdapter;
import com.diligroup.UserSet.SpecialAdapter;
import com.diligroup.base.BaseActivity;
import com.diligroup.bean.GetHistoryBean;
import com.diligroup.bean.GetSpecialBean;
import com.diligroup.bean.UserInfoBean;
import com.diligroup.net.Action;
import com.diligroup.net.Api;
import com.diligroup.utils.NetUtils;
import com.diligroup.utils.ToastUtil;
import java.util.ArrayList;
import java.util.List;
import butterknife.Bind;
import butterknife.OnClick;
import okhttp3.Request;
/**
* 上报特殊人群
* Created by Kevin on 2016/6/20.
*/
public class ReportSpecial extends BaseActivity {
@Override
public void setTitle(CharSequence title) {
super.setTitle(title);
tv_title.setText("特殊人群");
isShowBack(true);
}
@Override
protected int getContentViewLayoutID() {
return R.layout.activity_select_special;
}
@Bind(R.id.lv_special)
ListView lv_special;
GetSpecialBean specialBean;
SpecialAdapter adapter;
SpecialAdapter.ViewHolder holder;
private List<String> id_list;
List<GetSpecialBean.ListBean> hisList;
@OnClick(R.id.bt_special)
public void ReprotSpe(){
String s=id_list.toString().replaceAll(" ","");
String s2= s.substring(1,s.length()-1);
ToastUtil.showShort(ReportSpecial.this,s2);
UserInfoBean.getInstance().setSpecialCrowdCode(s2);
readyGo(ReportOther.class);
}
@Override
public void setTitle() {
super.setTitle();
tv_title.setText("特殊人群");
}
@Override
protected void onNetworkConnected(NetUtils.NetType type) {
}
@Override
protected void onNetworkDisConnected() {
}
@Override
protected void initViewAndData() {
isShowBack(true);
Api.getSpecial(this);
id_list=new ArrayList<>();
hisList = new ArrayList<>();
lv_special.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
holder= (SpecialAdapter.ViewHolder) view.getTag();
holder.cb.toggle();
HistoryAdapter.getIsSelected().put(position, holder.cb.isChecked());
// 调整选定条目
if (holder.cb.isChecked()){
ToastUtil.showShort(ReportSpecial.this,"Checked"+holder.foodId);
id_list.add(holder.foodId);
}else {
ToastUtil.showShort(ReportSpecial.this,"UnChecked"+holder.foodId);
removeUnChecked(holder.foodId);
}
}
});
}
@Override
public void onError(Request request, Action action, Exception e) {
}
public void removeUnChecked(String foodId) {
if (id_list.size()>0){
for (int i=0;i<id_list.size();i++){
if (id_list.get(i).equals(foodId)){
id_list.remove(foodId);
}
}
}
}
@Override
public void onResponse(Request request, Action action, Object object) {
if (action==Action.GET_SPECIAL&&object!=null){
specialBean= (GetSpecialBean) object;
if (specialBean.getCode().equals("000000")){
hisList= specialBean.getList();
adapter=new SpecialAdapter(this,hisList);
lv_special.setAdapter(adapter);
}
}
}
}
| [
"wtjandjay@sina.com"
] | wtjandjay@sina.com |
95cbb8b6423a64d3ddb836f956bb0164f766c4b8 | 51bb377fe455486481c954eceb11ecf807280b78 | /gateway/src/test/java/com/couchbase/example/config/DatabaseTestConfiguration.java | f8021d566eff674697e3121c46b119bab388af54 | [] | no_license | tchlyah/couchbase-jhipster-microservices-example | 5c6dc8ff53176a0d1e0d5aa9bc73dea14c60bef3 | eed20e1309f2bb9241e0eebb3d510ffe9431ace4 | refs/heads/master | 2020-03-28T02:31:44.626007 | 2018-09-05T20:50:51 | 2018-09-05T20:50:51 | 147,577,346 | 5 | 3 | null | null | null | null | UTF-8 | Java | false | false | 2,615 | java | package com.couchbase.example.config;
import com.couchbase.client.java.Cluster;
import com.couchbase.client.java.bucket.BucketType;
import com.couchbase.client.java.cluster.DefaultBucketSettings;
import com.couchbase.client.java.env.CouchbaseEnvironment;
import org.assertj.core.util.Lists;
import org.springframework.boot.autoconfigure.couchbase.CouchbaseProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.couchbase.config.AbstractCouchbaseConfiguration;
import org.springframework.data.couchbase.config.BeanNames;
import org.springframework.data.couchbase.config.CouchbaseConfigurer;
import org.testcontainers.couchbase.CouchbaseContainer;
import java.util.List;
@Configuration
public class DatabaseTestConfiguration extends AbstractCouchbaseConfiguration {
private CouchbaseProperties couchbaseProperties;
private static CouchbaseContainer<? extends CouchbaseContainer<?>> couchbaseContainer;
public DatabaseTestConfiguration(CouchbaseProperties couchbaseProperties) {
this.couchbaseProperties = couchbaseProperties;
}
@Override
@Bean(destroyMethod = "", name = BeanNames.COUCHBASE_ENV)
public CouchbaseEnvironment couchbaseEnvironment() {
return getCouchbaseContainer().getCouchbaseEnvironment();
}
@Override
public Cluster couchbaseCluster() throws Exception {
return getCouchbaseContainer().getCouchbaseCluster();
}
@Override
protected List<String> getBootstrapHosts() {
return Lists.newArrayList(getCouchbaseContainer().getContainerIpAddress());
}
@Override
protected String getBucketName() {
return couchbaseProperties.getBucket().getName();
}
@Override
protected String getBucketPassword() {
return couchbaseProperties.getBucket().getPassword();
}
@Override
protected CouchbaseConfigurer couchbaseConfigurer() {
return this;
}
private CouchbaseContainer<? extends CouchbaseContainer<?>> getCouchbaseContainer() {
if (couchbaseContainer != null) {
return couchbaseContainer;
}
couchbaseContainer = new CouchbaseContainer<>("couchbase/server:5.5.1");
couchbaseContainer
.withNewBucket(DefaultBucketSettings.builder()
.name(getBucketName())
.password(getBucketPassword())
.type(BucketType.COUCHBASE)
.quota(100)
.build());
couchbaseContainer.start();
return couchbaseContainer;
}
}
| [
"tayebchlyah@gmail.com"
] | tayebchlyah@gmail.com |
1defa9ff9b7b2006b0a2aaff4d1f3fd49588eb00 | c5857739f2db529d877cf33775d375fa2d4a3b30 | /src/pl/scribedroid/input/KeyboardInputMethod.java | 28695ffc009f14898d0e001a22fde52dd01d6e9c | [] | no_license | piotrdubiel/scribedroid | 38e69d433719daf2a0069a44f69dc1ce8263f66d | c86c588e91364c6d7e5f500c7c13d7d18cbf58f9 | HEAD | 2016-09-11T02:56:26.741377 | 2013-11-11T17:39:11 | 2013-11-11T17:39:11 | 39,066,696 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,156 | java | package pl.scribedroid.input;
import java.util.Arrays;
import java.util.List;
import pl.scribedroid.R;
import pl.scribedroid.input.keyboard.StandardKeyboard;
import roboguice.inject.InjectResource;
import android.inputmethodservice.Keyboard;
import android.inputmethodservice.Keyboard.Key;
import android.inputmethodservice.KeyboardView;
import android.util.Log;
import android.widget.Toast;
public class KeyboardInputMethod extends InputMethodController implements
KeyboardView.OnKeyboardActionListener {
private static final String TAG = "KeyboardInputMethod";
KeyboardView keyboard_view;
Keyboard alpha_keyboard;
Keyboard symbols_keyboard;
Keyboard symbols_shift_keyboard;
private static final int NORMAL = 0;
private static final int SHIFTED = 1;
private static final int CAPSLOCK = 2;
private int shift_state = NORMAL;
private int last_keycode = 0;
private int current_keycode = 0;
// TODO
@SuppressWarnings("unused")
private boolean postponed_reset = false;
@InjectResource(R.string.word_separators)
String word_separators;
/**
* Konstruktor inicjuje elementy widoku i ładuje klawiatury (znakową, symboli i symboli z wciśniętym klawiszem Shift).
* Wymaga podania klasy ScribeDroid, z którą będzie powiązany.
* @param s
*/
public KeyboardInputMethod(ScribeDroid s) {
super(s, R.layout.standard_keyboard);
keyboard_view = (KeyboardView) inputView.findViewById(R.id.keyboard);
alpha_keyboard = new StandardKeyboard(service, R.xml.qwerty_keyboard);
symbols_keyboard = new StandardKeyboard(service, R.xml.symbols_keyboard);
symbols_shift_keyboard = new StandardKeyboard(service, R.xml.symbols_shift_keyboard);
keyboard_view.setKeyboard(alpha_keyboard);
keyboard_view.setOnKeyboardActionListener(this);
}
/**
* Resetuje stan klawisza Shift.
* @see pl.scribedroid.input.InputMethodController#resetModifiers()
*/
@Override
public void resetModifiers() {
Log.d(TAG, "Last keycode: " + last_keycode + " Current keycode: " + current_keycode+ " " +isCodeComplex(current_keycode));
if (shift_state == SHIFTED) {
// if (isCodeComplex(current_keycode)) {
// postponed_reset = true;
// return;
// }
// if (postponed_reset && current_keycode == Keyboard.KEYCODE_DELETE) {}
//
shift_state = NORMAL;
((KeyboardView) inputView).setShifted(false);
// }
// else if (!postponed_reset)
}
}
/**
* Obsługuje zdarzenie naciśnięcia na przycisk.
* Inne, możliwe klawisze w zmiennej keyCodes nie są brane pod uwagę
* @see android.inputmethodservice.KeyboardView.OnKeyboardActionListener#onKey(int, int[])
*/
@Override
public void onKey(int primaryCode, int[] keyCodes) {
Log.v(TAG, "OnKey: " + primaryCode + " " + (char) primaryCode);
last_keycode = current_keycode;
current_keycode = primaryCode;
Log.d(TAG, "Last keycode: " + last_keycode + " Current keycode: " + current_keycode);
if (primaryCode == Keyboard.KEYCODE_DELETE) {
service.delete();
}
else if (primaryCode == Keyboard.KEYCODE_SHIFT) {
handleShift();
}
else if (primaryCode == Keyboard.KEYCODE_CANCEL) {
Log.i(TAG, "Input switch requested");
service.switchInputMethod();
return;
}
else if (primaryCode == Keyboard.KEYCODE_MODE_CHANGE && inputView != null) {
Keyboard current = ((KeyboardView) inputView).getKeyboard();
if (current == symbols_keyboard || current == symbols_shift_keyboard) current = alpha_keyboard;
else current = symbols_keyboard;
((KeyboardView) inputView).setKeyboard(current);
if (current == symbols_keyboard) {
current.setShifted(false);
}
}
else {
Log.v(TAG, "OnKey: " + primaryCode + " " + (char) primaryCode);
if (shift_state == SHIFTED || shift_state == CAPSLOCK) service.enterCharacter(Character.toUpperCase((char) primaryCode));
else service.enterCharacter((char) primaryCode);
resetModifiers();
}
}
private void handleShift() {
if (inputView == null) {
return;
}
Keyboard currentKeyboard = ((KeyboardView) inputView).getKeyboard();
if (currentKeyboard == alpha_keyboard) {
if (shift_state == NORMAL) {
shift_state = SHIFTED;
}
else if (shift_state == SHIFTED) {
shift_state = CAPSLOCK;
Toast.makeText(service, "CapsLock", Toast.LENGTH_SHORT).show();
}
else if (shift_state == CAPSLOCK) {
shift_state = NORMAL;
}
((KeyboardView) inputView).setShifted(shift_state == CAPSLOCK || !((KeyboardView) inputView).isShifted());
}
else if (currentKeyboard == symbols_keyboard) {
symbols_keyboard.setShifted(true);
((KeyboardView) inputView).setKeyboard(symbols_shift_keyboard);
symbols_shift_keyboard.setShifted(true);
}
else if (currentKeyboard == symbols_shift_keyboard) {
symbols_shift_keyboard.setShifted(false);
((KeyboardView) inputView).setKeyboard(symbols_keyboard);
symbols_keyboard.setShifted(false);
}
}
@Override
public void onPress(int primaryCode) {
}
@Override
public void onRelease(int primaryCode) {
}
@Override
public void onText(CharSequence text) {
}
@Override
public void swipeDown() {
service.switchInputMethod();
}
@Override
public void swipeLeft() {
Log.d(TAG, "Left");
}
@Override
public void swipeRight() {
Log.d(TAG, "Right");
}
@Override
public void swipeUp() {
//handleShift();
Log.d(TAG, "Up");
}
boolean isCodeComplex(int keycode) {
Keyboard current_keyboard = ((KeyboardView) inputView).getKeyboard();
List<Key> keys = current_keyboard.getKeys();
for (Key k : keys) {
if (Arrays.binarySearch(k.codes, keycode) >= 0 && k.codes.length > 1) return true;
}
return false;
}
boolean isCodeInOneKey(int keycode_a, int keycode_b) {
Keyboard current_keyboard = ((KeyboardView) inputView).getKeyboard();
List<Key> keys = current_keyboard.getKeys();
for (Key k : keys) {
if (Arrays.binarySearch(k.codes, keycode_a) >= 0 &&Arrays.binarySearch(k.codes, keycode_b) >= 0) return true;
}
return false;
}
}
| [
"piotrek@piotrek-desk"
] | piotrek@piotrek-desk |
e0cdcd2c196deb5f4aa895cd86403a55b1b779ca | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/3/3_873852f05f381d5d39b8aabcf6bcb38feb97ef1e/JavaSourcesSubject/3_873852f05f381d5d39b8aabcf6bcb38feb97ef1e_JavaSourcesSubject_t.java | a1e08983d93313c27b7e65174ff6b332c9520740 | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 13,106 | java | /*
* Copyright (C) 2013 Google, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.google.testing.compile;
import java.io.IOException;
import java.util.Arrays;
import javax.annotation.CheckReturnValue;
import javax.annotation.processing.Processor;
import javax.tools.Diagnostic;
import javax.tools.Diagnostic.Kind;
import javax.tools.FileObject;
import javax.tools.JavaFileObject;
import org.truth0.FailureStrategy;
import org.truth0.subjects.Subject;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
import com.google.common.base.Optional;
import com.google.common.base.Predicate;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.io.ByteStreams;
import com.sun.source.tree.CompilationUnitTree;
/**
* A <a href="https://github.com/truth0/truth">Truth</a> {@link Subject} that evaluates the result
* of a {@code javac} compilation.
*
* @author Gregory Kick
*/
public final class JavaSourcesSubject
extends Subject<JavaSourcesSubject, Iterable<? extends JavaFileObject>> {
JavaSourcesSubject(FailureStrategy failureStrategy, Iterable<? extends JavaFileObject> subject) {
super(failureStrategy, subject);
}
public interface ChainingClause<T> {
T and();
}
public interface FileClause extends ChainingClause<UnuccessfulCompilationClause> {
LineClause in(JavaFileObject file);
}
public interface LineClause extends ChainingClause<UnuccessfulCompilationClause> {
ColumnClause onLine(long lineNumber);
}
public interface ColumnClause extends ChainingClause<UnuccessfulCompilationClause> {
ChainingClause<UnuccessfulCompilationClause> atColumn(long columnNumber);
}
public interface GeneratedPredicateClause {
SuccessfulCompilationClause generatesSources(JavaFileObject first, JavaFileObject... rest);
SuccessfulCompilationClause generatesFiles(JavaFileObject first, JavaFileObject... rest);
}
public interface SuccessfulCompilationClause extends ChainingClause<GeneratedPredicateClause> {}
public interface UnuccessfulCompilationClause {
FileClause hasError(String message);
}
@CheckReturnValue
public CompilationClause processedWith(Processor first, Processor... rest) {
return new CompilationClause(Lists.asList(first, rest));
}
private CompilationClause newCompilationClause(Iterable<? extends Processor> processors) {
return new CompilationClause(processors);
}
public final class CompilationClause {
private final ImmutableSet<Processor> processors;
private CompilationClause() {
this(ImmutableSet.<Processor>of());
}
private CompilationClause(Iterable<? extends Processor> processors) {
this.processors = ImmutableSet.copyOf(processors);
}
public SuccessfulCompilationClause hasNoErrors() {
Compilation.Result result = Compilation.compile(processors, getSubject());
ImmutableList<Diagnostic<? extends JavaFileObject>> errors =
result.diagnosticsByKind.get(Kind.ERROR);
if (!errors.isEmpty()) {
StringBuilder message = new StringBuilder("Compilation produced the following errors:\n");
Joiner.on("\n").appendTo(message, errors);
failureStrategy.fail(message.toString());
}
return new SuccessfulCompilationBuilder(result);
}
public FileClause hasError(String message) {
Compilation.Result result = Compilation.compile(processors, getSubject());
return new UnsuccessfulCompilationBuilder(result).hasError(message);
}
}
public SuccessfulCompilationClause hasNoErrors() {
return new CompilationClause().hasNoErrors();
}
public FileClause hasError(String message) {
return new CompilationClause().hasError(message);
}
private final class UnsuccessfulCompilationBuilder implements UnuccessfulCompilationClause {
private final Compilation.Result result;
UnsuccessfulCompilationBuilder(Compilation.Result result) {
this.result = result;
}
@Override
public FileClause hasError(final String message) {
FluentIterable<Diagnostic<? extends JavaFileObject>> diagnostics =
FluentIterable.from(result.diagnosticsByKind.get(Kind.ERROR));
final FluentIterable<Diagnostic<? extends JavaFileObject>> diagnosticsWithMessage =
diagnostics.filter(new Predicate<Diagnostic<?>>() {
@Override
public boolean apply(Diagnostic<?> input) {
return message.equals(input.getMessage(null));
}
});
if (diagnosticsWithMessage.isEmpty()) {
failureStrategy.fail(String.format(
"Expected an error with message \"%s\", but only found %s", message,
diagnostics.transform(
new Function<Diagnostic<?>, String>() {
@Override public String apply(Diagnostic<?> input) {
return "\"" + input.getMessage(null) + "\"";
}
})));
}
return new FileClause() {
@Override
public UnuccessfulCompilationClause and() {
return UnsuccessfulCompilationBuilder.this;
}
@Override
public LineClause in(final JavaFileObject file) {
FluentIterable<Diagnostic<? extends JavaFileObject>> diagnosticsInFile =
diagnosticsWithMessage.filter(new Predicate<Diagnostic<? extends FileObject>>() {
@Override
public boolean apply(Diagnostic<? extends FileObject> input) {
return file.toUri().getPath().equals(input.getSource().toUri().getPath());
}
});
if (diagnosticsInFile.isEmpty()) {
failureStrategy.fail(String.format(
"Expected an error in %s, but only found errors in ", file.getName(),
diagnosticsWithMessage.transform(
new Function<Diagnostic<? extends FileObject>, String>() {
@Override public String apply(Diagnostic<? extends FileObject> input) {
return input.getSource().getName();
}
})));
}
return new LineClause() {
@Override public UnuccessfulCompilationClause and() {
return UnsuccessfulCompilationBuilder.this;
}
@Override public ColumnClause onLine(final long lineNumber) {
final FluentIterable<Diagnostic<? extends JavaFileObject>> diagnosticsOnLine =
diagnosticsWithMessage.filter(new Predicate<Diagnostic<?>>() {
@Override
public boolean apply(Diagnostic<?> input) {
return lineNumber == input.getLineNumber();
}
});
if (diagnosticsOnLine.isEmpty()) {
failureStrategy.fail(String.format(
"Expected an error on line %d, but only found errors on line(s) %s",
lineNumber, diagnosticsOnLine.transform(
new Function<Diagnostic<?>, Long>() {
@Override public Long apply(Diagnostic<?> input) {
return input.getLineNumber();
}
})));
}
return new ColumnClause() {
@Override
public UnuccessfulCompilationClause and() {
return UnsuccessfulCompilationBuilder.this;
}
@Override
public ChainingClause<UnuccessfulCompilationClause> atColumn(
final long columnNumber) {
FluentIterable<Diagnostic<? extends JavaFileObject>> diagnosticsAtColumn =
diagnosticsOnLine.filter(new Predicate<Diagnostic<?>>() {
@Override
public boolean apply(Diagnostic<?> input) {
return columnNumber == input.getColumnNumber();
}
});
if (diagnosticsAtColumn.isEmpty()) {
failureStrategy.fail(String.format(
"Expected an error at column %d, but only found errors at column(s) %s",
columnNumber, diagnosticsOnLine.transform(
new Function<Diagnostic<?>, Long>() {
@Override public Long apply(Diagnostic<?> input) {
return input.getColumnNumber();
}
})));
}
return new ChainingClause<JavaSourcesSubject.UnuccessfulCompilationClause>() {
@Override public UnuccessfulCompilationClause and() {
return UnsuccessfulCompilationBuilder.this;
}
};
}
};
}
};
}
};
}
}
private final class SuccessfulCompilationBuilder implements SuccessfulCompilationClause,
GeneratedPredicateClause {
private final Compilation.Result result;
SuccessfulCompilationBuilder(Compilation.Result result) {
this.result = result;
}
@Override
public GeneratedPredicateClause and() {
return this;
}
@Override
public SuccessfulCompilationClause generatesSources(JavaFileObject first,
JavaFileObject... rest) {
ImmutableList<JavaFileObject> generatedSources =
result.generatedFilesByKind.get(JavaFileObject.Kind.SOURCE);
Iterable<? extends CompilationUnitTree> actualCompilationUnits =
Compilation.parse(generatedSources);
final EqualityScanner scanner = new EqualityScanner();
for (final CompilationUnitTree expected : Compilation.parse(Lists.asList(first, rest))) {
Optional<? extends CompilationUnitTree> found =
Iterables.tryFind(actualCompilationUnits, new Predicate<CompilationUnitTree>() {
@Override
public boolean apply(CompilationUnitTree input) {
return scanner.visitCompilationUnit(expected, input);
}
});
if (!found.isPresent()) {
failureStrategy.fail("Did not find a source file coresponding to "
+ expected.getSourceFile().getName());
}
}
return this;
}
@Override
public SuccessfulCompilationClause generatesFiles(JavaFileObject first,
JavaFileObject... rest) {
for (JavaFileObject expected : Lists.asList(first, rest)) {
if (!wasGenerated(result, expected)) {
failureStrategy.fail("Did not find a generated file corresponding to "
+ expected.getName());
}
}
return this;
}
boolean wasGenerated(Compilation.Result result, JavaFileObject expected) {
for (JavaFileObject generated : result.generatedFilesByKind.get(expected.getKind())) {
try {
if (Arrays.equals(
ByteStreams.toByteArray(expected.openInputStream()),
ByteStreams.toByteArray(generated.openInputStream()))) {
return true;
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
return false;
}
}
public static final class SingleSourceAdapter
extends Subject<SingleSourceAdapter, JavaFileObject> {
private final JavaSourcesSubject delegate;
SingleSourceAdapter(FailureStrategy failureStrategy, JavaFileObject subject) {
super(failureStrategy, subject);
this.delegate =
new JavaSourcesSubject(failureStrategy, ImmutableList.of(subject));
}
@CheckReturnValue
public CompilationClause processedWith(Processor first, Processor... rest) {
return delegate.newCompilationClause(Lists.asList(first, rest));
}
public SuccessfulCompilationClause hasNoErrors() {
return delegate.hasNoErrors();
}
public FileClause hasError(String message) {
return delegate.hasError(message);
}
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
1a38dbf592efe4e848c7df73c1142cd1ce311cdc | 19dab7de1c0dfcbb582dddbe17e88f3d5b7a0e1b | /Assignments/Assignment 3 - Flashcard Application/MultiplicationFlashCardApplication.java | 14176015da0e16d78c8832208b5b08ac2452b345 | [] | no_license | Junebuggi/SYSC-2004 | 6f93d280a39b3baea2f86226ea69b825ed7624e0 | 630317ef4e7aa7db0be8a883c38eb377eacc6c6f | refs/heads/master | 2020-04-05T16:24:31.235547 | 2018-12-16T13:27:36 | 2018-12-16T13:27:36 | 157,010,940 | 0 | 0 | null | 2018-11-10T18:54:47 | 2018-11-10T18:46:09 | null | UTF-8 | Java | false | false | 1,921 | java | import java.util.Scanner;
/**
* An implementation of a multiplication flashCard application that cycles through all
* the cards until user answers all correctly or quits the game
*
* @author emmaboulay
* @version 1.0
*/
public class MultiplicationFlashCardApplication {
/**
* @param args
*/
public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
System.out.println("Which times tables would you like to test? (Between 1 and 12 inclusive)");
String[] parts = scanner.nextLine().split(" "); //Turns a user input string "2 3 4 5" into an array of ints [2,3,4,5]
int[] nums = new int[parts.length];
for(int i = 0; i < parts.length; i++) {
nums[i] = Integer.parseInt(parts[i]);
}
MultiplicationFlashCards cards = new MultiplicationFlashCards(nums);
String command = "Y";
while(command.toLowerCase().equals("y")){ //Game continues if the deck is not empty and user has not quit
if(!cards.nextCard()) {
System.out.println("Congratulations! You finished the deck!"); //This was the last card. No point asking if user wants to continue since they finished the deck
break;
}
System.out.println("Score = " + cards.getScore());
System.out.println("Next? (Y or N)");
command = scanner.next();
while(!command.toLowerCase().equals("y") && !command.toLowerCase().equals("n")){ // If user gives a invalid input. User will be prompted to do it again until they give a proper input
System.out.println("Sorry, that's not a valid input. Please try again");
command = scanner.next();
}
}
System.out.println("You've got a score of " + cards.getScore() + " so far");
}
}
| [
"emmaboulay@cmail.carleton.ca"
] | emmaboulay@cmail.carleton.ca |
4847c18d557c254168aafca77c4b01ed05085a12 | 21c70f242ba92c4f5c23b2ceb88f897413a71da4 | /src/main/java/com/hujian/switcher/reactive/functions/Function4.java | 03635d3e51b08cc8124182cb88ca3356e79d1fcc | [
"Apache-2.0"
] | permissive | pandening/JSwitcher | fd16829be94f1001cd42e98b5c347357bf815742 | c536f5ec71e0fea847aa2517ae030509b7fe5ff7 | refs/heads/facade | 2021-01-19T12:25:15.543666 | 2017-09-20T14:52:27 | 2017-09-20T14:52:27 | 100,784,178 | 2 | 0 | null | 2017-09-27T14:54:33 | 2017-08-19T09:28:29 | Java | UTF-8 | Java | false | false | 1,293 | java | /**
* Copyright (c) 2017 hujian
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hujian.switcher.reactive.functions;
/**
* A functional interface (callback) that computes a value based on multiple input values.
* @param <T1> the first value type
* @param <T2> the second value type
* @param <T3> the third value type
* @param <T4> the fourth value type
* @param <R> the result type
*/
public interface Function4<T1, T2, T3, T4, R> {
/**
* Calculate a value based on the input values.
* @param t1 the first value
* @param t2 the second value
* @param t3 the third value
* @param t4 the fourth value
* @return the result value
* @throws Exception on error
*/
R apply(T1 t1, T2 t2, T3 t3, T4 t4) throws Exception;
}
| [
"hujian06@meituan.com"
] | hujian06@meituan.com |
c57f33f6f0e4f222582b1b1b777fac0c42f0b276 | 775d1f1391abe3c98a7ec2f18ff41f371a7348f3 | /FragmentoBasico/app/src/test/java/com/example/vorper/fragmentobasico/ExampleUnitTest.java | 5811873176a644d6fba39aa6d661c4749a2aba13 | [] | no_license | voroferrer1/PMM | c7c7172b067c8d34ffa5f3f4ff8f36cce66c9758 | 4704c8c18d9673ec149d98b72f2975db27c25120 | refs/heads/master | 2020-03-30T09:28:11.952540 | 2019-02-10T11:39:37 | 2019-02-10T11:39:37 | 151,076,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 395 | java | package com.example.vorper.fragmentobasico;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
} | [
"2dam.vferrer@institutoserpis.org"
] | 2dam.vferrer@institutoserpis.org |
5b4f5d16cf70218ab9ce77629b5f7f29c54d0a66 | 523bda2ab3d4c68832182fc46da2e4068bea61a1 | /TwoLinkedList.java | aada47d4f0eb0dbb66e20382f776d4d75f7e12a5 | [] | no_license | BrigadaN9JAVA/TAlab3 | 0a928e0f2720b69d9a203dd97115f1958ccad1e2 | e781e11818764f519f4d8eca67a7cfc29cb71bff | refs/heads/master | 2023-03-21T08:01:24.127814 | 2021-03-22T10:59:44 | 2021-03-22T10:59:44 | 350,309,322 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,774 | java | public class TwoLinkedList<T> implements LinkedList<T>{
private NodeTwoLinked<T> head;
private NodeTwoLinked<T> tail;
private NodeTwoLinked<T> iterator;
private int size;
public TwoLinkedList(){
size = 0;
head = null;
tail = null;
iterator = null;
}
public NodeTwoLinked<T> getHead() {
return head;
}
public void setHead(NodeTwoLinked<T> head) {
this.head = head;
}
public NodeTwoLinked<T> getTail() {
return tail;
}
public void setTail(NodeTwoLinked<T> tail) {
this.tail = tail;
}
public NodeTwoLinked<T> getIterator() {
return iterator;
}
public void setIterator(NodeTwoLinked<T> iterator) {
this.iterator = iterator;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public boolean isEmpty(){
return getSize() == 0;
}
public void addFront(T data){
if(isEmpty()){
NodeTwoLinked<T> Node = new NodeTwoLinked<>();
Node.setData(data);
head = Node;
tail = Node;
}
else{
NodeTwoLinked<T> Node = new NodeTwoLinked<>();
Node.setData(data);
Node.setNext(head);
head.setPrevious(Node);
head = Node;
}
size++;
}
public void addBack(T data){
if(isEmpty()){
NodeTwoLinked<T> Node = new NodeTwoLinked<>();
Node.setData(data);
head = Node;
tail = Node;
}
else{
NodeTwoLinked<T> Node = new NodeTwoLinked<>();
Node.setData(data);
Node.setPrevious(tail);
tail.setNext(Node);
tail = Node;
}
size++;
}
public void insert(T data, int position){
if(position == 1){
addFront(data);
}
else if(position == size+1){
addBack(data);
}
else if(position > 1 && position <= size){
int count = 1;
iterator = head;
while(count != position-1){
iterator = iterator.getNext();
count++;
}
NodeTwoLinked<T> Node = new NodeTwoLinked<>();
Node.setData(data);
Node.setPrevious(iterator);
Node.setNext(iterator.getNext());
iterator.getNext().setPrevious(Node);
iterator.setNext(Node);
size++;
}
else{
System.out.println("Position is incorrect. Input other number");
}
}
public void removeFront(){
if(isEmpty()){
System.out.println("List is Empty. Cant remove the element");
}
else{
head = head.getNext();
head.setPrevious(null);
size--;
}
}
public void removeBack(){
if(isEmpty()){
System.out.println("List is Empty. Cant remove the element");
}
else{
tail = tail.getPrevious();
tail.setNext(null);
size--;
}
}
public void delete(int position){
if(isEmpty()){
System.out.println("List is Empty. Cant remove the element");
}
else if (position==1){
removeFront();
}
else if(position == getSize()){
removeBack();
}
else if(position > 1 && position < getSize()){
int count = 1;
iterator = head;
while(count != position-1){
iterator = iterator.getNext();
count++;
}
iterator.setNext(iterator.getNext().getNext());
iterator.getNext().setPrevious(iterator);
size--;
}
else {
System.out.println("Position is incorrect. Input other number");
}
}
public int getIndex(T data){
iterator = head;
int count = 0;
while(iterator != tail.getNext()){
if(iterator.getData().equals(data)){
return count;
}
count++;
iterator = iterator.getNext();
}
return -1;
}
public void display(){
if(isEmpty()){
System.out.println("List is empty");
}
else{
iterator = head;
while(iterator != tail.getNext()){
System.out.print(iterator.getData() + " ");
iterator = iterator.getNext();
}
System.out.println();
}
}
public void clear(){
size = 0;
iterator = null;
head = null;
tail = null;
}
}
| [
"vlad04102002@gmail.com"
] | vlad04102002@gmail.com |
b145c625621d29984bed4b07e0a071aa9c77f878 | ea646255823d48d89cfcc09de21af1c5c8e73433 | /src/main/java/ch/hsr/maloney/processing/DiskImageJob.java | bb7d2c23765aee1d752203f1a6e14b0328ba7e3d | [] | no_license | rehrbar/maloney | 64ac5a6e9dd369ef55a5b655b96a958bfb048b9c | 001a82ea5abc2d0972f1a94ddca780df0ca7ce41 | refs/heads/master | 2021-03-30T15:53:53.256758 | 2016-12-21T14:37:48 | 2016-12-21T14:37:48 | 71,127,298 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,667 | java | package ch.hsr.maloney.processing;
import ch.hsr.maloney.core.FrameworkEventNames;
import ch.hsr.maloney.storage.FileExtractor;
import ch.hsr.maloney.storage.FileSystemMetadata;
import ch.hsr.maloney.util.Context;
import ch.hsr.maloney.util.Event;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;
/**
* A job which can process disk images. Mainly, it adds the image and generates the necessary events for ohter modules.
*/
public class DiskImageJob implements Job {
private static final String JOB_NAME = "ImportRdsHashSetJob";
private static final String NewDiskImageEventName = "newDiskImage";
private LinkedList<String> producedEvents;
private LinkedList<String> requiredEvents;
private Path path;
public DiskImageJob() {
producedEvents = new LinkedList<String>() {{
add(NewDiskImageEventName);
}};
requiredEvents = new LinkedList<String>(){{
add(FrameworkEventNames.STARTUP);
}};
}
@Override
public boolean canRun(Context ctx, Event evt) {
return Files.exists(path);
}
@Override
public List<Event> run(Context ctx, Event evt) {
UUID uuid = ctx.getDataSource().addFile(null, new FileExtractor() {
@Override
public boolean useOriginalFile() {
return true;
}
@Override
public Path extractFile() {
return path;
}
@Override
public FileSystemMetadata extractMetadata() {
// TODO supply some metadata about the image. E.g. creationDate, name, etc.
FileSystemMetadata metadata = new FileSystemMetadata();
metadata.setFileName(path.getFileName().toString());
return metadata;
}
@Override
public void cleanup() {
// nothing to cleanup yet
}
});
Event event = new Event(NewDiskImageEventName, JOB_NAME, uuid);
return new LinkedList<Event>() {{
add(event);
}};
}
@Override
public List<String> getRequiredEvents() {
return requiredEvents;
}
@Override
public List<String> getProducedEvents() {
return producedEvents;
}
@Override
public String getJobName() {
return JOB_NAME;
}
@Override
public String getJobConfig() {
return path.toString();
}
@Override
public void setJobConfig(String config) {
path = Paths.get(config);
}
}
| [
"r1ehrbar@hsr.ch"
] | r1ehrbar@hsr.ch |
4f984fbdbb9f4bbd07e487a4b4bb6dad2239f8f6 | 98884e3b3a18fad648c14f4c0960673dcd70c6a2 | /src/com/intelligt/modbus/jlibmodbus/net/transport/ModbusTransportFactory.java | a4370c218bd005b9448ce551f04d3069a24d60bd | [
"Apache-2.0"
] | permissive | kochedykov/jlibmodbus | ca954b79b3dad3c320a4c7a730aa316a90a7920f | c6f663bbc3d1d8e076d418d7b974bec8bc8e551a | refs/heads/master | 2022-11-23T16:51:16.105020 | 2022-11-15T06:06:59 | 2022-11-15T06:06:59 | 51,168,154 | 254 | 143 | Apache-2.0 | 2022-11-15T06:07:00 | 2016-02-05T19:12:50 | Java | UTF-8 | Java | false | false | 1,364 | java | package com.intelligt.modbus.jlibmodbus.net.transport;
import com.intelligt.modbus.jlibmodbus.serial.SerialPort;
import java.io.IOException;
import java.net.Socket;
/*
* Copyright (C) 2016 "Invertor" Factory", JSC
* [http://www.sbp-invertor.ru]
*
* This file is part of JLibModbus.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Authors: Vladislav Y. Kochedykov, software engineer.
* email: vladislav.kochedykov@gmail.com
*/
public class ModbusTransportFactory {
static public ModbusTransport createRTU(SerialPort serial) {
return new ModbusTransportRTU(serial);
}
static public ModbusTransport createASCII(SerialPort serial) {
return new ModbusTransportASCII(serial);
}
static public ModbusTransport createTCP(Socket socket) throws IOException {
return new ModbusTransportTCP(socket);
}
}
| [
"vladislav.kochedykov@gmail.com"
] | vladislav.kochedykov@gmail.com |
4300a927ed71158460b4ecb23ad3ef731980d066 | 3ef63a8c0fa1a093f82e0bc71aa7ea37d76234b7 | /SoftUni Java Course/04. Java-Collections/_12_CardsFrequencies.java | ffbf0d66fdaea6450b1f545f03ce68035bc7f298 | [] | no_license | reathh/Java | f5c345b5e719c5916e9a6eca7cbe4c8b082cf908 | ff9ad8870e01506d84ba931f59a0abcbdf172a69 | refs/heads/master | 2016-08-05T08:26:23.919774 | 2014-07-12T18:41:49 | 2014-07-12T18:41:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,325 | java | import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;
public class _12_CardsFrequencies {
public static void main(String[] args) {
try (Scanner scanner = new Scanner(System.in)) {
String[] cards = scanner.nextLine().split("[♥♣♦♠ ]+");
int N = cards.length;
// use linked hash map to preserve initial order of elements
Map<String, Integer> cardOccurrences = new LinkedHashMap<String, Integer>();
for (String card : cards) {
Integer count = cardOccurrences.get(card);
if (count == null) count = 0;
cardOccurrences.put(card, count + 1);
}
// print
for (Map.Entry<String, Integer> entry : cardOccurrences.entrySet()){
System.out.printf("%s -> %.2f%%\n", entry.getKey(),
(double)entry.getValue() * 100 / N);
}
} catch (Exception e) {
e.printStackTrace();
}
}
} | [
"Ivelin Kirilov"
] | Ivelin Kirilov |
f9c6f1a5a1b024b1feb705e7d55de18406580b30 | 58273f9701a5907b8386fde1f7b63b3ca90941ed | /transforms/AppProfiles.java | ab7af514d8aa83aba16b00b0011833dfabdea177 | [] | no_license | zwang190/Code_Sample | 7c2a2bfa9eeebead38b6910a92fcf031eec9bca5 | f57b4ff5aebdcca309be9530131408c11d312e98 | refs/heads/master | 2023-02-17T12:30:39.414367 | 2021-01-20T07:44:03 | 2021-01-20T07:44:03 | 331,229,565 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,786 | java | package edu.usfca.dataflow.transforms;
import edu.usfca.dataflow.CorruptedDataException;
import edu.usfca.dataflow.utils.DeviceProfileUtils;
import edu.usfca.protobuf.Common;
import edu.usfca.protobuf.Profile.AppProfile;
import edu.usfca.protobuf.Profile.DeviceProfile;
import edu.usfca.protobuf.opt.BidOpt.ExchangeOpt;
import org.apache.beam.sdk.transforms.*;
import org.apache.beam.sdk.values.KV;
import org.apache.beam.sdk.values.PCollection;
import org.apache.beam.sdk.values.TypeDescriptor;
import java.util.Iterator;
public class AppProfiles {
/**
* "ComputeAppProfiles" takes in one PCollection of DeviceProfiles.
* <p>
* If the input PCollection contains any duplicate Device IDs (recall that uuid is case-insensitive),
* <p>
* then it must throw "CorruptedDataException".
* <p>
* Otherwise, proceed to produce one AppProfile proto per "bundle" (String, case-sensitive).
* <p>
* For each bundle (app), you should aggregate:
* <p>
* (1) "bundle": This is unique key (String) for each AppProfile, and is case-sensitive.
* <p>
* (2) "user_count": This is the unique number of users (Device IDs) who have this app in their DeviceProfile's
* AppActivity.
* <p>
* (3) "user_count_per_exchange": Same as (2), but it's a map from "Exchange" enum (its integer value) to the number
* of unique DeviceIDs.
* <p>
* (Note that this is simplified when compared to Project 2.)
* <p>
* TODO: You can use instructor's reference code from project 2 and modify it (you'll need to fix a couple of things),
* or reuse yours. Note that either way you'll have to make changes because the requirements / proto definitions have
* changed slightly (things are simplified).
*/
public static class ComputeAppProfiles extends PTransform<PCollection<DeviceProfile>, PCollection<AppProfile>> {
@Override
public PCollection<AppProfile> expand(PCollection<DeviceProfile> input) {
// check condition (a). (This is given to you in order to show you how you should handle cases like this.)
if (input == null) {
throw new CorruptedDataException("PCollectionList is null or its size is not 2");
}
checkId(getIdAndDpForAppProfiles(input));
final int offset = 1;
final int arrSize = ExchangeOpt.CS_VALUE + offset + 1;
return input.apply(ParDo.of(new EmitData())).apply(Count.perElement())
.apply(ParDo.of(new DoFn<KV<KV<String, Integer>, Long>, KV<String, KV<Integer, Long>>>() {
@ProcessElement
public void process(ProcessContext c) {
c.output(
KV.of(c.element().getKey().getKey(), KV.of(c.element().getKey().getValue(), c.element().getValue())));
}
})).apply(Combine.perKey(new Combine.CombineFn<KV<Integer, Long>, int[], AppProfile>() {
@Override
public int[] createAccumulator() {
return new int[arrSize];
}
@Override
public int[] addInput(int[] mutableAccumulator, KV<Integer, Long> input) {
mutableAccumulator[input.getKey() + offset] =
mutableAccumulator[input.getKey() + offset] + input.getValue().intValue();
return mutableAccumulator;
}
@Override
public int[] mergeAccumulators(Iterable<int[]> accumulators) {
Iterator<int[]> it = accumulators.iterator();
int[] first = null;
while (it.hasNext()) {
int[] next = it.next();
if (first == null)
first = next;
else {
for (int i = 0; i < arrSize; i++) {
first[i] += next[i];
}
}
}
return first;
}
@Override
public AppProfile extractOutput(int[] accumulator) {
AppProfile.Builder ap = AppProfile.newBuilder();
ap.setUserCount(accumulator[LIFE_COUNT + offset]);
for (ExchangeOpt exchange : ExchangeOpt.values()) {
if (exchange == ExchangeOpt.UNRECOGNIZED) {
continue;
}
if (accumulator[exchange.getNumber() + offset] != 0) {
ap.putUserCountPerExchange(exchange.getNumber(), accumulator[exchange.getNumber() + offset]);
}
}
return ap.build();
}
})).apply(MapElements.into(TypeDescriptor.of(AppProfile.class))
.via((KV<String, AppProfile> x) -> x.getValue().toBuilder().setBundle(x.getKey()).build()));
}
public static PCollection<KV<Common.DeviceId, DeviceProfile>> getIdAndDpForAppProfiles(PCollection<DeviceProfile> collection) {
PCollection<KV<Common.DeviceId, DeviceProfile>> res;
res = collection.apply("GenerateDPWithKV", ParDo.of(new DoFn<DeviceProfile, KV<Common.DeviceId, DeviceProfile>>() {
@ProcessElement
public void process(@Element DeviceProfile elem, OutputReceiver<KV<Common.DeviceId, DeviceProfile>> out) {
if (!DeviceProfileUtils.isDpValid(elem)) {
throw new CorruptedDataException("DeviceId is invalid");
}
Common.DeviceId canonical = elem.getDeviceId().toBuilder().setUuid(elem.getDeviceId().getUuid().toLowerCase()).build();
out.output(KV.of(canonical, elem.toBuilder().setDeviceId(canonical).build()));
}
}));
return res;
}
public static void checkId(PCollection<KV<Common.DeviceId, DeviceProfile>> input) {
input.apply(Count.perKey())
.apply("CheckDuplicate", ParDo.of(new DoFn<KV<Common.DeviceId, Long>, String>() {
@ProcessElement
public void process(@Element KV<Common.DeviceId, Long> elem) {
if (elem.getValue() != 1)
throw new CorruptedDataException("Duplicate deviceId is detected");
}
}));
}
}
static final int LIFE_COUNT = -1;
static class EmitData extends DoFn<DeviceProfile, KV<String, Integer>> {
@ProcessElement
public void process(ProcessContext c) {
DeviceProfile dp = c.element();
for (DeviceProfile.AppActivity app : dp.getAppList()) {
c.output(KV.of(app.getBundle(), LIFE_COUNT));
for (int exchange : app.getCountPerExchangeMap().keySet()) {
if (exchange < 0) {
continue;
}
c.output(KV.of(app.getBundle(), exchange));
}
}
}
}
}
| [
"zirongwang@Zirongs-MacBook-Pro.local"
] | zirongwang@Zirongs-MacBook-Pro.local |
d15038151a6afc19050cf54c11644c6021c85aee | 76ba65e1f1921ba206ba9ad7fd100380a0b8d51a | /sany-security/src/main/java/com/sany/security/config/bean/LoginProperties.java | bc650243491a11d3d398b645f71860817e297b9e | [
"Apache-2.0"
] | permissive | galilove/admin | 40989d3dad9bc9d856e152a03c0fb193a395d9fa | 8fbd72bb782b6081162810d95354aae4deb4c035 | refs/heads/master | 2023-02-16T05:08:32.138118 | 2021-01-10T14:32:27 | 2021-01-10T14:32:27 | 327,631,649 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,661 | java | /*
* Copyright 2019-2020 the original author or authors.
*
* Licensed under the Apache License, Version loginCode.length.0 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-loginCode.length.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package com.sany.security.config.bean;
import java.awt.*;
import java.util.Objects;
import com.wf.captcha.*;
import com.wf.captcha.base.Captcha;
import lombok.Data;
import me.zhengjie.exception.BadConfigurationException;
import me.zhengjie.utils.StringUtils;
/**
* 配置文件读取
*
* @author liaojinlong
* @date loginCode.length0loginCode.length0/6/10 17:loginCode.length6
*/
@Data
public class LoginProperties {
/**
* 账号单用户 登录
*/
private boolean singleLogin = false;
private LoginCode loginCode;
/**
* 用户登录信息缓存
*/
private boolean cacheEnable;
public boolean isSingleLogin() {
return singleLogin;
}
public boolean isCacheEnable() {
return cacheEnable;
}
/**
* 获取验证码生产类
*
* @return /
*/
public Captcha getCaptcha() {
if (Objects.isNull(loginCode)) {
loginCode = new LoginCode();
if (Objects.isNull(loginCode.getCodeType())) {
loginCode.setCodeType(LoginCodeEnum.arithmetic);
}
}
return switchCaptcha(loginCode);
}
/**
* 依据配置信息生产验证码
*
* @param loginCode
* 验证码配置信息
* @return /
*/
private Captcha switchCaptcha(LoginCode loginCode) {
Captcha captcha;
synchronized (this) {
switch (loginCode.getCodeType()) {
case arithmetic:
// 算术类型 https://gitee.com/whvse/EasyCaptcha
captcha = new ArithmeticCaptcha(loginCode.getWidth(), loginCode.getHeight());
// 几位数运算,默认是两位
captcha.setLen(loginCode.getLength());
break;
case chinese:
captcha = new ChineseCaptcha(loginCode.getWidth(), loginCode.getHeight());
captcha.setLen(loginCode.getLength());
break;
case chinese_gif:
captcha = new ChineseGifCaptcha(loginCode.getWidth(), loginCode.getHeight());
captcha.setLen(loginCode.getLength());
break;
case gif:
captcha = new GifCaptcha(loginCode.getWidth(), loginCode.getHeight());
captcha.setLen(loginCode.getLength());
break;
case spec:
captcha = new SpecCaptcha(loginCode.getWidth(), loginCode.getHeight());
captcha.setLen(loginCode.getLength());
break;
default:
throw new BadConfigurationException("验证码配置信息错误!正确配置查看 LoginCodeEnum ");
}
}
if (StringUtils.isNotBlank(loginCode.getFontName())) {
captcha.setFont(new Font(loginCode.getFontName(), Font.PLAIN, loginCode.getFontSize()));
}
return captcha;
}
}
| [
"lijiali@baoyinxiaofei.com"
] | lijiali@baoyinxiaofei.com |
bda8ad3064914f9413949771c65108df47d51c35 | 128eb90ce7b21a7ce621524dfad2402e5e32a1e8 | /laravel-converted/src/main/java/com/project/convertedCode/globalNamespace/classes/PHP_Token_LT.java | 3aa68e53a64672fc7d88673af609c039355cfa57 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | RuntimeConverter/RuntimeConverterLaravelJava | 657b4c73085b4e34fe4404a53277e056cf9094ba | 7ae848744fbcd993122347ffac853925ea4ea3b9 | refs/heads/master | 2020-04-12T17:22:30.345589 | 2018-12-22T10:32:34 | 2018-12-22T10:32:34 | 162,642,356 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,812 | java | package com.project.convertedCode.globalNamespace.classes;
import java.lang.invoke.MethodHandles;
import com.runtimeconverter.runtime.passByReference.PassByReferenceArgs;
import com.runtimeconverter.runtime.classes.NoConstructor;
import com.project.convertedCode.globalNamespace.classes.PHP_Token;
import com.runtimeconverter.runtime.classes.RuntimeClassBase;
import com.runtimeconverter.runtime.RuntimeEnv;
import com.runtimeconverter.runtime.reflection.ReflectionClassData;
import com.runtimeconverter.runtime.arrays.ZPair;
/*
Converted with The Runtime Converter (runtimeconverter.com)
vendor/phpunit/php-token-stream/src/Token.php
*/
public class PHP_Token_LT extends PHP_Token {
public PHP_Token_LT(RuntimeEnv env, Object... args) {
super(env);
if (this.getClass() == PHP_Token_LT.class) {
this.__construct(env, args);
}
}
public PHP_Token_LT(NoConstructor n) {
super(n);
}
public static final Object CONST_class = "PHP_Token_LT";
// Runtime Converter Internals
// RuntimeStaticCompanion contains static methods
// RequestStaticProperties contains static (per-request) properties
// ReflectionClassData contains php reflection data used by the runtime library
public static class RuntimeStaticCompanion extends PHP_Token.RuntimeStaticCompanion {
private static final MethodHandles.Lookup staticCompanionLookup = MethodHandles.lookup();
}
public static final RuntimeStaticCompanion runtimeStaticObject = new RuntimeStaticCompanion();
private static final ReflectionClassData runtimeConverterReflectionData =
ReflectionClassData.builder()
.setName("PHP_Token_LT")
.setLookup(
PHP_Token_LT.class,
MethodHandles.lookup(),
RuntimeStaticCompanion.staticCompanionLookup)
.setLocalProperties("id", "line", "text", "tokenStream")
.setFilename("vendor/phpunit/php-token-stream/src/Token.php")
.addExtendsClass("PHP_Token")
.get();
@Override
public ReflectionClassData getRuntimeConverterReflectionData() {
return runtimeConverterReflectionData;
}
@Override
public Object converterRuntimeCallExtended(
RuntimeEnv env,
String method,
Class<?> caller,
PassByReferenceArgs passByReferenceArgs,
Object... args) {
return RuntimeClassBase.converterRuntimeCallExtendedWithDataStatic(
this,
runtimeConverterReflectionData,
env,
method,
caller,
passByReferenceArgs,
args);
}
}
| [
"git@runtimeconverter.com"
] | git@runtimeconverter.com |
8629d2d535674d41def3f87ce8f26d56e82ceb5a | 76579c8a307de9dcd974a251ad653657a021e800 | /SSP3/src/com/company/task1/Main.java | 32678b1400f26bac11eabd90a746a22bcb58c59c | [] | no_license | Orange-hanter/SSP | 6f4819183dc03ec137c97196f0bac3cb86bff206 | 7609b979c4861ddc17b60c54b3e4810ab635ce1f | refs/heads/master | 2021-01-10T15:55:29.669942 | 2016-01-17T10:13:39 | 2016-01-17T10:13:39 | 49,812,339 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,145 | java | package com.company.task1;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Main {
public static void main(String[] args) {
String text = "";
try {
text = new String(Files.readAllBytes(Paths.get("rfc2818.txt")));
} catch (IOException e) {
e.printStackTrace();
}
Map<String, Integer> vocabulary = new TreeMap<>();
Pattern pattern = Pattern.compile("\\w+");
Matcher matcher = pattern.matcher(text);
while (matcher.find()) {
Integer value = vocabulary.get(matcher.group());
if(value == null) {
value = 1;
} else {
value++;
}
vocabulary.put(matcher.group(), value);
}
vocabulary.entrySet().stream()
.sorted(Map.Entry.<String, Integer>comparingByValue().reversed())
.limit(20)
.forEach(e -> System.out.println("" + e.getValue() + " - " + e.getKey()));
}
}
| [
"danil.bel53@gmail.com"
] | danil.bel53@gmail.com |
313afa7d9060032b99756813cff28e241086f7f2 | e2bc7c070feffaa1c3d72688f35655dcc83a6668 | /dl-core/src/main/java/com/yc/core/message/entity/MessageReceive.java | 578453798be520bde07ae1c475f42baafc6b3a9e | [] | no_license | zeze-ya/DeepLearning | 1287985b5fe4ecd3b7dee936b9e57e157bb16567 | d139dda23689175ceec4f191dc94f69949f7f869 | refs/heads/master | 2022-12-02T13:31:33.866152 | 2020-06-30T11:45:44 | 2020-06-30T11:45:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,060 | java | package com.yc.core.message.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 功能描述:
*
* @Author: xieyc && 紫色年华
* @Date 2019-10-08
* @Version: 1.0.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class MessageReceive implements Serializable {
private static final long serialVersionUID = 1L;
@TableId(value = "message_receive_id", type = IdType.ASSIGN_UUID)
private String messageReceiveId;
/**
* 用户ID
*/
private String userId;
/**
* 已读标识(0: 未读 1:已读)
*/
private int readState;
/**
* 阅读时间
*/
private LocalDateTime readTime;
/**
* 接受状态(0:接收成功 1:接受失败)
*/
private boolean receiveState;
/**
* 消息ID
*/
private String messageId;
}
| [
"1197798263@qq.com"
] | 1197798263@qq.com |
b96e93aa162027f8d708dd1a89f142243b12ba83 | 00c601d9f7af706b83f38949b0da9d45921bc2e8 | /cloud-provider-nacos-payment9001/src/main/java/com/atguigu/springcloud/controller/PaymentNacosController.java | 9cbdf68196a97ad3f0be066a2da3a3789598205f | [] | no_license | nupt-wb/spring-cloud | ef3e9847e040757a01b7689cdf91584c01983775 | 05f016b17dea7f19f765cbe120f7519b0dc39439 | refs/heads/main | 2023-05-07T09:33:39.300466 | 2021-05-24T10:19:24 | 2021-05-24T10:19:24 | 367,382,047 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 600 | java | package com.atguigu.springcloud.controller;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class PaymentNacosController {
@Value("${server.port}")
private String serverPort;
@GetMapping(value = "/payment/nacos/{id}")
public String get(@PathVariable("id") Long id){
return Thread.currentThread().getName()+":,server port: "+serverPort+" id:"+id;
}
}
| [
"bing.wu@weimob.com"
] | bing.wu@weimob.com |
f343dc2bbb8950395479e2e3ed889f5ab9d7f4d3 | 5848984aef6ed33826bb01705b34c87fa0dd4523 | /刷题/剑指Offer/src/Q44翻转单词.java | 7394d201f3520f0b1bb0e25f4e18f667a8788067 | [] | no_license | markIsCat/notes | 4401390ae3589f6c682884c46cc3a0235f5b64b9 | c3d00bd9e6c331c354989808b3c179fc32c60661 | refs/heads/master | 2022-11-14T22:39:41.539290 | 2020-05-11T14:52:46 | 2020-05-11T14:52:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 637 | java | /**
* 翻转单词顺序列
* "I am a student." -> "student. a am I"
*
* @author sherman
*/
public class Q44翻转单词 {
public String reverseSentence(String str) {
if ("".equals(str)) {
return "";
}
String trimStr = str.trim();
if ("".equals(trimStr)) {
return str;
}
String[] split = trimStr.split("\\s+");
for (int i = 0; i < split.length / 2; ++i) {
String tmp = split[i];
split[i] = split[split.length - 1 - i];
split[split.length - 1 - i] = tmp;
}
return String.join(" ", split);
}
}
| [
"tanglei2571@163.com"
] | tanglei2571@163.com |
e7ef53c86acac7fa20e60a90c1b00a0ed5b7e62e | 61a7a553fa04a61738b89d192b7b83bf5728a5df | /service/src/main/java/service/com/pandawork/service/impl/StudentServiceImpl.java | 9d22a7b9779dc4b1650d8d1f8c68c05198dde7aa | [] | no_license | lusizhang/newFrarmwork | 54bba62602c8065b74296f639af1060a4ac4e9df | 7841da5bcac4691c72c5acb227ad538ff4f7f76f | refs/heads/master | 2021-01-01T05:28:27.350488 | 2016-04-19T15:19:57 | 2016-04-19T15:19:57 | 56,607,576 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,415 | java | package com.pandawork.service.impl;
import com.pandawork.common.entity.Student;
import com.pandawork.common.utils.NFException;
import com.pandawork.core.common.exception.SSException;
import com.pandawork.core.common.log.LogClerk;
import com.pandawork.core.common.util.Assert;
import com.pandawork.core.common.util.CommonUtil;
import com.pandawork.mapper.StudentMapper;
import com.pandawork.service.StudentService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* StudentServiceImpl
* Created by chant on 2016/3/23.
*/
@Service("studentService")
public class StudentServiceImpl implements StudentService {
@Autowired
StudentMapper studentMapper;
@Override
public boolean checkLogin(Integer studentNumber, String password) throws SSException {
if (Assert.isNull(studentNumber ) || Assert.isNull(password)){
return false;
}
try {
return studentMapper.countByStudentNumberAndPassword(studentNumber,password) == 1?true:false;
} catch (Exception e) {
LogClerk.errLog.error(e);
throw SSException.get(NFException.SystemException, e);
}
}
@Override
public Student queryByStudentNumber(Integer studentNumber) throws SSException {
if (Assert.isNull(studentNumber)) {
return null;
}
try {
return studentMapper.queryByStudentNumber(studentNumber);
} catch (Exception e) {
LogClerk.errLog.error(e);
throw SSException.get(NFException.SystemException, e);
}
}
@Override
public void update(Student student) throws SSException {
if(Assert.isNull(student)){
return ;
}
try {
studentMapper.update(student);
} catch(Exception e) {
LogClerk.errLog.error(e);
throw SSException.get(NFException.SystemException, e);
}
}
@Override
public boolean checkStudentNumber(Integer studentNumber) throws SSException {
try {
return studentMapper.countByStudentNumber(studentNumber) == 1?true:false;
} catch(Exception e) {
LogClerk.errLog.error(e);
throw SSException.get(NFException.SystemException, e);
}
}
}
| [
"2909453685@qq.com"
] | 2909453685@qq.com |
3f7b15aaf309dc1cbc5ebccb4ddd6d32f68d61b7 | 402505bb15dc126b2c5a51f4082d87202f093e33 | /app/src/main/java/ru/kev163rus/countandearn/MainActivity.java | 80b7e6ad14a934715262d25dc206a772c95b202e | [] | no_license | KrivosheevEV/countandearn | cf0b0361c46a4ad7c11caec61ad894dfedceb0a1 | 028fd43b38597836a295a7454d393aed4b30e06f | refs/heads/master | 2020-05-22T08:41:58.952243 | 2019-05-12T17:33:01 | 2019-05-12T17:33:01 | 186,284,407 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,327 | java | package ru.kev163rus.countandearn;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ProgressBar;
import android.os.Handler;
import java.util.concurrent.TimeUnit;
public class MainActivity extends AppCompatActivity {
ProgressBar pbRun;
Handler h;
final int pbRun_Max = 100;
int pbRun_Count = 0;
int timeOut = 200;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
h = new Handler();
pbRun = findViewById(R.id.progressBar);
pbRun.setProgress(0);
Thread t = new Thread(new Runnable() {
public void run() {
try {
for (pbRun_Count = 1; pbRun_Count < pbRun_Max; pbRun_Count++) {
TimeUnit.MILLISECONDS.sleep(timeOut);
// обновляем ProgressBar
h.post(setProgress);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
t.start();
}
Runnable setProgress = new Runnable() {
public void run() {
pbRun.setProgress(pbRun_Count);
}
};
}
| [
"euja@yandex.ru"
] | euja@yandex.ru |
a80bb89904fc64c150b638b0762491e752ff0f5f | e204c4c9996478e48dd2fb3b0d048421fa39a2d5 | /accountservice/src/main/java/accountservice/store/online/advantage/com/AccountDeleteResponse.java | 01bb75416af500a0733fa42b9a5e3128d7adec99 | [] | no_license | suvenkar/AOS-Application-23March | 12bcd9df25c9cdafbf6ad7a1bcfd6ad46105628f | dcce3f466e747243c56b060d6fa1b0711eb4d374 | refs/heads/master | 2022-04-30T23:18:43.405191 | 2020-03-25T15:29:32 | 2020-03-25T15:29:32 | 249,427,267 | 0 | 0 | null | 2022-04-05T21:01:11 | 2020-03-23T12:40:25 | JavaScript | UTF-8 | Java | false | false | 6,785 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.7
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.12.12 at 12:44:42 AM EST
//
package accountservice.store.online.advantage.com;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="StatusMessage" form="qualified">
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="success" type="{http://www.w3.org/2001/XMLSchema}boolean" form="qualified"/>
* <element name="userId" type="{http://www.w3.org/2001/XMLSchema}long" form="qualified"/>
* <element name="reason" type="{http://www.w3.org/2001/XMLSchema}string" form="qualified"/>
* <element name="token" type="{http://www.w3.org/2001/XMLSchema}string" form="qualified"/>
* <element name="sessionId" type="{http://www.w3.org/2001/XMLSchema}string" form="qualified"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </element>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"statusMessage"
})
@XmlRootElement(name = "AccountDeleteResponse")
public class AccountDeleteResponse {
@XmlElement(name = "StatusMessage", required = true)
protected AccountDeleteResponse.StatusMessage statusMessage;
/**
* Gets the value of the statusMessage property.
*
* @return
* possible object is
* {@link AccountDeleteResponse.StatusMessage }
*
*/
public AccountDeleteResponse.StatusMessage getStatusMessage() {
return statusMessage;
}
/**
* Sets the value of the statusMessage property.
*
* @param value
* allowed object is
* {@link AccountDeleteResponse.StatusMessage }
*
*/
public void setStatusMessage(AccountDeleteResponse.StatusMessage value) {
this.statusMessage = value;
}
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="success" type="{http://www.w3.org/2001/XMLSchema}boolean" form="qualified"/>
* <element name="userId" type="{http://www.w3.org/2001/XMLSchema}long" form="qualified"/>
* <element name="reason" type="{http://www.w3.org/2001/XMLSchema}string" form="qualified"/>
* <element name="token" type="{http://www.w3.org/2001/XMLSchema}string" form="qualified"/>
* <element name="sessionId" type="{http://www.w3.org/2001/XMLSchema}string" form="qualified"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"success",
"userId",
"reason",
"token",
"sessionId"
})
public static class StatusMessage {
protected boolean success;
protected long userId;
@XmlElement(required = true)
protected String reason;
@XmlElement(required = true)
protected String token;
@XmlElement(required = true)
protected String sessionId;
/**
* Gets the value of the success property.
*
*/
public boolean isSuccess() {
return success;
}
/**
* Sets the value of the success property.
*
*/
public void setSuccess(boolean value) {
this.success = value;
}
/**
* Gets the value of the userId property.
*
*/
public long getUserId() {
return userId;
}
/**
* Sets the value of the userId property.
*
*/
public void setUserId(long value) {
this.userId = value;
}
/**
* Gets the value of the reason property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getReason() {
return reason;
}
/**
* Sets the value of the reason property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setReason(String value) {
this.reason = value;
}
/**
* Gets the value of the token property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getToken() {
return token;
}
/**
* Sets the value of the token property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setToken(String value) {
this.token = value;
}
/**
* Gets the value of the sessionId property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getSessionId() {
return sessionId;
}
/**
* Sets the value of the sessionId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setSessionId(String value) {
this.sessionId = value;
}
}
}
| [
"suvenduitc@gmail.com"
] | suvenduitc@gmail.com |
2d47198a83063e33e6e38ae64f8e86d417fc9dc7 | 58416b73b4acc857c27a395c5eb16e973c8b52d2 | /src/src/day24_arrays01/Arrays6.java | a8c835be95e479d8a7a9dd354d5294202c2494d5 | [] | no_license | DevSilicone/Developer | 6f70c39930f141b0e3329351263b337a8b2f8dd1 | da11e5ceb64e863d8128164bb9471461e1ecc3f0 | refs/heads/master | 2023-02-20T08:10:29.211334 | 2021-01-19T03:34:01 | 2021-01-19T03:34:01 | 330,849,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 114 | java | package day24_arrays01;
public class Arrays6 {
public static void main(String[] args) {
//
}
}
| [
"emreekinci83@hotmail.com"
] | emreekinci83@hotmail.com |
e3eb01d31776b72f0a2e103779a6316237744bca | 3235b0654fcedf49375bef66bb9be938c6cbbf48 | /default/Ex0305/src/Mall/Product/Ref/BasicRef.java | 24bc74dcad162d403c348d20571f880e7ee609e2 | [] | no_license | Mssuk/javaSource | 8164177704b2800e3f2160c0d10b224786321940 | ed9fdbb5dcdb01c8249134936869db4d459e1e61 | refs/heads/master | 2021-01-03T03:14:29.744515 | 2020-03-13T08:45:05 | 2020-03-13T08:45:05 | 239,897,879 | 0 | 0 | null | 2020-10-13T20:14:00 | 2020-02-12T00:59:57 | Java | UTF-8 | Java | false | false | 326 | java | package Mall.Product.Ref;
public class BasicRef extends Ref {
public BasicRef(int price , String name, String color, int liter){
this.price = price;
this.name = name;
this.color = color;
this.liter = liter;
bonuspoint = (int)(price *bonusRate) ;
door = "기본";
}
}
| [
"djqhr490@gmail.com"
] | djqhr490@gmail.com |
0a97d0cbd4e4dfd0b133890b1fcecc4610cdbbc2 | baeeb0ba250b58649c4d2b9e4c106a1760bbb16a | /src/main/java/spring/react/jwt/repositories/CityRepository.java | 49293b9253b3bc5cd2d63286ed61cd8e095a1dbd | [] | no_license | yanko1601/spring_react | fa70357f7f4ba223a7effeccfd6cb2ae2e4d8819 | 8256a6e932fe67241bf744377398767fa7b528dc | refs/heads/main | 2023-03-29T13:42:40.988755 | 2021-04-14T13:05:37 | 2021-04-14T13:05:37 | 353,807,246 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 315 | java | package spring.react.jwt.repositories;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import spring.react.jwt.model.entities.City;
@Repository
public interface CityRepository extends JpaRepository<City, Long> {
City findByName(String name);
}
| [
"yankoyankov54@gmail.com"
] | yankoyankov54@gmail.com |
db2c94fdae9750076b2d6e58143f9402230034d2 | 1fa0f1565e049e25ac8f5fd388a9d579d28a834a | /fraud-detection-demo/webapp/src/main/java/com/ververica/demo/backend/lagecy/controller/DataGenerationController.java | 00de04cb7860bc891f8ef42c5d6eab107504a295 | [
"MIT"
] | permissive | Gummybearr/java-practice | e58ae90ea14fdeccc0a5eb5eabc754f837d156b1 | 4dfba0f78ed59bec31c64b2c58ab60faf1cd6b90 | refs/heads/main | 2023-04-27T11:36:55.565156 | 2021-05-11T15:43:12 | 2021-05-11T15:43:12 | 324,571,688 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,901 | java | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ververica.demo.backend.lagecy.controller;
import com.ververica.demo.backend.lagecy.dataGenerators.DemoTransactionsGenerator;
import com.ververica.demo.backend.lagecy.dataGenerators.TransactionsGenerator;
import com.ververica.demo.backend.lagecy.service.KafkaTransactionsPusher;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.kafka.config.KafkaListenerEndpointRegistry;
import org.springframework.kafka.listener.MessageListenerContainer;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@RestController
@Slf4j
public class DataGenerationController {
private TransactionsGenerator transactionsGenerator;
private KafkaListenerEndpointRegistry kafkaListenerEndpointRegistry;
private ExecutorService executor = Executors.newSingleThreadExecutor();
private boolean generatingTransactions = false;
private boolean listenerContainerRunning = true;
@Value("${kafka.listeners.transactions.id}")
private String transactionListenerId;
@Value("${transactionsRateDisplayLimit}")
private int transactionsRateDisplayLimit;
@Autowired
public DataGenerationController(
KafkaTransactionsPusher transactionsPusher,
KafkaListenerEndpointRegistry kafkaListenerEndpointRegistry) {
transactionsGenerator = new DemoTransactionsGenerator(transactionsPusher, 1);
this.kafkaListenerEndpointRegistry = kafkaListenerEndpointRegistry;
}
@GetMapping("/api/startTransactionsGeneration")
public void startTransactionsGeneration() throws Exception {
log.info("{}", "startTransactionsGeneration called");
generateTransactions();
}
private void generateTransactions() {
if (!generatingTransactions) {
executor.submit(transactionsGenerator);
generatingTransactions = true;
}
}
@GetMapping("/api/stopTransactionsGeneration")
public void stopTransactionsGeneration() {
transactionsGenerator.cancel();
generatingTransactions = false;
log.info("{}", "stopTransactionsGeneration called");
}
@GetMapping("/api/generatorSpeed/{speed}")
public void setGeneratorSpeed(@PathVariable Long speed) {
log.info("Generator speed change request: " + speed);
if (speed <= 0) {
transactionsGenerator.cancel();
generatingTransactions = false;
return;
} else {
generateTransactions();
}
MessageListenerContainer listenerContainer =
kafkaListenerEndpointRegistry.getListenerContainer(transactionListenerId);
if (speed > transactionsRateDisplayLimit) {
listenerContainer.stop();
listenerContainerRunning = false;
} else if (!listenerContainerRunning) {
listenerContainer.start();
}
if (transactionsGenerator != null) {
transactionsGenerator.adjustMaxRecordsPerSecond(speed);
}
}
}
| [
"ehrudghl123@naver.com"
] | ehrudghl123@naver.com |
9204da23ad17d741cacabfd30c191ff8c4770788 | aeccc592b8b98449db5189b5c412fea1e00b5736 | /src/main/java/pt/isel/ls/view/html/GetMovieIDTMDBView.java | 5e713b60920156d55fc7cfad54a88a29e5e592cb | [] | no_license | PiniponSelvagem/1718-2-LI41D-G6 | 36cc63d25841f2f895ac3e5a8201bce4edab6fb4 | 989c6d9d0fab74c79838a6ff8217b6354782df1f | refs/heads/master | 2022-02-11T18:26:51.652720 | 2018-06-13T16:46:21 | 2018-06-13T16:46:21 | 139,199,713 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,656 | java | package pt.isel.ls.view.html;
import pt.isel.ls.core.common.commands.GetMovies;
import pt.isel.ls.core.common.headers.html.HtmlPage;
import pt.isel.ls.core.common.headers.html.HttpStatusCode;
import pt.isel.ls.core.utils.DataContainer;
import pt.isel.ls.model.Movie;
import static pt.isel.ls.core.common.headers.html.Html.*;
import static pt.isel.ls.core.common.headers.html.HtmlElem.submit;
import static pt.isel.ls.core.strings.CommandEnum.*;
import static pt.isel.ls.core.utils.DataContainer.DataEnum.D_MOVIE;
public class GetMovieIDTMDBView extends HtmlView {
public GetMovieIDTMDBView(DataContainer data) {
super(data);
}
@Override
public HtmlPage createPage() {
Movie movie = (Movie) data.getData(D_MOVIE);
return new HtmlPage("Add Movie",
h3(a("/movies", "Movies")),
h1(text("Creating movie")),
h3(text("Is this information correct?")),
li(text("Title: " + movie.getTitle())),
li(text("Release year: " + movie.getYear())),
li(text("Duration: " + movie.getDuration() + " minutes")),
breakLine(),
form(
POST.toString(), new GetMovies().getPath(),
hiddenInput("title", movie.getTitle()),
hiddenInput("duration", String.valueOf(movie.getDuration())),
hiddenInput("releaseYear", String.valueOf(movie.getYear())),
submit("Create")
)
);
}
@Override
public HttpStatusCode getCode() {
return HttpStatusCode.OK;
}
}
| [
"piniponselvagem@gmail.com"
] | piniponselvagem@gmail.com |
963703041b6f4d09d7f0622692e673469de3b115 | af3532b80780cf31453dedc07f9d2e92418f868c | /app/src/main/java/com/example/toutis/fypproject/SecondController.java | 37e83f8ad20f61b3d2bc43e4bcb73acfb7cc2d3d | [] | no_license | fadibejj/FYP | ad79c88be0c5729ccc3045e8e387355d4afc5396 | 9a96b5771915f42cd71891ed9de43e7c6b219cec | refs/heads/master | 2020-03-15T03:48:28.501885 | 2018-05-03T07:17:15 | 2018-05-03T07:17:15 | 131,951,358 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,004 | java | package com.example.toutis.fypproject;
/**
* Created by Alexandre on 16-Apr-18.
*/
import android.util.Log;
import com.fuzzylite.*;
import com.fuzzylite.activation.*;
import com.fuzzylite.defuzzifier.*;
import com.fuzzylite.factory.*;
import com.fuzzylite.hedge.*;
import com.fuzzylite.imex.*;
import com.fuzzylite.norm.*;
import com.fuzzylite.norm.s.*;
import com.fuzzylite.norm.t.*;
import com.fuzzylite.rule.*;
import com.fuzzylite.term.*;
import com.fuzzylite.variable.*;
import java.util.Scanner;
public class SecondController {
private FirstController first;
private double dueDate;
private double weight;
private double hoursFirst;
public FirstController getFirst() {
return first;
}
public void setFirst(FirstController first) {
this.first = first;
}
public double getDueDate() {
return dueDate;
}
public void setDueDate(double dueDate) {
this.dueDate = dueDate;
}
public double getWeight() {
return weight;
}
public void setWeight(double weight) {
this.weight = weight;
}
public double getHoursFirst() {
return hoursFirst;
}
public void setHoursFirst(double hoursFirst) {
this.hoursFirst = hoursFirst;
}
public double getAdjustedHours(){
Engine engine = new Engine();
engine.setName("SecondController");
engine.setDescription("");
InputVariable dueTime = new InputVariable();
dueTime.setName("dueTime");
dueTime.setDescription("");
dueTime.setEnabled(true);
dueTime.setRange(60.0, 95.0);
dueTime.setLockValueInRange(false);
dueTime.addTerm(new Gaussian("verySoon", 60.000, 4.956));
dueTime.addTerm(new Gaussian("soon", 71.67, 4.956));
dueTime.addTerm(new Gaussian("far", 83.33, 4.956));
engine.addInputVariable(dueTime);
InputVariable weightOfTask = new InputVariable();
weightOfTask.setName("weightOfTask");
weightOfTask.setDescription("");
weightOfTask.setEnabled(true);
weightOfTask.setRange(0.0, 100.0);
weightOfTask.setLockValueInRange(false);
weightOfTask.addTerm(new Gaussian("low", 0.0, 21.23));
weightOfTask.addTerm(new Gaussian("medium", 50.0, 21.23));
weightOfTask.addTerm(new Gaussian("high", 100.0, 21.23));
engine.addInputVariable(weightOfTask);
InputVariable inputOutput = new InputVariable();
inputOutput.setName("inputOutput");
inputOutput.setDescription("");
inputOutput.setEnabled(true);
inputOutput.setRange(3.0, 9.0);
inputOutput.setLockValueInRange(false);
inputOutput.addTerm(new Gaussian("veryFew", 3.0, 1.274));
inputOutput.addTerm(new Gaussian("few", 6.0, 1.274));
inputOutput.addTerm(new Gaussian("enough", 9.0, 1.274));
inputOutput.addTerm(new Gaussian("much", 6.0, 1.274));
inputOutput.addTerm(new Gaussian("significant", 9.0, 1.274));
engine.addInputVariable(inputOutput);
OutputVariable adjustedHours = new OutputVariable();
adjustedHours.setName("adjustedHours");
adjustedHours.setDescription("");
adjustedHours.setEnabled(true);
adjustedHours.setRange(3.0, 9.0);
adjustedHours.setLockValueInRange(false);
adjustedHours.setAggregation(new Maximum());
adjustedHours.setDefuzzifier(new Centroid(100));
adjustedHours.setDefaultValue(Double.NaN);
adjustedHours.setLockPreviousValue(false);
adjustedHours.addTerm(new Gaussian("veryFew", 3.0, 0.6372));
adjustedHours.addTerm(new Gaussian("few", 4.5, 0.6372));
adjustedHours.addTerm(new Gaussian("enough", 6.0, 0.6372));
adjustedHours.addTerm(new Gaussian("much", 7.5, 0.6372));
adjustedHours.addTerm(new Gaussian("significant", 9.0, 0.6372));
engine.addOutputVariable(adjustedHours);
RuleBlock mamdani = new RuleBlock();
mamdani.setName("mamdani");
mamdani.setDescription("");
mamdani.setEnabled(true);
mamdani.setConjunction(new Minimum());
mamdani.setDisjunction(new Maximum());
mamdani.setImplication(new Minimum());
mamdani.setActivation(new General());
mamdani.addRule(Rule.parse("if dueTime is far and weightOfTask is low and inputOutput is veryFew then adjustedHours is veryFew", engine));
mamdani.addRule(Rule.parse("if dueTime is far and weightOfTask is medium and inputOutput is veryFew then adjustedHours is veryFew", engine));
mamdani.addRule(Rule.parse("if dueTime is far and weightOfTask is high and inputOutput is veryFew then adjustedHours is veryFew", engine));
mamdani.addRule(Rule.parse("if dueTime is soon and weightOfTask is low and inputOutput is veryFew then adjustedHours is veryFew", engine));
mamdani.addRule(Rule.parse("if dueTime is soon and weightOfTask is medium and inputOutput is veryFew then adjustedHours is veryFew", engine));
mamdani.addRule(Rule.parse("if dueTime is soon and weightOfTask is high and inputOutput is veryFew then adjustedHours is veryFew", engine));
mamdani.addRule(Rule.parse("if dueTime is verySoon and weightOfTask is low and inputOutput is veryFew then adjustedHours is veryFew", engine));
mamdani.addRule(Rule.parse("if dueTime is verySoon and weightOfTask is medium and inputOutput is veryFew then adjustedHours is veryFew", engine));
mamdani.addRule(Rule.parse("if dueTime is verySoon and weightOfTask is high and inputOutput is veryFew then adjustedHours is few", engine));
//10
mamdani.addRule(Rule.parse("if dueTime is far and weightOfTask is low and inputOutput is few then adjustedHours is veryFew", engine));
mamdani.addRule(Rule.parse("if dueTime is far and weightOfTask is medium and inputOutput is few then adjustedHours is veryFew", engine));
mamdani.addRule(Rule.parse("if dueTime is far and weightOfTask is high and inputOutput is few then adjustedHours is veryFew", engine));
mamdani.addRule(Rule.parse("if dueTime is soon and weightOfTask is low and inputOutput is few then adjustedHours is few", engine));
mamdani.addRule(Rule.parse("if dueTime is soon and weightOfTask is medium and inputOutput is few then adjustedHours is few", engine));
mamdani.addRule(Rule.parse("if dueTime is soon and weightOfTask is high and inputOutput is few then adjustedHours is few", engine));
mamdani.addRule(Rule.parse("if dueTime is verySoon and weightOfTask is low and inputOutput is few then adjustedHours is few", engine));
mamdani.addRule(Rule.parse("if dueTime is verySoon and weightOfTask is medium and inputOutput is few then adjustedHours is enough", engine));
mamdani.addRule(Rule.parse("if dueTime is verySoon and weightOfTask is high and inputOutput is few then adjustedHours is enough", engine));
//19
mamdani.addRule(Rule.parse("if dueTime is far and weightOfTask is low and inputOutput is enough then adjustedHours is enough", engine));
mamdani.addRule(Rule.parse("if dueTime is far and weightOfTask is medium and inputOutput is enough then adjustedHours is enough", engine));
mamdani.addRule(Rule.parse("if dueTime is far and weightOfTask is high and inputOutput is enough then adjustedHours is enough", engine));
mamdani.addRule(Rule.parse("if dueTime is soon and weightOfTask is low and inputOutput is enough then adjustedHours is enough", engine));
mamdani.addRule(Rule.parse("if dueTime is soon and weightOfTask is medium and inputOutput is enough then adjustedHours is enough", engine));
mamdani.addRule(Rule.parse("if dueTime is soon and weightOfTask is high and inputOutput is enough then adjustedHours is much", engine));
mamdani.addRule(Rule.parse("if dueTime is verySoon and weightOfTask is low and inputOutput is enough then adjustedHours is enough", engine));
mamdani.addRule(Rule.parse("if dueTime is verySoon and weightOfTask is medium and inputOutput is enough then adjustedHours is much", engine));
mamdani.addRule(Rule.parse("if dueTime is verySoon and weightOfTask is high and inputOutput is enough then adjustedHours is much", engine));
//28
mamdani.addRule(Rule.parse("if dueTime is far and weightOfTask is low and inputOutput is much then adjustedHours is much", engine));
mamdani.addRule(Rule.parse("if dueTime is far and weightOfTask is medium and inputOutput is much then adjustedHours is much", engine));
mamdani.addRule(Rule.parse("if dueTime is far and weightOfTask is high and inputOutput is much then adjustedHours is much", engine));
mamdani.addRule(Rule.parse("if dueTime is soon and weightOfTask is low and inputOutput is much then adjustedHours is much", engine));
mamdani.addRule(Rule.parse("if dueTime is soon and weightOfTask is medium and inputOutput is much then adjustedHours is much", engine));
mamdani.addRule(Rule.parse("if dueTime is soon and weightOfTask is high and inputOutput is much then adjustedHours is significant", engine));
mamdani.addRule(Rule.parse("if dueTime is verySoon and weightOfTask is low and inputOutput is much then adjustedHours is much", engine));
mamdani.addRule(Rule.parse("if dueTime is verySoon and weightOfTask is medium and inputOutput is much then adjustedHours is significant", engine));
mamdani.addRule(Rule.parse("if dueTime is verySoon and weightOfTask is high and inputOutput is much then adjustedHours is significant", engine));
//37
mamdani.addRule(Rule.parse("if dueTime is far and weightOfTask is low and inputOutput is significant then adjustedHours is significant", engine));
mamdani.addRule(Rule.parse("if dueTime is far and weightOfTask is medium and inputOutput is significant then adjustedHours is significant", engine));
mamdani.addRule(Rule.parse("if dueTime is far and weightOfTask is high and inputOutput is significant then adjustedHours is significant", engine));
mamdani.addRule(Rule.parse("if dueTime is soon and weightOfTask is low and inputOutput is significant then adjustedHours is significant", engine));
mamdani.addRule(Rule.parse("if dueTime is soon and weightOfTask is medium and inputOutput is significant then adjustedHours is significant", engine));
mamdani.addRule(Rule.parse("if dueTime is soon and weightOfTask is high and inputOutput is significant then adjustedHours is significant", engine));
mamdani.addRule(Rule.parse("if dueTime is verySoon and weightOfTask is low and inputOutput is significant then adjustedHours is significant", engine));
mamdani.addRule(Rule.parse("if dueTime is verySoon and weightOfTask is medium and inputOutput is significant then adjustedHours is significant", engine));
mamdani.addRule(Rule.parse("if dueTime is verySoon and weightOfTask is high and inputOutput is significant then adjustedHours is significant", engine));
engine.addRuleBlock(mamdani);
StringBuilder status = new StringBuilder();
if (!engine.isReady(status))
throw new RuntimeException("[engine error] engine is not ready:n" + status);
InputVariable dueT = engine.getInputVariable("dueTime");
InputVariable WOT = engine.getInputVariable("weightOfTask");
InputVariable IO = engine.getInputVariable("inputOutput");
OutputVariable adjustedH = engine.getOutputVariable("adjustedHours");
setDueDate(dueT.getMaximum()); //Add user imput
dueT.setValue(this.dueDate);
setWeight(WOT.getMaximum());//Add user input
WOT.setValue(this.weight);
setHoursFirst(IO.getMaximum());//Output of controller 1
IO.setValue(this.hoursFirst);
engine.process();
double finalHours = adjustedH.getValue();
return finalHours;
}
public static void main(String[] args) {
}
}
| [
"fadi.bejjani.10@gmail.com"
] | fadi.bejjani.10@gmail.com |
62ba2ae993456d21548fefe0c3f9f929e133c357 | 56d8ab8c0ca79db381f18deacdc1c64d30bc8236 | /common/src/main/java/com/serenegiant/media/VideoConfig.java | bad4797ce7037e6f4067fd48424194ee24096984 | [
"Apache-2.0"
] | permissive | reasonpun/libcommon | fe4b8264d58dc2c03fd242d3d52fb6132ebe40a2 | 7df7c01f8abdff1d3687a06f66c832888f5c2184 | refs/heads/master | 2022-05-24T13:02:48.542456 | 2020-04-30T04:59:24 | 2020-04-30T04:59:24 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,819 | java | package com.serenegiant.media;
/*
* libcommon
* utility/helper classes for myself
*
* Copyright (c) 2014-2020 saki t_saki@serenegiant.com
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
import androidx.annotation.NonNull;
/**
* 従来はプレビュー解像度=動画の解像度の設定用に使用していたが
* 今後は動画解像度用のみに使用してプレビュー解像度はDeviceSettingから取得する
*/
public class VideoConfig implements Parcelable, Cloneable {
private static final boolean DEBUG = false; // set false on production
private static final String TAG = VideoConfig.class.getSimpleName();
public static final float BPP_MIN = 0.01f;
public static float BPP_MAX = 0.30f;
public static final int FPS_MIN = 2;
public static final int FPS_MAX = 121;
private static final int IFRAME_MIN = 1;
private static final int IFRAME_MAX = 30;
public static final VideoConfig DEFAULT_CONFIG = new VideoConfig(
0.25f, 10, 10 * 30.0f,
15, 30 * 1000L,
(Build.VERSION.SDK_INT >= 18), (Build.VERSION.SDK_INT >= 18)
);
/**
* DEFAULT_CONFIGを引き継いだ新しいVideoConfigオブジェクトを生成
* @return
*/
@Deprecated
public static VideoConfig createDefault() {
return new VideoConfig(DEFAULT_CONFIG);
}
/**
* BPP(Bits Per Pixel)
* (0.050/0.075/0.100/0.125/0.150/0.175/0.200/0.225/0.25)
*/
private float BPP;
/**
* I-frame(単独で圧縮された単独再生可能な一番劣化の少ないキーフレーム)間の秒数@30fps
*/
private float mIframeIntervalsS;
/**
* I-Frameの間隔 300 = 30fpsの時に10秒間隔 = 300フレームに1回
*/
private float mNumFramesBetweenIframeOn30fps;
/**
* エンコード時のFPS
*/
private int mCaptureFps;
/**
* 最大録画時間[ミリ秒], 負数=制限なし
*/
private long mMaxDuration;
/**
* trueならMediaMuxerを使う、 falseならVideoMuxerを使う
* ・・・VideoMuxerを使ってnative側での最大録画時間チェックを有効にするため常にfalse
*/
private boolean mUseMediaMuxer;
/**
* SurfaceEncoderを使って動画キャプチャをするかどうか
*/
private boolean mUseSurfaceCapture;
/**
* デフォルトコンストラクタ
* 生成時のDEFAULT_CONFIGの設定値を引き継ぐ
*/
public VideoConfig() {
this(DEFAULT_CONFIG);
}
/**
* コピーコンストラクタ
* @param src
*/
public VideoConfig(@NonNull final VideoConfig src) {
BPP = src.BPP;
mIframeIntervalsS = src.mIframeIntervalsS;
mNumFramesBetweenIframeOn30fps = src.mNumFramesBetweenIframeOn30fps;
mCaptureFps = src.mCaptureFps;
mMaxDuration = src.mMaxDuration;
mUseMediaMuxer = src.mUseMediaMuxer;
mUseSurfaceCapture = src.mUseSurfaceCapture;
}
/**
* DEFAULT_CONFIG生成用コンストラクタ
* @param BPP
* @param mIframeIntervalsS
* @param mNumFramesBetweenIframeOn30fps
* @param mCaptureFps
* @param mMaxDuration
* @param mUseMediaMuxer
* @param mUseSurfaceCapture
*/
private VideoConfig(final float BPP, final float mIframeIntervalsS,
final float mNumFramesBetweenIframeOn30fps, final int mCaptureFps,
final long mMaxDuration,
final boolean mUseMediaMuxer, final boolean mUseSurfaceCapture) {
this.BPP = BPP;
this.mIframeIntervalsS = mIframeIntervalsS;
this.mNumFramesBetweenIframeOn30fps = mNumFramesBetweenIframeOn30fps;
this.mCaptureFps = mCaptureFps;
this.mMaxDuration = mMaxDuration;
this.mUseMediaMuxer = mUseMediaMuxer;
this.mUseSurfaceCapture = mUseSurfaceCapture;
}
@NonNull
@Override
public VideoConfig clone() throws CloneNotSupportedException {
return (VideoConfig) super.clone();
}
/**
* セッター
* @param src
* @return
*/
public VideoConfig set(@NonNull final VideoConfig src) {
BPP = src.BPP;
mIframeIntervalsS = src.mIframeIntervalsS;
mNumFramesBetweenIframeOn30fps = src.mNumFramesBetweenIframeOn30fps;
mCaptureFps = src.mCaptureFps;
mMaxDuration = src.mMaxDuration;
mUseMediaMuxer = src.mUseMediaMuxer;
mUseSurfaceCapture = src.mUseSurfaceCapture;
return this;
}
/**
* 最大録画時間[ミリ秒], 負数=制限なし
* @return
*/
public long maxDuration() {
return mMaxDuration;
}
/**
* 最大録画時間[ミリ秒], 負数=制限なし
* @param duration
* @return
*/
@NonNull
public VideoConfig setMaxDuration(final long duration) {
mMaxDuration = duration;
return this;
}
/**
* MediaMuxerを使うかどうかを取得
* @return API<18なら常時false
*/
public boolean useMediaMuxer() {
return mUseMediaMuxer;
}
/**
* MediaMuxerを使うかどうかをセット、ただしAPI>=18のみ
* @param use
* @return
*/
@NonNull
public VideoConfig setUseMediaMuxer(final boolean use) {
mUseMediaMuxer = use & (Build.VERSION.SDK_INT >= 18);
return this;
}
/**
* Surface経由での動画エンコードを使うかどうかを取得
* @return API<18なら常時false
*/
public boolean useSurfaceCapture() {
return mUseSurfaceCapture;
}
/**
* Surface経由での動画エンコードを使うかどうかをセット、ただしAPI>=18のみ
* @param use
* @return
*/
@NonNull
public VideoConfig setUseSurfaceCapture(final boolean use) {
mUseSurfaceCapture = use & (Build.VERSION.SDK_INT >= 18);
return this;
}
/**
* エンコード時のFPS
* @param fps
* @return
*/
@NonNull
public VideoConfig setCaptureFps(final int fps) {
mCaptureFps = fps > FPS_MAX ? FPS_MAX : (fps < FPS_MIN ? FPS_MIN : fps);
return this;
}
/**
* エンコード時のFPS
* @return
*/
public int captureFps() {
return mCaptureFps > FPS_MAX ? FPS_MAX : (mCaptureFps < FPS_MIN ? FPS_MIN : mCaptureFps);
}
/**
* I-Frameの間隔[秒]@30fpsをセット
* @param iFrameIntervalSecs
* @return
*/
@NonNull
public VideoConfig setIFrameIntervals(final float iFrameIntervalSecs) {
mIframeIntervalsS = iFrameIntervalSecs;
mNumFramesBetweenIframeOn30fps = mIframeIntervalsS * 30.f;
return this;
}
/**
* I-Frameの間隔[秒]@30fpsを取得
* @return
*/
public int iFrameIntervals() {
return (int)mIframeIntervalsS;
}
/**
* エンコード時のFPSにおけるI-Frame間隔を取得
* @return
*/
public final int calcIFrameIntervals() {
final int fps = captureFps();
float iframe;
try {
if (fps < 2)
iframe = IFRAME_MIN;
else
iframe = (float)Math.ceil(mNumFramesBetweenIframeOn30fps / fps);
} catch (final Exception e) {
iframe = mIframeIntervalsS;
}
if ((int)iframe < IFRAME_MIN) iframe = IFRAME_MIN;
else if ((int)iframe > IFRAME_MAX) iframe = IFRAME_MAX;
// Log.d(TAG, "iframe_intervals=" + iframe);
return (int)iframe;
}
/**
* ビットレートを計算[bps]
* @param width
* @param height
* @param frameRate
* @param bpp
* @return
*/
private static int calcBitrate(final int width, final int height,
final int frameRate, final float bpp) {
int r = (int)(Math.floor(bpp * frameRate * width * height / 1000 / 100) * 100) * 1000;
if (r < 200000) r = 200000;
else if (r > 20000000) r = 20000000;
// Log.d(TAG, String.format("bitrate=%d[kbps]", r / 1024));
return r;
}
/**
* エンコード時のFPSにおけるビットレートを計算[bps]
* @param width
* @param height
* @return
*/
public int getBitrate(final int width, final int height) {
return calcBitrate(width, height, captureFps(), BPP);
}
/**
* ビットレートを計算[bps]
* @param width
* @param height
* @param frameRate
* @return
*/
public int getBitrate(final int width, final int height, final int frameRate) {
return calcBitrate(width, height, frameRate, BPP);
}
/**
* ビットレートを計算[bps]
* @param width
* @param height
* @param frameRate
* @return
*/
public int getBitrate(final int width, final int height,
final int frameRate, final float bpp) {
return calcBitrate(width, height, frameRate, bpp);
}
/**
* BPPを計算
* @param width
* @param height
* @param captureFps
* @param bitrate
* @return
*/
private static float calcBPP(final int width, final int height,
final int captureFps, final int bitrate) {
return bitrate / (float)(captureFps * width * height);
}
/**
* BPPを計算
* captureFpsは#getCaptureFpsを使用
* @param width
* @param height
* @param bitrate
* @return
*/
public float calcBPP(final int width, final int height,
final int bitrate) {
return calcBPP(width, height, captureFps(), bitrate);
}
/**
* BPPをセット
* @param width
* @param height
* @param bitrate
* @throws IllegalArgumentException
*/
@NonNull
public VideoConfig setBPP(final int width, final int height, final int bitrate)
throws IllegalArgumentException {
setBPP(calcBPP(width, height, bitrate));
return this;
}
/**
* BPPをセット
* @param bpp [BPP_MIN==0.01f, BPP_MAX]
* @throws IllegalArgumentException
*/
@NonNull
public VideoConfig setBPP(final float bpp) throws IllegalArgumentException {
if ((bpp < BPP_MIN) || (bpp > BPP_MAX)) {
throw new IllegalArgumentException("bpp should be within [BPP_MIN, BPP_MAX]");
}
BPP = bpp;
return this;
}
/**
* 現在のBPP設定を取得
* @return
*/
public float bpp() {
return BPP;
}
/**
* 現在の設定で生成される概略ファイルサイズを計算[バイト/分]
* 音声データ分は含まない
* @param width
* @param height
* @return
*/
public int getSizeRate(final int width, final int height) {
final int bitrate = getBitrate(width, height);
return bitrate * 60 / 8; // bits/sec -> bytes/min
}
@NonNull
@Override
public String toString() {
return "VideoConfig{" +
"BPP=" + BPP +
", mIframeIntervalsS=" + mIframeIntervalsS +
", mNumFramesBetweenIframeOn30fps=" + mNumFramesBetweenIframeOn30fps +
", mCaptureFps=" + mCaptureFps +
", mMaxDuration=" + mMaxDuration +
", mUseMediaMuxer=" + mUseMediaMuxer +
", mUseSurfaceCapture=" + mUseSurfaceCapture +
'}';
}
//================================================================================
// Parcelable関係の実装
/**
* Parcelable用のコンストラクタ
* @param in
*/
protected VideoConfig(final Parcel in) {
BPP = in.readFloat();
mIframeIntervalsS = in.readFloat();
mNumFramesBetweenIframeOn30fps = in.readFloat();
mCaptureFps = in.readInt();
mMaxDuration = in.readLong();
mUseMediaMuxer = in.readByte() != 0;
mUseSurfaceCapture = in.readByte() != 0;
}
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(final Parcel dest, final int flags) {
dest.writeFloat(BPP);
dest.writeFloat(mIframeIntervalsS);
dest.writeFloat(mNumFramesBetweenIframeOn30fps);
dest.writeInt(mCaptureFps);
dest.writeLong(mMaxDuration);
dest.writeByte((byte) (mUseMediaMuxer ? 1 : 0));
dest.writeByte((byte) (mUseSurfaceCapture ? 1 : 0));
}
public static final Creator<VideoConfig> CREATOR = new Creator<VideoConfig>() {
@Override
public VideoConfig createFromParcel(Parcel in) {
return new VideoConfig(in);
}
@Override
public VideoConfig[] newArray(int size) {
return new VideoConfig[size];
}
};
}
| [
"saki4510t@gmail.com"
] | saki4510t@gmail.com |
d1762ff058d7cdc057ab93893ead4b5fa3406f25 | 0f55432e07306daade7bc0839aa5bba7df23d46c | /Mail/src/main/java/com/mail/domain/MailPageIndex.java | c7c7bb38bc88c9f0b1b91a8d923885a872b7b474 | [] | no_license | Tristean/Mail | 18a75fe72b2f96436abd94fc84290c09d3c52fd7 | e0e0326aae31f6983e96117a73223253e9e40610 | refs/heads/master | 2021-09-03T20:04:18.058900 | 2018-01-11T15:48:28 | 2018-01-11T15:48:28 | 114,900,055 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,059 | java | package com.mail.domain;
public class MailPageIndex {
private long startIndex;
private long endIndex;
public MailPageIndex(long startIndex, long endIndex) {
super();
this.startIndex = startIndex;
this.endIndex = endIndex;
}
public long getStartIndex() {
return startIndex;
}
public void setStartIndex(long startIndex) {
this.startIndex = startIndex;
}
public long getEndIndex() {
return endIndex;
}
public void setEndIndex(long endIndex) {
this.endIndex = endIndex;
}
public static MailPageIndex getPageIndex(long viewpagecount,int currentPage,long totalpage){
long startpage=currentPage-(viewpagecount%2==0?viewpagecount/2-1:viewpagecount/2);
long endpage=currentPage+viewpagecount/2;
if(startpage<1){
startpage=1;
if(totalpage>=viewpagecount)
endpage=viewpagecount;
else
endpage=totalpage;
}
if(endpage>totalpage){
endpage=totalpage;
if((endpage-viewpagecount)>0)
startpage=endpage-viewpagecount+1;
else
startpage=1;
}
return new MailPageIndex(startpage,endpage);
}
}
| [
"861907286@qq.com"
] | 861907286@qq.com |
3c17f3a99dd6a2ba75edcf5c8c2a6e918a12cffa | 9683c949ea359ef7c9bd7a78977255d140b1daff | /app/src/main/java/com/axolotl/dota2traker/retrofit/model/PlayerSumRes.java | b159cdbd8af296a737c7a95e41eaf221abc8bfbc | [] | no_license | Axolot1/Dota2Traker | 37cd34a1d57e17f2d9e83a3f6cf18443354fdc5d | b66c9c50412ce43086fb838256c083d87dcb3765 | refs/heads/master | 2021-01-19T02:36:00.941133 | 2017-08-28T12:33:50 | 2017-08-28T12:33:50 | 63,762,053 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,240 | java | package com.axolotl.dota2traker.retrofit.model;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Generated;
/**
* Created by axolotl on 16/6/27.
*/
public class PlayerSumRes {
@SerializedName("response")
@Expose
private Response response;
/**
*
* @return
* The response
*/
public Response getResponse() {
return response;
}
/**
*
* @param response
* The response
*/
public void setResponse(Response response) {
this.response = response;
}
@Generated("org.jsonschema2pojo")
public static class Response {
@SerializedName("players")
@Expose
private List<PlayerSummaries> players = new ArrayList<PlayerSummaries>();
/**
*
* @return
* The players
*/
public List<PlayerSummaries> getPlayers() {
return players;
}
/**
*
* @param players
* The players
*/
public void setPlayers(List<PlayerSummaries> players) {
this.players = players;
}
}
}
| [
"axolotl1991@163.com"
] | axolotl1991@163.com |
ad55b9fc1c413285e4709600ac2ae1a4c8a3eefb | 823a8db541c6f2de312bdad145370b5d788ba934 | /app/src/main/java/com/ropkastudios/android/thegeographyapp/CopyPasteDialogFragment.java | e4adb124a13e9f9b71518a92753a8916d1f86045 | [] | no_license | rohankan/geography-first | bc4669f4bf0418b90eab6a152d22b7bd49e9174f | cc2c2c32ce0123946aa7a30afd5da230b3464836 | refs/heads/master | 2023-01-24T07:25:17.209441 | 2020-12-07T04:49:32 | 2020-12-07T04:49:33 | 319,206,861 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,007 | java | package com.ropkastudios.android.thegeographyapp;
import android.app.Activity;
import android.app.Dialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
public class CopyPasteDialogFragment extends DialogFragment {
private static final String ARG_TITLE = "cptitle";
private static final String ARG_CONTENTS = "cpcontents";
public static CopyPasteDialogFragment newInstance(String title, String contents) {
Bundle args = new Bundle();
args.putString(ARG_TITLE, title);
args.putString(ARG_CONTENTS, contents);
CopyPasteDialogFragment fragment = new CopyPasteDialogFragment();
fragment.setArguments(args);
return fragment;
}
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
View v = LayoutInflater.from(getActivity())
.inflate(R.layout.fragment_copy_paste, null);
TextView tv = (TextView) v.findViewById(R.id.copy_paste_tv);
tv.setText(getArguments().getString(ARG_CONTENTS));
return new AlertDialog.Builder(getActivity())
.setView(v)
.setTitle(getArguments().getString(ARG_TITLE))
.setPositiveButton(R.string.done,
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
sendResult(Activity.RESULT_OK);
}
})
.create();
}
private void sendResult(int resultCode) {
if (getTargetFragment() == null) {
return;
}
getTargetFragment().onActivityResult(getTargetRequestCode(), resultCode, new Intent());
}
}
| [
"rohankanchana@github.com"
] | rohankanchana@github.com |
59fa529a0d415d1974323ed3dd1b9f8500bd9623 | 0d33f3892c930e34d5a3000a499d99153d2c3536 | /PART 1/src/SumOfArrays.java | 8635128109a5aa779fce217db2b8923c9ce65d01 | [] | no_license | shubhiiiiika/JAVA | 91f40b03a5b66fbedd66cab46e4b760ff0019e49 | 1fb2855f9990d81e6a8ba685a448470b6caaea7b | refs/heads/master | 2023-07-08T04:25:14.082687 | 2021-08-18T18:55:41 | 2021-08-18T18:55:41 | 397,705,632 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 714 | java | public class SumOfArrays {
public static void main(String[] args) {
int[]arr={1,2,3,4,5};
int sum =0;
System.out.println("Using for each loop:");
for (int element:arr){
sum+= element;
}
System.out.println(sum);
System.out.println("using for loop:");
int total=0;
for (int i =0;i<arr.length;i++)
/* why <arr.length?; as index starts from 0,
the check statement will run till n-1th element if
<= is given the loop will check for nth element which doesn't exist
gives error out of index bound.
*/
{
total+=arr[i];
}
System.out.println(total);
}
}
| [
"shubhika17dev@gmail.com"
] | shubhika17dev@gmail.com |
f68072e174dc4f7a87329aeb783d0b43736cac78 | 35b3920eda96048876ddf9e88fd8d88b8dacdc7f | /src/cn/woniu/lib/pdf/model/derivate/ImageStream.java | ceba4b9fb59ba682612bb1e6443a7abbd2045ba6 | [
"Apache-2.0"
] | permissive | woniu1983/LibPdfStamper | 6f884a222503e7bd5eaf724f877bd61c728e93cc | 4d5a8fb6884aaedc17a552ecf14ff1991de70879 | refs/heads/master | 2021-06-08T11:47:20.503921 | 2021-04-05T09:31:19 | 2021-04-05T09:31:19 | 133,027,924 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,563 | java | /**
* Copyright (c) 2018, Woniu1983 All Rights Reserved.
*
*/
package cn.woniu.lib.pdf.model.derivate;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import cn.woniu.lib.pdf.image.PDFImage;
import cn.woniu.lib.pdf.model.PDFBoolean;
import cn.woniu.lib.pdf.model.PDFDictionary;
import cn.woniu.lib.pdf.model.PDFIndirectReference;
import cn.woniu.lib.pdf.model.PDFName;
import cn.woniu.lib.pdf.model.PDFNumeric;
import cn.woniu.lib.pdf.model.PDFStream;
/**
* @ClassName: ImageStream <br/>
* @Description: TODO <br/>
*
* @author woniu1983
* @date: 2018年5月14日 下午1:12:54 <br/>
* @version
* @since JDK 1.6
*/
public class ImageStream extends PDFStream {
protected PDFName name = null;
protected PDFImage image = null;
public ImageStream(PDFImage image, String name, PDFIndirectReference maskRef) throws IOException {
super();
this.image = image;
if (name == null){
generateImgResName( image );
} else {
this.name = new PDFName(name);
}
put(PDFName.TYPE, PDFName.XOBJECT);
put(PDFName.SUBTYPE, PDFName.IMAGE);
put(PDFName.WIDTH, new PDFNumeric(image.getWidth()));
put(PDFName.HEIGHT, new PDFNumeric(image.getHeight()));
// TODO 不支持
// if (image.getLayer() != null) {
// put(PDFName.OC, image.getLayer().getRef());
// }
if (image.isMask() && (image.getBpc() == 1 || image.getBpc() > 0xff)) {
put(PDFName.IMAGEMASK, PDFBoolean.PDFTRUE);
}
if (maskRef != null) {
if (image.isSmask()) {
put(PDFName.SMASK, maskRef);
} else {
put(PDFName.MASK, maskRef);
}
}
if (image.isMask() && image.isInverted()) {
put(PDFName.DECODE, new PDFLiteral("[1 0]"));
}
// TODO 不支持
// if (image.isInterpolation()) {
// put(PDFName.INTERPOLATE, PDFBoolean.PDFTRUE);
// }
InputStream is = null;
try {
// deal with transparency TODO transparency == null
int transparency[] = image.getTransparency();
if (transparency != null && !image.isMask() && maskRef == null) {
StringBuilder s = new StringBuilder("[");
for (int k = 0; k < transparency.length; ++k) {
s.append(transparency[k]).append(" ");
}
s.append("]");
put(PDFName.MASK, new PDFLiteral(s.toString()));
}
// Raw PDFImage data
if (image.isImgRaw()) {
// will also have the CCITT parameters
int colorspace = image.getColorspace();
bytes = image.getRawData();
put(PDFName.LENGTH, new PDFNumeric(bytes.length));
int bpc = image.getBpc();
if (bpc > 0xff) {
//TODO 不支持
// if (!image.isMask()) {
// put(PDFName.COLORSPACE, PDFName.DEVICEGRAY);
// }
// put(PDFName.BITSPERCOMPONENT, new PDFNumeric(1));
// put(PDFName.FILTER, PDFName.CCITTFAXDECODE);
// int k = bpc - PDFImage.CCITTG3_1D;
// PDFDictionary decodeparms = new PDFDictionary();
// if (k != 0)
// decodeparms.put(PDFName.K, new PDFNumeric(k));
// if ((colorspace & PDFImage.CCITT_BLACKIS1) != 0)
// decodeparms.put(PDFName.BLACKIS1, PDFBoolean.PDFTRUE);
// if ((colorspace & PDFImage.CCITT_ENCODEDBYTEALIGN) != 0)
// decodeparms.put(PDFName.ENCODEDBYTEALIGN, PDFBoolean.PDFTRUE);
// if ((colorspace & PDFImage.CCITT_ENDOFLINE) != 0)
// decodeparms.put(PDFName.ENDOFLINE, PDFBoolean.PDFTRUE);
// if ((colorspace & PDFImage.CCITT_ENDOFBLOCK) != 0)
// decodeparms.put(PDFName.ENDOFBLOCK, PDFBoolean.PDFFALSE);
// decodeparms.put(PDFName.COLUMNS, new PDFNumeric(image.getWidth()));
// decodeparms.put(PDFName.ROWS, new PDFNumeric(image.getHeight()));
// put(PDFName.DECODEPARMS, decodeparms);
} else {
switch(colorspace) {
case 1:
put(PDFName.COLORSPACE, PDFName.DEVICEGRAY);
if (image.isInverted()) {
put(PDFName.DECODE, new PDFLiteral("[1 0]"));
}
break;
case 3:
put(PDFName.COLORSPACE, PDFName.DEVICERGB);
if (image.isInverted()) {
put(PDFName.DECODE, new PDFLiteral("[1 0 1 0 1 0]"));
}
break;
case 4:
default:
put(PDFName.COLORSPACE, PDFName.DEVICECMYK);
if (image.isInverted()) {
put(PDFName.DECODE, new PDFLiteral("[1 0 1 0 1 0 1 0]"));
}
}
PDFDictionary additional = image.getAdditional();
if (additional != null) {
putAll(additional);
}
if (image.isMask() && (image.getBpc() == 1 || image.getBpc() > 8)) {
remove(PDFName.COLORSPACE);
}
put(PDFName.BITSPERCOMPONENT, new PDFNumeric(image.getBpc()));
if (image.isDeflated()) {
put(PDFName.FILTER, PDFName.FLATEDECODE);
} else {
flateCompress(image.getCompressionLevel());
}
}
return;
}
// Not get here TODO
// TODO 不支持
// // GIF, JPEG or PNG
// String errorID;
// if (image.getRawData() == null){
// throw new IOException("Can't get Image RawData");
// // is = image.getUrl().openStream();
// // errorID = image.getUrl().toString();
// }
// else{
// is = new java.io.ByteArrayInputStream(image.getRawData());
// errorID = "Byte array";
// }
//
// switch(image.type()) {
// case PDFImage.JPEG:
// //TODO
// break;
// case PDFImage.JPEG2000:
// //TODO
// break;
// case PDFImage.JBIG2:
// //TODO
// break;
// default:
// throw new IOException("unknown image format");
// }
// if (image.getCompressionLevel() > NO_COMPRESSION) {
// flateCompress(image.getCompressionLevel());
// }
// put(PDFName.LENGTH, new PDFNumeric(streamBytes.size()));
}
finally {
if (is != null) {
try{
is.close();
} catch (Exception ee) {
}
}
}
}
public PDFName getName() {
return name;
}
public PDFImage getImage() {
return image;
}
private void generateImgResName(PDFImage img ) {
name = new PDFName("img" + Long.toHexString(img.getImgId()));
}
static final int TRANSFERSIZE = 4096;
static void transferBytes(InputStream in, OutputStream out, int len) throws IOException {
byte buffer[] = new byte[TRANSFERSIZE];
if (len < 0)
len = 0x7fff0000;
int size;
while (len != 0) {
size = in.read(buffer, 0, Math.min(len, TRANSFERSIZE));
if (size < 0)
return;
out.write(buffer, 0, size);
len -= size;
}
}
}
| [
"mm1983abc@163.com"
] | mm1983abc@163.com |
77695855220412c1352454aa847a99189b5e42e2 | 92849d601c580b2ae8ecf43a444ac2101e9b1e4f | /src/test/java/io/github/oemergenc/hbase/orm/extensions/domain/Campaign.java | 12bb7d3bb989eb3d3884fb42ecf06f76627fabf2 | [
"Apache-2.0"
] | permissive | oemergenc/hbase-orm-extensions | 2296a285b724e45b35cf043d0ecc703cbda776cc | c2df58933f1f843f459eb1a023859fd3326cc484 | refs/heads/master | 2020-12-26T20:02:35.301874 | 2020-06-23T22:40:57 | 2020-06-23T22:40:57 | 237,623,526 | 0 | 1 | Apache-2.0 | 2020-06-23T22:40:58 | 2020-02-01T14:05:17 | Groovy | UTF-8 | Java | false | false | 486 | java | package io.github.oemergenc.hbase.orm.extensions.domain;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Map;
@Data
@NoArgsConstructor
public class Campaign implements Serializable {
private String campaignId;
private String customerId;
private Map<String, String> products;
public Campaign(String campaignId, String customerId) {
this.campaignId = campaignId;
this.customerId = customerId;
}
}
| [
"oemergenc@gmail.com"
] | oemergenc@gmail.com |
d2db1e6f16f468112f25d15bdf043286b6441708 | 7b3203d751ccdc8a909accb94834f86de71fc246 | /src/java/org/apache/ecs/wml/DoType.java | 1cd2f9546619477a3a7de6b99d77a19786a53057 | [
"Apache-1.1",
"Apache-2.0",
"BSD-2-Clause"
] | permissive | umairabbas/ecs | 0c0c8502c0a6f843a4b68f81c8a57c93b805f535 | fc42693826fad20a28d374e7cb3a4145b6eae4b1 | refs/heads/master | 2021-04-28T11:15:49.035691 | 2018-02-19T16:30:35 | 2018-02-19T16:30:35 | 122,089,822 | 0 | 0 | null | null | null | null | ISO-8859-2 | Java | false | false | 3,550 | java | /*
* ====================================================================
*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2000-2003 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Jakarta Element Construction Set",
* "Jakarta ECS" , and "Apache Software Foundation" must not be used
* to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* "Jakarta Element Construction Set" nor "Jakarta ECS" nor may "Apache"
* appear in their names without prior written permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package org.apache.ecs.wml;
/**
This class defines constant values for the do element type
@author Written by <a href="mailto:Anders.Samuelson@aspiro.com">Anders.Samuelson</a>
@author Modifications by <a href="mailto:Orjan.Petersson@ehpt.com">Örjan Petersson</a>
*/
public class DoType
{
public static final DoType ACCEPT = new DoType("accept");
public static final DoType DELETE = new DoType("delete");
public static final DoType HELP = new DoType("help");
public static final DoType OPTIONS = new DoType("options");
public static final DoType PREV = new DoType("prev");
private String value = null;
private DoType(String value)
{
this.value = value;
}
public String toString()
{
return value;
}
}
| [
"umairabbas@hotmail.com"
] | umairabbas@hotmail.com |
0b186d0a79dc24f0f34fb196917328b59932b0ff | 42f6583f088563a75a458d2e60f55422e02ea83a | /sources/kotlin/collections/ArraysKt___ArraysKt$withIndex$9.java | c183ed588cdd3f106395314a4ae4265d779c80aa | [] | no_license | jinendrasahu/Music-Player-Android-Application | dcac7f57d4dc05ee3c772c0fff27da3a315ed927 | 230f8c0c3b2cfbf07690b62e9485c04899fcc517 | refs/heads/master | 2023-02-04T21:13:09.658658 | 2020-12-25T12:29:23 | 2020-12-25T12:29:23 | 324,344,841 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 898 | java | package kotlin.collections;
import kotlin.Metadata;
import kotlin.jvm.functions.Function0;
import kotlin.jvm.internal.ArrayIteratorsKt;
import kotlin.jvm.internal.Lambda;
@Metadata(bv = {1, 0, 3}, d1 = {"\u0000\b\n\u0000\n\u0002\u0018\u0002\n\u0000\u0010\u0000\u001a\u00020\u0001H\n¢\u0006\u0002\b\u0002"}, d2 = {"<anonymous>", "Lkotlin/collections/CharIterator;", "invoke"}, k = 3, mv = {1, 1, 15})
/* compiled from: _Arrays.kt */
final class ArraysKt___ArraysKt$withIndex$9 extends Lambda implements Function0<CharIterator> {
final /* synthetic */ char[] $this_withIndex;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
ArraysKt___ArraysKt$withIndex$9(char[] cArr) {
super(0);
this.$this_withIndex = cArr;
}
public final CharIterator invoke() {
return ArrayIteratorsKt.iterator(this.$this_withIndex);
}
}
| [
"jinendrasahu11@gmail.com"
] | jinendrasahu11@gmail.com |
558585a1266c84a625301d84c9d69cd507b36d11 | 90a89b63b2b6c75824fa4873b3102672428dbbd9 | /src/main/java/com/assignment/android/repository/BookRepository.java | 37d694a47949084c72b1b11051fe0689c209bac6 | [] | no_license | NamNguyen2110/audio_book_api | db02b9798bb38f7292d5591ffd7e533f2b5683f1 | 90fe09023f8f288b2e46098dc6d586fddf238ee2 | refs/heads/master | 2023-05-13T15:40:53.754217 | 2021-05-24T17:04:39 | 2021-05-24T17:04:39 | 366,999,102 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 482 | java | package com.assignment.android.repository;
import com.assignment.android.model.Book;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
public interface BookRepository extends JpaRepository<Book, Integer> {
@Query("SELECT b FROM Book b WHERE b.status = '1'")
List<Book> getHomePageBook();
@Query("SELECT b FROM Book b WHERE b.status = '2'")
List<Book> getTrendingBook();
}
| [
"nguyenvannamptit@gmail.com"
] | nguyenvannamptit@gmail.com |
52c5aca728c6796a122689feecb719e2d85559e4 | 0ba78b6d97675d0a710a0df2704bad0fb005507a | /src/main/java/com/alexzfx/leetCode/dp/NumSquares.java | 24b15cb7156696abf612d8991e95994a3694e7b7 | [] | no_license | AlexZFX/AlgorithmStudy | 58c72b2f560ede2dfeb53b80c583d59641bd2226 | ac74062ccd0806f0355ca29faaba80563e5fd129 | refs/heads/master | 2020-03-24T06:42:07.496386 | 2018-10-31T04:52:53 | 2018-10-31T04:52:53 | 142,538,335 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 879 | java | package com.alexzfx.leetCode.dp;
/**
* Author : Alex
* Date : 2018/9/22 11:38
* Description : 279. 完全平方数
* <p>
* 给定正整数 n,找到若干个完全平方数(比如 1, 4, 9, 16, ...)使得它们的和等于 n。你需要让组成和的完全平方数的个数最少。
*/
public class NumSquares {
public static void main(String[] args) {
NumSquares numSquares = new NumSquares();
System.out.println(numSquares.numSquares(13));
}
public int numSquares(int n) {
int[] dp = new int[n + 1];
dp[1] = 1;
int temp = Integer.MAX_VALUE;
for (int i = 2; i <= n; i++) {
for (int j = 1; j <= Math.sqrt(i); j++) {
temp = Math.min(temp, dp[i - j * j] + 1);
}
dp[i] = temp;
temp = Integer.MAX_VALUE;
}
return dp[n];
}
}
| [
"z1079911968@163.com"
] | z1079911968@163.com |
283715f0bff5b2fd95aa9e1be5816c35a92f7094 | 002f319a6ad34b0d866e142c23b51569c8a4cc51 | /SDM_Engine/src/SDMSystem/SDMSystemCustomers.java | 8d34c23db90275771e60ab41b53ec90e05b988ff | [] | no_license | orelmo/Super-Duper-Market--Web-App | 9f3f4f3528823eacb53b6d8da8770e2e30074f2f | bbf2a3f01a88129b6ea6e07878a832cf1232bf52 | refs/heads/main | 2023-01-07T23:21:53.458598 | 2020-11-10T07:05:24 | 2020-11-10T07:05:24 | 311,573,849 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,005 | java | package SDMSystem;
import EngineClasses.Interfaces.Containable;
import java.util.HashMap;
import java.util.Map;
public class SDMSystemCustomers implements Containable<Integer, SDMSystemCustomer> {
private Map<Integer, SDMSystemCustomer> idToCustomer = new HashMap<>();
@Override
public boolean isExist(Integer key) {
return this.idToCustomer.containsKey(key);
}
@Override
public SDMSystemCustomer get(Integer key) {
return this.idToCustomer.get(key);
}
public SDMSystemCustomer get(String username) {
for(SDMSystemCustomer customer : this.getIterable()){
if(customer.getName().equals(username)){
return customer;
}
}
return null;
}
@Override
public void add(Integer key, SDMSystemCustomer newObj) {
this.idToCustomer.put(key, newObj);
}
@Override
public Iterable<SDMSystemCustomer> getIterable() {
return this.idToCustomer.values();
}
} | [
"orelmoshe94@gmail.com"
] | orelmoshe94@gmail.com |
e9f4117dbb6cef61e950100cf81a4ced325d3a9b | b8e16a55024c19f2f009ab83f186e621775e7e68 | /wrkspc_bloque1/DesarrolloClases/src/ejemplos/composicion/Main.java | 0069d828032aa401821937c9838941e04e00ef35 | [] | no_license | Chapa03/programacion-clases | 7afa24511fe031fa56107e0970f16fd61976ab4d | f6833b9a590f7f45201e761a9a2a09c7da2df34d | refs/heads/master | 2023-02-02T17:14:45.324100 | 2020-12-11T11:27:00 | 2020-12-11T11:27:00 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 286 | java | package ejemplos.composicion;
public class Main {
public static void main(String[] args) {
Ciudad vCiudad=new Ciudad(1,"Madrid",1);
Fecha vFecha=new Fecha(12,3,2000);
Persona vPersona=new Persona("123","Maria","Ferrando",'F',vCiudad,vCiudad,vFecha);
}
}
| [
"letic@T1SERV"
] | letic@T1SERV |
e665b32c0c0584a56dbfd19827c5fc0eaff40512 | 630430012db804e61eb7205bf89fafc84b69460d | /app/src/main/java/com/david/p1/projetonovo/Principal.java | dd92d44ccee99845cb245fb8cb44c7a6133266e6 | [] | no_license | DavidXea/CalculadorAndroid | d50eaa6d3204fb82506921012e562d0070a8ad0f | 1b127f02f2a0be9ed30eba8d17739b9be44222d5 | refs/heads/master | 2020-12-30T16:28:14.997478 | 2017-05-11T16:07:15 | 2017-05-11T16:07:15 | 90,991,448 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 340 | java | package com.david.p1.projetonovo;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class Principal extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.interface_principal);
}
}
| [
"5981506@univali.br"
] | 5981506@univali.br |
7866035a66d762f21c3af10b399377099d974cbd | f8af02dd6d14287f6bfbb8725e3b11094261875b | /deps/src/main/java/com/newrelic/deps/org/apache/http/impl/cookie/DateParseException.java | 096eb0a92650db9df24b76a7f27c3eff0ff93607 | [] | no_license | masonmei/mx | fca12bedf2c9fef30452a485b81e23d416a0b534 | 38e0909f9a1720f32d59af280d7fd9a591c45f6c | refs/heads/master | 2021-01-11T04:57:18.501563 | 2015-07-30T08:20:28 | 2015-07-30T08:20:31 | 39,553,289 | 2 | 3 | null | null | null | null | UTF-8 | Java | false | false | 1,778 | java | /*
* ====================================================================
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
*/
package com.newrelic.deps.org.apache.http.impl.cookie;
import com.newrelic.deps.org.apache.http.annotation.Immutable;
/**
* An exception to indicate an error parsing a date string.
*
* @see DateUtils
*
*
* @since 4.0
*/
@Immutable
public class DateParseException extends Exception {
private static final long serialVersionUID = 4417696455000643370L;
/**
*
*/
public DateParseException() {
super();
}
/**
* @param message the exception message
*/
public DateParseException(final String message) {
super(message);
}
}
| [
"dongxu.m@gmail.com"
] | dongxu.m@gmail.com |
32970cd559fe67667d88d08512fcad68c66e5984 | 894e0b59e0c5202073ce791e842533f3008bb8f8 | /ImageRecognition1/src/jp/ohwada/andorid/imagerecognition1/Constant.java | e073352afe9d4c4cb19311b86ef279386b5fee9b | [] | no_license | ohwada/Android_ImageRecognition1 | a43444d6dc6aaaafc0d6e89138eec4a017561485 | d3b51f97bfb7f1734de809ee958a309248f5b9b0 | refs/heads/master | 2020-05-14T20:57:00.521505 | 2014-12-09T06:07:08 | 2014-12-09T06:07:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 343 | java | package jp.ohwada.andorid.imagerecognition1;
/**
* Constant
*/
public class Constant {
public static final String TAG = "ImageRecognition";
public static final boolean D = true;
public static final int REQUEST_PHOTO_KITKAT = 1;
public static final int REQUEST_PHOTO_DEFAULT= 2;
public static final int REQUEST_CAMERA = 3;
}
| [
"ml.ohwada@gmail.com"
] | ml.ohwada@gmail.com |
41367260eec24c82a5f9a0ca819b710b1203c127 | dbbd3b844fb378f9c4e8f552250c71e568d11fde | /springboot-webflux/src/main/java/com/wxx/sbw/SpringbootWebfluxApplication.java | 3d24da3f0b10f9c4008ca40cadd8d7a74707603b | [] | no_license | WeisonWei/springboot-aggregation | 19203a46b4d9b345b7e0163c4ff7c47038f766bb | 12c39c76aaadc1d5d803398f523389eacd45b2c5 | refs/heads/master | 2020-06-28T20:15:42.651974 | 2019-08-12T15:11:37 | 2019-08-12T15:11:37 | 200,330,973 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 338 | java | package com.wxx.sbw;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringbootWebfluxApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootWebfluxApplication.class, args);
}
}
| [
"weixx3@139.com"
] | weixx3@139.com |
089fb54bca2e5f7f99d6ea3c948f37ed2e470c33 | a1826c2ed9c12cfc395fb1a14c1a2e1f097155cb | /holowatcher-20200730/src/main/java/com/aliyun/holowatcher20200730/models/ValidAliyunUidResponse.java | 9d46fcbf0e4a3eb6ce7c20b70b4e146e8c4cd380 | [
"Apache-2.0"
] | permissive | aliyun/alibabacloud-java-sdk | 83a6036a33c7278bca6f1bafccb0180940d58b0b | 008923f156adf2e4f4785a0419f60640273854ec | refs/heads/master | 2023-09-01T04:10:33.640756 | 2023-09-01T02:40:45 | 2023-09-01T02:40:45 | 288,968,318 | 40 | 45 | null | 2023-06-13T02:47:13 | 2020-08-20T09:51:08 | Java | UTF-8 | Java | false | false | 1,365 | java | // This file is auto-generated, don't edit it. Thanks.
package com.aliyun.holowatcher20200730.models;
import com.aliyun.tea.*;
public class ValidAliyunUidResponse extends TeaModel {
@NameInMap("headers")
@Validation(required = true)
public java.util.Map<String, String> headers;
@NameInMap("statusCode")
@Validation(required = true)
public Integer statusCode;
@NameInMap("body")
@Validation(required = true)
public ValidAliyunUidResponseBody body;
public static ValidAliyunUidResponse build(java.util.Map<String, ?> map) throws Exception {
ValidAliyunUidResponse self = new ValidAliyunUidResponse();
return TeaModel.build(map, self);
}
public ValidAliyunUidResponse setHeaders(java.util.Map<String, String> headers) {
this.headers = headers;
return this;
}
public java.util.Map<String, String> getHeaders() {
return this.headers;
}
public ValidAliyunUidResponse setStatusCode(Integer statusCode) {
this.statusCode = statusCode;
return this;
}
public Integer getStatusCode() {
return this.statusCode;
}
public ValidAliyunUidResponse setBody(ValidAliyunUidResponseBody body) {
this.body = body;
return this;
}
public ValidAliyunUidResponseBody getBody() {
return this.body;
}
}
| [
"sdk-team@alibabacloud.com"
] | sdk-team@alibabacloud.com |
4bf101c84c74fb15e029967cf42136f9612c3bf6 | dc0722db903a488b9989f4dd64e48234a12de211 | /library/src/main/java/de/wirecard/pdfbox/layout/util/EnumeratorFactory.java | e2fdacc99c693dfa83efab8ff21ff47a675232fa | [
"MIT"
] | permissive | WirecardMobileServices/pdfbox-layout-android | cc691782f6bc9f49bcb40edfddebb104ff0f8813 | b11f62f95dea3413d63dc5b244a933107bc72ee4 | refs/heads/master | 2020-03-21T15:48:34.827057 | 2018-09-05T13:57:43 | 2018-09-05T13:57:43 | 138,734,012 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,649 | java | package de.wirecard.pdfbox.layout.util;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import de.wirecard.pdfbox.layout.util.Enumerators.AlphabeticEnumerator;
import de.wirecard.pdfbox.layout.util.Enumerators.ArabicEnumerator;
import de.wirecard.pdfbox.layout.util.Enumerators.LowerCaseAlphabeticEnumerator;
import de.wirecard.pdfbox.layout.util.Enumerators.LowerCaseRomanEnumerator;
import de.wirecard.pdfbox.layout.util.Enumerators.RomanEnumerator;
/**
* Enumerators are created using this factory. It allows you to register and use
* your own enumerations, if the built ins does not satisfy your needs.<br>
* Currently supported are:
* <table>
* <tr><th>Name</th><th>Key</th><th>Seperator</th></tr>
* <tr><td>Arabic</td><td align="center">1</td><td align="center">.</td></tr>
* <tr><td>Roman</td><td align="center">I</td><td align="center">.</td></tr>
* <tr><td>Roman Lower Case</td><td align="center">i</td><td align="center">.</td></tr>
* <tr><td>Alphabetic</td><td align="center">A</td><td align="center">)</td></tr>
* <tr><td>Alphabetic Lower Case</td><td align="center">a</td><td align="center">)</td></tr>
* </table>
*/
public class EnumeratorFactory {
private final static Map<String, Class<? extends Enumerator>> ENUMERATORS = new ConcurrentHashMap<String, Class<? extends Enumerator>>();
static {
register("1", ArabicEnumerator.class);
register("I", RomanEnumerator.class);
register("i", LowerCaseRomanEnumerator.class);
register("A", AlphabeticEnumerator.class);
register("a", LowerCaseAlphabeticEnumerator.class);
}
/**
* Registers an Enumerator class for a given key.
*
* @param key the key (character) used in markup.
* @param enumeratorClass the enumerator class.
*/
public static void register(final String key,
final Class<? extends Enumerator> enumeratorClass) {
ENUMERATORS.put(key, enumeratorClass);
}
/**
* Creates an Enumerator for the given key.
*
* @param key the key of the enumerator.
* @return the created enumerator.
*/
public static Enumerator createEnumerator(final String key) {
Class<? extends Enumerator> enumeratorClass = ENUMERATORS.get(key);
if (enumeratorClass == null) {
throw new IllegalArgumentException("no enumerator found for '"
+ key + "'");
}
try {
return enumeratorClass.newInstance();
} catch (Exception e) {
throw new RuntimeException("failed to create enumerator", e);
}
}
}
| [
"jakub.misko@wirecard.com"
] | jakub.misko@wirecard.com |
2168d2ba27e724366fac84c7890a349c78d584f5 | aeaea40ac04d0f6a32e0ea860f40cf26edd539a6 | /WvivmallT/.svn/pristine/80/803a55dca7eb676761b5d98c2e44e065e40ef02d.svn-base | a11a5aa2ba790ae70d4a9b81e9d9c70a156444e3 | [] | no_license | minhmomang/SPM2016 | e9413786012d963ab3a459857e9fda48437ef407 | 5b50d60dcdec75ea1612fe5225ca726ae86f8f24 | refs/heads/master | 2021-01-12T12:40:35.231354 | 2016-10-03T19:31:13 | 2016-10-03T19:31:13 | 69,898,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,638 | package Model;
/***********************************************************************
* Module: Contact.java
* Author: HuynhChau
* Purpose: Defines the Class Contact
***********************************************************************/
import java.util.*;
/** @pdOid 0d378724-332e-486e-9250-4788cecc82ce */
public class Contact {
/** @pdOid afddd4dc-8148-4b33-97cb-240f039cc451 */
private String fullname;
/** @pdOid e1fa71ab-93a1-4df8-9fca-5e41be61517e */
private String email;
/** @pdOid 04f82c05-ce48-4fe0-be24-c5188fb6b029 */
private String phone;
/** @pdOid 5d0e059a-f712-425a-8a70-22e2a8444ec1 */
/** @pdOid 0da5114d-006b-420f-9196-37e714f441fb */
private String content;
/** @pdOid 8d06a334-b0ec-4e77-89ef-c1ecfde5e7da */
private String contactDate;
private int state;
/** @pdOid cc51e46b-ef36-4149-84ef-f9b5bd0c43cd */
public void submit_contact() {
// TODO: implement
}
public String getFullname() {
return fullname;
}
public void setFullname(String fullname) {
this.fullname = fullname;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getContactDate() {
return contactDate;
}
public void setContactDate(String contactDate) {
this.contactDate = contactDate;
}
public int getState() {
return state;
}
public void setState(int state) {
this.state = state;
}
} | [
"thminh.cseiu@gmail.com"
] | thminh.cseiu@gmail.com | |
94b049f23868a2547d6a56aaf96e3a61bb6fe824 | 537ed3ee15800e76cc3b6daee0fea06dcc6ad9da | /flash-sale-api/src/main/java/io/github/zhenyed/api/common/fallback/ProductServiceFallback.java | 487c5bb60eeecd866e6c94e799e31157dded4736 | [
"Apache-2.0"
] | permissive | zhenyed/flash-sale | a28e7a79ed73e3a021f4553376343e4484095d99 | 6c03f6b4f49b4e0b788c205e40a598f383ab317f | refs/heads/master | 2022-06-26T11:49:48.850383 | 2020-03-26T04:44:10 | 2020-03-26T04:44:10 | 246,748,316 | 0 | 0 | Apache-2.0 | 2022-06-17T02:59:03 | 2020-03-12T05:06:04 | Java | UTF-8 | Java | false | false | 1,230 | java | package io.github.zhenyed.api.common.fallback;
import io.github.zhenyed.api.common.constant.ProductErrorCodeEnum;
import io.github.zhenyed.api.common.service.ProductApiService;
import io.github.zhenyed.api.common.vo.CommonResult;
import io.github.zhenyed.api.product.vo.ProductVO;
import org.springframework.stereotype.Component;
import static io.github.zhenyed.api.common.vo.CommonResult.error;
@Component
public class ProductServiceFallback implements ProductApiService {
@Override
public CommonResult<ProductVO> getProductInfo(Integer id) {
return error(ProductErrorCodeEnum.PRODUCT_INVOKE_ERROR.getCode(),
ProductErrorCodeEnum.PRODUCT_INVOKE_ERROR.getMessage());
}
@Override
public CommonResult<Boolean> reduceQuantity(Integer id, Integer quantity) {
return error(ProductErrorCodeEnum.PRODUCT_INVOKE_ERROR.getCode(),
ProductErrorCodeEnum.PRODUCT_INVOKE_ERROR.getMessage());
}
// @Override
// public CommonResult<Boolean> resetQuantity(Integer id, Integer quantity) {
// return error(ProductErrorCodeEnum.PRODUCT_INVOKE_ERROR.getCode(),
// ProductErrorCodeEnum.PRODUCT_INVOKE_ERROR.getMessage());
// }
}
| [
"631461213@qq.com"
] | 631461213@qq.com |
b319c9f9156dbc51c6588b4e9870afe104890879 | 5e97803fabbb02ddd210184c9455ef9126a0aeee | /jrt_api/src/main/java/com/wocai/jrt/paper/dao/OptionsDao.java | 6aec88693deb22de5fd19edb135526038d54a37f | [] | no_license | gaga839/demo_api | 366ff118173b5de4dde891655216757ad4bad96c | 6bded9851636d6da66039a3d56e10dc551f0f772 | refs/heads/master | 2020-04-11T20:08:38.112265 | 2016-01-25T01:22:12 | 2016-01-25T01:22:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 484 | java | package com.wocai.jrt.paper.dao;
import com.vteba.tx.jdbc.mybatis.annotation.DaoMapper;
import com.vteba.tx.jdbc.mybatis.spi.BaseDao;
import com.wocai.jrt.paper.model.Options;
import com.wocai.jrt.paper.model.OptionsBean;
/**
* 表options的MyBatis Dao Mapper。
* 由代码工具自动生成,可以新增方法,但是不要修改自动生成的方法。
* @date 2015-11-09 16:40:04
*/
@DaoMapper
public interface OptionsDao extends BaseDao<Options, OptionsBean, String> {
} | [
"tongku2008@126.com"
] | tongku2008@126.com |
c81c1d7f593704583cf842deedabe5a19c6db49f | 2f8d9282faa3f3c35c011e000f9a34a1ece55b05 | /app/src/main/java/com/jihad/app/travelmate/adapters/EventDetailsAdapter.java | 79c058b64c0a0a02a5c9ff560679855b860f9483 | [] | no_license | Jehadul/TravelMate | 6b633efb934b58c614921a94cad56a71a78d8c0d | b60777e5ff43de8de80df34a3e6cc02cb081321f | refs/heads/master | 2020-11-30T17:19:13.730739 | 2019-12-27T13:58:50 | 2019-12-27T13:58:50 | 225,948,767 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,152 | java | package com.jihad.app.travelmate.adapters;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import com.jihad.app.travelmate.R;
import com.jihad.app.travelmate.fragments.EventDetailsFragment;
import com.jihad.app.travelmate.models.Event;
import com.jihad.app.travelmate.models.EventExpense;
import java.util.ArrayList;
import java.util.List;
public class EventDetailsAdapter extends RecyclerView.Adapter<EventDetailsAdapter.DetailsViewHolder> {
private static List<EventExpense> mEventExpenseList = new ArrayList<>();
private LayoutInflater mInflater;
private Context context;
private Event currentEvent;
public EventDetailsAdapter(Context context, List<EventExpense> eventExpenseList, Event currentEvent) {
mEventExpenseList = eventExpenseList;
this.mInflater = LayoutInflater.from(context);
this.context = context;
this.currentEvent = currentEvent;
}
@NonNull
@Override
public DetailsViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
View view = mInflater.inflate(R.layout.card_view_event_expense_item, viewGroup, false);
return new DetailsViewHolder(view);
}
@Override
public void onBindViewHolder(@NonNull DetailsViewHolder viewHolder, int position) {
EventExpense eventExpense = mEventExpenseList.get(position);
viewHolder.setData(eventExpense);
}
@Override
public int getItemCount() {
return mEventExpenseList.size();
}
public class DetailsViewHolder extends RecyclerView.ViewHolder {
EventExpense currentEventExpense;
TextView tvDate, tvType, tvAmount, tvDescription, tvCreatedAt;
DetailsViewHolder(@NonNull View itemView) {
super(itemView);
tvDate = itemView.findViewById(R.id.tv_expense_item_date);
tvType = itemView.findViewById(R.id.tv_expense_item_type);
tvAmount = itemView.findViewById(R.id.tv_expense_item_amount);
tvDescription = itemView.findViewById(R.id.tv_expense_item_description);
tvCreatedAt = itemView.findViewById(R.id.tv_expense_item_create_date);
itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
new EventDetailsFragment().openModalDialogForEdit(currentEvent, currentEventExpense, context);
}
});
}
public void setData(EventExpense eventExpense) {
this.currentEventExpense = eventExpense;
tvDate.setText(eventExpense.getExpenseDate());
tvType.setText(eventExpense.getType());
tvAmount.setText(String.valueOf(eventExpense.getAmount())+" TK");
tvDescription.setText(eventExpense.getDescription());
tvCreatedAt.setText("Created at: "+eventExpense.getCreatedTime()+" "+eventExpense.getCreatedDate());
}
}
}
| [
"smhoque100@gmail.com"
] | smhoque100@gmail.com |
a928f9ee0fc136d5c06eb5241bacc77fdc9b2daa | 5e8372bde3d91411cf9b1d80eb1f38e762ee1b0b | /spring-boot-jdbc-multiple-database/src/test/java/com/example/mdb/MultipleDatabaseApplicationTests.java | 92d644945bf524924d76ddc79ba4eccc00ebdd21 | [] | no_license | aklakl/mingli-spring-boot-microservices | 2d3d4ba2f6e8f835a46f5514fb8cab037d3ab1e5 | 960909fd2f00781511f9cd9451cd5774c84a7d3e | refs/heads/master | 2021-09-06T23:48:14.707918 | 2018-02-13T15:44:44 | 2018-02-13T15:44:44 | 113,093,370 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 342 | java | package com.example.mdb;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class MultipleDatabaseApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"mingli19850915@gmail.com"
] | mingli19850915@gmail.com |
aa34d1010dc984dca72dfb40e84c04e8bd25b868 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/5/5_3af2f711d276107038d1e86c3acd537f2bcd69f2/AstList/5_3af2f711d276107038d1e86c3acd537f2bcd69f2_AstList_t.java | 9e4ec89cc623c6eacae0fd91512c89bbfad503fc | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 17,095 | java | /*
* I don't like that this is in org.python.core, but PySequence has package
* private methods that I want to override. Hopefully we will clean up the
* PyList hierarchy in the future, and then maybe we will find a more sensible
* place for this class.
*/
package org.python.core;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import org.python.antlr.adapter.AstAdapter;
import org.python.expose.ExposedGet;
import org.python.expose.ExposedMethod;
import org.python.expose.ExposedType;
import org.python.expose.MethodType;
@ExposedType(name = "_ast.astlist", base = PyList.class)
public class AstList extends PySequence implements Cloneable, List {
public static final PyType TYPE = PyType.fromClass(AstList.class);
private final static PyString[] fields = new PyString[0];
@ExposedGet(name = "_fields")
public PyString[] get_fields() { return fields; }
/** The underlying Java List. */
private List data;
private AstAdapter adapter;
public AstList() {
this(TYPE, new ArrayList(), null);
}
public AstList(List data) {
this(TYPE, data, null);
}
public AstList(List data, AstAdapter adapter) {
this(TYPE, data, adapter);
}
public AstList(PyType type, List data, AstAdapter adapter) {
super(TYPE);
if (data == null) {
data = new ArrayList();
}
this.data = data;
this.adapter = adapter;
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject astlist___ne__(PyObject o) {
return seq___ne__(o);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject astlist___eq__(PyObject o) {
return seq___eq__(o);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject astlist___lt__(PyObject o) {
return seq___lt__(o);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject astlist___le__(PyObject o) {
return seq___le__(o);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject astlist___gt__(PyObject o) {
return seq___gt__(o);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject astlist___ge__(PyObject o) {
return seq___ge__(o);
}
@ExposedMethod
final boolean astlist___contains__(PyObject o) {
return object___contains__(o);
}
@ExposedMethod
final void astlist___delitem__(PyObject index) {
seq___delitem__(index);
}
@ExposedMethod
final void astlist___setitem__(PyObject o, PyObject def) {
seq___setitem__(o, def);
}
@ExposedMethod
final PyObject astlist___getitem__(PyObject o) {
PyObject ret = seq___finditem__(o);
if(ret == null) {
throw Py.IndexError("index out of range: " + o);
}
return ret;
}
@ExposedMethod
final boolean astlist___nonzero__() {
return seq___nonzero__();
}
@ExposedMethod
public PyObject astlist___iter__() {
return seq___iter__();
}
@ExposedMethod(defaults = "null")
final PyObject astlist___getslice__(PyObject start, PyObject stop, PyObject step) {
return seq___getslice__(start, stop, step);
}
@ExposedMethod(defaults = "null")
final void astlist___setslice__(PyObject start, PyObject stop, PyObject step, PyObject value) {
if(value == null) {
value = step;
step = null;
}
seq___setslice__(start, stop, step, value);
}
@ExposedMethod(defaults = "null")
final void astlist___delslice__(PyObject start, PyObject stop, PyObject step) {
seq___delslice__(start, stop, step);
}
public PyObject __imul__(PyObject o) {
return astlist___imul__(o);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject astlist___imul__(PyObject o) {
if (!o.isIndex()) {
return null;
}
int count = o.asIndex(Py.OverflowError);
int size = size();
if (size == 0 || count == 1) {
return this;
}
if (count < 1) {
clear();
return this;
}
if (size > Integer.MAX_VALUE / count) {
throw Py.MemoryError("");
}
int oldsize = data.size();
for (int i = 1; i < count; i++) {
data.addAll(data.subList(0, oldsize));
}
return this;
}
public PyObject __mul__(PyObject o) {
return astlist___mul__(o);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject astlist___mul__(PyObject o) {
if (!o.isIndex()) {
return null;
}
return repeat(o.asIndex(Py.OverflowError));
}
public PyObject __rmul__(PyObject o) {
return astlist___rmul__(o);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject astlist___rmul__(PyObject o) {
if (!o.isIndex()) {
return null;
}
return repeat(o.asIndex(Py.OverflowError));
}
public PyObject __iadd__(PyObject other) {
return astlist___iadd__(other);
}
@ExposedMethod
final PyObject astlist___iadd__(PyObject o) {
PyType oType = o.getType();
if (oType == TYPE || oType == PyTuple.TYPE || this == o) {
extend(fastSequence(o, "argument must be iterable"));
return this;
}
PyObject it;
try {
it = o.__iter__();
} catch (PyException pye) {
if (!Py.matchException(pye, Py.TypeError)) {
throw pye;
}
return null;
}
extend(it);
return this;
}
public PyObject __add__(PyObject other) {
return astlist___add__(other);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject astlist___add__(PyObject o) {
AstList sum = null;
Object oList = o.__tojava__(List.class);
if(oList != Py.NoConversion && oList != null) {
List otherList = (List) oList;
sum = new AstList();
sum.extend(this);
for(Iterator i = otherList.iterator(); i.hasNext();) {
sum.add(i.next());
}
}
return sum;
}
public PyObject __radd__(PyObject o) {
return astlist___radd__(o);
}
@ExposedMethod(type = MethodType.BINARY)
final PyObject astlist___radd__(PyObject o) {
PyList sum = null;
Object oList = o.__tojava__(List.class);
if (oList != Py.NoConversion && oList != null) {
sum = new PyList();
sum.addAll((List) oList);
sum.extend(this);
}
return sum;
}
public int __len__() {
return data.size();
}
@Override
public String toString() {
return astlist_toString();
}
@ExposedMethod(names = "__repr__")
final String astlist_toString() {
return data.toString();
}
public void append(PyObject o) {
astlist_append(o);
}
@ExposedMethod
final void astlist_append(PyObject o) {
data.add(o);
}
public Object clone() {
return new AstList(this);
}
@ExposedMethod
final int astlist_count(PyObject value) {
int count = 0;
for(Object o : data) {
if(o.equals(value)) {
count++;
}
}
return count;
}
public int count(PyObject value) {
return astlist_count(value);
}
public int index(PyObject o) {
return astlist_index(o, 0, size());
}
public int index(PyObject o, int start) {
return astlist_index(o, start, size());
}
public int index(PyObject o, int start, int stop) {
return astlist_index(o, start, stop);
}
@ExposedMethod(defaults = {"null", "null"})
final int astlist_index(PyObject o, PyObject start, PyObject stop) {
int startInt = start == null ? 0 : PySlice.calculateSliceIndex(start);
int stopInt = stop == null ? size() : PySlice.calculateSliceIndex(stop);
return astlist_index(o, startInt, stopInt);
}
final int astlist_index(PyObject o, int start, int stop) {
return _index(o, "astlist.index(x): x not in list", start, stop);
}
final int astlist_index(PyObject o, int start) {
return _index(o, "astlist.index(x): x not in list", start, size());
}
final int astlist_index(PyObject o) {
return _index(o, "astlist.index(x): x not in list", 0, size());
}
private int _index(PyObject o, String message, int start, int stop) {
// Follow Python 2.3+ behavior
int validStop = boundToSequence(stop);
int validStart = boundToSequence(start);
for(int i = validStart; i < validStop && i < size(); i++) {
if(data.get(i).equals(o)) {
return i;
}
}
throw Py.ValueError(message);
}
protected void del(int i) {
data.remove(i);
}
protected void delRange(int start, int stop, int step) {
if(step >= 1) {
for(int i = start; i < stop; i += step) {
remove(i);
i--;
stop--;
}
} else if(step < 0) {
for(int i = start; i >= 0 && i >= stop; i += step) {
remove(i);
}
}
}
@ExposedMethod
final void astlist_extend(PyObject iterable){
int length = size();
setslice(length, length, 1, iterable);
}
public void extend(PyObject iterable) {
astlist_extend(iterable);
}
protected PyObject getslice(int start, int stop, int step) {
if(step > 0 && stop < start) {
stop = start;
}
int n = sliceLength(start, stop, step);
List newList = data.subList(start, stop);
if(step == 1) {
newList = data.subList(start, stop);
return new AstList(newList, adapter);
}
int j = 0;
for(int i = start; j < n; i += step) {
newList.set(j, data.get(i));
j++;
}
return new AstList(newList, adapter);
}
public void insert(int index, PyObject o) {
astlist_insert(index, o);
}
@ExposedMethod
final void astlist_insert(int index, PyObject o) {
if(index < 0) {
index = Math.max(0, size() + index);
}
if(index > size()) {
index = size();
}
data.add(index, o);
}
@ExposedMethod
final void astlist_remove(PyObject value){
del(_index(value, "astlist.remove(x): x not in list", 0, size()));
}
public void remove(PyObject value) {
astlist_remove(value);
}
public void reverse() {
astlist_reverse();
}
@ExposedMethod
final void astlist_reverse() {
Collections.reverse(data);
}
public PyObject pop() {
return pop(-1);
}
public PyObject pop(int n) {
return astlist_pop(n);
}
@ExposedMethod(defaults = "-1")
final PyObject astlist_pop(int n) {
if (adapter == null) {
return (PyObject)data.remove(n);
}
Object element = data.remove(n);
return adapter.ast2py(element);
}
protected PyObject repeat(int count) {
if (count < 0) {
count = 0;
}
int size = size();
int newSize = size * count;
if (count != 0 && newSize / count != size) {
throw Py.MemoryError("");
}
List newList = new ArrayList();
for(int i = 0; i < count; i++) {
newList.addAll(data);
}
return new AstList(newList);
}
protected void setslice(int start, int stop, int step, PyObject value) {
if(stop < start) {
stop = start;
}
if (value instanceof PySequence) {
PySequence sequence = (PySequence) value;
setslicePySequence(start, stop, step, sequence);
} else if (value instanceof List) {
List list = (List)value.__tojava__(List.class);
if(list != null && list != Py.NoConversion) {
setsliceList(start, stop, step, list);
}
} else {
setsliceIterable(start, stop, step, value);
}
}
protected void setslicePySequence(int start, int stop, int step, PySequence value) {
if (step != 0) {
if(value == this) {
PyList newseq = new PyList();
PyObject iter = value.__iter__();
for(PyObject item = null; (item = iter.__iternext__()) != null;) {
newseq.append(item);
}
value = newseq;
}
int n = value.__len__();
for (int i = 0, j = start; i < n; i++, j += step) {
pyset(j, value.pyget(i));
}
}
}
protected void setsliceList(int start, int stop, int step, List value) {
if(step != 1) {
throw Py.TypeError("setslice with java.util.List and step != 1 not supported yet");
}
int n = value.size();
for(int i = 0; i < n; i++) {
data.add(i + start, value.get(i));
}
}
protected void setsliceIterable(int start, int stop, int step, PyObject value) {
PyObject[] seq;
try {
seq = Py.make_array(value);
} catch (PyException pye) {
if (Py.matchException(pye, Py.TypeError)) {
throw Py.TypeError("can only assign an iterable");
}
throw pye;
}
setslicePySequence(start, stop, step, new PyList(seq));
}
public void add(int index, Object element) {
data.add(index, element);
}
public boolean add(Object o) {
return data.add(o);
}
public boolean addAll(int index, Collection c) {
return data.addAll(index, c);
}
public boolean addAll(Collection c) {
return data.addAll(c);
}
public void clear() {
data.clear();
}
public boolean contains(Object o) {
return data.contains(o);
}
public boolean containsAll(Collection c) {
return data.containsAll(c);
}
public Object get(int index) {
return data.get(index);
}
public int indexOf(Object o) {
return data.indexOf(o);
}
public boolean isEmpty() {
return data.isEmpty();
}
public Iterator iterator() {
return data.iterator();
}
public int lastIndexOf(Object o) {
return data.lastIndexOf(o);
}
public ListIterator listIterator() {
return data.listIterator();
}
public ListIterator listIterator(int index) {
return data.listIterator(index);
}
public boolean pyadd(PyObject o) {
data.add(o);
return true;
}
public void pyadd(int index, PyObject element) {
data.add(index, element);
}
public PyObject pyget(int index) {
if (adapter == null) {
return (PyObject)data.get(index);
}
return adapter.ast2py(data.get(index));
}
public void pyset(int index, PyObject element) {
if (adapter == null) {
data.set(index, element);
} else {
Object o = adapter.py2ast(element);
data.set(index, o);
}
}
public Object remove(int index) {
return data.remove(index);
}
public boolean remove(Object o) {
return data.remove(o);
}
public boolean removeAll(Collection c) {
return data.removeAll(c);
}
public boolean retainAll(Collection c) {
return data.retainAll(c);
}
public Object set(int index, Object element) {
return data.set(index, element);
}
public int size() {
return data.size();
}
public List subList(int fromIndex, int toIndex) {
return data.subList(fromIndex, toIndex);
}
public Object[] toArray() {
return data.toArray();
}
public Object[] toArray(Object[] a) {
return data.toArray(a);
}
public Object __tojava__(Class c) {
if(c.isInstance(this)) {
return this;
}
return Py.NoConversion;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
e87f424b5c1fc730672a744e76c859173e822267 | 9e0be86ff09580366b4b55b0f3b9f14f379085cc | /src/main/java/com/leetcode/demo/easy/dp/MaximumProductSubarray.java | 0a987e47ea46937dace31c01510aae49aca5e3e7 | [] | no_license | apktool/Data-Structures-and-Algorithms | cccd6c52370f8c22db5effa4d70e9a707f1cc5d4 | 06ce1280300f56fb845ae1af2742722583f9d976 | refs/heads/main | 2021-11-07T20:15:35.265294 | 2021-10-13T16:00:45 | 2021-10-13T16:00:45 | 34,459,018 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,077 | java | package com.leetcode.demo.easy.dp;
/**
* 给你一个整数数组 nums ,请你找出数组中乘积最大的连续子数组(该子数组中至少包含一个数字),并返回该子数组所对应的乘积。
* <p>
* 来源:力扣(LeetCode)
* 链接:https://leetcode-cn.com/problems/maximum-product-subarray
* 著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请注明出处。
*/
public class MaximumProductSubarray {
public int solve01(int[] nums) {
int[] dpMax = new int[nums.length];
int[] dpMin = new int[nums.length];
dpMax[0] = nums[0];
dpMin[0] = nums[0];
for (int i = 1; i < nums.length; i++) {
dpMax[i] = Math.max(dpMax[i - 1] * nums[i], Math.max(nums[i], dpMin[i - 1] * nums[i]));
dpMin[i] = Math.min(dpMin[i - 1] * nums[i], Math.min(nums[i], dpMax[i - 1] * nums[i]));
}
int ans = dpMax[0];
for (int i = 0; i < dpMax.length; i++) {
ans = Math.max(ans, dpMax[i]);
}
return ans;
}
}
| [
"apktoolOo@gmail.com"
] | apktoolOo@gmail.com |
14d496b3a1dcb777a8f379a23fac7a01168b0b77 | 13d6dcb5746b9fb389fe3e826fd043bdd74d7553 | /src/gpa/FORMULA.java | 4e16f4c371daba7fdaaade3980232733ee1a7f51 | [] | no_license | HammadAshrafNawab/gpaproject | d3b8e7985e923aeba0863772fd8a7d7ac1b9034e | d71dbcfae0617ca34895dfd1fa08ca51af2af485 | refs/heads/master | 2023-01-07T02:42:20.105821 | 2020-11-02T20:25:36 | 2020-11-02T20:25:36 | 309,487,121 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,103 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package gpa;
import java.sql.ResultSet;
import net.proteanit.sql.DbUtils;
/**
*
* @author hammadashraf2083
*/
public class FORMULA extends javax.swing.JFrame {
/**
* Creates new form FORMULA
*/
public FORMULA() {
initComponents();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
table = new javax.swing.JTable();
jButton1 = new javax.swing.JButton();
jButton2 = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setText("FORMULA TABLE");
table.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
{null, null, null, null},
{null, null, null, null},
{null, null, null, null},
{null, null, null, null}
},
new String [] {
"GRADE", "RANGEHIGH", "RANGELOW", "POINTS"
}
));
jScrollPane1.setViewportView(table);
jButton1.setText("SHOW");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton2.setText("GO_TO_GPA");
jButton2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton2ActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(107, 107, 107)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jButton1)))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jButton2)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 375, javax.swing.GroupLayout.PREFERRED_SIZE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton2)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 275, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jButton1))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
DAO dao=new DAO();
ResultSet rs=dao.selectall();
table.setModel(DbUtils.resultSetToTableModel(rs)) ; // TODO add your handling code here:
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
SGPACAL obj=new SGPACAL();
obj.setVisible(true);
dispose();// TODO add your handling code here:
}//GEN-LAST:event_jButton2ActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(FORMULA.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(FORMULA.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(FORMULA.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(FORMULA.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new FORMULA().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable table;
// End of variables declaration//GEN-END:variables
}
| [
"hammadashraf@localhost"
] | hammadashraf@localhost |
e2c75b3a986628e5cf2ee02bd11d05fd6a0ad86b | 0a9240df20a8c23bc4beba70ed6b893a006649c7 | /src/main/java/com/SeventhGroup/CollegeSearchJob/service/inner/CominfoContent.java | e72b9eb842031fc4613df8eff915e8dfe0eb7ca8 | [] | no_license | Vaskka/CollegeSearchJob | fda0f44b0829142394e54faefa0c588e992bc1e4 | fe447c554d0fb243e9507690a31ce1bed328dd5a | refs/heads/master | 2022-11-17T03:24:50.897426 | 2020-06-20T10:02:06 | 2020-06-20T10:02:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 586 | java | package com.SeventhGroup.CollegeSearchJob.service.inner;
import com.SeventhGroup.CollegeSearchJob.entity.CominformationEntity;
import java.util.List;
public class CominfoContent {
List<CominformationEntity> cominformation;
public CominfoContent(List<CominformationEntity> cominformation) {
this.cominformation = cominformation;
}
public List<CominformationEntity> getCominformation() {
return cominformation;
}
public void setCominformation(List<CominformationEntity> cominformation) {
this.cominformation = cominformation;
}
}
| [
"git@github.com:LW202151/CollegeSearchJob.git"
] | git@github.com:LW202151/CollegeSearchJob.git |
0201bd9ea03589302c3f96de8660d68d335c5fe2 | ec01419a153633004a08a091d243bd63709f7956 | /appTramDocuConcytecAdvancedFD/src/tramitedoc/concytec/admin/action/AActionMantTipoDocumento.java | 775fbfe42fe6d21ad0d6fa7d10293b7a4c76ccd6 | [] | no_license | angelnoa/TramiteDoc-FD | 5c3f4b024d4421486d92e1f3eb88a2de424e9472 | e2e2d3e60886efd44d91981a674d1a358cce6aa1 | refs/heads/master | 2021-01-10T13:50:01.720613 | 2016-01-25T15:20:57 | 2016-01-25T15:20:57 | 50,359,496 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 5,014 | java | package tramitedoc.concytec.admin.action;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.Date;
import java.util.Vector;
import javax.sql.DataSource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import tramitedoc.concytec.dao.*;
import tramitedoc.concytec.admin.form.*;
import tramitedoc.concytec.bean.*;
import tramitedoc.concytec.dao.interfaces.*;
import tramitedoc.concytec.util.*;
import tramitedoc.concytec.dao.sql.*;
import java.sql.Connection;
import java.sql.SQLException;
/**
* AUTOR : Machuca Ovalle
* FECHA : 03-04-2006
* VERSION : 1.0
* DESCRIPCIÓN : Accion de Logeo
*/
public class AActionMantTipoDocumento extends ValidaSessionAction{
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
HttpSession session = request.getSession(true);
Connection cnx = getConnection(request, "principal");
System.out.println("El cnx............" + cnx);
IAdministradorDAO daoIAdministradorDAO = new SqlAdministradorDAO();
FFormMantTipoDocumento oForm = (FFormMantTipoDocumento) form;
String tipo = oForm.getTipo() == null ? "init" : oForm.getTipo().trim();
System.out.println("El tipo 1 "+ tipo);
tipo = tipo.equals("") ? "init" : tipo;
System.out.println("El tipo 2 "+ tipo);
String codigo_tipo;
String descripcion_tipo;
codigo_tipo = ((FFormMantTipoDocumento)form).getCodigo_tipo();
descripcion_tipo = ((FFormMantTipoDocumento)form).getDescripcion_tipo();
System.out.println("codigo_tipo... "+ codigo_tipo);
System.out.println("descripcion_tipo... "+ descripcion_tipo);
try {
if (tipo.equals("tipodocumento") ){
System.out.println("Si tipo es init" + tipo);
System.out.println("Listar Tipo Documento....." );
Collection listatipodoc = daoIAdministradorDAO.of_lista_tipodocumento(cnx);
System.out.println("listatipodoc" + listatipodoc);
session.setAttribute("operacion",tipo);
session.setAttribute("listatipodoc",listatipodoc);
}else if (tipo.equalsIgnoreCase("nuevo")){
//li_operacion = 2;
try {
System.out.println("Ingresando Tipo Documento .........." );
descripcion_tipo=descripcion_tipo.toUpperCase();
daoIAdministradorDAO.TipoDocumentoIng(cnx,descripcion_tipo);
Collection listatipodoc = daoIAdministradorDAO.of_lista_tipodocumento(cnx);
session.setAttribute("listatipodoc",listatipodoc);
}catch (SQLException e) {
e.printStackTrace();
closeConnection(cnx);
//return mapping.getInputForward();
}
//session.removeAttribute("operacioncs");
}else if (tipo.equalsIgnoreCase("editar")){
try {
System.out.println("Modificacion de... Tipo Documento .........." );
descripcion_tipo=descripcion_tipo.toUpperCase();
daoIAdministradorDAO.TipoDocumentoMod(cnx,codigo_tipo,descripcion_tipo);
Collection listatipodoc = daoIAdministradorDAO.of_lista_tipodocumento(cnx);
System.out.println("listatipodoc" + listatipodoc);
session.setAttribute("operacion",tipo);
session.setAttribute("listatipodoc",listatipodoc);
}catch (SQLException e) {
rollbackConnection(cnx);
e.printStackTrace();
session.setAttribute("MsjeError", "Error al actualizar al empleado: " + e.getMessage());
//closeConnection(cnx);
//return mapping.getInputForward();
}
return mapping.getInputForward();
} else if (tipo.equalsIgnoreCase("eliminar")){
try {
System.out.println("Eliminar Tipo Documento.........." );
daoIAdministradorDAO.TipoDocumentoElim(cnx,codigo_tipo);
Collection listatipodoc = daoIAdministradorDAO.of_lista_tipodocumento(cnx);
System.out.println("listatipodoc" + listatipodoc);
session.setAttribute("operacion",tipo);
session.setAttribute("listatipodoc",listatipodoc);
}catch (SQLException e) {
e.printStackTrace();
closeConnection(cnx);
//return mapping.getInputForward();
}
}
closeConnection(cnx);
oForm.reset(mapping, request);
oForm.setTipo("nuevo");
return (mapping.findForward("exito"));
}
catch (Exception e) {
e.printStackTrace();
}
return (mapping.findForward("error"));
}
}
| [
"anghelo.dj87@gmail.com"
] | anghelo.dj87@gmail.com |
2ff105d7fec528cee1f14dfb2d3ef67582e03793 | f664b02fb8d06f8c2cb82461c2b8af7649afc2ee | /JavaD3HW1/src/JavaD3HW1/CustomerManager2.java | ba45770828bd117a117ee1dcab924611595c6605 | [] | no_license | hturktan/JavaD3HW1 | addc1f3c1f7f7a46536b0f26bcba86f247cb56dd | 127d0a124a78a453927603852184f1adc1c08cce | refs/heads/master | 2023-04-16T01:52:13.695838 | 2021-04-30T15:26:19 | 2021-04-30T15:26:19 | 363,118,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 82 | java | package JavaD3HW1;
public class CustomerManager2 extends PersonManager{
}
| [
"82947367+hturktan@users.noreply.github.com"
] | 82947367+hturktan@users.noreply.github.com |
0f8a5c90feb85a88f5bd2ea46f040b39d4557ae8 | a496526e81e2eb13b60794d09560045aa082d6d6 | /app/src/main/java/com/happycomehealthy/module/register/RegisterBiz.java | 78eb50eecce29698c829f0ba851a6dc6bda662a3 | [] | no_license | Juphome/HappyComeHealthy | 1dfeeb745bfbf0e9073900e910f8430b70ad2100 | 9af42ba96d47980c07757ccfabe84fc0a842cdd3 | refs/heads/master | 2020-03-28T09:04:30.619189 | 2018-09-09T09:55:26 | 2018-09-09T09:55:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 463 | java | package com.happycomehealthy.module.register;
import com.happycomehealthy.listeners.OperationListener;
import com.happycomehealthy.module.login.LoginContact;
/**
* creator: ZZF
* careate date: 2018/5/18 09:25.
*/
public class RegisterBiz implements RegisterContact.IRegisterBiz{
@Override
public void register(String account, String password, OperationListener operationListener) {
operationListener.onDone(null);
}
}
| [
"shixinshan@ShiXinShand.local"
] | shixinshan@ShiXinShand.local |
c47867bf037f362aae867ab09393b13aaee50083 | cd4802766531a9ccf0fb54ca4b8ea4ddc15e31b5 | /java/com/l2jmobius/gameserver/model/items/enchant/EnchantScrollGroup.java | 492768eca4d931fd538f9ae3c64c70819fdf89cf | [] | no_license | singto53/underground | 8933179b0d72418f4b9dc483a8f8998ef5268e3e | 94264f5168165f0b17cc040955d4afd0ba436557 | refs/heads/master | 2021-01-13T10:30:20.094599 | 2016-12-11T20:32:47 | 2016-12-11T20:32:47 | 76,455,182 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,906 | java | /*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.items.enchant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.l2jmobius.gameserver.model.items.L2Item;
/**
* @author UnAfraid
*/
public final class EnchantScrollGroup
{
private final int _id;
private List<EnchantRateItem> _rateGroups;
public EnchantScrollGroup(int id)
{
_id = id;
}
/**
* @return id of current enchant scroll group.
*/
public int getId()
{
return _id;
}
/**
* Adds new rate group.
* @param group
*/
public void addRateGroup(EnchantRateItem group)
{
if (_rateGroups == null)
{
_rateGroups = new ArrayList<>();
}
_rateGroups.add(group);
}
/**
* @return {@code List} of all enchant rate items, Empty list if none.
*/
public List<EnchantRateItem> getRateGroups()
{
return _rateGroups != null ? _rateGroups : Collections.emptyList();
}
/**
* @param item
* @return {@link EnchantRateItem}, {@code NULL} in case non of rate items can be used with.
*/
public EnchantRateItem getRateGroup(L2Item item)
{
for (EnchantRateItem group : getRateGroups())
{
if (group.validate(item))
{
return group;
}
}
return null;
}
}
| [
"MobiusDev@7325c9f8-25fd-504a-9f63-8876acdc129b"
] | MobiusDev@7325c9f8-25fd-504a-9f63-8876acdc129b |
73c1ffd579220a1157d786a6457f4064674eecc7 | 814c955470d5f50fe7302835a10d19455e038b0f | /src/model/heroes/HeroListener.java | 7a4ece7c0304584970f61f8148141897f3f54423 | [] | no_license | alyyasser19/Milestone2 | 24492d04e5529024493c2ab9bddfb46bac5dac19 | 4d94425365da57d67afcd517ba7800960ae71aa8 | refs/heads/master | 2021-04-05T10:45:06.377621 | 2020-04-07T20:11:39 | 2020-04-07T20:11:39 | 248,545,954 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 224 | java | package model.heroes;
import exceptions.*;
public interface HeroListener {
public void onHeroDeath();
public void damageOpponent(int amount);
public void endTurn() throws FullHandException, CloneNotSupportedException;
}
| [
"alyyasser19@gmail.com"
] | alyyasser19@gmail.com |
d786ed10de189043d58e58065d40f7fe82c209e5 | 0af81249558834cfa0881585894e26b538aa40fa | /src/main/java/com/study/spring/listenner/ListennerTest2.java | 7764721e7edffedbd2471d849f43efe48ab0c11b | [] | no_license | MaxineZWS/spring-boot-study | d5833c2a805958497e2a44dd8348ac48566eba33 | dd93d932de8f2f37a5db51330ad9e5e3bb39e8a5 | refs/heads/master | 2022-03-30T01:09:06.368496 | 2019-11-11T08:17:21 | 2019-11-11T08:17:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 672 | java | package com.study.spring.listenner;
import com.study.spring.thread.ThreadTest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author liuyzh
* @description 接口形式触发异步多线程
* @date 2019-10-11
*/
@RestController
@RequestMapping("thread")
public class ListennerTest2 {
@Autowired
private ThreadTest t;
@GetMapping("dingshi")
public void run() {
for (int i = 1; i < 10; i++) {
t.ceshi2();
}
}
}
| [
"liuyongzhi95@163.com"
] | liuyongzhi95@163.com |
04aa5b5b7dd311b2376e7946a80a56c35b6ff333 | c0fef264f0adfb2561fdc88201e4430a7bf14a2f | /ProjectGeometry2/src/sk/akademiasovy/points/Triangle.java | 6f7bd87fc698a17a0ac8e77aa3f0627f16e1e960 | [] | no_license | michalnov/java | 3f52388a99833d7d94403934ae443ef253d1a7fc | e09fc09138c730574fcce9d16cf289dd7d8eb136 | refs/heads/master | 2021-05-06T05:59:21.067235 | 2018-01-23T11:08:08 | 2018-01-23T11:08:08 | 115,284,758 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,281 | java | package sk.akademiasovy.points;
public class Triangle implements InterfaceTriangle{
private Point2D pointA;
private Point2D pointB;
private Point2D pointC;
public Triangle(Point2D pointA, Point2D pointB, Point2D pointC) {
this.pointA = pointA;
this.pointB = pointB;
this.pointC = pointC;
}
public Line getSideC()
{
return new Line(this.pointA, this.pointB);
}
public Line getSideB()
{
return new Line(this.pointA, this.pointC);
}
public Line getSideA()
{
return new Line(this.pointC, this.pointB);
}
@Override
public double getPerimeter()
{
Line lineA = new Line(this.pointA, this.pointB);
Line lineB = new Line(this.pointB, this.pointC);
Line lineC = new Line(this.pointC, this.pointA);
return (lineA.getLineLenght() + lineB.getLineLenght() + lineC.getLineLenght());
}
@Override
public double getArea()
{
double s = (getPerimeter() / 2);
double area = Math.sqrt((s*(s-new Line(this.pointA, this.pointB).getLineLenght())*(s-new Line(this.pointB, this.pointC).getLineLenght())*(s-new Line(this.pointC, this.pointA).getLineLenght())));
return area;
}
@Override
public boolean isRightAngled() {
if (Math.pow(getSideA().getLineLenght(),2) + Math.pow(getSideB().getLineLenght(),2) == Math.pow(getSideC().getLineLenght(),2))
return true;
else if (Math.pow(getSideA().getLineLenght(),2) + Math.pow(getSideC().getLineLenght(),2) == Math.pow(getSideB().getLineLenght(),2))
return true;
else if (Math.pow(getSideC().getLineLenght(),2) + Math.pow(getSideB().getLineLenght(),2) == Math.pow(getSideA().getLineLenght(),2))
return true;
else
return false;
}
@Override
public boolean isEquilateral() {
return (getSideA().getLineLenght() == getSideB().getLineLenght() && getSideB().getLineLenght() == getSideC().getLineLenght());
}
@Override
public boolean isIsosceles() {
return (getSideA().getLineLenght() == getSideB().getLineLenght() || getSideA().getLineLenght() == getSideC().getLineLenght() || getSideC().getLineLenght() == getSideB().getLineLenght());
}
}
| [
"michal.novotny@akademiasovy.sk"
] | michal.novotny@akademiasovy.sk |
39bda621a856256ae3c4752719dead8b677ec170 | 6c4152a667d7c59410b330dbb4acd1eccc717a84 | /src/main/java/cn/itcast/day05/demo01/Demo03Array.java | e3fad5a0c676f7e3cb6e2d0224c493738b5465bd | [] | no_license | tiancailyb/javaBasics | 61580d3cf1acb1760f3789c7ab64a7725f17875e | 049c0c0f88a70f8f5f2f24e1d80ee998064d8e4d | refs/heads/master | 2021-01-07T17:35:09.627190 | 2020-03-10T07:21:24 | 2020-03-10T07:21:24 | 241,769,971 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 275 | java | package cn.itcast.day05.demo01;
/**
* @author lyb
* @date 2020/2/21
*/
/**
* 静态初始化省略格式
*/
public class Demo03Array {
public static void main(String[] args) {
int [] arrayA = {1, 2, 3};
System.out.println(arrayA.length);
}
}
| [
"2224615397@qq.com"
] | 2224615397@qq.com |
61dc6a20f88945e6598e0075e841c3057a0bc4d5 | 2122d24de66635b64ec2b46a7c3f6f664297edc4 | /spring/spring-boot/spring-boot-data-elasticsearch5-sample/src/main/java/com/example/lee/DemoApplication.java | cfd12c7eda453262e82e66cd6df5da69cdafa013 | [] | no_license | yiminyangguang520/Java-Learning | 8cfecc1b226ca905c4ee791300e9b025db40cc6a | 87ec6c09228f8ad3d154c96bd2a9e65c80fc4b25 | refs/heads/master | 2023-01-10T09:56:29.568765 | 2022-08-29T05:56:27 | 2022-08-29T05:56:27 | 92,575,777 | 5 | 1 | null | 2023-01-05T05:21:02 | 2017-05-27T06:16:40 | Java | UTF-8 | Java | false | false | 555 | java | package com.example.lee;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.data.elasticsearch.repository.config.EnableElasticsearchRepositories;
/**
* @author min
*/
@SpringBootApplication
@EnableElasticsearchRepositories
@ComponentScan("com.example.lee")
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
| [
"litz-a@glodon.com"
] | litz-a@glodon.com |
038da2e7e4f29557dac8cce937ce5e7668a14c99 | e4b58c0c540b6fd4e74764c40d079afdc6688992 | /src/net/shopxx/service/SensitivityService.java | ea51c70a25248e7d754d73a04cee2f7b619cc32e | [] | no_license | shenlong07412/shop | 8fcdaffd39908ce3160405059292eb0052b4689c | 6ce4bb79edc12dd253fa1ad617a45c859b6565ae | refs/heads/master | 2021-01-02T08:31:50.036226 | 2015-06-26T03:16:01 | 2015-06-26T03:16:01 | 37,038,744 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package net.shopxx.service;
import net.shopxx.entity.Sensitivity;
public interface SensitivityService extends BaseService<Sensitivity, Long>{
/**
* 替换敏感词
* @param source 要替换的字符串
* @param to 要替换成的目标字符
* @return
*/
public String replaceSensitivity(String source,String to);
}
| [
"2431497890@qq.com"
] | 2431497890@qq.com |
afa3fc55d80806c950be0265d52ebd41726ee880 | 886c0ec47a228dc25193efb3e18a23ed7f4198a8 | /spring-cloud-user-core-provider2/src/main/java/com/carsonlius/springcloudusercoreprovider2/exception/ErrorParamsException.java | e6336921f26c9fcf21df67c9e54a855529440965 | [] | no_license | carsonlius/first-spring-cloud-cluster-project | b272a884f49146970b1f28b9289d7d3ad6fcc1f6 | fcfcb931488cdeb0a79c457cb5cd4c59fe1520e5 | refs/heads/main | 2023-02-01T14:42:46.780370 | 2020-12-18T10:18:15 | 2020-12-18T10:18:15 | 318,156,415 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 200 | java | package com.carsonlius.springcloudusercoreprovider2.exception;
public class ErrorParamsException extends Exception {
public ErrorParamsException(String message) {
super(message);
}
}
| [
"liusen@huice.com"
] | liusen@huice.com |
c19fc21feb6539617a3560bed7cef2e5fad6f215 | 9a04b2482f9c9ddf5d537a074cdf32b20e3c353e | /angryships-core/src/main/java/com/gemserk/games/angryships/components/Components.java | 1881292a4df6857412edd6097adf78e2b734a9f6 | [] | no_license | jesuslopezparkour/angryships | 34fe85be6dad50c8c175404ee956d29eff432dd2 | 6c9c419ed91850a13a6ea6cadc0c14784fd160d2 | refs/heads/master | 2020-12-25T00:56:12.984681 | 2012-01-13T16:13:18 | 2012-01-13T16:13:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,223 | java | package com.gemserk.games.angryships.components;
import com.artemis.ComponentType;
import com.artemis.ComponentTypeManager;
import com.artemis.Entity;
public class Components extends com.gemserk.commons.artemis.components.Components {
public static final Class<CameraDistanceComponent> cameraDistanceComponentClass = CameraDistanceComponent.class;
public static final ComponentType cameraDistanceComponentType = ComponentTypeManager.getTypeFor(cameraDistanceComponentClass);
public static final Class<ControllerComponent> controllerComponentClass = ControllerComponent.class;
public static final ComponentType controllerComponentType = ComponentTypeManager.getTypeFor(controllerComponentClass);
public static final Class<PixmapCollidableComponent> pixmapCollidableComponentClass = PixmapCollidableComponent.class;
public static final ComponentType pixmapCollidableComponentType = ComponentTypeManager.getTypeFor(pixmapCollidableComponentClass);
public static final Class<ExplosionComponent> explosionComponentClass = ExplosionComponent.class;
public static final ComponentType explosionComponentType = ComponentTypeManager.getTypeFor(explosionComponentClass);
public static final Class<ClusterBombComponent> clusterBombComponentClass = ClusterBombComponent.class;
public static final ComponentType clusterBombComponentType = ComponentTypeManager.getTypeFor(clusterBombComponentClass);
public static ControllerComponent getControllerComponent(Entity e) {
return controllerComponentClass.cast(e.getComponent(controllerComponentType));
}
public static PixmapCollidableComponent getPixmapCollidableComponent(Entity e) {
return pixmapCollidableComponentClass.cast(e.getComponent(pixmapCollidableComponentType));
}
public static ExplosionComponent getExplosionComponent(Entity e) {
return explosionComponentClass.cast(e.getComponent(explosionComponentType));
}
public static CameraDistanceComponent getCameraDistanceComponent(Entity e) {
return cameraDistanceComponentClass.cast(e.getComponent(cameraDistanceComponentType));
}
public static ClusterBombComponent getClusterBombComponent(Entity e) {
return clusterBombComponentClass.cast(e.getComponent(clusterBombComponentType));
}
}
| [
"ariel.coppes@gemserk.com"
] | ariel.coppes@gemserk.com |
10f2c03119a726c783c6bb39f8b8c07923ccdade | 0ca64a379147f801ef598f51b6e1373d41dfe709 | /java9-jigsaw/jigsaw-api-cli-example/jigsaw-cli/src/main/java/com/rajendarreddyj/jigsaw/calculator/cli/Main.java | 913f64f8538b0d34fa70485e27b58712eddba7c6 | [
"MIT"
] | permissive | rajendarreddyj/development-java9-features | 47ab468f6bfd9c2dd69f1b9117ad7eaa7c445743 | 7aa082a1e3680c583047bc43465faee356228f99 | refs/heads/master | 2021-09-19T18:46:55.760881 | 2018-07-30T18:59:32 | 2018-07-30T18:59:32 | 121,902,277 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,406 | java | package com.rajendarreddyj.jigsaw.calculator.cli;
import com.rajendarreddyj.jigsaw.calculator.api.Algorithm;
import java.io.Console;
import java.util.HashMap;
import java.util.Map;
import java.util.ServiceLoader;
/**
* rajendarreddy.jagapathi
*/
public class Main {
private ServiceLoader<Algorithm> algorithms;
private Map<String, Algorithm> algorithmMap;
public Main() {
loadAlgorithms();
}
private void loadAlgorithms() {
algorithms = ServiceLoader.load(Algorithm.class);
algorithmMap = new HashMap<>();
algorithms.stream().forEach(al -> algorithmMap.put(al.get().getClass().getSimpleName(), al.get()));
}
public static void main(String[] args) {
new Main().launch();
}
public void launch() {
Console c = System.console();
if (c == null) {
System.err.println("No console.");
System.exit(1);
}
c.printf("Welcome to the calculator CLI. ");
Integer input1 = getValidInput(c, c.readLine("Enter your first input parameter: "));
Algorithm algorithm = getAlgorithm(c);
Integer input2 = getValidInput(c, c.readLine("Enter your second input parameter: "));
c.format("The answer is: " + algorithm.calculate(input1, input2) + "\n");
}
private Integer getValidInput(Console c, String input) {
Integer result = 0;
boolean noValidInput;
do {
try {
result = Integer.valueOf(input);
noValidInput = false;
} catch(NumberFormatException ex) {
noValidInput = true;
input = c.readLine("No valid number please try again: ");
}
} while (noValidInput);
return result;
}
private Algorithm getAlgorithm(Console c) {
final StringBuffer algorithmText = new StringBuffer("Please select which algorithm you want to use from the following list: ");
algorithmMap.keySet().stream().forEach(aln -> {
algorithmText.append(aln);
algorithmText.append(", ");
});
algorithmText.append("\n");
c.printf(algorithmText.toString());
String algorithm;
do {
algorithm = c.readLine("Select the algorithm: " );
} while(!algorithmMap.keySet().contains(algorithm));
return algorithmMap.get(algorithm);
}
}
| [
"rajendarreddyj@gmail.com"
] | rajendarreddyj@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.