blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2
values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82
values | src_encoding stringclasses 28
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 7 5.41M | extension stringclasses 11
values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
06c18f47259434add9e5da92b3fc69ee804c7cbb | 5d46c85dd07cd0f8d866300dee3d7f9ed09ff344 | /google-cloud-asset/src/main/java/com/google/cloud/asset/v1p4beta1/stub/AssetServiceStubSettings.java | 064be401ac0970e8552c81c70138df9a2c146e8f | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | richard-vu/java-asset | cb8b6ca3333d3664793b4527e03cd24d519ae959 | cb12f9cdb58234a026f54338ef8c0f060c30115e | refs/heads/master | 2023-04-25T05:58:05.247904 | 2021-05-14T02:10:25 | 2021-05-14T02:10:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,987 | java | /*
* Copyright 2021 Google LLC
*
* 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
*
* https://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.cloud.asset.v1p4beta1.stub;
import com.google.api.core.ApiFunction;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.GaxProperties;
import com.google.api.gax.core.GoogleCredentialsProvider;
import com.google.api.gax.core.InstantiatingExecutorProvider;
import com.google.api.gax.grpc.GaxGrpcProperties;
import com.google.api.gax.grpc.GrpcTransportChannel;
import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider;
import com.google.api.gax.grpc.ProtoOperationTransformers;
import com.google.api.gax.longrunning.OperationSnapshot;
import com.google.api.gax.longrunning.OperationTimedPollAlgorithm;
import com.google.api.gax.retrying.RetrySettings;
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.OperationCallSettings;
import com.google.api.gax.rpc.StatusCode;
import com.google.api.gax.rpc.StubSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
import com.google.cloud.asset.v1p4beta1.AnalyzeIamPolicyRequest;
import com.google.cloud.asset.v1p4beta1.AnalyzeIamPolicyResponse;
import com.google.cloud.asset.v1p4beta1.ExportIamPolicyAnalysisRequest;
import com.google.cloud.asset.v1p4beta1.ExportIamPolicyAnalysisResponse;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Lists;
import com.google.longrunning.Operation;
import java.io.IOException;
import java.util.List;
import javax.annotation.Generated;
import org.threeten.bp.Duration;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Settings class to configure an instance of {@link AssetServiceStub}.
*
* <p>The default instance has everything set to sensible defaults:
*
* <ul>
* <li>The default service address (cloudasset.googleapis.com) and default port (443) are used.
* <li>Credentials are acquired automatically through Application Default Credentials.
* <li>Retries are configured for idempotent methods but not for non-idempotent methods.
* </ul>
*
* <p>The builder of this class is recursive, so contained classes are themselves builders. When
* build() is called, the tree of builders is called to create the complete settings object.
*
* <p>For example, to set the total timeout of analyzeIamPolicy to 30 seconds:
*
* <pre>{@code
* AssetServiceStubSettings.Builder assetServiceSettingsBuilder =
* AssetServiceStubSettings.newBuilder();
* assetServiceSettingsBuilder
* .analyzeIamPolicySettings()
* .setRetrySettings(
* assetServiceSettingsBuilder
* .analyzeIamPolicySettings()
* .getRetrySettings()
* .toBuilder()
* .setTotalTimeout(Duration.ofSeconds(30))
* .build());
* AssetServiceStubSettings assetServiceSettings = assetServiceSettingsBuilder.build();
* }</pre>
*/
@BetaApi
@Generated("by gapic-generator-java")
public class AssetServiceStubSettings extends StubSettings<AssetServiceStubSettings> {
/** The default scopes of the service. */
private static final ImmutableList<String> DEFAULT_SERVICE_SCOPES =
ImmutableList.<String>builder().add("https://www.googleapis.com/auth/cloud-platform").build();
private final UnaryCallSettings<AnalyzeIamPolicyRequest, AnalyzeIamPolicyResponse>
analyzeIamPolicySettings;
private final UnaryCallSettings<ExportIamPolicyAnalysisRequest, Operation>
exportIamPolicyAnalysisSettings;
private final OperationCallSettings<
ExportIamPolicyAnalysisRequest,
ExportIamPolicyAnalysisResponse,
ExportIamPolicyAnalysisRequest>
exportIamPolicyAnalysisOperationSettings;
/** Returns the object with the settings used for calls to analyzeIamPolicy. */
public UnaryCallSettings<AnalyzeIamPolicyRequest, AnalyzeIamPolicyResponse>
analyzeIamPolicySettings() {
return analyzeIamPolicySettings;
}
/** Returns the object with the settings used for calls to exportIamPolicyAnalysis. */
public UnaryCallSettings<ExportIamPolicyAnalysisRequest, Operation>
exportIamPolicyAnalysisSettings() {
return exportIamPolicyAnalysisSettings;
}
/** Returns the object with the settings used for calls to exportIamPolicyAnalysis. */
public OperationCallSettings<
ExportIamPolicyAnalysisRequest,
ExportIamPolicyAnalysisResponse,
ExportIamPolicyAnalysisRequest>
exportIamPolicyAnalysisOperationSettings() {
return exportIamPolicyAnalysisOperationSettings;
}
@BetaApi("A restructuring of stub classes is planned, so this may break in the future")
public AssetServiceStub createStub() throws IOException {
if (getTransportChannelProvider()
.getTransportName()
.equals(GrpcTransportChannel.getGrpcTransportName())) {
return GrpcAssetServiceStub.create(this);
}
throw new UnsupportedOperationException(
String.format(
"Transport not supported: %s", getTransportChannelProvider().getTransportName()));
}
/** Returns a builder for the default ExecutorProvider for this service. */
public static InstantiatingExecutorProvider.Builder defaultExecutorProviderBuilder() {
return InstantiatingExecutorProvider.newBuilder();
}
/** Returns the default service endpoint. */
public static String getDefaultEndpoint() {
return "cloudasset.googleapis.com:443";
}
/** Returns the default service scopes. */
public static List<String> getDefaultServiceScopes() {
return DEFAULT_SERVICE_SCOPES;
}
/** Returns a builder for the default credentials for this service. */
public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilder() {
return GoogleCredentialsProvider.newBuilder().setScopesToApply(DEFAULT_SERVICE_SCOPES);
}
/** Returns a builder for the default ChannelProvider for this service. */
public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() {
return InstantiatingGrpcChannelProvider.newBuilder()
.setMaxInboundMessageSize(Integer.MAX_VALUE);
}
public static TransportChannelProvider defaultTransportChannelProvider() {
return defaultGrpcTransportProviderBuilder().build();
}
@BetaApi("The surface for customizing headers is not stable yet and may change in the future.")
public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() {
return ApiClientHeaderProvider.newBuilder()
.setGeneratedLibToken(
"gapic", GaxProperties.getLibraryVersion(AssetServiceStubSettings.class))
.setTransportToken(
GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion());
}
/** Returns a new builder for this class. */
public static Builder newBuilder() {
return Builder.createDefault();
}
/** Returns a new builder for this class. */
public static Builder newBuilder(ClientContext clientContext) {
return new Builder(clientContext);
}
/** Returns a builder containing all the values of this settings class. */
public Builder toBuilder() {
return new Builder(this);
}
protected AssetServiceStubSettings(Builder settingsBuilder) throws IOException {
super(settingsBuilder);
analyzeIamPolicySettings = settingsBuilder.analyzeIamPolicySettings().build();
exportIamPolicyAnalysisSettings = settingsBuilder.exportIamPolicyAnalysisSettings().build();
exportIamPolicyAnalysisOperationSettings =
settingsBuilder.exportIamPolicyAnalysisOperationSettings().build();
}
/** Builder for AssetServiceStubSettings. */
public static class Builder extends StubSettings.Builder<AssetServiceStubSettings, Builder> {
private final ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders;
private final UnaryCallSettings.Builder<AnalyzeIamPolicyRequest, AnalyzeIamPolicyResponse>
analyzeIamPolicySettings;
private final UnaryCallSettings.Builder<ExportIamPolicyAnalysisRequest, Operation>
exportIamPolicyAnalysisSettings;
private final OperationCallSettings.Builder<
ExportIamPolicyAnalysisRequest,
ExportIamPolicyAnalysisResponse,
ExportIamPolicyAnalysisRequest>
exportIamPolicyAnalysisOperationSettings;
private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>>
RETRYABLE_CODE_DEFINITIONS;
static {
ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions =
ImmutableMap.builder();
definitions.put(
"retry_policy_1_codes",
ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList(StatusCode.Code.UNAVAILABLE)));
definitions.put(
"no_retry_0_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}
private static final ImmutableMap<String, RetrySettings> RETRY_PARAM_DEFINITIONS;
static {
ImmutableMap.Builder<String, RetrySettings> definitions = ImmutableMap.builder();
RetrySettings settings = null;
settings =
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(100L))
.setRetryDelayMultiplier(1.3)
.setMaxRetryDelay(Duration.ofMillis(60000L))
.setInitialRpcTimeout(Duration.ofMillis(300000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(300000L))
.setTotalTimeout(Duration.ofMillis(300000L))
.build();
definitions.put("retry_policy_1_params", settings);
settings =
RetrySettings.newBuilder()
.setInitialRpcTimeout(Duration.ofMillis(60000L))
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ofMillis(60000L))
.setTotalTimeout(Duration.ofMillis(60000L))
.build();
definitions.put("no_retry_0_params", settings);
RETRY_PARAM_DEFINITIONS = definitions.build();
}
protected Builder() {
this(((ClientContext) null));
}
protected Builder(ClientContext clientContext) {
super(clientContext);
analyzeIamPolicySettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
exportIamPolicyAnalysisSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
exportIamPolicyAnalysisOperationSettings = OperationCallSettings.newBuilder();
unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
analyzeIamPolicySettings, exportIamPolicyAnalysisSettings);
initDefaults(this);
}
protected Builder(AssetServiceStubSettings settings) {
super(settings);
analyzeIamPolicySettings = settings.analyzeIamPolicySettings.toBuilder();
exportIamPolicyAnalysisSettings = settings.exportIamPolicyAnalysisSettings.toBuilder();
exportIamPolicyAnalysisOperationSettings =
settings.exportIamPolicyAnalysisOperationSettings.toBuilder();
unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
analyzeIamPolicySettings, exportIamPolicyAnalysisSettings);
}
private static Builder createDefault() {
Builder builder = new Builder(((ClientContext) null));
builder.setTransportChannelProvider(defaultTransportChannelProvider());
builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build());
builder.setInternalHeaderProvider(defaultApiClientHeaderProviderBuilder().build());
builder.setEndpoint(getDefaultEndpoint());
return initDefaults(builder);
}
private static Builder initDefaults(Builder builder) {
builder
.analyzeIamPolicySettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_1_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_1_params"));
builder
.exportIamPolicyAnalysisSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"));
builder
.exportIamPolicyAnalysisOperationSettings()
.setInitialCallSettings(
UnaryCallSettings
.<ExportIamPolicyAnalysisRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_0_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(
ExportIamPolicyAnalysisResponse.class))
.setMetadataTransformer(
ProtoOperationTransformers.MetadataTransformer.create(
ExportIamPolicyAnalysisRequest.class))
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(500L))
.setRetryDelayMultiplier(1.5)
.setMaxRetryDelay(Duration.ofMillis(5000L))
.setInitialRpcTimeout(Duration.ZERO)
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ZERO)
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));
return builder;
}
// NEXT_MAJOR_VER: remove 'throws Exception'.
/**
* Applies the given settings updater function to all of the unary API methods in this service.
*
* <p>Note: This method does not support applying settings to streaming methods.
*/
public Builder applyToAllUnaryMethods(
ApiFunction<UnaryCallSettings.Builder<?, ?>, Void> settingsUpdater) throws Exception {
super.applyToAllUnaryMethods(unaryMethodSettingsBuilders, settingsUpdater);
return this;
}
public ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders() {
return unaryMethodSettingsBuilders;
}
/** Returns the builder for the settings used for calls to analyzeIamPolicy. */
public UnaryCallSettings.Builder<AnalyzeIamPolicyRequest, AnalyzeIamPolicyResponse>
analyzeIamPolicySettings() {
return analyzeIamPolicySettings;
}
/** Returns the builder for the settings used for calls to exportIamPolicyAnalysis. */
public UnaryCallSettings.Builder<ExportIamPolicyAnalysisRequest, Operation>
exportIamPolicyAnalysisSettings() {
return exportIamPolicyAnalysisSettings;
}
/** Returns the builder for the settings used for calls to exportIamPolicyAnalysis. */
@BetaApi(
"The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallSettings.Builder<
ExportIamPolicyAnalysisRequest,
ExportIamPolicyAnalysisResponse,
ExportIamPolicyAnalysisRequest>
exportIamPolicyAnalysisOperationSettings() {
return exportIamPolicyAnalysisOperationSettings;
}
@Override
public AssetServiceStubSettings build() throws IOException {
return new AssetServiceStubSettings(this);
}
}
}
| [
"noreply@github.com"
] | noreply@github.com |
f85b9e94e7afe29da4858a932e15d4fa0d4ba96f | e4fbc3522688bceef74c39f63aa619bed7916248 | /src/blogDao/AboutMe.java | 0eb06723cc9de79cc9add665c8e06657596f6c97 | [] | no_license | AsukiOkikiki/13blog | 5fb0f7ef522e41ba6f7241a8294c93fc72e375c4 | d62b1bf690501eb83b3c25979ea07cfdc019c164 | refs/heads/master | 2020-03-27T23:33:30.619342 | 2018-09-04T10:49:44 | 2018-09-04T10:49:44 | 147,327,801 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 423 | java | package blogDao;
public class AboutMe {
private String text;
private String id;
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public AboutMe(String text, String id) {
this.text = text;
this.id = id;
}
public AboutMe() {
}
}
| [
"Administrator@USER-EJJO09NLUM"
] | Administrator@USER-EJJO09NLUM |
6f5525f810ee0ce7c3ace9e3e3c7e6185f20bed0 | c2e8142a9c06bc798dc4aecb161ea12e442e54e7 | /src/main/java/clase6/linkedlist/ObjetosBasicosLinkedList.java | 2d2c60efdfe18b1a565194d6aaa37c9ef5ea3646 | [] | no_license | miguelangeldg/cursos | 9b0f6337539e3a9a703093ebaa6d286af8be6faa | 62ef796746c471db3bb82abef80de9765b260889 | refs/heads/main | 2023-06-19T16:40:47.671220 | 2021-07-21T19:07:46 | 2021-07-21T19:07:46 | 385,952,262 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,062 | java | package clase6.linkedlist;
import java.util.AbstractList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
public class ObjetosBasicosLinkedList {
public static void main(String[] args) {
List<String> nombresA = new LinkedList<>();
AbstractList<String> nombresB = new LinkedList<>();
LinkedList<String> nombresC = new LinkedList<>();
nombresA.add("mariana");
nombresA.add("analia");
nombresC.add("octavio");
nombresC.add("jose");
nombresC.add("jose");
nombresB.addAll(nombresA);
nombresB.addAll(nombresC);
System.out.println(nombresB.contains("sabriana"));
System.out.println(nombresA.equals(nombresC));
nombresB.remove("mariana");
nombresB.removeAll(nombresA);
System.out.println(nombresB.size());
Object[] objetos = nombresB.toArray();
for (Object o : objetos) {
System.out.println(o);
}
Iterator<String> it = nombresB.iterator();
while (it.hasNext()) {
System.out.println(it.next());
}
nombresB.clear();
System.out.println(nombresB.isEmpty());
if (nombresB.isEmpty()) {
nombresB.addAll(nombresA);
nombresB.addAll(nombresC);
}
System.out.println("ArrayList con Metodos de List y AbstractList");
nombresB.add(1, "lautaro");
for (int i = 0; i < nombresB.size(); i++) {
System.out.println(nombresB.get(i));
}
nombresB.set(0, "ariel");
System.out.println(nombresB.remove(2));
System.out.println(nombresB.indexOf("jose"));
System.out.println(nombresB.lastIndexOf("jose"));
List<String> subLista = nombresB.subList(1, 3);
ListIterator<String> iteradorLista = subLista.listIterator();
while (iteradorLista.hasNext()) {
String nombre = iteradorLista.next();
if (nombre.equals("lautaro")) {
iteradorLista.remove();
}
if (nombre.equals("octavio")) {
iteradorLista.set("fabian");
}
}
while (iteradorLista.hasPrevious()) {
String nombre = iteradorLista.previous();
if (nombre.equals("fabian")) {
iteradorLista.add("laura");
}
}
}
}
| [
"dgmiguelangel@gmail.com"
] | dgmiguelangel@gmail.com |
6d74e0212b4e43c1ab6b96c1fe6b107070ab604a | 96f6cc327581521b4e400a85a31f3cde1625e24b | /eureka_consumer/src/main/java/com/cloud/start/BootApplication.java | 28956caa8f01d3007904765e5869e27953b78aa1 | [] | no_license | funliangiii/spring-cloud-git-demo | 3b5ab8bfbd11abdf3e68a66149724a2ade0fa341 | d3b7599ce68d12c0170926d053887664548f202a | refs/heads/master | 2020-11-28T17:50:05.764889 | 2020-06-11T02:55:12 | 2020-06-11T02:55:12 | 229,885,306 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 649 | java | package com.cloud.start;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication
public class BootApplication {
public static void main(String[] args){
SpringApplication.run(BootApplication.class,args);
}
//使用RestTemplate对服务提供者发请求
@LoadBalanced()
@Bean()
public RestTemplate restTemplate(){
return new RestTemplate();
}
}
| [
"justdoitliang@foxmail.com"
] | justdoitliang@foxmail.com |
651cc4c3722d129c599a4d8830bc4e7660eb9415 | acb632c03d6f42c44bb2325c85dafa9a67a06bcf | /DetailActivity.java | 94b818fc26ade46803159ef0308513520091f474 | [] | no_license | kkh610/ALl | 323c8b028b88546e89ff954087705d1f990741d9 | 06fb9f54156e82ae606ef6be7974b92c09c8116b | refs/heads/master | 2020-09-17T00:33:00.590221 | 2019-11-25T11:35:31 | 2019-11-25T11:35:31 | 223,933,431 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,758 | java | package halla.icsw.kkhproject11_18;
import android.content.Intent;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.os.Bundle;
import android.speech.tts.TextToSpeech;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import java.util.Locale;
public class DetailActivity extends AppCompatActivity implements TextToSpeech.OnInitListener, SensorEventListener {
private Intent intent;
private TextView textView;
private TextView textView2;
//센서
SensorManager m; Sensor s;
//센서 x,y,z축
private float angle;
private float pitch;
private float roll;
String read;
TextToSpeech tts;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
textView = findViewById(R.id.textView);
textView2 = findViewById(R.id.textView2);
tts = new TextToSpeech(this, this);
// MainActivity에서 보낸 imgRes를 받기위해 getIntent()로 초기화
intent = getIntent();
// "imgRes" key로 받은 값은 int 형이기 때문에 getIntExtra(key, defaultValue);
// 받는 값이 String 형이면 getStringExtra(key);
textView.setText(intent.getStringExtra("titleRes"));
Toast.makeText(getApplicationContext(),"저작권으로 인해 일부분 미리듣기입니다.",Toast.LENGTH_LONG).show();
//센서 코드
m = (SensorManager) getSystemService(SENSOR_SERVICE);
s = m.getDefaultSensor(Sensor.TYPE_ORIENTATION);
if(s==null) {
Toast.makeText(this,"방향센서 없음-> 프로그램 종료",Toast.LENGTH_LONG).show();
finish();
}
m.registerListener(this, s, SensorManager.SENSOR_DELAY_UI);
//tts
String str = intent.getStringExtra("titleRes");
if (textView.toString() != null) {
if (str.equals("모든 순간이 너였다.")) {
textView2.setText("\n동화 같은 사랑\n\n결국 연애라는 건 추구하는 연애와 가치관이 비슷한 사람끼리 해야한다.\n" +
"누구나 동화 같은 사랑 속의 주인공을 꿈꾸지만 서로 자신이 생각하는 스토리가 옳다고 우기다 보면\n" +
"필히 한쪽은 악당이 되고야 말테니까.");
} else if (str.equals("아무것도 아닌 지금은 없다")) {
textView2.setText("앞이 깜깜하고 앞이 보이지 않을 때가 있죠.\n\n" +
"오늘이 그랬나요.\n\n" +
"그랬다면 당신은 대단한 거에요.\n\n" +
"그 힘든 하루를 또 참아냈으니까");
} else if (str.equals("말그릇")) {
textView2.setText("내게는 만나면 힐링이 되는 사람이 있다.\n" +
"상대를 보며 내 처지를 비관하지도 않고\n" +
"위안 삼지도 않게 되는\n" +
"온전히 마음으로 만나게 되는 사람.\n" +
"그래서 빡빡한 내 삶에 용기를 주고\n" +
"다시 열심히 살아보자고 다잡게 해주는 사람\n" +
"특별히 내게 충고나 조언을 하지 않는데도\n" +
"그냥 수다만으로도 마음이 편해지는 사람");
} else if (str.equals("어른아이로 산다는 것")) {
textView2.setText("이전에 느끼지 못했던 것들을 새롭게 느끼고.\n" +
"사소한 것들의 소중한 의미를 깨우쳐가면서 우리는\n" +
"조금씩 어른이 되어가고 있는 게 아닐까.");
}
}
tts.speak(textView2.getText().toString(), TextToSpeech.QUEUE_FLUSH, null);
}
@Override
public void onSensorChanged(SensorEvent event) {
if (event.sensor.getType() == Sensor.TYPE_ORIENTATION) {
angle = event.values[0];
pitch = event.values[1]; // y축에 적용되는 힘
roll = event.values[2]; // z축에 적용되는 힘
if (pitch >= -160 && pitch <= -90 || pitch >= 90 && pitch <= 160 || roll == 0) {
tts.stop();
}
}
else {
speak(textView2.getText().toString());
}
}
@Override
public void onDestroy() {
super.onDestroy();
// Stop the Bluetooth chat services
if (tts != null) tts.shutdown();
}
public void speak(String str){
tts.speak(textView2.getText().toString(), TextToSpeech.QUEUE_FLUSH, null);
}
@Override
public void onInit(int status) {
if (status == TextToSpeech.SUCCESS)
{
Locale locale = Locale.getDefault();
if(tts.isLanguageAvailable(locale)>=TextToSpeech.LANG_AVAILABLE)
tts.setLanguage(locale);
else
Toast.makeText(this, "지원하지 않는 오류", Toast.LENGTH_SHORT).show();
}
else if (status == TextToSpeech.ERROR) {
Toast.makeText(this, "음성 합성 초기화 오류", Toast.LENGTH_SHORT).show();
}
speak(textView2.getText().toString());
}
@Override
public void onAccuracyChanged(Sensor sensor, int i) {
}
}
| [
"noreply@github.com"
] | noreply@github.com |
805ffaa372c417d8ce70491e6be15167cf4f9bc3 | 2c111223ea96cd6d94bf32b0f34fc8198b002825 | /src/inaction/generator/SequenceGenerator.java | 1f27a089d0edb19da40ff72fb8d5a71e4b472dee | [] | no_license | daybreaksnow/hibernateSample | 8dabb58fee0d2d6667ece48e030b5ebceee1a872 | d5e4d449ef4f7a09b8b6808fa771b9bf64fed532 | refs/heads/master | 2021-01-25T05:35:26.353898 | 2013-04-17T09:36:34 | 2013-04-17T09:36:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 846 | java | package inaction.generator;
// Generated 2013/01/14 1:11:15 by Hibernate Tools 3.4.0.CR1
/**
* SequenceGenerator generated by hbm2java
*/
public class SequenceGenerator implements java.io.Serializable {
private long id;
private Long version;
private String value;
public SequenceGenerator() {
}
public SequenceGenerator(long id) {
this.id = id;
}
public SequenceGenerator(long id, String value) {
this.id = id;
this.value = value;
}
public long getId() {
return this.id;
}
public void setId(long id) {
this.id = id;
}
public Long getVersion() {
return this.version;
}
public void setVersion(Long version) {
this.version = version;
}
public String getValue() {
return this.value;
}
public void setValue(String value) {
this.value = value;
}
}
| [
"daybreaksnow@gmail.com"
] | daybreaksnow@gmail.com |
9024048692305ebd80e0a9f127351eb29c8f8ceb | 065c1f648e8dd061a20147ff9c0dbb6b5bc8b9be | /eclipseswt_cluster/12168/tar_1.java | e397365b974075fe1678e13884898e4114e7545a | [] | 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 | 90,731 | java | /*******************************************************************************
* Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.swt.widgets;
import org.eclipse.swt.*;
import org.eclipse.swt.internal.*;
import org.eclipse.swt.internal.gtk.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.events.*;
/**
* Instances of this class implement a selectable user interface
* object that displays a list of images and strings and issue
* notificiation when selected.
* <p>
* The item children that may be added to instances of this class
* must be of type <code>TableItem</code>.
* </p><p>
* Note that although this class is a subclass of <code>Composite</code>,
* it does not make sense to add <code>Control</code> children to it,
* or set a layout on it.
* </p><p>
* <dl>
* <dt><b>Styles:</b></dt>
* <dd>SINGLE, MULTI, CHECK, FULL_SELECTION, HIDE_SELECTION, VIRTUAL</dd>
* <dt><b>Events:</b></dt>
* <dd>Selection, DefaultSelection</dd>
* </dl>
* <p>
* Note: Only one of the styles SINGLE, and MULTI may be specified.
* </p><p>
* IMPORTANT: This class is <em>not</em> intended to be subclassed.
* </p>
*/
public class Table extends Composite {
int /*long*/ modelHandle, checkRenderer;
int itemCount, columnCount, lastIndexOf, lastDataIndex = -1;
int /*long*/ ignoreTextCell, ignorePixbufCell;
TableItem [] items;
TableColumn [] columns;
ImageList imageList;
boolean firstCustomDraw;
static final int CHECKED_COLUMN = 0;
static final int GRAYED_COLUMN = 1;
static final int FOREGROUND_COLUMN = 2;
static final int BACKGROUND_COLUMN = 3;
static final int FONT_COLUMN = 4;
static final int FIRST_COLUMN = FONT_COLUMN + 1;
static final int CELL_PIXBUF = 0;
static final int CELL_TEXT = 1;
static final int CELL_FOREGROUND = 2;
static final int CELL_BACKGROUND = 3;
static final int CELL_FONT = 4;
static final int CELL_TYPES = CELL_FONT + 1;
/**
* Constructs a new instance of this class given its parent
* and a style value describing its behavior and appearance.
* <p>
* The style value is either one of the style constants defined in
* class <code>SWT</code> which is applicable to instances of this
* class, or must be built by <em>bitwise OR</em>'ing together
* (that is, using the <code>int</code> "|" operator) two or more
* of those <code>SWT</code> style constants. The class description
* lists the style constants that are applicable to the class.
* Style bits are also inherited from superclasses.
* </p>
*
* @param parent a composite control which will be the parent of the new instance (cannot be null)
* @param style the style of control to construct
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the parent is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent</li>
* <li>ERROR_INVALID_SUBCLASS - if this class is not an allowed subclass</li>
* </ul>
*
* @see SWT#SINGLE
* @see SWT#MULTI
* @see SWT#CHECK
* @see SWT#FULL_SELECTION
* @see SWT#HIDE_SELECTION
* @see Widget#checkSubclass
* @see Widget#getStyle
*/
public Table (Composite parent, int style) {
super (parent, checkStyle (style));
}
TableItem _getItem (int index) {
if (items [index] != null) return items [index];
return items [index] = new TableItem (this, SWT.NONE, index, false);
}
static int checkStyle (int style) {
/*
* To be compatible with Windows, force the H_SCROLL
* and V_SCROLL style bits. On Windows, it is not
* possible to create a table without scroll bars.
*/
style |= SWT.H_SCROLL | SWT.V_SCROLL;
return checkBits (style, SWT.SINGLE, SWT.MULTI, 0, 0, 0, 0);
}
boolean checkData (TableItem item) {
if (item.cached) return true;
if ((style & SWT.VIRTUAL) != 0) {
item.cached = true;
Event event = new Event ();
event.item = item;
int mask = OS.G_SIGNAL_MATCH_DATA | OS.G_SIGNAL_MATCH_ID;
int signal_id = OS.g_signal_lookup (OS.row_changed, OS.gtk_tree_model_get_type ());
OS.g_signal_handlers_block_matched (modelHandle, mask, signal_id, 0, 0, 0, handle);
sendEvent (SWT.SetData, event);
//widget could be disposed at this point
if (isDisposed ()) return false;
OS.g_signal_handlers_unblock_matched (modelHandle, mask, signal_id, 0, 0, 0, handle);
if (item.isDisposed ()) return false;
}
return true;
}
protected void checkSubclass () {
if (!isValidSubclass ()) error (SWT.ERROR_INVALID_SUBCLASS);
}
/**
* Adds the listener to the collection of listeners who will
* be notified when the receiver's selection changes, by sending
* it one of the messages defined in the <code>SelectionListener</code>
* interface.
* <p>
* When <code>widgetSelected</code> is called, the item field of the event object is valid.
* If the reciever has <code>SWT.CHECK</code> style set and the check selection changes,
* the event object detail field contains the value <code>SWT.CHECK</code>.
* <code>widgetDefaultSelected</code> is typically called when an item is double-clicked.
* The item field of the event object is valid for default selection, but the detail field is not used.
* </p>
*
* @param listener the listener which should be notified
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see SelectionListener
* @see #removeSelectionListener
* @see SelectionEvent
*/
public void addSelectionListener (SelectionListener listener) {
checkWidget();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
TypedListener typedListener = new TypedListener (listener);
addListener (SWT.Selection,typedListener);
addListener (SWT.DefaultSelection,typedListener);
}
int calculateWidth (int /*long*/ column, int /*long*/ iter) {
OS.gtk_tree_view_column_cell_set_cell_data (column, modelHandle, iter, false, false);
int [] width = new int [1];
OS.gtk_tree_view_column_cell_get_size (column, null, null, null, width, null);
return width [0];
}
public Point computeSize (int wHint, int hHint, boolean changed) {
checkWidget ();
if (wHint != SWT.DEFAULT && wHint < 0) wHint = 0;
if (hHint != SWT.DEFAULT && hHint < 0) hHint = 0;
Point size = computeNativeSize (handle, wHint, hHint, changed);
Rectangle trim = computeTrim (0, 0, size.x, size.y);
size.x = trim.width;
size.y = trim.height;
return size;
}
/**
* Clears the item at the given zero-relative index in the receiver.
* The text, icon and other attribues of the item are set to the default
* value. If the table was created with the SWT.VIRTUAL style, these
* attributes are requested again as needed.
*
* @param index the index of the item to clear
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see SWT#VIRTUAL
* @see SWT#SetData
*
* @since 3.0
*/
public void clear (int index) {
checkWidget ();
if (!(0 <= index && index < itemCount)) {
error(SWT.ERROR_INVALID_RANGE);
}
TableItem item = items [index];
if (item != null) item.clear();
}
/**
* Removes the items from the receiver which are between the given
* zero-relative start and end indices (inclusive). The text, icon
* and other attribues of the items are set to their default values.
* If the table was created with the SWT.VIRTUAL style, these attributes
* are requested again as needed.
*
* @param start the start index of the item to clear
* @param end the end index of the item to clear
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see SWT#VIRTUAL
* @see SWT.SetData
*
* @since 3.0
*/
public void clear (int start, int end) {
checkWidget ();
if (start > end) return;
if (!(0 <= start && start <= end && end < itemCount)) {
error (SWT.ERROR_INVALID_RANGE);
}
if (start == 0 && end == itemCount - 1) {
clearAll();
} else {
for (int i=start; i<=end; i++) {
TableItem item = items [i];
if (item != null) item.clear();
}
}
}
/**
* Clears the items at the given zero-relative indices in the receiver.
* The text, icon and other attribues of the items are set to their default
* values. If the table was created with the SWT.VIRTUAL style, these
* attributes are requested again as needed.
*
* @param indices the array of indices of the items
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
* <li>ERROR_NULL_ARGUMENT - if the indices array is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see SWT#VIRTUAL
* @see SWT.SetData
*
* @since 3.0
*/
public void clear (int [] indices) {
checkWidget ();
if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
if (indices.length == 0) return;
for (int i=0; i<indices.length; i++) {
if (!(0 <= indices [i] && indices [i] < itemCount)) {
error (SWT.ERROR_INVALID_RANGE);
}
}
for (int i=0; i<indices.length; i++) {
TableItem item = items [indices [i]];
if (item != null) item.clear();
}
}
/**
* Clears all the items in the receiver. The text, icon and other
* attribues of the items are set to their default values. If the
* table was created with the SWT.VIRTUAL style, these attributes
* are requested again as needed.
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see SWT#VIRTUAL
* @see SWT.SetData
*
* @since 3.0
*/
public void clearAll () {
checkWidget ();
for (int i=0; i<itemCount; i++) {
TableItem item = items [i];
if (item != null) item.clear();
}
}
void createColumn (TableColumn column, int index) {
int modelIndex = FIRST_COLUMN;
if (columnCount != 0) {
int modelLength = OS.gtk_tree_model_get_n_columns (modelHandle);
boolean [] usedColumns = new boolean [modelLength];
for (int i=0; i<columnCount; i++) {
int columnIndex = columns [i].modelIndex;
for (int j = 0; j < CELL_TYPES; j++) {
usedColumns [columnIndex + j] = true;
}
}
while (modelIndex < modelLength) {
if (!usedColumns [modelIndex]) break;
modelIndex++;
}
if (modelIndex == modelLength) {
int /*long*/ oldModel = modelHandle;
int /*long*/[] types = getColumnTypes (columnCount + 4); // grow by 4 rows at a time
int /*long*/ newModel = OS.gtk_list_store_newv (types.length, types);
if (newModel == 0) error (SWT.ERROR_NO_HANDLES);
int /*long*/ [] ptr = new int /*long*/ [1];
for (int i=0; i<itemCount; i++) {
int /*long*/ newItem = OS.g_malloc (OS.GtkTreeIter_sizeof ());
if (newItem == 0) error (SWT.ERROR_NO_HANDLES);
OS.gtk_list_store_append (newModel, newItem);
TableItem item = items [i];
if (item != null) {
int /*long*/ oldItem = item.handle;
for (int j=0; j<modelLength; j++) {
OS.gtk_tree_model_get (oldModel, oldItem, j, ptr, -1);
OS.gtk_list_store_set (newModel, newItem, j, ptr [0], -1);
if (types [j] == OS.G_TYPE_STRING ()) OS.g_free ((ptr [0]));
}
OS.gtk_list_store_remove (oldModel, oldItem);
OS.g_free (oldItem);
item.handle = newItem;
} else {
OS.g_free (newItem);
}
}
OS.gtk_tree_view_set_model (handle, newModel);
OS.g_object_unref (oldModel);
modelHandle = newModel;
}
}
int /*long*/ columnHandle = OS.gtk_tree_view_column_new ();
if (columnHandle == 0) error (SWT.ERROR_NO_HANDLES);
if (index == 0 && columnCount > 0) {
TableColumn checkColumn = columns [0];
createRenderers (checkColumn.handle, checkColumn.modelIndex, false, checkColumn.style);
}
createRenderers (columnHandle, modelIndex, index == 0, column == null ? 0 : column.style);
if ((style & SWT.VIRTUAL) == 0 && columnCount == 0) {
OS.gtk_tree_view_column_set_sizing (columnHandle, OS.GTK_TREE_VIEW_COLUMN_AUTOSIZE);
} else {
OS.gtk_tree_view_column_set_sizing (columnHandle, OS.GTK_TREE_VIEW_COLUMN_FIXED);
OS.gtk_tree_view_column_set_fixed_width (columnHandle, 10);
}
OS.gtk_tree_view_column_set_resizable (columnHandle, true);
OS.gtk_tree_view_column_set_clickable (columnHandle, true);
OS.gtk_tree_view_insert_column (handle, columnHandle, index);
if (column != null) {
column.handle = columnHandle;
column.modelIndex = modelIndex;
}
}
void createHandle (int index) {
state |= HANDLE;
fixedHandle = OS.g_object_new (display.gtk_fixed_get_type (), 0);
if (fixedHandle == 0) error (SWT.ERROR_NO_HANDLES);
OS.gtk_fixed_set_has_window (fixedHandle, true);
scrolledHandle = OS.gtk_scrolled_window_new (0, 0);
if (scrolledHandle == 0) error (SWT.ERROR_NO_HANDLES);
int /*long*/ [] types = getColumnTypes (1);
modelHandle = OS.gtk_list_store_newv (types.length, types);
if (modelHandle == 0) error (SWT.ERROR_NO_HANDLES);
handle = OS.gtk_tree_view_new_with_model (modelHandle);
if (handle == 0) error (SWT.ERROR_NO_HANDLES);
if ((style & SWT.CHECK) != 0) {
checkRenderer = OS.gtk_cell_renderer_toggle_new ();
if (checkRenderer == 0) error (SWT.ERROR_NO_HANDLES);
OS.g_object_ref (checkRenderer);
}
createColumn (null, 0);
OS.gtk_container_add (fixedHandle, scrolledHandle);
OS.gtk_container_add (scrolledHandle, handle);
int mode = (style & SWT.MULTI) != 0 ? OS.GTK_SELECTION_MULTIPLE : OS.GTK_SELECTION_BROWSE;
int /*long*/ selectionHandle = OS.gtk_tree_view_get_selection (handle);
OS.gtk_tree_selection_set_mode (selectionHandle, mode);
OS.gtk_tree_view_set_headers_visible (handle, false);
int hsp = (style & SWT.H_SCROLL) != 0 ? OS.GTK_POLICY_AUTOMATIC : OS.GTK_POLICY_NEVER;
int vsp = (style & SWT.V_SCROLL) != 0 ? OS.GTK_POLICY_AUTOMATIC : OS.GTK_POLICY_NEVER;
OS.gtk_scrolled_window_set_policy (scrolledHandle, hsp, vsp);
if ((style & SWT.BORDER) != 0) OS.gtk_scrolled_window_set_shadow_type (scrolledHandle, OS.GTK_SHADOW_ETCHED_IN);
if ((style & SWT.VIRTUAL) != 0) {
/*
* Feature in GTK. The fixed_height_mode property only exists in GTK 2.3.2 and greater.
*/
if (OS.GTK_VERSION >= OS.VERSION (2, 3, 2)) {
OS.g_object_set (handle, OS.fixed_height_mode, true, 0);
}
}
}
void createItem (TableColumn column, int index) {
if (!(0 <= index && index <= columnCount)) error (SWT.ERROR_INVALID_RANGE);
if (columnCount == 0) {
column.handle = OS.gtk_tree_view_get_column (handle, 0);
OS.gtk_tree_view_column_set_sizing (column.handle, OS.GTK_TREE_VIEW_COLUMN_FIXED);
OS.gtk_tree_view_column_set_fixed_width (column.handle, 10);
column.modelIndex = FIRST_COLUMN;
createRenderers (column.handle, column.modelIndex, true, column.style);
column.customDraw = firstCustomDraw;
firstCustomDraw = false;
} else {
createColumn (column, index);
}
int /*long*/ boxHandle = OS.gtk_hbox_new (false, 3);
if (boxHandle == 0) error (SWT.ERROR_NO_HANDLES);
int /*long*/ labelHandle = OS.gtk_label_new_with_mnemonic (null);
if (labelHandle == 0) error (SWT.ERROR_NO_HANDLES);
int /*long*/ imageHandle = OS.gtk_image_new ();
if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES);
OS.gtk_container_add (boxHandle, imageHandle);
OS.gtk_container_add (boxHandle, labelHandle);
OS.gtk_widget_show (boxHandle);
OS.gtk_widget_show (labelHandle);
column.labelHandle = labelHandle;
column.imageHandle = imageHandle;
OS.gtk_tree_view_column_set_widget (column.handle, boxHandle);
int /*long*/ widget = OS.gtk_widget_get_parent (boxHandle);
while (widget != handle) {
if (OS.GTK_IS_BUTTON (widget)) {
column.buttonHandle = widget;
break;
}
widget = OS.gtk_widget_get_parent (widget);
}
if (columnCount == columns.length) {
TableColumn [] newColumns = new TableColumn [columns.length + 4];
System.arraycopy (columns, 0, newColumns, 0, columns.length);
columns = newColumns;
}
System.arraycopy (columns, index, columns, index + 1, columnCount++ - index);
columns [index] = column;
column.setFontDescription (getFontDescription ());
if (columnCount >= 1) {
for (int i=0; i<itemCount; i++) {
TableItem item = items [i];
if (item != null) {
Font [] cellFont = item.cellFont;
if (cellFont != null) {
Font [] temp = new Font [columnCount];
System.arraycopy (cellFont, 0, temp, 0, index);
System.arraycopy (cellFont, index, temp, index+1, columnCount-index-1);
item.cellFont = temp;
}
}
}
}
}
void createItem (TableItem item, int index) {
if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_INVALID_RANGE);
if (itemCount == items.length) {
int length = drawCount == 0 ? items.length + 4 : Math.max (4, items.length * 3 / 2);
TableItem [] newItems = new TableItem [length];
System.arraycopy (items, 0, newItems, 0, items.length);
items = newItems;
}
item.handle = OS.g_malloc (OS.GtkTreeIter_sizeof ());
if (item.handle == 0) error (SWT.ERROR_NO_HANDLES);
if (index == itemCount) {
OS.gtk_list_store_append (modelHandle, item.handle);
} else {
OS.gtk_list_store_insert (modelHandle, item.handle, index);
}
System.arraycopy (items, index, items, index + 1, itemCount++ - index);
items [index] = item;
}
void createRenderers (int /*long*/ columnHandle, int modelIndex, boolean check, int columnStyle) {
OS.gtk_tree_view_column_clear (columnHandle);
if ((style & SWT.CHECK) != 0 && check) {
OS.gtk_tree_view_column_pack_start (columnHandle, checkRenderer, false);
OS.gtk_tree_view_column_add_attribute (columnHandle, checkRenderer, OS.active, CHECKED_COLUMN);
/*
* Feature in GTK. The inconsistent property only exists in GTK 2.2.x.
*/
if (OS.GTK_VERSION >= OS.VERSION (2, 2, 0)) {
OS.gtk_tree_view_column_add_attribute (columnHandle, checkRenderer, OS.inconsistent, GRAYED_COLUMN);
}
/*
* Bug in GTK. GTK renders the background on top of the checkbox.
* This only happens in version 2.2.1 and earlier. The fix is not to set the background.
*/
if (OS.GTK_VERSION > OS.VERSION (2, 2, 1)) {
OS.gtk_tree_view_column_add_attribute (columnHandle, checkRenderer, OS.cell_background_gdk, BACKGROUND_COLUMN);
}
}
int /*long*/ pixbufRenderer = OS.gtk_cell_renderer_pixbuf_new ();
if (pixbufRenderer == 0) error (SWT.ERROR_NO_HANDLES);
int /*long*/ textRenderer = OS.gtk_cell_renderer_text_new ();
if (textRenderer == 0) error (SWT.ERROR_NO_HANDLES);
/*
* Feature in GTK. When a tree view column contains only one activatable
* cell renderer such as a toggle renderer, mouse clicks anywhere in a cell
* activate that renderer. The workaround is to set a second cell renderer
* to be activatable.
*/
if ((style & SWT.CHECK) != 0 && check) {
OS.g_object_set (pixbufRenderer, OS.mode, OS.GTK_CELL_RENDERER_MODE_ACTIVATABLE, 0);
}
/* Set alignment */
if ((columnStyle & SWT.RIGHT) != 0) {
OS.g_object_set (textRenderer, OS.xalign, 1f, 0);
OS.gtk_tree_view_column_pack_start (columnHandle, pixbufRenderer, false);
OS.gtk_tree_view_column_pack_start (columnHandle, textRenderer, true);
OS.gtk_tree_view_column_set_alignment (columnHandle, 1f);
} else if ((columnStyle & SWT.CENTER) != 0) {
OS.g_object_set (textRenderer, OS.xalign, 0.5f, 0);
OS.gtk_tree_view_column_pack_start (columnHandle, pixbufRenderer, false);
OS.gtk_tree_view_column_pack_end (columnHandle, textRenderer, true);
OS.gtk_tree_view_column_set_alignment (columnHandle, 0.5f);
} else {
OS.gtk_tree_view_column_pack_start (columnHandle, pixbufRenderer, false);
OS.gtk_tree_view_column_pack_start (columnHandle, textRenderer, true);
OS.gtk_tree_view_column_set_alignment (columnHandle, 0f);
}
/* Add attributes */
OS.gtk_tree_view_column_add_attribute (columnHandle, pixbufRenderer, OS.pixbuf, modelIndex + CELL_PIXBUF);
/*
* Bug on GTK. Gtk renders the background on top of the pixbuf.
* This only happens in version 2.2.1 and earlier. The fix is not to set the background.
*/
if (OS.GTK_VERSION > OS.VERSION (2, 2, 1)) {
OS.gtk_tree_view_column_add_attribute (columnHandle, pixbufRenderer, OS.cell_background_gdk, BACKGROUND_COLUMN);
OS.gtk_tree_view_column_add_attribute (columnHandle, textRenderer, OS.background_gdk, BACKGROUND_COLUMN);
}
OS.gtk_tree_view_column_add_attribute (columnHandle, textRenderer, OS.text, modelIndex + CELL_TEXT);
OS.gtk_tree_view_column_add_attribute (columnHandle, textRenderer, OS.foreground_gdk, FOREGROUND_COLUMN);
OS.gtk_tree_view_column_add_attribute (columnHandle, textRenderer, OS.font_desc, FONT_COLUMN);
boolean customDraw = firstCustomDraw;
if (columnCount != 0) {
for (int i=0; i<columnCount; i++) {
if (columns [i].handle == columnHandle) {
customDraw = columns [i].customDraw;
break;
}
}
}
if ((style & SWT.VIRTUAL) != 0 || customDraw) {
OS.gtk_tree_view_column_set_cell_data_func (columnHandle, textRenderer, display.textCellDataProc, handle, 0);
OS.gtk_tree_view_column_set_cell_data_func (columnHandle, pixbufRenderer, display.pixbufCellDataProc, handle, 0);
}
}
void createWidget (int index) {
super.createWidget (index);
items = new TableItem [4];
columns = new TableColumn [4];
itemCount = columnCount = 0;
}
GdkColor defaultBackground () {
return display.COLOR_LIST_BACKGROUND;
}
GdkColor defaultForeground () {
return display.COLOR_LIST_FOREGROUND;
}
void deregister() {
super.deregister ();
display.removeWidget (OS.gtk_tree_view_get_selection (handle));
if (checkRenderer != 0) display.removeWidget (checkRenderer);
}
/**
* Deselects the item at the given zero-relative index in the receiver.
* If the item at the index was already deselected, it remains
* deselected. Indices that are out of range are ignored.
*
* @param index the index of the item to deselect
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void deselect (int index) {
checkWidget();
if (index < 0 || index >= itemCount) return;
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.gtk_tree_selection_unselect_iter (selection, _getItem (index).handle);
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
}
/**
* Deselects the items at the given zero-relative indices in the receiver.
* If the item at the given zero-relative index in the receiver
* is selected, it is deselected. If the item at the index
* was not selected, it remains deselected. The range of the
* indices is inclusive. Indices that are out of range are ignored.
*
* @param start the start index of the items to deselect
* @param end the end index of the items to deselect
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void deselect (int start, int end) {
checkWidget();
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
for (int index=start; index<=end; index++) {
if (index < 0 || index >= itemCount) continue;
OS.gtk_tree_selection_unselect_iter (selection, _getItem (index).handle);
}
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
}
/**
* Deselects the items at the given zero-relative indices in the receiver.
* If the item at the given zero-relative index in the receiver
* is selected, it is deselected. If the item at the index
* was not selected, it remains deselected. Indices that are out
* of range and duplicate indices are ignored.
*
* @param indices the array of indices for the items to deselect
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the set of indices is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void deselect (int [] indices) {
checkWidget();
if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
for (int i=0; i<indices.length; i++) {
int index = indices[i];
if (index < 0 || index >= itemCount) continue;
OS.gtk_tree_selection_unselect_iter (selection, _getItem (index).handle);
}
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
}
/**
* Deselects all selected items in the receiver.
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void deselectAll () {
checkWidget();
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.gtk_tree_selection_unselect_all (selection);
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
}
void destroyItem (TableColumn column) {
int index = 0;
while (index < columnCount) {
if (columns [index] == column) break;
index++;
}
if (index == columnCount) return;
int /*long*/ columnHandle = column.handle;
if (columnCount == 1) {
firstCustomDraw = column.customDraw;
}
System.arraycopy (columns, index + 1, columns, index, --columnCount - index);
columns [columnCount] = null;
column.deregister ();
OS.gtk_tree_view_remove_column (handle, columnHandle);
if (columnCount == 0) {
int /*long*/ oldModel = modelHandle;
int /*long*/[] types = getColumnTypes (1);
int /*long*/ newModel = OS.gtk_list_store_newv (types.length, types);
if (newModel == 0) error (SWT.ERROR_NO_HANDLES);
int /*long*/ [] ptr = new int /*long*/ [1];
for (int i=0; i<itemCount; i++) {
int /*long*/ newItem = OS.g_malloc (OS.GtkTreeIter_sizeof ());
if (newItem == 0) error (SWT.ERROR_NO_HANDLES);
OS.gtk_list_store_append (newModel, newItem);
TableItem item = items [i];
if (item != null) {
int /*long*/ oldItem = item.handle;
for (int j=0; j<FIRST_COLUMN; j++) {
OS.gtk_tree_model_get (oldModel, oldItem, j, ptr, -1);
OS.gtk_list_store_set (newModel, newItem, j, ptr [0], -1);
}
OS.gtk_tree_model_get (oldModel, oldItem, column.modelIndex + CELL_PIXBUF, ptr, -1);
OS.gtk_list_store_set (newModel, newItem, FIRST_COLUMN + CELL_PIXBUF, ptr [0], -1);
OS.gtk_tree_model_get (oldModel, oldItem, column.modelIndex + CELL_TEXT, ptr, -1);
OS.gtk_list_store_set (newModel, newItem, FIRST_COLUMN + CELL_TEXT, ptr [0], -1);
OS.g_free (ptr [0]);
OS.gtk_tree_model_get (oldModel, oldItem, column.modelIndex + CELL_FOREGROUND, ptr, -1);
OS.gtk_list_store_set (newModel, newItem, FIRST_COLUMN + CELL_FOREGROUND, ptr [0], -1);
OS.gtk_tree_model_get (oldModel, oldItem, column.modelIndex + CELL_BACKGROUND, ptr, -1);
OS.gtk_list_store_set (newModel, newItem, FIRST_COLUMN + CELL_BACKGROUND, ptr [0], -1);
OS.gtk_tree_model_get (oldModel, oldItem, column.modelIndex + CELL_FONT, ptr, -1);
OS.gtk_list_store_set (newModel, newItem, FIRST_COLUMN + CELL_FONT, ptr [0], -1);
OS.gtk_list_store_remove (oldModel, oldItem);
OS.g_free (oldItem);
item.handle = newItem;
} else {
OS.g_free (newItem);
}
}
OS.gtk_tree_view_set_model (handle, newModel);
OS.g_object_unref (oldModel);
modelHandle = newModel;
createColumn (null, 0);
} else {
for (int i=0; i<itemCount; i++) {
TableItem item = items [i];
if (item != null) {
int /*long*/ iter = item.handle;
int modelIndex = column.modelIndex;
OS.gtk_list_store_set (modelHandle, iter, modelIndex + CELL_PIXBUF, 0, -1);
OS.gtk_list_store_set (modelHandle, iter, modelIndex + CELL_TEXT, 0, -1);
OS.gtk_list_store_set (modelHandle, iter, modelIndex + CELL_FOREGROUND, 0, -1);
OS.gtk_list_store_set (modelHandle, iter, modelIndex + CELL_BACKGROUND, 0, -1);
OS.gtk_list_store_set (modelHandle, iter, modelIndex + CELL_FONT, 0, -1);
Font [] cellFont = item.cellFont;
if (cellFont != null) {
if (columnCount == 1) {
item.cellFont = null;
} else {
Font [] temp = new Font [columnCount - 1];
System.arraycopy (cellFont, 0, temp, 0, index);
System.arraycopy (cellFont, index + 1, temp, index, columnCount - 1 - index);
item.cellFont = temp;
}
}
}
}
if (index == 0) {
TableColumn checkColumn = columns [0];
createRenderers (checkColumn.handle, checkColumn.modelIndex, true, checkColumn.style);
}
}
column.handle = column.buttonHandle = column.labelHandle = 0;
column.imageHandle = 0;
}
void destroyItem (TableItem item) {
int index = 0;
while (index < itemCount) {
if (items [index] == item) break;
index++;
}
if (index == itemCount) return;
int /*long*/ itemHandle = item.handle;
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.gtk_list_store_remove (modelHandle, itemHandle);
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.g_free (itemHandle);
item.handle = 0;
System.arraycopy (items, index + 1, items, index, --itemCount - index);
items [itemCount] = null;
lastDataIndex = -1;
if (itemCount == 0) resetCustomDraw ();
}
GdkColor getBackgroundColor () {
return getBaseColor ();
}
/**
* Returns the column at the given, zero-relative index in the
* receiver. Throws an exception if the index is out of range.
* If no <code>TableColumn</code>s were created by the programmer,
* this method will throw <code>ERROR_INVALID_RANGE</code> despite
* the fact that a single column of data may be visible in the table.
* This occurs when the programmer uses the table like a list, adding
* items but never creating a column.
*
* @param index the index of the column to return
* @return the column at the given index
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public TableColumn getColumn (int index) {
checkWidget();
if (!(0 <= index && index < columnCount)) error (SWT.ERROR_INVALID_RANGE);
return columns [index];
}
/**
* Returns the number of columns contained in the receiver.
* If no <code>TableColumn</code>s were created by the programmer,
* this value is zero, despite the fact that visually, one column
* of items is may be visible. This occurs when the programmer uses
* the table like a list, adding items but never creating a column.
*
* @return the number of columns
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
* @exception SWTError <ul>
* <li>ERROR_CANNOT_GET_COUNT - if the operation fails because of an operating system failure</li>
* </ul>
*/
public int getColumnCount () {
checkWidget();
return columnCount;
}
int /*long*/[] getColumnTypes (int columnCount) {
int /*long*/[] types = new int /*long*/ [FIRST_COLUMN + (columnCount * CELL_TYPES)];
// per row data
types [CHECKED_COLUMN] = OS.G_TYPE_BOOLEAN ();
types [GRAYED_COLUMN] = OS.G_TYPE_BOOLEAN ();
types [FOREGROUND_COLUMN] = OS.GDK_TYPE_COLOR ();
types [BACKGROUND_COLUMN] = OS.GDK_TYPE_COLOR ();
types [FONT_COLUMN] = OS.PANGO_TYPE_FONT_DESCRIPTION ();
// per cell data
for (int i=FIRST_COLUMN; i<types.length; i+=CELL_TYPES) {
types [i + CELL_PIXBUF] = OS.GDK_TYPE_PIXBUF ();
types [i + CELL_TEXT] = OS.G_TYPE_STRING ();
types [i + CELL_FOREGROUND] = OS.GDK_TYPE_COLOR ();
types [i + CELL_BACKGROUND] = OS.GDK_TYPE_COLOR ();
types [i + CELL_FONT] = OS.PANGO_TYPE_FONT_DESCRIPTION ();
}
return types;
}
/**
* Returns an array of <code>TableColumn</code>s which are the
* columns in the receiver. If no <code>TableColumn</code>s were
* created by the programmer, the array is empty, despite the fact
* that visually, one column of items may be visible. This occurs
* when the programmer uses the table like a list, adding items but
* never creating a column.
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its list of items, so modifying the array will
* not affect the receiver.
* </p>
*
* @return the items in the receiver
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public TableColumn [] getColumns () {
checkWidget();
TableColumn [] result = new TableColumn [columnCount];
System.arraycopy (columns, 0, result, 0, columnCount);
return result;
}
TableItem getFocusItem () {
int /*long*/ [] path = new int /*long*/ [1];
OS.gtk_tree_view_get_cursor (handle, path, null);
if (path [0] == 0) return null;
TableItem item = null;
int /*long*/ indices = OS.gtk_tree_path_get_indices (path [0]);
if (indices != 0) {
int [] index = new int []{-1};
OS.memmove (index, indices, 4);
item = _getItem (index [0]);
}
OS.gtk_tree_path_free (path [0]);
return item;
}
GdkColor getForegroundColor () {
return getTextColor ();
}
/**
* Returns the width in pixels of a grid line.
*
* @return the width of a grid line in pixels
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getGridLineWidth () {
checkWidget();
return 0;
}
/**
* Returns the height of the receiver's header
*
* @return the height of the header or zero if the header is not visible
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @since 2.0
*/
public int getHeaderHeight () {
checkWidget ();
if (!OS.gtk_tree_view_get_headers_visible (handle)) return 0;
OS.gtk_widget_realize (handle);
int /*long*/ fixedWindow = OS.GTK_WIDGET_WINDOW (fixedHandle);
int /*long*/ binWindow = OS.gtk_tree_view_get_bin_window (handle);
int [] binY = new int [1];
OS.gdk_window_get_origin (binWindow, null, binY);
int [] fixedY = new int [1];
OS.gdk_window_get_origin (fixedWindow, null, fixedY);
return binY [0] - fixedY [0];
}
/**
* Returns <code>true</code> if the receiver's header is visible,
* and <code>false</code> otherwise.
* <p>
* If one of the receiver's ancestors is not visible or some
* other condition makes the receiver not visible, this method
* may still indicate that it is considered visible even though
* it may not actually be showing.
* </p>
*
* @return the receiver's header's visibility state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public boolean getHeaderVisible () {
checkWidget();
return OS.gtk_tree_view_get_headers_visible (handle);
}
/**
* Returns the item at the given, zero-relative index in the
* receiver. Throws an exception if the index is out of range.
*
* @param index the index of the item to return
* @return the item at the given index
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public TableItem getItem (int index) {
checkWidget();
if (!(0 <= index && index < itemCount)) error (SWT.ERROR_INVALID_RANGE);
return _getItem (index);
}
/**
* Returns the item at the given point in the receiver
* or null if no such item exists. The point is in the
* coordinate system of the receiver.
*
* @param point the point used to locate the item
* @return the item at the given point
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the point is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public TableItem getItem (Point point) {
checkWidget();
int /*long*/ [] path = new int /*long*/ [1];
int clientX = point.x - getBorderWidth ();
int clientY = point.y - getHeaderHeight ();
OS.gtk_widget_realize (handle);
if (!OS.gtk_tree_view_get_path_at_pos (handle, clientX, clientY, path, null, null, null)) return null;
if (path [0] == 0) return null;
int /*long*/ indices = OS.gtk_tree_path_get_indices (path [0]);
TableItem item = null;
if (indices != 0) {
int [] index = new int [1];
OS.memmove (index, indices, 4);
item = _getItem (index [0]);
}
OS.gtk_tree_path_free (path [0]);
return item;
}
/**
* Returns the number of items contained in the receiver.
*
* @return the number of items
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getItemCount () {
checkWidget ();
return itemCount;
}
/**
* Returns the height of the area which would be used to
* display <em>one</em> of the items in the receiver's.
*
* @return the height of one item
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getItemHeight () {
checkWidget();
if (itemCount == 0) {
int /*long*/ column = OS.gtk_tree_view_get_column (handle, 0);
int [] w = new int [1], h = new int [1];
OS.gtk_tree_view_column_cell_get_size (column, null, null, null, w, h);
return h [0];
} else {
int height = 0;
int /*long*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());
OS.gtk_tree_model_get_iter_first (modelHandle, iter);
int columnCount = Math.max (1, this.columnCount);
for (int i=0; i<columnCount; i++) {
int /*long*/ column = OS.gtk_tree_view_get_column (handle, i);
OS.gtk_tree_view_column_cell_set_cell_data (column, modelHandle, iter, false, false);
int [] w = new int [1], h = new int [1];
OS.gtk_tree_view_column_cell_get_size (column, null, null, null, w, h);
height = Math.max (height, h [0]);
}
OS.g_free (iter);
return height;
}
}
/**
* Returns an array of <code>TableItem</code>s which are the items
* in the receiver.
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its list of items, so modifying the array will
* not affect the receiver.
* </p>
*
* @return the items in the receiver
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public TableItem [] getItems () {
checkWidget();
TableItem [] result = new TableItem [itemCount];
if ((style & SWT.VIRTUAL) != 0) {
for (int i=0; i<itemCount; i++) {
result [i] = _getItem (i);
}
} else {
System.arraycopy (items, 0, result, 0, itemCount);
}
return result;
}
/**
* Returns <code>true</code> if the receiver's lines are visible,
* and <code>false</code> otherwise.
* <p>
* If one of the receiver's ancestors is not visible or some
* other condition makes the receiver not visible, this method
* may still indicate that it is considered visible even though
* it may not actually be showing.
* </p>
*
* @return the visibility state of the lines
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public boolean getLinesVisible() {
checkWidget();
return OS.gtk_tree_view_get_rules_hint (handle);
}
int /*long*/ getPixbufRenderer (int /*long*/ column) {
int /*long*/ list = OS.gtk_tree_view_column_get_cell_renderers (column);
if (list == 0) return 0;
int count = OS.g_list_length (list);
int /*long*/ pixbufRenderer = 0;
int i = 0;
while (i < count) {
int /*long*/ renderer = OS.g_list_nth_data (list, i);
if (OS.GTK_IS_CELL_RENDERER_PIXBUF (renderer)) {
pixbufRenderer = renderer;
break;
}
i++;
}
OS.g_list_free (list);
return pixbufRenderer;
}
/**
* Returns an array of <code>TableItem</code>s that are currently
* selected in the receiver. An empty array indicates that no
* items are selected.
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its selection, so modifying the array will
* not affect the receiver.
* </p>
* @return an array representing the selection
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public TableItem [] getSelection () {
checkWidget();
display.treeSelectionLength = 0;
display.treeSelection = new int [itemCount];
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
OS.gtk_tree_selection_selected_foreach (selection, display.treeSelectionProc, handle);
TableItem [] result = new TableItem [display.treeSelectionLength];
for (int i=0; i<result.length; i++) result [i] = _getItem (display.treeSelection [i]);
return result;
}
/**
* Returns the number of selected items contained in the receiver.
*
* @return the number of selected items
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getSelectionCount () {
checkWidget();
display.treeSelectionLength = 0;
display.treeSelection = null;
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
OS.gtk_tree_selection_selected_foreach (selection, display.treeSelectionProc, handle);
return display.treeSelectionLength;
}
/**
* Returns the zero-relative index of the item which is currently
* selected in the receiver, or -1 if no item is selected.
*
* @return the index of the selected item
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getSelectionIndex () {
checkWidget();
display.treeSelectionLength = 0;
display.treeSelection = new int [itemCount];
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
OS.gtk_tree_selection_selected_foreach (selection, display.treeSelectionProc, handle);
if (display.treeSelectionLength == 0) return -1;
return display.treeSelection [0];
}
/**
* Returns the zero-relative indices of the items which are currently
* selected in the receiver. The array is empty if no items are selected.
* <p>
* Note: This is not the actual structure used by the receiver
* to maintain its selection, so modifying the array will
* not affect the receiver.
* </p>
* @return the array of indices of the selected items
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int [] getSelectionIndices () {
checkWidget();
display.treeSelectionLength = 0;
display.treeSelection = new int [itemCount];
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
OS.gtk_tree_selection_selected_foreach (selection, display.treeSelectionProc, handle);
if (display.treeSelectionLength == display.treeSelection.length) return display.treeSelection;
int [] result = new int [display.treeSelectionLength];
System.arraycopy (display.treeSelection, 0, result, 0, display.treeSelectionLength);
return result;
}
int /*long*/ getTextRenderer (int /*long*/ column) {
int /*long*/ list = OS.gtk_tree_view_column_get_cell_renderers (column);
if (list == 0) return 0;
int count = OS.g_list_length (list);
int /*long*/ textRenderer = 0;
int i = 0;
while (i < count) {
int /*long*/ renderer = OS.g_list_nth_data (list, i);
if (OS.GTK_IS_CELL_RENDERER_TEXT (renderer)) {
textRenderer = renderer;
break;
}
i++;
}
OS.g_list_free (list);
return textRenderer;
}
/**
* Returns the zero-relative index of the item which is currently
* at the top of the receiver. This index can change when items are
* scrolled or new items are added or removed.
*
* @return the index of the top item
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int getTopIndex () {
checkWidget();
int /*long*/ [] path = new int /*long*/ [1];
OS.gtk_widget_realize (handle);
if (!OS.gtk_tree_view_get_path_at_pos (handle, 1, 1, path, null, null, null)) return 0;
if (path [0] == 0) return 0;
int /*long*/ indices = OS.gtk_tree_path_get_indices (path[0]);
int[] index = new int [1];
if (indices != 0) OS.memmove (index, indices, 4);
OS.gtk_tree_path_free (path [0]);
return index [0];
}
int /*long*/ gtk_button_press_event (int /*long*/ widget, int /*long*/ event) {
GdkEventButton gdkEvent = new GdkEventButton ();
OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
if (gdkEvent.window != OS.gtk_tree_view_get_bin_window (handle)) return 0;
int border = getBorderWidth ();
int headerHeight = getHeaderHeight ();
gdkEvent.x += border;
gdkEvent.y += headerHeight;
OS.memmove (event, gdkEvent, GdkEventButton.sizeof);
int /*long*/ result = super.gtk_button_press_event (widget, event);
gdkEvent.x -= border;
gdkEvent.y -= headerHeight;
OS.memmove (event, gdkEvent, GdkEventButton.sizeof);
if (result != 0) return result;
/*
* Feature in GTK. In a multi-select table view, when multiple items are already
* selected, the selection state of the item is toggled and the previous selection
* is cleared. This is not the desired behaviour when bringing up a popup menu.
* Also, when an item is reselected with the right button, the tree view issues
* an unwanted selection event. The workaround is to detect that case and not
* run the default handler when the item is already part of the current selection.
*/
int button = gdkEvent.button;
if (button == 3 && gdkEvent.type == OS.GDK_BUTTON_PRESS) {
int /*long*/ [] path = new int /*long*/ [1];
if (OS.gtk_tree_view_get_path_at_pos (handle, (int)gdkEvent.x, (int)gdkEvent.y, path, null, null, null)) {
if (path [0] != 0) {
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
if (OS.gtk_tree_selection_path_is_selected (selection, path [0])) result = 1;
OS.gtk_tree_path_free (path [0]);
}
}
}
/*
* Feature in GTK. When the user clicks in a single selection GtkTreeView
* and there are no selected items, the first item is selected automatically
* before the click is processed, causing two selection events. The is fix
* is the set the cursor item to be same as the clicked item to stop the
* widget from automatically selecting the first item.
*/
if ((style & SWT.SINGLE) != 0 && getSelectionCount () == 0) {
int /*long*/ [] path = new int /*long*/ [1];
if (OS.gtk_tree_view_get_path_at_pos (handle, (int)gdkEvent.x, (int)gdkEvent.y, path, null, null, null)) {
if (path [0] != 0) {
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.gtk_tree_view_set_cursor (handle, path [0], 0, false);
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.gtk_tree_path_free (path [0]);
}
}
}
/*
* Bug in GTK. GTK segments fault, if the GtkTreeView widget is
* not in focus and all items in the widget are disposed before
* it finishes processing a button press. The fix is to give
* focus to the widget before it starts processing the event.
*/
if (!OS.GTK_WIDGET_HAS_FOCUS (handle)) {
OS.gtk_widget_grab_focus (handle);
}
return result;
}
int /*long*/ gtk_button_release_event (int /*long*/ widget, int /*long*/ event) {
GdkEventButton gdkEvent = new GdkEventButton ();
OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
if (gdkEvent.window != OS.gtk_tree_view_get_bin_window (handle)) return 0;
int border = getBorderWidth ();
int headerHeight = getHeaderHeight ();
gdkEvent.x += border;
gdkEvent.y += headerHeight;
OS.memmove (event, gdkEvent, GdkEventButton.sizeof);
int /*long*/ result = super.gtk_button_release_event (widget, event);
gdkEvent.x -= border;
gdkEvent.y -= headerHeight;
OS.memmove (event, gdkEvent, GdkEventButton.sizeof);
return result;
}
int /*long*/ gtk_changed (int /*long*/ widget) {
TableItem item = getFocusItem ();
if (item != null) {
Event event = new Event ();
event.item = item;
postEvent (SWT.Selection, event);
}
return 0;
}
int /*long*/ gtk_key_press_event (int /*long*/ widget, int /*long*/ eventPtr) {
int /*long*/ result = super.gtk_key_press_event (widget, eventPtr);
if (result != 0) return result;
if (OS.GTK_VERSION < OS.VERSION (2, 2 ,0)) {
/*
* Feature in GTK 2.0.x. When an item is default selected using
* the return key, GTK does not issue notification. The fix is
* to issue this notification when the return key is pressed.
*/
GdkEventKey keyEvent = new GdkEventKey ();
OS.memmove (keyEvent, eventPtr, GdkEventKey.sizeof);
int key = keyEvent.keyval;
switch (key) {
case OS.GDK_Return:
case OS.GDK_KP_Enter: {
Event event = new Event ();
event.item = getFocusItem ();
postEvent (SWT.DefaultSelection, event);
break;
}
}
}
return result;
}
int /*long*/ gtk_motion_notify_event (int /*long*/ widget, int /*long*/ event) {
GdkEventButton gdkEvent = new GdkEventButton ();
OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
if (gdkEvent.window != OS.gtk_tree_view_get_bin_window (handle)) return 0;
int border = getBorderWidth ();
int headerHeight = getHeaderHeight ();
gdkEvent.x += border;
gdkEvent.y += headerHeight;
OS.memmove (event, gdkEvent, GdkEventButton.sizeof);
int /*long*/ result = super.gtk_motion_notify_event (widget, event);
gdkEvent.x -= border;
gdkEvent.y -= headerHeight;
OS.memmove (event, gdkEvent, GdkEventButton.sizeof);
return result;
}
int /*long*/ gtk_row_activated (int /*long*/ tree, int /*long*/ path, int /*long*/ column) {
TableItem item = null;
int /*long*/ indices = OS.gtk_tree_path_get_indices (path);
if (indices != 0) {
int [] index = new int []{-1};
OS.memmove (index, indices, 4);
item = _getItem (index [0]);
}
Event event = new Event ();
event.item = item;
postEvent (SWT.DefaultSelection, event);
return 0;
}
int /*long*/ gtk_toggled (int /*long*/ renderer, int /*long*/ pathStr) {
int /*long*/ path = OS.gtk_tree_path_new_from_string (pathStr);
if (path == 0) return 0;
int /*long*/ indices = OS.gtk_tree_path_get_indices (path);
if (indices != 0) {
int [] index = new int [1];
OS.memmove (index, indices, 4);
TableItem item = _getItem (index [0]);
item.setChecked (!item.getChecked ());
Event event = new Event ();
event.detail = SWT.CHECK;
event.item = item;
postEvent (SWT.Selection, event);
}
OS.gtk_tree_path_free (path);
return 0;
}
void hookEvents () {
super.hookEvents ();
int /*long*/ selection = OS.gtk_tree_view_get_selection(handle);
OS.g_signal_connect (selection, OS.changed, display.windowProc2, CHANGED);
OS.g_signal_connect (handle, OS.row_activated, display.windowProc4, ROW_ACTIVATED);
if (checkRenderer != 0) {
OS.g_signal_connect (checkRenderer, OS.toggled, display.windowProc3, TOGGLED);
}
}
/**
* Searches the receiver's list starting at the first column
* (index 0) until a column is found that is equal to the
* argument, and returns the index of that column. If no column
* is found, returns -1.
*
* @param column the search column
* @return the index of the column
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int indexOf (TableColumn column) {
checkWidget();
if (column == null) error (SWT.ERROR_NULL_ARGUMENT);
for (int i=0; i<columnCount; i++) {
if (columns [i] == column) return i;
}
return -1;
}
/**
* Searches the receiver's list starting at the first item
* (index 0) until an item is found that is equal to the
* argument, and returns the index of that item. If no item
* is found, returns -1.
*
* @param item the search item
* @return the index of the item
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the string is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public int indexOf (TableItem item) {
checkWidget();
if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
if (1 <= lastIndexOf && lastIndexOf < itemCount - 1) {
if (items [lastIndexOf] == item) return lastIndexOf;
if (items [lastIndexOf + 1] == item) return ++lastIndexOf;
if (items [lastIndexOf - 1] == item) return --lastIndexOf;
}
if (lastIndexOf < itemCount / 2) {
for (int i=0; i<itemCount; i++) {
if (items [i] == item) return lastIndexOf = i;
}
} else {
for (int i=itemCount - 1; i>=0; --i) {
if (items [i] == item) return lastIndexOf = i;
}
}
return -1;
}
/**
* Returns <code>true</code> if the item is selected,
* and <code>false</code> otherwise. Indices out of
* range are ignored.
*
* @param index the index of the item
* @return the visibility state of the item at the index
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public boolean isSelected (int index) {
checkWidget();
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
byte [] buffer = Converter.wcsToMbcs (null, Integer.toString (index), true);
int /*long*/ path = OS.gtk_tree_path_new_from_string (buffer);
boolean answer = OS.gtk_tree_selection_path_is_selected (selection, path);
OS.gtk_tree_path_free (path);
return answer;
}
boolean mnemonicHit (char key) {
for (int i=0; i<columnCount; i++) {
int /*long*/ labelHandle = columns [i].labelHandle;
if (labelHandle != 0 && mnemonicHit (labelHandle, key)) return true;
}
return false;
}
boolean mnemonicMatch (char key) {
for (int i=0; i<columnCount; i++) {
int /*long*/ labelHandle = columns [i].labelHandle;
if (labelHandle != 0 && mnemonicMatch (labelHandle, key)) return true;
}
return false;
}
int /*long*/ paintWindow () {
OS.gtk_widget_realize (handle);
return OS.gtk_tree_view_get_bin_window (handle);
}
int /*long*/ pixbufCellDataProc (int /*long*/ tree_column, int /*long*/ cell, int /*long*/ tree_model, int /*long*/ iter, int /*long*/ data) {
if (cell == ignorePixbufCell) return 0;
int modelIndex = -1;
boolean customDraw = false;
if (columnCount == 0) {
modelIndex = Table.FIRST_COLUMN;
customDraw = firstCustomDraw;
} else {
for (int i = 0; i < columns.length; i++) {
if (columns [i] != null && columns [i].handle == tree_column) {
modelIndex = columns [i].modelIndex;
customDraw = columns [i].customDraw;
break;
}
}
}
if (modelIndex == -1) return 0;
boolean setData = setCellData (tree_model, iter);
int /*long*/ [] ptr = new int /*long*/ [1];
if (setData) {
OS.gtk_tree_model_get (tree_model, iter, modelIndex + CELL_PIXBUF, ptr, -1);
OS.g_object_set(cell, OS.pixbuf, ptr[0], 0);
ptr = new int /*long*/ [1];
}
if (customDraw) {
/*
* Bug on GTK. Gtk renders the background on top of the checkbox and pixbuf.
* This only happens in version 2.2.1 and earlier. The fix is not to set the background.
*/
if (OS.GTK_VERSION > OS.VERSION (2, 2, 1)) {
OS.gtk_tree_model_get (tree_model, iter, modelIndex + CELL_BACKGROUND, ptr, -1);
if (ptr [0] != 0) {
OS.g_object_set(cell, OS.cell_background_gdk, ptr[0], 0);
}
}
}
if (setData) {
ignorePixbufCell = cell;
setScrollWidth (tree_column, iter);
ignorePixbufCell = 0;
}
return 0;
}
void register () {
super.register ();
display.addWidget (OS.gtk_tree_view_get_selection (handle), this);
if (checkRenderer != 0) display.addWidget (checkRenderer, this);
}
void releaseWidget () {
for (int i=0; i<columnCount; i++) {
TableColumn column = columns [i];
if (!column.isDisposed ()) column.releaseResources ();
}
columns = null;
for (int i=0; i<itemCount; i++) {
TableItem item = items [i];
if (item != null && !item.isDisposed ()) item.releaseResources ();
}
items = null;
super.releaseWidget ();
if (modelHandle != 0) OS.g_object_unref (modelHandle);
modelHandle = 0;
if (checkRenderer != 0) OS.g_object_unref (checkRenderer);
checkRenderer = 0;
if (imageList != null) {
imageList.dispose ();
imageList = null;
}
}
/**
* Removes the item from the receiver at the given
* zero-relative index.
*
* @param index the index for the item
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
* @exception SWTError <ul>
* <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
* </ul>
*/
public void remove (int index) {
checkWidget();
if (!(0 <= index && index <= itemCount)) error (SWT.ERROR_ITEM_NOT_REMOVED);
TableItem item = items [index];
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
if (item != null && !item.isDisposed ()) {
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.gtk_list_store_remove (modelHandle, item.handle);
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
item.releaseResources ();
} else {
int /*long*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());
OS.gtk_tree_model_iter_nth_child (modelHandle, iter, 0, index);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.gtk_list_store_remove (modelHandle, iter);
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.g_free (iter);
}
System.arraycopy (items, index + 1, items, index, --itemCount - index);
items [itemCount] = null;
}
/**
* Removes the items from the receiver which are
* between the given zero-relative start and end
* indices (inclusive).
*
* @param start the start of the range
* @param end the end of the range
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
* @exception SWTError <ul>
* <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
* </ul>
*/
public void remove (int start, int end) {
checkWidget();
if (start > end) return;
if (!(0 <= start && start <= end && end < itemCount)) {
error (SWT.ERROR_INVALID_RANGE);
}
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
int /*long*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());
OS.gtk_tree_model_iter_nth_child (modelHandle, iter, 0, start);
int index = start;
while (index <= end) {
TableItem item = items [index];
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.gtk_list_store_remove (modelHandle, iter);
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
if (item != null && !item.isDisposed ()) item.releaseResources ();
index++;
}
OS.g_free (iter);
System.arraycopy (items, index, items, start, itemCount - index);
for (int i=itemCount-(index-start); i<itemCount; i++) items [i] = null;
itemCount = itemCount - (index - start);
}
/**
* Removes the items from the receiver's list at the given
* zero-relative indices.
*
* @param indices the array of indices of the items
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)</li>
* <li>ERROR_NULL_ARGUMENT - if the indices array is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
* @exception SWTError <ul>
* <li>ERROR_ITEM_NOT_REMOVED - if the operation fails because of an operating system failure</li>
* </ul>
*/
public void remove (int [] indices) {
checkWidget();
if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
if (indices.length == 0) return;
int [] newIndices = new int [indices.length];
System.arraycopy (indices, 0, newIndices, 0, indices.length);
sort (newIndices);
int start = newIndices [newIndices.length - 1], end = newIndices [0];
if (!(0 <= start && start <= end && end < itemCount)) {
error (SWT.ERROR_INVALID_RANGE);
}
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
int last = -1;
int /*long*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());
for (int i=0; i<newIndices.length; i++) {
int index = newIndices [i];
if (index != last) {
TableItem item = items [index];
if (item != null && !item.isDisposed ()) {
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.gtk_list_store_remove (modelHandle, item.handle);
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
item.releaseResources ();
} else {
OS.gtk_tree_model_iter_nth_child (modelHandle, iter, 0, index);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.gtk_list_store_remove (modelHandle, iter);
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
}
System.arraycopy (items, index + 1, items, index, --itemCount - index);
items [itemCount] = null;
last = index;
}
}
OS.g_free (iter);
}
/**
* Removes all of the items from the receiver.
* <p>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void removeAll () {
checkWidget();
/*
* Bug in GTK. In version 2.3.2, when the property fixed-height-mode
* is set and there are items in the list, OS.gtk_list_store_clear()
* segment faults. The fix is to create a new empty model instead.
*/
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
// OS.gtk_list_store_clear (modelHandle);
int /*long*/ oldModel = modelHandle;
int /*long*/[] types = getColumnTypes (Math.max (1,columnCount));
int /*long*/ newModel = OS.gtk_list_store_newv (types.length, types);
if (newModel == 0) error (SWT.ERROR_NO_HANDLES);
OS.gtk_tree_view_set_model (handle, newModel);
OS.g_object_unref (oldModel);
modelHandle = newModel;
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
int index = itemCount - 1;
while (index >= 0) {
TableItem item = items [index];
if (item != null && !item.isDisposed ()) item.releaseResources ();
--index;
}
items = new TableItem [4];
itemCount = 0;
resetCustomDraw ();
}
/**
* Removes the listener from the collection of listeners who will
* be notified when the receiver's selection changes.
*
* @param listener the listener which should no longer be notified
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the listener is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see SelectionListener
* @see #addSelectionListener(SelectionListener)
*/
public void removeSelectionListener(SelectionListener listener) {
checkWidget();
if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
if (eventTable == null) return;
eventTable.unhook (SWT.Selection, listener);
eventTable.unhook (SWT.DefaultSelection,listener);
}
void resetCustomDraw () {
if ((style & SWT.VIRTUAL) != 0) return;
int end = Math.max (1, columnCount);
for (int i=0; i<end; i++) {
boolean customDraw = columnCount != 0 ? columns [i].customDraw : firstCustomDraw;
if (customDraw) {
int /*long*/ column = OS.gtk_tree_view_get_column (handle, i);
int /*long*/ textRenderer = getTextRenderer (column);
OS.gtk_tree_view_column_set_cell_data_func (column, textRenderer, 0, 0, 0);
if (columnCount != 0) columns [i].customDraw = false;
}
}
firstCustomDraw = false;
}
/**
* Selects the item at the given zero-relative index in the receiver.
* If the item at the index was already selected, it remains
* selected. Indices that are out of range are ignored.
*
* @param index the index of the item to select
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void select (int index) {
checkWidget();
if (!(0 <= index && index < itemCount)) return;
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
TableItem item = _getItem (index);
OS.gtk_tree_selection_select_iter (selection, item.handle);
if ((style & SWT.SINGLE) != 0) {
int /*long*/ path = OS.gtk_tree_model_get_path (modelHandle, item.handle);
OS.gtk_tree_view_set_cursor (handle, path, 0, false);
OS.gtk_tree_path_free (path);
}
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
}
/**
* Selects the items in the range specified by the given zero-relative
* indices in the receiver. The range of indices is inclusive.
* The current selection is not cleared before the new items are selected.
* <p>
* If an item in the given range is not selected, it is selected.
* If an item in the given range was already selected, it remains selected.
* Indices that are out of range are ignored and no items will be selected
* if start is greater than end.
* If the receiver is single-select and there is more than one item in the
* given range, then all indices are ignored.
*
* @param start the start of the range
* @param end the end of the range
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see Table#setSelection(int,int)
*/
public void select (int start, int end) {
checkWidget ();
if (end < 0 || start > end || ((style & SWT.SINGLE) != 0 && start != end)) return;
if (itemCount == 0 || start >= itemCount) return;
start = Math.max (0, start);
end = Math.min (end, itemCount - 1);
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
for (int index=start; index<=end; index++) {
TableItem item = _getItem (index);
OS.gtk_tree_selection_select_iter (selection, item.handle);
if ((style & SWT.SINGLE) != 0) {
int /*long*/ path = OS.gtk_tree_model_get_path (modelHandle, item.handle);
OS.gtk_tree_view_set_cursor (handle, path, 0, false);
OS.gtk_tree_path_free (path);
}
}
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
}
/**
* Selects the items at the given zero-relative indices in the receiver.
* The current selection is not cleared before the new items are selected.
* <p>
* If the item at a given index is not selected, it is selected.
* If the item at a given index was already selected, it remains selected.
* Indices that are out of range and duplicate indices are ignored.
* If the receiver is single-select and multiple indices are specified,
* then all indices are ignored.
*
* @param indices the array of indices for the items to select
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see Table#setSelection(int[])
*/
public void select (int [] indices) {
checkWidget ();
if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
int length = indices.length;
if (length == 0 || ((style & SWT.SINGLE) != 0 && length > 1)) return;
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
for (int i=0; i<length; i++) {
int index = indices [i];
if (!(0 <= index && index < itemCount)) continue;
TableItem item = _getItem (index);
OS.gtk_tree_selection_select_iter (selection, item.handle);
if ((style & SWT.SINGLE) != 0) {
int /*long*/ path = OS.gtk_tree_model_get_path (modelHandle, item.handle);
OS.gtk_tree_view_set_cursor (handle, path, 0, false);
OS.gtk_tree_path_free (path);
}
}
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
}
/**
* Selects all of the items in the receiver.
* <p>
* If the receiver is single-select, do nothing.
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void selectAll () {
checkWidget();
if ((style & SWT.SINGLE) != 0) return;
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.gtk_tree_selection_select_all (selection);
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
}
void selectFocusIndex (int index) {
/*
* Note that this method both selects and sets the focus to the
* specified index, so any previous selection in the list will be lost.
* gtk does not provide a way to just set focus to a specified list item.
*/
if (!(0 <= index && index < itemCount)) return;
TableItem item = _getItem (index);
int /*long*/ path = OS.gtk_tree_model_get_path (modelHandle, item.handle);
int /*long*/ selection = OS.gtk_tree_view_get_selection (handle);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.gtk_tree_view_set_cursor (handle, path, 0, false);
/*
* Bug in GTK. For some reason, when an event loop is run from
* within a key pressed handler and a dialog is displayed that
* contains a GtkTreeView, gtk_tree_view_set_cursor() does
* not set the cursor or select the item. The fix is to select the
* item with gtk_tree_selection_select_iter() as well.
*
* NOTE: This happens in GTK 2.2.1 and is fixed in GTK 2.2.4.
*/
OS.gtk_tree_selection_select_iter (selection, item.handle);
OS.g_signal_handlers_unblock_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
OS.gtk_tree_path_free (path);
}
void setBackgroundColor (GdkColor color) {
super.setBackgroundColor (color);
OS.gtk_widget_modify_base (handle, 0, color);
}
int setBounds (int x, int y, int width, int height, boolean move, boolean resize) {
int result = super.setBounds (x, y, width, height, move, resize);
/*
* Bug on GTK. The tree view sometimes does not get a paint
* event or resizes to a one pixel square when resized in a new
* shell that is not visible after any event loop has been run. The
* problem is intermittent. It doesn't seem to happen the first time
* a new shell is created. The fix is to ensure the tree view is realized
* after it has been resized.
*/
OS.gtk_widget_realize (handle);
return result;
}
boolean setCellData(int /*long*/ tree_model, int /*long*/ iter) {
if ((style & SWT.VIRTUAL) != 0) {
int [] index = new int [1];
int /*long*/ path = OS.gtk_tree_model_get_path (tree_model, iter);
OS.memmove (index, OS.gtk_tree_path_get_indices (path), 4);
OS.gtk_tree_path_free (path);
if (lastDataIndex != index [0]) {
lastDataIndex = lastIndexOf = index [0];
TableItem item = _getItem (index [0]);
if (!item.cached) return checkData (item);
}
}
return false;
}
void setFontDescription (int /*long*/ font) {
super.setFontDescription (font);
TableColumn[] columns = getColumns ();
for (int i = 0; i < columns.length; i++) {
if (columns[i] != null) {
columns[i].setFontDescription (font);
}
}
}
void setForegroundColor (GdkColor color) {
super.setForegroundColor (color);
OS.gtk_widget_modify_text (handle, 0, color);
}
/**
* Marks the receiver's header as visible if the argument is <code>true</code>,
* and marks it invisible otherwise.
* <p>
* If one of the receiver's ancestors is not visible or some
* other condition makes the receiver not visible, marking
* it visible may not actually cause it to be displayed.
* </p>
*
* @param show the new visibility state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setHeaderVisible (boolean show) {
checkWidget ();
OS.gtk_tree_view_set_headers_visible (handle, show);
}
/**
* Sets the number of items contained in the receiver.
*
* @param count the number of items
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @since 3.0
*/
public void setItemCount (int count) {
checkWidget ();
count = Math.max (0, count);
if (count == itemCount) return;
boolean isVirtual = (style & SWT.VIRTUAL) != 0;
if (!isVirtual) setRedraw (false);
remove (count, itemCount - 1);
int length = Math.max (4, (count + 3) / 4 * 4);
TableItem [] newItems = new TableItem [length];
System.arraycopy (items, 0, newItems, 0, itemCount);
items = newItems;
if (isVirtual) {
int /*long*/ iter = OS.g_malloc (OS.GtkTreeIter_sizeof ());
if (iter == 0) error (SWT.ERROR_NO_HANDLES);
for (int i=itemCount; i<count; i++) {
OS.gtk_list_store_append (modelHandle, iter);
}
OS.g_free (iter);
itemCount = count;
} else {
for (int i=itemCount; i<count; i++) {
items [i] = new TableItem (this, SWT.NONE, i, true);
}
}
if (!isVirtual) setRedraw (true);
}
/**
* Marks the receiver's lines as visible if the argument is <code>true</code>,
* and marks it invisible otherwise.
* <p>
* If one of the receiver's ancestors is not visible or some
* other condition makes the receiver not visible, marking
* it visible may not actually cause it to be displayed.
* </p>
*
* @param show the new visibility state
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setLinesVisible (boolean show) {
checkWidget();
OS.gtk_tree_view_set_rules_hint (handle, show);
}
public void setRedraw (boolean redraw) {
checkWidget();
super.setRedraw (redraw);
if (redraw && drawCount == 0) {
/* Resize the item array to match the item count */
if (items.length > 4 && items.length - itemCount > 3) {
int length = Math.max (4, (itemCount + 3) / 4 * 4);
TableItem [] newItems = new TableItem [length];
System.arraycopy (items, 0, newItems, 0, itemCount);
items = newItems;
}
}
}
void setScrollWidth (int /*long*/ column, int /*long*/ iter) {
if (columnCount != 0) return;
int width = OS.gtk_tree_view_column_get_width (column);
int itemWidth = calculateWidth (column, iter);
if (width < itemWidth) {
OS.gtk_tree_view_column_set_fixed_width (column, itemWidth);
}
}
/**
* Selects the item at the given zero-relative index in the receiver.
* The current selected is first cleared, then the new item is selected.
*
* @param index the index of the item to select
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see Table#deselectAll()
* @see Table#select(int)
*/
public void setSelection (int index) {
checkWidget ();
deselectAll ();
selectFocusIndex (index);
showSelection ();
}
/**
* Selects the items in the range specified by the given zero-relative
* indices in the receiver. The range of indices is inclusive.
* The current selection is cleared before the new items are selected.
* <p>
* Indices that are out of range are ignored and no items will be selected
* if start is greater than end.
* If the receiver is single-select and there is more than one item in the
* given range, then all indices are ignored.
*
* @param start the start index of the items to select
* @param end the end index of the items to select
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see Table#deselectAll()
* @see Table#select(int,int)
*/
public void setSelection (int start, int end) {
checkWidget ();
deselectAll();
if (end < 0 || start > end || ((style & SWT.SINGLE) != 0 && start != end)) return;
if (itemCount == 0 || start >= itemCount) return;
start = Math.max (0, start);
end = Math.min (end, itemCount - 1);
selectFocusIndex (start);
if ((style & SWT.MULTI) != 0) {
select (start, end);
}
showSelection ();
}
/**
* Selects the items at the given zero-relative indices in the receiver.
* The current selection is cleared before the new items are selected.
* <p>
* Indices that are out of range and duplicate indices are ignored.
* If the receiver is single-select and multiple indices are specified,
* then all indices are ignored.
*
* @param indices the indices of the items to select
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the array of indices is null</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see Table#deselectAll()
* @see Table#select(int[])
*/
public void setSelection (int [] indices) {
checkWidget ();
if (indices == null) error (SWT.ERROR_NULL_ARGUMENT);
deselectAll ();
int length = indices.length;
if (length == 0 || ((style & SWT.SINGLE) != 0 && length > 1)) return;
selectFocusIndex (indices [0]);
if ((style & SWT.MULTI) != 0) {
select (indices);
}
showSelection ();
}
/**
* Sets the receiver's selection to be the given array of items.
* The current selection is cleared before the new items are selected.
* <p>
* Items that are not in the receiver are ignored.
* If the receiver is single-select and multiple items are specified,
* then all items are ignored.
*
* @param items the array of items
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the array of items is null</li>
* <li>ERROR_INVALID_ARGUMENT - if one of the items has been disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see Table#deselectAll()
* @see Table#select(int[])
* @see Table#setSelection(int[])
*/
public void setSelection (TableItem [] items) {
checkWidget ();
if (items == null) error (SWT.ERROR_NULL_ARGUMENT);
deselectAll ();
int length = items.length;
if (length == 0 || ((style & SWT.SINGLE) != 0 && length > 1)) return;
boolean first = true;
for (int i = 0; i < length; i++) {
int index = indexOf (items [i]);
if (index != -1) {
if (first) {
first = false;
selectFocusIndex (index);
} else {
select (index);
}
}
}
showSelection ();
}
/**
* Sets the zero-relative index of the item which is currently
* at the top of the receiver. This index can change when items
* are scrolled or new items are added and removed.
*
* @param index the index of the top item
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
public void setTopIndex (int index) {
checkWidget();
if (!(0 <= index && index < itemCount)) return;
// FIXME - For some reason, sometimes the tree scrolls to the wrong place
int /*long*/ path = OS.gtk_tree_model_get_path (modelHandle, _getItem (index).handle);
OS.gtk_tree_view_scroll_to_cell (handle, path, 0, true, 0, 0);
OS.gtk_tree_path_free (path);
}
/**
* Shows the column. If the column is already showing in the receiver,
* this method simply returns. Otherwise, the columns are scrolled until
* the column is visible.
*
* @param column the column to be shown
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the item is null</li>
* <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @since 3.0
*/
public void showColumn (TableColumn column) {
checkWidget ();
if (column == null) error (SWT.ERROR_NULL_ARGUMENT);
if (column.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
if (column.parent != this) return;
/*
* This code is intentionally commented. According to the
* documentation, gtk_tree_view_scroll_to_cell should scroll the
* minimum amount to show the column but instead it scrolls strangely.
*/
//OS.gtk_tree_view_scroll_to_cell (handle, 0, column.handle, false, 0, 0);
OS.gtk_widget_realize (handle);
GdkRectangle cellRect = new GdkRectangle ();
OS.gtk_tree_view_get_cell_area (handle, 0, column.handle, cellRect);
GdkRectangle visibleRect = new GdkRectangle ();
OS.gtk_tree_view_get_visible_rect (handle, visibleRect);
if (cellRect.x < visibleRect.x) {
OS.gtk_tree_view_scroll_to_point (handle, cellRect.x, -1);
} else {
int width = Math.min (visibleRect.width, cellRect.width);
if (cellRect.x + width > visibleRect.x + visibleRect.width) {
int tree_x = cellRect.x + width - visibleRect.width;
OS.gtk_tree_view_scroll_to_point (handle, tree_x, -1);
}
}
}
/**
* Shows the item. If the item is already showing in the receiver,
* this method simply returns. Otherwise, the items are scrolled until
* the item is visible.
*
* @param item the item to be shown
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_NULL_ARGUMENT - if the item is null</li>
* <li>ERROR_INVALID_ARGUMENT - if the item has been disposed</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see Table#showSelection()
*/
public void showItem (TableItem item) {
checkWidget ();
if (item == null) error (SWT.ERROR_NULL_ARGUMENT);
if (item.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
if (item.parent != this) return;
showItem (item.handle);
}
void showItem (int /*long*/ iter) {
int /*long*/ path = OS.gtk_tree_model_get_path (modelHandle, iter);
OS.gtk_tree_view_scroll_to_cell (handle, path, 0, false, 0, 0);
OS.gtk_tree_path_free (path);
}
/**
* Shows the selection. If the selection is already showing in the receiver,
* this method simply returns. Otherwise, the items are scrolled until
* the selection is visible.
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*
* @see Table#showItem(TableItem)
*/
public void showSelection () {
checkWidget();
TableItem [] selection = getSelection ();
if (selection.length == 0) return;
TableItem item = selection [0];
showItem (item.handle);
}
int /*long*/ textCellDataProc (int /*long*/ tree_column, int /*long*/ cell, int /*long*/ tree_model, int /*long*/ iter, int /*long*/ data) {
if (cell == ignoreTextCell) return 0;
int modelIndex = -1;
boolean customDraw = false;
if (columnCount == 0) {
modelIndex = Table.FIRST_COLUMN;
customDraw = firstCustomDraw;
} else {
for (int i = 0; i < columns.length; i++) {
if (columns [i] != null && columns [i].handle == tree_column) {
modelIndex = columns [i].modelIndex;
customDraw = columns [i].customDraw;
break;
}
}
}
if (modelIndex == -1) return 0;
boolean setData = setCellData (tree_model, iter);
int /*long*/ [] ptr = new int /*long*/ [1];
if (setData) {
OS.gtk_tree_model_get (tree_model, iter, modelIndex + CELL_TEXT, ptr, -1);
if (ptr [0] != 0) {
OS.g_object_set(cell, OS.text, ptr[0], 0);
OS.g_free (ptr[0]);
}
ptr = new int /*long*/ [1];
}
if (customDraw) {
OS.gtk_tree_model_get (tree_model, iter, modelIndex + CELL_FOREGROUND, ptr, -1);
if (ptr [0] != 0) {
OS.g_object_set(cell, OS.foreground_gdk, ptr[0], 0);
}
/*
* Bug on GTK. Gtk renders the background of the text renderer on top of the pixbuf renderer.
* This only happens in version 2.2.1 and earlier. The fix is not to set the background.
*/
if (OS.GTK_VERSION > OS.VERSION (2, 2, 1)) {
ptr = new int /*long*/ [1];
OS.gtk_tree_model_get (tree_model, iter, modelIndex + CELL_BACKGROUND, ptr, -1);
if (ptr [0] != 0) {
OS.g_object_set(cell, OS.background_gdk, ptr[0], 0);
}
}
ptr = new int /*long*/ [1];
OS.gtk_tree_model_get (tree_model, iter, modelIndex + CELL_FONT, ptr, -1);
if (ptr [0] != 0) {
OS.g_object_set(cell, OS.font_desc, ptr[0], 0);
}
}
if (setData) {
ignoreTextCell = cell;
setScrollWidth (tree_column, iter);
ignoreTextCell = 0;
}
return 0;
}
int /*long*/ treeSelectionProc (int /*long*/ model, int /*long*/ path, int /*long*/ iter, int[] selection, int length) {
if (selection != null) {
int /*long*/ indices = OS.gtk_tree_path_get_indices (path);
if (indices != 0) {
int [] index = new int [1];
OS.memmove (index, indices, 4);
selection [(int)/*64*/length] = index [0];
}
}
return 0;
}
}
| [
"375833274@qq.com"
] | 375833274@qq.com |
71f86d094bc03f4deb8e1f30c06fc03fb6bf7703 | 06cf3528a03b6c679188f51012984e7663512dc1 | /src/main/java/com/syncleus/ferma/annotations/Adjacency.java | 65b195b49bf9f162d240a74931eefde224aafccb | [] | no_license | the-ntf/Ferma | 764b7c4b765b4363e96f1ad25d70790fda32d1fa | 66d4a1df6348532f9a9b196097efea3b6dfa9d3d | refs/heads/master | 2020-07-10T04:07:30.812195 | 2015-10-17T15:11:08 | 2015-10-17T15:11:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,983 | java | /**
* Copyright: (c) Syncleus, Inc.
*
* You may redistribute and modify this source code under the terms and
* conditions of the Open Source Community License - Type C version 1.0
* or any later version as published by Syncleus, Inc. at www.syncleus.com.
* There should be a copy of the license included with this file. If a copy
* of the license is not included you are granted no right to distribute or
* otherwise use this file except through a legal and valid license. You
* should also contact Syncleus, Inc. at the information below if you cannot
* find a license:
*
* Syncleus, Inc.
* 2604 South 12th Street
* Philadelphia, PA 19148
*/
package com.syncleus.ferma.annotations;
import com.tinkerpop.blueprints.Direction;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* Adjacencies annotate getters and adders to represent a Vertex adjacent to a Vertex. This annotation extends the
* TinkerPop built-in Adjacency annotation. It allows type arguments to be passed into the annotated method. This
* ensures the returned type is of the specified type in the argument. The following method signatures are valid.
*
* T add*(Class<T> type)
* T get*(Class<T> type)
*
* When annotating a get* class it ensures it only returns nodes of the specified type (including sub-classes). Any
* Nodes which are not of this type will not be returned.
*
* @since 2.0.0
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface Adjacency {
/**
* The label of the edges making the adjacency between the vertices.
*
* @return the edge label
* @since 2.0.0
*/
String label();
/**
* The edge direction of the adjacency.
*
* @return the direction of the edges composing the adjacency
* @since 2.0.0
*/
Direction direction() default Direction.OUT;
}
| [
"jeffrey.freeman@syncleus.com"
] | jeffrey.freeman@syncleus.com |
6d9915d848374b272a4bdd0f062c504d17af0155 | 9c81dfb1cb9b65a3fad6ce7cdf63437a84fc0b50 | /demo210124-shiro-test/src/main/java/com/guoyw/demo210124/shirotest/config/MyExceptionHandler.java | bde590bfbd3b04b90ef49b6f2b35fe8b22766fc0 | [] | no_license | guoyaweiCode/springboot-demo | 8006a3afd9876e6ff2770f75a4536a119edd546b | 1b54bacc8528f040a9e33bce1025c44e6522ea8c | refs/heads/master | 2023-02-28T23:50:22.741232 | 2021-01-24T10:51:26 | 2021-01-24T10:51:26 | 326,628,502 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 603 | java | package com.guoyw.demo210124.shirotest.config;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.AuthorizationException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
/**
* @className: MyExceptionHandler
* @description: TODO 类描述
* @author: guoyw
* @date: 2021/1/5
**/
@Slf4j
@RestControllerAdvice
public class MyExceptionHandler {
@ExceptionHandler(AuthorizationException.class)
public String shiroHandle(){
log.info("--> 您没有权限");
return "您没有权限";
}
}
| [
"435945337@qq.com"
] | 435945337@qq.com |
c3536df392b2813daa8119cd4abee1a237ae59d8 | d861c84f19fc7eec8fc6323131a64fa89c05c719 | /wms/src/main/java/com/zsc/pojo/SysRoleExample.java | 32fcdc46be3da06f7e93c0b428f01910b82e5837 | [] | no_license | lw965616295/ssm-java | b5cd172044c14cfb6d454ecf18b4f6da1430fc24 | 2c657bcb6c3e5d13958085cff05bf1a2c8d12ad9 | refs/heads/master | 2020-04-06T09:02:09.289038 | 2018-11-13T05:46:04 | 2018-11-13T05:46:04 | 149,591,436 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,460 | java | package com.zsc.pojo;
import java.util.ArrayList;
import java.util.List;
public class SysRoleExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public SysRoleExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("ID is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("ID is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(String value) {
addCriterion("ID =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(String value) {
addCriterion("ID <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(String value) {
addCriterion("ID >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(String value) {
addCriterion("ID >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(String value) {
addCriterion("ID <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(String value) {
addCriterion("ID <=", value, "id");
return (Criteria) this;
}
public Criteria andIdLike(String value) {
addCriterion("ID like", value, "id");
return (Criteria) this;
}
public Criteria andIdNotLike(String value) {
addCriterion("ID not like", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<String> values) {
addCriterion("ID in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<String> values) {
addCriterion("ID not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(String value1, String value2) {
addCriterion("ID between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(String value1, String value2) {
addCriterion("ID not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andNameIsNull() {
addCriterion("NAME is null");
return (Criteria) this;
}
public Criteria andNameIsNotNull() {
addCriterion("NAME is not null");
return (Criteria) this;
}
public Criteria andNameEqualTo(String value) {
addCriterion("NAME =", value, "name");
return (Criteria) this;
}
public Criteria andNameNotEqualTo(String value) {
addCriterion("NAME <>", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThan(String value) {
addCriterion("NAME >", value, "name");
return (Criteria) this;
}
public Criteria andNameGreaterThanOrEqualTo(String value) {
addCriterion("NAME >=", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThan(String value) {
addCriterion("NAME <", value, "name");
return (Criteria) this;
}
public Criteria andNameLessThanOrEqualTo(String value) {
addCriterion("NAME <=", value, "name");
return (Criteria) this;
}
public Criteria andNameLike(String value) {
addCriterion("NAME like", value, "name");
return (Criteria) this;
}
public Criteria andNameNotLike(String value) {
addCriterion("NAME not like", value, "name");
return (Criteria) this;
}
public Criteria andNameIn(List<String> values) {
addCriterion("NAME in", values, "name");
return (Criteria) this;
}
public Criteria andNameNotIn(List<String> values) {
addCriterion("NAME not in", values, "name");
return (Criteria) this;
}
public Criteria andNameBetween(String value1, String value2) {
addCriterion("NAME between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andNameNotBetween(String value1, String value2) {
addCriterion("NAME not between", value1, value2, "name");
return (Criteria) this;
}
public Criteria andStatusIsNull() {
addCriterion("STATUS is null");
return (Criteria) this;
}
public Criteria andStatusIsNotNull() {
addCriterion("STATUS is not null");
return (Criteria) this;
}
public Criteria andStatusEqualTo(Integer value) {
addCriterion("STATUS =", value, "status");
return (Criteria) this;
}
public Criteria andStatusNotEqualTo(Integer value) {
addCriterion("STATUS <>", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThan(Integer value) {
addCriterion("STATUS >", value, "status");
return (Criteria) this;
}
public Criteria andStatusGreaterThanOrEqualTo(Integer value) {
addCriterion("STATUS >=", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThan(Integer value) {
addCriterion("STATUS <", value, "status");
return (Criteria) this;
}
public Criteria andStatusLessThanOrEqualTo(Integer value) {
addCriterion("STATUS <=", value, "status");
return (Criteria) this;
}
public Criteria andStatusIn(List<Integer> values) {
addCriterion("STATUS in", values, "status");
return (Criteria) this;
}
public Criteria andStatusNotIn(List<Integer> values) {
addCriterion("STATUS not in", values, "status");
return (Criteria) this;
}
public Criteria andStatusBetween(Integer value1, Integer value2) {
addCriterion("STATUS between", value1, value2, "status");
return (Criteria) this;
}
public Criteria andStatusNotBetween(Integer value1, Integer value2) {
addCriterion("STATUS not between", value1, value2, "status");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"965616295@qq.com"
] | 965616295@qq.com |
84238d97eefed23f4aee9a75785db804daddcd9b | 99f670be61c1c5dcb700154c0b126ab07707c6d4 | /service/src/main/java/com/parking/spring/recognition/vision/DeepVisionPreview.java | cbe8b3aa86ff867f77df51f689f6f33132879e3b | [] | no_license | andreigaevsky/parking-backend | 77d442cf590d2e3d789cc691b035ffd0f9212246 | 0338a1772a5c80c6482934d27b1e14b1519fa215 | refs/heads/master | 2023-04-29T21:13:06.676414 | 2020-09-15T05:49:03 | 2020-09-15T05:49:03 | 295,549,184 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 282 | java | package com.parking.spring.recognition.vision;
import com.parking.spring.recognition.vision.dependency.Repository;
import processing.core.PApplet;
public class DeepVisionPreview extends DeepVision {
public DeepVisionPreview(PApplet sketch) {
super(sketch);
}
}
| [
"ahayeuski@exadel.com"
] | ahayeuski@exadel.com |
4912b67bee270eb1a89682d387ef0b5ba0e2098b | d00530e85f1178a17eaa8c97637084170e87361e | /Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/database/guest/DBTracePlatformManager.java | f9a05376be05452942ef7555ff2c80fa87f124e9 | [
"Apache-2.0",
"GPL-1.0-or-later",
"GPL-3.0-only",
"LicenseRef-scancode-public-domain",
"LGPL-2.1-only",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | gareth8118/ghidra | f68bbbd35f83c9ed7ec07a0ba19c1e34301d7b2b | 2536099c0eb2683ee0e416a127f8a8795f8de853 | refs/heads/master | 2022-09-12T05:53:26.586319 | 2022-08-26T18:13:00 | 2022-08-26T18:13:00 | 186,974,979 | 0 | 0 | Apache-2.0 | 2019-05-16T07:27:20 | 2019-05-16T07:27:16 | null | UTF-8 | Java | false | false | 11,068 | java | /* ###
* IP: GHIDRA
*
* 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 ghidra.trace.database.guest;
import java.io.IOException;
import java.util.*;
import java.util.concurrent.locks.ReadWriteLock;
import db.DBHandle;
import ghidra.lifecycle.Internal;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressSetView;
import ghidra.program.model.lang.*;
import ghidra.program.model.mem.MemBuffer;
import ghidra.trace.database.DBTrace;
import ghidra.trace.database.DBTraceManager;
import ghidra.trace.database.guest.DBTraceGuestPlatform.DBTraceGuestLanguage;
import ghidra.trace.model.Trace;
import ghidra.trace.model.Trace.TracePlatformChangeType;
import ghidra.trace.model.guest.*;
import ghidra.trace.util.TraceChangeRecord;
import ghidra.util.LockHold;
import ghidra.util.database.*;
import ghidra.util.exception.CancelledException;
import ghidra.util.exception.VersionException;
import ghidra.util.task.TaskMonitor;
/*
* TODO: Store mapping as from (host) address, to (guest) address, length. "to" must include
* spaceId. It is not a problem if things overlap, as these are just informational in case an
* instruction or reference comes along that needs mapping. This also determines what is visible
* in program views of the mapped language. There should not be any overlaps in the same guest
* language, however.
*/
public class DBTracePlatformManager implements DBTraceManager, TracePlatformManager {
protected final DBHandle dbh;
protected final ReadWriteLock lock;
protected final Language baseLanguage;
protected final CompilerSpec baseCompilerSpec;
protected final DBTrace trace;
protected final DBCachedObjectStore<DBTraceGuestLanguage> languageStore;
protected final DBCachedObjectStore<DBTraceGuestPlatform> platformStore;
protected final Collection<TraceGuestPlatform> platformView;
protected final Map<Language, DBTraceGuestLanguage> languagesByLanguage = new HashMap<>();
protected final Map<CompilerSpec, DBTraceGuestPlatform> platformsByCompiler = new HashMap<>();
protected final DBCachedObjectStore<DBTraceGuestPlatformMappedRange> rangeMappingStore;
protected final InternalTracePlatform hostPlatform = new InternalTracePlatform() {
@Override
public Trace getTrace() {
return trace;
}
@Override
public DBTraceGuestLanguage getLanguageEntry() {
return null;
}
@Override
public int getIntKey() {
return -1;
}
@Override
public boolean isGuest() {
return false;
}
@Override
public Language getLanguage() {
return trace.getBaseLanguage();
}
@Override
public CompilerSpec getCompilerSpec() {
return trace.getBaseCompilerSpec();
}
@Override
public AddressSetView getHostAddressSet() {
return trace.getBaseAddressFactory().getAddressSet();
}
@Override
public AddressSetView getGuestAddressSet() {
return trace.getBaseAddressFactory().getAddressSet();
}
@Override
public Address mapHostToGuest(Address hostAddress) {
return hostAddress;
}
@Override
public Address mapGuestToHost(Address guestAddress) {
return guestAddress;
}
@Override
public MemBuffer getMappedMemBuffer(long snap, Address guestAddress) {
return trace.getMemoryManager().getBufferAt(snap, guestAddress);
}
@Override
public InstructionSet mapGuestInstructionAddressesToHost(InstructionSet set) {
return set;
}
};
public DBTracePlatformManager(DBHandle dbh, DBOpenMode openMode, ReadWriteLock lock,
TaskMonitor monitor, CompilerSpec baseCompilerSpec, DBTrace trace)
throws VersionException, IOException {
this.dbh = dbh;
this.lock = lock;
this.baseLanguage = baseCompilerSpec.getLanguage();
this.baseCompilerSpec = baseCompilerSpec;
this.trace = trace;
DBCachedObjectStoreFactory factory = trace.getStoreFactory();
languageStore = factory.getOrCreateCachedStore(DBTraceGuestLanguage.TABLE_NAME,
DBTraceGuestLanguage.class, DBTraceGuestLanguage::new, true);
platformStore = factory.getOrCreateCachedStore(DBTraceGuestPlatform.TABLE_NAME,
DBTraceGuestPlatform.class, (s, r) -> new DBTraceGuestPlatform(this, s, r), true);
platformView = Collections.unmodifiableCollection(platformStore.asMap().values());
rangeMappingStore = factory.getOrCreateCachedStore(
DBTraceGuestPlatformMappedRange.TABLE_NAME, DBTraceGuestPlatformMappedRange.class,
(s, r) -> new DBTraceGuestPlatformMappedRange(this, s, r), true);
loadLanguages();
loadPlatforms();
loadPlatformMappings();
}
protected void loadLanguages() {
for (DBTraceGuestLanguage languageEntry : languageStore.asMap().values()) {
languagesByLanguage.put(languageEntry.getLanguage(), languageEntry);
}
}
protected void loadPlatforms()
throws LanguageNotFoundException, CompilerSpecNotFoundException, VersionException {
for (DBTraceGuestPlatform platformEntry : platformStore.asMap().values()) {
platformsByCompiler.put(platformEntry.getCompilerSpec(), platformEntry);
}
}
protected void loadPlatformMappings() {
for (DBTraceGuestPlatformMappedRange langMapping : rangeMappingStore.asMap().values()) {
DBTraceGuestPlatform mappedLanguage =
platformStore.getObjectAt(langMapping.guestPlatformKey);
mappedLanguage.rangesByHostAddress.put(langMapping.getHostRange().getMinAddress(),
langMapping);
mappedLanguage.rangesByGuestAddress.put(langMapping.getGuestRange().getMinAddress(),
langMapping);
}
}
@Internal
protected DBTraceGuestLanguage getOrCreateLanguage(Language language) {
if (language == baseLanguage) {
return null;
}
DBTraceGuestLanguage languageEntry = languagesByLanguage.get(language);
if (languageEntry == null) {
languageEntry = languageStore.create();
languageEntry.set(language);
languagesByLanguage.put(language, languageEntry);
}
return languageEntry;
}
@Internal
public DBTraceGuestLanguage getLanguageByKey(int key) {
if (key == -1) {
return null;
}
return languageStore.getObjectAt(key);
}
@Internal
public InternalTracePlatform getPlatformByKey(int key) {
if (key == -1) {
return hostPlatform;
}
return platformStore.getObjectAt(key);
}
protected int getPlatformKeyForCompiler(CompilerSpec compiler) {
if (Objects.equals(compiler, baseCompilerSpec)) {
return -1;
}
return (int) platformsByCompiler.get(compiler).getKey();
}
@Internal
public DBTraceGuestLanguage getLanguageByLanguage(Language language) {
if (Objects.equals(language, baseLanguage)) {
return null;
}
return Objects.requireNonNull(languagesByLanguage.get(language));
}
protected CompilerSpec getCompilerByKey(int compilerKey) {
if (compilerKey == -1) {
return baseCompilerSpec;
}
return platformStore.getObjectAt(compilerKey).getCompilerSpec();
}
@Override
public void dbError(IOException e) {
trace.dbError(e);
}
@Override
public void invalidateCache(boolean all) {
languageStore.invalidateCache();
platformStore.invalidateCache();
rangeMappingStore.invalidateCache();
languagesByLanguage.clear();
platformsByCompiler.clear();
try {
loadLanguages();
loadPlatforms();
loadPlatformMappings();
}
catch (LanguageNotFoundException | CompilerSpecNotFoundException | VersionException e) {
throw new AssertionError(e);
}
}
protected void deleteGuestPlatform(DBTraceGuestPlatform platform, TaskMonitor monitor)
throws CancelledException {
try (LockHold hold = LockHold.lock(lock.writeLock())) {
int platformKey = (int) platform.getKey();
trace.getCodeManager().deletePlatform(platform, monitor);
monitor.setMessage("Clearing guest platform range mappings");
monitor.setMaximum(rangeMappingStore.getRecordCount());
for (Iterator<DBTraceGuestPlatformMappedRange> it =
rangeMappingStore.asMap().values().iterator(); it.hasNext();) {
DBTraceGuestPlatformMappedRange range = it.next();
if (platformKey != range.guestPlatformKey) {
continue;
}
it.remove();
}
platformsByCompiler.remove(platform.getCompilerSpec());
platformStore.delete(platform);
}
trace.setChanged(new TraceChangeRecord<>(TracePlatformChangeType.DELETED, null, platform));
}
@Override
public InternalTracePlatform getHostPlatform() {
return hostPlatform;
}
protected DBTraceGuestPlatform doAddGuestPlatform(CompilerSpec compilerSpec) {
DBTraceGuestPlatform platformEntry = platformStore.create();
platformEntry.set(compilerSpec);
platformsByCompiler.put(compilerSpec, platformEntry);
return platformEntry;
}
@Override
public DBTraceGuestPlatform addGuestPlatform(CompilerSpec compilerSpec) {
if (trace.getBaseCompilerSpec() == compilerSpec) {
throw new IllegalArgumentException(
"Base compiler spec cannot be a guest compiler spec");
}
DBTraceGuestPlatform platform;
try (LockHold hold = LockHold.lock(lock.writeLock())) {
platform = doAddGuestPlatform(compilerSpec);
}
trace.setChanged(new TraceChangeRecord<>(TracePlatformChangeType.ADDED, null, platform));
return platform;
}
@Override
public InternalTracePlatform getPlatform(CompilerSpec compilerSpec) {
try (LockHold hold = LockHold.lock(lock.readLock())) {
if (trace.getBaseCompilerSpec() == compilerSpec) {
return hostPlatform;
}
return platformsByCompiler.get(compilerSpec);
}
}
@Override
public InternalTracePlatform getOrAddPlatform(CompilerSpec compilerSpec) {
if (compilerSpec.getCompilerSpecID()
.equals(trace.getBaseCompilerSpec().getCompilerSpecID())) {
return hostPlatform;
}
DBTraceGuestPlatform platform;
try (LockHold hold = LockHold.lock(lock.writeLock())) {
DBTraceGuestPlatform exists = platformsByCompiler.get(compilerSpec);
if (exists != null) {
return exists;
}
platform = doAddGuestPlatform(compilerSpec);
}
trace.setChanged(new TraceChangeRecord<>(TracePlatformChangeType.ADDED, null, platform));
return platform;
}
@Override
public Collection<TraceGuestPlatform> getGuestPlatforms() {
return platformView;
}
@Internal
public InternalTracePlatform assertMine(TracePlatform platform) {
if (platform == hostPlatform) {
return hostPlatform;
}
if (!(platform instanceof DBTraceGuestPlatform)) {
throw new IllegalArgumentException("Given platform does not belong to this trace");
}
DBTraceGuestPlatform dbPlatform = (DBTraceGuestPlatform) platform;
if (dbPlatform.manager != this) {
throw new IllegalArgumentException("Given platform does not belong to this trace");
}
if (dbPlatform.isDeleted()) {
throw new IllegalArgumentException("Given platform has been deleted");
}
return dbPlatform;
}
}
| [
"46821332+nsadeveloper789@users.noreply.github.com"
] | 46821332+nsadeveloper789@users.noreply.github.com |
4607f410101cea509e90528dac595cda9bbb8b33 | 2af99472082c5daee51d5db428d9787cc2621329 | /runelite-client/src/main/java/net/runelite/client/plugins/zulrah/overlays/ZulrahOverlay.java | 0df7095d2b3ec4ea88c04f586640994787c825ea | [
"BSD-2-Clause",
"LicenseRef-scancode-free-unknown"
] | permissive | KenAdams5/runelite | cecfa403ee3f812d94bce51f2ee031042baa272c | 853b5d53749df458c185f7cb403d1728da7cf059 | refs/heads/master | 2020-03-27T18:51:39.096022 | 2018-08-31T22:55:05 | 2018-08-31T22:55:05 | 146,455,283 | 0 | 0 | BSD-2-Clause | 2018-08-28T13:55:10 | 2018-08-28T13:55:09 | null | UTF-8 | Java | false | false | 7,564 | java | package net.runelite.client.plugins.zulrah.overlays;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Polygon;
import java.awt.image.BufferedImage;
import javax.annotation.Nullable;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.client.plugins.zulrah.ZulrahInstance;
import net.runelite.client.plugins.zulrah.ZulrahPlugin;
import net.runelite.client.plugins.zulrah.phase.ZulrahPhase;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayPosition;
@Slf4j
public class ZulrahOverlay extends Overlay
{
private static final Color TILE_BORDER_COLOR = new Color(0, 0, 0, 100);
private static final Color NEXT_TEXT_COLOR = new Color(255, 255, 255, 100);
private final Client client;
private final ZulrahPlugin plugin;
@Inject
ZulrahOverlay(@Nullable Client client, ZulrahPlugin plugin)
{
setPosition(OverlayPosition.DYNAMIC);
this.client = client;
this.plugin = plugin;
}
@Override
public Dimension render(Graphics2D graphics, java.awt.Point point)
{
ZulrahInstance instance = plugin.getInstance();
if (instance == null)
{
return null;
}
ZulrahPhase currentPhase = instance.getPhase();
ZulrahPhase nextPhase = instance.getNextPhase();
if (currentPhase == null)
{
return null;
}
Point startTile = instance.getStartLocation();
if (nextPhase != null && currentPhase.getStandLocation() == nextPhase.getStandLocation())
{
drawStandTiles(graphics, startTile, currentPhase, nextPhase);
}
else
{
drawStandTile(graphics, startTile, currentPhase, false);
drawStandTile(graphics, startTile, nextPhase, true);
}
drawZulrahTileMinimap(graphics, startTile, currentPhase, false);
drawZulrahTileMinimap(graphics, startTile, nextPhase, true);
return null;
}
private void drawStandTiles(Graphics2D graphics, Point startTile, ZulrahPhase currentPhase, ZulrahPhase nextPhase)
{
Point localTile = Perspective.worldToLocal(client, currentPhase.getStandTile(startTile));
localTile = new Point(localTile.getX() + Perspective.LOCAL_TILE_SIZE / 2, localTile.getY() + Perspective.LOCAL_TILE_SIZE / 2);
Polygon northPoly = getCanvasTileNorthPoly(client, localTile);
Polygon southPoly = getCanvasTileSouthPoly(client, localTile);
Polygon poly = Perspective.getCanvasTilePoly(client, localTile);
Point textLoc = Perspective.getCanvasTextLocation(client, graphics, localTile, "Next", 0);
if (northPoly != null && southPoly != null && poly != null && textLoc != null)
{
Color northColor = currentPhase.getColor();
Color southColor = nextPhase.getColor();
graphics.setColor(northColor);
graphics.fillPolygon(northPoly);
graphics.setColor(southColor);
graphics.fillPolygon(southPoly);
graphics.setColor(TILE_BORDER_COLOR);
graphics.setStroke(new BasicStroke(2));
graphics.drawPolygon(poly);
graphics.setColor(NEXT_TEXT_COLOR);
graphics.drawString("Next", textLoc.getX(), textLoc.getY());
}
if (nextPhase.isJad())
{
Image jadPrayerImg = ZulrahImageManager.getProtectionPrayerBufferedImage(nextPhase.getPrayer());
if (jadPrayerImg != null)
{
Point imageLoc = Perspective.getCanvasImageLocation(client, graphics, localTile, (BufferedImage) jadPrayerImg, 0);
if (imageLoc != null)
{
graphics.drawImage(jadPrayerImg, imageLoc.getX(), imageLoc.getY(), null);
}
}
}
}
private void drawStandTile(Graphics2D graphics, Point startTile, ZulrahPhase phase, boolean next)
{
if (phase == null)
{
return;
}
Point localTile = Perspective.worldToLocal(client, phase.getStandTile(startTile));
localTile = new Point(localTile.getX() + Perspective.LOCAL_TILE_SIZE / 2, localTile.getY() + Perspective.LOCAL_TILE_SIZE / 2);
Polygon poly = Perspective.getCanvasTilePoly(client, localTile);
Color color = phase.getColor();
if (poly != null)
{
graphics.setColor(TILE_BORDER_COLOR);
graphics.setStroke(new BasicStroke(2));
graphics.drawPolygon(poly);
graphics.setColor(color);
graphics.fillPolygon(poly);
}
if (next)
{
Point textLoc = Perspective.getCanvasTextLocation(client, graphics, localTile, "Next", 0);
if (textLoc != null)
{
graphics.setColor(NEXT_TEXT_COLOR);
graphics.drawString("Next", textLoc.getX(), textLoc.getY());
}
if (phase.isJad())
{
Image jadPrayerImg = ZulrahImageManager.getProtectionPrayerBufferedImage(phase.getPrayer());
if (jadPrayerImg != null)
{
Point imageLoc = Perspective.getCanvasImageLocation(client, graphics, localTile, (BufferedImage) jadPrayerImg, 0);
if (imageLoc != null)
{
graphics.drawImage(jadPrayerImg, imageLoc.getX(), imageLoc.getY(), null);
}
}
}
}
}
private void drawZulrahTileMinimap(Graphics2D graphics, Point startTile, ZulrahPhase phase, boolean next)
{
if (phase == null)
{
return;
}
Point zulrahLocalTile = Perspective.worldToLocal(client, phase.getZulrahTile(startTile));
Point zulrahMinimapPoint = Perspective.worldToMiniMap(client, zulrahLocalTile.getX(), zulrahLocalTile.getY());
Color color = phase.getColor();
graphics.setColor(color);
graphics.fillOval(zulrahMinimapPoint.getX(), zulrahMinimapPoint.getY(), 5, 5);
graphics.setColor(TILE_BORDER_COLOR);
graphics.setStroke(new BasicStroke(1));
graphics.drawOval(zulrahMinimapPoint.getX(), zulrahMinimapPoint.getY(), 5, 5);
if (next)
{
graphics.setColor(NEXT_TEXT_COLOR);
FontMetrics fm = graphics.getFontMetrics();
graphics.drawString("Next", zulrahMinimapPoint.getX() - fm.stringWidth("Next") / 2, zulrahMinimapPoint.getY() - 2);
}
}
private Polygon getCanvasTileNorthPoly(Client client, Point localLocation)
{
int plane = client.getPlane();
int halfTile = Perspective.LOCAL_TILE_SIZE / 2;
Point p1 = Perspective.worldToCanvas(client, localLocation.getX() - halfTile, localLocation.getY() - halfTile, plane);
Point p2 = Perspective.worldToCanvas(client, localLocation.getX() - halfTile, localLocation.getY() + halfTile, plane);
Point p3 = Perspective.worldToCanvas(client, localLocation.getX() + halfTile, localLocation.getY() + halfTile, plane);
if (p1 == null || p2 == null || p3 == null)
{
return null;
}
Polygon poly = new Polygon();
poly.addPoint(p1.getX(), p1.getY());
poly.addPoint(p2.getX(), p2.getY());
poly.addPoint(p3.getX(), p3.getY());
return poly;
}
private Polygon getCanvasTileSouthPoly(Client client, Point localLocation)
{
int plane = client.getPlane();
int halfTile = Perspective.LOCAL_TILE_SIZE / 2;
Point p1 = Perspective.worldToCanvas(client, localLocation.getX() - halfTile, localLocation.getY() - halfTile, plane);
Point p2 = Perspective.worldToCanvas(client, localLocation.getX() + halfTile, localLocation.getY() + halfTile, plane);
Point p3 = Perspective.worldToCanvas(client, localLocation.getX() + halfTile, localLocation.getY() - halfTile, plane);
if (p1 == null || p2 == null || p3 == null)
{
return null;
}
Polygon poly = new Polygon();
poly.addPoint(p1.getX(), p1.getY());
poly.addPoint(p2.getX(), p2.getY());
poly.addPoint(p3.getX(), p3.getY());
return poly;
}
} | [
"noreply@github.com"
] | noreply@github.com |
4794d8ba1223ed86848b0f6fcb55acf5bf9751ec | 2f3e81442a14142089d8fcfd97503c7d6a61c5e8 | /app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/android/support/coordinatorlayout/R.java | 27290515f7b4ebf30480247fcb90f24a65d879c5 | [] | no_license | esegebart/SnakeGame1-Master | 9665da053694b10dfd899a455505ae075334e57e | ad1678af9d0b0e74394a8cbd33ba25b9fdd03ce7 | refs/heads/master | 2020-07-10T21:24:16.850073 | 2019-08-28T23:53:01 | 2019-08-28T23:53:01 | 204,374,723 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 12,406 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package android.support.coordinatorlayout;
public final class R {
private R() {}
public static final class attr {
private attr() {}
public static final int alpha = 0x7f020027;
public static final int coordinatorLayoutStyle = 0x7f020062;
public static final int font = 0x7f020077;
public static final int fontProviderAuthority = 0x7f020079;
public static final int fontProviderCerts = 0x7f02007a;
public static final int fontProviderFetchStrategy = 0x7f02007b;
public static final int fontProviderFetchTimeout = 0x7f02007c;
public static final int fontProviderPackage = 0x7f02007d;
public static final int fontProviderQuery = 0x7f02007e;
public static final int fontStyle = 0x7f02007f;
public static final int fontVariationSettings = 0x7f020080;
public static final int fontWeight = 0x7f020081;
public static final int keylines = 0x7f020091;
public static final int layout_anchor = 0x7f020094;
public static final int layout_anchorGravity = 0x7f020095;
public static final int layout_behavior = 0x7f020096;
public static final int layout_dodgeInsetEdges = 0x7f020097;
public static final int layout_insetEdge = 0x7f020098;
public static final int layout_keyline = 0x7f020099;
public static final int statusBarBackground = 0x7f0200d4;
public static final int ttcIndex = 0x7f020108;
}
public static final class color {
private color() {}
public static final int notification_action_color_filter = 0x7f040040;
public static final int notification_icon_bg_color = 0x7f040041;
public static final int ripple_material_light = 0x7f04004b;
public static final int secondary_text_default_material_light = 0x7f04004d;
}
public static final class dimen {
private dimen() {}
public static final int compat_button_inset_horizontal_material = 0x7f05004b;
public static final int compat_button_inset_vertical_material = 0x7f05004c;
public static final int compat_button_padding_horizontal_material = 0x7f05004d;
public static final int compat_button_padding_vertical_material = 0x7f05004e;
public static final int compat_control_corner_material = 0x7f05004f;
public static final int compat_notification_large_icon_max_height = 0x7f050050;
public static final int compat_notification_large_icon_max_width = 0x7f050051;
public static final int notification_action_icon_size = 0x7f05005b;
public static final int notification_action_text_size = 0x7f05005c;
public static final int notification_big_circle_margin = 0x7f05005d;
public static final int notification_content_margin_start = 0x7f05005e;
public static final int notification_large_icon_height = 0x7f05005f;
public static final int notification_large_icon_width = 0x7f050060;
public static final int notification_main_column_padding_top = 0x7f050061;
public static final int notification_media_narrow_margin = 0x7f050062;
public static final int notification_right_icon_size = 0x7f050063;
public static final int notification_right_side_padding_top = 0x7f050064;
public static final int notification_small_icon_background_padding = 0x7f050065;
public static final int notification_small_icon_size_as_large = 0x7f050066;
public static final int notification_subtext_size = 0x7f050067;
public static final int notification_top_pad = 0x7f050068;
public static final int notification_top_pad_large_text = 0x7f050069;
}
public static final class drawable {
private drawable() {}
public static final int notification_action_background = 0x7f06005b;
public static final int notification_bg = 0x7f06005c;
public static final int notification_bg_low = 0x7f06005d;
public static final int notification_bg_low_normal = 0x7f06005e;
public static final int notification_bg_low_pressed = 0x7f06005f;
public static final int notification_bg_normal = 0x7f060060;
public static final int notification_bg_normal_pressed = 0x7f060061;
public static final int notification_icon_background = 0x7f060062;
public static final int notification_template_icon_bg = 0x7f060063;
public static final int notification_template_icon_low_bg = 0x7f060064;
public static final int notification_tile_bg = 0x7f060065;
public static final int notify_panel_notification_icon_bg = 0x7f060066;
}
public static final class id {
private id() {}
public static final int action_container = 0x7f07000d;
public static final int action_divider = 0x7f07000f;
public static final int action_image = 0x7f070010;
public static final int action_text = 0x7f070016;
public static final int actions = 0x7f070017;
public static final int async = 0x7f07001e;
public static final int blocking = 0x7f070021;
public static final int bottom = 0x7f070022;
public static final int chronometer = 0x7f070028;
public static final int end = 0x7f070034;
public static final int forever = 0x7f07003a;
public static final int icon = 0x7f07003e;
public static final int icon_group = 0x7f07003f;
public static final int info = 0x7f070046;
public static final int italic = 0x7f070047;
public static final int left = 0x7f070048;
public static final int line1 = 0x7f070049;
public static final int line3 = 0x7f07004a;
public static final int none = 0x7f070051;
public static final int normal = 0x7f070052;
public static final int notification_background = 0x7f070053;
public static final int notification_main_column = 0x7f070054;
public static final int notification_main_column_container = 0x7f070055;
public static final int right = 0x7f07005a;
public static final int right_icon = 0x7f07005b;
public static final int right_side = 0x7f07005c;
public static final int start = 0x7f070076;
public static final int tag_transition_group = 0x7f07007a;
public static final int tag_unhandled_key_event_manager = 0x7f07007b;
public static final int tag_unhandled_key_listeners = 0x7f07007c;
public static final int text = 0x7f07007d;
public static final int text2 = 0x7f07007e;
public static final int time = 0x7f070081;
public static final int title = 0x7f070082;
public static final int top = 0x7f070085;
}
public static final class integer {
private integer() {}
public static final int status_bar_notification_info_maxnum = 0x7f080004;
}
public static final class layout {
private layout() {}
public static final int notification_action = 0x7f09001c;
public static final int notification_action_tombstone = 0x7f09001d;
public static final int notification_template_custom_big = 0x7f09001e;
public static final int notification_template_icon_group = 0x7f09001f;
public static final int notification_template_part_chronometer = 0x7f090020;
public static final int notification_template_part_time = 0x7f090021;
}
public static final class string {
private string() {}
public static final int status_bar_notification_info_overflow = 0x7f0b002c;
}
public static final class style {
private style() {}
public static final int TextAppearance_Compat_Notification = 0x7f0c00ed;
public static final int TextAppearance_Compat_Notification_Info = 0x7f0c00ee;
public static final int TextAppearance_Compat_Notification_Line2 = 0x7f0c00ef;
public static final int TextAppearance_Compat_Notification_Time = 0x7f0c00f0;
public static final int TextAppearance_Compat_Notification_Title = 0x7f0c00f1;
public static final int Widget_Compat_NotificationActionContainer = 0x7f0c0159;
public static final int Widget_Compat_NotificationActionText = 0x7f0c015a;
public static final int Widget_Support_CoordinatorLayout = 0x7f0c015b;
}
public static final class styleable {
private styleable() {}
public static final int[] ColorStateListItem = { 0x10101a5, 0x101031f, 0x7f020027 };
public static final int ColorStateListItem_android_color = 0;
public static final int ColorStateListItem_android_alpha = 1;
public static final int ColorStateListItem_alpha = 2;
public static final int[] CoordinatorLayout = { 0x7f020091, 0x7f0200d4 };
public static final int CoordinatorLayout_keylines = 0;
public static final int CoordinatorLayout_statusBarBackground = 1;
public static final int[] CoordinatorLayout_Layout = { 0x10100b3, 0x7f020094, 0x7f020095, 0x7f020096, 0x7f020097, 0x7f020098, 0x7f020099 };
public static final int CoordinatorLayout_Layout_android_layout_gravity = 0;
public static final int CoordinatorLayout_Layout_layout_anchor = 1;
public static final int CoordinatorLayout_Layout_layout_anchorGravity = 2;
public static final int CoordinatorLayout_Layout_layout_behavior = 3;
public static final int CoordinatorLayout_Layout_layout_dodgeInsetEdges = 4;
public static final int CoordinatorLayout_Layout_layout_insetEdge = 5;
public static final int CoordinatorLayout_Layout_layout_keyline = 6;
public static final int[] FontFamily = { 0x7f020079, 0x7f02007a, 0x7f02007b, 0x7f02007c, 0x7f02007d, 0x7f02007e };
public static final int FontFamily_fontProviderAuthority = 0;
public static final int FontFamily_fontProviderCerts = 1;
public static final int FontFamily_fontProviderFetchStrategy = 2;
public static final int FontFamily_fontProviderFetchTimeout = 3;
public static final int FontFamily_fontProviderPackage = 4;
public static final int FontFamily_fontProviderQuery = 5;
public static final int[] FontFamilyFont = { 0x1010532, 0x1010533, 0x101053f, 0x101056f, 0x1010570, 0x7f020077, 0x7f02007f, 0x7f020080, 0x7f020081, 0x7f020108 };
public static final int FontFamilyFont_android_font = 0;
public static final int FontFamilyFont_android_fontWeight = 1;
public static final int FontFamilyFont_android_fontStyle = 2;
public static final int FontFamilyFont_android_ttcIndex = 3;
public static final int FontFamilyFont_android_fontVariationSettings = 4;
public static final int FontFamilyFont_font = 5;
public static final int FontFamilyFont_fontStyle = 6;
public static final int FontFamilyFont_fontVariationSettings = 7;
public static final int FontFamilyFont_fontWeight = 8;
public static final int FontFamilyFont_ttcIndex = 9;
public static final int[] GradientColor = { 0x101019d, 0x101019e, 0x10101a1, 0x10101a2, 0x10101a3, 0x10101a4, 0x1010201, 0x101020b, 0x1010510, 0x1010511, 0x1010512, 0x1010513 };
public static final int GradientColor_android_startColor = 0;
public static final int GradientColor_android_endColor = 1;
public static final int GradientColor_android_type = 2;
public static final int GradientColor_android_centerX = 3;
public static final int GradientColor_android_centerY = 4;
public static final int GradientColor_android_gradientRadius = 5;
public static final int GradientColor_android_tileMode = 6;
public static final int GradientColor_android_centerColor = 7;
public static final int GradientColor_android_startX = 8;
public static final int GradientColor_android_startY = 9;
public static final int GradientColor_android_endX = 10;
public static final int GradientColor_android_endY = 11;
public static final int[] GradientColorItem = { 0x10101a5, 0x1010514 };
public static final int GradientColorItem_android_color = 0;
public static final int GradientColorItem_android_offset = 1;
}
}
| [
"36378900+esegebart@users.noreply.github.com"
] | 36378900+esegebart@users.noreply.github.com |
5295879676ce0a1cdf00f9e5a5c2585f8062dc4f | 1d5d6f298aad8242f0c4c0f86a666b7e2033d196 | /sharding-jdbc/310/sharding-core-3.1.0-sources/io/shardingsphere/api/config/rule/ShardingRuleConfiguration.java | 11d8ddc1628e98e78a579081e71b41e639180799 | [
"Apache-2.0"
] | permissive | kongq1983/opensourcecode | b0a2c951e24220c22dae3136d1cc5ed7e5230ed9 | 96242fe545e65c41b1a1a3bc9230e49792fa348b | refs/heads/master | 2023-03-06T08:35:13.730272 | 2022-11-15T15:14:57 | 2022-11-15T15:14:57 | 193,943,067 | 0 | 0 | Apache-2.0 | 2023-02-22T07:31:30 | 2019-06-26T16:42:03 | Java | UTF-8 | Java | false | false | 1,690 | java | /*
* Copyright 2016-2018 shardingsphere.io.
* <p>
* 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.
* </p>
*/
package io.shardingsphere.api.config.rule;
import io.shardingsphere.api.config.strategy.ShardingStrategyConfiguration;
import io.shardingsphere.core.keygen.KeyGenerator;
import lombok.Getter;
import lombok.Setter;
import java.util.Collection;
import java.util.LinkedList;
/**
* Sharding rule configuration.
*
* @author zhangliang
* @author maxiaoguang
*/
@Getter
@Setter
public final class ShardingRuleConfiguration implements RuleConfiguration {
private String defaultDataSourceName;
private Collection<TableRuleConfiguration> tableRuleConfigs = new LinkedList<>();
private Collection<String> bindingTableGroups = new LinkedList<>();
private Collection<String> broadcastTables = new LinkedList<>();
private ShardingStrategyConfiguration defaultDatabaseShardingStrategyConfig;
private ShardingStrategyConfiguration defaultTableShardingStrategyConfig;
private KeyGenerator defaultKeyGenerator;
private Collection<MasterSlaveRuleConfiguration> masterSlaveRuleConfigs = new LinkedList<>();
}
| [
"king@qq.com"
] | king@qq.com |
98fdb830582db72d6aacb5d69e920a5a31c7daba | 82feb0c1928b2af1bb05550c4a302d4b5093ea23 | /src/cn/erpreport/it/privilege/vo/UserVO.java | f0148149ca34add6e3fb928eebe9e98a9b402672 | [] | no_license | liuhao0813/csmdemo | 1f335661fdeab4f4547a26c122bfd0cdc9d3f9a9 | 2e0f51f8c6da11b7b13bd7b11476e7a2f205289b | refs/heads/master | 2021-01-23T18:00:16.846014 | 2018-07-03T23:50:14 | 2018-07-03T23:50:14 | 19,441,905 | 6 | 5 | null | null | null | null | UTF-8 | Java | false | false | 2,751 | java | package cn.erpreport.it.privilege.vo;
import java.util.List;
import cn.erpreport.it.common.BaseVO;
/**
* 用户VO
*/
public class UserVO extends BaseVO{
private static final long serialVersionUID = 1L;
/**
* 用户ID
*/
private Integer userId;
/**
* 用户名
*/
private String userName;
/**
* 用户密码
*/
private String password;
private String sex;
private String defaultRole;
private String email;
private String phone;
private String fax;
private String beginDate;
private String endDate;
/**
* 用户状态
*/
private Integer status;
/**
* 最后一次登录时间
*/
private String lastLogin;
/**
* 用户对应的角色信息
*/
private List<RoleVO> listRoles;
/**
* 用户授权的菜单信息
*/
private List<MenuVO> listMenus;
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public List<RoleVO> getListRoles() {
return listRoles;
}
public void setListRoles(List<RoleVO> listRoles) {
this.listRoles = listRoles;
}
public List<MenuVO> getListMenus() {
return listMenus;
}
public void setListMenus(List<MenuVO> listMenus) {
this.listMenus = listMenus;
}
public String getLastLogin() {
return lastLogin;
}
public void setLastLogin(String lastLogin) {
this.lastLogin = lastLogin;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getSex() {
return sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public String getDefaultRole() {
return defaultRole;
}
public void setDefaultRole(String defaultRole) {
this.defaultRole = defaultRole;
}
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 getFax() {
return fax;
}
public void setFax(String fax) {
this.fax = fax;
}
public String getBeginDate() {
return beginDate;
}
public void setBeginDate(String beginDate) {
this.beginDate = beginDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
}
| [
"liu_hao0813@foxmail.com"
] | liu_hao0813@foxmail.com |
daf3b4d06d3de72574c5edb5519bb3a2f0359370 | 0631ecb02d269218a6388376f3af87952ed4cb5e | /src/controler/ShowEditFormServlet.java | d1217e5de2b2c23dfaa9ed3c86fbf183d64c74a1 | [] | no_license | di-nethra/Online-Drug-Ordering-jsp_servlet | c0b085caa43f92204cd5878490473d15f196c92d | 0d8614791703104b91a4f1a529e0782601353d15 | refs/heads/master | 2023-05-11T11:42:23.040484 | 2021-05-28T07:46:56 | 2021-05-28T07:46:56 | 363,976,014 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,586 | java | package controler;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
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 model.SelectUser;
import model.User;
/**
* Servlet implementation class ShowEditFormServlet
*/
@WebServlet("/ShowEditFormServlet")
public class ShowEditFormServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private SelectUser SelectUser=new SelectUser();
/**
* @see HttpServlet#HttpServlet()
*/
public ShowEditFormServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
int id = Integer.parseInt(request.getParameter("id"));
User existingUser = SelectUser.selectUser(id);
RequestDispatcher dispatcher = request.getRequestDispatcher("user-form.jsp");
request.setAttribute("user", existingUser);
dispatcher.forward(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"anjana.dinethra@gmail.com"
] | anjana.dinethra@gmail.com |
9afaf3de38a48fd8b7623bf9686fc67aaffb38a5 | 81967a168d763cdfce589496cb60dd88fcc4fe1f | /src/main/java/com/thrift/client/ThriftClient.java | 2887949647152947ee32b62f1cccb53dcab71978 | [] | no_license | lebron374/thriftDemo | 0132e6a10d6bb7d68020de01dd03e305b47f999b | 932860b30e2d1229065cdd252732b4ef7aac3e83 | refs/heads/master | 2021-05-07T23:08:50.433655 | 2017-10-18T11:14:34 | 2017-10-18T11:14:34 | 107,397,059 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,254 | java | package com.thrift.client;
import com.alibaba.fastjson.JSON;
import com.thrift.rpc.Operation;
import com.thrift.rpc.input;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
/**
* Created by zhi.wang on 2017/10/18.
*/
public class ThriftClient {
public static void main(String[] args) {
try {
TTransport transport = new TSocket("localhost", 8088);
transport.open();
TProtocol protocol = new TBinaryProtocol(transport);
Operation.Client client = new Operation.Client(protocol);
input input = new input();
input.setParam1("100");
input.setParam2("50");
System.out.println(JSON.toJSONString(client.add(input)));
System.out.println(JSON.toJSONString(client.sub(input)));
System.out.println(JSON.toJSONString(client.divide(input)));
System.out.println(JSON.toJSONString(client.multiplication(input)));
System.out.println(JSON.toJSONString(client.alive()));
} catch (Exception e) {
e.printStackTrace();
} finally {
}
}
}
| [
"zhi.wang@husor.com"
] | zhi.wang@husor.com |
3e3464705510a451779c6872acb52fc5c1c51d01 | ec31812fa9658cd77ae6d06e4da1d625fa66ee49 | /PXL_DIGITAL_JAAR_1/Java Essentials/Oplossingen/H10/oefening2/VliegtuigReis.java | 36ab561417e9d00e41fa421c5cb6f569c365f96a | [
"MIT"
] | permissive | MatthiasWillemsPXL/PXL-DIGITAL | a69e40e3fcbd82eea5f78368d0568521ee937bc3 | fe8440145a4cb75b66aaaa8e74a92cac0d58dcc8 | refs/heads/master | 2023-03-08T03:12:04.971764 | 2021-02-22T20:29:10 | 2021-02-22T20:29:10 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 917 | java | package oefening2;
public class VliegtuigReis extends Reis {
private String vluchtnummer;
private final int MINPRIJS = 25;
public VliegtuigReis(String bestemming) {
this(bestemming, 0, bestemming.substring(0, 1).concat("999"));
}
public VliegtuigReis(String bestemming, double prijs, String vluchtnummer) {
super(bestemming, prijs);
this.vluchtnummer = vluchtnummer;
}
public String getVluchtnummer() {
return vluchtnummer;
}
public void setVluchtnummer(String vluchtnummer) {
this.vluchtnummer = vluchtnummer;
String EersteLetter = this.getBestemming().substring(0, 1);
if (!this.vluchtnummer.substring(0, 1).equals(EersteLetter)) {
this.vluchtnummer = EersteLetter.concat(this.vluchtnummer);
}
}
public int getMINPRIJS() {
return MINPRIJS;
}
@Override
public void print() {
super.print();
System.out.println("Vliegtuigreis (vluchtnr " + this.vluchtnummer + ")");
}
}
| [
"dj-joa@hotmail.be"
] | dj-joa@hotmail.be |
245ef42b78f7f6c3fe81af3d3ebd97042c38cbbd | b8f82e098fc0ad45122c3d946db2e7a655bee1d9 | /src/main/java/bruce/jvminjava/rtda/OperandStack.java | c2f8188ac414b57dc90e99ee188d05f2478c8411 | [] | no_license | BruceYuan1993/jvminjava | 620bb6ecbfcfd197b1378557a517cdcacacaa890 | ce62e41910dd0148ad74fbd3905da6e83a6baa23 | refs/heads/master | 2021-06-24T17:36:25.154085 | 2019-07-16T07:26:22 | 2019-07-16T07:26:22 | 142,538,793 | 2 | 0 | null | 2020-10-13T09:04:20 | 2018-07-27T06:46:26 | Java | UTF-8 | Java | false | false | 1,980 | java | package bruce.jvminjava.rtda;
import bruce.jvminjava.rtda.heap.Object;
public class OperandStack {
public Slot[] slots;
int size;
public OperandStack(int size){
if (size > 0){
slots = new Slot[size];
for (int i = 0; i< size; i++){
slots[i] = new Slot();
}
}
}
public void pushInt(int val){
slots[size].setNum(val);
size++;
}
public int popInt(){
size--;
return slots[size].getNum();
}
public void pushFloat(float val){
slots[size].setNum(Float.floatToIntBits(val));
size++;
}
public float popFloat(){
size--;
return Float.intBitsToFloat(slots[size].getNum());
}
public void pushLong(long val){
slots[size].setNum((int)val);
slots[size+1].setNum((int)(val>>32));
size += 2;
}
public long popLong(){
size -= 2;
int num1 = slots[size].getNum();
int num2 = slots[size+1].getNum();
long l1 = (num2&0x00000000ffffffffL)<<32;
long l2 = num1&0x00000000ffffffffL;
return l1|l2;
}
public void pushDouble(double val){
long i = Double.doubleToLongBits(val);
pushLong(i);
}
public double popDouble(){
long i = popLong();
return Double.longBitsToDouble(i);
}
public void pushRef(Object val){
slots[size].setRef(val);
size++;
}
public Object popRef(){
size--;
return slots[size].getRef();
}
public void pushSlot(Slot slot) {
Slot copy = new Slot();
copy.setNum(slot.getNum());
copy.setRef(slot.getRef());
slots[size] = copy;
size++;
}
public Slot popSlot() {
size--;
return slots[size];
}
public int getSize() {
return size;
}
public Object getRefFromTop(int n) {
// TODO Auto-generated method stub
return slots[size -1 - n].getRef();
}
public void pushBoolean(boolean val) {
if (val) {
this.pushInt(1);
} else {
this.pushInt(0);
}
}
public boolean popBoolean() {
return this.popInt() == 1;
}
}
| [
"bruceyuan@augmentum.com.cn"
] | bruceyuan@augmentum.com.cn |
71531c8ff878822ceaf26ed6e068bc5c242c7418 | 8adffe03f0bf072b985e12763fb2bb2d36c83dd5 | /businessDelegatePattern/src/services/BusinessService.java | 42b1e16ba13d9b6c7907a65f69e716b2f721a782 | [] | no_license | LakruwanPathirage/businessDelegatePattern | 6165228802bf0b81797b33082e99c1f9bf864e2a | 05d6701ed1ed56364c630457d283e9e01e1348b8 | refs/heads/master | 2021-03-16T02:30:15.379962 | 2020-03-12T17:39:54 | 2020-03-12T17:39:54 | 246,896,351 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 87 | java | package services;
public interface BusinessService {
public void process();
}
| [
"lakruwanpathirage01@gmail.com"
] | lakruwanpathirage01@gmail.com |
ba4bf1ff5223b6767f8c265f1ba96c0e45300ac6 | 9bd64ab4f1bad1aa3f06cabcc7386b216b8e70bb | /src/main/java/com/forquality/crud/config/LiquibaseConfiguration.java | b61eab062100d29820f8432c6857498590e84880 | [] | no_license | BulkSecurityGeneratorProject/crud-universidade | cf3332823c119ac09cdcdfda7d6d18feb3c2703d | 6f31d0b8732e30f246aba441856f16343e376140 | refs/heads/master | 2022-12-18T02:37:56.660855 | 2020-03-02T21:05:45 | 2020-03-02T21:05:45 | 296,570,861 | 0 | 0 | null | 2020-09-18T09:07:14 | 2020-09-18T09:07:13 | null | UTF-8 | Java | false | false | 2,154 | java | package com.forquality.crud.config;
import javax.sql.DataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.liquibase.LiquibaseProperties;
import org.springframework.cache.CacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;
import org.springframework.core.task.TaskExecutor;
import io.github.jhipster.config.JHipsterConstants;
import io.github.jhipster.config.liquibase.AsyncSpringLiquibase;
import liquibase.integration.spring.SpringLiquibase;
@Configuration
public class LiquibaseConfiguration {
private final Logger log = LoggerFactory.getLogger(LiquibaseConfiguration.class);
private final Environment env;
private final CacheManager cacheManager;
public LiquibaseConfiguration(Environment env, CacheManager cacheManager) {
this.env = env;
this.cacheManager = cacheManager;
}
@Bean
public SpringLiquibase liquibase(@Qualifier("taskExecutor") TaskExecutor taskExecutor,
DataSource dataSource, LiquibaseProperties liquibaseProperties) {
// Use liquibase.integration.spring.SpringLiquibase if you don't want Liquibase to start asynchronously
SpringLiquibase liquibase = new AsyncSpringLiquibase(taskExecutor, env);
liquibase.setDataSource(dataSource);
liquibase.setChangeLog("classpath:config/liquibase/master.xml");
liquibase.setContexts(liquibaseProperties.getContexts());
liquibase.setDefaultSchema(liquibaseProperties.getDefaultSchema());
liquibase.setDropFirst(liquibaseProperties.isDropFirst());
liquibase.setChangeLogParameters(liquibaseProperties.getParameters());
if (env.acceptsProfiles(JHipsterConstants.SPRING_PROFILE_NO_LIQUIBASE)) {
liquibase.setShouldRun(false);
} else {
liquibase.setShouldRun(liquibaseProperties.isEnabled());
log.debug("Configuring Liquibase");
}
return liquibase;
}
}
| [
"johnatanbrayan1@gmail.com"
] | johnatanbrayan1@gmail.com |
f767de4798b012c084bb24e48176ccd697c5550c | 1d80aa0f29971a0e0806cdc20701c8f2b1119742 | /src/main/java/cn/tomoya/module/index/controller/IndexController.java | 384a4ea6621d124f3f3b00068618bb5c4b67bc67 | [
"MIT"
] | permissive | songxx1989/pybbs | 184e001e1cb6710a5351f9713d523d33f66d96f0 | 1c5cc65e6a7508b02904e28f047bbc62f9d051ed | refs/heads/master | 2021-01-12T10:41:13.236249 | 2016-11-01T09:17:50 | 2016-11-01T09:17:50 | 72,609,878 | 1 | 0 | null | 2016-11-02T06:17:29 | 2016-11-02T06:17:29 | null | UTF-8 | Java | false | false | 4,668 | java | package cn.tomoya.module.index.controller;
import cn.tomoya.common.BaseController;
import cn.tomoya.common.config.SiteConfig;
import cn.tomoya.exception.Result;
import cn.tomoya.module.topic.entity.Topic;
import cn.tomoya.module.topic.service.TopicService;
import cn.tomoya.module.user.entity.User;
import cn.tomoya.module.user.service.UserService;
import cn.tomoya.util.FileUploadEnum;
import cn.tomoya.util.FileUtil;
import cn.tomoya.util.identicon.Identicon;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Date;
import java.util.UUID;
/**
* Created by tomoya.
* Copyright (c) 2016, All Rights Reserved.
* http://tomoya.cn
*/
@Controller
public class IndexController extends BaseController {
@Autowired
private TopicService topicService;
@Autowired
private UserService userService;
@Autowired
private SiteConfig siteConfig;
@Autowired
private Identicon identicon;
@Autowired
private FileUtil fileUtil;
/**
* 首页
*
* @return
*/
@GetMapping("/")
public String index(String tab, Integer p, Model model) {
String sectionName = tab;
if (StringUtils.isEmpty(tab)) tab = "全部";
if (tab.equals("全部") || tab.equals("精华") || tab.equals("等待回复")) {
sectionName = "版块";
}
Page<Topic> page = topicService.page(p == null ? 1 : p, siteConfig.getPageSize(), tab);
model.addAttribute("page", page);
model.addAttribute("tab", tab);
model.addAttribute("sectionName", sectionName);
model.addAttribute("user", getUser());
return render("/index");
}
/**
* 进入登录页
*
* @return
*/
@GetMapping("/login")
public String toLogin(String s, Model model, HttpServletResponse response) {
if (getUser() != null) {
return redirect(response, "/");
}
model.addAttribute("s", s);
return render("/login");
}
/**
* 进入注册页面
*
* @return
*/
@GetMapping("/register")
public String toRegister(HttpServletResponse response) {
if (getUser() != null) {
return redirect(response, "/");
}
return render("/register");
}
/**
* 注册验证
*
* @param username
* @param password
* @return
*/
@PostMapping("/register")
public String register(String username, String password, HttpServletResponse response, Model model) {
User user = userService.findByUsername(username);
if (user != null) {
model.addAttribute("errors", "用户名已经被注册");
} else if (StringUtils.isEmpty(username)) {
model.addAttribute("errors", "用户名不能为空");
} else if (StringUtils.isEmpty(password)) {
model.addAttribute("errors", "密码不能为空");
} else {
String avatarName = UUID.randomUUID().toString();
identicon.generator(avatarName);
user = new User();
user.setUsername(username);
user.setPassword(new BCryptPasswordEncoder().encode(password));
user.setInTime(new Date());
user.setAvatar(siteConfig.getBaseUrl() + "static/images/avatar/" + avatarName + ".png");
userService.save(user);
return redirect(response, "/login?s=reg");
}
return render("/register");
}
/**
* 上传
*
* @param file
* @return
*/
@GetMapping("/upload")
@ResponseBody
public Result upload(@RequestParam("file") MultipartFile file) {
if (!file.isEmpty()) {
try {
String requestUrl = fileUtil.uploadFile(file, FileUploadEnum.FILE);
return Result.success(requestUrl);
} catch (IOException e) {
e.printStackTrace();
return Result.error("上传失败");
}
}
return Result.error("文件不存在");
}
}
| [
"liuyangyang@ichefeng.com"
] | liuyangyang@ichefeng.com |
8ccd198574e544270a43d9bdb6b9ba5d5a9b024f | ae5ca62bc5bc6b73f6888818c921a0e6c999b116 | /app/src/main/java/com/felix/travel/fragment/TravelViewPager.java | ca78ff06c65679bc6c7433ce8c6cd739f2af26bf | [] | no_license | photolife168/FelixTravel | 45e3977c1efa7608c4b7b749c39ab0f6ff12906f | a209bde083686877b9091db41a29843e73f05f6a | refs/heads/master | 2020-07-02T23:59:23.061581 | 2017-04-06T15:14:26 | 2017-04-06T15:14:26 | 74,211,294 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,182 | java | package com.felix.travel.fragment;
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;
import java.util.ArrayList;
import java.util.List;
/**
* Created by felixlin on 2016/11/20.
*/
public class TravelViewPager extends ViewPager {
public List<Fragment> fragmentList = new ArrayList<Fragment>();
public TravelViewPager(Context context) {
super(context);
init();
}
public TravelViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
@Override
public boolean onInterceptTouchEvent(MotionEvent ev) {
return super.onInterceptTouchEvent(ev);
}
@Override
public boolean onTouchEvent(MotionEvent ev) {
return super.onTouchEvent(ev);
}
public List<Fragment> getFragmentList() {
return fragmentList;
}
private void init() {
fragmentList.add(TravelAreaFragment.newInstance());
fragmentList.add(TravelPlanFragment.newInstance());
fragmentList.add(TravelFoodFragment.newInstance());
}
}
| [
"runafter400d@gmail.com"
] | runafter400d@gmail.com |
ab2e4c41afe737d883b3f776af56abf1cc8988eb | db93a8f232103c763ffb9b958a9ab28d1fb883ba | /bundles/eclipseworkbench.compability/src/org/eclipse/ui/texteditor/DeleteLineAction.java | a7a2c097aee6e0b477db2b1e369db1c9609f83de | [] | no_license | Lulle74/Eclipse3-Workbench-Mock-Facade | f021c0caae284775b8d3bd42dcff151e60caae9e | 0190fb8ecb167e76c1b5f2d5cc73aa3912f6c7d2 | refs/heads/master | 2021-04-09T11:39:54.665409 | 2019-10-09T13:07:33 | 2019-10-09T13:07:33 | 125,486,624 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,564 | 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
* Tom Eicher (Avaloq Evolution AG) - block selection mode
*******************************************************************************/
package org.eclipse.ui.texteditor;
import java.util.ResourceBundle;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.ITextSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionProvider;
/**
* An action to delete a whole line, the fraction of the line that is left from the cursor
* or the fraction that is right from the cursor.
*
* @since 2.0
*/
public class DeleteLineAction extends TextEditorAction {
/**
* Delete the whole line.
*/
public static final int WHOLE= 0;
/**
* Delete to the beginning of line.
*/
public static final int TO_BEGINNING= 1;
/**
* Delete to the end of line.
*/
public static final int TO_END= 2;
/**
* The type of deletion.
*/
private final int fType;
/**
* Should the deleted line be copied to the clipboard.
* @since 2.1
*/
private final boolean fCopyToClipboard;
/** The deletion target.
* @since 2.1
*/
private IDeleteLineTarget fTarget;
/**
* Creates a line deletion action.
*
* @param bundle the resource bundle for UI strings
* @param prefix the prefix for the property keys into <code>bundle</code>
* @param editor the editor
* @param type the line deletion type, must be one of <code>WHOLE_LINE</code>,
* <code>TO_BEGINNING</code> or <code>TO_END</code>
*/
public DeleteLineAction(ResourceBundle bundle, String prefix, ITextEditor editor, int type) {
this(bundle, prefix, editor, type, true);
}
/**
* Creates a line deletion action.
*
* @param bundle the resource bundle for UI strings
* @param prefix the prefix for the property keys into <code>bundle</code>
* @param editor the editor
* @param type the line deletion type, must be one of
* <code>WHOLE_LINE</code>, <code>TO_BEGINNING</code> or <code>TO_END</code>
* @param copyToClipboard if <code>true</code>, the contents of the deleted line are copied to the clipboard
* @since 2.1
*/
public DeleteLineAction(ResourceBundle bundle, String prefix, ITextEditor editor, int type, boolean copyToClipboard) {
super(bundle, prefix, editor);
fType= type;
fCopyToClipboard= copyToClipboard;
update();
}
/**
* Creates a line deletion action.
*
* @param editor the editor
* @param type the line deletion type, must be one of <code>WHOLE_LINE</code>,
* <code>TO_BEGINNING</code> or <code>TO_END</code>
* @param copyToClipboard if <code>true</code>, the contents of the deleted line are copied to
* the clipboard
* @since 3.5
*/
public DeleteLineAction(ITextEditor editor, int type, boolean copyToClipboard) {
this(EditorMessages.getBundleForConstructedKeys(), getPrefix(type, copyToClipboard), editor, type, copyToClipboard);
}
/**
* Returns the default resource bundle prefix for the given arguments.
*
* @param type the line deletion type, must be one of <code>WHOLE_LINE</code>,
* <code>TO_BEGINNING</code> or <code>TO_END</code>
* @param copyToClipboard if <code>true</code>, the contents of the deleted line are copied to
* the clipboard
* @return the prefix for the property keys into <code>bundle</code>
* @since 3.5
*/
private static String getPrefix(int type, boolean copyToClipboard) {
switch (type) {
case WHOLE:
return copyToClipboard ? "Editor.CutLine." : "Editor.DeleteLine."; //$NON-NLS-1$ //$NON-NLS-2$
case TO_BEGINNING:
return copyToClipboard ? "Editor.CutLineToBeginning." : "Editor.DeleteLineToBeginning."; //$NON-NLS-1$ //$NON-NLS-2$
case TO_END:
return copyToClipboard ? "Editor.CutLineToEnd." : "Editor.DeleteLineToEnd."; //$NON-NLS-1$ //$NON-NLS-2$
default:
Assert.isLegal(false);
return ""; //$NON-NLS-1$
}
}
/**
* Returns the editor's document.
*
* @param editor the editor
* @return the editor's document
*/
private static IDocument getDocument(ITextEditor editor) {
IDocumentProvider documentProvider= editor.getDocumentProvider();
if (documentProvider == null)
return null;
IDocument document= documentProvider.getDocument(editor.getEditorInput());
if (document == null)
return null;
return document;
}
/**
* Returns the editor's selection.
*
* @param editor the editor
* @return the editor's selection
*/
private static ITextSelection getSelection(ITextEditor editor) {
ISelectionProvider selectionProvider= editor.getSelectionProvider();
if (selectionProvider == null)
return null;
ISelection selection= selectionProvider.getSelection();
if (!(selection instanceof ITextSelection))
return null;
return (ITextSelection) selection;
}
@Override
public void run() {
if (fTarget == null)
return;
ITextEditor editor= getTextEditor();
if (editor == null)
return;
if (!validateEditorInputState())
return;
IDocument document= getDocument(editor);
if (document == null)
return;
ITextSelection selection= getSelection(editor);
if (selection == null)
return;
try {
if (fTarget instanceof TextViewerDeleteLineTarget)
((TextViewerDeleteLineTarget) fTarget).deleteLine(document, selection, fType, fCopyToClipboard);
else
fTarget.deleteLine(document, selection.getOffset(), selection.getLength(), fType, fCopyToClipboard);
} catch (BadLocationException e) {
// should not happen
}
}
@Override
public void update() {
super.update();
if (!isEnabled())
return;
if (!canModifyEditor()) {
setEnabled(false);
return;
}
ITextEditor editor= getTextEditor();
if (editor != null)
fTarget= editor.getAdapter(IDeleteLineTarget.class);
else
fTarget= null;
setEnabled(fTarget != null);
}
}
| [
"erik.lundstrom@solme.se"
] | erik.lundstrom@solme.se |
e4cad0ce143c768ceb534fce00beea4916ef4279 | ca030864a3a1c24be6b9d1802c2353da4ca0d441 | /classes6.dex_source_from_JADX/com/facebook/zero/DefaultZeroDeltaHandler.java | 35570d83dd65d0784d2a2c6a1d68bdfad9bb7c7d | [] | no_license | pxson001/facebook-app | 87aa51e29195eeaae69adeb30219547f83a5b7b1 | 640630f078980f9818049625ebc42569c67c69f7 | refs/heads/master | 2020-04-07T20:36:45.758523 | 2018-03-07T09:04:57 | 2018-03-07T09:04:57 | 124,208,458 | 4 | 0 | null | null | null | null | UTF-8 | Java | false | false | 299 | java | package com.facebook.zero;
import com.facebook.inject.InjectorLike;
/* compiled from: com.facebook.platform.extra.FRIENDS */
public class DefaultZeroDeltaHandler {
public static DefaultZeroDeltaHandler m28832a(InjectorLike injectorLike) {
return new DefaultZeroDeltaHandler();
}
}
| [
"son.pham@jmango360.com"
] | son.pham@jmango360.com |
134d38eb4d62d64f0ac1dd4092a77dc601c31ed6 | 920fae6ee19e08b1819b219511b2e5cda0a7338e | /src/org/rlcommunity/environments/octopus/config/TargetSpec.java | 9c816e11e7db883da3332f346b0f661530a26b02 | [] | no_license | bradknox/tamerproject | f3855f6d7654664b0451049b7bc87da016376f60 | 37c54815504c9df5361cd756f259b3142198a2ab | refs/heads/master | 2021-01-02T23:07:32.111505 | 2018-10-18T15:31:51 | 2018-10-18T15:31:51 | 32,704,868 | 3 | 6 | null | null | null | null | UTF-8 | Java | false | false | 2,777 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.0-b26-ea3
// 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: 2006.05.02 at 05:14:34 PM EDT
//
package org.rlcommunity.environments.octopus.config;
import java.util.ArrayList;
import java.util.List;
import org.rlcommunity.environments.octopus.config.ObjectiveSpec;
import org.rlcommunity.environments.octopus.config.TargetSpec;
/**
* <p>Java class for TargetSpec complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="TargetSpec">
* <complexContent>
* <extension base="{}ObjectiveSpec">
* <attribute name="position" type="{}Duple" />
* <attribute name="reward" type="{http://www.w3.org/2001/XMLSchema}double" />
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
public class TargetSpec
extends ObjectiveSpec
{
protected List<Double> position;
protected Double reward;
public TargetSpec(double[] positionArray, double reward){
position=new ArrayList<Double>();
for (double d : positionArray) {
position.add(d);
}
this.reward=reward;
}
/**
* Gets the value of the position property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the position property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getPosition().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Double }
*
*
*/
public List<Double> getPosition() {
if (position == null) {
position = new ArrayList<Double>();
}
return this.position;
}
/**
* Gets the value of the reward property.
*
* @return
* possible object is
* {@link Double }
*
*/
public Double getReward() {
return reward;
}
/**
* Sets the value of the reward property.
*
* @param value
* allowed object is
* {@link Double }
*
*/
public void setReward(Double value) {
this.reward = value;
}
}
| [
"wbradleyknox@gmail.com@211e96c9-e30a-a9fb-192c-a0af1cbd6eb3"
] | wbradleyknox@gmail.com@211e96c9-e30a-a9fb-192c-a0af1cbd6eb3 |
5dbbc095614718a65fcecf6e8033dba04169e5de | 4482bb07aaae0f901fa48f74127f416ddbcf56f9 | /projects/org.eclipse.epsilon.evl.engine.distributed.crossflow/src-gen/org/eclipse/epsilon/evl/distributed/crossflow/ConfigConfigTopicConsumer.java | 0e053e7ba47f5e7df8dcd39fcc0b53ca96fb82f8 | [] | no_license | SMadani/PhD | 931add010375b6df64fd4bf43fba0c8c85bc4d3b | 18c44b0126d22eb50a4dad4719a41e025402a337 | refs/heads/master | 2023-02-18T04:55:53.011207 | 2021-01-20T19:38:17 | 2021-01-20T19:38:17 | 275,636,801 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 427 | java | /** This class was automatically generated and should not be modified */
package org.eclipse.epsilon.evl.distributed.crossflow;
import javax.annotation.Generated;
@Generated(value = "org.eclipse.scava.crossflow.java.Steam2Consumer", date = "2019-11-30T17:04:27.022703400Z")
public interface ConfigConfigTopicConsumer {
void consumeConfigConfigTopicWithNotifications(Config validationResult) throws Exception;
} | [
"sinadoom@googlemail.com"
] | sinadoom@googlemail.com |
5cb64d9ca5c08788c8aed54634c6579c92a502c9 | 2b6cef034bc00b084dcabd187a56bb00b4bc291b | /src/ui/ShopManagementApplication.java | fc8c05ee311b1445bcfaf8ec627df4b2a596f986 | [] | no_license | JessieDing/ShopManagement | 612a5be288aedef538ee81d6d9bbb5a1e3a08b09 | 89d0c853fb9069c1ab5b6b40eaffa72c959cebd3 | refs/heads/master | 2020-05-20T20:23:11.754628 | 2017-07-07T14:33:38 | 2017-07-07T14:33:38 | 84,519,153 | 0 | 1 | null | null | null | null | GB18030 | Java | false | false | 5,397 | java | package ui;
import business.Goods;
import business.Provider;
import business.TransFactory;
import business.Transaction;
import database.DatabaseOperator;
import java.text.ParseException;
import java.util.Calendar;
import java.util.Scanner;
public class ShopManagementApplication {
public static void main(String[] args) throws ParseException {
// 1.首先打印菜单主界面
// 2.客户选择交易后,进入各个交易对应的操作/提示界面
// 3.客户完成输入后,从界面读取客户输入的数据
// 4.执行该交易,并且打印执行结果
Scanner scan = new Scanner(System.in);
DatabaseOperator databaseOperator = new DatabaseOperator();// 数据操作对象
// initTestData(databaseOperator);
databaseOperator.loadAllGoods();
while (true) {
printMainMenu(); // 打印主菜单
String strTrans = scan.next();// 读取交易
if (strTrans.equalsIgnoreCase("q")) {
break;
}
Transaction trans;
TransFactory tFactory = new TransFactory();
trans = tFactory.createTrans(strTrans);
if (trans != null) {
trans.setDatabaseOperator(databaseOperator);
trans.printPrompt();// 打印交易提示信息
if (trans.getInput() != 0) {// 读取输入的数据
trans.printResult();
System.out.println("获取输入数据失败");
} else {
if (trans.process() != 0) {
trans.printResult();
} else {
trans.printResult();
}
}
} else {
System.out.println("创建交易实例出错");
}
}
scan.close();
System.out.println("系统正常退出");
}
private static void initTestData(DatabaseOperator databaseOperator) throws ParseException {
Calendar c = Calendar.getInstance();
c.set(Calendar.YEAR, 2016);
c.set(Calendar.MONTH, 11);
c.set(Calendar.DATE, 30);
// 添加测试数据
Goods g1 = new Goods("00010001", "华为P8", "部", "0", 120);
Goods g2 = new Goods("00020002", "华为麦芒", "部", "0", 120);
Goods g3 = new Goods("00030003", "Iphone7", "部", "0", 120);
Goods g4 = new Goods("00040004", "红米2", "部", "0", 120);
databaseOperator.insertGoods(g1);
databaseOperator.insertGoods(g2);
databaseOperator.insertGoods(g3);
databaseOperator.insertGoods(g4);
Provider p1 = new Provider("0001", "迅捷通讯", "天府三街", "02811111111", "0");
Provider p2 = new Provider("0002", "迪信通", "天府二街", "02822222222", "0");
Provider p3 = new Provider("0003", "赛格", "太升南路", "02833333333", "0");
Provider p4 = new Provider("0004", "新世界", "天府五街", "02844444444", "0");
databaseOperator.insertProvider(p1);
databaseOperator.insertProvider(p2);
databaseOperator.insertProvider(p3);
databaseOperator.insertProvider(p4);
// 采购 测试数据
// DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
// Purchase purchase1 = new Purchase("00010001", "华为P8", 8, "部", 2000, dateFormat.parse("2017-03-13"), "迪信通");
// Purchase purchase2 = new Purchase("00020002", "华为麦芒", 6, "部", 1765.5, dateFormat.parse("2017-03-16"), "迅捷");
// Purchase purchase3 = new Purchase("00030003", "Iphone7", 10, "部", 4890.5, dateFormat.parse("2017-03-12"), "赛格");
// Purchase purchase4 = new Purchase("00040004", "红米2", 10, "部", 275.5, dateFormat.parse("2017-03-15"), "新世界");
// dbhelper.insertPurchase(purchase1);
// dbhelper.insertPurchase(purchase2);
// dbhelper.insertPurchase(purchase3);
// dbhelper.insertPurchase(purchase4);
// 销售 测试数据
// Sale sale1 = new Sale("00010001", "华为P8", 6, 3000, dateFormat.parse("2017-03-16"));
// Sale sale2 = new Sale("00030003", "Iphone7", 3, 7299, dateFormat.parse("2017-03-16"));
// Sale sale3 = new Sale("00020002", "华为麦芒", 5, 2699, dateFormat.parse("2017-03-16"));
// Sale sale4 = new Sale("00040004", "红米2", 8, 599, dateFormat.parse("2017-03-16"));
// Sale sale5 = new Sale("00030003", "Iphone7", 5, 6999, dateFormat.parse("2017-03-13"));
// dbhelper.insertSale(sale1);
// dbhelper.insertSale(sale2);
// dbhelper.insertSale(sale3);
// dbhelper.insertSale(sale4);
// dbhelper.insertSale(sale5);
// 添加测试数据结束
}
private static void printMainMenu() {
System.out.println();
System.out.println("****************商品进销存系统*****************");
System.out.println("\t1-添加商品信息\t2-修改商品信息");
System.out.println("\t3-查询商品信息\t4-新增供货商");
System.out.println("\t5-修改供货商信息\t6-查询供货商信息");
System.out.println("\t7-采购信息录入\t8-销售信息录入");
System.out.println("\t9-库存查询\t0-打印销售报表");
System.out.println("********************************************");
System.out.println("请输入您要进行的操作,退出请输入q/Q:");
System.out.println();
}
}
| [
"nathalie.ding@gmail.com"
] | nathalie.ding@gmail.com |
a0f4112c49fc0f1735101d8d3671cb942fec9283 | 92036cf2581f38acc58ee12c4ad53d4d70368a10 | /src/DidadasStiefel.java | 748f03a8ffd9ec6793366f35d1e393880076147c | [] | no_license | JuliaZamaitat/Info3-Uebung3 | 6e7748ed164fda53e50d4c779a683a361a114981 | 59c06eb80f9ab3dc535f89dba5e7a4fc2f808b93 | refs/heads/master | 2020-05-20T11:13:10.914748 | 2019-05-09T16:06:38 | 2019-05-09T16:06:38 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 164 | java | public class DidadasStiefel implements AbstrakterStiefel {
private final String TYP = "DidadasStiefel";
public String getTyp(){
return TYP;
}
}
| [
"j.zamaitat@gmail.com"
] | j.zamaitat@gmail.com |
5967a089cdd8d9bdbd0f0b92f82f5bd163b293ef | 6ba3dbf3dee59c5722f324cda78664f84feb8622 | /src/main/java/de/aktienmathematik/config/CloudDatabaseConfiguration.java | 8244bbfbbf7e1ee2f95fe7de619d1983df3f1892 | [] | no_license | ChristopherWy/aktienmathematik | a74f5e64820736f927af9c6ad0d8707e184eaf21 | 7b271c50626368e6dffed9c4cfdf6f5cd49227f4 | refs/heads/master | 2022-12-21T15:05:15.144437 | 2020-07-06T12:52:51 | 2020-07-06T12:52:51 | 243,520,979 | 0 | 0 | null | 2022-12-16T05:13:17 | 2020-02-27T13:03:53 | Java | UTF-8 | Java | false | false | 932 | java | package de.aktienmathematik.config;
import io.github.jhipster.config.JHipsterConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.config.java.AbstractCloudConfig;
import org.springframework.context.annotation.*;
import javax.sql.DataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
@Configuration
@Profile(JHipsterConstants.SPRING_PROFILE_CLOUD)
public class CloudDatabaseConfiguration extends AbstractCloudConfig {
private final Logger log = LoggerFactory.getLogger(CloudDatabaseConfiguration.class);
private static final String CLOUD_CONFIGURATION_HIKARI_PREFIX = "spring.datasource.hikari";
@Bean
@ConfigurationProperties(CLOUD_CONFIGURATION_HIKARI_PREFIX)
public DataSource dataSource() {
log.info("Configuring JDBC datasource from a cloud provider");
return connectionFactory().dataSource();
}
}
| [
"jhipster-bot@jhipster.tech"
] | jhipster-bot@jhipster.tech |
6bc7671ed8b44258ae8edfcbeec5baa15ce70ab9 | 80ee991ff203c83c0d3fb7acc5adfe486d5bcf85 | /mvc-dubbo/mvc-dubbo-web/src/main/java/com/loserbird/curator/utils/DistributedLock.java | 75c04787bfe54e89412c4b96c28fc5125106c185 | [] | no_license | loserbird/dubbo-demo | ef9d8dd776dd08a6485bc42b6c3a1f6d31d67aee | 28ba38bda9dd92788378964faa9f971bfa8aaf8c | refs/heads/master | 2020-03-12T23:02:37.281098 | 2018-04-24T13:34:00 | 2018-04-24T13:34:00 | 130,858,078 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,700 | java | package com.loserbird.curator.utils;
import java.util.concurrent.CountDownLatch;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.recipes.cache.PathChildrenCache;
import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent;
import org.apache.curator.framework.recipes.cache.PathChildrenCacheListener;
import org.apache.curator.framework.recipes.cache.PathChildrenCache.StartMode;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.ZooDefs.Ids;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.sun.corba.se.pept.transport.EventHandler;
import sun.util.logging.resources.logging;
public class DistributedLock {
private CuratorFramework client = null;
final static Logger log = LoggerFactory.getLogger(DistributedLock.class);
//用于挂起当前请求,并且等待上一个分布式锁释放
private static CountDownLatch zkLocklatch = new CountDownLatch(1);
//分布式锁的总节点名
private static final String ZK_LOCK_PROJECT = "locks";
//分布式锁节点
private static final String DISTRIBUTED_LOCK = "distributed_lock";
//构造函数
public DistributedLock(CuratorFramework client) {
this.client = client;
}
public void init() {
client = client.usingNamespace("zklocks-namespace");
try {
if(client.checkExists().forPath("/"+ZK_LOCK_PROJECT) == null) {
client.create()
.creatingParentsIfNeeded()
.withMode(CreateMode.PERSISTENT)
.withACL(Ids.OPEN_ACL_UNSAFE)
.forPath("/"+ZK_LOCK_PROJECT);
}
//针对zk的分布式锁节点,创建相应的watcher事件
addWatcherToLock("/"+ZK_LOCK_PROJECT);
}catch (Exception e) {
log.error("客户端连接zookeeper服务器失败,请重试");
}
}
private void addWatcherToLock(String path) throws Exception {
final PathChildrenCache childrenCache = new PathChildrenCache(client, path, true);
childrenCache.start(StartMode.POST_INITIALIZED_EVENT);
childrenCache.getListenable().addListener(new PathChildrenCacheListener() {
public void childEvent(CuratorFramework client, PathChildrenCacheEvent event) throws Exception {
if(event.getType().equals(PathChildrenCacheEvent.Type.CHILD_REMOVED)) {
String path = event.getData().getPath();
log.info("上一个会话已经释放锁或该会话已经断开,节点路径为:"+path);
if(path.contains(DISTRIBUTED_LOCK)) {
log.info("释放计数器,让当前请求来获取分布式锁。。");
zkLocklatch.countDown();
}
}
}
});
}
public boolean realeaseLock() {
try {
if(client.checkExists().forPath("/"+ZK_LOCK_PROJECT+"/"+DISTRIBUTED_LOCK) != null) {
client.delete().forPath("/"+ZK_LOCK_PROJECT+"/"+DISTRIBUTED_LOCK);
}
}catch (Exception e) {
e.printStackTrace();
return false;
}
log.info("分布式锁释放完毕");
return true;
}
public void getLock() {
//当获得分布式锁退出循环
while(true) {
try {
client.create()
.creatingParentsIfNeeded()
.withMode(CreateMode.EPHEMERAL)
.withACL(Ids.OPEN_ACL_UNSAFE)
.forPath("/"+ZK_LOCK_PROJECT+"/"+DISTRIBUTED_LOCK);
log.info("获得分布式成功");
return;
}catch (Exception e) {
log.info("获得分布式锁失败");
//如果没有获取到分布式锁,需要重新设置同步资源值
if(zkLocklatch.getCount() <=0) {
zkLocklatch = new CountDownLatch(1);
}
//阻塞线程
try {
zkLocklatch.await();
} catch (InterruptedException e1) {
e1.printStackTrace();
}
}
}
}
}
| [
"15626140150@163.com"
] | 15626140150@163.com |
2288568473462d8884d54f2cd16003b0cb0c9304 | 91835831d8e2ab7a9d3f63ae4925fbfe5e7d52ad | /Sr_Blog_Svc/src/main/java/com/sr/blog/service/rest/WrappingExceptionMapper.java | 7b6388865f8d8f1249ecc3967840f43bf53eb2e4 | [] | no_license | qbaze/rest-blog-service | 6b7fc6b5097f395f6bdcebaf33fb18a33b84e06e | a7c629884ab008dacd2435845a6c3a2d97244fda | refs/heads/master | 2022-08-30T21:29:03.919909 | 2013-10-02T14:16:22 | 2013-10-02T14:16:22 | 13,248,046 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 849 | java | package com.sr.blog.service.rest;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import javax.ws.rs.ext.ExceptionMapper;
import javax.ws.rs.ext.Provider;
import com.sr.blog.error.ResourceNotFoundException;
import com.sr.blog.model.ErrorInfo;
@Provider
public class WrappingExceptionMapper implements ExceptionMapper<Exception> {
public Response toResponse(Exception ex) {
if (ex instanceof ResourceNotFoundException) {
return Response.status(404).entity(ErrorInfo.toErrorInfo(ex))
.build();
}
if (ex instanceof WebApplicationException) {
WebApplicationException waex = (WebApplicationException) ex;
return Response.status(waex.getResponse().getStatusInfo())
.entity(ErrorInfo.toErrorInfo(waex)).build();
}
return Response.status(500).entity(ErrorInfo.toErrorInfo(ex)).build();
}
}
| [
"elmo@qube"
] | elmo@qube |
24ed8f4b99ec2070e6886f6ffc1525d506005c7d | 29e601095b602e28664f35ccbb443a9b097bf468 | /src/main/java/com/ston/cursomc/resources/PedidoResource.java | 0dc4398fb2e5f7c1f939ec1716c81465e50c192f | [] | no_license | aempinto02/cursomc | 05def5b815399edcc63f9b4fb8c30d010b07389e | 709586019eb3b1959809db8ae1e7504a6095fbdc | refs/heads/main | 2023-04-08T17:49:26.580825 | 2021-04-19T13:13:20 | 2021-04-19T13:13:20 | 355,197,232 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,952 | java | package com.ston.cursomc.resources;
import java.net.URI;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import com.ston.cursomc.domain.Pedido;
import com.ston.cursomc.services.PedidoService;
@RestController
@RequestMapping(value="/pedidos")
public class PedidoResource {
@Autowired
private PedidoService service;
@RequestMapping(value="/{id}", method=RequestMethod.GET)
public ResponseEntity<Pedido> find(@PathVariable Integer id) {
Pedido pedido = service.find(id);
return ResponseEntity.ok().body(pedido);
}
@RequestMapping(method=RequestMethod.POST)
public ResponseEntity<Void> insert(@Valid @RequestBody Pedido pedido) {
pedido = service.insert(pedido);
URI uri = ServletUriComponentsBuilder.fromCurrentRequest()
.path("/{id}").buildAndExpand(pedido.getId()).toUri();
return ResponseEntity.created(uri).build();
}
@RequestMapping(method=RequestMethod.GET)
public ResponseEntity<Page<Pedido>> findPage(
@RequestParam(value="page", defaultValue="0") Integer page,
@RequestParam(value="linesPerPage", defaultValue="24") Integer linesPerPage,
@RequestParam(value="orderBy", defaultValue="instante") String orderBy,
@RequestParam(value="direction", defaultValue="DESC") String direction) {
Page<Pedido> pagina = service.findPage(page, linesPerPage, orderBy, direction);
return ResponseEntity.ok().body(pagina);
}
}
| [
"aempinto02@gmail.com"
] | aempinto02@gmail.com |
c56685d615f8cb68c4cf465f70edd552bfbebf76 | 9ff08a955c7661b35e90d6f822d0843bdf12c507 | /Chapter03/src/main/java/it/vige/businesscomponents/persistence/Topic.java | 148d0cbb46529d34d25f80c93c19f9e9ee6da243 | [
"MIT"
] | permissive | PacktPublishing/Mastering-Java-EE-Development-with-WildFly | db5cca03f852767e5eecb2ad32c9c3eda61410e3 | 619c0e94defd0249c778a10776dae4acafe56616 | refs/heads/master | 2023-02-06T08:04:33.128572 | 2023-01-30T08:32:56 | 2023-01-30T08:32:56 | 94,743,961 | 13 | 17 | null | null | null | null | UTF-8 | Java | false | false | 8,663 | java | package it.vige.businesscomponents.persistence;
import static javax.persistence.CascadeType.REMOVE;
import static org.hibernate.search.annotations.Index.YES;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
@NamedQueries({
@NamedQuery(name = "findAnnouncements", query = "select t from Topic as t where t.forum=:forumid and "
+ "t.type = :type order by t.lastPostDate"),
@NamedQuery(name = "findPoll", query = "select t.poll from Topic as t where t.id=:topicid"),
@NamedQuery(name = "findTopics", query = "select t from Topic as t"),
@NamedQuery(name = "findTopicsTypeasc", query = "select t from Topic as t " + "join fetch t.poster "
+ "where t.forum = :forumid " + "and t.type = :type " + "order by t.lastPostDate asc"),
@NamedQuery(name = "findTopicsTypedesc", query = "select t from Topic as t " + "join fetch t.poster "
+ "where t.forum = :forumid " + "and t.type = :type " + "order by t.lastPostDate desc"),
@NamedQuery(name = "findTopicsForumasc", query = "select t from Topic as t " + "join fetch t.poster "
+ "where t.forum = :forumid " + "order by t.lastPostDate asc"),
@NamedQuery(name = "findTopicsForumdesc", query = "select t from Topic as t " + "join fetch t.poster "
+ "where t.forum = :forumid " + "order by t.lastPostDate desc"),
@NamedQuery(name = "findTopicsHot", query = "select t from Topic as t where t.replies > :replies "
+ "order by t.lastPostDate desc"),
@NamedQuery(name = "findTopicsByLatestPosts", query = "select t from Topic as t order by t.lastPostDate desc"),
@NamedQuery(name = "findTopicsHottest", query = "select t from Topic as t where t.lastPostDate > :after "
+ "order by t.replies desc"),
@NamedQuery(name = "findTopicsMostViewed", query = "select t from Topic as t where t.lastPostDate > :after "
+ "order by t.viewCount desc"),
@NamedQuery(name = "findTopicsForumNoOrder", query = "select t from Topic as t where t.forum = :forumid"),
@NamedQuery(name = "findPostsFromForumasc", query = "select p from Topic as t join t.posts as p where "
+ "t.forum.id = :forumId order by p.createDate asc"),
@NamedQuery(name = "findPostsFromForumdesc", query = "select p from Topic as t join t.posts as p where "
+ "t.forum.id = :forumId order by p.createDate desc") })
@Entity
@Table(name = "JBP_FORUMS_TOPICS")
@Indexed(index = "indexes/topics")
public class Topic implements Serializable, Comparable<Topic> {
/**
*
*/
private static final long serialVersionUID = 3426875789016150344L;
@Id
@Column(name = "JBP_ID")
@GeneratedValue
private Integer id;
@OneToMany(mappedBy = "topic", cascade = REMOVE)
private List<Post> posts;
@ManyToOne
@JoinColumn(name = "JBP_FORUM_ID")
@IndexedEmbedded(includeEmbeddedObjectId = true, targetElement = Forum.class)
private Forum forum;
@Column(name = "JBP_VIEW_COUNT")
private int viewCount;
@Column(name = "JBP_REPLIES")
private int replies;
/**
* this field is cached but was left as it's easier to sort topics with HQL
* having such column
*
*/
@Column(name = "JBP_LAST_POST_DATE")
private Date lastPostDate;
@ManyToOne
@JoinColumn(name = "JBP_POSTER")
private Poster poster;
@Column(name = "JBP_TYPE")
private TopicType type;
@Column(name = "JBP_STATUS")
private int status;
@Field(index = YES)
@Column(name = "JBP_SUBJECT")
private String subject;
@ManyToMany
@JoinTable(name = "JBP_FORUMS_TOPICSWATCH", joinColumns = @JoinColumn(name = "JBP_TOPIC_ID"), inverseJoinColumns = @JoinColumn(name = "JBP_ID"))
private List<Watch> watches;
@ManyToOne(cascade = REMOVE)
@JoinColumn(name = "JBP_POLL")
private Poll poll;
/**
* Creates a new {@link Topic} object.
*/
public Topic() {
setPosts(new ArrayList<Post>());
}
public Topic(String subject) {
this();
this.subject = subject;
}
public Topic(Forum forum, String subject) {
this(subject);
this.forum = forum;
}
public Topic(Forum forum, String subject, List<Post> posts) {
this(forum, subject);
this.posts = posts;
}
public Topic(Forum forum, String subject, List<Post> posts, TopicType type, Poll poll) {
this(forum, subject, posts);
this.type = type;
this.poll = poll;
}
/**
* we are implementing comparable to be able to sort topics by last post
* date without to have a column in db.
*
* @param comp
* the topic to compare
* @return the result of the comparation. -1 minor, 0 equal, 1 major
*/
public int compareTo(Topic comp) {
Date thisDate = getLastPostDate();
Date thatDate = comp.getLastPostDate();
if (thisDate != null && (thatDate != null)) {
return thisDate.compareTo(thatDate);
} else if (thisDate == null && (thatDate != null)) {
return -1;
} else if (thisDate != null && (thatDate == null)) {
return 1;
} else {
return 0;
}
}
/**
* @return the id of the topic
*/
public Integer getId() {
return id;
}
/**
* DOCUMENT_ME
*
* @param id
* DOCUMENT_ME
*/
public void setId(Integer id) {
this.id = id;
}
/**
* @return the posts of the topic
*/
public List<Post> getPosts() {
return posts;
}
/**
* DOCUMENT_ME
*
* @param value
* DOCUMENT_ME
*/
public void setPosts(List<Post> value) {
posts = value;
}
/**
* @return the forum of the topic
*/
public Forum getForum() {
return forum;
}
/**
* DOCUMENT_ME
*
* @param forum
* DOCUMENT_ME
*/
public void setForum(Forum forum) {
this.forum = forum;
}
/**
* @return the count of visitors
*/
public int getViewCount() {
return viewCount;
}
/**
* DOCUMENT_ME
*
* @param viewCount
* DOCUMENT_ME
*/
public void setViewCount(int viewCount) {
this.viewCount = viewCount;
}
/**
* @return the number of replies
*/
public int getReplies() {
return replies;
}
/**
* DOCUMENT_ME
*
* @param replies
* DOCUMENT_ME
*/
public void setReplies(int replies) {
this.replies = replies;
}
/**
* @return the last post date
*/
public Date getLastPostDate() {
return lastPostDate;
}
/**
* DOCUMENT_ME
*
* @param lastPostDate
* DOCUMENT_ME
*/
public void setLastPostDate(Date lastPostDate) {
this.lastPostDate = lastPostDate;
}
/**
* @return the poster
*/
public Poster getPoster() {
return poster;
}
/**
* DOCUMENT_ME
*
* @param poster
* DOCUMENT_ME
*/
public void setPoster(Poster poster) {
this.poster = poster;
}
/**
* @return the topic type. It can be NORMAL, IMPORTANT or ADVICE
*/
public TopicType getType() {
return type;
}
/**
* DOCUMENT_ME
*
* @param type
* DOCUMENT_ME
*/
public void setType(TopicType type) {
this.type = type;
}
/**
* @return the status of the topic
*/
public int getStatus() {
return status;
}
/**
* DOCUMENT_ME
*
* @param status
* DOCUMENT_ME
*/
public void setStatus(int status) {
this.status = status;
}
/**
* @return the subject of the topic
*/
public String getSubject() {
return subject;
}
/**
* DOCUMENT_ME
*
* @param subject
* DOCUMENT_ME
*/
public void setSubject(String subject) {
this.subject = subject;
}
/**
* @return the watches list of the topic
*/
public List<Watch> getWatches() {
return watches;
}
public void setWatches(List<Watch> watches) {
this.watches = watches;
}
/**
* @return the poll of the topic
*/
public Poll getPoll() {
return poll;
}
public void setPoll(Poll poll) {
this.poll = poll;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((id == null) ? 0 : id.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Topic other = (Topic) obj;
if (id == null) {
if (other.id != null)
return false;
} else if (!id.equals(other.id))
return false;
return true;
}
} | [
"murtazat@packtpub.com"
] | murtazat@packtpub.com |
1045c0ac9a2888a2b1f093115e9b6ba170f820a4 | fd431c99a3cefebe3556fa30ce3768f904128496 | /PlatformBase/src/com/system/constant/Constant.java | 33cead92bfd68fdfb67a9304766ca62982056f52 | [] | no_license | liushengmz/scpc | d2140cb24d0af16c39e4fef4c0cd1422b144e238 | f760bf2c3b1ec45fd06d0d89018a3bfae3c9748c | refs/heads/master | 2021-06-19T15:49:59.928248 | 2018-10-16T08:24:18 | 2018-10-16T08:24:18 | 95,423,982 | 2 | 4 | null | 2017-06-28T02:35:14 | 2017-06-26T08:13:22 | null | UTF-8 | Java | false | false | 445 | java | package com.system.constant;
public class Constant
{
public static int PAGE_SIZE = 20;
public static String CONSTANT_REPLACE_STRING = "CONSTANT_REPLACE_STRING";
/**
* 点播类型数据查询
*/
public static final int MR_SUMMER_QUERY_NORMAL = 0;
/**
* IVR数据类型查询
*/
public static final int MR_SUMMER_QUERY_IVR = 2;
/**
* 隔天数据类型查询
*/
public static final int MR_SUMMER_QUERY_OTHER_DAY = 1;
}
| [
"liushengmz@163.com"
] | liushengmz@163.com |
8f96a60e3258f0f99c953e6b631a288dc690fe79 | 9d948b76a27de875f956b94049452d1775c11637 | /server/src/main/java/com/tvshowtracker/service/Service.java | 1c879cf909bdbdbeb6af7028a6aa0eb9a151aa6d | [] | no_license | igorflyunt/TvShowTracker | b708e74867b9a8dd25705ea6a263a8a17afd22a6 | 458a69b8556294993d909baa54df88dffec90f02 | refs/heads/master | 2020-03-14T17:27:16.786068 | 2018-05-01T19:19:07 | 2018-05-01T19:19:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 316 | java | package com.tvshowtracker.service;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface Service<T, ID, R extends JpaRepository<T, ID>> {
void delete(T entity);
void save(T entity);
T findById(ID id);
List<T> findAll();
R getRepository();
}
| [
"igflyunt@gmail.com"
] | igflyunt@gmail.com |
f1566f7384425225b71f0d1322ca95a675376f72 | 445c9900e346f86acd6ae2523d161cdff853a491 | /part1/chapter09/IFTest.java | d021693757c10cf186269ff495d24ff6afdde32a | [] | no_license | Sasakin/Shildt | 4fccae12ecdc0fc554d00449da960203c392ca99 | 320cdabeee48ba820cb505aca1532a1f47b4c97a | refs/heads/master | 2020-04-12T08:05:15.112648 | 2017-08-17T14:40:22 | 2017-08-17T14:40:22 | 63,973,965 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,487 | java | // Реализация интерфейса IntStack для стека фиксированного размера
class FixedStack implements IntStack {
private int stck[];
private int tos;
// выделить память и инициалезировать стек
FixedStack(int size) {
stck = new int[size];
tos = -1;
}
// разместить элемент в стэке
void push(int item) {
if(tos==stck.length-1) // использовать поле длинны стека
System.out.println("Стек заполнен.");
else
stck[++tos]=item;
}
// извлеч элемент из стека
int pop() {
if (tos<0){
System.out.println("Стек не загружен.");
return 0;
}
else
return stck[tos--];
}
}
class IFTest {
public static void main(String args[]) {
FixedStack mystack1 = new FixedStack(5);
FixedStack mystack2 = new FixedStack(8);
// разместить чила в стеке
for(int i=0; i<5; i++) mystack1.push(i);
for(int i=0; i<8; i++) mystack2.push(i);
// извлеч эти числа из сиека
System.out.println("Содержимое стека mystack1:");
for(int i=0;i<5;i++)
System.out.println(mystak1.pop());
System.out.println("Содержимое стека mystack2:");
for(int i=0;i<8;i++)
System.out.println(mystak2.pop());
}
}
| [
"max_to_day@Mail.ru"
] | max_to_day@Mail.ru |
7b3f01496fd39992cb0fc644094ce34e5583e257 | bb2239a78330ac5f64d4d87a494c393c6d96b3f3 | /app/src/main/java/com/universl/realestate/utils/ItemData.java | a439294365fb03d3cbe24b84ed3903c7fa77319b | [
"MIT"
] | permissive | rayanprasanna/property-app-new | 7b70ad5604c8f10613c23133a54833264d303fa8 | 7e43494a366c7cde6fb210b9c9f7a1af30b0e5dd | refs/heads/master | 2020-12-28T12:54:26.144223 | 2020-02-05T01:03:28 | 2020-02-05T01:03:28 | 238,339,832 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 434 | java | package com.universl.realestate.utils;
public class ItemData {
private String text;
private Integer image_id;
public ItemData(String text, Integer image_id) {
this.text = text;
this.image_id = image_id;
}
public ItemData(String text) {
this.text = text;
}
public String getText() {
return text;
}
public Integer getImage_id() {
return image_id;
}
}
| [
"rayanprasanna224@gmail.com"
] | rayanprasanna224@gmail.com |
23b80cc7cb81c362632d9009f56b3e59fec14611 | c90c5357d78da457365cfc4d05879c1b8a90398a | /app/src/main/java/com/ican/ilkercan/utils/UtilsUI.java | 65a97af6df058b964591dd398e2402248be859b5 | [] | no_license | ilkerican/Places | cdc2f08ac56e9f5dbc2dc951b3c391f7e50e7141 | f407eddf1f54ef64d5e0653d6a5fc1e0caa9ec8b | refs/heads/master | 2020-04-07T06:42:18.029927 | 2018-03-07T07:16:41 | 2018-03-07T07:16:41 | 124,189,991 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,976 | java | package com.ican.ilkercan.utils;
import android.app.ProgressDialog;
import android.content.SharedPreferences;
import android.graphics.drawable.ColorDrawable;
import android.preference.PreferenceManager;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;
import com.ican.ilkercan.places.R;
/**
* Created by ilkercan on 13/02/2018.
*/
public class UtilsUI {
public static void ShowProgressDialog(ProgressDialog progressDialog, boolean show)
{
if(show) {
progressDialog.show();
}
else
{
progressDialog.hide();
}
}
public static void ShowMessage(AppCompatActivity activity, String message)
{
Toast.makeText(activity, message, Toast.LENGTH_SHORT).show();
}
public static ProgressDialog GetProgressDialog(AppCompatActivity activity)
{
ProgressDialog progressDialog = new ProgressDialog(activity, R.style.MyAlertDialogStyle);
progressDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
progressDialog.setIndeterminate(false);
progressDialog.setCancelable(false);
progressDialog.setCanceledOnTouchOutside(false);
progressDialog.getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
return progressDialog;
}
public static String GetSharedPreferenceValue(AppCompatActivity activity, String keyName)
{
SharedPreferences app_preferences = PreferenceManager.getDefaultSharedPreferences(activity);
return app_preferences.getString(keyName, null);
}
public static void SetSharedPreferenceValue(AppCompatActivity activity, String keyName, String value)
{
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity);
SharedPreferences.Editor editor = preferences.edit();
editor.putString(keyName,value);
editor.apply();
editor.commit();
}
}
| [
"ilkercan@ilkers-MacBook-Pro.local"
] | ilkercan@ilkers-MacBook-Pro.local |
3319e844ab41dc236242957d51f6f3b1f2972b17 | 865cfcd68357d640ee812aaf503228f779620c9d | /android/app/build/generated/source/buildConfig/debug/com/android/BuildConfig.java | 62108e812d086bd40718316eb789919e6a34dc64 | [] | no_license | hamzasclone2/UDKFrontend | 05a7d83c59df153ed273bcade191960606679118 | 0a03c200be015ceadfd276e6a0e6a670e114b668 | refs/heads/master | 2023-05-13T22:18:49.178842 | 2023-04-27T21:21:21 | 2023-04-27T21:21:21 | 172,108,537 | 0 | 1 | null | 2022-12-03T11:29:57 | 2019-02-22T17:39:54 | Java | UTF-8 | Java | false | false | 429 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package com.android;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "com.android";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}
| [
"alejandro.melgar38@gmail.com"
] | alejandro.melgar38@gmail.com |
6fa9cba6add913561e2a6ff97a9cec8cc3ce48ce | 41ae418e54303c7cc63fcaa1e49c9582c6171c77 | /src/buss/Configuration.java | f6325c6c836ed9433bffcb3ac69d62169d371aeb | [] | no_license | dragomirthesorrow/buss | 3d5a45a2ad33368bfb07139df313b0b7ef5232da | 167dc1df8e9eae99fbe5988ba9f04c62d2b51b98 | refs/heads/master | 2021-01-21T21:05:27.134187 | 2017-05-24T14:48:20 | 2017-05-24T14:48:20 | 92,303,497 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,147 | 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 buss;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
/**
*
* @author oadm
*/
public class Configuration {
static File cfgFile;
public Configuration(){
this.cfgFile=new File("/etc/buss/buss.cfg");
}
public Configuration(String cfg_path){
this.cfgFile=new File(cfg_path);
}
static int getTimeOut(){
int time_out=0;
try{
ArrayList<String> list = new ArrayList<>();
//File file = new File(getServiceDirectory()+"config/blind.config");
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(Configuration.cfgFile), "UTF-8"));
String line = null;
//StringBuilder stringBuilder = new StringBuilder();
//String ls = System.getProperty("line.separator");
while( ( line = reader.readLine() ) != null ) {
list.add(line);
}
reader.close();
String directive = list.get(12).substring(21);
time_out=Integer.parseInt(directive);
//System.out.println("Directive: "+dir);
}catch(IOException e){
System.out.println(e);
}
return time_out;
}
static String getBUFolder(){
String folder="";
try{
ArrayList<String> list = new ArrayList<>();
//File file = new File(getServiceDirectory()+"config/blind.config");
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(cfgFile), "UTF-8"));
String line = null;
//StringBuilder stringBuilder = new StringBuilder();
//String ls = System.getProperty("line.separator");
while( ( line = reader.readLine() ) != null ) {
list.add(line);
}
reader.close();
String directive = list.get(4).substring(17);
folder=directive;
//System.out.println("Directive: "+dir);
}catch(IOException e){
System.out.println(e);
}
return folder;
}
static String getRootDir(){
String folder="";
try{
ArrayList<String> list = new ArrayList<>();
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(cfgFile), "UTF-8"));
String line = null;
while( ( line = reader.readLine() ) != null ) {
list.add(line);
}
reader.close();
String directive = list.get(3).substring(20);
folder=directive;
}catch(IOException e){
System.out.println(e);
}
return folder;
}
static String getDBName(){
String folder="";
try{
ArrayList<String> list = new ArrayList<>();
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(cfgFile), "UTF-8"));
String line = null;
while( ( line = reader.readLine() ) != null ) {
list.add(line);
}
reader.close();
String directive = list.get(10).substring(15);
folder=directive;
}catch(IOException e){
System.out.println(e);
}
return folder;
}
static String[] mysqlAcc(){
String[] acc=new String[2];
acc[0]="";
try{
ArrayList<String> list = new ArrayList<>();
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(Configuration.cfgFile), "UTF-8"));
String line = null;
while( ( line = reader.readLine() ) != null ) {
list.add(line);
}
reader.close();
String directive = list.get(8).substring(11);
acc[0]=directive;
//System.out.println("Directive: "+directive);
}catch(IOException e){
System.out.println(e);
}
acc[1]="";
try{
ArrayList<String> list = new ArrayList<>();
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(Configuration.cfgFile), "UTF-8"));
String line = null;
while( ( line = reader.readLine() ) != null ) {
list.add(line);
}
reader.close();
String directive = list.get(9).substring(15);
acc[1]=directive;
//System.out.println("Directive: "+directive);
}catch(IOException e){
System.out.println(e);
}
return acc;
}
static int getDepth(){
int depth=0;
try{
ArrayList<String> list = new ArrayList<>();
//File file = new File(getServiceDirectory()+"config/blind.config");
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(Configuration.cfgFile), "UTF-8"));
String line = null;
//StringBuilder stringBuilder = new StringBuilder();
//String ls = System.getProperty("line.separator");
while( ( line = reader.readLine() ) != null ) {
list.add(line);
}
reader.close();
String directive = list.get(16).substring(22);
depth=Integer.parseInt(directive);
//System.out.println("Directive: "+dir);
}catch(IOException e){
System.out.println(e);
}
return depth;
}
static int getTime(){
int time=0;
try{
ArrayList<String> list = new ArrayList<>();
//File file = new File(getServiceDirectory()+"config/blind.config");
BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(Configuration.cfgFile), "UTF-8"));
String line = null;
//StringBuilder stringBuilder = new StringBuilder();
//String ls = System.getProperty("line.separator");
while( ( line = reader.readLine() ) != null ) {
list.add(line);
}
reader.close();
String directive = list.get(15).substring(18);
time=Integer.parseInt(directive);
//System.out.println("Directive: "+dir);
}catch(IOException e){
System.out.println(e);
}
return time;
}
}
| [
"oadm@ubuntu.corp.digital-grass.ru"
] | oadm@ubuntu.corp.digital-grass.ru |
e378c6276e78dd7781802b624650c104913f9b34 | 5a13f24c35c34082492ef851fb91d404827b7ddb | /src/main/java3/com/alipay/api/response/AlipayCommerceCityfacilitatorVoucherGenerateResponse.java | a805613a033dbe118d712661054fd20ff7b0d29d | [] | no_license | featherfly/alipay-sdk | 69b2f2fc89a09996004b36373bd5512664521bfd | ba2355a05de358dc15855ffaab8e19acfa24a93b | refs/heads/master | 2021-01-22T11:03:20.304528 | 2017-09-04T09:39:42 | 2017-09-04T09:39:42 | 102,344,436 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,204 | java | package com.alipay.api.response;
import com.alipay.api.internal.mapping.ApiField;
import com.alipay.api.AlipayResponse;
/**
* ALIPAY API: alipay.commerce.cityfacilitator.voucher.generate response.
*
* @author auto create
* @since 1.0, 2016-08-03 16:10:34
*/
public class AlipayCommerceCityfacilitatorVoucherGenerateResponse extends AlipayResponse {
private static final long serialVersionUID = 1678536519621434321L;
/**
* 核销码过期时间
*/
@ApiField("expired_date")
private String expiredDate;
/**
* 地铁购票二维码编码,可自定义
*/
@ApiField("qr_code_no")
private String qrCodeNo;
/**
* 地铁购票的核销码
*/
@ApiField("ticket_no")
private String ticketNo;
public void setExpiredDate(String expiredDate) {
this.expiredDate = expiredDate;
}
public String getExpiredDate( ) {
return this.expiredDate;
}
public void setQrCodeNo(String qrCodeNo) {
this.qrCodeNo = qrCodeNo;
}
public String getQrCodeNo( ) {
return this.qrCodeNo;
}
public void setTicketNo(String ticketNo) {
this.ticketNo = ticketNo;
}
public String getTicketNo( ) {
return this.ticketNo;
}
}
| [
"zhongj@cdmhzx.com"
] | zhongj@cdmhzx.com |
392e93c1eee0b7c6669070bb4005913fed2db6b3 | 4611ba9c852bcc03b330ca00e98884746082e57f | /Libraries/http/htmlparser1_6/src/src/org/htmlparser/lexerapplications/thumbelina/Thumbelina.java | d19984206b5f78e4d254be5a7ec9045f67a007fd | [
"LGPL-2.1-or-later",
"LGPL-2.1-only",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-copyleft",
"GPL-1.0-or-later",
"GPL-2.0-only",
"LGPL-2.0-or-later",
"Apache-2.0"
] | permissive | sami-sari/cezmi | 374ddb4606586282613e0abef04fc70e2550c97d | 6042b566fb8598b60faef0dcf8671b819d2e4f0a | refs/heads/master | 2021-07-02T12:26:13.707009 | 2020-12-01T02:45:08 | 2020-12-01T02:45:08 | 193,400,687 | 0 | 0 | Apache-2.0 | 2020-12-01T02:45:09 | 2019-06-23T22:18:44 | HTML | UTF-8 | Java | false | false | 46,122 | java | // HTMLParser Library $Name: v1_6 $ - A java-based parser for HTML
// http://sourceforge.org/projects/htmlparser
// Copyright (C) 2003 Derrick Oswald
//
// Revision Control Information
//
// $Source: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/lexerapplications/thumbelina/Thumbelina.java,v $
// $Author: derrickoswald $
// $Date: 2005/02/13 20:36:00 $
// $Revision: 1.7 $
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
package org.htmlparser.lexerapplications.thumbelina;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Image;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.image.ImageObserver;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import javax.swing.BoxLayout;
import javax.swing.DefaultListModel;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JSlider;
import javax.swing.JSplitPane;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.ScrollPaneConstants;
import javax.swing.border.BevelBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import org.htmlparser.Node;
import org.htmlparser.Tag;
import org.htmlparser.lexer.Lexer;
import org.htmlparser.util.ParserException;
/**
* View images behind thumbnails.
*/
public class Thumbelina
extends
JPanel // was: java.awt.Canvas
implements
Runnable,
ItemListener,
ChangeListener,
ListSelectionListener
{
/**
* Property name for current URL binding.
*/
public static final String PROP_CURRENT_URL_PROPERTY = "currentURL";
/**
* Property name for queue size binding.
*/
public static final String PROP_URL_QUEUE_PROPERTY = "queueSize";
/**
* Property name for visited URL size binding.
*/
public static final String PROP_URL_VISITED_PROPERTY = "visitedSize";
/**
* URL's to visit.
*/
private ArrayList mUrls;
/**
* URL's visited.
*/
protected HashMap mVisited;
/**
* Images requested.
*/
protected HashMap mRequested;
/**
* Images being tracked currently.
*/
protected HashMap mTracked;
/**
* Background thread.
*/
protected Thread mThread;
/**
* Activity state.
* <code>true</code> means processing URLS, <code>false</code> not.
*/
protected boolean mActive;
/**
* The picture sequencer.
*/
protected Sequencer mSequencer;
/**
* The central area for pictures.
*/
protected PicturePanel mPicturePanel;
/**
* Value returned when no links are discovered.
*/
protected static final URL[][] NONE = { { }, { } };
/**
* Bound property support.
*/
protected PropertyChangeSupport mPropertySupport;
/**
* The URL being currently being examined.
*/
protected String mCurrentURL;
/**
* If <code>true</code>, does not follow links containing cgi calls.
*/
protected boolean mDiscardCGI;
/**
* If <code>true</code>, does not follow links containing queries (?).
*/
protected boolean mDiscardQueries;
/**
* Background thread checkbox in status bar.
*/
protected JCheckBox mBackgroundToggle;
/**
* History list.
*/
protected JList mHistory;
/**
* Scroller for the picture panel.
*/
protected JScrollPane mPicturePanelScroller;
/**
* Scroller for the history list.
*/
protected JScrollPane mHistoryScroller;
/**
* Main panel in central area.
*/
protected JSplitPane mMainArea;
/**
* Status bar.
*/
protected JPanel mPowerBar;
/**
* Image request queue monitor in status bar.
*/
protected JProgressBar mQueueProgress;
/**
* Image ready queue monitor in status bar.
*/
protected JProgressBar mReadyProgress;
/**
* Sequencer thread toggle in status bar.
*/
protected JCheckBox mRunToggle;
/**
* Sequencer speed slider in status bar.
*/
protected JSlider mSpeedSlider;
/**
* URL report in status bar.
*/
protected JTextField mUrlText;
/**
* URL queue size display in status bar.
*/
protected JLabel mQueueSize;
/**
* URL visited count display in status bar.
*/
protected JLabel mVisitedSize;
/**
* Creates a new instance of Thumbelina.
*/
public Thumbelina ()
{
this ((URL)null);
}
/**
* Creates a new instance of Thumbelina.
* @param url Single URL to enter into the 'to follow' list.
* @exception MalformedURLException If the url is malformed.
*/
public Thumbelina (final String url)
throws
MalformedURLException
{
this (null == url ? null : new URL (url));
}
/**
* Creates a new instance of Thumbelina.
* @param url URL to enter into the 'to follow' list.
*/
public Thumbelina (final URL url)
{
mUrls = new ArrayList ();
mVisited = new HashMap ();
mRequested = new HashMap ();
mTracked = new HashMap ();
mThread = null;
mActive = true;
mPicturePanel = new PicturePanel (this);
mSequencer = new Sequencer (this);
mPropertySupport = new PropertyChangeSupport (this);
mCurrentURL = null;
mDiscardCGI = true;
mDiscardQueries = true;
// JComponent specific
setDoubleBuffered (false);
setLayout (new java.awt.BorderLayout ());
mPicturePanel.setDoubleBuffered (false);
mThread = new Thread (this);
mThread.setName ("BackgroundThread");
mThread.start ();
initComponents ();
mRunToggle.addItemListener (this);
mBackgroundToggle.addItemListener (this);
mSpeedSlider.addChangeListener (this);
mHistory.addListSelectionListener (this);
memCheck ();
if (null != url)
append (url);
}
/**
* Check for low memory situation.
* Report to the user a bad situation.
*/
protected void memCheck ()
{
Runtime runtime;
long maximum;
if (System.getProperty ("java.version").startsWith ("1.4"))
{
runtime = Runtime.getRuntime ();
runtime.gc ();
maximum = runtime.maxMemory ();
if (maximum < 67108864L) // 64MB
JOptionPane.showMessageDialog (
null,
"Maximum available memory is low (" + maximum + " bytes).\n"
+ "\n"
+ "It is strongly suggested to increase the maximum memory\n"
+ "available by using the JVM command line switch -Xmx with\n"
+ "a suitable value, such as -Xmx256M for example.",
"Thumbelina - Low memory",
JOptionPane.WARNING_MESSAGE,
null /*Icon*/);
}
}
/**
* Reset this Thumbelina.
* Clears the sequencer of pending images, resets the picture panel,
* emptiies the 'to be examined' list of URLs.
*/
public void reset ()
{
int oldsize;
synchronized (mUrls)
{
mSequencer.reset ();
mPicturePanel.reset ();
oldsize = mUrls.size ();
mUrls.clear ();
}
updateQueueSize (oldsize, mUrls.size ());
}
/**
* Append the given URL to the queue.
* Adds the url only if it isn't already in the queue,
* and notifys listeners about the addition.
* @param url The url to add.
*/
public void append (final URL url)
{
String href;
boolean found;
URL u;
int oldsize;
href = url.toExternalForm ();
found = false;
oldsize = -1;
synchronized (mUrls)
{
for (int i = 0; !found && (i < mUrls.size ()); i++)
{
u = (URL)mUrls.get (i);
if (href.equals (u.toExternalForm ()))
found = true;
}
if (!found)
{
oldsize = mUrls.size ();
mUrls.add (url);
mUrls.notify ();
}
}
if (-1 != oldsize)
updateQueueSize (oldsize, mUrls.size ());
}
/**
* Append the given URLs to the queue.
* @param list The list of URL objects to add.
*/
public void append (final ArrayList list)
{
for (int i = 0; i < list.size (); i++)
append ((URL)list.get (i));
}
/**
* Filter URLs and add to queue.
* Removes already visited links and appends the rest (if any) to the
* visit pending list.
* @param urls The list of URL's to add to the 'to visit' list.
* @return Returns the filered list.
*/
protected ArrayList filter (final URL[] urls)
{
ArrayList list;
URL url;
String ref;
list = new ArrayList ();
for (int i = 0; i < urls.length; i++)
{
url = urls[i];
ref = url.toExternalForm ();
// ignore cgi
if (!mDiscardCGI || (-1 == ref.indexOf ("/cgi-bin/")))
// ignore queries
if (!mDiscardQueries || (-1 == ref.indexOf ("?")))
// ignore duplicates
if (!mVisited.containsKey (ref))
{
try
{
url.openConnection ();
list.add (url);
}
catch (IOException ioe)
{
// unknown host or some other problem... discard
}
}
}
return (list);
}
/**
* Initialize the GUI.
*/
private void initComponents ()
{
mPowerBar = new JPanel ();
mUrlText = new JTextField ();
mRunToggle = new JCheckBox ();
mSpeedSlider = new JSlider ();
mReadyProgress = new JProgressBar ();
mQueueProgress = new JProgressBar ();
mBackgroundToggle = new JCheckBox ();
mMainArea = new JSplitPane ();
mPicturePanelScroller = new JScrollPane ();
mHistoryScroller = new JScrollPane ();
mHistory = new JList ();
mQueueSize = new JLabel ();
mVisitedSize = new JLabel ();
mPowerBar.setLayout (new BoxLayout (mPowerBar, BoxLayout.X_AXIS));
mPowerBar.setBorder (new BevelBorder (BevelBorder.LOWERED));
mPowerBar.add (mUrlText);
mRunToggle.setSelected (true);
mRunToggle.setText ("On/Off");
mRunToggle.setToolTipText ("Starts/stops the image presentation.");
mPowerBar.add (mRunToggle);
mSpeedSlider.setMajorTickSpacing (1000);
mSpeedSlider.setMaximum (5000);
mSpeedSlider.setPaintTicks (true);
mSpeedSlider.setToolTipText ("Set inter-image delay.");
mSpeedSlider.setValue (500);
mSpeedSlider.setInverted (true);
mPowerBar.add (mSpeedSlider);
mReadyProgress.setToolTipText ("Pending images..");
mReadyProgress.setStringPainted (true);
mPowerBar.add (mReadyProgress);
mQueueProgress.setToolTipText ("Outstanding image fetches..");
mQueueProgress.setStringPainted (true);
mPowerBar.add (mQueueProgress);
mBackgroundToggle.setSelected (true);
mBackgroundToggle.setText ("On/Off");
mBackgroundToggle.setToolTipText ("Starts/stops background fetching.");
mPowerBar.add (mBackgroundToggle);
mVisitedSize.setBorder (new BevelBorder (BevelBorder.LOWERED));
mVisitedSize.setText ("00000");
mVisitedSize.setToolTipText ("Number of URLs examined.");
mPowerBar.add (mVisitedSize);
mQueueSize.setBorder (new BevelBorder (BevelBorder.LOWERED));
mQueueSize.setText ("00000");
mQueueSize.setToolTipText ("Number of URLs in queue.");
mPowerBar.add (mQueueSize);
mHistory.setModel (new DefaultListModel ());
mHistory.setToolTipText ("History");
mHistory.setDoubleBuffered (false);
mHistory.setSelectionMode (
ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
mHistoryScroller.setViewportView (mHistory);
mHistoryScroller.setDoubleBuffered (false);
mPicturePanelScroller.setViewportView (mPicturePanel);
mPicturePanelScroller.setDoubleBuffered (false);
mPicturePanelScroller.setHorizontalScrollBarPolicy (
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
mPicturePanelScroller.setVerticalScrollBarPolicy (
ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
add (mMainArea, java.awt.BorderLayout.CENTER);
mMainArea.setLeftComponent (mHistoryScroller);
mMainArea.setRightComponent (mPicturePanelScroller);
add (mPowerBar, java.awt.BorderLayout.SOUTH);
}
/**
* Gets the state of status bar visibility.
* @return <code>true</code> if the status bar is visible.
*/
public boolean getStatusBarVisible ()
{
boolean ret;
ret = false;
for (int i = 0; !ret && (i < getComponentCount ()); i++)
if (mPowerBar == getComponent (i))
ret = true;
return (ret);
}
/**
* Sets the status bar visibility.
* @param visible The new visibility state.
* If <code>true</code>, the status bar will be unhidden.
*/
public void setStatusBarVisible (final boolean visible)
{
int index;
index = -1;
for (int i = 0; (-1 == index) && (i < getComponentCount ()); i++)
if (mPowerBar == getComponent (i))
index = i;
if (visible)
{
if (-1 == index)
{
add (mPowerBar, java.awt.BorderLayout.SOUTH);
invalidate ();
validate ();
}
}
else
if (-1 != index)
{
remove (index);
invalidate ();
validate ();
}
}
/**
* Gets the state of history list visibility.
* @return <code>true</code> if the history list is visible.
*/
public boolean getHistoryListVisible ()
{
boolean ret;
ret = false;
for (int i = 0; !ret && (i < getComponentCount ()); i++)
// check indirectly because the history list is in a splitter
if (mMainArea == getComponent (i))
ret = true;
return (ret);
}
/**
* Sets the history list visibility.
* @param visible The new visibility state.
* If <code>true</code>, the history list will be unhidden.
*/
public void setHistoryListVisible (final boolean visible)
{
int pictpanel;
int splitter;
Component component;
pictpanel = -1;
splitter = -1;
for (int i = 0; i < getComponentCount (); i++)
{
component = getComponent (i);
if (mPicturePanelScroller == component)
pictpanel = i;
else if (mMainArea == component)
splitter = i;
}
if (visible)
{
if (-1 != pictpanel)
{
remove (pictpanel);
add (mMainArea, java.awt.BorderLayout.CENTER);
mMainArea.setLeftComponent (mHistoryScroller);
//mPicturePanelScroller.setViewportView (mPicturePanel);
mMainArea.setRightComponent (mPicturePanelScroller);
invalidate ();
validate ();
}
}
else
if (-1 != splitter)
{
remove (splitter);
add (mPicturePanelScroller, java.awt.BorderLayout.CENTER);
invalidate ();
validate ();
}
}
/**
* Gets the state of the sequencer thread.
* @return <code>true</code> if the thread is pumping images.
*/
public boolean getSequencerActive ()
{
return (mSequencer.mActive);
}
/**
* Sets the sequencer activity state.
* The sequencer is the thread that moves images from the pending list
* to the picture panel on a timed basis.
* @param active The new activity state.
* If <code>true</code>, the sequencer will be turned on.
* This may alter the speed setting if it is set to zero.
*/
public void setSequencerActive (final boolean active)
{
// check the delay is not zero
if (0 == getSpeed ())
setSpeed (Sequencer.DEFAULT_DELAY);
mSequencer.mActive = active;
if (active)
synchronized (mSequencer.mPending)
{
mSequencer.mPending.notify ();
}
if (active != mRunToggle.isSelected ())
mRunToggle.setSelected (active);
}
/**
* Gets the state of the background thread.
* @return <code>true</code> if the thread is examining web pages.
*/
public boolean getBackgroundThreadActive ()
{
return (mActive);
}
/**
* Sets the state of the background thread activity.
* The background thread is responsible for examining URLs that are on
* the queue for thumbnails, and starting the image fetch operation.
* @param active If <code>true</code>,
* the background thread will be turned on.
*/
public void setBackgroundThreadActive (final boolean active)
{
mActive = active;
if (active)
synchronized (mUrls)
{
mUrls.notify ();
}
if (active != mBackgroundToggle.isSelected ())
mBackgroundToggle.setSelected (active);
}
/**
* Get the sequencer delay time.
* @return The number of milliseconds between image additions to the panel.
*/
public int getSpeed ()
{
return (mSequencer.getDelay ());
}
/**
* Set the sequencer delay time.
* The sequencer is the thread that moves images from the pending list
* to the picture panel on a timed basis. This value sets the number of
* milliseconds it waits between pictures.
* Setting it to zero toggles the running state off.
* @param speed The sequencer delay in milliseconds.
*/
public void setSpeed (final int speed)
{
if (0 == speed)
mRunToggle.setSelected (false);
else
{
mRunToggle.setSelected (true);
mSequencer.setDelay (speed);
}
if (speed != mSpeedSlider.getValue ())
mSpeedSlider.setValue (speed);
}
/**
* Getter for property discardCGI.
* @return Value of property discardCGI.
*
*/
public boolean isDiscardCGI ()
{
return (mDiscardCGI);
}
/**
* Setter for property discardCGI.
* @param discard New value of property discardCGI.
*
*/
public void setDiscardCGI (final boolean discard)
{
mDiscardCGI = discard;
}
/**
* Getter for property discardQueries.
* @return Value of property discardQueries.
*
*/
public boolean isDiscardQueries ()
{
return (mDiscardQueries);
}
/**
* Setter for property discardQueries.
* @param discard New value of property discardQueries.
*
*/
public void setDiscardQueries (final boolean discard)
{
mDiscardQueries = discard;
}
/**
* Check if the url looks like an image.
* @param url The usrl to check for image characteristics.
* @return <code>true</code> if the url ends in a recognized image
* extension.
*/
protected boolean isImage (final String url)
{
String lower = url.toLowerCase ();
return (lower.endsWith (".jpg") || lower.endsWith (".gif")
|| lower.endsWith (".png"));
}
/**
* Get the links of an element of a document.
* Only gets the links on IMG elements that reference another image.
* The latter is based on suffix (.jpg, .gif and .png).
* @param lexer The fully conditioned lexer, ready to rock.
* @param docbase The url to read.
* @return The URLs, targets of the IMG links;
* @exception IOException If the underlying infrastructure throws it.
* @exception ParserException If there is a problem parsing the url.
*/
protected URL[][] extractImageLinks (final Lexer lexer, final URL docbase)
throws
IOException,
ParserException
{
HashMap images;
HashMap links;
boolean ina; // true when within a <A></A> pair
Node node;
Tag tag;
String name;
Tag startatag;
Tag imgtag;
String href;
String src;
URL url;
URL[][] ret;
images = new HashMap ();
links = new HashMap ();
ina = false;
startatag = null;
imgtag = null;
while (null != (node = lexer.nextNode ()))
{
if (node instanceof Tag)
{
tag = (Tag)node;
name = tag.getTagName ();
if ("A".equals (name))
{
if (tag.isEndTag ())
{
ina = false;
if (null != imgtag)
{
// evidence of a thumb
href = startatag.getAttribute ("HREF");
if (null != href)
{
if (isImage (href))
{
src = imgtag.getAttribute ("SRC");
if (null != src)
try
{
url = new URL (docbase, href);
// eliminate duplicates
href = url.toExternalForm ();
if (!images.containsKey (href))
images.put (href, url);
}
catch (MalformedURLException murle)
{
// oops, forget it
}
}
}
}
}
else
{
startatag = tag;
imgtag = null;
ina = true;
href = startatag.getAttribute ("HREF");
if (null != href)
{
if (!isImage (href))
try
{
url = new URL (docbase, href);
// eliminate duplicates
href = url.toExternalForm ();
if (!links.containsKey (href))
links.put (href, url);
}
catch (MalformedURLException murle)
{
// well, obviously we don't want this one
}
}
}
}
else if (ina && "IMG".equals (name))
imgtag = tag;
}
}
ret = new URL[2][];
ret[0] = new URL[images.size ()];
images.values ().toArray (ret[0]);
ret[1] = new URL[links.size ()];
links.values ().toArray (ret[1]);
return (ret);
}
/**
* Get the image links from the current URL.
* @param url The URL to get the links from
* @return An array of two URL arrays, index 0 is a list of images,
* index 1 is a list of links to possibly follow.
*/
protected URL[][] getImageLinks (final URL url)
{
Lexer lexer;
URL[][] ret;
if (null != url)
{
try
{
lexer = new Lexer (url.openConnection ());
ret = extractImageLinks (lexer, url);
}
catch (Throwable t)
{
System.out.println (t.getMessage ());
ret = NONE;
}
}
else
ret = NONE;
return (ret);
}
/**
* Get the picture panel object encapsulated by this Thumbelina.
* @return The picture panel.
*/
public PicturePanel getPicturePanel ()
{
return (mPicturePanel);
}
/**
* Add a PropertyChangeListener to the listener list.
* The listener is registered for all properties.
* @param listener The PropertyChangeListener to be added.
*/
public void addPropertyChangeListener (
final PropertyChangeListener listener)
{
mPropertySupport.addPropertyChangeListener (listener);
}
/**
* Remove a PropertyChangeListener from the listener list.
* This removes a PropertyChangeListener that was registered for all
* properties.
* @param listener The PropertyChangeListener to be removed.
*/
public void removePropertyChangeListener (
final PropertyChangeListener listener)
{
mPropertySupport.removePropertyChangeListener (listener);
}
/**
* Return the URL currently being examined.
* This is a bound property. Notifications are available via the
* PROP_CURRENT_URL_PROPERTY property.
* @return The size of the 'to be examined' list.
*/
public String getCurrentURL ()
{
return (mCurrentURL);
}
/**
* Set the current URL being examined.
* @param url The url that is being examined.
*/
protected void setCurrentURL (final String url)
{
String oldValue;
if (((null != url) && !url.equals (mCurrentURL))
|| ((null == url) && (null != mCurrentURL)))
{
oldValue = mCurrentURL;
mCurrentURL = url;
mPropertySupport.firePropertyChange (
PROP_CURRENT_URL_PROPERTY, oldValue, url);
}
}
/**
* Apply a change in 'to be examined' URL list size.
* Sends notification via the <code>PROP_URL_QUEUE_PROPERTY</code> property
* and updates the status bar.
* @param original The original size of the list.
* @param current The new size of the list.
*/
protected void updateQueueSize (final int original, final int current)
{
StringBuffer buffer;
buffer = new StringBuffer ();
buffer.append (current);
while (buffer.length () < 5)
buffer.insert (0, '0');
mQueueSize.setText (buffer.toString ());
mPropertySupport.firePropertyChange (
PROP_URL_QUEUE_PROPERTY, original, current);
}
/**
* Apply a change in 'visited' URL list size.
* Sends notification via the <code>PROP_URL_VISITED_PROPERTY</code>
* property and updates the status bar.
* @param original The original size of the list.
* @param current The new size of the list.
*/
protected void updateVisitedSize (final int original, final int current)
{
StringBuffer buffer;
buffer = new StringBuffer ();
buffer.append (current);
while (buffer.length () < 5)
buffer.insert (0, '0');
mVisitedSize.setText (buffer.toString ());
mPropertySupport.firePropertyChange (
PROP_URL_VISITED_PROPERTY, original, current);
}
/**
* Fetch images.
* Ask the toolkit to make the image from a URL, and add a tracker
* to handle it when it's received.
* Add details to the rquested and tracked lists and update
* the status bar.
* @param images The list of images to fetch.
*/
protected void fetch (final URL[] images)
{
Image image;
Tracker tracker;
int size;
for (int j = 0; j < images.length; j++)
{
if (!mRequested.containsKey (
images[j].toExternalForm ()))
{
image = getToolkit ().createImage (images[j]);
tracker = new Tracker (images[j]);
synchronized (mTracked)
{
size = mTracked.size () + 1;
if (mQueueProgress.getMaximum () < size)
{
try
{
mTracked.wait ();
}
catch (InterruptedException ie)
{
// this won't happen, just continue on
}
}
mRequested.put (images[j].toExternalForm (), images[j]);
mTracked.put (images[j].toExternalForm (), images[j]);
mQueueProgress.setValue (size);
image.getWidth (tracker); // trigger the observer
}
}
}
}
//
// Runnable interface
//
/**
* The main processing loop.
* Pull suspect URLs off the queue one at a time, fetch and parse it,
* request images and enqueue further links.
*/
public void run ()
{
URL link;
int original;
String href;
URL[][] urls;
while (true)
{
try
{
link = null;
original = -1;
synchronized (mUrls)
{
if (0 != mUrls.size ())
{
original = mUrls.size ();
link = (URL)mUrls.remove (0);
}
else
// don't spin crazily on an empty list
Thread.sleep (100);
}
if (null != link)
{
updateQueueSize (original, mUrls.size ());
href = link.toExternalForm ();
setCurrentURL (href);
mVisited.put (href, link);
updateVisitedSize (
mVisited.size () - 1, mVisited.size ());
urls = getImageLinks (link);
fetch (urls[0]);
//append (filter (urls[1]));
synchronized (mEnqueuers)
{
Enqueuer enqueuer = new Enqueuer (urls[1]);
enqueuer.setPriority (Thread.MIN_PRIORITY);
mEnqueuers.add (enqueuer);
enqueuer.start ();
}
setCurrentURL (null);
}
if (!mActive)
synchronized (mUrls)
{
mUrls.wait ();
}
}
catch (Throwable t)
{
t.printStackTrace ();
}
}
}
static ArrayList mEnqueuers = new ArrayList ();
class Enqueuer extends Thread
{
URL[] mList;
public Enqueuer (URL[] list)
{
mList = list;
}
public void run ()
{
append (filter (mList));
synchronized (mEnqueuers)
{
mEnqueuers.remove (this);
}
}
}
//
// ItemListener interface
//
/**
* Handle checkbox events from the status bar.
* Based on the thread toggles, activates or deactivates the
* background thread processes.
* @param event The event describing the checkbox event.
*/
public void itemStateChanged (final ItemEvent event)
{
Object source;
boolean checked;
source = event.getItemSelectable ();
checked = ItemEvent.SELECTED == event.getStateChange ();
if (source == mRunToggle)
setSequencerActive (checked);
else if (source == mBackgroundToggle)
setBackgroundThreadActive (checked);
}
//
// ChangeListener interface
//
/**
* Handles the speed slider events.
* @param event The event describing the slider activity.
*/
public void stateChanged (final ChangeEvent event)
{
JSlider source;
source = (JSlider)event.getSource ();
if (!source.getValueIsAdjusting ())
setSpeed (source.getValue ());
}
//
// ListSelectionListener interface
//
/**
* Handles the history list events.
* @param event The event describing the list activity.
*/
public void valueChanged (final ListSelectionEvent event)
{
JList source;
Object[] hrefs;
Picture picture;
URL url;
Image image;
Tracker tracker;
source = (JList)event.getSource ();
if (source == mHistory && !event.getValueIsAdjusting ())
{
hrefs = source.getSelectedValues ();
for (int i = 0; i < hrefs.length; i++)
{
picture = mPicturePanel.find ("http://" + (String)hrefs[i]);
if (null != picture)
mPicturePanel.bringToTop (picture);
else
try
{
url = new URL ("http://" + (String)hrefs[i]);
image = getToolkit ().createImage (url);
tracker = new Tracker (url);
image.getWidth (tracker);
System.out.println ("refetching " + hrefs[i]);
}
catch (MalformedURLException murle)
{
murle.printStackTrace ();
}
}
}
}
/**
* Adds the given url to the history list.
* Also puts the URL in the url text of the status bar.
* @param url The URL to add to the history list.
*/
public void addHistory (String url)
{
int index;
DefaultListModel model;
mUrlText.setText (url);
// chop off the protocol
index = url.indexOf ("http://");
if (-1 != index)
url = url.substring (index + 7);
else
System.out.println ("********* " + url + " ************");
model = (DefaultListModel)mHistory.getModel ();
model.addElement (url);
// this doesn't friggin work:
// mHistory.ensureIndexIsVisible (model.getSize ());
}
/**
* Open a URL.
* Resets the urls list and appends the given url as the only item.
* @param ref The URL to add.
*/
public void open (String ref)
{
URL url;
try
{
if (!ref.startsWith ("http://"))
ref = "http://" + ref;
url = new URL (ref);
reset ();
append (url);
}
catch (Exception e)
{
System.out.println (e.getMessage ());
}
}
/**
* Provide command line help.
*/
protected static void help ()
{
System.out.println ("Thumbelina - Scan and display the images behind thumbnails.");
System.out.println ("java -Xmx256M -jar thumbelina.jar [url]");
System.out.println ("It is highly recommended that the maximum heap "
+ "size be increased with -Xmx switch.");
System.exit (0);
}
/**
* Mainline.
* @param args the command line arguments.
* Can be one or more forms of -help to get command line help,
* or a URL to prime the program with.
* Checks for JDK 1.4 and if not found runs in crippled mode
* (no ThumbelinaFrame).
*/
public static void main (final String[] args)
{
URL url;
String version;
JFrame frame;
Thumbelina thumbelina;
System.setProperty ("sun.net.client.defaultReadTimeout", "7000");
System.setProperty ("sun.net.client.defaultConnectTimeout", "7000");
url = null;
if (0 != args.length)
try
{
if (args[0].equalsIgnoreCase ("help")
|| args[0].equalsIgnoreCase ("-help")
|| args[0].equalsIgnoreCase ("-h")
|| args[0].equalsIgnoreCase ("?")
|| args[0].equalsIgnoreCase ("-?"))
help ();
else
url = new URL (args[0]);
}
catch (MalformedURLException murle)
{
System.err.println (murle.getMessage ());
help ();
}
version = System.getProperty ("java.version");
if (version.startsWith ("1.4") || version.startsWith ("1.5"))
frame = new ThumbelinaFrame (url);
else
{
if (null == url)
help ();
System.out.println (
"Java version is only "
+ version
+ ", entering crippled mode");
frame = new JFrame ("Thumbelina");
thumbelina = new Thumbelina (url);
frame.getContentPane ().add (thumbelina, BorderLayout.CENTER);
frame.setBounds (10, 10, 640, 480);
frame.addWindowListener (new WindowAdapter ()
{
public void windowClosing (final WindowEvent event)
{
System.exit (0);
}
});
}
frame.setVisible (true);
}
/**
* Getter for property queue.
* @return List of URLs that are to be visited.
*/
public ArrayList getQueue ()
{
return (mUrls);
}
/**
* Getter for property queue.
* This is a bound property. Notifications are available via the
* <code>PROP_URL_QUEUE_PROPERTY</code> property.
* @return The size of the list of URLs that are to be visited.
*/
public int getQueueSize ()
{
return (mUrls.size ());
}
/**
* Track incoming asynchronous image reception.
* On completion, adds the image to the pending list.
*/
class Tracker implements ImageObserver
{
/**
* The url the image is comming from.
*/
protected URL mSource;
/**
* Create an image tracker.
* @param source The URL the image is being fetched from.
*/
public Tracker (final URL source)
{
mSource = source;
}
//
// ImageObserver interface
//
/**
* This method is called when information about an image which was
* previously requested using an asynchronous interface becomes
* available. Asynchronous interfaces are method calls such as
* getWidth(ImageObserver) and drawImage(img, x, y, ImageObserver)
* which take an ImageObserver object as an argument. Those methods
* register the caller as interested either in information about
* the overall image itself (in the case of getWidth(ImageObserver))
* or about an output version of an image (in the case of the
* drawImage(img, x, y, [w, h,] ImageObserver) call).
*
* <p>This method
* should return true if further updates are needed or false if the
* required information has been acquired. The image which was being
* tracked is passed in using the img argument. Various constants
* are combined to form the infoflags argument which indicates what
* information about the image is now available. The interpretation
* of the x, y, width, and height arguments depends on the contents
* of the infoflags argument.
* <p>
* The <code>infoflags</code> argument should be the bitwise inclusive
* <b>OR</b> of the following flags: <code>WIDTH</code>,
* <code>HEIGHT</code>, <code>PROPERTIES</code>, <code>SOMEBITS</code>,
* <code>FRAMEBITS</code>, <code>ALLBITS</code>, <code>ERROR</code>,
* <code>ABORT</code>.
*
* @param image the image being observed.
* @param infoflags the bitwise inclusive OR of the following
* flags: <code>WIDTH</code>, <code>HEIGHT</code>,
* <code>PROPERTIES</code>, <code>SOMEBITS</code>,
* <code>FRAMEBITS</code>, <code>ALLBITS</code>,
* <code>ERROR</code>, <code>ABORT</code>.
* @param x the <i>x</i> coordinate.
* @param y the <i>y</i> coordinate.
* @param width the width.
* @param height the height.
* @return <code>false</code> if the infoflags indicate that the
* image is completely loaded; <code>true</code> otherwise.
*
* @see #WIDTH
* @see #HEIGHT
* @see #PROPERTIES
* @see #SOMEBITS
* @see #FRAMEBITS
* @see #ALLBITS
* @see #ERROR
* @see #ABORT
* @see Image#getWidth
* @see Image#getHeight
* @see java.awt.Graphics#drawImage
*/
public synchronized boolean imageUpdate (
final Image image,
final int infoflags,
final int x,
final int y,
final int width,
final int height)
{
boolean done;
boolean error;
boolean abort;
URL url;
done = (0 != (infoflags & ImageObserver.ALLBITS));
abort = (0 != (infoflags & ImageObserver.ABORT));
error = (0 != (infoflags & ImageObserver.ERROR));
if (done || abort || error)
synchronized (mTracked)
{
url = (URL)mTracked.remove (mSource.toExternalForm ());
mTracked.notify ();
mQueueProgress.setValue (mTracked.size ());
if (done)
mSequencer.add (image, mSource, (null != url));
}
return (!done);
}
}
}
/*
* Revision Control Modification History
*
* $Log: Thumbelina.java,v $
* Revision 1.7 2005/02/13 20:36:00 derrickoswald
* FilterBuilder
*
* Revision 1.6 2004/07/31 16:42:30 derrickoswald
* Remove unused variables and other fixes exposed by turning on compiler warnings.
*
* Revision 1.5 2004/05/24 16:18:17 derrickoswald
* Part three of a multiphase refactoring.
* The three node types are now fronted by interfaces (program to the interface paradigm)
* with concrete implementations in the new htmlparser.nodes package. Classes from the
* lexer.nodes package are moved to this package, and obvious references to the concrete
* classes that got broken by this have been changed to use the interfaces where possible.
*
* Revision 1.4 2004/05/16 17:59:56 derrickoswald
* Alter bound property name constants to agree with section
* 8.8 Capitalization of inferred names.
* in the JavaBeans API specification.
*
* Revision 1.3 2003/11/04 01:25:02 derrickoswald
* Made visiting order the same order as on the page.
* The 'shouldRecurseSelf' boolean of NodeVisitor could probably
* be removed since it doesn't make much sense any more.
* Fixed StringBean, which was still looking for end tags with names starting with
* a slash, i.e. "/SCRIPT", silly beany.
* Added some debugging support to the lexer, you can easily base a breakpoint on
* line number.
*
* Revision 1.2 2003/10/26 16:44:01 derrickoswald
* Get thumbelina working again. The tag.getName() method doesn't include the / of end tags.
*
* Revision 1.1 2003/09/21 18:20:56 derrickoswald
* Thumbelina
* Created a lexer GUI application to extract images behind thumbnails.
* Added a task in the ant build script - thumbelina - to create the jar file.
* You need JDK 1.4.x to build it. It can be run on JDK 1.3.x in crippled mode.
* Usage: java -Xmx256M thumbelina.jar [URL]
*
*
*/
| [
"sari@alumni.bilkent.edu.tr"
] | sari@alumni.bilkent.edu.tr |
3f9b3b40a215e53b68f878c00f7d986246725852 | a04faaa74800504f272178cd9de7d0d66ae9d130 | /JavaScript/src/main/java/userdb/dao/UserDAOImpl.java | dc1090fc55ecc19a0f5b0463e44431fa4f7bb1da | [] | no_license | PukanBOOM/NR | e56ab4c6343473819dce12d4648c3a6b4db6e683 | 42113fedfe2179d3f9aa003161a5574f8345b726 | refs/heads/main | 2023-03-06T06:22:01.728752 | 2021-02-20T23:47:02 | 2021-02-20T23:47:02 | 319,016,449 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,982 | java | package userdb.dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import userdb.model.User;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import javax.persistence.TypedQuery;
import java.util.List;
@Repository
@Transactional(transactionManager = "transaction")
public class UserDAOImpl implements UserDAO {
@PersistenceContext
private EntityManager entityManager;
@Autowired
public void setSessionFactory(EntityManager entityManager) {
this.entityManager = entityManager;
}
@Override
public List<User> allUsers() {
return entityManager.createQuery("From User").getResultList();
}
@Override
public void add(User user) {
entityManager.getTransaction().begin();
entityManager.persist(user);
entityManager.getTransaction().commit();
}
@Override
public void delete(User user) {
entityManager.getTransaction().begin();
entityManager.remove(user);
entityManager.getTransaction().commit();
}
@Override
public void edit(User user) {
entityManager.getTransaction().begin();
entityManager.merge(user);
entityManager.getTransaction().commit();
}
@Override
public User getById(int id) {
return entityManager.find(User.class, id);
}
@Override
public User getUserByName(String username) {
TypedQuery<User> query = entityManager.createQuery(
"SELECT user FROM User user WHERE user.username = :username", User.class);
User user = query.setParameter("username", username)
.getSingleResult();
return user;
}
}
| [
"noreply@github.com"
] | noreply@github.com |
5c8fc58053517aedf59785370dc926bf3bf0b608 | 4a398180edddc9656087ea97c9d0eec5ac4b0da1 | /app/src/main/java/com/example/viet/weatherapp/di/module/NetModule.java | fbb77d8c90db222239df78d58cddad1d824c2893 | [] | no_license | vietcoscc/WeatherApp | 8cfbbdd6f63cb7e763ac82f39ddf77272a0d3989 | dbc4b2fd18e3645fbc78489b81d044e4ff3fa9fe | refs/heads/master | 2021-01-20T04:04:51.063555 | 2017-08-29T06:57:19 | 2017-08-29T06:57:19 | 101,380,250 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 777 | java | package com.example.viet.weatherapp.di.module;
import com.example.viet.weatherapp.ui.main.MainMvpView;
import com.example.viet.weatherapp.ui.main.MainPresenter;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
/**
* Created by viet on 25/08/2017.
*/
@Module
@Singleton
public class NetModule {
private String mBaseUrl;
public NetModule(String baseUrl) {
this.mBaseUrl = baseUrl;
}
@Provides
@Singleton
Retrofit provideRetrofit() {
Retrofit retrofit = new Retrofit.Builder()
.addConverterFactory(GsonConverterFactory.create())
.baseUrl(mBaseUrl).build();
return retrofit;
}
}
| [
"vietcoscc"
] | vietcoscc |
f3d477dd8602186b4e606d17d0fc1ee1abff969b | d3101bdf9d98f867dc98ad3088028abe0142c65b | /app/src/main/java/com/batteria/gldroid/utils/BufferUtil.java | 1170b168078db3e1de95d774ef43c05a3ff0295e | [] | no_license | BubbleDomain/GLdroid | 688523428715ca30a40d31ecc5ac8a7d83e68e04 | 7c574ca3c05870d096831e2742fbd422b973350b | refs/heads/main | 2023-06-30T05:46:49.648258 | 2021-08-05T11:38:08 | 2021-08-05T11:38:08 | 390,914,515 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 788 | java | package com.batteria.gldroid.utils;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
/**
* @author: yaobeihaoyu
* @version: 1.0
* @since: 2021/7/29
* @description:
*/
public class BufferUtil {
public static FloatBuffer floatToBuffer(float[] input) {
FloatBuffer output = ByteBuffer.allocateDirect(input.length * 4)
.order(ByteOrder.nativeOrder()).asFloatBuffer().put(input);
output.position(0);
return output;
}
public static IntBuffer intToBuffer(int[] input) {
IntBuffer output = ByteBuffer.allocateDirect(input.length * 4)
.order(ByteOrder.nativeOrder()).asIntBuffer().put(input);
output.position(0);
return output;
}
} | [
"yaobeihaoyu@bilibili.com"
] | yaobeihaoyu@bilibili.com |
a6549a2cc06a09ffb157769fa4c6ce4938c842ca | 480175305d7cb4c959c0ad81f64bbe695ee36a2d | /src/test/java/congye6/HotelBooking/test/bl/transaction/TransactionTest.java | 141bc3092093d72707caa153bfe9cf1d3584710f | [] | no_license | congye6/HotelBooking | 2794fd24f4e5895afea7efb794eb53e5d26cfacb | 9cb440c66c65a1c98db168de1e472813550f4a6d | refs/heads/master | 2021-01-12T06:52:54.874885 | 2017-02-07T09:16:44 | 2017-02-07T09:16:44 | 76,854,733 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 976 | java | package congye6.HotelBooking.test.bl.transaction;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
import congye6.HotelBooking.blservice.user.AccountBlService;
import congye6.HotelBooking.enumeration.UserType;
import congye6.HotelBooking.mapper.user.AccountMapper;
import congye6.HotelBooking.po.AccountPO;
import congye6.HotelBooking.test.ConstValue;
import congye6.HotelBooking.vo.AccountVO;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({ConstValue.SPRING_SERVICE_PATH,ConstValue.SPRING_DAO_PATH})
public class TransactionTest {
@Autowired
private AccountBlService bl;
@Test
public void transaction(){
bl.addAccount(new AccountVO(0, "666", UserType.PROMOTION_STAFF));
}
}
| [
"244053679@qq.com"
] | 244053679@qq.com |
28c7fe4719ad5de141c21b4998bc278410475808 | 7f298c2bf9ff5a61eeb87e3929e072c9a04c8832 | /spring-webflux/src/main/java/org/springframework/web/reactive/resource/ResourceWebHandler.java | 37c6029dbd1103e38dde18c65898c2a395f97b59 | [
"Apache-2.0"
] | permissive | stwen/my-spring5 | 1ca1e85786ba1b5fdb90a583444a9c030fe429dd | d44be68874b8152d32403fe87c39ae2a8bebac18 | refs/heads/master | 2023-02-17T19:51:32.686701 | 2021-01-15T05:39:14 | 2021-01-15T05:39:14 | 322,756,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 17,624 | java | /*
* Copyright 2002-2018 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.springframework.web.reactive.resource;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.Set;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import reactor.core.publisher.Mono;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.ResolvableType;
import org.springframework.core.io.Resource;
import org.springframework.http.CacheControl;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.MediaTypeFactory;
import org.springframework.http.codec.ResourceHttpMessageWriter;
import org.springframework.http.server.PathContainer;
import org.springframework.lang.Nullable;
import org.springframework.util.Assert;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ResourceUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.reactive.HandlerMapping;
import org.springframework.web.server.MethodNotAllowedException;
import org.springframework.web.server.ResponseStatusException;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebHandler;
/**
* {@code HttpRequestHandler} that serves static resources in an optimized way
* according to the guidelines of Page Speed, YSlow, etc.
*
* <p>The {@linkplain #setLocations "locations"} property takes a list of Spring
* {@link Resource} locations from which static resources are allowed to
* be served by this handler. Resources could be served from a classpath location,
* e.g. "classpath:/META-INF/public-web-resources/", allowing convenient packaging
* and serving of resources such as .js, .css, and others in jar files.
*
* <p>This request handler may also be configured with a
* {@link #setResourceResolvers(List) resourcesResolver} and
* {@link #setResourceTransformers(List) resourceTransformer} chains to support
* arbitrary resolution and transformation of resources being served. By default a
* {@link PathResourceResolver} simply finds resources based on the configured
* "locations". An application can configure additional resolvers and
* transformers such as the {@link VersionResourceResolver} which can resolve
* and prepare URLs for resources with a version in the URL.
*
* <p>This handler also properly evaluates the {@code Last-Modified} header (if
* present) so that a {@code 304} status code will be returned as appropriate,
* avoiding unnecessary overhead for resources that are already cached by the
* client.
*
* @author Rossen Stoyanchev
* @author Brian Clozel
* @since 5.0
*/
public class ResourceWebHandler implements WebHandler, InitializingBean {
private static final Set<HttpMethod> SUPPORTED_METHODS = EnumSet.of(HttpMethod.GET, HttpMethod.HEAD);
private static final Exception NOT_FOUND_EXCEPTION = new ResponseStatusException(HttpStatus.NOT_FOUND);
private static final Log logger = LogFactory.getLog(ResourceWebHandler.class);
private final List<Resource> locations = new ArrayList<>(4);
private final List<ResourceResolver> resourceResolvers = new ArrayList<>(4);
private final List<ResourceTransformer> resourceTransformers = new ArrayList<>(4);
@Nullable
private ResourceResolverChain resolverChain;
@Nullable
private ResourceTransformerChain transformerChain;
@Nullable
private CacheControl cacheControl;
@Nullable
private ResourceHttpMessageWriter resourceHttpMessageWriter;
/**
* Set the {@code List} of {@code Resource} paths to use as sources
* for serving static resources.
*/
public void setLocations(@Nullable List<Resource> locations) {
this.locations.clear();
if (locations != null) {
this.locations.addAll(locations);
}
}
/**
* Return the {@code List} of {@code Resource} paths to use as sources
* for serving static resources.
*/
public List<Resource> getLocations() {
return this.locations;
}
/**
* Configure the list of {@link ResourceResolver}s to use.
* <p>By default {@link PathResourceResolver} is configured. If using this property,
* it is recommended to add {@link PathResourceResolver} as the last resolver.
*/
public void setResourceResolvers(@Nullable List<ResourceResolver> resourceResolvers) {
this.resourceResolvers.clear();
if (resourceResolvers != null) {
this.resourceResolvers.addAll(resourceResolvers);
}
}
/**
* Return the list of configured resource resolvers.
*/
public List<ResourceResolver> getResourceResolvers() {
return this.resourceResolvers;
}
/**
* Configure the list of {@link ResourceTransformer}s to use.
* <p>By default no transformers are configured for use.
*/
public void setResourceTransformers(@Nullable List<ResourceTransformer> resourceTransformers) {
this.resourceTransformers.clear();
if (resourceTransformers != null) {
this.resourceTransformers.addAll(resourceTransformers);
}
}
/**
* Return the list of configured resource transformers.
*/
public List<ResourceTransformer> getResourceTransformers() {
return this.resourceTransformers;
}
/**
* Set the {@link org.springframework.http.CacheControl} instance to build
* the Cache-Control HTTP response header.
*/
public void setCacheControl(@Nullable CacheControl cacheControl) {
this.cacheControl = cacheControl;
}
/**
* Return the {@link org.springframework.http.CacheControl} instance to build
* the Cache-Control HTTP response header.
*/
@Nullable
public CacheControl getCacheControl() {
return this.cacheControl;
}
/**
* Configure the {@link ResourceHttpMessageWriter} to use.
* <p>By default a {@link ResourceHttpMessageWriter} will be configured.
*/
public void setResourceHttpMessageWriter(@Nullable ResourceHttpMessageWriter httpMessageWriter) {
this.resourceHttpMessageWriter = httpMessageWriter;
}
/**
* Return the configured resource message writer.
*/
@Nullable
public ResourceHttpMessageWriter getResourceHttpMessageWriter() {
return this.resourceHttpMessageWriter;
}
@Override
public void afterPropertiesSet() throws Exception {
if (this.resourceResolvers.isEmpty()) {
this.resourceResolvers.add(new PathResourceResolver());
}
initAllowedLocations();
if (getResourceHttpMessageWriter() == null) {
this.resourceHttpMessageWriter = new ResourceHttpMessageWriter();
}
// Initialize immutable resolver and transformer chains
this.resolverChain = new DefaultResourceResolverChain(this.resourceResolvers);
this.transformerChain = new DefaultResourceTransformerChain(this.resolverChain, this.resourceTransformers);
}
/**
* Look for a {@code PathResourceResolver} among the configured resource
* resolvers and set its {@code allowedLocations} property (if empty) to
* match the {@link #setLocations locations} configured on this class.
*/
protected void initAllowedLocations() {
if (CollectionUtils.isEmpty(this.locations)) {
if (logger.isWarnEnabled()) {
logger.warn("Locations list is empty. No resources will be served unless a " +
"custom ResourceResolver is configured as an alternative to PathResourceResolver.");
}
return;
}
for (int i = getResourceResolvers().size() - 1; i >= 0; i--) {
if (getResourceResolvers().get(i) instanceof PathResourceResolver) {
PathResourceResolver resolver = (PathResourceResolver) getResourceResolvers().get(i);
if (ObjectUtils.isEmpty(resolver.getAllowedLocations())) {
resolver.setAllowedLocations(getLocations().toArray(new Resource[0]));
}
break;
}
}
}
/**
* Processes a resource request.
* <p>Checks for the existence of the requested resource in the configured list of locations.
* If the resource does not exist, a {@code 404} response will be returned to the client.
* If the resource exists, the request will be checked for the presence of the
* {@code Last-Modified} header, and its value will be compared against the last-modified
* timestamp of the given resource, returning a {@code 304} status code if the
* {@code Last-Modified} value is greater. If the resource is newer than the
* {@code Last-Modified} value, or the header is not present, the content resource
* of the resource will be written to the response with caching headers
* set to expire one year in the future.
*/
@Override
public Mono<Void> handle(ServerWebExchange exchange) {
return getResource(exchange)
.switchIfEmpty(Mono.defer(() -> {
logger.trace("No matching resource found - returning 404");
return Mono.error(NOT_FOUND_EXCEPTION);
}))
.flatMap(resource -> {
try {
if (HttpMethod.OPTIONS.matches(exchange.getRequest().getMethodValue())) {
exchange.getResponse().getHeaders().add("Allow", "GET,HEAD,OPTIONS");
return Mono.empty();
}
// Supported methods and required session
HttpMethod httpMethod = exchange.getRequest().getMethod();
if (!SUPPORTED_METHODS.contains(httpMethod)) {
return Mono.error(new MethodNotAllowedException(
exchange.getRequest().getMethodValue(), SUPPORTED_METHODS));
}
// Header phase
if (exchange.checkNotModified(Instant.ofEpochMilli(resource.lastModified()))) {
logger.trace("Resource not modified - returning 304");
return Mono.empty();
}
// Apply cache settings, if any
if (getCacheControl() != null) {
String value = getCacheControl().getHeaderValue();
if (value != null) {
exchange.getResponse().getHeaders().setCacheControl(value);
}
}
// Check the media type for the resource
MediaType mediaType = MediaTypeFactory.getMediaType(resource).orElse(null);
if (mediaType != null) {
if (logger.isTraceEnabled()) {
logger.trace("Determined media type '" + mediaType + "' for " + resource);
}
} else {
if (logger.isTraceEnabled()) {
logger.trace("No media type found " +
"for " + resource + " - not sending a content-type header");
}
}
// Content phase
if (HttpMethod.HEAD.matches(exchange.getRequest().getMethodValue())) {
setHeaders(exchange, resource, mediaType);
exchange.getResponse().getHeaders().set(HttpHeaders.ACCEPT_RANGES, "bytes");
logger.trace("HEAD request - skipping content");
return Mono.empty();
}
setHeaders(exchange, resource, mediaType);
ResourceHttpMessageWriter writer = getResourceHttpMessageWriter();
Assert.state(writer != null, "No ResourceHttpMessageWriter");
return writer.write(Mono.just(resource),
null, ResolvableType.forClass(Resource.class), mediaType,
exchange.getRequest(), exchange.getResponse(), Collections.emptyMap());
} catch (IOException ex) {
return Mono.error(ex);
}
});
}
protected Mono<Resource> getResource(ServerWebExchange exchange) {
String name = HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE;
PathContainer pathWithinHandler = exchange.getRequiredAttribute(name);
String path = processPath(pathWithinHandler.value());
if (!StringUtils.hasText(path) || isInvalidPath(path)) {
if (logger.isTraceEnabled()) {
logger.trace("Ignoring invalid resource path [" + path + "]");
}
return Mono.empty();
}
if (isInvalidEncodedPath(path)) {
if (logger.isTraceEnabled()) {
logger.trace("Ignoring invalid resource path with escape sequences [" + path + "]");
}
return Mono.empty();
}
Assert.notNull(this.resolverChain, "ResourceResolverChain not initialized.");
Assert.notNull(this.transformerChain, "ResourceTransformerChain not initialized.");
return this.resolverChain.resolveResource(exchange, path, getLocations())
.flatMap(resource -> this.transformerChain.transform(exchange, resource));
}
/**
* Process the given resource path.
* <p>The default implementation replaces:
* <ul>
* <li>Backslash with forward slash.
* <li>Duplicate occurrences of slash with a single slash.
* <li>Any combination of leading slash and control characters (00-1F and 7F)
* with a single "/" or "". For example {@code " / // foo/bar"}
* becomes {@code "/foo/bar"}.
* </ul>
*
* @since 3.2.12
*/
protected String processPath(String path) {
path = StringUtils.replace(path, "\\", "/");
path = cleanDuplicateSlashes(path);
return cleanLeadingSlash(path);
}
private String cleanDuplicateSlashes(String path) {
StringBuilder sb = null;
char prev = 0;
for (int i = 0; i < path.length(); i++) {
char curr = path.charAt(i);
try {
if ((curr == '/') && (prev == '/')) {
if (sb == null) {
sb = new StringBuilder(path.substring(0, i));
}
continue;
}
if (sb != null) {
sb.append(path.charAt(i));
}
} finally {
prev = curr;
}
}
return sb != null ? sb.toString() : path;
}
private String cleanLeadingSlash(String path) {
boolean slash = false;
for (int i = 0; i < path.length(); i++) {
if (path.charAt(i) == '/') {
slash = true;
} else if (path.charAt(i) > ' ' && path.charAt(i) != 127) {
if (i == 0 || (i == 1 && slash)) {
return path;
}
path = slash ? "/" + path.substring(i) : path.substring(i);
if (logger.isTraceEnabled()) {
logger.trace("Path after trimming leading '/' and control characters: " + path);
}
return path;
}
}
return (slash ? "/" : "");
}
/**
* Check whether the given path contains invalid escape sequences.
*
* @param path the path to validate
* @return {@code true} if the path is invalid, {@code false} otherwise
*/
private boolean isInvalidEncodedPath(String path) {
if (path.contains("%")) {
try {
// Use URLDecoder (vs UriUtils) to preserve potentially decoded UTF-8 chars
String decodedPath = URLDecoder.decode(path, "UTF-8");
if (isInvalidPath(decodedPath)) {
return true;
}
decodedPath = processPath(decodedPath);
if (isInvalidPath(decodedPath)) {
return true;
}
} catch (IllegalArgumentException | UnsupportedEncodingException ex) {
// Should never happen...
}
}
return false;
}
/**
* Identifies invalid resource paths. By default rejects:
* <ul>
* <li>Paths that contain "WEB-INF" or "META-INF"
* <li>Paths that contain "../" after a call to
* {@link StringUtils#cleanPath}.
* <li>Paths that represent a {@link ResourceUtils#isUrl
* valid URL} or would represent one after the leading slash is removed.
* </ul>
* <p><strong>Note:</strong> this method assumes that leading, duplicate '/'
* or control characters (e.g. white space) have been trimmed so that the
* path starts predictably with a single '/' or does not have one.
*
* @param path the path to validate
* @return {@code true} if the path is invalid, {@code false} otherwise
*/
protected boolean isInvalidPath(String path) {
if (logger.isTraceEnabled()) {
logger.trace("Applying \"invalid path\" checks to path: " + path);
}
if (path.contains("WEB-INF") || path.contains("META-INF")) {
if (logger.isTraceEnabled()) {
logger.trace("Path contains \"WEB-INF\" or \"META-INF\".");
}
return true;
}
if (path.contains(":/")) {
String relativePath = (path.charAt(0) == '/' ? path.substring(1) : path);
if (ResourceUtils.isUrl(relativePath) || relativePath.startsWith("url:")) {
if (logger.isTraceEnabled()) {
logger.trace("Path represents URL or has \"url:\" prefix.");
}
return true;
}
}
if (path.contains("..")) {
path = StringUtils.cleanPath(path);
if (path.contains("../")) {
if (logger.isTraceEnabled()) {
logger.trace("Path contains \"../\" after call to StringUtils#cleanPath.");
}
return true;
}
}
return false;
}
/**
* Set headers on the response. Called for both GET and HEAD requests.
*
* @param exchange current exchange
* @param resource the identified resource (never {@code null})
* @param mediaType the resource's media type (never {@code null})
*/
protected void setHeaders(ServerWebExchange exchange, Resource resource, @Nullable MediaType mediaType)
throws IOException {
HttpHeaders headers = exchange.getResponse().getHeaders();
long length = resource.contentLength();
headers.setContentLength(length);
if (mediaType != null) {
headers.setContentType(mediaType);
}
if (resource instanceof HttpResource) {
HttpHeaders resourceHeaders = ((HttpResource) resource).getResponseHeaders();
exchange.getResponse().getHeaders().putAll(resourceHeaders);
}
}
@Override
public String toString() {
return "ResourceWebHandler [locations=" + getLocations() + ", resolvers=" + getResourceResolvers() + "]";
}
}
| [
"xianhao_gan@qq.com"
] | xianhao_gan@qq.com |
ea78e24f2aa341be6fcf79651e65416c88f04144 | b036f8c1381585753bfddb8c3d2d248af8dd11ee | /CustomPlayerModels/src/shared/java/com/tom/cpm/shared/model/PlayerPartValues.java | 00d5da8c1a2c91b6d5a94344222d9166bf4683aa | [
"MIT"
] | permissive | Skinforge/CustomPlayerModels | 661e33a6d5c862397f4486237ae0c1135e723d26 | 6c81155d564acd005c00ab47f0cb6f0e7c894d2b | refs/heads/master | 2023-08-28T05:13:16.755688 | 2021-10-03T17:32:49 | 2021-10-03T17:32:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,081 | java | package com.tom.cpm.shared.model;
import com.tom.cpl.math.Vec2i;
import com.tom.cpl.math.Vec3f;
import com.tom.cpm.shared.editor.util.PlayerSkinLayer;
public enum PlayerPartValues implements PartValues {// px, py, pz, ox, oy, oz, sx, sy, sz, u, v, u2, v2, [type]
HEAD (PlayerModelParts.HEAD, PlayerSkinLayer.HAT, 0, 0, 0, -4, -8, -4, 8, 8, 8, 0, 0, 32, 0),
BODY (PlayerModelParts.BODY, PlayerSkinLayer.JACKET, 0, 0, 0, -4, 0, -2, 8, 12, 4, 16, 16, 16, 32),
LEFT_ARM (PlayerModelParts.LEFT_ARM, PlayerSkinLayer.LEFT_SLEEVE, 5, 2, 0, -1, -2, -2, 4, 12, 4, 32, 48, 48, 48, SkinType.DEFAULT),
RIGHT_ARM (PlayerModelParts.RIGHT_ARM, PlayerSkinLayer.RIGHT_SLEEVE, -5, 2, 0, -3, -2, -2, 4, 12, 4, 40, 16, 40, 32, SkinType.DEFAULT),
LEFT_ARM_S (PlayerModelParts.LEFT_ARM, PlayerSkinLayer.LEFT_SLEEVE, 5, 2, 0, -1, -2, -2, 3, 12, 4, 32, 48, 48, 48, SkinType.SLIM),
RIGHT_ARM_S(PlayerModelParts.RIGHT_ARM, PlayerSkinLayer.RIGHT_SLEEVE, -5, 2, 0, -2, -2, -2, 3, 12, 4, 40, 16, 40, 32, SkinType.SLIM),
LEFT_LEG (PlayerModelParts.LEFT_LEG, PlayerSkinLayer.LEFT_PANTS_LEG, 1.9f, 12, 0, -2, 0, -2, 4, 12, 4, 16, 48, 0, 48),
RIGHT_LEG (PlayerModelParts.RIGHT_LEG, PlayerSkinLayer.RIGHT_PANTS_LEG, -1.9f, 12, 0, -2, 0, -2, 4, 12, 4, 0, 16, 0, 32),
;
public static final PlayerPartValues[] VALUES = values();
public final PlayerModelParts part;
public final PlayerSkinLayer layer;
public final float px, py, pz, ox, oy, oz, sx, sy, sz;
public final int u, v, u2, v2;
public final SkinType skinType;
private PlayerPartValues(PlayerModelParts part, PlayerSkinLayer layer, float px, float py, float pz, float ox, float oy, float oz, float sx, float sy, float sz, int u, int v, int u2, int v2) {
this(part, layer, px, py, pz, ox, oy, oz, sx, sy, sz, u, v, u2, v2, SkinType.UNKNOWN);
}
private PlayerPartValues(PlayerModelParts part, PlayerSkinLayer layer, float px, float py, float pz, float ox, float oy, float oz,
float sx, float sy, float sz, int u, int v, int u2, int v2, SkinType skinType) {
this.part = part;
this.layer = layer;
this.px = px;
this.py = py;
this.pz = pz;
this.ox = ox;
this.oy = oy;
this.oz = oz;
this.sx = sx;
this.sy = sy;
this.sz = sz;
this.u = u;
this.v = v;
this.u2 = u2;
this.v2 = v2;
this.skinType = skinType;
}
public static PlayerPartValues getFor(PlayerModelParts part, SkinType skinType) {
for (PlayerPartValues v : VALUES) {
if(v.part == part && (v.skinType == skinType || v.skinType == SkinType.UNKNOWN))
return v;
}
return null;
}
@Override
public Vec3f getPos() {
return new Vec3f(px, py, pz);
}
@Override
public Vec3f getOffset() {
return new Vec3f(ox, oy, oz);
}
@Override
public Vec3f getSize() {
return new Vec3f(sx, sy, sz);
}
@Override
public Vec2i getUV() {
return new Vec2i(u, v);
}
@Override
public boolean isMirror() {
return false;
}
@Override
public float getMCScale() {
return 0;
}
}
| [
"tom5454a@gmail.com"
] | tom5454a@gmail.com |
31f5b5872eab1ebc26ad5c6486846df25833e26d | 43bef70b21eb72f2d30ad4840d2dbc42466a0cfc | /src/starsrus/Customer.java | 9dc17f086cbcc0298b039a752dce2ac518d816fd | [] | no_license | Kevcheezy/databaseProject | 9d557e3afae29d0ff5f3f7dae6f9c0d7b71adc2a | 3902c97258d1cbf05922e87a879a7acb65d29317 | refs/heads/master | 2021-08-24T15:23:02.162858 | 2017-12-10T07:00:34 | 2017-12-10T07:00:34 | 113,241,341 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 32,954 | java | package starsrus;
import java.sql.*;
import java.util.*;
public class Customer {
// User information
String username, password;
// SQL info
public static final String HOST = "jdbc:mysql://cs174a.engr.ucsb.edu:3306/kevinchanDB";
public static final String USER = "kevinchan";
public static final String PWD = "651";
// Default constructor
public Customer(){
}
// 1) Deposit into market account
public void deposit(Integer amt) throws SQLException {
System.out.println("Depositing " + amt.toString() + " ...");
// Send request query to database getting current market account balance of user
String query = "";
Connection con = null;
PreparedStatement stm = null;
PreparedStatement stm2 = null;
PreparedStatement stm3 = null;
try {
MySQLDB db = new MySQLDB();
con = db.getDBConnection();
double userBalance = getMarketAccountBalance();
// Increase balance by amount
System.out.println("Current market account balance: " + String.format("%.2f", userBalance));
userBalance = userBalance + (double)amt;
// Update database using aid and new balance amount
query = "UPDATE market_accounts SET balance = ? WHERE taxID = ?";
int taxID = taxIDOfUsername(this.username);
stm2 = con.prepareStatement(query);
stm2.setDouble(1,userBalance);
stm2.setInt(2, taxID);
stm2.executeUpdate();
System.out.println("New market account balance is: " + String.format("%.2f", userBalance));
// Insert a new record into transaction table for this deposit
query = "INSERT INTO transactions (aid, type, date, amount, balance) VALUES (?,?,?,?,?)";
java.sql.Date sqlDate = db.getCurrentTime();
int aid = getAIDofAccount("market");
stm3 = con.prepareStatement(query);
stm3.setInt(1, aid);
stm3.setString(2, "deposit");
stm3.setDate(3, sqlDate);
stm3.setDouble(4, (double)amt);
stm3.setDouble(5, userBalance);
stm3.executeUpdate();
} catch (SQLException e){
System.out.println(e.getMessage());
} finally {
if (stm != null) try { stm.close(); } catch (SQLException e) {}
if (stm2 != null) try { stm2.close(); } catch (SQLException e) {}
if (stm3 != null) try { stm3.close(); } catch (SQLException e) {}
if (con != null) try { con.close(); } catch (SQLException e) {}
}
}
// 2) Withdraw from market account
public void withdraw(Integer amt) throws SQLException{
Connection con = null;
PreparedStatement stm = null;
PreparedStatement stm2 = null;
PreparedStatement stm3 = null;
try {
MySQLDB db = new MySQLDB();
con = db.getDBConnection();
// Send request query to database getting current market account balance of user
double userBalance = getMarketAccountBalance();
// Increase balance by amount
System.out.println("Current market account balance: " + String.format("%.2f", userBalance));
userBalance = userBalance - (float)amt;
if (userBalance < 0){
System.out.println("ERROR: BALANCE BELOW $0!");
return;
}
// Update database using aid and new balance amount
String query = "UPDATE market_accounts SET balance = ? WHERE aid = ?";
int aid = getAIDofAccount("market");
stm2 = con.prepareStatement(query);
stm2.setDouble(1,userBalance);
stm2.setInt(2, aid);
stm2.executeUpdate();
System.out.println("New market account balance: " + String.format("%.2f", userBalance));
// Insert a new record into transaction table for this withdrawal
query = "INSERT INTO transactions (aid, type, date, amount, balance) VALUES (?,?,?,?,?)";
java.sql.Date sqlDate = db.getCurrentTime();
stm3 = con.prepareStatement(query);
stm3.setInt(1, aid);
stm3.setString(2, "withdrawal");
stm3.setDate(3, sqlDate);
stm3.setDouble(4, (double)amt);
stm3.setDouble(5, userBalance);
stm3.executeUpdate();
} catch (SQLException e){
System.out.println(e.getMessage());
} finally {
if (stm != null) try { stm.close(); } catch (SQLException e) {}
if (stm2 != null) try { stm2.close(); } catch (SQLException e) {}
if (stm3 != null) try { stm3.close(); } catch (SQLException e) {}
if (con != null) try { con.close(); } catch (SQLException e) {}
}
}
// 3) Buy stock
public void buyStock(Scanner sc) throws SQLException{
// Display all stocks for purchase
Connection con = null;
PreparedStatement stm = null;
PreparedStatement stm1 = null;
PreparedStatement stm2 = null;
PreparedStatement stm3 = null;
PreparedStatement stm4 = null;
PreparedStatement stm5 = null;
PreparedStatement stm6 = null;
PreparedStatement stm7 = null;
PreparedStatement stm8 = null;
PreparedStatement stm9 = null;
ResultSet rs = null;
String query = "SELECT stock_symbol,stock_price FROM actor_directors";
try {
MySQLDB db = new MySQLDB();
int isMarketOpen = db.isMarketOpen();
// Only if market is open
if(isMarketOpen == 1){
con = db.getDBConnection();
stm = con.prepareStatement(query);
rs = stm.executeQuery();
ArrayList<String> allStocks = new ArrayList<String>();
ArrayList<Double> allStockPrices = new ArrayList<Double>();
String stock_symbol = "";
double stock_price = 0.0d;
while (rs.next()){
stock_symbol = rs.getString("stock_symbol");
allStocks.add(stock_symbol);
stock_price = rs.getFloat("stock_price");
allStockPrices.add(stock_price);
}
for(int i=1; i<= allStocks.size(); i++){
System.out.print(i + ") " + allStocks.get(i-1) + " | Price: ");
System.out.printf("%.3f", allStockPrices.get(i-1));
System.out.println();
}
// Display current balance
double currentBalance = this.getMarketAccountBalance();
double stock_account_balance = this.getStockAccountBalance();
System.out.println("Current market account balance: " + currentBalance);
System.out.println("Current stock account balance: " + stock_account_balance);
// User selects stock and how many
System.out.print("Enter index of stock to purchase: ");
int choice = sc.nextInt();
System.out.print("Number of stocks to purchase: ");
int numStock = sc.nextInt();
String chosenStockSymbol = allStocks.get(choice-1);
double chosenStockPrice = allStockPrices.get(choice-1);
// Deduct money from market account (make sure balance >= 0)
double totalPrice = (double)numStock * allStockPrices.get(choice-1) + 20.0d;
double newBalance = (double)currentBalance - totalPrice;
// If user does not have enough money to make this purchase, do not allow
if (newBalance < 0){
System.out.println("ERROR! Market account has insufficient funds to make this purchase!");
}
else {
// Otherwise, update new market account balance
int aid = getAIDofAccount("market");
query = "UPDATE market_accounts SET balance = ? WHERE aid = ?";
stm2 = con.prepareStatement(query);
stm2.setDouble(1,newBalance);
stm2.setInt(2, aid);
stm2.executeUpdate();
System.out.println();
System.out.println("New market account balance: " + String.format("%.2f", newBalance));
// Check if user has existing stock account
query = "SELECT aid FROM accounts WHERE username = ? && account_type = ?";
stm4 = con.prepareStatement(query);
stm4.setString(1, this.username);
stm4.setString(2, "stock");
rs = stm4.executeQuery();
int useraid = -1;
while(rs.next()){
useraid = rs.getInt("aid");
}
// If user has an existing stock account: add purchased stock info into account
if (useraid != -1){
query = "INSERT INTO stock_accounts (aid,stock_symbol,amount_bought,bought_at,date) VALUES (?,?,?,?,?)";
stm5 = con.prepareStatement(query);
stm5.setInt(1, useraid);
stm5.setString(2, chosenStockSymbol);
stm5.setInt(3, numStock);
stm5.setDouble(4, chosenStockPrice);
stm5.setDate(5, db.getCurrentTime());
stm5.executeUpdate();
// Query - Update stock_account_balance with new balance
query = "UPDATE stock_accounts_balance SET balance = ? WHERE aid = ?";
stock_account_balance = stock_account_balance + (numStock * chosenStockPrice);
stm9 = con.prepareStatement(query);
stm9.setDouble(1,stock_account_balance);
stm9.setInt(2, useraid);
System.out.println("New stock account balance: " + String.format("%.3f", stock_account_balance));
}
// If user does NOT have stock account, create one and add purchased stock info into account
else{
// Create new account
int taxID = taxIDOfUsername(this.username);
query = "INSERT INTO accounts (account_type,username, taxID) VALUES (?,?,?)";
stm6 = con.prepareStatement(query);
stm6.setString(1, "stock");
stm6.setString(2, this.username);
stm6.setInt(3, taxID);
stm6.executeUpdate();
// Get newly made aid of stock account
int newStockaid = getAIDofAccount("stock");
// Create new stock account entry
query = "INSERT INTO stock_accounts (aid,stock_symbol,amount_bought,bought_at,date) VALUES (?,?,?,?,?)";
stm7 = con.prepareStatement(query);
stm7.setInt(1, newStockaid);
stm7.setString(2, chosenStockSymbol);
stm7.setInt(3, numStock);
stm7.setDouble(4, chosenStockPrice);
stm7.setDate(5, db.getCurrentTime());
stm7.executeUpdate();
// Query - Insert stock_account_balance with new balance
query = "INSERT INTO stock_accounts_balance (balance,aid) VALUES (?,?)";
stock_account_balance = getStockAccountBalance() + (numStock * chosenStockPrice);
stm9 = con.prepareStatement(query);
stm9.setDouble(1,stock_account_balance);
stm9.setInt(2, newStockaid);
stm9.executeUpdate();
System.out.println("New stock account balance: " + String.format("%.3f", stock_account_balance));
}
// Insert new buy transaction
query = "INSERT INTO transactions (aid,type,date,amount,stock_symbol,num_shares,buy_price, balance)"
+ "VALUES (?,?,?,?,?,?,?,?)";
aid = getAIDofAccount("stock");
stm3 = con.prepareStatement(query);
stm3.setInt(1, aid);
stm3.setString(2, "buy");
stm3.setDate(3, db.getCurrentTime());
stm3.setDouble(4,totalPrice);
stm3.setString(5, chosenStockSymbol);
stm3.setInt(6, numStock);
stm3.setDouble(7, chosenStockPrice);
stm3.setDouble(8, stock_account_balance);
stm3.executeUpdate();
}
}
else{
System.out.println("ERROR! Market is not open!");
}
} catch (SQLException e){
System.out.println(e.getMessage());
} finally {
if (stm != null) try { stm.close(); } catch (SQLException e) {}
if (stm1 != null) try { stm1.close(); } catch (SQLException e) {}
if (stm2 != null) try { stm2.close(); } catch (SQLException e) {}
if (stm3 != null) try { stm3.close(); } catch (SQLException e) {}
if (stm4 != null) try { stm4.close(); } catch (SQLException e) {}
if (stm5 != null) try { stm5.close(); } catch (SQLException e) {}
if (stm6 != null) try { stm6.close(); } catch (SQLException e) {}
if (stm7 != null) try { stm7.close(); } catch (SQLException e) {}
if (stm8 != null) try { stm8.close(); } catch (SQLException e) {}
if (stm9 != null) try { stm9.close(); } catch (SQLException e) {}
if (con != null) try { con.close(); } catch (SQLException e) {}
if (rs != null) try { rs.close(); } catch (SQLException e) {}
}
}
// 4) Sell stock
public void sellStock(Scanner sc) throws SQLException{
System.out.println();
// Show user which stocks are in account
String query = "SELECT stock_symbol,amount_bought,bought_at,sa_id FROM stock_accounts WHERE aid = ?";
Connection con = null;
PreparedStatement stm = null;
PreparedStatement stm1 = null;
PreparedStatement stm2 = null;
PreparedStatement stm3 = null;
PreparedStatement stm4 = null;
PreparedStatement stm5 = null;
ResultSet rs = null;
try {
int stockAID = getAIDofAccount("stock");
MySQLDB db = new MySQLDB();
int isMarketOpen = db.isMarketOpen();
if(isMarketOpen == 1){
con = db.getDBConnection();
stm = con.prepareStatement(query);
stm.setInt(1,stockAID);
rs = stm.executeQuery();
String stock_symbol = "";
int amount_bought = 0;
double bought_at = 0.0d;
int sa_id = -1;
ArrayList<String> stock_symbolList = new ArrayList<String>();
ArrayList<Integer> amount_boughtList = new ArrayList<Integer>();
ArrayList<Double> bought_atList = new ArrayList<Double>();
ArrayList<Integer> sa_idList = new ArrayList<Integer>();
while (rs.next()){
stock_symbol = rs.getString("stock_symbol");
amount_bought = rs.getInt("amount_bought");
bought_at = rs.getDouble("bought_at");
sa_id = rs.getInt("sa_id");
stock_symbolList.add(stock_symbol);
amount_boughtList.add(amount_bought);
bought_atList.add(bought_at);
sa_idList.add(sa_id);
}
for(int i=1; i<=stock_symbolList.size(); i++){
System.out.println(i+") " + amount_boughtList.get(i-1) + " " + stock_symbolList.get(i-1) + " bought at " + bought_atList.get(i-1));
}
// Display current stock account balance
double stock_account_balance = this.getStockAccountBalance();
System.out.println("Current stock account balance: " + String.format("%.3f", stock_account_balance));
// User chooses which stock to sell: list all in stock account
System.out.print("Enter index of stock to sell: ");
int choice = sc.nextInt();
// User picks how many of stocks to sell
System.out.print("Quantity: ");
int numStocks = sc.nextInt();
String chosenStockSymbol = stock_symbolList.get(choice-1);
Double chosenBoughtAt = bought_atList.get(choice-1);
int chosenAmountBought = amount_boughtList.get(choice-1);
int chosensaID = sa_idList.get(choice-1);
// Make sure user has enough of the stocks to sell
// Calculate stocks remaining = amount_bought - numStocks
int stocksLeft = chosenAmountBought - numStocks;
if (stocksLeft < 0){
System.out.println("You do not have enough stocks.");
}
else{
// Get current price of stock
query = "SELECT stock_price FROM actor_directors WHERE stock_symbol = ?";
stm1 = con.prepareStatement(query);
stm1.setString(1,chosenStockSymbol);
rs = stm1.executeQuery();
float stock_price = 0.0f;
while(rs.next()){
stock_price = rs.getFloat("stock_price");
}
// Calculate and update earnings in transactions = (current price - bought_at) * numStocks - commission
double earnings = (stock_price - chosenBoughtAt) * numStocks - 20;
double marketBalance = getMarketAccountBalance();
// Check if stock account balance is < 0, if so, do not proceed
stock_account_balance = stock_account_balance + (numStocks * stock_price) - 20;
if (stock_account_balance >= 0){
// If the transaction will make marketBalance < 0, don't let
if(marketBalance >= 20){
query = "INSERT INTO transactions (aid,type,date,amount,stock_symbol,num_shares,sell_price, balance) VALUES (?,?,?,?,?,?,?,?)";
stm3 = con.prepareStatement(query);
stm3.setInt(1, stockAID);
stm3.setString(2, "sell");
stm3.setDate(3, db.getCurrentTime());
stm3.setDouble(4, earnings);
stm3.setString(5, chosenStockSymbol);
stm3.setInt(6, numStocks);
stm3.setDouble(7, stock_price);
stm3.setDouble(8, stock_account_balance);
stm3.executeUpdate();
// Query - Update stock_account_balance with new balance
query = "UPDATE stock_accounts_balance SET balance = ? WHERE aid = ?";
stm5 = con.prepareStatement(query);
stm5.setDouble(1,stock_account_balance);
stm5.setInt(2, stockAID);
stm5.executeUpdate();
System.out.println("New stock account balance: " + String.format("%.3f", stock_account_balance));
// Update or delete stock_account depending on stocks left
if (stocksLeft == 0){
// Delete records with no stocks left in stock account
System.out.println("Sold all of that stock!");
query = "DELETE FROM stock_accounts WHERE sa_id = ?";
stm4 = con.prepareStatement(query);
stm4.setInt(1, chosensaID);
stm4.executeUpdate();
}
else{
// Update stocks remaining in stock account
query = "UPDATE stock_accounts SET amount_bought = ? WHERE sa_id = ?";
stm2 = con.prepareStatement(query);
stm2.setInt(1, stocksLeft);
stm2.setInt(2,chosensaID);
stm2.executeUpdate();
}
System.out.println("You earned: " + earnings + "!");
}
else{
System.out.println("ERROR! Insufficient funds in market account!");
}
}
// Error: stock account balance will go below 0
else{
System.out.println("ERROR! Stock account balance will go below 0!");
}
}
}
else{
System.out.println("ERROR! Market is not open!");
}
} catch (SQLException e){
System.out.println(e.getMessage());
} finally {
if (stm != null) try { stm.close(); } catch (SQLException e) {}
if (stm1 != null) try { stm1.close(); } catch (SQLException e) {}
if (stm2 != null) try { stm2.close(); } catch (SQLException e) {}
if (stm3 != null) try { stm3.close(); } catch (SQLException e) {}
if (stm4 != null) try { stm4.close(); } catch (SQLException e) {}
if (stm5 != null) try { stm5.close(); } catch (SQLException e) {}
if (con != null) try { con.close(); } catch (SQLException e) {}
if (rs != null) try { rs.close(); } catch (SQLException e) {}
}
}
// 5) Show market account balance
public double getMarketAccountBalance() throws SQLException{
System.out.println();
// Send request query to database getting current market account balance of user
int taxID = taxIDOfUsername(this.username);
String query = "SELECT balance FROM market_accounts WHERE taxID = ?";
Connection con = null;
PreparedStatement stm = null;
ResultSet rs = null;
double userBalance = 0;
try {
MySQLDB db = new MySQLDB();
con = db.getDBConnection();
stm = con.prepareStatement(query);
stm.setInt(1,taxID);
rs = stm.executeQuery();
while (rs.next()){
userBalance = rs.getFloat("balance");
}
} catch (SQLException e){
System.out.println(e.getMessage());
} finally {
if (stm != null) try { stm.close(); } catch (SQLException e) {}
if (con != null) try { con.close(); } catch (SQLException e) {}
if (rs != null) try { rs.close(); } catch (SQLException e) {}
}
return userBalance;
}
// 6) Show stock account transaction history
public void showStockTransactionHistory() throws SQLException{
String query = "SELECT type,date,amount,stock_symbol,num_shares,buy_price,sell_price FROM transactions WHERE aid = ?";
Connection con = null;
PreparedStatement stm = null;
PreparedStatement stm1 = null;
ResultSet rs = null;
try {
int stockAID = getAIDofAccount("stock");
MySQLDB db = new MySQLDB();
con = db.getDBConnection();
stm = con.prepareStatement(query);
stm.setInt(1,stockAID);
rs = stm.executeQuery();
// Query - Show recent stock transaction history
String type = "";
java.sql.Date date = null;
int amount = 0;
String stock_symbol = "";
int num_shares = 0;
double buy_price = 0.0d;
double sell_price = 0.0d;
while (rs.next()){
System.out.println();
type = rs.getString("type");
date = rs.getDate("date");
amount = rs.getInt("amount");
stock_symbol = rs.getString("stock_symbol");
num_shares = rs.getInt("num_shares");
buy_price = rs.getDouble("buy_price");
sell_price = rs.getDouble("sell_price");
if(type.equals("buy")) {
System.out.println(num_shares + " shares of " + stock_symbol + " was/were bought at " + buy_price + ", on " + date);
}
if(type.equals("sell")) {
System.out.println(num_shares + " shares of " + stock_symbol + " was/were sold at " + sell_price + ", on " + date);
}
}
// Query - Show stock account balance (in terms of stock)
query = "SELECT balance FROM stock_accounts_balance WHERE aid = ?";
stm1 = con.prepareStatement(query);
stm1.setInt(1, stockAID);
rs = stm1.executeQuery();
double balance = 0.0d;
while(rs.next()){
balance = rs.getDouble("balance");
}
System.out.println();
System.out.println("Current stock account balance (in terms of stock): " + String.format("%.3f", balance));
System.out.println();
} catch (SQLException e){
System.out.println(e.getMessage());
} finally {
if (stm != null) try { stm.close(); } catch (SQLException e) {}
if (stm1 != null) try { stm1.close(); } catch (SQLException e) {}
if (con != null) try { con.close(); } catch (SQLException e) {}
if (rs != null) try { rs.close(); } catch (SQLException e) {}
}
}
// 7) List current price of stock and display actor/director profile
public void showStockAndProfile(Scanner sc) throws SQLException{
// Display all stock to pick from
Connection con = null;
PreparedStatement stm = null;
PreparedStatement stm1 = null;
ResultSet rs = null;
String query = "SELECT stock_symbol,name FROM actor_directors";
try {
MySQLDB db = new MySQLDB();
con = db.getDBConnection();
stm = con.prepareStatement(query);
rs = stm.executeQuery();
ArrayList<String> allStocks = new ArrayList<String>();
String stock_symbol = "";
while (rs.next()){
stock_symbol = rs.getString("stock_symbol");
allStocks.add(stock_symbol);
}
// Display movies to choose from
for(int i=1; i<= allStocks.size(); i++){
System.out.println(i + ") " + allStocks.get(i-1));
}
// User selects stock
System.out.print("Enter index of stock to display details of: ");
int choice = sc.nextInt();
String chosenStock = allStocks.get(choice-1);
// Display actor/director's details from selected stock
// Get basic info
query = "SELECT * FROM actor_directors WHERE stock_symbol = ?";
stm1 = con.prepareStatement(query);
stm1.setString(1,chosenStock);
rs = stm1.executeQuery();
String name = "";
String dob = "";
double stock_price = 0.0d;
String movie_title = "";
String role = "";
int year = 0;
int contract = 0;
System.out.println();
while (rs.next()){
name = rs.getString("name");
dob = rs.getString("dob");
stock_price = rs.getDouble("stock_price");
movie_title = rs.getString("movie_title");
role = rs.getString("role");
year = rs.getInt("year");
contract = rs.getInt("contract");
System.out.println("------------------ Stock: "+ chosenStock + " ------------------");
System.out.printf("Stock price: %.3f", stock_price);
System.out.println();
System.out.println("Name: " + name);
System.out.println("Date of birth: " + dob);
System.out.println("Movie title: " + movie_title);
System.out.println("Role: " + role);
System.out.println("Year: " + year);
System.out.println("Contract value: " + contract);
System.out.println();
}
} catch (SQLException e){
System.out.println(e.getMessage());
} finally {
if (stm != null) try { stm.close(); } catch (SQLException e) {}
if (stm1 != null) try { stm1.close(); } catch (SQLException e) {}
if (con != null) try { con.close(); } catch (SQLException e) {}
if (rs != null) try { rs.close(); } catch (SQLException e) {}
}
}
// 8) Movie info router
public void movieInfo(Scanner sc) throws SQLException{
System.out.println("|-------------------------------------------------------|");
System.out.println("| Movie Menu: |");
System.out.println("| |");
System.out.println("| 1.) Display movie information |");
System.out.println("| 2.) Top movies between certain time |");
System.out.println("| 3.) Display all reviews for a movie |");
System.out.println("--------------------------------------------------------");
System.out.print("Enter option: ");
int choice = sc.nextInt();
System.out.println();
switch (choice){
case 1:
showMovies(sc);
break;
case 2:
System.out.print("Enter begin year: ");
int beginYear = sc.nextInt();
System.out.print("Enter end year: ");
int endYear = sc.nextInt();
moviesBtwnTime(sc,beginYear,endYear);
break;
case 3:
displayReviews(sc);
break;
default:
System.out.println("Invalid option!");
}
}
// 8a) List all movie information
public void showMovies(Scanner sc) throws SQLException{
Connection con = null;
PreparedStatement stm = null;
PreparedStatement stm1 = null;
String query = "SELECT id,title FROM Movies";
ResultSet rs = null;
try {
MySQLDB db = new MySQLDB();
con = db.getMoviesDBConnection();
stm = con.prepareStatement(query);
rs = stm.executeQuery();
Map<Integer, String> moviesMap = new HashMap<Integer,String>();
String title = "";
int movieID = -1;
float rating = 0.0f;
int prodYear = 0;
while (rs.next()){
movieID = rs.getInt("id");
title = rs.getString("title");
moviesMap.put(movieID, title);
}
// Display movies to choose from
for(int i=1; i<= moviesMap.size(); i++){
System.out.println(i + ") " + moviesMap.get(i));
}
// Pick movie to display
System.out.print("Enter index of movie to display details : ");
int choice = sc.nextInt();
query = "SELECT * FROM Movies WHERE id = ?";
stm1 = con.prepareStatement(query);
stm1.setInt(1,choice);
rs = stm1.executeQuery();
while (rs.next()){
movieID = rs.getInt("id");
title = rs.getString("title");
rating = rs.getFloat("rating");
prodYear = rs.getInt("production_year");
}
// Display movie results
System.out.println();
System.out.println("Movie ID: " + movieID);
System.out.println("Movie title: " + title);
System.out.println("Movie rating: " + rating);
System.out.println("Production Year: " + prodYear);
System.out.println();
} catch (SQLException e){
System.out.println(e.getMessage());
} finally {
if (stm != null) try { stm.close(); } catch (SQLException e) {}
if (stm1 != null) try { stm1.close(); } catch (SQLException e) {}
if (con != null) try { con.close(); } catch (SQLException e) {}
if (rs != null) try { rs.close(); } catch (SQLException e) {}
}
}
// 8b) Display top movies within time interval
public void moviesBtwnTime(Scanner sc, int beginYear, int endYear) throws SQLException {
// Query - Get movies between time frame of rating 5
String query = "SELECT title FROM Movies WHERE rating = 5 && production_year >= ? && production_year <= ?";
Connection con = null;
PreparedStatement stm = null;
ResultSet rs = null;
System.out.println();
try {
MySQLDB db = new MySQLDB();
con = db.getMoviesDBConnection();
stm = con.prepareStatement(query);
stm.setInt(1,beginYear);
stm.setInt(2, endYear);
rs = stm.executeQuery();
String title = "";
while (rs.next()){
title = rs.getString("title");
System.out.println("Movie title: " + title);
}
} catch (SQLException e){
System.out.println(e.getMessage());
} finally {
if (stm != null) try { stm.close(); } catch (SQLException e) {}
if (con != null) try { con.close(); } catch (SQLException e) {}
if (rs != null) try { rs.close(); } catch (SQLException e) {}
}
}
// 8c) Display all reviews for a given movie
public void displayReviews(Scanner sc) throws SQLException{
Connection con = null;
PreparedStatement stm = null;
PreparedStatement stm1 = null;
ResultSet rs = null;
// Give menu of movies to choose from
String query = "SELECT id,title FROM Movies";
try {
MySQLDB db = new MySQLDB();
con = db.getMoviesDBConnection();
stm = con.prepareStatement(query);
rs = stm.executeQuery();
Map<Integer, String> moviesMap = new HashMap<Integer,String>();
String title = "";
int movieID = -1;
while (rs.next()){
movieID = rs.getInt("id");
title = rs.getString("title");
moviesMap.put(movieID, title);
}
for(int i=1; i<= moviesMap.size(); i++){
System.out.println(i + ") " + moviesMap.get(i));
}
// Pick movie to display
System.out.println();
System.out.print("Enter index of movie to display details : ");
int choice = sc.nextInt();
// Get reviews of that movie
query = "SELECT author,review FROM Reviews WHERE movie_id = ?";
stm1 = con.prepareStatement(query);
stm1.setInt(1,choice);
rs = stm1.executeQuery();
String author = "";
String review = "";
System.out.println();
System.out.println("For movie title: " + moviesMap.get(choice));
while (rs.next()){
author = rs.getString("author");
review = rs.getString("review");
System.out.println(author + " gave the review: " + review);
}
System.out.println();
} catch (SQLException e){
System.out.println(e.getMessage());
} finally {
if (stm != null) try { stm.close(); } catch (SQLException e) {}
if (stm1 != null) try { stm1.close(); } catch (SQLException e) {}
if (con != null) try { con.close(); } catch (SQLException e) {}
if (rs != null) try { rs.close(); } catch (SQLException e) {}
}
}
public int taxIDOfUsername(String username) throws SQLException {
// Send request query to database getting aid of user
String query = "SELECT taxID FROM customers WHERE username = ?";
Connection con = null;
PreparedStatement stm = null;
ResultSet rs = null;
int taxID = -1;
try {
MySQLDB db = new MySQLDB();
con = db.getDBConnection();
stm = con.prepareStatement(query);
stm.setString(1,username);
rs = stm.executeQuery();
while (rs.next()){
taxID = rs.getInt("taxID");
}
} catch (SQLException e){
System.out.println(e.getMessage());
} finally {
if (stm != null) try { stm.close(); } catch (SQLException e) {}
if (con != null) try { con.close(); } catch (SQLException e) {}
if (rs != null) try { rs.close(); } catch (SQLException e) {}
}
return taxID;
}
public double getStockAccountBalance() throws SQLException{
System.out.println();
// Send request query to database getting current stock account balance of user
int stockAID = getAIDofAccount("stock");
String query = "SELECT balance FROM stock_accounts_balance WHERE aid = ?";
Connection con = null;
PreparedStatement stm = null;
ResultSet rs = null;
double userBalance = 0;
try {
MySQLDB db = new MySQLDB();
con = db.getDBConnection();
stm = con.prepareStatement(query);
stm.setInt(1,stockAID);
rs = stm.executeQuery();
while (rs.next()){
userBalance = rs.getDouble("balance");
}
} catch (SQLException e){
System.out.println(e.getMessage());
} finally {
if (stm != null) try { stm.close(); } catch (SQLException e) {}
if (con != null) try { con.close(); } catch (SQLException e) {}
if (rs != null) try { rs.close(); } catch (SQLException e) {}
}
return userBalance;
}
public int getAIDofAccount(String accountType) throws SQLException{
// Send request query to database getting aid of user
String query = "SELECT aid FROM accounts WHERE username = ? && account_type = ?";
Connection con = null;
PreparedStatement stm = null;
ResultSet rs = null;
int aid = -1;
try {
MySQLDB db = new MySQLDB();
con = db.getDBConnection();
stm = con.prepareStatement(query);
stm.setString(1,this.username);
stm.setString(2, accountType);
rs = stm.executeQuery();
while (rs.next()){
aid = rs.getInt("aid");
}
} catch (SQLException e){
System.out.println(e.getMessage());
} finally {
if (stm != null) try { stm.close(); } catch (SQLException e) {}
if (con != null) try { con.close(); } catch (SQLException e) {}
if (rs != null) try { rs.close(); } catch (SQLException e) {}
}
return aid;
}
}
| [
"kevinchan@umail.ucsb.edu"
] | kevinchan@umail.ucsb.edu |
e4b33f3bf51745d11539ad710f3e1b2a7ac6c966 | e89d45f9e6831afc054468cc7a6ec675867cd3d7 | /src/main/java/com/microsoft/graph/models/extensions/AccessPackageResourceRequest.java | 8f090e6536a31a9260cfac1e7bb7472e8b59f84f | [
"MIT"
] | permissive | isabella232/msgraph-beta-sdk-java | 67d3b9251317f04a465042d273fe533ef1ace13e | 7d2b929d5c99c01ec1af1a251f4bf5876ca95ed8 | refs/heads/dev | 2023-03-12T05:44:24.349020 | 2020-11-19T15:51:17 | 2020-11-19T15:51:17 | 318,158,544 | 0 | 0 | MIT | 2021-02-23T20:48:09 | 2020-12-03T10:37:46 | null | UTF-8 | Java | false | false | 3,760 | java | // ------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
// ------------------------------------------------------------------------------
package com.microsoft.graph.models.extensions;
import com.microsoft.graph.serializer.ISerializer;
import com.microsoft.graph.serializer.IJsonBackedObject;
import com.microsoft.graph.serializer.AdditionalDataManager;
import java.util.EnumSet;
import com.microsoft.graph.models.extensions.AccessPackageResource;
import com.microsoft.graph.models.extensions.AccessPackageSubject;
import com.microsoft.graph.models.extensions.Entity;
import com.google.gson.JsonObject;
import com.google.gson.annotations.SerializedName;
import com.google.gson.annotations.Expose;
// **NOTE** This file was generated by a tool and any changes will be overwritten.
/**
* The class for the Access Package Resource Request.
*/
public class AccessPackageResourceRequest extends Entity implements IJsonBackedObject {
/**
* The Catalog Id.
*
*/
@SerializedName(value = "catalogId", alternate = {"CatalogId"})
@Expose
public String catalogId;
/**
* The Execute Immediately.
*
*/
@SerializedName(value = "executeImmediately", alternate = {"ExecuteImmediately"})
@Expose
public Boolean executeImmediately;
/**
* The Expiration Date Time.
*
*/
@SerializedName(value = "expirationDateTime", alternate = {"ExpirationDateTime"})
@Expose
public java.util.Calendar expirationDateTime;
/**
* The Is Validation Only.
*
*/
@SerializedName(value = "isValidationOnly", alternate = {"IsValidationOnly"})
@Expose
public Boolean isValidationOnly;
/**
* The Justification.
*
*/
@SerializedName(value = "justification", alternate = {"Justification"})
@Expose
public String justification;
/**
* The Request State.
*
*/
@SerializedName(value = "requestState", alternate = {"RequestState"})
@Expose
public String requestState;
/**
* The Request Status.
*
*/
@SerializedName(value = "requestStatus", alternate = {"RequestStatus"})
@Expose
public String requestStatus;
/**
* The Request Type.
*
*/
@SerializedName(value = "requestType", alternate = {"RequestType"})
@Expose
public String requestType;
/**
* The Access Package Resource.
*
*/
@SerializedName(value = "accessPackageResource", alternate = {"AccessPackageResource"})
@Expose
public AccessPackageResource accessPackageResource;
/**
* The Requestor.
*
*/
@SerializedName(value = "requestor", alternate = {"Requestor"})
@Expose
public AccessPackageSubject requestor;
/**
* The raw representation of this class
*/
private JsonObject rawObject;
/**
* The serializer
*/
private ISerializer serializer;
/**
* Gets the raw representation of this class
*
* @return the raw representation of this class
*/
public JsonObject getRawObject() {
return rawObject;
}
/**
* Gets serializer
*
* @return the serializer
*/
protected ISerializer getSerializer() {
return serializer;
}
/**
* Sets the raw JSON object
*
* @param serializer the serializer
* @param json the JSON object to set this object to
*/
public void setRawObject(final ISerializer serializer, final JsonObject json) {
this.serializer = serializer;
rawObject = json;
}
}
| [
"GraphTooling@service.microsoft.com"
] | GraphTooling@service.microsoft.com |
b40547a44afe68ccac37335c9520799f8c18cd31 | a1e5fa028f9b933d54b3edfbd7d087f0be34474a | /src/Database/Models/Priority.java | e511bb4efb18a4de03ddb5e0cb7e216649c2dc82 | [] | no_license | yz201906/Hostpital-database-and-java-application-project | f596000a48fe1e142a173d565e75d5fbfabe7a98 | 1351148b9653af2eedbd8fcd7a50199a1872f345 | refs/heads/master | 2021-05-17T03:52:36.803252 | 2020-05-25T03:39:35 | 2020-05-25T03:39:35 | 250,609,119 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,603 | java | package Database.Models;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import Database.DBConnection;
public class Priority {
static Connection conn = DBConnection.getConnection();
private int PriorityID;
private String Type;
Priority(int PriorityID, String Type) {
this.PriorityID = PriorityID;
this.Type = Type;
}
public int getPriorityID() {
return PriorityID;
}
public String getType() {
return Type;
}
public static List<Priority> getAll() {
List<Priority> list = new ArrayList<Priority>();
PreparedStatement ps = null;
ResultSet rs = null;
try {
ps = conn.prepareStatement("SELECT * FROM Priority");
rs = ps.executeQuery();
while (rs.next()) {
Priority priorityRule = new Priority(rs.getInt("PriorityId"), rs.getString("TYPE"));
list.add(priorityRule);
}
} catch (SQLException e) {
System.out.println("Error in getting priorities");
} finally {
DBConnection.close(ps);
DBConnection.close(rs);
}
return list;
}
public static Priority getById(int pid) {
PreparedStatement stmt = null;
ResultSet rs = null;
Priority priority = null;
try {
stmt = conn.prepareStatement("SELECT * FROM PRIORITY WHERE PRIORITYID=?");
stmt.setInt(1, pid);
rs = stmt.executeQuery();
while (rs.next()) {
priority = new Priority(pid, rs.getString("TYPE"));
}
} catch (Exception ex) {
System.out.println("Error in getting priority");
} finally {
DBConnection.close(stmt);
DBConnection.close(rs);
}
return priority;
}
@Override
public String toString() {
return getType();
}
}
| [
"yinzhou1989@gmail.com"
] | yinzhou1989@gmail.com |
9d07d591808c2a8befe90dd14398f92598f18316 | 875ccbf7baf53b03d41579d656098512459520a5 | /patt11.java | a76a6a94c6a48335f8861626b024e70937e7ebf4 | [] | no_license | SaarthShah/Blue-J-Programs | a6aeb3a9acd949b143b5dac5b9511cbe2c7986ab | 94df50719f457d8cb7a8e031bef8f22f76504118 | refs/heads/master | 2023-01-08T23:57:53.608057 | 2020-11-09T19:27:32 | 2020-11-09T19:27:32 | 311,443,259 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 390 | java | import java.util.Scanner;
public class patt11
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the number of terms");
int n=sc.nextInt();
int sum=2,q=2;
for(int i=2;i<=n;i++)
{
q=q*10+2;
sum=sum+q;
}
System.out.println("Sum="+sum);
}
} | [
"69341449+SaarthShah@users.noreply.github.com"
] | 69341449+SaarthShah@users.noreply.github.com |
ce0fccc5f68857d35b8ed4f4b1dcded911a05dba | 74f292e5a24df903411dcf0e25ad5b44631b2a63 | /util/src/main/java/org/metachart/Version.java | 3550e596d7418bb9c50a8ad44a2b9b8dcd9801b3 | [] | no_license | aht-group/metachart | bc555320d490b13c553855d68b355bd3ce0ce928 | dc03ee01fe9618b06b721c938ecffa10e205d5ce | refs/heads/master | 2023-07-19T23:59:25.069797 | 2023-07-08T13:37:04 | 2023-07-08T13:37:04 | 8,525,666 | 0 | 1 | null | 2023-04-06T17:47:11 | 2013-03-02T19:22:01 | JavaScript | UTF-8 | Java | false | false | 446 | java | package org.metachart;
public class Version
{
public static final String jeeslUtil = "org.jeesl:jeesl-util:";
public static final String jeeslXml = "org.jeesl:jeesl-xml:";
public static final String jeeslEjb = "org.jeesl:jeesl-ejb:";
public static final String jeeslInterfaces = "org.jeesl:jeesl-interfaces:";
public static final String jeeslMail = "org.jeesl:jeesl-mail:";
public static final String jeeslTest = "org.jeesl:jeesl-test:";
} | [
"t.kisner@web.de"
] | t.kisner@web.de |
b0e5e47df7a99476f45c6568ef9b642adf6542da | a1b4926c306328c91b0979fa28a950ce148dd2fb | /target/generated-sources/groovy-stubs/test/life/qbic/portal/domain/ListWorkflowRunsSpec.java | 13aff1377267e2eafcbfce823c556585649db388 | [
"MIT"
] | permissive | Steffengreiner/my-workflow-dashboard-portlet | 4ee89716dc901f310e3448b76fb472c934f16449 | 6d3305a04dd09d0a536906ad3711a67c3b8e67da | refs/heads/master | 2021-07-09T22:15:14.275006 | 2020-01-08T16:29:24 | 2020-01-08T16:29:24 | 232,336,939 | 0 | 0 | MIT | 2021-03-31T21:44:05 | 2020-01-07T14:02:41 | Java | UTF-8 | Java | false | false | 974 | java | package life.qbic.portal.domain;
import java.lang.*;
import java.io.*;
import java.net.*;
import java.util.*;
import groovy.lang.*;
import groovy.util.*;
public class ListWorkflowRunsSpec
extends spock.lang.Specification implements
groovy.lang.GroovyObject {
;
@groovy.transform.Generated() @groovy.transform.Internal() public groovy.lang.MetaClass getMetaClass() { return (groovy.lang.MetaClass)null;}
@groovy.transform.Generated() @groovy.transform.Internal() public void setMetaClass(groovy.lang.MetaClass mc) { }
@groovy.transform.Generated() @groovy.transform.Internal() public java.lang.Object invokeMethod(java.lang.String method, java.lang.Object arguments) { return null;}
@groovy.transform.Generated() @groovy.transform.Internal() public java.lang.Object getProperty(java.lang.String property) { return null;}
@groovy.transform.Generated() @groovy.transform.Internal() public void setProperty(java.lang.String property, java.lang.Object value) { }
}
| [
"Steffen.Greiner@gmx.de"
] | Steffen.Greiner@gmx.de |
667740357c73fde3eceda6a215c3bdb66ddd18bf | 12a37e0689d0c21f7f524bfc3f1c8571cac51aef | /app/src/main/java/f/star/iota/milk/ui/tngou/ClassifyBean.java | 3ecea613c94ec9603d83a71316ab814f386fef4b | [] | no_license | bugnull404/milk-fresco | c18c1eb291b19fd2a57e1255c72d5ab069c4f8f7 | 87a87611d8c544a290d112d4487eddb1b4cde556 | refs/heads/master | 2023-03-15T17:09:59.837523 | 2017-08-31T08:18:54 | 2017-08-31T08:18:54 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,068 | java | package f.star.iota.milk.ui.tngou;
import com.google.gson.annotations.SerializedName;
import java.util.List;
import f.star.iota.milk.base.BaseBean;
class ClassifyBean {
@SerializedName("status")
private boolean status;
@SerializedName("tngou")
private List<TngouBean> tngou;
public boolean isStatus() {
return status;
}
public void setStatus(boolean status) {
this.status = status;
}
public List<TngouBean> getTngou() {
return tngou;
}
public void setTngou(List<TngouBean> tngou) {
this.tngou = tngou;
}
public static class TngouBean extends BaseBean {
@SerializedName("id")
private int id;
@SerializedName("title")
private String title;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
}
}
| [
"iota.9star@foxmail.com"
] | iota.9star@foxmail.com |
de9995d2e7067183db303bd85a9347547d021e36 | 3cb35e2574b9374f28da7f70d6a7cff5d1573081 | /src/main/java/com/proyecto/demo/modelo/control/ITp000001Logic.java | eda1985a4bf736fd57ea0b462d0f15bc1e6b1416 | [] | no_license | ingenieriaproyecto/proyecto | 99b320ac1c241b4f03ad11fc53b941e02d57c5ca | 75794691b222325b71e9e8d1108bba5dff0406ce | refs/heads/master | 2021-08-26T04:43:03.681385 | 2017-11-21T16:50:04 | 2017-11-21T16:50:04 | 111,355,869 | 0 | 1 | null | 2017-11-21T01:55:24 | 2017-11-20T03:12:15 | Java | UTF-8 | Java | false | false | 1,596 | java | package com.proyecto.demo.modelo.control;
import com.proyecto.demo.modelo.Tp000001;
import com.proyecto.demo.modelo.Tp000001Id;
import com.proyecto.demo.modelo.dto.Tp000001DTO;
import java.math.BigDecimal;
import java.util.*;
import java.util.Date;
import java.util.List;
import java.util.Set;
/**
* @author Zathura Code Generator http://zathuracode.org
* www.zathuracode.org
*
*/
public interface ITp000001Logic {
public List<Tp000001> getTp000001() throws Exception;
/**
* Save an new Tp000001 entity
*/
public void saveTp000001(Tp000001 entity) throws Exception;
/**
* Delete an existing Tp000001 entity
*
*/
public void deleteTp000001(Tp000001 entity) throws Exception;
/**
* Update an existing Tp000001 entity
*
*/
public void updateTp000001(Tp000001 entity) throws Exception;
/**
* Load an existing Tp000001 entity
*
*/
public Tp000001 getTp000001(Tp000001Id id) throws Exception;
public List<Tp000001> findByCriteria(Object[] variables,
Object[] variablesBetween, Object[] variablesBetweenDates)
throws Exception;
public List<Tp000001> findPageTp000001(String sortColumnName,
boolean sortAscending, int startRow, int maxResults)
throws Exception;
public Long findTotalNumberTp000001() throws Exception;
public List<Tp000001DTO> getDataTp000001() throws Exception;
public void validateTp000001(Tp000001 tp000001) throws Exception;
}
| [
"Jairo@SONYVAIO-PC"
] | Jairo@SONYVAIO-PC |
2397c8fc0e3cebbecc5383189518b8ccc6a8f869 | 6a7d06b6b9093e0ac936f52861ebfc436c725d05 | /clase7/Impresora.java | a19a76dd26e70b48b31e726b654633980054dd73 | [] | no_license | locchiato/clases-poo | 5dc03bc0587422486560417d84603e9738d938e7 | 796a0b7fb7fc6dd1ce3dcaeb0fc0c03fde1140e3 | refs/heads/master | 2023-06-24T16:05:21.696598 | 2021-08-01T02:32:59 | 2021-08-01T02:32:59 | 372,693,375 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 545 | java | package clase7;
import java.util.Date;
public class Impresora {
private String modelo;
private String tipoConexion;
private Date fechaFabricacion;
private int cantHojas;
public static void main(String[] args) {
Impresora epson = new Impresora("Epson");
}
private void imprimir(String modelo) {
System.out.println(modelo);
}
public Impresora() {
this("Sin-Modelo");
}
public Impresora(String modelo) {
this.modelo = modelo;
imprimir(this.modelo);
}
}
| [
"leandro.occhiato@gmail.com"
] | leandro.occhiato@gmail.com |
2a37205d87d9cd284d8ebeda064a68d1d6045324 | 0a0044773085a45f915039190e8eb3f80342be45 | /app/src/main/java/cn/gxy/mydagger2/di/UserModule.java | c0b7984d5ecd348b6ab5005eb6c084cdee1e48ba | [] | no_license | zhudaihao/MyDagger2 | 133f13aacf6feea933069af675210a6ed65c1cc2 | a0b171768afc932bf6d24f42982b380a0fb91000 | refs/heads/master | 2020-07-24T19:03:51.385721 | 2019-09-12T09:49:04 | 2019-09-12T09:49:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 250 | java | package cn.gxy.mydagger2.di;
import cn.gxy.mydagger2.object.UserObject;
import dagger.Module;
import dagger.Provides;
@Module
public class UserModule {
@Provides
public UserObject providerUser() {
return new UserObject();
}
}
| [
"zhudaihao@wswtz.com"
] | zhudaihao@wswtz.com |
933e8a21205134e419d205e8e3b4414428593bf9 | 01e0779440510220a21e6440a46bab32486a4a1b | /src/main/java/net/dongliu/apk/parser/struct/AndroidConstants.java | 7cc0b71edddef6d33055c1fa3286e6ac5b34064e | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | bincker/apk-parser | aa764489a1ed00e45647513be19ae39a0824537a | 03e12149de177817608380ad13aaf85acd289f47 | refs/heads/master | 2021-01-15T08:10:18.620340 | 2014-07-07T22:16:31 | 2014-07-07T22:16:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 778 | java | package net.dongliu.apk.parser.struct;
/**
* android system file.
*
* @author dongiu
*/
public class AndroidConstants {
public static final String RESOURCE_FILE = "resources.arsc";
public static final String MANIFEST_FILE = "AndroidManifest.xml";
public static final String DEX_FILE = "classes.dex";
public static final String RES_PREFIX = "res/";
public static final String ASSETS_PREFIX = "assets/";
public static final String LIB_PreFIX = "lib/";
public static final String META_PREFIX = "META-INF/";
/**
* the binary xml file used system attr id.
*/
public static final int ATTR_ID_START = 0x01010000;
/**
* the system style resouce ids.
*/
public static final int STYLE_ID_START = 0x01030000;
}
| [
"dongliu@wandoujia.com"
] | dongliu@wandoujia.com |
3c41597cefd3c07a707b6e120ba97a18b71b4dca | e81fa1e373914b0e81aa60d536651329b037acee | /employee-service/src/main/java/com/samokha/takeaway/employeeservice/events/EventBus.java | 079120c4a7c603a34a15682d7c582b18f206405a | [] | no_license | vansickle/TakeawayCodingChallenge | 0798e11a66b14b5e3444983f69bf960c2242fa48 | 411eda76e3046474e35310667297bb631fb19402 | refs/heads/master | 2020-05-03T10:40:11.751587 | 2019-04-01T22:15:37 | 2019-04-01T22:15:37 | 178,584,801 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 961 | java | package com.samokha.takeaway.employeeservice.events;
import com.samokha.takeaway.employeeservice.EmployeeServiceApplication;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;
import java.util.UUID;
/**
* Encapsulates operations with events
*/
@Component
public class EventBus {
private final EventFactory eventFactory;
private final RabbitTemplate rabbitTemplate;
private final EventSerializer serializer;
public EventBus(EventFactory eventFactory, RabbitTemplate rabbitTemplate, EventSerializer serializer) {
this.eventFactory = eventFactory;
this.rabbitTemplate = rabbitTemplate;
this.serializer = serializer;
}
public void send(UUID id, EventType eventType, Object entity) {
Event event = eventFactory.createEvent(id, eventType, entity);
rabbitTemplate.convertAndSend(EmployeeServiceApplication.topicExchangeName,
"events.all",
serializer.serialize(event));
}
}
| [
"pavel@samokha.com"
] | pavel@samokha.com |
bb8ed0d4ed539644d684dc1b0921cfe24f090846 | 812224241b357dca8adcd2359fdd0f3e4ad0c9dc | /src/main/java/serviceMixFirstApp/Bean.java | aa10a9e1cef8f2b9dbb6b3f5bb616f226b10766c | [] | no_license | kfolwarczny/serviceMixFirstApp | 8b0b5236e910b8e03aeabe840754a5a537875d80 | 9e1acec283b179e9448cca07dae622bac651d344 | refs/heads/master | 2016-09-06T11:34:58.050246 | 2014-01-07T22:28:17 | 2014-01-07T22:28:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 79 | java | package serviceMixFirstApp;
public interface Bean {
boolean isABean();
} | [
"kfolwarczny@gmail.com"
] | kfolwarczny@gmail.com |
a2a76d6e67609d12a7e02f4b1a30cdf4145f8376 | e178b51423aed8dff403a2006fd6684c5edce2d7 | /src/main/java/chen/entity/OrderItemExample.java | e415b054467929e317b904e8ce6a64a698b94f82 | [] | no_license | allen0010910/tmallCopy | caa3b7f38142b4fd685d14f9ada58303ffd74fe5 | a21a0cfe0075de0d4f22879d473f8a2a24751104 | refs/heads/master | 2022-12-22T23:10:41.673956 | 2018-10-19T14:52:42 | 2018-10-19T14:52:42 | 201,160,191 | 0 | 0 | null | 2022-12-16T08:45:03 | 2019-08-08T02:11:56 | TSQL | UTF-8 | Java | false | false | 14,629 | java | package chen.entity;
import java.util.ArrayList;
import java.util.List;
public class OrderItemExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public OrderItemExample() {
oredCriteria = new ArrayList<Criteria>();
}
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
public String getOrderByClause() {
return orderByClause;
}
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
public boolean isDistinct() {
return distinct;
}
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<Criterion>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andPidIsNull() {
addCriterion("pid is null");
return (Criteria) this;
}
public Criteria andPidIsNotNull() {
addCriterion("pid is not null");
return (Criteria) this;
}
public Criteria andPidEqualTo(Integer value) {
addCriterion("pid =", value, "pid");
return (Criteria) this;
}
public Criteria andPidNotEqualTo(Integer value) {
addCriterion("pid <>", value, "pid");
return (Criteria) this;
}
public Criteria andPidGreaterThan(Integer value) {
addCriterion("pid >", value, "pid");
return (Criteria) this;
}
public Criteria andPidGreaterThanOrEqualTo(Integer value) {
addCriterion("pid >=", value, "pid");
return (Criteria) this;
}
public Criteria andPidLessThan(Integer value) {
addCriterion("pid <", value, "pid");
return (Criteria) this;
}
public Criteria andPidLessThanOrEqualTo(Integer value) {
addCriterion("pid <=", value, "pid");
return (Criteria) this;
}
public Criteria andPidIn(List<Integer> values) {
addCriterion("pid in", values, "pid");
return (Criteria) this;
}
public Criteria andPidNotIn(List<Integer> values) {
addCriterion("pid not in", values, "pid");
return (Criteria) this;
}
public Criteria andPidBetween(Integer value1, Integer value2) {
addCriterion("pid between", value1, value2, "pid");
return (Criteria) this;
}
public Criteria andPidNotBetween(Integer value1, Integer value2) {
addCriterion("pid not between", value1, value2, "pid");
return (Criteria) this;
}
public Criteria andOidIsNull() {
addCriterion("oid is null");
return (Criteria) this;
}
public Criteria andOidIsNotNull() {
addCriterion("oid is not null");
return (Criteria) this;
}
public Criteria andOidEqualTo(Integer value) {
addCriterion("oid =", value, "oid");
return (Criteria) this;
}
public Criteria andOidNotEqualTo(Integer value) {
addCriterion("oid <>", value, "oid");
return (Criteria) this;
}
public Criteria andOidGreaterThan(Integer value) {
addCriterion("oid >", value, "oid");
return (Criteria) this;
}
public Criteria andOidGreaterThanOrEqualTo(Integer value) {
addCriterion("oid >=", value, "oid");
return (Criteria) this;
}
public Criteria andOidLessThan(Integer value) {
addCriterion("oid <", value, "oid");
return (Criteria) this;
}
public Criteria andOidLessThanOrEqualTo(Integer value) {
addCriterion("oid <=", value, "oid");
return (Criteria) this;
}
public Criteria andOidIn(List<Integer> values) {
addCriterion("oid in", values, "oid");
return (Criteria) this;
}
public Criteria andOidNotIn(List<Integer> values) {
addCriterion("oid not in", values, "oid");
return (Criteria) this;
}
public Criteria andOidBetween(Integer value1, Integer value2) {
addCriterion("oid between", value1, value2, "oid");
return (Criteria) this;
}
public Criteria andOidNotBetween(Integer value1, Integer value2) {
addCriterion("oid not between", value1, value2, "oid");
return (Criteria) this;
}
public Criteria andUidIsNull() {
addCriterion("uid is null");
return (Criteria) this;
}
public Criteria andUidIsNotNull() {
addCriterion("uid is not null");
return (Criteria) this;
}
public Criteria andUidEqualTo(Integer value) {
addCriterion("uid =", value, "uid");
return (Criteria) this;
}
public Criteria andUidNotEqualTo(Integer value) {
addCriterion("uid <>", value, "uid");
return (Criteria) this;
}
public Criteria andUidGreaterThan(Integer value) {
addCriterion("uid >", value, "uid");
return (Criteria) this;
}
public Criteria andUidGreaterThanOrEqualTo(Integer value) {
addCriterion("uid >=", value, "uid");
return (Criteria) this;
}
public Criteria andUidLessThan(Integer value) {
addCriterion("uid <", value, "uid");
return (Criteria) this;
}
public Criteria andUidLessThanOrEqualTo(Integer value) {
addCriterion("uid <=", value, "uid");
return (Criteria) this;
}
public Criteria andUidIn(List<Integer> values) {
addCriterion("uid in", values, "uid");
return (Criteria) this;
}
public Criteria andUidNotIn(List<Integer> values) {
addCriterion("uid not in", values, "uid");
return (Criteria) this;
}
public Criteria andUidBetween(Integer value1, Integer value2) {
addCriterion("uid between", value1, value2, "uid");
return (Criteria) this;
}
public Criteria andUidNotBetween(Integer value1, Integer value2) {
addCriterion("uid not between", value1, value2, "uid");
return (Criteria) this;
}
public Criteria andNumberIsNull() {
addCriterion("number is null");
return (Criteria) this;
}
public Criteria andNumberIsNotNull() {
addCriterion("number is not null");
return (Criteria) this;
}
public Criteria andNumberEqualTo(Integer value) {
addCriterion("number =", value, "number");
return (Criteria) this;
}
public Criteria andNumberNotEqualTo(Integer value) {
addCriterion("number <>", value, "number");
return (Criteria) this;
}
public Criteria andNumberGreaterThan(Integer value) {
addCriterion("number >", value, "number");
return (Criteria) this;
}
public Criteria andNumberGreaterThanOrEqualTo(Integer value) {
addCriterion("number >=", value, "number");
return (Criteria) this;
}
public Criteria andNumberLessThan(Integer value) {
addCriterion("number <", value, "number");
return (Criteria) this;
}
public Criteria andNumberLessThanOrEqualTo(Integer value) {
addCriterion("number <=", value, "number");
return (Criteria) this;
}
public Criteria andNumberIn(List<Integer> values) {
addCriterion("number in", values, "number");
return (Criteria) this;
}
public Criteria andNumberNotIn(List<Integer> values) {
addCriterion("number not in", values, "number");
return (Criteria) this;
}
public Criteria andNumberBetween(Integer value1, Integer value2) {
addCriterion("number between", value1, value2, "number");
return (Criteria) this;
}
public Criteria andNumberNotBetween(Integer value1, Integer value2) {
addCriterion("number not between", value1, value2, "number");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
} | [
"ai6547778@vip.qq.com"
] | ai6547778@vip.qq.com |
a293d6e53d8588a964d35ad6a7361bb128d0ae2a | fcbdaa36e7da3b285253e1b4f080f602baf7dea9 | /workflow-manager-api/src/main/java/com/sixliu/workflow/runtime/worker/ApprovalWorker.java | 0ec4daf1e761e5ee114de7e7133d2fb50a8c77eb | [
"Apache-2.0"
] | permissive | scanry/workflow-manager | 5918bfc736480fa96032c7fa0216b574b2d82cff | 72f283a6f9b0da11a56d6140edf56228edf8a7b4 | refs/heads/master | 2020-04-06T19:06:54.824716 | 2018-11-29T07:04:27 | 2018-11-29T07:04:27 | 157,726,190 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 324 | java | package com.sixliu.workflow.runtime.worker;
import com.sixliu.workflow.runtime.dto.TaskProcessResult;
/**
*@author:MG01867
*@date:2018年11月23日
*@email:359852326@qq.com
*@version:
*@describe //TODO
*/
@FunctionalInterface
public interface ApprovalWorker {
TaskProcessResult process(String taskId);
}
| [
"359852326@qq.com"
] | 359852326@qq.com |
531568fb9c4472c8adf9e22164dc304a601d0266 | b82ac609cb6773f65e283247f673c0f07bf09c6a | /week-07/day-1.5/src/main/java/spring/sql/connections/repository/TodoRepository.java | 4da96b796e25c5091fc2a40c7efe26be9cc79beb | [] | no_license | green-fox-academy/scerios | 03b2c2cc611a02f332b3ce1edd9743446b0a8a12 | f829d62bdf1518e3e01dc125a98f90e484c9dce4 | refs/heads/master | 2020-04-02T22:36:36.470006 | 2019-01-07T16:38:20 | 2019-01-07T16:38:20 | 154,839,007 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 402 | java | package spring.sql.connections.repository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;
import spring.sql.connections.model.Todo;
import java.util.ArrayList;
@Repository
public interface TodoRepository extends CrudRepository<Todo, Long> {
ArrayList<Todo> findByDoneFalse();
ArrayList<Todo> findAllByTitleContains(String search);
}
| [
"89.t.robert@gmail.com"
] | 89.t.robert@gmail.com |
6dfc31835d7422a76daf7e9105adee02e0edfe24 | 55ffb414b0fc70f087aa90feb24484688bc059c0 | /cfacq/backend/controllers/EmployeurControlleur.java | 8d9a2a331205685b212e036272adf05e57b2c8f8 | [] | no_license | SvitlanaMelnyk/App-cfacq | 129188c2f06706b1b485378241fe14403a76ccd8 | 19e1ec4e63b72957de2f19da1681d7c7cd6dd045 | refs/heads/master | 2020-05-01T23:56:16.459398 | 2019-03-25T21:42:23 | 2019-03-25T21:42:23 | 177,668,813 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 729 | java | package sitecfacq.web.controllers;
import ca.attsoft.web.framework.annotations.*;
import sitecfacq.domaine.Employeur;
import sitecfacq.services.EmployeurService;
import sitecfacq.web.interceptors.HistoryInterceptor;
import sitecfacq.web.interceptors.ValidationInterceptor;
import javax.inject.Inject;
import javax.interceptor.Interceptors;
import java.util.List;
@Interceptors({ValidationInterceptor.class, HistoryInterceptor.class})
@Public
public class EmployeurControlleur extends ca.attsoft.web.framework.controlleurs.AbstractController {
@Inject
private EmployeurService service;
@Json
@Public
public List<Employeur> getAll(@Name("c") String critereDeRecherche) {
return service.getAllEmployeur();
}
}
| [
"svetmelnyk@gmail.com"
] | svetmelnyk@gmail.com |
4e9e4b40f6aadc6cc1697ac04f92009b0a83c80b | 15ed08f4ca5c0f783573a846b4444a3431b83e97 | /xm-commons-scheduler/src/main/java/com/icthh/xm/commons/scheduler/adapter/SchedulerChannelManager.java | dcec251e50a84ce73802b15e7f26c118a9f29681 | [
"Apache-2.0"
] | permissive | shukia/xm-commons-unsafe | 0486e12c81d5b2f6a583604fd3f7eee8b84e044d | 30b9ac3076687e3c6507ed00aca4749067b5879b | refs/heads/master | 2023-02-04T15:03:26.874101 | 2020-12-23T15:31:02 | 2020-12-23T15:31:02 | 323,937,711 | 0 | 1 | Apache-2.0 | 2020-12-23T15:31:46 | 2020-12-23T15:30:33 | Java | UTF-8 | Java | false | false | 14,259 | java | package com.icthh.xm.commons.scheduler.adapter;
import static com.icthh.xm.commons.config.client.repository.TenantListRepository.TENANTS_LIST_CONFIG_KEY;
import static com.icthh.xm.commons.config.client.repository.TenantListRepository.isSuspended;
import static java.nio.charset.StandardCharsets.UTF_8;
import static java.util.UUID.randomUUID;
import static org.apache.commons.lang3.StringUtils.endsWith;
import static org.apache.commons.lang3.StringUtils.isEmpty;
import static org.apache.commons.lang3.StringUtils.lowerCase;
import static org.apache.commons.lang3.StringUtils.startsWith;
import static org.apache.commons.lang3.StringUtils.upperCase;
import static org.apache.kafka.clients.consumer.ConsumerConfig.METADATA_MAX_AGE_CONFIG;
import static org.springframework.cloud.stream.binder.kafka.properties.KafkaConsumerProperties.StartOffset.earliest;
import static org.springframework.cloud.stream.binder.kafka.properties.KafkaConsumerProperties.StartOffset.latest;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.icthh.xm.commons.config.client.api.RefreshableConfiguration;
import com.icthh.xm.commons.config.client.config.XmConfigProperties;
import com.icthh.xm.commons.config.client.repository.TenantListRepository;
import com.icthh.xm.commons.config.domain.TenantState;
import com.icthh.xm.commons.logging.util.MdcUtils;
import com.icthh.xm.commons.scheduler.domain.ScheduledEvent;
import com.icthh.xm.commons.scheduler.service.SchedulerEventService;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.StopWatch;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.health.CompositeHealthIndicator;
import org.springframework.boot.actuate.health.HealthIndicatorRegistry;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.binder.ConsumerProperties;
import org.springframework.cloud.stream.binder.HeaderMode;
import org.springframework.cloud.stream.binder.kafka.KafkaBinderHealthIndicator;
import org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder;
import org.springframework.cloud.stream.binder.kafka.config.KafkaBinderConfiguration;
import org.springframework.cloud.stream.binder.kafka.properties.KafkaBindingProperties;
import org.springframework.cloud.stream.binder.kafka.properties.KafkaConsumerProperties.StartOffset;
import org.springframework.cloud.stream.binder.kafka.properties.KafkaExtendedBindingProperties;
import org.springframework.cloud.stream.binding.BindingService;
import org.springframework.cloud.stream.binding.SubscribableChannelBindingTargetFactory;
import org.springframework.cloud.stream.config.BindingProperties;
import org.springframework.cloud.stream.config.BindingServiceProperties;
import org.springframework.context.annotation.Import;
import org.springframework.context.event.EventListener;
import org.springframework.integration.config.EnableIntegration;
import org.springframework.kafka.support.Acknowledgment;
import org.springframework.kafka.support.KafkaHeaders;
import org.springframework.messaging.SubscribableChannel;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.Base64;
import java.util.Collections;
import java.util.HashSet;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
@Slf4j
@Component
@EnableBinding
@EnableIntegration
@Import(KafkaBinderConfiguration.class)
@ConditionalOnProperty("application.scheduler-enabled")
public class SchedulerChannelManager implements RefreshableConfiguration {
private static final String PREFIX = "scheduler_";
private static final String KAFKA = "kafka";
private static final String DELIMITER = "_";
private static final String GENERALGROUP = "GENERALGROUP";
private static final String TOPIC = "_topic";
private static final String QUEUE = "_queue";
private static final String SCHEDULER_APP_DEFAULT = "scheduler";
private static final String WRAP_TOKEN = "\"";
private final BindingServiceProperties bindingServiceProperties;
private final SubscribableChannelBindingTargetFactory bindingTargetFactory;
private final BindingService bindingService;
private final KafkaExtendedBindingProperties kafkaExtendedBindingProperties = new KafkaExtendedBindingProperties();
private final Map<String, SubscribableChannel> channels = new ConcurrentHashMap<>();
private final SchedulerEventService schedulerEventService;
private CompositeHealthIndicator bindersHealthIndicator;
private KafkaBinderHealthIndicator kafkaBinderHealthIndicator;
private final ObjectMapper objectMapper;
@Value("${spring.application.name}")
String appName;
@Value("${application.scheduler-config.scheduler-app-name:" + SCHEDULER_APP_DEFAULT + "}")
private String schedulerAppName = SCHEDULER_APP_DEFAULT;
@Value("${application.scheduler-config.task-back-off-initial-interval:1000}")
private int backOffInitialInterval;
@Value("${application.scheduler-config.task-back-off-max-interval:60000}")
private int backOffMaxInterval;
@Value("${application.kafka-metadata-max-age:60000}")
private int kafkaMetadataMaxAge;
private final Set<String> includedTenants;
private Set<String> tenantToStart;
@Autowired
public SchedulerChannelManager(BindingServiceProperties bindingServiceProperties,
SubscribableChannelBindingTargetFactory bindingTargetFactory,
BindingService bindingService,
KafkaMessageChannelBinder kafkaMessageChannelBinder,
ObjectMapper objectMapper,
SchedulerEventService schedulerEventService,
CompositeHealthIndicator bindersHealthIndicator,
KafkaBinderHealthIndicator kafkaBinderHealthIndicator,
XmConfigProperties xmConfigProperties) {
this.bindingServiceProperties = bindingServiceProperties;
this.bindingTargetFactory = bindingTargetFactory;
this.bindingService = bindingService;
this.schedulerEventService = schedulerEventService;
this.objectMapper = objectMapper;
this.bindersHealthIndicator = bindersHealthIndicator;
this.kafkaBinderHealthIndicator = kafkaBinderHealthIndicator;
this.includedTenants = xmConfigProperties.getIncludeTenantLowercase();
kafkaMessageChannelBinder.setExtendedBindingProperties(kafkaExtendedBindingProperties);
}
void createChannels(String tenantName) {
try {
String tenant = lowerCase(tenantName);
String tenantKey = upperCase(tenantName);
String id = randomUUID().toString();
createHandler(PREFIX + tenant + QUEUE, GENERALGROUP, tenantKey, earliest);
createHandler(PREFIX + tenant + TOPIC, id, tenantKey, latest);
createHandler(PREFIX + tenant + DELIMITER + appName + QUEUE, appName, tenantKey, earliest);
createHandler(PREFIX + tenant + DELIMITER + appName + TOPIC, id, tenantKey, latest);
} catch (Exception e) {
log.error("Error create scheduler channels for tenant " + tenantName, e);
throw e;
}
}
synchronized void createHandler(String chanelName, String consumerGroup, String tenantName, StartOffset startOffset) {
if (!channels.containsKey(chanelName)) {
log.info("Create binding to {}. Consumer group {}", chanelName, consumerGroup);
KafkaBindingProperties props = new KafkaBindingProperties();
props.getConsumer().setAutoCommitOffset(false);
props.getConsumer().setStartOffset(startOffset);
props.getConsumer().getConfiguration().put(METADATA_MAX_AGE_CONFIG, String.valueOf(kafkaMetadataMaxAge));
kafkaExtendedBindingProperties.setBindings(Collections.singletonMap(chanelName, props));
ConsumerProperties consumerProperties = new ConsumerProperties();
consumerProperties.setMaxAttempts(Integer.MAX_VALUE);
consumerProperties.setHeaderMode(HeaderMode.none);
consumerProperties.setBackOffInitialInterval(backOffInitialInterval);
consumerProperties.setBackOffMaxInterval(backOffMaxInterval);
BindingProperties bindingProperties = new BindingProperties();
bindingProperties.setConsumer(consumerProperties);
bindingProperties.setDestination(chanelName);
bindingProperties.setGroup(consumerGroup);
bindingServiceProperties.getBindings().put(chanelName, bindingProperties);
SubscribableChannel channel = bindingTargetFactory.createInput(chanelName);
bindingService.bindConsumer(channel, chanelName);
HealthIndicatorRegistry registry = bindersHealthIndicator.getRegistry();
if (registry.get(KAFKA) == null) {
bindersHealthIndicator.getRegistry().register(KAFKA, kafkaBinderHealthIndicator);
}
channels.put(chanelName, channel);
channel.subscribe(message -> {
try {
MdcUtils.putRid(MdcUtils.generateRid() + ":" + tenantName);
StopWatch stopWatch = StopWatch.createStarted();
String payloadString = (String) message.getPayload();
payloadString = unwrap(payloadString);
log.debug("start processing message for tenant: [{}], raw body in base64 = {}",
tenantName, payloadString);
String eventBody = new String(Base64.getDecoder().decode(payloadString), UTF_8);
log.info("start processing message for tenant: [{}], body = {}", tenantName, eventBody);
schedulerEventService.processSchedulerEvent(mapToEvent(eventBody), tenantName);
Optional.ofNullable(message.getHeaders().get(KafkaHeaders.ACKNOWLEDGMENT, Acknowledgment.class))
.ifPresent(Acknowledgment::acknowledge);
log.info("stop processing message for tenant: [{}], time = {}",
tenantName,
stopWatch.getTime());
} catch (Exception e) {
log.error("error processing event for tenant [{}]", tenantName, e);
throw e;
} finally {
MdcUtils.clear();
}
});
}
}
@SneakyThrows
private ScheduledEvent mapToEvent(String eventBody) {
return objectMapper.readValue(eventBody, ScheduledEvent.class);
}
@SneakyThrows
void parseConfig(String key, String config) {
log.info("Tenants list was updated, start to parse config");
if (!TENANTS_LIST_CONFIG_KEY.equals(key)) {
throw new IllegalArgumentException("Wrong config key to update " + key);
}
if (StringUtils.isEmpty(config)) {
throw new IllegalArgumentException("Config file has empty content: " + key);
}
Set<TenantState> tenantKeys = TenantListRepository.parseTenantStates(config, objectMapper)
.getOrDefault(schedulerAppName, new HashSet<>());
if (tenantKeys.isEmpty()) {
log.warn("No one tenant configured to use scheduler. "
+ "Add tenant state to ms-config/tenant-list.json to section $.scheduler");
}
if (!includedTenants.isEmpty()) {
log.warn("Tenant list was overridden by property 'xm-config.include-tenants' to: {}", includedTenants);
}
tenantToStart = tenantKeys.stream()
.filter(TenantListRepository.isIncluded(includedTenants)
.and(isSuspended().negate()))
.map(TenantState::getName)
.collect(Collectors.toSet());
log.info("scheduler will be turned on for tenants: {}", tenantToStart);
}
// Do not delete @Async! Otherwise bindingService.bindConsumer(channel, chanelName) will initiate recursive call
// through Spring application creation and startup event sending.
// See: https://github.com/spring-cloud/spring-cloud-stream/issues/609
@Async
@EventListener(ApplicationReadyEvent.class)
public void startChannels() {
if (tenantToStart == null) {
throw new IllegalStateException("Scheduler channel manager was not initialized. Call onInit() first!");
}
log.info("Start channels for tenants: {}", tenantToStart);
tenantToStart.forEach(this::createChannels);
}
@Override
public void onRefresh(String key, String config) {
parseConfig(key, config);
startChannels();
}
@Override
public boolean isListeningConfiguration(String updatedKey) {
return TENANTS_LIST_CONFIG_KEY.equals(updatedKey);
}
@Override
public void onInit(String key, String config) {
parseConfig(key, config);
}
private static String unwrap(final String str) {
if (isEmpty(str) || isEmpty(WRAP_TOKEN)) {
return str;
}
if (startsWith(str, WRAP_TOKEN) && endsWith(str, WRAP_TOKEN)) {
final int startIndex = str.indexOf(WRAP_TOKEN);
final int endIndex = str.lastIndexOf(WRAP_TOKEN);
final int wrapLength = WRAP_TOKEN.length();
if (startIndex != -1 && endIndex != -1) {
return str.substring(startIndex + wrapLength, endIndex);
}
}
return str;
}
}
| [
"shuki.avraham@whitesourcesoftware.com"
] | shuki.avraham@whitesourcesoftware.com |
2840ebc7122ca3b39205f09e87344240bae6305a | 27d176357b928e975eab5d4430a174d17e30b45a | /AcostaMejia-cop3330-ex01/src/main/java/org/example/App.java | 18951623a941ee7b359d50722233a04a4e5dcef9 | [] | no_license | lacostamejia/AcostaMejia-cop3330-ex01 | 0f38ddddd6fe1589725b814bef8886a18cd065df | b6ec8d480733ec48c4c228bd6621450533b167f2 | refs/heads/main | 2023-06-25T04:39:54.993561 | 2021-07-24T22:46:11 | 2021-07-24T22:46:11 | 372,032,640 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 465 | java | package org.example;
import java.util.Scanner;
//Homework 1.
public class App
{
public static void main( String[] args )
{
Scanner name_input = new Scanner(System.in); // Create a Scanner object
System.out.print("What is your name?");
String name = name_input.nextLine(); // Read user input
String output = "Hello, " + name + ", nice to meet you!";
System.out.println(output); // Output user input
}
}
| [
"lacostamejia@knights.ucf.edu"
] | lacostamejia@knights.ucf.edu |
52ea1f295a50d74263a4f7ebc9e4af6a07dc0cd3 | 0f996667eeb5bf330978ec5166e9fe4d4ccd3ba0 | /src/main/java/com/hrh/kmanual/sys/controllers/DictionaryController.java | 3ca4c4bca65312d72d6f8507000def9934bab00a | [] | no_license | zhengzhixiong/KnowledgeManual | 949f5c159bc01cfdf60f23a18560c4115e9c4185 | 3740da24430b49229d91bbcc204a87ade9ef01f3 | refs/heads/master | 2020-05-30T14:41:13.434051 | 2018-10-11T12:34:55 | 2018-10-11T12:34:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,214 | java | package com.hrh.kmanual.sys.controllers;
import com.hrh.kmanual.commons.utils.HttpJsonUtils;
import com.hrh.kmanual.sys.config.DictionaryConfig;
import com.hrh.kmanual.sys.dao.entities.Dictionary;
import com.hrh.kmanual.sys.dao.jpas.DictionaryRepository;
import com.hrh.kmanual.sys.dto.form.DictionaryAddForm;
import com.hrh.kmanual.sys.dto.form.DictionaryUpdateForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Sort;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Date;
/**
* @author huangrenhao
* @date 2018/8/17
*/
@RequestMapping("dictionary")
@RestController
public class DictionaryController {
@Autowired
private DictionaryRepository dictionaryRepository;
@PostMapping("update")
public Object update(@Valid DictionaryUpdateForm form, BindingResult bindingResult){
if (bindingResult.hasFieldErrors()) {
return HttpJsonUtils.buildError(bindingResult.getFieldError().getDefaultMessage());
}
dictionaryRepository.save(form.trainToEntity());
return HttpJsonUtils.RESULT_SUCCESS ;
}
@PostMapping("addition")
public Object addition(@Valid DictionaryAddForm form, BindingResult bindingResult) {
if (bindingResult.hasFieldErrors()) {
return HttpJsonUtils.buildError(bindingResult.getFieldError().getDefaultMessage());
}
Dictionary dictionary = form.trainToEntity();
dictionary.setCreateTime(new Date());
dictionary.setStatus(1);
dictionaryRepository.save(dictionary);
return dictionary.getId() != null ? HttpJsonUtils.RESULT_SUCCESS : HttpJsonUtils.RESULT_FAILURE;
}
@GetMapping("knowledge/types")
public Object getDictionaryTypes() {
return DictionaryConfig.getKnowledgeTypeMap();
}
@GetMapping("{id}/info")
public Object getOne(@PathVariable("id") Long id) {
return dictionaryRepository.findOne(id);
}
@GetMapping("list")
public Object getList() {
return dictionaryRepository.findAll(new Sort(Sort.Direction.DESC, "createTime"));
}
}
| [
"916812040@qq.com"
] | 916812040@qq.com |
bb23edefabe5850865065ef7f9b4f76f42cf51f9 | 058141a02bf1fadffcb06584b651a519e827c3e0 | /src/com/liulian/chatuidemo/applib/model/HXNotifier.java | 3eb7d802fd2973f49ae452dca41ebd36e1430adf | [
"Apache-2.0"
] | permissive | tingxingge1234/liulian | d6afa66068360743190afa10ea0b2d3ccbeab304 | 5af6d7f8c4d490fb191333e06de836fcba2c4a89 | refs/heads/master | 2020-04-02T06:07:22.316634 | 2016-06-08T09:31:55 | 2016-06-08T09:31:55 | 60,312,509 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,697 | java | /************************************************************
* * EaseMob CONFIDENTIAL
* __________________
* Copyright (C) 2013-2014 EaseMob Technologies. All rights reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of EaseMob Technologies.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from EaseMob Technologies.
*/
package com.liulian.chatuidemo.applib.model;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.media.AudioManager;
import android.media.Ringtone;
import android.media.RingtoneManager;
import android.net.Uri;
import android.os.Build;
import android.os.Vibrator;
import android.support.v4.app.NotificationCompat;
import com.liulian.chatuidemo.applib.controller.HXSDKHelper;
import com.easemob.chat.EMChatManager;
import com.easemob.chat.EMMessage;
import com.easemob.util.EMLog;
import com.easemob.util.EasyUtils;
/**
* 新消息提醒class
* 2.1.8把新消息提示相关的api移除出sdk,方便开发者自由修改
* 开发者也可以继承此类实现相关的接口
*
* this class is subject to be inherited and implement the relative APIs
*/
public class HXNotifier {
private final static String TAG = "notify";
Ringtone ringtone = null;
protected final static String[] msg_eng = { "sent a message", "sent a picture", "sent a voice",
"sent location message", "sent a video", "sent a file", "%1 contacts sent %2 messages"
};
protected final static String[] msg_ch = { "发来一条消息", "发来一张图片", "发来一段语音", "发来位置信息", "发来一个视频", "发来一个文件",
"%1个联系人发来%2条消息"
};
protected static int notifyID = 0525; // start notification id
protected static int foregroundNotifyID = 0555;
protected NotificationManager notificationManager = null;
protected HashSet<String> fromUsers = new HashSet<String>();
protected int notificationNum = 0;
protected Context appContext;
protected String packageName;
protected String[] msgs;
protected long lastNotifiyTime;
protected AudioManager audioManager;
protected Vibrator vibrator;
protected HXNotificationInfoProvider notificationInfoProvider;
public HXNotifier() {
}
/**
* 开发者可以重载此函数
* this function can be override
* @param context
* @return
*/
public HXNotifier init(Context context){
appContext = context;
notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
packageName = appContext.getApplicationInfo().packageName;
if (Locale.getDefault().getLanguage().equals("zh")) {
msgs = msg_ch;
} else {
msgs = msg_eng;
}
audioManager = (AudioManager) appContext.getSystemService(Context.AUDIO_SERVICE);
vibrator = (Vibrator) appContext.getSystemService(Context.VIBRATOR_SERVICE);
return this;
}
/**
* 开发者可以重载此函数
* this function can be override
*/
public void reset(){
resetNotificationCount();
cancelNotificaton();
}
void resetNotificationCount() {
notificationNum = 0;
fromUsers.clear();
}
void cancelNotificaton() {
if (notificationManager != null)
notificationManager.cancel(notifyID);
}
/**
* 处理新收到的消息,然后发送通知
*
* 开发者可以重载此函数
* this function can be override
*
* @param message
*/
public synchronized void onNewMsg(EMMessage message) {
if(EMChatManager.getInstance().isSlientMessage(message)){
return;
}
// 判断app是否在后台
if (!EasyUtils.isAppRunningForeground(appContext)) {
EMLog.d(TAG, "app is running in backgroud");
sendNotification(message, false);
} else {
sendNotification(message, true);
}
viberateAndPlayTone(message);
}
public synchronized void onNewMesg(List<EMMessage> messages) {
if(EMChatManager.getInstance().isSlientMessage(messages.get(messages.size()-1))){
return;
}
// 判断app是否在后台
if (!EasyUtils.isAppRunningForeground(appContext)) {
EMLog.d(TAG, "app is running in backgroud");
sendNotification(messages, false);
} else {
sendNotification(messages, true);
}
viberateAndPlayTone(messages.get(messages.size()-1));
}
/**
* 发送通知栏提示
* This can be override by subclass to provide customer implementation
* @param messages
* @param isForeground
*/
protected void sendNotification (List<EMMessage> messages, boolean isForeground){
for(EMMessage message : messages){
if(!isForeground){
notificationNum++;
fromUsers.add(message.getFrom());
}
}
sendNotification(messages.get(messages.size()-1), isForeground, false);
}
protected void sendNotification (EMMessage message, boolean isForeground){
sendNotification(message, isForeground, true);
}
/**
* 发送通知栏提示
* This can be override by subclass to provide customer implementation
* @param message
*/
protected void sendNotification(EMMessage message, boolean isForeground, boolean numIncrease) {
String username = message.getFrom();
try {
String notifyText = username + " ";
switch (message.getType()) {
case TXT:
notifyText += msgs[0];
break;
case IMAGE:
notifyText += msgs[1];
break;
case VOICE:
notifyText += msgs[2];
break;
case LOCATION:
notifyText += msgs[3];
break;
case VIDEO:
notifyText += msgs[4];
break;
case FILE:
notifyText += msgs[5];
break;
}
PackageManager packageManager = appContext.getPackageManager();
String appname = (String) packageManager.getApplicationLabel(appContext.getApplicationInfo());
// notification titile
String contentTitle = appname;
if (notificationInfoProvider != null) {
String customNotifyText = notificationInfoProvider.getDisplayedText(message);
String customCotentTitle = notificationInfoProvider.getTitle(message);
if (customNotifyText != null){
// 设置自定义的状态栏提示内容
notifyText = customNotifyText;
}
if (customCotentTitle != null){
// 设置自定义的通知栏标题
contentTitle = customCotentTitle;
}
}
// create and send notificaiton
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(appContext)
.setSmallIcon(appContext.getApplicationInfo().icon)
.setWhen(System.currentTimeMillis())
.setAutoCancel(true);
Intent msgIntent = appContext.getPackageManager().getLaunchIntentForPackage(packageName);
if (notificationInfoProvider != null) {
// 设置自定义的notification点击跳转intent
msgIntent = notificationInfoProvider.getLaunchIntent(message);
}
PendingIntent pendingIntent = PendingIntent.getActivity(appContext, notifyID, msgIntent,PendingIntent.FLAG_UPDATE_CURRENT);
if(numIncrease){
// prepare latest event info section
if(!isForeground){
notificationNum++;
fromUsers.add(message.getFrom());
}
}
int fromUsersNum = fromUsers.size();
String summaryBody = msgs[6].replaceFirst("%1", Integer.toString(fromUsersNum)).replaceFirst("%2",Integer.toString(notificationNum));
if (notificationInfoProvider != null) {
// lastest text
String customSummaryBody = notificationInfoProvider.getLatestText(message, fromUsersNum,notificationNum);
if (customSummaryBody != null){
summaryBody = customSummaryBody;
}
// small icon
int smallIcon = notificationInfoProvider.getSmallIcon(message);
if (smallIcon != 0){
mBuilder.setSmallIcon(smallIcon);
}
}
mBuilder.setContentTitle(contentTitle);
mBuilder.setTicker(notifyText);
mBuilder.setContentText(summaryBody);
mBuilder.setContentIntent(pendingIntent);
// mBuilder.setNumber(notificationNum);
Notification notification = mBuilder.build();
if (isForeground) {
notificationManager.notify(foregroundNotifyID, notification);
notificationManager.cancel(foregroundNotifyID);
} else {
notificationManager.notify(notifyID, notification);
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 手机震动和声音提示
*/
public void viberateAndPlayTone(EMMessage message) {
if(message != null){
if(EMChatManager.getInstance().isSlientMessage(message)){
return;
}
}
HXSDKModel model = HXSDKHelper.getInstance().getModel();
if(!model.getSettingMsgNotification()){
return;
}
if (System.currentTimeMillis() - lastNotifiyTime < 1000) {
// received new messages within 2 seconds, skip play ringtone
return;
}
try {
lastNotifiyTime = System.currentTimeMillis();
// 判断是否处于静音模式
if (audioManager.getRingerMode() == AudioManager.RINGER_MODE_SILENT) {
EMLog.e(TAG, "in slient mode now");
return;
}
if(model.getSettingMsgVibrate()){
long[] pattern = new long[] { 0, 180, 80, 120 };
vibrator.vibrate(pattern, -1);
}
if(model.getSettingMsgSound()){
if (ringtone == null) {
Uri notificationUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
ringtone = RingtoneManager.getRingtone(appContext, notificationUri);
if (ringtone == null) {
EMLog.d(TAG, "cant find ringtone at:" + notificationUri.getPath());
return;
}
}
if (!ringtone.isPlaying()) {
String vendor = Build.MANUFACTURER;
ringtone.play();
// for samsung S3, we meet a bug that the phone will
// continue ringtone without stop
// so add below special handler to stop it after 3s if
// needed
if (vendor != null && vendor.toLowerCase().contains("samsung")) {
Thread ctlThread = new Thread() {
public void run() {
try {
Thread.sleep(3000);
if (ringtone.isPlaying()) {
ringtone.stop();
}
} catch (Exception e) {
}
}
};
ctlThread.run();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* 设置NotificationInfoProvider
*
* @param provider
*/
public void setNotificationInfoProvider(HXNotificationInfoProvider provider) {
notificationInfoProvider = provider;
}
public interface HXNotificationInfoProvider {
/**
* 设置发送notification时状态栏提示新消息的内容(比如Xxx发来了一条图片消息)
*
* @param message
* 接收到的消息
* @return null为使用默认
*/
String getDisplayedText(EMMessage message);
/**
* 设置notification持续显示的新消息提示(比如2个联系人发来了5条消息)
*
* @param message
* 接收到的消息
* @param fromUsersNum
* 发送人的数量
* @param messageNum
* 消息数量
* @return null为使用默认
*/
String getLatestText(EMMessage message, int fromUsersNum, int messageNum);
/**
* 设置notification标题
*
* @param message
* @return null为使用默认
*/
String getTitle(EMMessage message);
/**
* 设置小图标
*
* @param message
* @return 0使用默认图标
*/
int getSmallIcon(EMMessage message);
/**
* 设置notification点击时的跳转intent
*
* @param message
* 显示在notification上最近的一条消息
* @return null为使用默认
*/
Intent getLaunchIntent(EMMessage message);
}
}
| [
"88075728@qq.com"
] | 88075728@qq.com |
38e1065eeca6b161d2f1c01cb2f79349ab2e48e2 | 2d1b180935fa52cb83cbc3ebd3858d8a4160942c | /src/main/java/ua/kiev/prog/daoImpl/GroupDAOImpl.java | 4e6bef277b1e73a389c838c4cdd50139fa711a6a | [] | no_license | OksanaKilianchuk/SpringSecurityMVC | dafaed6cb3d62fd502ed99d1a667fa374a1a7884 | a0c78bba6d2f5156ac9eceb4620713f46320242d | refs/heads/master | 2021-01-18T01:29:26.176683 | 2016-09-20T08:40:33 | 2016-09-20T08:40:33 | 68,691,576 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 917 | java | package ua.kiev.prog.daoImpl;
import org.springframework.stereotype.Repository;
import ua.kiev.prog.dao.GroupDAO;
import ua.kiev.prog.entity.Group;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import java.util.List;
@Repository
public class GroupDAOImpl implements GroupDAO {
@PersistenceContext
private EntityManager entityManager;
@Override
public void add(Group group) {
entityManager.persist(group);
}
@Override
public void delete(Group group) {
entityManager.remove(group);
}
@Override
public Group findOne(long id) {
return entityManager.getReference(Group.class, id);
}
@Override
public List<Group> list() {
Query query = entityManager.createQuery("SELECT g FROM Group g", Group.class);
return (List<Group>) query.getResultList();
}
}
| [
"oksanakilyanchuk@gmail.com"
] | oksanakilyanchuk@gmail.com |
d1f7c4ff0428949f6658dadc8fe8ab41138aad63 | e84059c54c48228e831cd905463989cd8734feb5 | /orderMeal/OrderMeal/src/com/java1234/view/LogOnFrm.java | 1dcda231db9696b942fee8513468d9bf24baa6ea | [] | no_license | ljh-712/javacode | 5c89b7e7a2c14c03e1e42978367985932d552561 | c5430fbb12a85e088effa9113c325fd94a87be96 | refs/heads/master | 2021-07-10T13:53:25.128861 | 2020-11-24T02:18:05 | 2020-11-24T02:18:05 | 211,501,085 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,998 | java | /*
* LogOnFrm.java
*
* Created on __DATE__, __TIME__
*/
package com.java1234.view;
import java.awt.Font;
import java.sql.Connection;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import com.java1234.dao.UserDao;
import com.java1234.model.User;
import com.java1234.util.DbUtil;
import com.java1234.util.StringUtil;
/**
*
* @author __USER__
*/
public class LogOnFrm extends javax.swing.JFrame {
DbUtil dbUtil = new DbUtil();
UserDao userDao = new UserDao();
public User s_currentUser = null;//�����½�û��IJ���
/** Creates new form LogOnFrm */
public LogOnFrm() {
//�ı�ϵͳĬ������
Font font = new Font("Dialog", Font.PLAIN, 12);
java.util.Enumeration keys = UIManager.getDefaults().keys();
while (keys.hasMoreElements()) {
Object key = keys.nextElement();
Object value = UIManager.get(key);
if (value instanceof javax.swing.plaf.FontUIResource) {
UIManager.put(key, font);
}
}
initComponents();
//����frame������ʾ
this.setLocationRelativeTo(null);
}
//GEN-BEGIN:initComponents
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel3 = new javax.swing.JLabel();
jb_logon = new javax.swing.JButton();
jb_register = new javax.swing.JButton();
userNameTxt = new javax.swing.JTextField();
passwordTxt = new javax.swing.JPasswordField();
jb_reset = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("\u9910\u5385\u70b9\u9910\u7cfb\u7edf");
setResizable(false);
jLabel1.setFont(new java.awt.Font("����", 1, 24));
jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource(
"/images/OrderMeal.png"))); // NOI18N
jLabel1
.setText("\u9910\u5385\u70b9\u9910\u7cfb\u7edf\u6b22\u8fce\u60a8");
jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource(
"/images/userName.png"))); // NOI18N
jLabel2.setText("\u7528\u6237\u540d\uff1a");
jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource(
"/images/password.png"))); // NOI18N
jLabel3.setText("\u5bc6 \u7801\uff1a");
jb_logon.setIcon(new javax.swing.ImageIcon(getClass().getResource(
"/images/login.png"))); // NOI18N
jb_logon.setText("\u767b\u9646");
jb_logon.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jb_logonActionPerformed(evt);
}
});
jb_register.setIcon(new javax.swing.ImageIcon(getClass().getResource(
"/images/register.png"))); // NOI18N
jb_register.setText("\u6ce8\u518c\u7528\u6237");
jb_register.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jb_registerActionPerformed(evt);
}
});
jb_reset.setIcon(new javax.swing.ImageIcon(getClass().getResource(
"/images/reset.png"))); // NOI18N
jb_reset.setText("\u91cd\u7f6e");
jb_reset.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jb_resetActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(
getContentPane());
getContentPane().setLayout(layout);
layout
.setHorizontalGroup(layout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
javax.swing.GroupLayout.Alignment.TRAILING,
layout
.createSequentialGroup()
.addGap(52, 52, 52)
.addGroup(
layout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
layout
.createSequentialGroup()
.addGroup(
layout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(
jLabel2)
.addComponent(
jLabel3))
.addGap(
33,
33,
33)
.addGroup(
layout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING,
false)
.addComponent(
passwordTxt)
.addComponent(
userNameTxt,
javax.swing.GroupLayout.DEFAULT_SIZE,
193,
Short.MAX_VALUE)))
.addGroup(
layout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(
javax.swing.GroupLayout.Alignment.LEADING,
layout
.createSequentialGroup()
.addGap(
8,
8,
8)
.addComponent(
jb_logon)
.addGap(
18,
18,
18)
.addComponent(
jb_reset)
.addGap(
18,
18,
18)
.addComponent(
jb_register))
.addComponent(
jLabel1,
javax.swing.GroupLayout.PREFERRED_SIZE,
304,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addContainerGap(54, Short.MAX_VALUE)));
layout
.setVerticalGroup(layout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(
layout
.createSequentialGroup()
.addGap(18, 18, 18)
.addComponent(
jLabel1,
javax.swing.GroupLayout.PREFERRED_SIZE,
58,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(27, 27, 27)
.addGroup(
layout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(
userNameTxt,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(38, 38, 38)
.addGroup(
layout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(
passwordTxt,
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(37, 37, 37)
.addGroup(
layout
.createParallelGroup(
javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jb_logon)
.addComponent(jb_reset)
.addComponent(
jb_register))
.addContainerGap(55, Short.MAX_VALUE)));
pack();
}// </editor-fold>
//GEN-END:initComponents
//��ʾע��ҳ��
private void jb_registerActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose();
new RegisterFrm().setVisible(true);
}
//��½��֤��ʾ��½�Ժ����
private void jb_logonActionPerformed(java.awt.event.ActionEvent evt) {
String userName = this.userNameTxt.getText();
String password = new String(this.passwordTxt.getPassword());
if (StringUtil.isEmpty(userName)) {
JOptionPane.showMessageDialog(null, "�û�������Ϊ��");
return;
}
if (StringUtil.isEmpty(password)) {
JOptionPane.showMessageDialog(null, "���벻��Ϊ��");
return;
}
User user = new User(userName, password);
Connection con = null;
try {
con = dbUtil.getCon();
User currentUser = userDao.login(con, user);
if (currentUser != null) {
s_currentUser = currentUser;//�����½���û�
int role = currentUser.getRank();
if (role == 1) {
this.dispose();
new AdminFrm().setVisible(true);//�������Աҳ��
} else if (role == 0) {
this.dispose();
new UserOrderFrm().setVisible(true);//�����û���ͽ���
}
} else {
JOptionPane.showMessageDialog(null, "�û������������");
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
JOptionPane.showMessageDialog(null, "�û������������");
} finally {
try {
dbUtil.closeCon(con);
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
//�����ı�������
private void jb_resetActionPerformed(java.awt.event.ActionEvent evt) {
this.passwordTxt.setText("");
this.userNameTxt.setText("");
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new LogOnFrm().setVisible(true);
}
});
}
//GEN-BEGIN:variables
// Variables declaration - do not modify
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JButton jb_logon;
private javax.swing.JButton jb_register;
private javax.swing.JButton jb_reset;
private javax.swing.JPasswordField passwordTxt;
private javax.swing.JTextField userNameTxt;
// End of variables declaration//GEN-END:variables
} | [
"l15991864531@163.com"
] | l15991864531@163.com |
2cd576dacedd291e443c13d8c576f4d3bdb1bf00 | f3f50f50a590837405c5f151b9a13b2b44b7f191 | /tubesPBO/src/tubespbo/Pesanan.java | dd4fcc4395495b8b6f420676e5f61455bdb41d49 | [] | no_license | gilangtama/tubesPBO | 87e70285be05b5598700e07e44d5f5bdd1f770e7 | 8489f39518d347fe0ea34a132806b4221e92d39e | refs/heads/master | 2021-01-22T01:43:27.627774 | 2016-03-18T08:31:02 | 2016-03-18T08:31:02 | 54,101,188 | 0 | 0 | null | 2016-03-17T08:27:56 | 2016-03-17T08:27:56 | null | UTF-8 | Java | false | false | 720 | 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 tubespbo;
/**
*
* @author asd
*/
public class Pesanan {
private String origin;
private String destination;
public Pesanan (String origin, String destination) {
this.origin = origin;
this.destination = destination;
}
public void setOrigin (String origin){
this.origin= origin;
}
public String getOrigin() {
return this.origin;
}
public void setDestination (String destination){
this.destination= destination;
}
public String getDestination() {
return this.destination;
}
}
| [
"asd@10.5.248.39"
] | asd@10.5.248.39 |
6da6e45b8f95ce010709c6ee6fe8e52874ea0538 | adda7e6d2e0ff3e8d985bd0ee1034328de1755f1 | /raj/leetcode/google/GuessTheWord.java | d2649d05aae0963046b5eafb69b04e62ec94b4c4 | [] | no_license | that-engineer/dsa | d976263c917e67f37ca442f42cb868a0f7c11b6d | 73e93adbf6c7bf29cae63f9f7b58734d61096266 | refs/heads/master | 2021-10-12T00:49:14.352791 | 2019-01-31T05:57:15 | 2019-01-31T05:57:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,866 | java | package com.raj.leetcode.google;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
/**
*
* @author Raj
* This problem is an interactive problem new to the LeetCode platform.
We are given a word list of unique words, each word is 6 letters long, and one word in this list is chosen as secret.
You may call master.guess(word) to guess a word. The guessed word should have type string and must be from the original list with 6 lowercase letters.
This function returns an integer type, representing the number of exact matches (value and position) of your guess to the secret word. Also, if your guess is not in the given wordlist, it will return -1 instead.
For each test case, you have 10 guesses to guess the word. At the end of any number of calls, if you have made 10 or less calls to master.guess and at least one of these guesses was the secret, you pass the testcase.
Besides the example test case below, there will be 5 additional test cases, each with 100 words in the word list. The letters of each word in those testcases were chosen independently at random from 'a' to 'z', such that every word in the given word lists is unique.
Example 1:
Input: secret = "acckzz", wordlist = ["acckzz","ccbazz","eiowzz","abcczz"]
Explanation:
master.guess("aaaaaa") returns -1, because "aaaaaa" is not in wordlist.
master.guess("acckzz") returns 6, because "acckzz" is secret and has all 6 matches.
master.guess("ccbazz") returns 3, because "ccbazz" has 3 matches.
master.guess("eiowzz") returns 2, because "eiowzz" has 2 matches.
master.guess("abcczz") returns 4, because "abcczz" has 4 matches.
We made 5 calls to master.guess and one of them was the secret, so we pass the test case.
Note: Any solutions that attempt to circumvent the judge will result in disqualification.
*
*/
public class GuessTheWord {
// https://leetcode.com/problems/guess-the-word/discuss/133862/Random-Guess-and-Minimax-Guess-with-Comparison
/*
* Strategy : Avoid words that has zero matches in each round
* 1. make map of words with zero matches
* 2. Guess will be a word (a) that has atleast one match with other words, or
* (b) word that least of zero matches
* 3) if guess is not correct, build words for next iteration with exact 'x' matches
*/
public void findSecretWord(String[] wordlist, Master master) {
for (int i = 0, x = 0; i < 10 && x < 6; i++) {
Map<String, Integer> map = new HashMap<>();
for (String w1 : wordlist) {
for (String w2 : wordlist) {
if (match(w1, w2) == 0) {
map.put(w1, map.getOrDefault(w1, 0) + 1);
}
}
}
String guess = "";
int minCount = 1000;
for (String word : wordlist) {
if (!map.containsKey(word)) {
guess = word;
break;
} else if (map.get(word) < minCount) {
minCount = map.get(word);
guess = word;
}
}
x = master.guess(guess);
List<String> newWordList = new ArrayList<>();
for (String word : wordlist) {
if (match(word, guess) == x) {
newWordList.add(word);
}
}
wordlist = newWordList.toArray(new String[newWordList.size()]);
}
}
// https://leetcode.com/problems/guess-the-word/discuss/133862/Random-Guess-and-Minimax-Guess-with-Comparison
/*
* Strategy : Guess the word randomly
* 1. make map of words with zero matches
* 2. Guess will be a word (a) that has atleast one match with other words, or
* (b) word that least of zero matches
* 3) if guess is not correct, build words for next iteration with exact 'x' matches
*/
public void findSecretWord2(String[] wordlist, Master master) {
for (int i = 0, x = 0; i < 10 && x < 6; i++) {
String guess = wordlist[new Random().nextInt(wordlist.length)];
x = master.guess(guess);
List<String> newWordList = new ArrayList<>();
for (String word : wordlist) {
if (match(word, guess) == x) {
newWordList.add(word);
}
}
wordlist = newWordList.toArray(new String[newWordList.size()]);
}
}
private int match(String s, String t) {
int matches = 0;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == t.charAt(i)) {
matches++;
}
}
return matches;
}
public static void main(String... args) {
GuessTheWord obj = new GuessTheWord();
String words[] = { "acckzz", "ccbazz", "eiowzz", "abcczz" };
Master master = new Master("eiowzz");
obj.findSecretWord(words, master);
}
}
class Master {
String secret;
public Master(String secret) {
this.secret = secret;
}
public int guess(String word) {
int x = match(secret, word);
if (x == 6) {
System.out.println("Matched : " + word);
}
return x;
}
private int match(String s, String t) {
int matches = 0;
for (int i = 0; i < s.length(); i++) {
if (s.charAt(i) == t.charAt(i)) {
matches++;
}
}
return matches;
}
} | [
"passionatecoderraj@gmail.com"
] | passionatecoderraj@gmail.com |
9fa3c696745a3a645589a0e91f3cedec8c1a2849 | 07d104539f8689e522c3549beed827d25a59dddc | /src/main/java/com/example/Actorep/model/ActiviteModel.java | 3ce35ca0f75dc6c0d63d3a4640472dd72f0f1810 | [] | no_license | ezmr/Actorep | 7ae5deec155b72fc18892360f200c57852475e41 | 32573334546cb90b2260d8c72627a145a5a4bad3 | refs/heads/main | 2023-04-19T02:44:22.635260 | 2021-05-10T02:35:36 | 2021-05-10T02:35:36 | 365,896,251 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 707 | java | package com.example.Actorep.model;
public class ActiviteModel {
private String libelleActivite;
private String descriptionActivite;
public ActiviteModel() {
}
public ActiviteModel(String libelle, String description) {
this.libelleActivite = libelle;
this.descriptionActivite = description;
}
public String getLibelleActivite() {
return libelleActivite;
}
public void setLibelleActivite(String libelle) {
this.libelleActivite = libelle;
}
public String getDescriptionActivite() {
return descriptionActivite;
}
public void setDescriptionActivité(String description) {
this.descriptionActivite = description;
}
}
| [
"83933532+ezmr@users.noreply.github.com"
] | 83933532+ezmr@users.noreply.github.com |
696fb72e35ad7595ed83a021d84f6e03931bbc75 | 9e0aaedd8421a19d77a7a417d9555fa7e4c204da | /bubbleSortTest.java | 79bed1b180598c3ded97eaa8f2b12040218dbb05 | [] | no_license | BGordon419/CISS110 | e54ebcce5131c635c5e3df4ea91dd5706448b762 | 599c6c0844ae16ee6b719366f3b46a455b86bf4d | refs/heads/master | 2021-01-24T21:25:22.688714 | 2014-12-03T15:40:30 | 2014-12-03T15:40:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,250 | java | import java.util.Random;
public class bubbleSortTest {
public static void main(String[] args) {
Random rand = new Random();
int[] sorted, array = new int[1000];
// Fill array with random numbers
for(int x=0;x<array.length;x++) {
array[x] = rand.nextInt(array.length)+1;
System.out.println(array[x]); // Outputs numbers
}
System.out.println();
// retrive sorted array.
sorted = BubbleSort(array);
// Prints sorted numbers
for(int x=0;x<sorted.length;x++) {
System.out.println(sorted[x]);
}
}
// Sorts array using bubble sort
public static int[] BubbleSort(int array[]) {
int x, temp; // Counter and holding variable
boolean swapped = true;
while(swapped) {
swapped = false;
for(x=0;x<array.length-1;x++) {
// Checks to see if which od two numbers is larger
if(array[x]>array[x+1]) {
temp = array[x];
array[x] = array[x+1];
array[x+1] = temp;
swapped = true;
// System.out.println(array[x] + ", " + array[x+1]);
}
}
}
System.out.println();
return array;
}
}
| [
"BGordon419@gmail.com"
] | BGordon419@gmail.com |
73b70ac9f03745de75bd7ca1b85412aedd22b5c0 | 4b29481223e0975b7674cbc6022944d68f53a270 | /ActionBarSherlock-Library/.evosuite/best-tests/com/actionbarsherlock/widget/ShareActionProvider_ESTest_scaffolding.java | 6f37db38029cb9ae81747f0c299cd13862a55110 | [] | no_license | filipegl/Calculadora-de-Tributos-PJ | ab621df09101f27d982d0726a40ea95ac55b2eea | 07b36cbfde6242899c367ecf6c65db10cf96ab7b | refs/heads/master | 2020-04-04T21:24:03.585630 | 2018-11-06T01:58:26 | 2018-11-06T01:58:26 | 156,284,561 | 0 | 0 | null | 2018-11-05T21:20:31 | 2018-11-05T21:20:30 | null | UTF-8 | Java | false | false | 32,296 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Mon Nov 05 22:39:31 GMT 2018
*/
package com.actionbarsherlock.widget;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
import static org.evosuite.shaded.org.mockito.Mockito.*;
@EvoSuiteClassExclude
public class ShareActionProvider_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "com.actionbarsherlock.widget.ShareActionProvider";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
try { initMocksToAvoidTimeoutsInTheTests(); } catch(ClassNotFoundException e) {}
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("file.encoding", "Cp1252");
java.lang.System.setProperty("java.awt.headless", "true");
java.lang.System.setProperty("java.io.tmpdir", "C:\\Users\\Thiago\\AppData\\Local\\Temp\\");
java.lang.System.setProperty("user.country", "US");
java.lang.System.setProperty("user.dir", "C:\\Users\\Thiago\\Documents\\Calculadora\\Calculadora-de-Tributos-PJ\\ActionBarSherlock-Library");
java.lang.System.setProperty("user.home", "C:\\Users\\Thiago");
java.lang.System.setProperty("user.language", "en");
java.lang.System.setProperty("user.name", "Thiago");
java.lang.System.setProperty("user.timezone", "America/Sao_Paulo");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(ShareActionProvider_ESTest_scaffolding.class.getClassLoader() ,
"android.app.NativeActivity",
"android.view.View$AccessibilityDelegate",
"android.content.ComponentCallbacks",
"android.view.MenuItem$OnActionExpandListener",
"android.appwidget.AppWidgetProviderInfo",
"android.widget.ExpandableListView$OnGroupCollapseListener",
"android.widget.RelativeLayout$LayoutParams",
"android.content.res.ColorStateList",
"android.view.ViewStub$OnInflateListener",
"android.app.LocalActivityManager",
"android.view.DragEvent",
"android.widget.ExpandableListView$OnGroupClickListener",
"android.view.View$OnGenericMotionListener",
"android.content.ContentProvider$PipeDataWriter",
"com.actionbarsherlock.internal.app.ActionBarWrapper",
"android.graphics.Paint",
"com.actionbarsherlock.internal.view.View_OnAttachStateChangeListener",
"android.content.DialogInterface$OnShowListener",
"android.widget.AdapterView$OnItemSelectedListener",
"android.app.FragmentManager",
"android.graphics.Path",
"android.app.TimePickerDialog",
"com.actionbarsherlock.R$id",
"com.actionbarsherlock.app.ActionBar",
"android.widget.ExpandableListAdapter",
"com.actionbarsherlock.widget.ShareActionProvider$OnShareTargetSelectedListener",
"android.view.ViewTreeObserver$OnPreDrawListener",
"android.widget.LinearLayout$LayoutParams",
"android.graphics.ColorFilter",
"com.actionbarsherlock.widget.ShareActionProvider",
"android.os.Parcelable",
"android.graphics.Path$FillType",
"android.text.method.KeyListener",
"android.content.ComponentName",
"com.actionbarsherlock.R$styleable",
"android.database.CrossProcessCursor",
"android.view.TextureView$SurfaceTextureListener",
"android.widget.ArrayAdapter",
"android.content.SharedPreferences",
"com.actionbarsherlock.R$integer",
"android.widget.TableRow",
"com.actionbarsherlock.internal.nineoldandroids.animation.AnimatorSet",
"android.widget.ImageButton",
"android.view.ActionMode",
"com.actionbarsherlock.R$bool",
"android.graphics.drawable.Drawable$Callback",
"com.actionbarsherlock.R$drawable",
"android.text.style.ClickableSpan",
"android.animation.Animator",
"android.widget.TabHost$OnTabChangeListener",
"android.database.DatabaseErrorHandler",
"android.widget.AdapterView",
"android.database.DataSetObserver",
"android.widget.GridLayout",
"android.view.View$OnLongClickListener",
"android.widget.ViewSwitcher",
"android.content.pm.ComponentInfo",
"android.widget.Checkable",
"com.actionbarsherlock.internal.view.View_HasStateListenerSupport",
"com.actionbarsherlock.view.MenuItem$OnActionExpandListener",
"android.view.LayoutInflater$Filter",
"com.actionbarsherlock.internal.nineoldandroids.view.NineViewGroup",
"android.widget.BaseAdapter",
"android.app.Application",
"com.actionbarsherlock.internal.widget.ScrollingTabContainerView$TabView",
"android.view.accessibility.AccessibilityRecord",
"com.actionbarsherlock.internal.widget.IcsAbsSpinner",
"android.widget.Filterable",
"android.widget.ListView",
"com.actionbarsherlock.internal.view.menu.MenuView",
"android.view.LayoutInflater$Factory2",
"com.actionbarsherlock.internal.nineoldandroids.widget.NineHorizontalScrollView",
"android.view.inputmethod.EditorInfo",
"android.widget.NumberPicker",
"android.content.res.AssetFileDescriptor",
"android.widget.CalendarView",
"android.widget.CalendarView$OnDateChangeListener",
"android.widget.Filter$FilterListener",
"com.actionbarsherlock.internal.view.menu.MenuItemImpl",
"android.text.GetChars",
"android.view.SurfaceHolder$Callback",
"com.actionbarsherlock.internal.view.menu.MenuBuilder$ItemInvoker",
"android.os.Build",
"android.text.SpannableStringInternal",
"android.widget.MediaController$MediaPlayerControl",
"android.widget.Scroller",
"android.widget.RadioGroup$LayoutParams",
"android.view.InputQueue$Callback",
"android.content.pm.PackageItemInfo",
"android.database.sqlite.SQLiteDatabase$CursorFactory",
"android.graphics.Bitmap",
"android.widget.TextSwitcher",
"android.view.ViewTreeObserver",
"android.text.style.CharacterStyle",
"android.view.View$OnHoverListener",
"android.database.MatrixCursor$RowBuilder",
"com.actionbarsherlock.widget.ShareActionProvider$ShareAcitivityChooserModelPolicy",
"android.content.DialogInterface$OnClickListener",
"com.actionbarsherlock.R$dimen",
"android.net.Uri",
"android.gesture.GestureOverlayView",
"android.graphics.drawable.Drawable",
"com.actionbarsherlock.view.SubMenu",
"com.actionbarsherlock.widget.ActivityChooserView$3",
"android.os.Build$VERSION",
"com.actionbarsherlock.widget.ActivityChooserView$1",
"android.widget.PopupWindow$OnDismissListener",
"android.os.Looper",
"android.graphics.Canvas",
"android.view.accessibility.AccessibilityEvent",
"android.net.Uri$Builder",
"android.widget.TextView$BufferType",
"android.view.animation.Interpolator",
"com.actionbarsherlock.internal.widget.ActionBarContainer",
"com.actionbarsherlock.internal.view.menu.ActionMenuPresenter$OpenOverflowRunnable",
"com.actionbarsherlock.internal.view.menu.BaseMenuPresenter",
"android.graphics.Region",
"android.view.ActionProvider",
"android.view.ViewTreeObserver$OnGlobalLayoutListener",
"android.view.View$OnLayoutChangeListener",
"android.content.BroadcastReceiver$PendingResult",
"android.os.Message",
"android.view.animation.LayoutAnimationController",
"com.actionbarsherlock.internal.widget.ScrollingTabContainerView",
"android.text.TextPaint",
"android.text.TextWatcher",
"com.actionbarsherlock.internal.widget.ActionBarContextView",
"android.animation.TimeInterpolator",
"com.actionbarsherlock.internal.view.menu.ListMenuItemView",
"android.app.FragmentTransaction",
"android.renderscript.RenderScript",
"android.os.Parcel",
"android.database.CursorWindow",
"android.app.FragmentManager$OnBackStackChangedListener",
"android.text.Spannable$Factory",
"android.content.SearchRecentSuggestionsProvider",
"android.content.res.AssetManager",
"android.content.Loader$OnLoadCompleteListener",
"com.xtremelabs.robolectric.util.I18nException",
"com.actionbarsherlock.internal.view.menu.ActionMenuItemView",
"com.actionbarsherlock.widget.ActivityChooserModel$SerialExecutor",
"android.text.ParcelableSpan",
"android.widget.TwoLineListItem",
"android.view.ViewGroup$OnHierarchyChangeListener",
"android.text.SpannableString",
"com.actionbarsherlock.widget.ActivityChooserModel$ActivityChooserModelClient",
"android.widget.TabHost",
"android.widget.AbsListView$OnScrollListener",
"android.util.TypedValue",
"android.view.InputQueue",
"com.actionbarsherlock.internal.nineoldandroids.widget.NineLinearLayout",
"com.actionbarsherlock.internal.nineoldandroids.view.animation.AnimatorProxy",
"com.actionbarsherlock.internal.nineoldandroids.animation.Animator$AnimatorListener",
"android.view.SurfaceView",
"android.text.Spannable",
"android.widget.RemoteViews$RemoteView",
"android.content.res.XmlResourceParser",
"android.widget.TableLayout$LayoutParams",
"com.actionbarsherlock.internal.app.ActionBarWrapper$TabWrapper",
"android.os.IBinder",
"android.widget.CheckBox",
"android.view.ContextThemeWrapper",
"android.view.ViewTreeObserver$OnTouchModeChangeListener",
"com.actionbarsherlock.R$attr",
"android.view.animation.Animation",
"android.graphics.Matrix",
"android.text.method.MovementMethod",
"android.content.ContentProviderResult",
"com.actionbarsherlock.internal.view.menu.MenuView$ItemView",
"android.view.ViewGroup$LayoutParams",
"android.text.InputType",
"android.widget.GridLayout$LayoutParams",
"android.content.BroadcastReceiver",
"android.view.animation.Animation$AnimationListener",
"android.os.PatternMatcher",
"android.accounts.AccountAuthenticatorActivity",
"android.widget.RelativeLayout",
"android.widget.TimePicker",
"android.widget.TimePicker$OnTimeChangedListener",
"com.actionbarsherlock.R$color",
"android.view.animation.DecelerateInterpolator",
"android.widget.GridLayout$Alignment",
"android.graphics.BitmapFactory$Options",
"com.actionbarsherlock.internal.view.menu.ActionMenuItem",
"android.content.Context",
"android.view.ContextMenu",
"android.widget.Adapter",
"com.actionbarsherlock.view.ActionProvider",
"android.widget.Filter",
"android.app.ActionBar$TabListener",
"android.widget.ViewSwitcher$ViewFactory",
"com.actionbarsherlock.view.Menu",
"android.content.res.TypedArray",
"android.view.ActionMode$Callback",
"com.actionbarsherlock.internal.widget.ActionBarView",
"com.actionbarsherlock.widget.ActivityChooserModel$HistoryPersister",
"android.renderscript.RenderScriptGL",
"android.widget.AdapterView$OnItemLongClickListener",
"com.actionbarsherlock.view.ActionProvider$SubUiVisibilityListener",
"com.actionbarsherlock.internal.view.menu.MenuBuilder$Callback",
"android.database.Cursor",
"android.widget.RadioGroup$OnCheckedChangeListener",
"android.app.ActionBar",
"android.graphics.SurfaceTexture",
"android.view.View$OnKeyListener",
"android.widget.CompoundButton",
"android.os.IInterface",
"android.database.DataSetObservable",
"android.graphics.Point",
"android.widget.AbsListView",
"android.gesture.Gesture",
"android.content.pm.ResolveInfo",
"android.view.View$DragShadowBuilder",
"android.gesture.GestureOverlayView$OnGesturingListener",
"com.actionbarsherlock.internal.view.menu.MenuWrapper",
"com.actionbarsherlock.app.ActionBar$OnMenuVisibilityListener",
"android.view.ContextMenu$ContextMenuInfo",
"android.widget.NumberPicker$Formatter",
"android.os.Bundle",
"com.actionbarsherlock.widget.ActivityChooserModel$HistoryLoader",
"android.database.AbstractCursor",
"android.view.TouchDelegate",
"android.widget.DatePicker",
"android.database.sqlite.SQLiteDatabase",
"android.widget.HorizontalScrollView",
"android.animation.LayoutTransition",
"android.view.View$OnSystemUiVisibilityChangeListener",
"android.os.Handler",
"android.view.inputmethod.ExtractedTextRequest",
"android.renderscript.RenderScriptGL$SurfaceConfig",
"com.actionbarsherlock.internal.view.ActionProviderWrapper",
"org.xmlpull.v1.XmlPullParser",
"android.database.CharArrayBuffer",
"com.actionbarsherlock.R",
"android.widget.NumberPicker$OnValueChangeListener",
"com.xtremelabs.robolectric.tester.android.view.TestMenuItem",
"android.text.TextUtils$TruncateAt",
"android.content.IntentFilter",
"com.actionbarsherlock.widget.ActivityChooserModel$OnChooseActivityListener",
"android.widget.NumberPicker$OnScrollListener",
"android.view.SubMenu",
"android.content.MutableContextWrapper",
"android.content.pm.PathPermission",
"android.view.InflateException",
"android.text.Layout",
"com.actionbarsherlock.internal.view.menu.MenuBuilder",
"com.actionbarsherlock.internal.app.ActionBarImpl",
"android.view.View$OnAttachStateChangeListener",
"android.widget.AbsListView$LayoutParams",
"android.media.MediaPlayer$OnCompletionListener",
"android.view.View$OnClickListener",
"android.content.pm.PackageManager$NameNotFoundException",
"com.actionbarsherlock.app.ActionBar$LayoutParams",
"com.actionbarsherlock.internal.view.menu.ActionMenuView$ActionMenuChildView",
"com.actionbarsherlock.internal.app.ActionBarImpl$TabImpl",
"android.widget.AbsListView$MultiChoiceModeListener",
"android.view.inputmethod.CorrectionInfo",
"android.view.InputDevice",
"android.view.MenuInflater",
"android.view.Menu",
"android.widget.AdapterView$OnItemClickListener",
"android.app.ActionBar$OnMenuVisibilityListener",
"android.content.ContextWrapper",
"android.content.res.Resources$Theme",
"android.app.ListActivity",
"android.widget.AdapterViewFlipper",
"android.text.style.URLSpan",
"android.widget.ExpandableListView$OnChildClickListener",
"com.actionbarsherlock.internal.widget.IcsAdapterView$OnItemSelectedListener",
"android.app.ActionBar$OnNavigationListener",
"android.app.ProgressDialog",
"com.actionbarsherlock.internal.view.menu.MenuPopupHelper",
"android.graphics.PorterDuff$Mode",
"android.view.Window$Callback",
"com.actionbarsherlock.view.ActionMode",
"android.widget.ViewAnimator",
"com.actionbarsherlock.internal.view.menu.SubMenuWrapper",
"android.view.animation.Transformation",
"android.util.Printer",
"org.xmlpull.mxp1.MXParser",
"android.view.View$OnCreateContextMenuListener",
"android.view.inputmethod.CompletionInfo",
"android.graphics.Rect",
"android.widget.LinearLayout",
"android.widget.DialerFilter",
"android.content.pm.PackageManager",
"android.view.WindowManager",
"android.content.pm.ProviderInfo",
"com.actionbarsherlock.view.MenuItem",
"android.widget.ExpandableListView$OnGroupExpandListener",
"android.app.DatePickerDialog",
"android.content.ContentResolver",
"com.actionbarsherlock.R$layout",
"android.content.pm.ActivityInfo",
"android.widget.Button",
"android.content.DialogInterface$OnDismissListener",
"android.widget.AdapterViewAnimator",
"android.graphics.RectF",
"android.widget.RemoteViews",
"com.actionbarsherlock.R$string",
"android.renderscript.RSTextureView",
"android.util.AndroidException",
"android.widget.TableLayout",
"android.view.InputEvent",
"com.xtremelabs.robolectric.res.ResourceExtractor",
"com.actionbarsherlock.internal.view.menu.SubMenuBuilder",
"android.util.DisplayMetrics",
"org.xmlpull.v1.XmlPullParserException",
"android.app.AliasActivity",
"android.content.DialogInterface$OnCancelListener",
"android.widget.GridLayout$Spec",
"android.content.Loader",
"android.widget.TabWidget",
"android.view.GestureDetector$OnGestureListener",
"android.content.ContentValues",
"android.view.Window",
"com.actionbarsherlock.internal.view.menu.MenuItemWrapper",
"com.actionbarsherlock.view.MenuItem$OnMenuItemClickListener",
"android.text.Spanned",
"android.widget.AbsListView$RecyclerListener",
"com.actionbarsherlock.internal.view.menu.MenuPresenter",
"android.os.Parcelable$Creator",
"android.view.MenuItem",
"android.graphics.Path$Direction",
"android.widget.FrameLayout$LayoutParams",
"android.view.WindowManager$LayoutParams",
"android.widget.TableRow$LayoutParams",
"android.widget.Gallery",
"android.view.LayoutInflater",
"android.app.FragmentBreadCrumbs",
"android.view.inputmethod.ExtractedText",
"com.actionbarsherlock.R$style",
"android.view.TextureView",
"com.actionbarsherlock.view.ActionMode$Callback",
"android.view.KeyCharacterMap",
"android.database.MatrixCursor",
"com.actionbarsherlock.widget.ActivityChooserModel$ActivityResolveInfo",
"android.app.Activity",
"android.support.v4.app.FragmentTransaction",
"android.view.ViewManager",
"android.content.res.Resources",
"android.view.View$OnDragListener",
"android.text.Editable$Factory",
"android.os.ParcelFileDescriptor",
"android.widget.ZoomControls",
"android.content.IntentSender$SendIntentException",
"android.widget.FrameLayout",
"android.widget.RadioButton",
"android.widget.ImageView",
"android.graphics.drawable.ColorDrawable",
"com.xtremelabs.robolectric.res.XmlLoader",
"android.text.method.TransformationMethod",
"com.actionbarsherlock.app.ActionBar$OnNavigationListener",
"android.graphics.drawable.Drawable$ConstantState",
"com.actionbarsherlock.internal.view.menu.ActionMenuPresenter$ActionButtonSubmenu",
"com.actionbarsherlock.internal.view.menu.ActionMenuPresenter$OverflowPopup",
"com.actionbarsherlock.widget.ActivityChooserView",
"com.xtremelabs.robolectric.res.AttrResourceLoader",
"android.appwidget.AppWidgetProvider",
"android.content.res.Resources$NotFoundException",
"com.actionbarsherlock.internal.view.menu.ActionMenuPresenter",
"android.view.KeyCharacterMap$KeyData",
"com.actionbarsherlock.internal.app.ActionBarImpl$ActionModeImpl",
"com.actionbarsherlock.internal.widget.IcsListPopupWindow",
"android.media.MediaPlayer$OnErrorListener",
"android.text.InputFilter",
"android.view.accessibility.AccessibilityEventSource",
"android.view.ViewParent",
"com.actionbarsherlock.widget.ActivityChooserModel$HistoricalRecord",
"com.actionbarsherlock.app.ActionBar$Tab",
"android.text.NoCopySpan",
"android.widget.MediaController",
"com.actionbarsherlock.widget.ActivityChooserModel",
"android.app.Dialog",
"android.widget.RadioGroup",
"android.text.Editable",
"com.actionbarsherlock.internal.widget.IcsSpinner",
"android.graphics.Movie",
"android.content.IntentSender",
"android.text.style.UpdateAppearance",
"android.appwidget.AppWidgetHostView",
"android.app.DialogFragment",
"android.widget.SpinnerAdapter",
"android.app.Fragment",
"android.view.KeyEvent$Callback",
"android.media.MediaPlayer$OnPreparedListener",
"android.content.OperationApplicationException",
"android.appwidget.AppWidgetManager",
"android.content.ComponentCallbacks2",
"android.util.SparseBooleanArray",
"com.actionbarsherlock.internal.view.menu.ActionMenuView$LayoutParams",
"android.content.res.Configuration",
"android.view.ViewGroup$MarginLayoutParams",
"com.actionbarsherlock.widget.ShareActionProvider$ShareMenuItemOnMenuItemClickListener",
"android.gesture.GestureOverlayView$OnGestureListener",
"android.widget.DatePicker$OnDateChangedListener",
"android.animation.ValueAnimator",
"com.xtremelabs.robolectric.tester.android.util.TestAttributeSet",
"android.app.PendingIntent",
"android.widget.TabHost$TabSpec",
"android.view.KeyEvent$DispatcherState",
"com.actionbarsherlock.internal.nineoldandroids.animation.Animator",
"android.gesture.GestureOverlayView$OnGesturePerformedListener",
"android.util.AttributeSet",
"com.actionbarsherlock.internal.view.menu.ActionMenuPresenter$OverflowMenuButton",
"com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout",
"com.actionbarsherlock.internal.nineoldandroids.animation.ObjectAnimator",
"android.view.View",
"android.content.ServiceConnection",
"com.actionbarsherlock.internal.nineoldandroids.animation.ValueAnimator",
"com.actionbarsherlock.widget.ActivityChooserModel$ActivitySorter",
"android.view.SurfaceHolder",
"android.view.MenuItem$OnMenuItemClickListener",
"android.os.Build$VERSION_CODES",
"android.content.DialogInterface$OnKeyListener",
"android.animation.ObjectAnimator",
"com.actionbarsherlock.internal.widget.AbsActionBarView",
"android.view.ViewGroup",
"android.database.ContentObserver",
"android.app.AlertDialog",
"android.util.SparseArray",
"android.os.MessageQueue",
"android.widget.AbsSpinner",
"android.widget.TextView",
"android.app.FragmentBreadCrumbs$OnBreadCrumbClickListener",
"com.actionbarsherlock.widget.ActivityChooserModel$DefaultSorter",
"android.widget.ListAdapter",
"android.view.ViewPropertyAnimator",
"android.database.Observable",
"android.content.pm.ApplicationInfo",
"android.widget.TextView$OnEditorActionListener",
"android.graphics.Typeface",
"android.view.accessibility.AccessibilityNodeInfo",
"android.view.KeyEvent",
"com.actionbarsherlock.internal.widget.IcsAdapterView",
"android.view.inputmethod.InputConnection",
"android.view.LayoutInflater$Factory",
"android.content.Intent",
"android.app.ExpandableListActivity",
"com.actionbarsherlock.internal.view.menu.MenuPresenter$Callback",
"com.xtremelabs.robolectric.tester.android.view.TestSubMenu",
"android.content.ClipData",
"android.view.MotionEvent",
"android.widget.VideoView",
"android.app.LoaderManager",
"android.content.DialogInterface",
"android.app.Fragment$SavedState",
"android.widget.ZoomButton",
"android.view.ViewStub",
"com.actionbarsherlock.widget.ActivityChooserView$ActivityChooserViewAdapter",
"android.widget.ImageView$ScaleType",
"com.xtremelabs.robolectric.tester.android.view.TestMenu",
"android.content.ContentProvider",
"com.actionbarsherlock.internal.widget.IcsLinearLayout",
"android.view.View$OnFocusChangeListener",
"android.database.sqlite.SQLiteClosable",
"android.widget.ExpandableListView",
"android.view.View$OnTouchListener",
"android.view.SurfaceHolder$Callback2"
);
}
private static void initMocksToAvoidTimeoutsInTheTests() throws ClassNotFoundException {
mock(Class.forName("com.actionbarsherlock.widget.ShareActionProvider$OnShareTargetSelectedListener", false, ShareActionProvider_ESTest_scaffolding.class.getClassLoader()));
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ShareActionProvider_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"com.actionbarsherlock.view.ActionProvider",
"com.actionbarsherlock.widget.ShareActionProvider",
"com.actionbarsherlock.widget.ShareActionProvider$ShareMenuItemOnMenuItemClickListener",
"com.actionbarsherlock.widget.ShareActionProvider$ShareAcitivityChooserModelPolicy",
"android.database.Observable",
"android.database.DataSetObservable",
"com.actionbarsherlock.widget.ActivityChooserModel$SerialExecutor",
"com.actionbarsherlock.widget.ActivityChooserModel",
"com.actionbarsherlock.R$attr",
"com.actionbarsherlock.R$string",
"android.content.ContentProvider",
"android.content.SearchRecentSuggestionsProvider",
"android.content.Context",
"android.content.ContextWrapper",
"android.app.Fragment",
"android.app.DialogFragment",
"android.view.ContextThemeWrapper",
"android.app.Activity",
"android.accounts.AccountAuthenticatorActivity",
"com.xtremelabs.robolectric.tester.android.view.TestMenu",
"com.xtremelabs.robolectric.tester.android.view.TestSubMenu",
"com.xtremelabs.robolectric.tester.android.view.TestMenuItem",
"com.actionbarsherlock.internal.view.menu.MenuWrapper",
"com.actionbarsherlock.internal.view.menu.SubMenuWrapper",
"android.view.View",
"android.view.ViewGroup",
"android.widget.FrameLayout",
"android.widget.HorizontalScrollView",
"com.actionbarsherlock.internal.nineoldandroids.widget.NineHorizontalScrollView",
"android.view.animation.DecelerateInterpolator",
"com.actionbarsherlock.internal.widget.ScrollingTabContainerView",
"android.app.NativeActivity",
"android.app.AliasActivity",
"android.app.ListActivity",
"com.xtremelabs.robolectric.tester.android.util.TestAttributeSet",
"android.widget.LinearLayout",
"com.actionbarsherlock.internal.view.menu.ListMenuItemView",
"android.app.ExpandableListActivity",
"android.widget.BaseAdapter",
"android.widget.ArrayAdapter",
"android.os.Build$VERSION",
"com.actionbarsherlock.internal.view.menu.BaseMenuPresenter",
"com.actionbarsherlock.internal.view.menu.ActionMenuPresenter",
"com.actionbarsherlock.R$layout",
"android.view.LayoutInflater",
"android.content.Intent",
"android.app.Dialog",
"android.app.AlertDialog",
"android.app.TimePickerDialog",
"com.xtremelabs.robolectric.res.ResourceExtractor",
"com.xtremelabs.robolectric.res.XmlLoader",
"com.xtremelabs.robolectric.res.AttrResourceLoader",
"android.view.TextureView",
"android.renderscript.RSTextureView",
"android.graphics.drawable.Drawable",
"com.actionbarsherlock.app.ActionBar",
"com.actionbarsherlock.internal.app.ActionBarWrapper",
"android.content.Loader",
"android.content.MutableContextWrapper",
"com.actionbarsherlock.internal.view.menu.ActionMenuItem",
"android.app.DatePickerDialog",
"com.actionbarsherlock.internal.view.menu.ActionMenuItemView",
"com.actionbarsherlock.internal.view.menu.MenuBuilder",
"android.os.Message",
"android.view.inputmethod.EditorInfo",
"android.content.pm.PackageItemInfo",
"android.content.pm.ApplicationInfo",
"android.content.BroadcastReceiver",
"android.appwidget.AppWidgetProvider",
"android.os.Looper",
"org.xmlpull.mxp1.MXParser",
"android.database.AbstractCursor",
"android.database.MatrixCursor",
"com.actionbarsherlock.internal.nineoldandroids.widget.NineFrameLayout",
"com.actionbarsherlock.internal.widget.ActionBarContainer",
"com.actionbarsherlock.internal.view.menu.MenuItemWrapper",
"android.content.res.Configuration",
"android.widget.TableLayout",
"android.widget.AdapterView",
"android.widget.AbsListView",
"android.widget.ListView",
"android.widget.AdapterViewAnimator",
"android.widget.AdapterViewFlipper",
"android.app.ProgressDialog",
"android.widget.RadioGroup",
"android.widget.NumberPicker",
"android.widget.ImageView",
"android.widget.ImageButton",
"android.widget.ZoomButton",
"android.widget.CalendarView",
"android.net.Uri",
"android.widget.MediaController",
"android.widget.RelativeLayout",
"android.widget.TwoLineListItem",
"android.widget.TabHost",
"android.widget.TextView",
"android.view.ViewStub",
"android.widget.AbsSpinner",
"android.widget.Gallery",
"android.widget.ZoomControls",
"android.app.FragmentBreadCrumbs",
"android.widget.TableRow",
"android.gesture.GestureOverlayView",
"android.os.Parcel",
"android.view.SurfaceView",
"android.widget.VideoView",
"android.renderscript.RenderScriptGL$SurfaceConfig",
"com.actionbarsherlock.internal.app.ActionBarImpl",
"android.os.Handler",
"android.widget.GridLayout",
"android.graphics.Path",
"android.view.InputEvent",
"android.view.KeyEvent",
"android.appwidget.AppWidgetHostView",
"android.widget.ViewAnimator",
"android.widget.ViewSwitcher",
"android.widget.TextSwitcher",
"android.text.SpannableStringInternal",
"android.text.SpannableString",
"android.widget.TabWidget",
"android.content.ComponentName",
"android.widget.DialerFilter",
"android.content.res.Resources",
"android.graphics.drawable.ColorDrawable",
"android.widget.DatePicker",
"android.widget.ExpandableListView"
);
}
}
| [
"jose.thiago.silva@ccc.ufcg.edu.br"
] | jose.thiago.silva@ccc.ufcg.edu.br |
66817094494223c40668dd11362cef71d2e0d92d | 16b5d51ab0409cbb5a1da9eacb9948a54acd6258 | /app/src/main/java/com/haoche51/checker/util/HCActionUtil.java | 37344b5f3bd54b542addf8f3eaafa4707079cf9c | [] | no_license | liyq1406/haochebang | c3405a537d4f695ca51cb26d7889e952c6965eea | 12727fcca80c85aa9586bd58fe9b16c98fa1bf5b | refs/heads/master | 2021-01-17T21:20:31.261785 | 2017-02-28T04:52:06 | 2017-02-28T04:52:06 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,981 | java | package com.haoche51.checker.util;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import com.haoche51.checker.entity.Serializable.SerializableMap;
import java.io.Serializable;
import java.util.Iterator;
import java.util.Map;
public class HCActionUtil {
public static void startActivity(Context context, Class<?> activity,Map<String,Object> map) {
Intent intent = new Intent(context,activity);
SerializableMap tmpmap=new SerializableMap();
tmpmap.setMap(map);
Bundle bundle = new Bundle();
bundle.putSerializable("params", tmpmap);
intent.putExtras(bundle);
context.startActivity(intent);
}
/**
* 打开activity
*/
public static void launchActivity(Context context, Class<?> activity, Map<String, Object> extraMap) {
if (context != null) {
Intent intent = new Intent(context, activity);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (extraMap != null) {
Iterator<String> iterator = extraMap.keySet().iterator();
while (iterator.hasNext()) {
String key = iterator.next();
Object object = extraMap.get(key);
if (object instanceof String) {
intent.putExtra(key, (String) object);
} else if (object instanceof Boolean) {
intent.putExtra(key, (Boolean) object);
} else if (object instanceof Float) {
intent.putExtra(key, Float.parseFloat(object.toString()));
} else if (object instanceof Integer) {
intent.putExtra(key, Integer.parseInt(object.toString()));
} else if (object instanceof Long) {
intent.putExtra(key, Long.parseLong(object.toString()));
} else if (object instanceof Serializable) {
intent.putExtra(key, (Serializable) object);
} else {
intent.putExtra(key, object.toString());
}
}
}
context.startActivity(intent);
}
}
}
| [
"pengxianglin@haoche51.com"
] | pengxianglin@haoche51.com |
bd4b8a0ebd8fa334a2ad6d349ea77d50b312de3a | 2a8697a6ec0bdbf98ccc9a37da0bef8750ab7e49 | /src/gateway/controllers/MultimediaController.java | 582307c10fe1cbdb97c91abe52afcc2494533d7c | [] | no_license | Oshanwick/Student-Management-System | 8927908fff1b058d29f32fa1ee3ffb0c1ae56494 | 2a59d8f2e43414799fad605f354d2c30ff7e7fe6 | refs/heads/master | 2021-01-26T04:39:32.879920 | 2018-03-06T11:12:43 | 2018-03-06T11:12:43 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,353 | 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 gateway.controllers;
import gateway.dbconnection.DBConnection;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
/**
*
* @author DELL
*/
public class MultimediaController {
public static ArrayList<String[]> getMultimedia() throws SQLException, ClassNotFoundException{
String sql="select PackageDesc from package";
Connection connection=DBConnection.getDBConnection().getConnection();
Statement stm=connection.createStatement();
ResultSet rst=stm.executeQuery(sql);
ArrayList<String[]> rows=new ArrayList<>();
while(rst.next()){
String[] row={rst.getString(1)};
rows.add(row);
}
return rows;
}
public static String getMultimediaId(String packageDesc) throws SQLException, ClassNotFoundException{
String sql="select MultimediaID from multimediapackages where PackageDesc='"+packageDesc+"'";
Connection connection =DBConnection.getDBConnection().getConnection();
Statement stm=connection.createStatement();
ResultSet rst= stm.executeQuery(sql);
rst.next();
String multimediaID=rst.getString("MultimediaID");
return multimediaID;
}
public static ArrayList<String[]> getMultimediaDescription() throws SQLException, ClassNotFoundException{
String sql="select PackageID ,package name Multimediafascility from Multimedia,multimediaFascility ,package where.... ";
//methana queryata ganna one package table eken packageID,package Table eken PackageDesc ekai, mutimedia tabl eken multimedia facility ekai ganna widiyata
Connection connection=DBConnection.getDBConnection().getConnection();
Statement stm=connection.createStatement();
ResultSet rst=stm.executeQuery(sql);
ArrayList<String[]> rows=new ArrayList<>();
while(rst.next()){
String[] row={rst.getString(0),rst.getString(1),rst.getString(2)};
rows.add(row);
}
return rows;
}
}
| [
"peshalarandima@gmail.com"
] | peshalarandima@gmail.com |
d79a3d3ec260c591dbc554e2a09195c362e0e9f4 | 3e176296759f1f211f7a8bcfbba165abb1a4d3f1 | /gosu-core/src/main/java/gw/internal/gosu/ir/compiler/bytecode/expression/IRBooleanLiteralCompiler.java | a7d89597a64a0f6612a25b526a0c728ee9797885 | [
"Apache-2.0",
"BSD-3-Clause",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | gosu-lang/old-gosu-repo | 6335ac90cd0c635fdec6360e3e208ba12ac0a39e | 48c598458abd412aa9f2d21b8088120e8aa9de00 | refs/heads/master | 2020-05-18T03:39:34.631550 | 2014-04-21T17:36:38 | 2014-04-21T17:36:38 | 1,303,622 | 1 | 2 | null | null | null | null | UTF-8 | Java | false | false | 606 | java | /*
* Copyright 2013 Guidewire Software, Inc.
*/
package gw.internal.gosu.ir.compiler.bytecode.expression;
import gw.internal.gosu.ir.compiler.bytecode.AbstractBytecodeCompiler;
import gw.internal.gosu.ir.compiler.bytecode.IRBytecodeContext;
import gw.lang.ir.expression.IRBooleanLiteral;
import gw.internal.ext.org.objectweb.asm.Opcodes;
public class IRBooleanLiteralCompiler extends AbstractBytecodeCompiler {
public static void compile( IRBooleanLiteral expression, IRBytecodeContext context ) {
context.getMv().visitInsn( expression.getValue() ? Opcodes.ICONST_1 : Opcodes.ICONST_0 );
}
}
| [
"smckinney@guidewire.com"
] | smckinney@guidewire.com |
f328ff6d59a480257dbcc32b0558c683728ff5b0 | 323d70c048bb00a3f17270816fe11eedfabdc8e9 | /app/src/main/java/com/example/kevin/androidproject/ExpandableListAdapter.java | 681252869378dcf2ac373674000391f6b6ef563b | [] | no_license | Rodtsl/AndroidProject | 406d53c18a41e48336b50f402386deec724699f9 | a12815c6199f6885d3235c4caa102791d6c27c27 | refs/heads/master | 2021-01-11T16:04:45.978654 | 2017-04-01T14:38:26 | 2017-04-01T14:38:26 | 80,000,390 | 0 | 1 | null | 2017-02-16T11:34:39 | 2017-01-25T09:31:45 | Java | UTF-8 | Java | false | false | 3,416 | java | package com.example.kevin.androidproject;
/**
* Created by leopold.rodts on 08/02/2017.
*/
import android.content.Context;
import android.graphics.Typeface;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.TextView;
import java.util.HashMap;
import java.util.List;
public class ExpandableListAdapter extends BaseExpandableListAdapter {
private Context _context;
private List<String> _listDataHeader; // header titles
// child data in format of header title, child title
private HashMap<String, List<String>> _listDataChild;
public ExpandableListAdapter(Context context, List<String> listDataHeader,
HashMap<String, List<String>> listChildData) {
this._context = context;
this._listDataHeader = listDataHeader;
this._listDataChild = listChildData;
}
@Override
public Object getChild(int groupPosition, int childPosititon) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
.get(childPosititon);
}
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
@Override
public View getChildView(int groupPosition, final int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
final String childText = (String) getChild(groupPosition, childPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.list_item, null);
}
TextView txtListChild = (TextView) convertView
.findViewById(R.id.lblListItem);
txtListChild.setText(childText);
return convertView;
}
@Override
public int getChildrenCount(int groupPosition) {
return this._listDataChild.get(this._listDataHeader.get(groupPosition))
.size();
}
@Override
public Object getGroup(int groupPosition) {
return this._listDataHeader.get(groupPosition);
}
@Override
public int getGroupCount() {
return this._listDataHeader.size();
}
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
String headerTitle = (String) getGroup(groupPosition);
if (convertView == null) {
LayoutInflater infalInflater = (LayoutInflater) this._context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = infalInflater.inflate(R.layout.list_group, null);
}
TextView lblListHeader = (TextView) convertView
.findViewById(R.id.lblListHeader);
lblListHeader.setTypeface(null, Typeface.BOLD);
lblListHeader.setText(headerTitle);
return convertView;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
} | [
"kevin-cornu@hotmail.fr"
] | kevin-cornu@hotmail.fr |
dfefaf8e8db86831be1f7d0fff03e957cd569f0e | 06b3367e38037e3922d1c9f1444a468ea7fd1751 | /spring-cloud-config/config-client/src/main/java/com/liuxz/config/ConfigClientApplication.java | 0afd841c60118c3639a0333ce6da54f94707c86f | [] | no_license | KerenAce/springcloud | 6d41d8fbd1dcc6070c2fbfe4b57e5ad2a27110e6 | ad76096cfcca4b627ba418cf81c55ee72c0b46eb | refs/heads/master | 2023-03-16T17:53:10.962649 | 2020-08-24T02:11:13 | 2020-08-24T02:11:13 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 331 | java | package com.liuxz.config;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ConfigClientApplication {
public static void main(String[] args) {
SpringApplication.run(ConfigClientApplication.class, args);
}
}
| [
"1510822551@qq.com"
] | 1510822551@qq.com |
27ba1ca27e926b46b581654a07a54d747c872fec | f6edb997b5df3e3516992002c071fd6b77a47248 | /app/src/main/java/com/sifa/muslimstore/DoaHarian.java | 20dbd9adcf61b0370707349433cfab3792b957da | [] | no_license | Sifafat/MuslimStore19 | 4665bb0de0743595a1e2b6c369e510ea434cd749 | 00a8f028f15d80447f995ab7bf1a35c2da829ea6 | refs/heads/master | 2020-07-08T23:34:53.275622 | 2019-08-22T14:29:24 | 2019-08-22T14:29:24 | 203,811,955 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,572 | java | package com.sifa.muslimstore;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
public class DoaHarian extends AppCompatActivity {
private String [] doa = {"Doa Sebelum Makan","Doa Sesudah Makan","Doa Sebelum Tidur","Doa Turun Hujan","Doa Berpergian"};
private ArrayList<String> data;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_doa_harian);
ListView listView = findViewById(R.id.Listitem);
data = new ArrayList<>();
getData();
ArrayAdapter<String> adapter = new ArrayAdapter<>
(this, R.layout.support_simple_spinner_dropdown_item, data);
listView.setAdapter(adapter);
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> adapterView, View view, int position, long id){
String getName = data.get(position);
Intent sendData = new Intent(DoaHarian.this, DataDoa.class);
sendData.putExtra("MyName", getName);
startActivity(sendData);
}
});
}
private void getData(){
Collections.addAll(data, doa);
} {
}
}
| [
"sifabae95@gmail.com"
] | sifabae95@gmail.com |
6de861ecb03751643d4a1432f5a2b94dd4576288 | 88d1e3895650a40def90304b634d0f80db826ba6 | /src/main/java/fr/wati/yacramanager/utils/JqgridFilter.java | af0e362e8eaa3b4b35b99d375d6e506920881168 | [] | no_license | newbare/yacramanager | 7ccc2403c65fddee747024d961bfbc885e0b97e6 | deac24d33e71d9af51c89723832deb28f7b3db44 | refs/heads/master | 2020-12-01T01:03:08.660518 | 2015-08-21T15:26:39 | 2015-08-21T15:26:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,736 | java | package fr.wati.yacramanager.utils;
import java.util.ArrayList;
/**
* A POJO that represents a jQgrid JSON requests {@link String}<br/>
* A sample filter follows the following format:
* <pre>
* {"groupOp":"AND","rules":[{"field":"firstName","op":"eq","data":"John"}]}
* </pre>
*/
public class JqgridFilter {
private String source;
private String groupOp;
private ArrayList<Rule> rules;
public JqgridFilter() {
super();
}
public JqgridFilter(String source) {
super();
this.source = source;
}
public String getSource() {
return source;
}
public void setSource(String source) {
this.source = source;
}
public String getGroupOp() {
return groupOp;
}
public void setGroupOp(String groupOp) {
this.groupOp = groupOp;
}
public ArrayList<Rule> getRules() {
return rules;
}
public void setRules(ArrayList<Rule> rules) {
this.rules = rules;
}
/**
* Inner class containing field rules
*/
public static class Rule {
private String junction;
private String field;
private String op;
private String data;
public Rule() {}
public Rule(String junction, String field, String op, String data) {
super();
this.junction = junction;
this.field = field;
this.op = op;
this.data = data;
}
public String getJunction() {
return junction;
}
public void setJunction(String junction) {
this.junction = junction;
}
public String getField() {
return field;
}
public void setField(String field) {
this.field = field;
}
public String getOp() {
return op;
}
public void setOp(String op) {
this.op = op;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}
}
| [
"rachid.outtara-ext@natixis.com"
] | rachid.outtara-ext@natixis.com |
b061097226b5248e64bff39c8638bb9b59ac2e99 | eac0b43bd7bf55f9c59c6867cc52706f5a8b9c1c | /eshop-v3/eshop-wms/src/main/java/com/zhss/eshop/wms/mapper/PurchaseInputOrderPutOnItemMapper.java | ac17bc787146e8e5b3b923a8534cb555c02cc424 | [] | no_license | fengqing90/Learn | b017fa9d40cb0592ee63f77f620a8a8f39f046b9 | 396f48eddb5b78a4fdb880d46ea1f2b109b707e4 | refs/heads/master | 2022-11-22T01:44:05.803929 | 2021-08-04T03:57:26 | 2021-08-04T03:57:26 | 144,801,377 | 0 | 3 | null | 2022-11-16T06:59:58 | 2018-08-15T03:29:15 | Java | UTF-8 | Java | false | false | 2,341 | java | package com.zhss.eshop.wms.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import com.zhss.eshop.wms.domain.PurchaseInputOrderPutOnItemDO;
/**
* 采购入库单上架条目管理mapper组件
* @author zhonghuashishan
*
*/
@Mapper
public interface PurchaseInputOrderPutOnItemMapper {
/**
* 新增采购入库单上架条目
* @param putOnItem 上架条目
*/
@Insert("INSERT INTO wms_purchase_input_order_put_on_item("
+ "purchase_input_order_item_id,"
+ "goods_allocation_id,"
+ "goods_sku_id,"
+ "put_on_shelves_count,"
+ "gmt_create,"
+ "gmt_modified"
+ ") VALUES("
+ "#{purchaseInputOrderItemId},"
+ "#{goodsAllocationId},"
+ "#{goodsSkuId},"
+ "#{putOnShelvesCount},"
+ "#{gmtCreate},"
+ "#{gmtModified}"
+ ")")
@Options(keyColumn = "id", keyProperty = "id", useGeneratedKeys = true)
void save(PurchaseInputOrderPutOnItemDO putOnItem);
/**
* 根据采购入库单条目id查询采购入库单上架条目
* @param purchaseInputOrderItemId 采购入库单id
* @return 采购入库单上架条目
*/
@Select("SELECT "
+ "id,"
+ "purchase_input_order_item_id,"
+ "goods_allocation_id,"
+ "goods_sku_id,"
+ "put_on_shelves_count,"
+ "gmt_create,"
+ "gmt_modified "
+ "FROM wms_purchase_input_order_put_on_item "
+ "WHERE purchase_input_order_item_id=#{purchaseInputOrderItemId}")
@Results({
@Result(column = "id", property = "id", id = true),
@Result(column = "purchase_input_order_item_id", property = "purchaseInputOrderItemId"),
@Result(column = "goods_allocation_id", property = "goodsAllocationId"),
@Result(column = "goods_sku_id", property = "goodsSkuId"),
@Result(column = "put_on_shelves_count", property = "putOnShelvesCount"),
@Result(column = "gmt_create", property = "gmtCreate"),
@Result(column = "gmt_modified", property = "gmtModified")
})
List<PurchaseInputOrderPutOnItemDO> listByPurchaseInputOrderItemId(
@Param("purchaseInputOrderItemId") Long purchaseInputOrderItemId);
}
| [
"fengqing@youxin.com"
] | fengqing@youxin.com |
81e15c7a1d405fc716fcf62631ff14cf223c6c9d | ba72e405062510a1efc950c4565d9b99c5163009 | /src/Practice/Chuong4/GreatestCommonDivisor.java | 515251592c05924b932ed0fde4e4c07c09b47e4c | [] | no_license | Minhnhat21/JavaCoBan | 1819cb4bf7abb2973aa3409b0a6f29defcaf4fb6 | 15ee67fa90ef6e482bc7e68fa2d27da75c96605c | refs/heads/master | 2023-08-21T02:11:53.918169 | 2021-11-03T09:39:41 | 2021-11-03T09:39:41 | 402,272,956 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 791 | 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 Practice.Chuong4;
/**
*
* @author nguye
*/
import java.util.Scanner;
public class GreatestCommonDivisor {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter two positive number: ");
int num1 = sc.nextInt();
int num2 = sc.nextInt();
int gcd;
while(num1 != num2) {
if(num1 > num2) {
num1 -= num2;
} else {
num2 -= num1;
}
}
gcd = num1;
System.out.println("Greatest common divisor is " + gcd);
}
}
| [
"nguyenhuuminhnhatasus@gmail.com"
] | nguyenhuuminhnhatasus@gmail.com |
639eff218bebcdbc14116e65ee6520b29e91760d | f42d7da85f9633cfb84371ae67f6d3469f80fdcb | /com4j-20120426-2/samples/speech/build/src/speech/types/ISpeechVoice.java | 3fda86ef10450c2e2826cb7b42a7a55f3a038a51 | [
"BSD-2-Clause"
] | permissive | LoongYou/Wanda | ca89ac03cc179cf761f1286172d36ead41f036b5 | 2c2c4d1d14e95e98c0a3af365495ec53775cc36b | refs/heads/master | 2023-03-14T13:14:38.476457 | 2021-03-06T10:20:37 | 2021-03-06T10:20:37 | 231,610,760 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 11,454 | java | package speech.types ;
import com4j.*;
/**
* ISpeechVoice Interface
*/
@IID("{269316D8-57BD-11D2-9EEE-00C04F797396}")
public interface ISpeechVoice extends Com4jObject {
// Methods:
/**
* <p>
* Status
* </p>
* <p>
* Getter method for the COM property "Status"
* </p>
* @return Returns a value of type speech.types.ISpeechVoiceStatus
*/
@DISPID(1) //= 0x1. The runtime will prefer the VTID if present
@VTID(7)
speech.types.ISpeechVoiceStatus status();
/**
* <p>
* Voice
* </p>
* <p>
* Getter method for the COM property "Voice"
* </p>
* @return Returns a value of type speech.types.ISpeechObjectToken
*/
@DISPID(2) //= 0x2. The runtime will prefer the VTID if present
@VTID(8)
speech.types.ISpeechObjectToken voice();
/**
* <p>
* Voice
* </p>
* <p>
* Setter method for the COM property "Voice"
* </p>
* @param voice Mandatory speech.types.ISpeechObjectToken parameter.
*/
@DISPID(2) //= 0x2. The runtime will prefer the VTID if present
@VTID(9)
void voice(
speech.types.ISpeechObjectToken voice);
/**
* <p>
* Gets the audio output object
* </p>
* <p>
* Getter method for the COM property "AudioOutput"
* </p>
* @return Returns a value of type speech.types.ISpeechObjectToken
*/
@DISPID(3) //= 0x3. The runtime will prefer the VTID if present
@VTID(10)
speech.types.ISpeechObjectToken audioOutput();
/**
* <p>
* Gets the audio output object
* </p>
* <p>
* Setter method for the COM property "AudioOutput"
* </p>
* @param audioOutput Mandatory speech.types.ISpeechObjectToken parameter.
*/
@DISPID(3) //= 0x3. The runtime will prefer the VTID if present
@VTID(11)
void audioOutput(
speech.types.ISpeechObjectToken audioOutput);
/**
* <p>
* Gets the audio output stream
* </p>
* <p>
* Getter method for the COM property "AudioOutputStream"
* </p>
* @return Returns a value of type speech.types.ISpeechBaseStream
*/
@DISPID(4) //= 0x4. The runtime will prefer the VTID if present
@VTID(12)
speech.types.ISpeechBaseStream audioOutputStream();
/**
* <p>
* Gets the audio output stream
* </p>
* <p>
* Setter method for the COM property "AudioOutputStream"
* </p>
* @param audioOutputStream Mandatory speech.types.ISpeechBaseStream parameter.
*/
@DISPID(4) //= 0x4. The runtime will prefer the VTID if present
@VTID(13)
void audioOutputStream(
speech.types.ISpeechBaseStream audioOutputStream);
/**
* <p>
* Rate
* </p>
* <p>
* Getter method for the COM property "Rate"
* </p>
* @return Returns a value of type int
*/
@DISPID(5) //= 0x5. The runtime will prefer the VTID if present
@VTID(14)
int rate();
/**
* <p>
* Rate
* </p>
* <p>
* Setter method for the COM property "Rate"
* </p>
* @param rate Mandatory int parameter.
*/
@DISPID(5) //= 0x5. The runtime will prefer the VTID if present
@VTID(15)
void rate(
int rate);
/**
* <p>
* Volume
* </p>
* <p>
* Getter method for the COM property "Volume"
* </p>
* @return Returns a value of type int
*/
@DISPID(6) //= 0x6. The runtime will prefer the VTID if present
@VTID(16)
int volume();
/**
* <p>
* Volume
* </p>
* <p>
* Setter method for the COM property "Volume"
* </p>
* @param volume Mandatory int parameter.
*/
@DISPID(6) //= 0x6. The runtime will prefer the VTID if present
@VTID(17)
void volume(
int volume);
/**
* <p>
* AllowAudioOutputFormatChangesOnNextSet
* </p>
* <p>
* Setter method for the COM property "AllowAudioOutputFormatChangesOnNextSet"
* </p>
* @param allow Mandatory boolean parameter.
*/
@DISPID(7) //= 0x7. The runtime will prefer the VTID if present
@VTID(18)
void allowAudioOutputFormatChangesOnNextSet(
boolean allow);
/**
* <p>
* AllowAudioOutputFormatChangesOnNextSet
* </p>
* <p>
* Getter method for the COM property "AllowAudioOutputFormatChangesOnNextSet"
* </p>
* @return Returns a value of type boolean
*/
@DISPID(7) //= 0x7. The runtime will prefer the VTID if present
@VTID(19)
boolean allowAudioOutputFormatChangesOnNextSet();
/**
* <p>
* EventInterests
* </p>
* <p>
* Getter method for the COM property "EventInterests"
* </p>
* @return Returns a value of type speech.types.SpeechVoiceEvents
*/
@DISPID(8) //= 0x8. The runtime will prefer the VTID if present
@VTID(20)
speech.types.SpeechVoiceEvents eventInterests();
/**
* <p>
* EventInterests
* </p>
* <p>
* Setter method for the COM property "EventInterests"
* </p>
* @param eventInterestFlags Mandatory speech.types.SpeechVoiceEvents parameter.
*/
@DISPID(8) //= 0x8. The runtime will prefer the VTID if present
@VTID(21)
void eventInterests(
speech.types.SpeechVoiceEvents eventInterestFlags);
/**
* <p>
* Priority
* </p>
* <p>
* Setter method for the COM property "Priority"
* </p>
* @param priority Mandatory speech.types.SpeechVoicePriority parameter.
*/
@DISPID(9) //= 0x9. The runtime will prefer the VTID if present
@VTID(22)
void priority(
speech.types.SpeechVoicePriority priority);
/**
* <p>
* Priority
* </p>
* <p>
* Getter method for the COM property "Priority"
* </p>
* @return Returns a value of type speech.types.SpeechVoicePriority
*/
@DISPID(9) //= 0x9. The runtime will prefer the VTID if present
@VTID(23)
speech.types.SpeechVoicePriority priority();
/**
* <p>
* AlertBoundary
* </p>
* <p>
* Setter method for the COM property "AlertBoundary"
* </p>
* @param boundary Mandatory speech.types.SpeechVoiceEvents parameter.
*/
@DISPID(10) //= 0xa. The runtime will prefer the VTID if present
@VTID(24)
void alertBoundary(
speech.types.SpeechVoiceEvents boundary);
/**
* <p>
* AlertBoundary
* </p>
* <p>
* Getter method for the COM property "AlertBoundary"
* </p>
* @return Returns a value of type speech.types.SpeechVoiceEvents
*/
@DISPID(10) //= 0xa. The runtime will prefer the VTID if present
@VTID(25)
speech.types.SpeechVoiceEvents alertBoundary();
/**
* <p>
* SyncSpeakTimeout
* </p>
* <p>
* Setter method for the COM property "SynchronousSpeakTimeout"
* </p>
* @param msTimeout Mandatory int parameter.
*/
@DISPID(11) //= 0xb. The runtime will prefer the VTID if present
@VTID(26)
void synchronousSpeakTimeout(
int msTimeout);
/**
* <p>
* SyncSpeakTimeout
* </p>
* <p>
* Getter method for the COM property "SynchronousSpeakTimeout"
* </p>
* @return Returns a value of type int
*/
@DISPID(11) //= 0xb. The runtime will prefer the VTID if present
@VTID(27)
int synchronousSpeakTimeout();
/**
* <p>
* Speak
* </p>
* @param text Mandatory java.lang.String parameter.
* @param flags Optional parameter. Default value is 0
* @return Returns a value of type int
*/
@DISPID(12) //= 0xc. The runtime will prefer the VTID if present
@VTID(28)
int speak(
java.lang.String text,
@Optional @DefaultValue("0") speech.types.SpeechVoiceSpeakFlags flags);
/**
* <p>
* SpeakStream
* </p>
* @param stream Mandatory speech.types.ISpeechBaseStream parameter.
* @param flags Optional parameter. Default value is 0
* @return Returns a value of type int
*/
@DISPID(13) //= 0xd. The runtime will prefer the VTID if present
@VTID(29)
int speakStream(
speech.types.ISpeechBaseStream stream,
@Optional @DefaultValue("0") speech.types.SpeechVoiceSpeakFlags flags);
/**
* <p>
* Pauses the voices rendering.
* </p>
*/
@DISPID(14) //= 0xe. The runtime will prefer the VTID if present
@VTID(30)
void pause();
/**
* <p>
* Resumes the voices rendering.
* </p>
*/
@DISPID(15) //= 0xf. The runtime will prefer the VTID if present
@VTID(31)
void resume();
/**
* <p>
* Skips rendering the specified number of items.
* </p>
* @param type Mandatory java.lang.String parameter.
* @param numItems Mandatory int parameter.
* @return Returns a value of type int
*/
@DISPID(16) //= 0x10. The runtime will prefer the VTID if present
@VTID(32)
int skip(
java.lang.String type,
int numItems);
/**
* <p>
* GetVoices
* </p>
* @param requiredAttributes Optional parameter. Default value is ""
* @param optionalAttributes Optional parameter. Default value is ""
* @return Returns a value of type speech.types.ISpeechObjectTokens
*/
@DISPID(17) //= 0x11. The runtime will prefer the VTID if present
@VTID(33)
speech.types.ISpeechObjectTokens getVoices(
@Optional @DefaultValue("") java.lang.String requiredAttributes,
@Optional @DefaultValue("") java.lang.String optionalAttributes);
/**
* <p>
* GetAudioOutputs
* </p>
* @param requiredAttributes Optional parameter. Default value is ""
* @param optionalAttributes Optional parameter. Default value is ""
* @return Returns a value of type speech.types.ISpeechObjectTokens
*/
@DISPID(18) //= 0x12. The runtime will prefer the VTID if present
@VTID(34)
speech.types.ISpeechObjectTokens getAudioOutputs(
@Optional @DefaultValue("") java.lang.String requiredAttributes,
@Optional @DefaultValue("") java.lang.String optionalAttributes);
/**
* <p>
* WaitUntilDone
* </p>
* @param msTimeout Mandatory int parameter.
* @return Returns a value of type boolean
*/
@DISPID(19) //= 0x13. The runtime will prefer the VTID if present
@VTID(35)
boolean waitUntilDone(
int msTimeout);
/**
* <p>
* SpeakCompleteEvent
* </p>
* @return Returns a value of type int
*/
@DISPID(20) //= 0x14. The runtime will prefer the VTID if present
@VTID(36)
int speakCompleteEvent();
/**
* <p>
* IsUISupported
* </p>
* @param typeOfUI Mandatory java.lang.String parameter.
* @param extraData Optional parameter. Default value is ""
* @return Returns a value of type boolean
*/
@DISPID(21) //= 0x15. The runtime will prefer the VTID if present
@VTID(37)
boolean isUISupported(
java.lang.String typeOfUI,
@Optional @DefaultValue("") java.lang.Object extraData);
/**
* <p>
* DisplayUI
* </p>
* @param hWndParent Mandatory int parameter.
* @param title Mandatory java.lang.String parameter.
* @param typeOfUI Mandatory java.lang.String parameter.
* @param extraData Optional parameter. Default value is ""
*/
@DISPID(22) //= 0x16. The runtime will prefer the VTID if present
@VTID(38)
void displayUI(
int hWndParent,
java.lang.String title,
java.lang.String typeOfUI,
@Optional @DefaultValue("") java.lang.Object extraData);
// Properties:
}
| [
"815234949@qq.com"
] | 815234949@qq.com |
4b4720729aa964eac3bf19d339fb7d4b45d0339e | 5142a8986e7a80420357a7f1b1bbfdf94ad02767 | /hybris-commerce-suite-5.5.1.2/hybris/bin/ext-addon/assistedservicestorefront/acceleratoraddon/web/src/de/hybris/platform/assistedservicestorefront/security/impl/AssistedServiceAgentLoginStrategy.java | 5b83e1e9b29d06d0e7fecff4a04f47a93a96a6f3 | [] | no_license | gerardoram/research1 | 613ef2143ba60a440bb577362bcf1ce2a646664b | 2a4515e3f8901f0b3b510653d61dac059c6521a8 | refs/heads/master | 2020-05-20T17:04:39.574621 | 2015-06-23T17:53:26 | 2015-06-23T17:53:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,523 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2000-2015 hybris AG
* All rights reserved.
*
* This software is the confidential and proprietary information of hybris
* ("Confidential Information"). 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 hybris.
*
*
*/
package de.hybris.platform.assistedservicestorefront.security.impl;
import de.hybris.platform.acceleratorstorefrontcommons.security.AutoLoginStrategy;
import de.hybris.platform.acceleratorstorefrontcommons.security.GUIDCookieStrategy;
import de.hybris.platform.commercefacades.customer.CustomerFacade;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Required;
import org.springframework.security.authentication.AuthenticationManager;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.security.web.authentication.WebAuthenticationDetails;
/**
* Implementation of {@link AutoLoginStrategy} for assisted service agent.
*/
public class AssistedServiceAgentLoginStrategy implements AutoLoginStrategy
{
private static final Logger LOG = Logger.getLogger(AssistedServiceAgentLoginStrategy.class);
private AuthenticationManager authenticationManager;
private CustomerFacade customerFacade;
private GUIDCookieStrategy guidCookieStrategy;
@Override
public void login(final String username, final String password, final HttpServletRequest request,
final HttpServletResponse response)
{
AssistedServiceAuthenticationToken token = new AssistedServiceAuthenticationToken(new AssistedServiceAgentPrincipal(
username), password);
token.setDetails(new WebAuthenticationDetails(request));
try
{
final Authentication authentication = getAuthenticationManager().authenticate(token);
// You may ask - what's the point in using custom token and principal?
// - the point is, that SecurityContextHolder stores ASM agent, but UserService stores emulated user.
// There is a check "SecurityUserCheckBeforeControllerHandler",
// it skips validation when principal isn't an instance of String.
token = new AssistedServiceAuthenticationToken(new AssistedServiceAgentPrincipal(username), password,
authentication.getAuthorities());
SecurityContextHolder.getContext().setAuthentication(token);
getCustomerFacade().loginSuccess();
getGuidCookieStrategy().setCookie(request, response);
}
catch (final Exception e)
{
SecurityContextHolder.getContext().setAuthentication(null);
LOG.error("Failure during autoLogin", e);
}
}
protected AuthenticationManager getAuthenticationManager()
{
return authenticationManager;
}
@Required
public void setAuthenticationManager(final AuthenticationManager authenticationManager)
{
this.authenticationManager = authenticationManager;
}
protected CustomerFacade getCustomerFacade()
{
return customerFacade;
}
@Required
public void setCustomerFacade(final CustomerFacade customerFacade)
{
this.customerFacade = customerFacade;
}
protected GUIDCookieStrategy getGuidCookieStrategy()
{
return guidCookieStrategy;
}
@Required
public void setGuidCookieStrategy(final GUIDCookieStrategy guidCookieStrategy)
{
this.guidCookieStrategy = guidCookieStrategy;
}
}
| [
"thaisonnguyenbt@gmail.com"
] | thaisonnguyenbt@gmail.com |
c12826757180cf9f6787409eafc1db56a305907d | e08b1cb47603f6b33b803f55cb57073d2acfef6c | /src/main/java/com/util/RefreshTest.java | 7c587d7f3e5a17b1d7b288f92adee8d96e69adcb | [] | no_license | sri595/onforcedeploymenttool | 82ed80a767c2473dbc80571f6f0fe7ccd1b49719 | 5e0c52106f03a7a50becfe5eca0bd8c542b647ef | refs/heads/master | 2021-01-15T12:19:12.684055 | 2017-01-13T10:16:24 | 2017-01-13T10:16:24 | 78,838,463 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 741 | java | package com.util;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
public class RefreshTest {
public static void main(String[] args) throws IOException {
InputStream input;
try {
input = new FileInputStream(AppUtil.getCurrentPath()
+ "/WebContent/WEB-INF/properties/config.properties");
Properties p = new Properties();
p.load(input);
System.out.println(p.getProperty("baseclientclientId"));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println(AppUtil.getCurrentPath()
+ "/WebContent/WEB-INF/properties/config.properties");
}
}
| [
"skrishna@infrascape.com"
] | skrishna@infrascape.com |
48361a4d98f8a8beffddacdd6dbd08e695a1136b | 2cb499e4be6ce34054bf854793f0c34716180359 | /module4/case_study/src/main/java/com/example/case_study/dto/CustomerDto.java | 387bcb9ef4aa51aaf3c188ca2c3c9b71e751d4ae | [] | no_license | nhutam123/C0221G1-le-nhu-tam | 3b1398583e778cec1c232ce72a562daf1778398e | 549304e82500a5094a91e332dc8a23213ffca80b | refs/heads/main | 2023-07-12T01:06:09.316138 | 2021-08-11T10:35:45 | 2021-08-11T10:35:45 | 342,120,462 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,579 | java | package com.example.case_study.dto;
import com.example.case_study.model.entity.CustomerType;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.aspectj.apache.bcel.ExceptionConstants;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.sql.Date;
public class CustomerDto {
private Integer id;
private String name;
// @Pattern(regexp = "^[0-9]{2}/[0-9]{2}/[0-9]{4}$")
@JsonFormat( pattern = "MM/dd/yyyy")
private Date birthday;
private String gender;
private String card;
@Pattern(regexp = "090[0-9]{7}")
private String phoneNumber;
@Pattern(regexp = "^[a-zA-Z0-9]{1,9}@[0-9a-zA-Z]{1,9}")
private String email;
private String address;
private int flag;
@Pattern(regexp="^KH-[0-9]{4}")
private String customerCode;
private CustomerType customerType;
public CustomerDto() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Date getBirthday() {
return birthday;
}
public void setBirthday(Date birthday) {
this.birthday = birthday;
}
public String getGender() {
return gender;
}
public void setGender(String gender) {
this.gender = gender;
}
public String getCard() {
return card;
}
public void setCard(String card) {
this.card = card;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public CustomerType getCustomerType() {
return customerType;
}
public void setCustomerType(CustomerType customerType) {
this.customerType = customerType;
}
public int getFlag() {
return flag;
}
public void setFlag(int flag) {
this.flag = flag;
}
public String getCustomerCode() {
return customerCode;
}
public void setCustomerCode(String customerCode) {
this.customerCode = customerCode;
}
}
| [
"soledad.guitarist@gmail.com"
] | soledad.guitarist@gmail.com |
4b52ed8886982451012c3ed8e51065cb699cdaac | 1a9c92ca71ec754ba23dddb332c3eda13adf8ee7 | /src/main/java/inventorysetups/InventorySetupsDisplayAttributes.java | 77f0b2a71356d1796fc4ed41a65e610f2cb95ac0 | [
"BSD-2-Clause"
] | permissive | dillydill123/inventory-setups | 6768395384caa7ba7df2c2cec89181007edf717a | fb7d9d5814887785e8debcdfb201ae7af09c7a09 | refs/heads/master | 2023-08-12T00:05:52.342625 | 2023-07-25T00:47:14 | 2023-07-25T00:47:14 | 230,001,906 | 56 | 26 | BSD-2-Clause | 2023-04-01T15:24:02 | 2019-12-24T20:47:21 | Java | UTF-8 | Java | false | false | 1,662 | java | /*
* Copyright (c) 2022, dillydill123 <https://github.com/dillydill123>
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS 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 COPYRIGHT OWNER OR 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.
*/
package inventorysetups;
import java.awt.Color;
public interface InventorySetupsDisplayAttributes
{
String getName();
void setName(final String name);
Color getDisplayColor();
void setDisplayColor(final Color color);
}
| [
""
] | |
b56fed1e67cec2ead1daace304411a230c89288a | 96a04dce0f712e2d06a10b57cd7056427f79a55f | /src/cn/sharesdk/tpl/SignupPage.java | c7e9c6016cddfefd666270844c1f37cc0828c744 | [] | no_license | tianrenz2/whoknows | ccce20ac2603af3ac1624f92ec2b3824e6a58837 | 21548538a092f65e90176724eb65dfc84d855efe | refs/heads/master | 2018-12-26T02:46:10.042921 | 2018-10-19T19:10:53 | 2018-10-19T19:10:53 | 46,835,884 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 14,172 | java | //package cn.sharesdk.tpl;
//
//import java.io.File;
//import java.io.FileNotFoundException;
//import java.io.FileOutputStream;
//import java.io.IOException;
//import java.net.URL;
//
//import com.qiadao.iknow.R;
//
//import android.app.Activity;
//import android.app.Dialog;
//import android.content.Intent;
//import android.database.Cursor;
//import android.graphics.Bitmap;
//import android.graphics.Bitmap.Config;
//import android.graphics.BitmapFactory;
//import android.graphics.drawable.Drawable;
//import android.net.Uri;
//import android.os.Environment;
//import android.os.Handler.Callback;
//import android.os.Message;
//import android.provider.MediaStore;
//import android.text.TextUtils;
//import android.util.Log;
//import android.view.View;
//import android.view.View.OnClickListener;
//import android.widget.EditText;
//import android.widget.ImageView;
//import android.widget.LinearLayout.LayoutParams;
//import android.widget.TextView;
//import android.widget.Toast;
//import cn.sharesdk.framework.FakeActivity;
//import cn.sharesdk.framework.Platform;
//import cn.sharesdk.framework.ShareSDK;
//import cn.sharesdk.framework.utils.UIHandler;
//
//public class SignupPage extends FakeActivity implements OnClickListener, Callback {
//
// /** 淇敼鐢ㄦ埛淇℃伅dialog,濡傜敤鎴蜂俊鎭紝澶囨敞淇℃伅*/
// private enum ChangeUserType {USER_NAME, USER_NOTE};
// /**鍔犺浇瀵硅瘽妗�*/
// private static final int SHOW_PROGRESS_DIALOG = 1;
// /**鍔犺浇鐢ㄦ埛icon*/
// private static final int LOAD_USER_ICON = 2;
// /**Toast 鎻愬崌*/
// private static final int MSG_SHOW_TOAST = 3;
// /**鎵撳紑鐩稿唽锛屽苟鎴浘*/
// private static final int INTENT_ACTION_PICTURE = 0;
// /**鎵撳紑鐩告満鐓х浉*/
// private static final int INTENT_ACTION_CAREMA = 1;
// /**鐓х浉鍚庯紝鎴浘*/
// private static final int INTENT_ACTION_CROP = 2;
// /**鍥剧墖鍚嶅瓧*/
// private static final String PICTURE_NAME = "userIcon.jpg";
//
// private OnLoginListener signupListener;
// private ImageView ivUserIcon;
// private TextView tvUserName, tvUserGender, tvUserNote, tvEnsure;
// private Platform platform;
//
// private String picturePath;
// private UserInfo userInfo = new UserInfo();
//
// /** 璁剧疆鎺堟潈鍥炶皟锛岀敤浜庡垽鏂槸鍚﹁繘鍏ユ敞鍐� */
// public void setOnLoginListener(OnLoginListener l) {
// this.signupListener = l;
// }
//
// @Override
// public void onCreate() {
// activity.setContentView(R.layout.tpl_page_signup);
// activity.findViewById(R.id.ll_back).setOnClickListener(this);
//
// tvUserName = (TextView) activity.findViewById(R.id.tv_user_name);
// tvUserNote = (TextView) activity.findViewById(R.id.tv_user_note);
// tvEnsure = (TextView) activity.findViewById(R.id.tv_ensure);
// ivUserIcon = (ImageView) activity.findViewById(R.id.iv_user_icon);
//
// ivUserIcon.setOnClickListener(this);
// tvEnsure.setOnClickListener(this);
// activity.findViewById(R.id.rl_icon).setOnClickListener(this);
// activity.findViewById(R.id.rl_name).setOnClickListener(this);
// activity.findViewById(R.id.rl_note).setOnClickListener(this);
//
// initData();
// }
//
// public void setPlatform(String platName) {
// platform = ShareSDK.getPlatform(platName);
// }
//
// /**鍒濆鍖栨暟鎹�*/
// private void initData(){
// //String gender = "";
// if(platform != null){
//// gender = platform.getDb().getUserGender();
//// if(gender.equals("m")){
//// //userInfo.setUserGender(UserInfo.Gender.BOY);
//// gender = getContext().getString(R.string.tpl_boy);
//// }else{
//// //userInfo.setUserGender(UserInfo.Gender.GIRL);
//// gender = getContext().getString(R.string.tpl_girl);
//// }
//
// userInfo.setUserIcon(platform.getDb().getUserIcon());
// userInfo.setUserName(platform.getDb().getUserName());
// userInfo.setUserNote(platform.getDb().getUserId());
// }
//
// tvUserName.setText(userInfo.getUserName());
// //tvUserGender.setText(gender);
// tvUserNote.setText("USER ID : " + userInfo.getUserNote());
// // 鍔犺浇澶村儚
// if(!TextUtils.isEmpty(userInfo.getUserIcon())){
// loadIcon();
// }
// //鍒濆鍖栫収鐗囦繚瀛樺湴鍧�
// if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)){
// String thumPicture = Environment.getExternalStorageDirectory().getAbsolutePath()+"/"+activity.getPackageName()+"/download";
// File pictureParent =new File(thumPicture);
// File pictureFile =new File(pictureParent, PICTURE_NAME);
//
// if(!pictureParent.exists()){
// pictureParent.mkdirs();
// }
// try{
// if (!pictureFile.exists()) {
// pictureFile.createNewFile();
// }
// }catch (Exception e) {
// e.printStackTrace();
// }
// picturePath = pictureFile.getAbsolutePath();
// Log.e("picturePath ==>>", picturePath);
// }else{
// Log.e("change user icon ==>>", "there is not sdcard!");
// }
// }
//
//// @Override
//// public void onClick(View v) {
//// switch (v.getId()) {
//// case R.id.ll_back:
//// this.finish();
//// break;
//// case R.id.tv_ensure:
//// UIHandler.sendEmptyMessage(MSG_SHOW_TOAST, SignupPage.this);
//// break;
//// case R.id.rl_icon:
//// //showChangeIconDialog();
//// getPicture();
//// break;
//// case R.id.rl_name:
//// showChangeInfo(ChangeUserType.USER_NAME);
//// break;
////// case R.id.rl_gender:
////// showGerderDialog();
////// break;
//// case R.id.rl_note:
//// showChangeInfo(ChangeUserType.USER_NOTE);
//// break;
//// case R.id.iv_user_icon:
//// PicViewer pv = new PicViewer();
//// pv.setImagePath(userInfo.getUserIcon());
//// pv.show(activity, null);
//// break;
//// default:
//// break;
//// }
//// }
//
// public boolean handleMessage(Message msg) {
// switch (msg.what) {
// case SHOW_PROGRESS_DIALOG:
// break;
// case LOAD_USER_ICON:
// ivUserIcon.setImageURI(Uri.parse(picturePath));
// break;
//
// default:
// break;
// }
// return false;
// }
//
// /**
// * 鍔犺浇澶村儚
// */
// public void loadIcon() {
// final String imageUrl = platform.getDb().getUserIcon();
// new Thread(new Runnable() {
// @Override
// public void run() {
// try {
// URL picUrl = new URL(imageUrl);
// Bitmap userIcon = BitmapFactory.decodeStream(picUrl.openStream());
// FileOutputStream b = null;
// try {
// b = new FileOutputStream(picturePath);
// userIcon.compress(Bitmap.CompressFormat.JPEG, 100, b);// 鎶婃暟鎹啓鍏ユ枃浠�
// } catch (FileNotFoundException e) {
// e.printStackTrace();
// } finally {
// try {
// b.flush();
// b.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
// userInfo.setUserIcon(picturePath);
//
// Message msg = new Message();
// msg.what = LOAD_USER_ICON;
// UIHandler.sendMessage(msg, SignupPage.this);
// } catch (Exception e) {
// e.printStackTrace();
// }
// }
// }).start();
// }
//
// @Override
// public void onActivityResult(int requestCode, int resultCode, Intent data) {
// if(requestCode == INTENT_ACTION_PICTURE && resultCode == Activity.RESULT_OK && null != data){
// Cursor c = activity.getContentResolver().query(data.getData(), null, null, null, null);
// c.moveToNext();
// String path = c.getString(c.getColumnIndex(MediaStore.MediaColumns.DATA));
// c.close();
// System.out.println("onActivityResult == " + path);
// if(new File(path).exists()){
// System.out.println("onActivityResult == " + path +" == exist");
// userInfo.setUserIcon(path);
// ivUserIcon.setImageBitmap(compressImageFromFile(path));
// //ivUserIcon.setImageURI(Uri.parse(path));
// //ivUserIcon.setImageDrawable(Drawable.createFromPath(path));
// }
// }else if(requestCode == INTENT_ACTION_CAREMA && resultCode == Activity.RESULT_OK){
// userInfo.setUserIcon(picturePath);
// //ivUserIcon.setImageURI(Uri.parse(picturePath));
// ivUserIcon.setImageDrawable(Drawable.createFromPath(picturePath));
// }else if(requestCode == INTENT_ACTION_CROP && resultCode == Activity.RESULT_OK && null != data){
// //ivUserIcon.setImageURI(Uri.parse(picturePath));
// ivUserIcon.setImageDrawable(Drawable.createFromPath(picturePath));
// }
// }
//
// /**浠庣浉鍐岃幏鍙栧浘鐗�*/
// private void getPicture(){
// Intent intent = new Intent(Intent.ACTION_PICK);
// intent.setType("image/*");
// intent.setData(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
// startActivityForResult(intent, INTENT_ACTION_PICTURE);
// //TODO
// }
//
//// /**鎵撳紑鐩告満鐓х浉*/
//// private void openCamera(){
//// Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
//// intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(picturePath)));
//// intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);
//// startActivityForResult(intent, INTENT_ACTION_CAREMA);
//// }
//
// /**鍓鏂规硶*/
// private void openCrop(Uri uri){
// //TODO 瑁佸壀鏂规硶锛岃嚜宸卞仛
// Intent intent = new Intent("com.android.camera.action.CROP");
// intent.setDataAndType(uri, "image/*");
// intent.putExtra("crop", "true");//鍙鍓�
// intent.putExtra("aspectX", 1);
// intent.putExtra("aspectY", 1);
// intent.putExtra("outputX", 100);
// intent.putExtra("outputY", 100);
// intent.putExtra("scale", true);
// // intent.putExtra(MediaStore.EXTRA_OUTPUT, uri);
// intent.putExtra("return-data", true);//鑻ヤ负false鍒欒〃绀轰笉杩斿洖鏁版嵁
// // intent.putExtra("outputFormat", Bitmap.CompressFormat.JPEG.toString());
// intent.putExtra("noFaceDetection", true);
// startActivityForResult(intent, INTENT_ACTION_CROP);
//// startActivityForResult(intent, INTENT_ACTION_CAREMA);
// }
//
// /**
// * gender select dialog,鎬у埆閫夋嫨瀵硅瘽妗�
// */
//// private void showGerderDialog(){
//// final Dialog dialog = new Dialog(getContext(), R.style.WhiteDialog);
//// dialog.setContentView(R.layout.tpl_gender_select_dialog);
//// final ImageView ivBoy = (ImageView) dialog.findViewById(R.id.dialog_iv_boy);
//// final ImageView ivGirl = (ImageView) dialog.findViewById(R.id.dialog_iv_girl);
//// if(userInfo.getUserGender() == UserInfo.Gender.BOY){
//// ivGirl.setVisibility(View.GONE);
//// ivBoy.setVisibility(View.VISIBLE);
//// }else{
//// ivBoy.setVisibility(View.GONE);
//// ivGirl.setVisibility(View.VISIBLE);
//// }
//// dialog.findViewById(R.id.rl_boy).setOnClickListener(new OnClickListener() {
//// @Override
//// public void onClick(View v) {
//// ivGirl.setVisibility(View.GONE);
//// ivBoy.setVisibility(View.VISIBLE);
//// tvUserGender.setText(R.string.tpl_boy);
//// userInfo.setUserGender(UserInfo.Gender.BOY);
//// dialog.dismiss();
//// }
//// });
////
//// }
//
// /**鏀瑰彉鐢ㄦ埛淇℃伅*/
// private void showChangeInfo(final ChangeUserType type){
// String title;
// String content;
// String hint;
// if(type == ChangeUserType.USER_NAME){
// content = tvUserName.getText().toString();
// title = getContext().getString(R.string.tpl_change_user_name_title);
// hint = getContext().getString(R.string.tpl_input_user_name_hint);
// }else{
// content = tvUserNote.getText().toString();
// title = getContext().getString(R.string.tpl_change_user_note_title);
// hint = getContext().getString(R.string.tpl_input_user_note_hint);
// }
//
// View dlgView = View.inflate(activity, R.layout.tpl_change_userinfo_dialog, null);
// LayoutParams layoutParams = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
//
// final Dialog dialog = new Dialog(getContext(), R.style.WhiteDialog);
// dialog.setContentView(dlgView, layoutParams);
// final TextView tvTitle = (TextView) dialog.findViewById(R.id.dialog_tv_title);
// final EditText etInfo = (EditText) dialog.findViewById(R.id.dialog_ev_info);
// final TextView tvHint = (TextView) dialog.findViewById(R.id.dialog_tv_hint);
// tvTitle.setText(title);
// etInfo.setText(content);
// tvHint.setText(hint);
// dialog.findViewById(R.id.dialog_btn_save).setOnClickListener(new OnClickListener() {
// @Override
// public void onClick(View v) {
// String content = etInfo.getText().toString();
// if(type == ChangeUserType.USER_NAME){
// tvUserName.setText(content);
// userInfo.setUserName(content);
// }else{
// tvUserNote.setText(content);
// userInfo.setUserNote(content);
// }
// dialog.dismiss();
// }
// });
// dialog.show();
// }
//
// //鍥剧墖鍘嬬缉
// private Bitmap compressImageFromFile(String srcPath) {
// BitmapFactory.Options newOpts = new BitmapFactory.Options();
// newOpts.inJustDecodeBounds = true;//鍙杈�,涓嶈鍐呭
// Bitmap bitmap = BitmapFactory.decodeFile(srcPath, newOpts);
//
// newOpts.inJustDecodeBounds = false;
// int w = newOpts.outWidth;
// int h = newOpts.outHeight;
// float hh = 800f;//
// float ww = 480f;//
// int be = 1;
// if (w > h && w > ww) {
// be = (int) (newOpts.outWidth / ww);
// } else if (w < h && h > hh) {
// be = (int) (newOpts.outHeight / hh);
// }
// if (be <= 0)
// be = 1;
// newOpts.inSampleSize = be;//璁剧疆閲囨牱鐜�
//
// newOpts.inPreferredConfig = Config.ARGB_8888;//璇ユā寮忔槸榛樿鐨�,鍙笉璁�
// newOpts.inPurgeable = true;// 鍚屾椂璁剧疆鎵嶄細鏈夋晥
// newOpts.inInputShareable = true;//銆傚綋绯荤粺鍐呭瓨涓嶅鏃跺�欏浘鐗囪嚜鍔ㄨ鍥炴敹
//
// bitmap = BitmapFactory.decodeFile(srcPath, newOpts);
//// return compressBmpFromBmp(bitmap);//鍘熸潵鐨勬柟娉曡皟鐢ㄤ簡杩欎釜鏂规硶浼佸浘杩涜浜屾鍘嬬缉
// //鍏跺疄鏄棤鏁堢殑,澶у灏界灏濊瘯
// return bitmap;
// }
//
// @Override
// public void onClick(View v) {
// // TODO Auto-generated method stub
//
// }
//}
| [
"tianrenz@uci.edu"
] | tianrenz@uci.edu |
fd54f2ff2dc8a3f238621df2f979238d549fa7bc | cf1458eb4140394ea52e1f1f1426677cc520f6ca | /JAVA2/ATM/src/Transaction.java | 60a2c8e8c1b66fbbc821fbad75918e4c1a2f8f54 | [] | no_license | nazarethk/Java-Projects | e87dbd889b753351c4f23355ae1781f9ff431b6c | 475c489dded25f74403e741e0c685f5fc39daa19 | refs/heads/master | 2023-04-03T00:08:29.561364 | 2019-01-31T22:41:49 | 2019-01-31T22:41:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,938 | java |
/*Name: Nazareth H. Keshishian
*Date Last Modified: 7/04/2018
*Associated files:Account.java, Accounts.java, Node.java, Person.java, Queue.java, ATM.java.
*Program Description: ATM Machine program, that runs from 9am till 6pm and puts every transaction in the queue after 6pm.
*/
public class Transaction {
private String date,time,type;
private double amount;
private Person person;
private Account account,account1;
//type deposit ,whitdrawal or transfer of money
public Transaction(Person person,Account account ,String date,String time,String type,double amount) {
//A constructor for instantiation
this.person=person;
this.account=account;
this.date=date;
this.time=time;
this.type=type;
this.amount=amount;
}
public Transaction(Person person, Account account, Account account1, String date, String time, String type,
double amount) {
//Another constructor used for transfering money from acc to acc1.
this.person=person;
this.account=account;
this.account1=account1;
this.date=date;
this.time=time;
this.type=type;
this.amount=amount;
}
//Getters and Setters
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public Person getPerson() {
return person;
}
public Account getAccount() {
return account;
}
public void setAccount(Account account) {
this.account = account;
}
public Account getAccount1() {//getAccount1 gets the account in which the money is going to be transfered.
return account1;
}
public void setAccount1(Account account1) {//setAccount1 sets the account in which the money is going to be transfered.
this.account1 = account1;
}
public String toString() { //returns a transaction's info.
return "Transaction: Person: "+person.getName()+", date: "+date+", time: "+time
+", type: "+type+", amount: "+amount;
}
}
| [
"nazareth.keshishian@lau.edu"
] | nazareth.keshishian@lau.edu |
05baed4b560a24739d2833a74dd3a0743aa80b42 | 376c41d4ee6e45a0eec40f1542e7b8bca8b525c9 | /esiee-hmi-base/src/com/esiee/mbdaihm/tps/TP03.java | c5f0ee90f5558e95bb4551bd63393cab2e0958a9 | [] | no_license | KevinBordier/IHM_MBDA2 | a8b7ea0f2e77b3f9bdc5d0f837197847c012340c | 624e8108944d90d1404ba2e516d2834408e49168 | refs/heads/master | 2021-05-15T22:20:12.597845 | 2017-11-12T15:38:39 | 2017-11-12T15:38:39 | 106,660,259 | 0 | 0 | null | 2017-11-12T15:38:40 | 2017-10-12T07:35:41 | Java | UTF-8 | Java | false | false | 2,117 | java | package com.esiee.mbdaihm.tps.solution;
import java.awt.*;
import java.awt.geom.AffineTransform;
import java.awt.geom.GeneralPath;
import javax.swing.*;
/**
* Use of Java2D API.
*/
public class TP03
{
private final JFrame frame;
private final DrawingPanel panel;
public TP03()
{
frame = new JFrame("TP03");
frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
panel = new DrawingPanel();
}
private void layoutComponents()
{
frame.setLayout(new BorderLayout());
frame.add(panel);
}
private void display()
{
frame.setBounds(0, 0, 800, 600);
frame.setVisible(true);
}
public static void main(String[] args)
{
TP03 tp = new TP03();
tp.layoutComponents();
SwingUtilities.invokeLater(() -> tp.display());
}
private static class DrawingPanel extends JPanel
{
@Override
protected void paintComponent(Graphics g)
{
super.paintComponent(g);
Graphics2D g2d = (Graphics2D) g;
//*
AffineTransform tr = g2d.getTransform();
tr.translate(0, 400);
tr.scale(0.5, -1);
g2d.setTransform(tr);
//*/
g2d.setPaint(Color.GREEN);
g2d.fillRect(100, 100, 200, 100);
g2d.setPaint(Color.RED);
g2d.fillOval(300, 100, 100, 100);
GeneralPath triangle = new GeneralPath();
triangle.moveTo(200, 200);
triangle.lineTo(100, 300);
triangle.lineTo(300, 300);
triangle.closePath();
g2d.setPaint(Color.BLACK);
g2d.draw(triangle);
GeneralPath t = new GeneralPath();
t.moveTo(400, 250);
t.lineTo(550, 250);
t.lineTo(550, 300);
t.lineTo(500, 300);
t.lineTo(500, 350);
t.lineTo(450, 350);
t.lineTo(450, 300);
t.lineTo(400, 300);
t.closePath();
g2d.setPaint(Color.CYAN);
g2d.fill(t);
}
}
}
| [
"kev.bor.77@gmail.com"
] | kev.bor.77@gmail.com |
c39e7e5dfeff6e1d29e035720ef0809dc2766177 | 7f785f2396aed44aa740647cc84622bcfd917b9b | /app/src/test/java/com/domgarr/android/volleyballscorekeeper/ExampleUnitTest.java | 7fe261d42de9a0a805ecf1b1c811320fee36c268 | [] | no_license | domgarr/Volleyball-ScoreKeeper | 12d012c21088e019e858330dfaded816677a13ff | f0b31c3d1951ec5e36a5538fa1b53fd2c5e8f63e | refs/heads/master | 2022-02-25T07:54:20.380978 | 2019-10-04T18:50:39 | 2019-10-04T18:50:39 | 104,024,361 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 419 | java | package com.domgarr.android.volleyballscorekeeper;
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() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"garreffd@uwindsor.ca"
] | garreffd@uwindsor.ca |
d0de348df5c7a143bb461eb3821b15951d1b9eea | bc639d15bcc35b6e58f97ca02bee2dc66eba894b | /src/com/vmware/vim25/LicenseRestricted.java | 280d1760d544a6aa31251b58b0af60ecf3ae24d7 | [
"BSD-3-Clause"
] | permissive | benn-cs/vijava | db473c46f1a4f449e52611055781f9cfa921c647 | 14fd6b5d2f1407bc981b3c56433c30a33e8d74ab | refs/heads/master | 2021-01-19T08:15:17.194988 | 2013-07-11T05:17:08 | 2013-07-11T05:17:08 | 7,495,841 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,826 | java | /*================================================================================
Copyright (c) 2012 Steve Jin. All Rights Reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* 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.
* Neither the name of VMware, Inc. nor the names of its contributors may be used
to endorse or promote products derived from this software without specific prior
written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS 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 VMWARE, INC. OR 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.
================================================================================*/
package com.vmware.vim25;
/**
* @author Steve Jin (http://www.doublecloud.org)
* @version 5.1
*/
@SuppressWarnings("all")
public class LicenseRestricted extends NotEnoughLicenses {
} | [
"sjin2008@3374d856-466b-4dc9-8cc5-e1e8506a9ea1"
] | sjin2008@3374d856-466b-4dc9-8cc5-e1e8506a9ea1 |
58cf3568139d534b6257fc6262ea596df9148815 | 027f2fa5f481175b3865b840a583378e42a9b7d4 | /src/main/java/com/login/service/MicrinLoginServiceApplication.java | 3e3621a2c1cb809f115b8016afc6156dd861af2a | [] | no_license | kevinore/Micrin-login-service | a4cc3521fcd2f413d013c91abc74c6d91da90c80 | 8835b04a6b2bd3555f43b64a869041af0b1ae1e2 | refs/heads/master | 2022-12-28T01:52:32.551917 | 2020-06-08T00:32:52 | 2020-06-08T00:32:52 | 243,998,831 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 336 | java | package com.login.service;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class MicrinLoginServiceApplication {
public static void main(String[] args) {
SpringApplication.run(MicrinLoginServiceApplication.class, args);
}
}
| [
"kevinaldana51@gmail.com"
] | kevinaldana51@gmail.com |
a0ac51f33a9e0f4864d97882ac187405be221b40 | 7762b5ecb44f4c3b08d25f58c210bfa97c6dcefc | /src/main/java/com/example/task/springSchedule/TestSchedule.java | 8bfb49b8bb7ac9a530350fdd101b703c98a910dc | [] | no_license | wuqingyanjava/javademo | f247b5028e33f724e3f9026bb4712081aefeb346 | 9122ecfb2f97bb7f5435e76059c3a99de3499b28 | refs/heads/master | 2022-11-03T22:43:50.487684 | 2020-01-07T03:54:33 | 2020-01-07T03:54:33 | 190,150,260 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 650 | java | package com.example.task.springSchedule;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* 只需要在springboot的启动类上加上@EnableScheduling
* 一旦某个任务在执行过程中抛出异常,则整个定时器生命周期就结束,以后永远不会再执行定时器任务
* @Author wuqingyan
* Date 2019/9/29 15:44
* Modify Log
**/
@Component
public class TestSchedule {
//每五秒执行一次
// @Scheduled(cron = "*/5 * * * * ?")
// public void testScheduleTask(){
// System.out.println("spring-schedule定时任务执行中");
// }
}
| [
"wqy@56join.com"
] | wqy@56join.com |
fb0103ec8167bbde798567011eb34e4f91f442d7 | 3b22a684e1540d58d07bc6a12ab09584884c273d | /hybris/bin/ext-content/cmsfacades/src/de/hybris/platform/cmsfacades/pagescontentslots/service/impl/DefaultPageContentSlotConverterType.java | 667e7545560d047cfba01188131b06a8d6ff2aae | [] | no_license | ScottGledhill/HYB | 955221b824b8f0d1b0e584d3f80c2e48bc0c19d9 | 0c91735fe889bc47878c851445220dbcae7ca281 | refs/heads/master | 2021-07-25T20:00:36.924559 | 2017-10-27T14:17:02 | 2017-10-27T14:17:02 | 108,548,668 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,572 | java | /*
* [y] hybris Platform
*
* Copyright (c) 2017 SAP SE or an SAP affiliate company. All rights reserved.
*
* This software is the confidential and proprietary information of SAP
* ("Confidential Information"). 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 SAP.
*/
package de.hybris.platform.cmsfacades.pagescontentslots.service.impl;
import de.hybris.platform.cms2.model.relations.CMSRelationModel;
import de.hybris.platform.cmsfacades.pagescontentslots.service.PageContentSlotConverterType;
import de.hybris.platform.cmswebservices.data.PageContentSlotData;
import de.hybris.platform.converters.impl.AbstractPopulatingConverter;
/**
* Default implementation of <code>PageContentSlotConverterType</code>.
*/
public class DefaultPageContentSlotConverterType implements PageContentSlotConverterType
{
private Class<? extends CMSRelationModel> classType;
private AbstractPopulatingConverter<CMSRelationModel, PageContentSlotData> converter;
@Override
public Class<? extends CMSRelationModel> getClassType()
{
return classType;
}
@Override
public void setClassType(final Class<? extends CMSRelationModel> classType)
{
this.classType = classType;
}
@Override
public AbstractPopulatingConverter<CMSRelationModel, PageContentSlotData> getConverter()
{
return converter;
}
@Override
public void setConverter(final AbstractPopulatingConverter<CMSRelationModel, PageContentSlotData> converter)
{
this.converter = converter;
}
}
| [
"ScottGledhill@hotmail.co.uk"
] | ScottGledhill@hotmail.co.uk |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.