blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
eb81e234d7e5dbeb2a9f1b5fb3583eec5f6ecd50
2b1f51ee26b79bbbbabe4b1bc7eeea9ab1e56333
/app/src/main/java/com/giahan/app/vietskindoctor/screens/setting/transaction/SingleTransactionAdaper.java
332268fd688db5ba312e04a1128fcb8dd50aa5c5
[]
no_license
nambingo/vietskin-doctor
c21bb705565c387b86f57cea6f71f8ad88637988
20b20e54a2cd29f95961bec9d1c548adc4d7893e
refs/heads/master
2020-04-04T08:17:39.671058
2019-01-07T02:15:16
2019-01-07T02:15:16
155,778,456
0
0
null
2019-01-07T02:15:17
2018-11-01T21:32:41
Java
UTF-8
Java
false
false
3,718
java
package com.giahan.app.vietskindoctor.screens.setting.transaction; import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import com.giahan.app.vietskindoctor.R; import com.giahan.app.vietskindoctor.domains.Transaction; import com.giahan.app.vietskindoctor.utils.Toolbox; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; public class SingleTransactionAdaper extends RecyclerView.Adapter<SingleTransactionAdaper.MyViewHolder> { private List<Transaction> mTransList; private Context context; private OnClickOpenTransactionListener mOnClickOpenTransactionListener; public SingleTransactionAdaper(List<Transaction> mTransList, Context context) { this.mTransList = mTransList; this.context = context; } public void setmOnClickOpenTransactionListener(OnClickOpenTransactionListener mOnClickOpenTransactionListener) { this.mOnClickOpenTransactionListener = mOnClickOpenTransactionListener; } @NonNull @Override public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_transaction_detail, parent, false); return new MyViewHolder(view); } @Override public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { Transaction t = mTransList.get(position); holder.tvSessionID.setText(t.getReferenceId()); holder.tvDateAndTime.setText(t.getTransTime()); int money = Integer.parseInt(t.getPostMoney()) - Integer.parseInt(t.getPreMoney()); if(t.getTransType().equals("1")){ holder.lnTitleSession.setVisibility(View.VISIBLE); holder.lnTitleWithdraw.setVisibility(View.GONE); holder.tvMoney.setText(context.getString(R.string.title_money_default4, Toolbox.formatMoney(String.valueOf(money)))); holder.tvMoney.setTextColor(context.getResources().getColor(R.color.color_default)); }else { holder.lnTitleSession.setVisibility(View.GONE); holder.lnTitleWithdraw.setVisibility(View.VISIBLE); holder.tvMoney.setText("-" + context.getString(R.string.title_money_default4, Toolbox.formatMoney(String.valueOf(money)))); holder.tvMoney.setTextColor(context.getResources().getColor(R.color.black)); } holder.rlTransCOntainer.setOnClickListener(view ->{ if(mOnClickOpenTransactionListener == null)return ; mOnClickOpenTransactionListener.onClickTransaction(t.getReferenceId()); }); } @Override public int getItemCount() { return mTransList.size(); } public interface OnClickOpenTransactionListener{ void onClickTransaction(String transactionId); } class MyViewHolder extends RecyclerView.ViewHolder{ @BindView(R.id.tvSessionID) TextView tvSessionID; @BindView(R.id.tvMoney) TextView tvMoney; @BindView(R.id.titleSession) LinearLayout lnTitleSession; @BindView(R.id.titleWithdraw) LinearLayout lnTitleWithdraw; @BindView(R.id.tvDateAndTime) TextView tvDateAndTime; @BindView(R.id.rlTransContaner) RelativeLayout rlTransCOntainer; public MyViewHolder(View itemView) { super(itemView); ButterKnife.bind(this, itemView); } } }
[ "vanthuong0108@gmail.com" ]
vanthuong0108@gmail.com
6fc0598f0a1d773b15f78885fc6b9cbe52cb67dc
381e7e42961c61e4bd8ab09f70252ed0a4f8dbb5
/superchaoran/GraniteSplitter/script/Script.java
7cdcb0186d09d7423e5d57f4dde3c208285c7ff4
[]
no_license
mindis/Algorithms-2
ca4ab02b7e9ea09ead4cacbed93ca48b1bf3308b
cb1c97f65e83df6632312ffb1eb3df448c5e1c76
refs/heads/master
2021-01-11T23:10:54.802372
2016-12-27T23:31:01
2016-12-27T23:31:01
78,555,238
1
0
null
2017-01-10T17:07:25
2017-01-10T17:07:25
null
UTF-8
Java
false
false
555
java
package superchaoran.GraniteSplitter.script; import org.powerbot.script.ClientContext; import org.powerbot.script.PollingScript; /* * Author: Coma */ public abstract class Script<C extends ClientContext> extends PollingScript<C> { protected JobContainer container = new JobContainer(); protected void work() { Job j = container.get(); if (j != null) { j.execute(); } } public void submit(Job... jobs) { container.submit(jobs); } public C context() { return ctx; } }
[ "superchaoran@gmail.com" ]
superchaoran@gmail.com
732db76d4d39e9364b301198ea3e8b314665a713
92eb4a6174243e7e050c811960b308690c924613
/app/src/main/java/com/pplab/songhua2/androidstudy/pActivity/pApplication.java
aa9ec13b206cc71d2192ca49834f875cad60a186
[]
no_license
shcalm/AndroidStudy
3ba3c66f29739eba5cb4090ccb695187ba1382e6
9a442ba07dbdc536f8e7dac0375c6da498c05eaf
refs/heads/master
2021-11-11T15:44:53.358461
2021-11-01T06:28:28
2021-11-01T06:28:28
51,740,639
0
0
null
null
null
null
UTF-8
Java
false
false
472
java
package com.pplab.songhua2.androidstudy.pActivity; import com.pplab.songhua2.androidstudy.pContext.ComponentCallbacks; import com.pplab.songhua2.androidstudy.pContext.Context; /** * Created by songhua2 on 2016/2/26. */ public class pApplication extends Context implements ComponentCallbacks{ @Override public void onConfigurationChanged() { } @Override public void onLowMemory() { } @Override public void onTrimmemory() { } }
[ "test@qq.com" ]
test@qq.com
e0895754fd7b9df15c913c1995f894d9f809c6fc
5a71eee6897a6cb49eadbe7142d1acab349790d0
/google-cloud-aiplatform/src/main/java/com/google/cloud/aiplatform/v1beta1/stub/EndpointServiceStubSettings.java
4e2b99fe77bd30b625b7d26266477355ddf4cd08
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
munkhuushmgl/java-aiplatform
054b5236de77a7b1f5ade4a1ed7a184444f05130
93bd92128bb4617d090cc29613a262a2c7965d8f
refs/heads/master
2023-01-04T22:16:57.577846
2020-11-06T20:12:33
2020-11-06T20:12:33
298,168,732
0
1
NOASSERTION
2020-09-24T04:28:23
2020-09-24T04:28:23
null
UTF-8
Java
false
false
35,070
java
/* * Copyright 2020 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.aiplatform.v1beta1.stub; import static com.google.cloud.aiplatform.v1beta1.EndpointServiceClient.ListEndpointsPagedResponse; import com.google.api.core.ApiFunction; import com.google.api.core.ApiFuture; 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.ApiCallContext; 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.PageContext; import com.google.api.gax.rpc.PagedCallSettings; import com.google.api.gax.rpc.PagedListDescriptor; import com.google.api.gax.rpc.PagedListResponseFactory; 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.api.gax.rpc.UnaryCallable; import com.google.cloud.aiplatform.v1beta1.CreateEndpointOperationMetadata; import com.google.cloud.aiplatform.v1beta1.CreateEndpointRequest; import com.google.cloud.aiplatform.v1beta1.DeleteEndpointRequest; import com.google.cloud.aiplatform.v1beta1.DeleteOperationMetadata; import com.google.cloud.aiplatform.v1beta1.DeployModelOperationMetadata; import com.google.cloud.aiplatform.v1beta1.DeployModelRequest; import com.google.cloud.aiplatform.v1beta1.DeployModelResponse; import com.google.cloud.aiplatform.v1beta1.Endpoint; import com.google.cloud.aiplatform.v1beta1.GetEndpointRequest; import com.google.cloud.aiplatform.v1beta1.ListEndpointsRequest; import com.google.cloud.aiplatform.v1beta1.ListEndpointsResponse; import com.google.cloud.aiplatform.v1beta1.UndeployModelOperationMetadata; import com.google.cloud.aiplatform.v1beta1.UndeployModelRequest; import com.google.cloud.aiplatform.v1beta1.UndeployModelResponse; import com.google.cloud.aiplatform.v1beta1.UpdateEndpointRequest; 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 com.google.protobuf.Empty; 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 EndpointServiceStub}. * * <p>The default instance has everything set to sensible defaults: * * <ul> * <li>The default service address (aiplatform.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 getEndpoint to 30 seconds: * * <pre> * <code> * EndpointServiceStubSettings.Builder endpointServiceSettingsBuilder = * EndpointServiceStubSettings.newBuilder(); * endpointServiceSettingsBuilder * .getEndpointSettings() * .setRetrySettings( * endpointServiceSettingsBuilder.getEndpointSettings().getRetrySettings().toBuilder() * .setTotalTimeout(Duration.ofSeconds(30)) * .build()); * EndpointServiceStubSettings endpointServiceSettings = endpointServiceSettingsBuilder.build(); * </code> * </pre> */ @Generated("by gapic-generator") @BetaApi public class EndpointServiceStubSettings extends StubSettings<EndpointServiceStubSettings> { /** 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<CreateEndpointRequest, Operation> createEndpointSettings; private final OperationCallSettings< CreateEndpointRequest, Endpoint, CreateEndpointOperationMetadata> createEndpointOperationSettings; private final UnaryCallSettings<GetEndpointRequest, Endpoint> getEndpointSettings; private final PagedCallSettings< ListEndpointsRequest, ListEndpointsResponse, ListEndpointsPagedResponse> listEndpointsSettings; private final UnaryCallSettings<UpdateEndpointRequest, Endpoint> updateEndpointSettings; private final UnaryCallSettings<DeleteEndpointRequest, Operation> deleteEndpointSettings; private final OperationCallSettings<DeleteEndpointRequest, Empty, DeleteOperationMetadata> deleteEndpointOperationSettings; private final UnaryCallSettings<DeployModelRequest, Operation> deployModelSettings; private final OperationCallSettings< DeployModelRequest, DeployModelResponse, DeployModelOperationMetadata> deployModelOperationSettings; private final UnaryCallSettings<UndeployModelRequest, Operation> undeployModelSettings; private final OperationCallSettings< UndeployModelRequest, UndeployModelResponse, UndeployModelOperationMetadata> undeployModelOperationSettings; /** Returns the object with the settings used for calls to createEndpoint. */ public UnaryCallSettings<CreateEndpointRequest, Operation> createEndpointSettings() { return createEndpointSettings; } /** Returns the object with the settings used for calls to createEndpoint. */ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings<CreateEndpointRequest, Endpoint, CreateEndpointOperationMetadata> createEndpointOperationSettings() { return createEndpointOperationSettings; } /** Returns the object with the settings used for calls to getEndpoint. */ public UnaryCallSettings<GetEndpointRequest, Endpoint> getEndpointSettings() { return getEndpointSettings; } /** Returns the object with the settings used for calls to listEndpoints. */ public PagedCallSettings<ListEndpointsRequest, ListEndpointsResponse, ListEndpointsPagedResponse> listEndpointsSettings() { return listEndpointsSettings; } /** Returns the object with the settings used for calls to updateEndpoint. */ public UnaryCallSettings<UpdateEndpointRequest, Endpoint> updateEndpointSettings() { return updateEndpointSettings; } /** Returns the object with the settings used for calls to deleteEndpoint. */ public UnaryCallSettings<DeleteEndpointRequest, Operation> deleteEndpointSettings() { return deleteEndpointSettings; } /** Returns the object with the settings used for calls to deleteEndpoint. */ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings<DeleteEndpointRequest, Empty, DeleteOperationMetadata> deleteEndpointOperationSettings() { return deleteEndpointOperationSettings; } /** Returns the object with the settings used for calls to deployModel. */ public UnaryCallSettings<DeployModelRequest, Operation> deployModelSettings() { return deployModelSettings; } /** Returns the object with the settings used for calls to deployModel. */ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings< DeployModelRequest, DeployModelResponse, DeployModelOperationMetadata> deployModelOperationSettings() { return deployModelOperationSettings; } /** Returns the object with the settings used for calls to undeployModel. */ public UnaryCallSettings<UndeployModelRequest, Operation> undeployModelSettings() { return undeployModelSettings; } /** Returns the object with the settings used for calls to undeployModel. */ @BetaApi("The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings< UndeployModelRequest, UndeployModelResponse, UndeployModelOperationMetadata> undeployModelOperationSettings() { return undeployModelOperationSettings; } @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public EndpointServiceStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcEndpointServiceStub.create(this); } else { throw new UnsupportedOperationException( "Transport not supported: " + 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 "aiplatform.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(EndpointServiceStubSettings.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 EndpointServiceStubSettings(Builder settingsBuilder) throws IOException { super(settingsBuilder); createEndpointSettings = settingsBuilder.createEndpointSettings().build(); createEndpointOperationSettings = settingsBuilder.createEndpointOperationSettings().build(); getEndpointSettings = settingsBuilder.getEndpointSettings().build(); listEndpointsSettings = settingsBuilder.listEndpointsSettings().build(); updateEndpointSettings = settingsBuilder.updateEndpointSettings().build(); deleteEndpointSettings = settingsBuilder.deleteEndpointSettings().build(); deleteEndpointOperationSettings = settingsBuilder.deleteEndpointOperationSettings().build(); deployModelSettings = settingsBuilder.deployModelSettings().build(); deployModelOperationSettings = settingsBuilder.deployModelOperationSettings().build(); undeployModelSettings = settingsBuilder.undeployModelSettings().build(); undeployModelOperationSettings = settingsBuilder.undeployModelOperationSettings().build(); } private static final PagedListDescriptor<ListEndpointsRequest, ListEndpointsResponse, Endpoint> LIST_ENDPOINTS_PAGE_STR_DESC = new PagedListDescriptor<ListEndpointsRequest, ListEndpointsResponse, Endpoint>() { @Override public String emptyToken() { return ""; } @Override public ListEndpointsRequest injectToken(ListEndpointsRequest payload, String token) { return ListEndpointsRequest.newBuilder(payload).setPageToken(token).build(); } @Override public ListEndpointsRequest injectPageSize(ListEndpointsRequest payload, int pageSize) { return ListEndpointsRequest.newBuilder(payload).setPageSize(pageSize).build(); } @Override public Integer extractPageSize(ListEndpointsRequest payload) { return payload.getPageSize(); } @Override public String extractNextToken(ListEndpointsResponse payload) { return payload.getNextPageToken(); } @Override public Iterable<Endpoint> extractResources(ListEndpointsResponse payload) { return payload.getEndpointsList() != null ? payload.getEndpointsList() : ImmutableList.<Endpoint>of(); } }; private static final PagedListResponseFactory< ListEndpointsRequest, ListEndpointsResponse, ListEndpointsPagedResponse> LIST_ENDPOINTS_PAGE_STR_FACT = new PagedListResponseFactory< ListEndpointsRequest, ListEndpointsResponse, ListEndpointsPagedResponse>() { @Override public ApiFuture<ListEndpointsPagedResponse> getFuturePagedResponse( UnaryCallable<ListEndpointsRequest, ListEndpointsResponse> callable, ListEndpointsRequest request, ApiCallContext context, ApiFuture<ListEndpointsResponse> futureResponse) { PageContext<ListEndpointsRequest, ListEndpointsResponse, Endpoint> pageContext = PageContext.create(callable, LIST_ENDPOINTS_PAGE_STR_DESC, request, context); return ListEndpointsPagedResponse.createAsync(pageContext, futureResponse); } }; /** Builder for EndpointServiceStubSettings. */ public static class Builder extends StubSettings.Builder<EndpointServiceStubSettings, Builder> { private final ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders; private final UnaryCallSettings.Builder<CreateEndpointRequest, Operation> createEndpointSettings; private final OperationCallSettings.Builder< CreateEndpointRequest, Endpoint, CreateEndpointOperationMetadata> createEndpointOperationSettings; private final UnaryCallSettings.Builder<GetEndpointRequest, Endpoint> getEndpointSettings; private final PagedCallSettings.Builder< ListEndpointsRequest, ListEndpointsResponse, ListEndpointsPagedResponse> listEndpointsSettings; private final UnaryCallSettings.Builder<UpdateEndpointRequest, Endpoint> updateEndpointSettings; private final UnaryCallSettings.Builder<DeleteEndpointRequest, Operation> deleteEndpointSettings; private final OperationCallSettings.Builder< DeleteEndpointRequest, Empty, DeleteOperationMetadata> deleteEndpointOperationSettings; private final UnaryCallSettings.Builder<DeployModelRequest, Operation> deployModelSettings; private final OperationCallSettings.Builder< DeployModelRequest, DeployModelResponse, DeployModelOperationMetadata> deployModelOperationSettings; private final UnaryCallSettings.Builder<UndeployModelRequest, Operation> undeployModelSettings; private final OperationCallSettings.Builder< UndeployModelRequest, UndeployModelResponse, UndeployModelOperationMetadata> undeployModelOperationSettings; private static final ImmutableMap<String, ImmutableSet<StatusCode.Code>> RETRYABLE_CODE_DEFINITIONS; static { ImmutableMap.Builder<String, ImmutableSet<StatusCode.Code>> definitions = ImmutableMap.builder(); definitions.put( "no_retry_2_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList())); definitions.put( "no_retry_4_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList())); definitions.put( "no_retry_6_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList())); definitions.put("no_retry_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList())); definitions.put( "no_retry_3_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList())); definitions.put( "no_retry_1_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList())); definitions.put( "no_retry_7_codes", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList())); definitions.put( "no_retry_5_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() .setInitialRpcTimeout(Duration.ofMillis(5000L)) .setRpcTimeoutMultiplier(1.0) .setMaxRpcTimeout(Duration.ofMillis(5000L)) .setTotalTimeout(Duration.ofMillis(5000L)) .build(); definitions.put("no_retry_3_params", settings); settings = RetrySettings.newBuilder().setRpcTimeoutMultiplier(1.0).build(); definitions.put("no_retry_params", settings); settings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(5000L)) .setRpcTimeoutMultiplier(1.0) .setMaxRpcTimeout(Duration.ofMillis(5000L)) .setTotalTimeout(Duration.ofMillis(5000L)) .build(); definitions.put("no_retry_5_params", settings); settings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(5000L)) .setRpcTimeoutMultiplier(1.0) .setMaxRpcTimeout(Duration.ofMillis(5000L)) .setTotalTimeout(Duration.ofMillis(5000L)) .build(); definitions.put("no_retry_1_params", settings); settings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(5000L)) .setRpcTimeoutMultiplier(1.0) .setMaxRpcTimeout(Duration.ofMillis(5000L)) .setTotalTimeout(Duration.ofMillis(5000L)) .build(); definitions.put("no_retry_4_params", settings); settings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(5000L)) .setRpcTimeoutMultiplier(1.0) .setMaxRpcTimeout(Duration.ofMillis(5000L)) .setTotalTimeout(Duration.ofMillis(5000L)) .build(); definitions.put("no_retry_2_params", settings); settings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(5000L)) .setRpcTimeoutMultiplier(1.0) .setMaxRpcTimeout(Duration.ofMillis(5000L)) .setTotalTimeout(Duration.ofMillis(5000L)) .build(); definitions.put("no_retry_6_params", settings); settings = RetrySettings.newBuilder() .setInitialRpcTimeout(Duration.ofMillis(5000L)) .setRpcTimeoutMultiplier(1.0) .setMaxRpcTimeout(Duration.ofMillis(5000L)) .setTotalTimeout(Duration.ofMillis(5000L)) .build(); definitions.put("no_retry_7_params", settings); RETRY_PARAM_DEFINITIONS = definitions.build(); } protected Builder() { this((ClientContext) null); } protected Builder(ClientContext clientContext) { super(clientContext); createEndpointSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); createEndpointOperationSettings = OperationCallSettings.newBuilder(); getEndpointSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); listEndpointsSettings = PagedCallSettings.newBuilder(LIST_ENDPOINTS_PAGE_STR_FACT); updateEndpointSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); deleteEndpointSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); deleteEndpointOperationSettings = OperationCallSettings.newBuilder(); deployModelSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); deployModelOperationSettings = OperationCallSettings.newBuilder(); undeployModelSettings = UnaryCallSettings.newUnaryCallSettingsBuilder(); undeployModelOperationSettings = OperationCallSettings.newBuilder(); unaryMethodSettingsBuilders = ImmutableList.<UnaryCallSettings.Builder<?, ?>>of( createEndpointSettings, getEndpointSettings, listEndpointsSettings, updateEndpointSettings, deleteEndpointSettings, deployModelSettings, undeployModelSettings); initDefaults(this); } 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 .createEndpointSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params")); builder .getEndpointSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params")); builder .listEndpointsSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params")); builder .updateEndpointSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params")); builder .deleteEndpointSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params")); builder .deployModelSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params")); builder .undeployModelSettings() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params")); builder .createEndpointOperationSettings() .setInitialCallSettings( UnaryCallSettings .<CreateEndpointRequest, OperationSnapshot>newUnaryCallSettingsBuilder() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Endpoint.class)) .setMetadataTransformer( ProtoOperationTransformers.MetadataTransformer.create( CreateEndpointOperationMetadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() .setInitialRetryDelay(Duration.ofMillis(500L)) .setRetryDelayMultiplier(1.5) .setMaxRetryDelay(Duration.ofMillis(5000L)) .setInitialRpcTimeout(Duration.ZERO) // ignored .setRpcTimeoutMultiplier(1.0) // ignored .setMaxRpcTimeout(Duration.ZERO) // ignored .setTotalTimeout(Duration.ofMillis(300000L)) .build())); builder .deleteEndpointOperationSettings() .setInitialCallSettings( UnaryCallSettings .<DeleteEndpointRequest, OperationSnapshot>newUnaryCallSettingsBuilder() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(Empty.class)) .setMetadataTransformer( ProtoOperationTransformers.MetadataTransformer.create(DeleteOperationMetadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() .setInitialRetryDelay(Duration.ofMillis(500L)) .setRetryDelayMultiplier(1.5) .setMaxRetryDelay(Duration.ofMillis(5000L)) .setInitialRpcTimeout(Duration.ZERO) // ignored .setRpcTimeoutMultiplier(1.0) // ignored .setMaxRpcTimeout(Duration.ZERO) // ignored .setTotalTimeout(Duration.ofMillis(300000L)) .build())); builder .deployModelOperationSettings() .setInitialCallSettings( UnaryCallSettings.<DeployModelRequest, OperationSnapshot>newUnaryCallSettingsBuilder() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(DeployModelResponse.class)) .setMetadataTransformer( ProtoOperationTransformers.MetadataTransformer.create( DeployModelOperationMetadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() .setInitialRetryDelay(Duration.ofMillis(500L)) .setRetryDelayMultiplier(1.5) .setMaxRetryDelay(Duration.ofMillis(5000L)) .setInitialRpcTimeout(Duration.ZERO) // ignored .setRpcTimeoutMultiplier(1.0) // ignored .setMaxRpcTimeout(Duration.ZERO) // ignored .setTotalTimeout(Duration.ofMillis(300000L)) .build())); builder .undeployModelOperationSettings() .setInitialCallSettings( UnaryCallSettings .<UndeployModelRequest, OperationSnapshot>newUnaryCallSettingsBuilder() .setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("no_retry_2_codes")) .setRetrySettings(RETRY_PARAM_DEFINITIONS.get("no_retry_2_params")) .build()) .setResponseTransformer( ProtoOperationTransformers.ResponseTransformer.create(UndeployModelResponse.class)) .setMetadataTransformer( ProtoOperationTransformers.MetadataTransformer.create( UndeployModelOperationMetadata.class)) .setPollingAlgorithm( OperationTimedPollAlgorithm.create( RetrySettings.newBuilder() .setInitialRetryDelay(Duration.ofMillis(500L)) .setRetryDelayMultiplier(1.5) .setMaxRetryDelay(Duration.ofMillis(5000L)) .setInitialRpcTimeout(Duration.ZERO) // ignored .setRpcTimeoutMultiplier(1.0) // ignored .setMaxRpcTimeout(Duration.ZERO) // ignored .setTotalTimeout(Duration.ofMillis(300000L)) .build())); return builder; } protected Builder(EndpointServiceStubSettings settings) { super(settings); createEndpointSettings = settings.createEndpointSettings.toBuilder(); createEndpointOperationSettings = settings.createEndpointOperationSettings.toBuilder(); getEndpointSettings = settings.getEndpointSettings.toBuilder(); listEndpointsSettings = settings.listEndpointsSettings.toBuilder(); updateEndpointSettings = settings.updateEndpointSettings.toBuilder(); deleteEndpointSettings = settings.deleteEndpointSettings.toBuilder(); deleteEndpointOperationSettings = settings.deleteEndpointOperationSettings.toBuilder(); deployModelSettings = settings.deployModelSettings.toBuilder(); deployModelOperationSettings = settings.deployModelOperationSettings.toBuilder(); undeployModelSettings = settings.undeployModelSettings.toBuilder(); undeployModelOperationSettings = settings.undeployModelOperationSettings.toBuilder(); unaryMethodSettingsBuilders = ImmutableList.<UnaryCallSettings.Builder<?, ?>>of( createEndpointSettings, getEndpointSettings, listEndpointsSettings, updateEndpointSettings, deleteEndpointSettings, deployModelSettings, undeployModelSettings); } // 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 createEndpoint. */ public UnaryCallSettings.Builder<CreateEndpointRequest, Operation> createEndpointSettings() { return createEndpointSettings; } /** Returns the builder for the settings used for calls to createEndpoint. */ @BetaApi( "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder< CreateEndpointRequest, Endpoint, CreateEndpointOperationMetadata> createEndpointOperationSettings() { return createEndpointOperationSettings; } /** Returns the builder for the settings used for calls to getEndpoint. */ public UnaryCallSettings.Builder<GetEndpointRequest, Endpoint> getEndpointSettings() { return getEndpointSettings; } /** Returns the builder for the settings used for calls to listEndpoints. */ public PagedCallSettings.Builder< ListEndpointsRequest, ListEndpointsResponse, ListEndpointsPagedResponse> listEndpointsSettings() { return listEndpointsSettings; } /** Returns the builder for the settings used for calls to updateEndpoint. */ public UnaryCallSettings.Builder<UpdateEndpointRequest, Endpoint> updateEndpointSettings() { return updateEndpointSettings; } /** Returns the builder for the settings used for calls to deleteEndpoint. */ public UnaryCallSettings.Builder<DeleteEndpointRequest, Operation> deleteEndpointSettings() { return deleteEndpointSettings; } /** Returns the builder for the settings used for calls to deleteEndpoint. */ @BetaApi( "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder<DeleteEndpointRequest, Empty, DeleteOperationMetadata> deleteEndpointOperationSettings() { return deleteEndpointOperationSettings; } /** Returns the builder for the settings used for calls to deployModel. */ public UnaryCallSettings.Builder<DeployModelRequest, Operation> deployModelSettings() { return deployModelSettings; } /** Returns the builder for the settings used for calls to deployModel. */ @BetaApi( "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder< DeployModelRequest, DeployModelResponse, DeployModelOperationMetadata> deployModelOperationSettings() { return deployModelOperationSettings; } /** Returns the builder for the settings used for calls to undeployModel. */ public UnaryCallSettings.Builder<UndeployModelRequest, Operation> undeployModelSettings() { return undeployModelSettings; } /** Returns the builder for the settings used for calls to undeployModel. */ @BetaApi( "The surface for use by generated code is not stable yet and may change in the future.") public OperationCallSettings.Builder< UndeployModelRequest, UndeployModelResponse, UndeployModelOperationMetadata> undeployModelOperationSettings() { return undeployModelOperationSettings; } @Override public EndpointServiceStubSettings build() throws IOException { return new EndpointServiceStubSettings(this); } } }
[ "chingor@google.com" ]
chingor@google.com
cf955d1c3af01d24855eec224ba5791c08999b0b
b1545e356338f02cc1b4d1981ecef66648a6dfbf
/Inventory/app/src/main/java/com/example/priyankanandiraju/inventory/data/InventoryProvider.java
f7c7fe1d88d0e91acc0e091c97620576d8883c29
[]
no_license
nandirajupriyanka/android-basic-nano-degree-program_projects
a11a8decf2e60e382c93ee804ba5880f625ac6f1
1919475bf8a5876108e7f5db9d0643f7f70649be
refs/heads/master
2021-01-21T06:38:27.949096
2017-02-27T02:34:22
2017-02-27T02:34:22
83,260,187
0
0
null
null
null
null
UTF-8
Java
false
false
8,520
java
package com.example.priyankanandiraju.inventory.data; import android.content.ContentProvider; import android.content.ContentUris; import android.content.ContentValues; import android.content.UriMatcher; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.net.Uri; import android.support.annotation.Nullable; import android.util.Log; import com.example.priyankanandiraju.inventory.data.InventoryContract.InventoryEvent; /** * Created by priyankanandiraju on 1/19/17. */ public class InventoryProvider extends ContentProvider { public static final String LOG_TAG = InventoryProvider.class.getSimpleName(); private static final int INVENTORY = 100; private static final int INVENTORY_ITEM = 200; private static final UriMatcher sUriMatcher = new UriMatcher(UriMatcher.NO_MATCH); static { sUriMatcher.addURI(InventoryContract.CONTENT_AUTHORITY, InventoryContract.PATH_INVENTORY, INVENTORY); sUriMatcher.addURI(InventoryContract.CONTENT_AUTHORITY, InventoryContract.PATH_INVENTORY + "/#", INVENTORY_ITEM); } private InventoryDbHelper mDbHelper; @Override public boolean onCreate() { mDbHelper = InventoryDbHelper.getInstance(getContext()); return true; } @Nullable @Override public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) { SQLiteDatabase database = mDbHelper.getReadableDatabase(); Cursor cursor; int match = sUriMatcher.match(uri); switch (match) { case INVENTORY: cursor = database.query(InventoryEvent.TABLE_NAME, projection, selection, selectionArgs, null, null, sortOrder); break; case INVENTORY_ITEM: selection = InventoryEvent._ID + "=?"; selectionArgs = new String[]{String.valueOf(ContentUris.parseId(uri))}; cursor = database.query(InventoryEvent.TABLE_NAME, projection, selection, selectionArgs, null, null, sortOrder); break; default: throw new IllegalArgumentException("Cannot query unknown URI " + uri); } cursor.setNotificationUri(getContext().getContentResolver(), uri); return cursor; } @Nullable @Override public String getType(Uri uri) { final int match = sUriMatcher.match(uri); switch (match) { case INVENTORY: return InventoryEvent.CONTENT_LIST_TYPE; case INVENTORY_ITEM: return InventoryEvent.CONTENT_ITEM_TYPE; default: throw new IllegalStateException("Unknown URI " + uri + " with match " + match); } } @Nullable @Override public Uri insert(Uri uri, ContentValues values) { final int match = sUriMatcher.match(uri); switch (match) { case INVENTORY: return insertInventory(uri, values); default: throw new IllegalArgumentException("Insertion is not supported for " + uri); } } private Uri insertInventory(Uri uri, ContentValues values) { Integer image = values.getAsInteger(InventoryEvent.COLUMN_INVENTORY_IMAGE); if (image == null) { throw new IllegalArgumentException("Inventory requires a image"); } String name = values.getAsString(InventoryEvent.COLUMN_INVENTORY_NAME); if (name == null) { throw new IllegalArgumentException("Inventory requires a name"); } Integer quantity = values.getAsInteger(InventoryEvent.COLUMN_INVENTORY_QUANTITY); if (quantity == null) { throw new IllegalArgumentException("Inventory requires valid quantity"); } Integer price = values.getAsInteger(InventoryEvent.COLUMN_INVENTORY_PRICE); if (price != null && price < 0) { throw new IllegalArgumentException("Inventory requires valid price"); } String supplier = values.getAsString(InventoryEvent.COLUMN_INVENTORY_SUPPLIER); if (supplier == null) { throw new IllegalArgumentException("Inventory requires a supplier"); } SQLiteDatabase database = mDbHelper.getWritableDatabase(); long id = database.insert(InventoryEvent.TABLE_NAME, null, values); if (id == -1) { Log.e(LOG_TAG, "Failed to insert row for " + uri); return null; } getContext().getContentResolver().notifyChange(uri, null); return ContentUris.withAppendedId(uri, id); } @Override public int delete(Uri uri, String selection, String[] selectionArgs) { SQLiteDatabase database = mDbHelper.getWritableDatabase(); int rowsDeleted; final int match = sUriMatcher.match(uri); switch (match) { case INVENTORY: // Delete all rows that match the selection and selection args rowsDeleted = database.delete(InventoryEvent.TABLE_NAME, selection, selectionArgs); break; case INVENTORY_ITEM: // Delete a single row given by the ID in the URI selection = InventoryEvent._ID + "=?"; selectionArgs = new String[]{String.valueOf(ContentUris.parseId(uri))}; rowsDeleted = database.delete(InventoryEvent.TABLE_NAME, selection, selectionArgs); break; default: throw new IllegalArgumentException("Deletion is not supported for " + uri); } if (rowsDeleted != 0) { getContext().getContentResolver().notifyChange(uri, null); } return rowsDeleted; } @Override public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) { final int match = sUriMatcher.match(uri); switch (match) { case INVENTORY: return updateInventory(uri, values, selection, selectionArgs); case INVENTORY_ITEM: selection = InventoryEvent._ID + "=?"; selectionArgs = new String[]{String.valueOf(ContentUris.parseId(uri))}; return updateInventory(uri, values, selection, selectionArgs); default: throw new IllegalArgumentException("Update is not supported for " + uri); } } private int updateInventory(Uri uri, ContentValues values, String selection, String[] selectionArgs) { if (values.containsKey(InventoryEvent.COLUMN_INVENTORY_IMAGE)) { Integer image = values.getAsInteger(InventoryEvent.COLUMN_INVENTORY_IMAGE); if (image == null) { throw new IllegalArgumentException("Inventory requires a image"); } } if (values.containsKey(InventoryEvent.COLUMN_INVENTORY_NAME)) { String name = values.getAsString(InventoryEvent.COLUMN_INVENTORY_NAME); if (name == null) { throw new IllegalArgumentException("Inventory requires a name"); } } if (values.containsKey(InventoryEvent.COLUMN_INVENTORY_QUANTITY)) { Integer quantity = values.getAsInteger(InventoryEvent.COLUMN_INVENTORY_QUANTITY); if (quantity == null) { throw new IllegalArgumentException("Inventory requires valid quantity"); } } if (values.containsKey(InventoryEvent.COLUMN_INVENTORY_PRICE)) { Integer price = values.getAsInteger(InventoryEvent.COLUMN_INVENTORY_PRICE); if (price != null && price < 0) { throw new IllegalArgumentException("Inventory requires valid price"); } } if (values.containsKey(InventoryEvent.COLUMN_INVENTORY_SUPPLIER)) { String supplier = values.getAsString(InventoryEvent.COLUMN_INVENTORY_SUPPLIER); if (supplier == null) { throw new IllegalArgumentException("Inventory requires a supplier"); } } if (values.size() == 0) { return 0; } SQLiteDatabase database = mDbHelper.getWritableDatabase(); int rowsUpdated = database.update(InventoryEvent.TABLE_NAME, values, selection, selectionArgs); if (rowsUpdated != 0) { getContext().getContentResolver().notifyChange(uri, null); } return rowsUpdated; } }
[ "priyankanandiraju@Priyankas-MacBook-Pro-2.local" ]
priyankanandiraju@Priyankas-MacBook-Pro-2.local
7fcd83468aeb6f08e699d434103c9a2431eaaf69
48e835e6f176a8ac9ae3ca718e8922891f1e5a18
/benchmark/training/org/apache/avro/codegentest/TestLogicalTypesWithDefaults.java
9b91d77998f642a407f3606f699263c81189f8d7
[]
no_license
STAMP-project/dspot-experiments
f2c7a639d6616ae0adfc491b4cb4eefcb83d04e5
121487e65cdce6988081b67f21bbc6731354a47f
refs/heads/master
2023-02-07T14:40:12.919811
2019-11-06T07:17:09
2019-11-06T07:17:09
75,710,758
14
19
null
2023-01-26T23:57:41
2016-12-06T08:27:42
null
UTF-8
Java
false
false
2,198
java
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.avro.codegentest; import java.io.IOException; import org.apache.avro.codegentest.testdata.LogicalTypesWithDefaults; import org.joda.time.LocalDate; import org.junit.Assert; import org.junit.Test; public class TestLogicalTypesWithDefaults extends AbstractSpecificRecordTest { private static final LocalDate DEFAULT_VALUE = LocalDate.parse("1973-05-19"); @Test public void testDefaultValueOfNullableField() throws IOException { LogicalTypesWithDefaults instanceOfGeneratedClass = LogicalTypesWithDefaults.newBuilder().setNonNullDate(LocalDate.now()).build(); verifySerDeAndStandardMethods(instanceOfGeneratedClass); } @Test public void testDefaultValueOfNonNullField() throws IOException { LogicalTypesWithDefaults instanceOfGeneratedClass = LogicalTypesWithDefaults.newBuilder().setNullableDate(LocalDate.now()).build(); Assert.assertEquals(TestLogicalTypesWithDefaults.DEFAULT_VALUE, instanceOfGeneratedClass.getNonNullDate()); verifySerDeAndStandardMethods(instanceOfGeneratedClass); } @Test public void testWithValues() throws IOException { LogicalTypesWithDefaults instanceOfGeneratedClass = LogicalTypesWithDefaults.newBuilder().setNullableDate(LocalDate.now()).setNonNullDate(LocalDate.now()).build(); verifySerDeAndStandardMethods(instanceOfGeneratedClass); } }
[ "benjamin.danglot@inria.fr" ]
benjamin.danglot@inria.fr
12c6434f0c82bca092e379b10ad33cc349f0fa09
5ae53eb2f091444fe021c0d1d53a27e2f6469cc2
/src/main/java/org/struts2sifat/dao/JoinSampleDao.java
3b1037883d5223e65cebec1ca891f866d5e41a20
[]
no_license
masudjbd/Struts2MySifat
56f724d234d06f010d23dd90f81371a6eb4798da
a6b38b405940a9dfcb7497bfb5dd0c008a0ee55e
refs/heads/master
2021-01-10T07:16:00.659588
2015-05-31T07:46:29
2015-05-31T07:46:29
36,593,015
0
0
null
null
null
null
UTF-8
Java
false
false
5,449
java
package org.struts2sifat.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.ArrayList; import java.util.List; import javax.naming.NamingException; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.struts2sifat.common.Common; import org.struts2sifat.entity.JoinDataEntity; public class JoinSampleDao extends CommonDao { /** */ private Log log = LogFactory.getLog(this.getClass()); /** * Constructor * */ public JoinSampleDao() throws NamingException { super(); } /** */ public List<JoinDataEntity> selectJoinData(String id) throws Exception { log.debug("Test "); boolean idIsExist = false; if (!Common.IsNullOrEmpty(id)) { idIsExist = true; } Connection con = super.getConnection(); PreparedStatement pstmt = null; ResultSet rs = null; List<JoinDataEntity> list = null; try { // String SQL = "select event_id, user_name, mailaddress, key, comment, cancel_flg, updt_date from T_Test; "; StringBuffer sbSQL = new StringBuffer(); sbSQL.append("select event_id, user_name, mailaddress, key, comment, cancel_flg, updt_date from T_PERSON"); if (idIsExist) { sbSQL.append(" where event_id = ? "); } pstmt = con.prepareStatement(sbSQL.toString()); //pstmt.setQueryTimeout(CommonDao.getSqlExcuteTimeout()); if (idIsExist) { pstmt.setString(1, id); } rs = pstmt.executeQuery(); // Iterate through the data in the result set and display it. while (rs.next()) { if (list == null) { list = new ArrayList<JoinDataEntity>(); } JoinDataEntity tdEntitiy = null; tdEntitiy = new JoinDataEntity(); tdEntitiy.setEvent_id(rs.getString("event_id")); tdEntitiy.setUser_name(rs.getString("user_name")); tdEntitiy.setMailaddress(rs.getString("mailaddress")); tdEntitiy.setKey(rs.getString("key")); tdEntitiy.setComment(rs.getString("comment")); tdEntitiy.setCancel_flg(rs.getBoolean("cancel_flg")); tdEntitiy.setUpdt_date(rs.getDate("updt_date")); list.add(tdEntitiy); } } finally { if (rs != null) { try { rs.close(); } catch (Exception e) { } } if (pstmt != null) { try { pstmt.close(); } catch (Exception e) { } } if (con != null) { try { con.close(); } catch (Exception e) { } } } return list; } public int registJoinData(JoinDataEntity tdEntity) throws Exception { log.debug("Test "); Connection con = super.getConnection(); PreparedStatement pstmt = null; int rs = 0; try { String SQL = "INSERT INTO t_join (event_id, user_name, mailaddress, key, comment, cancel_flg, updt_date) VALUES (?, ?, ?, ?, ?, ?, ?);"; //String SQL = "select event_id, user_name, mailaddress, key, comment, cancel_flg, updt_date from t_join; "; pstmt = con.prepareStatement(SQL); // pstmt.setQueryTimeout(CommonDao.getSqlExcuteTimeout()); pstmt.setString(1, tdEntity.getEvent_id()); pstmt.setString(2, tdEntity.getUser_name()); pstmt.setString(3, tdEntity.getMailaddress()); pstmt.setString(4, tdEntity.getKey()); pstmt.setString(5, tdEntity.getComment()); pstmt.setBoolean(6, tdEntity.getCancel_flg()); pstmt.setDate(7, new java.sql.Date(tdEntity.getUpdt_date().getTime())); // Insert, Update executeUpdate rs = pstmt.executeUpdate(); } finally { if (pstmt != null) { try { pstmt.close(); } catch (Exception e) { } } if (con != null) { try { con.close(); } catch (Exception e) { } } } System.out.println("**** SampleDAO.registJoinData " + rs + " ****"); return rs; } /** * public int updateTestData(TestDataEntity tdEntity) throws Exception { Connection con = super.getConnection(); PreparedStatement pstmt = null; int rs = 0; try { String SQL = "UPDATE T_PERSON SET name = ?, age = ?, location = ?, updt_date = ? WHERE person_id = ?;"; //String SQL = "select person_id, name, age, loaction, updt_date from T_Test; "; pstmt = con.prepareStatement(SQL); // pstmt.setQueryTimeout(CommonDao.getSqlExcuteTimeout()); pstmt.setString(1, tdEntity.getName()); pstmt.setInt(2, tdEntity.getAge()); pstmt.setString(3, tdEntity.getLocation()); pstmt.setDate(4, new java.sql.Date(tdEntity.getUpdt_date().getTime())); pstmt.setString(5, tdEntity.getPerson_id()); rs = pstmt.executeUpdate(); } finally { if (pstmt != null) { try { pstmt.close(); } catch (Exception e) { } } if (con != null) { try { con.close(); } catch (Exception e) { } } } return rs; } */ /** public int deleteTestData(String person_id) throws Exception { Connection con = super.getConnection(); PreparedStatement pstmt = null; int rs = 0; try { String SQL = "DELETE FROM T_PERSON WHERE person_id = ?;"; //String SQL = "select person_id, name, age, location, updt_date from T_Test; "; pstmt = con.prepareStatement(SQL); // pstmt.setQueryTimeout(CommonDao.getSqlExcuteTimeout()); pstmt.setString(1, person_id); // Insert, UpdateはexecuteUpdate rs = pstmt.executeUpdate(); } finally { if (pstmt != null) { try { pstmt.close(); } catch (Exception e) { } } if (con != null) { try { con.close(); } catch (Exception e) { } } } return rs; } */ }
[ "masudjbd@gmail.com" ]
masudjbd@gmail.com
acb5828f77f90aa089bd8162f833ca6aefbd3f66
89dc7dfa4bfb75e9f837d2b35c1308d6d85baf78
/src/main/java/com/hxqh/eam/model/Openstreetmap2.java
4ff9519c93af91773f5b9f76a5d5dc3f49372279
[]
no_license
HyChangChen/DashBoard
5a25c462dd4e476b62a69c0debd83ecc723353c8
95f0e92504ba15a6bbdf068ec9fdbc9dd664e786
refs/heads/master
2021-07-12T08:24:42.166088
2017-10-18T13:40:29
2017-10-18T13:40:29
107,292,232
3
0
null
null
null
null
UTF-8
Java
false
false
1,301
java
package com.hxqh.eam.model; import java.io.Serializable; import javax.persistence.*; /** * The persistent class for the OPENSTREETMAP2 database table. * */ @Entity @Table(name = "OPENSTREETMAP2") public class Openstreetmap2 implements Serializable { private static final long serialVersionUID = 1L; private String description; private String mapx; private String mapy; private String name; @Id private String openstreetmapid; @Column(name="\"TYPE\"") private String type; public Openstreetmap2() { } public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } public String getMapx() { return this.mapx; } public void setMapx(String mapx) { this.mapx = mapx; } public String getMapy() { return this.mapy; } public void setMapy(String mapy) { this.mapy = mapy; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getOpenstreetmapid() { return this.openstreetmapid; } public void setOpenstreetmapid(String openstreetmapid) { this.openstreetmapid = openstreetmapid; } public String getType() { return this.type; } public void setType(String type) { this.type = type; } }
[ "he88012512@163.com" ]
he88012512@163.com
4c1bfdec29013b41cf92cd1f3e0764c41882b5ef
1f1abe44bd0ef8b24703fc631a89cb5cb64c7af0
/app/src/main/java/com/idealist/www/useopencvwithcmake/utils/GenerateQRTask.java
6c041deccf024bd4a605631667468d37b653c85e
[]
no_license
parkcsm/Debat_Chat
92a51fc72d556c50ca6b712d9ad8c3307313498d
1ba02fae2a634155738e18d15f71b7e95ddc3c4a
refs/heads/master
2022-02-11T09:13:11.739215
2019-07-13T12:06:10
2019-07-13T12:06:10
194,493,172
1
0
null
null
null
null
UTF-8
Java
false
false
2,408
java
package com.idealist.www.useopencvwithcmake.utils; import android.graphics.Bitmap; import android.os.AsyncTask; import android.widget.ImageView; import com.google.zxing.BarcodeFormat; import com.google.zxing.MultiFormatWriter; import com.google.zxing.WriterException; import com.google.zxing.common.BitMatrix; import com.idealist.www.useopencvwithcmake.interfaces.IGenerateQR; /** * Created by alex on 24/07/2017. */ public class GenerateQRTask extends AsyncTask<Void,Void,Bitmap> { private String mQRcode; private IGenerateQR igenerateQR = null; private ImageView iv; private Bitmap bitmap; public static int white = 0xFFFFFFFF; public static int black = 0xFF000000; public final static int QRcodeWidth = 500 ; public GenerateQRTask(String qrCode,IGenerateQR igenerateQR){ this.igenerateQR = igenerateQR; mQRcode = qrCode; //this.iv = iv; } @Override protected Bitmap doInBackground(Void... params) { try { //bitmap = TextToImageEncode(qrCode); bitmap = encodeAsBitmap(mQRcode); //igenerateQR.onPostExecute(bitmap); } catch (WriterException e) { e.printStackTrace(); } return null; } @Override public void onPostExecute(Bitmap returned_bitmap) { try { if(this.igenerateQR != null) this.igenerateQR.onPostExecute(this.bitmap); } catch(Exception e) { String a = e.getMessage(); } //task.cancel(true); } private Bitmap encodeAsBitmap(String str) throws WriterException { BitMatrix result; try { result = new MultiFormatWriter().encode(str, BarcodeFormat.QR_CODE, QRcodeWidth, QRcodeWidth, null); } catch (IllegalArgumentException iae) { // Unsupported format return null; } int w = result.getWidth(); int h = result.getHeight(); int[] pixels = new int[w * h]; for (int y = 0; y < h; y++) { int offset = y * w; for (int x = 0; x < w; x++) { pixels[offset + x] = result.get(x, y) ? black:white; } } Bitmap bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888); bitmap.setPixels(pixels, 0, QRcodeWidth, 0, 0, w, h); return bitmap; } }
[ "parkcsm10@gmail.com" ]
parkcsm10@gmail.com
99d0eadf3a3d7d8864fda366f4570368b6b4032c
8cb831145220252829b75875d5263b2b9d0fca34
/src/main/java/networking/MulticastServer.java
06aa50af818f7a4625bbf9268203262634ab8476
[]
no_license
32ravi/research
c4bf85f8c30ae441c4e17d08dfec06ec6f28ef74
ff9580a9165fa873487895b3a54b0d5b0eba47e9
refs/heads/master
2021-01-21T06:39:47.238686
2017-03-28T03:17:34
2017-03-28T03:17:34
83,266,880
0
0
null
null
null
null
UTF-8
Java
false
false
176
java
package networking; public class MulticastServer { public static void main(String[] args) throws java.io.IOException { new MulticastServerThread().start(); } }
[ "32ravi@outlook.com" ]
32ravi@outlook.com
7369292ec2fe3aae084474e248dca06717ee4b88
0cbacc3e017f49ba53873d39afdc0436ded35e6b
/src/test/java/hello/core/beanfind/ApplicationContextExtendsFindTest.java
ab3d68e4f13ea60364d52d84a0f9b8cc0e6e513a
[]
no_license
constantoh/core
b623f384b71de5b353849412f4037dabcf38b515
d61f370e060827878e03657906ed5c5f02f8405c
refs/heads/master
2023-05-11T07:31:39.299790
2021-06-01T23:44:48
2021-06-01T23:44:48
360,217,382
0
0
null
null
null
null
UTF-8
Java
false
false
2,940
java
package hello.core.beanfind; import hello.core.AppConfig; import hello.core.discount.DiscountPolicy; import hello.core.discount.FixDiscountPolicy; import hello.core.discount.RateDiscountPolicy; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.NoUniqueBeanDefinitionException; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import java.util.Map; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; public class ApplicationContextExtendsFindTest { AnnotationConfigApplicationContext ac = new AnnotationConfigApplicationContext(TestConfig.class); @Test @DisplayName("부모 타입으로 조회시, 자식이 둘 이상이 있으면 중복 오류가 난다.") void findBeanByParentTypeDuplicate() { // DiscountPolicy bean = ac.getBean(DiscountPolicy.class); assertThrows(NoUniqueBeanDefinitionException.class, () -> ac.getBean(DiscountPolicy.class)); } @Test @DisplayName("부모 타입으로 조회시, 자식이 둘 이상이 있으면 중복 오류가 난다.") void findBeanByParentTypeBeanName() { DiscountPolicy rateDiscountPolicy = ac.getBean("rateDiscountPolicy", DiscountPolicy.class); assertThat(rateDiscountPolicy).isInstanceOf(RateDiscountPolicy.class); } @Test @DisplayName("특정 하위 타입으로 조회") // -> 구현체를 직접 코딩하는것은 지양 void findBeanBySubType() { DiscountPolicy rateDiscountPolicy = ac.getBean(RateDiscountPolicy.class); assertThat(rateDiscountPolicy).isInstanceOf(RateDiscountPolicy.class); } @Test @DisplayName("부모 타입으로 모두 조회하기") void findAllBeanByParentType() { Map<String, DiscountPolicy> beansOfType = ac.getBeansOfType(DiscountPolicy.class); assertThat(beansOfType.size()).isEqualTo(2); for (String key : beansOfType.keySet()) { System.out.println("key = " + key + ", value = " + beansOfType.get(key)); } } @Test @DisplayName("부모 타입으로 모두 조회하기 - Object") void findAllBeanByObjectType() { Map<String, Object> beansOfType = ac.getBeansOfType(Object.class); for (String key : beansOfType.keySet()) { System.out.println("key = " + key + ", value = " + beansOfType.get(key)); } } @Configuration static class TestConfig { @Bean public DiscountPolicy rateDiscountPolicy() { return new RateDiscountPolicy(); } @Bean public DiscountPolicy fixDiscountPolicy() { return new FixDiscountPolicy(); } } }
[ "ohconstant@naver.com" ]
ohconstant@naver.com
b699c208fae9f95b286ac27549545da964ad23be
44672c61d224e4ed81199b454c850fdf86d3f6c9
/config-server/src/main/java/com/stackroute/configserver/ConfigServerApplication.java
34c6dd26a48cebe59c75d4e9e4281c89bd8a9461
[]
no_license
rajender97/MicroService
1e712b84db03b85cc01bb7e28448bd08e0801af5
96abe41120cd4545a53747c6cdfb52c189cb48dc
refs/heads/master
2020-08-24T01:54:45.545340
2019-10-22T06:54:10
2019-10-22T06:54:10
216,721,093
0
0
null
null
null
null
UTF-8
Java
false
false
419
java
package com.stackroute.configserver; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.config.server.EnableConfigServer; @EnableConfigServer @SpringBootApplication public class ConfigServerApplication { public static void main(String[] args) { SpringApplication.run(ConfigServerApplication.class, args); } }
[ "nayak3539@gmail.com" ]
nayak3539@gmail.com
fb0e6131523be42272f0dc8b35766b2375f6ad6e
435db7ddfceb525c40c9ac6e08178c1fc0e68e54
/LoginApiTestTotal/app/src/androidTest/java/com/example/loginapitest/ExampleInstrumentedTest.java
dcb9fdba7454f895a7fb5c9f2b3477bc73df8707
[]
no_license
AndroidMnS/MammamiaRnD
ec92be4c57ed7a3b16f967f27e60060a31c6193a
c9d63632d4328ef38add05229a62613bb883e2c3
refs/heads/master
2023-02-11T18:13:43.368912
2020-12-30T11:40:49
2020-12-30T11:40:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
762
java
package com.example.loginapitest; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.loginapitest", appContext.getPackageName()); } }
[ "godol811@naver.com" ]
godol811@naver.com
85eff48f8404cdfaea5e43c8e79718bff51c8434
e6c97b3c5ee8bda597cdd9fff288d8bcf5efd775
/src/main/java/com/hal/stun/message/StunMessage.java
8eb956f5b7198db0307e7b98b686ce82de157bd5
[]
no_license
abvdasker/Stunner
588c364eff5750808baef2c92c316b3de12f4713
5e15f3d69d788bbdedeff8ae60b7404a76e408b0
refs/heads/master
2021-01-16T23:49:35.963890
2017-01-16T08:40:27
2017-01-16T08:40:27
32,775,122
10
4
null
null
null
null
UTF-8
Java
false
false
1,370
java
package com.hal.stun.message; import com.hal.stun.message.attribute.StunAttribute; import java.util.List; import java.net.InetSocketAddress; public abstract class StunMessage { protected StunHeader header; protected List<StunAttribute> attributes; protected InetSocketAddress address; public StunHeader getHeader() { return header; } abstract public byte[] getBytes(); public List<StunAttribute> getAttributes() { return attributes; } public InetSocketAddress getAddress() { return address; } protected static byte[] getHeaderBytes(byte[] message) throws StunParseException { if (message.length < StunHeader.HEADER_SIZE) { throw new StunParseException("message was smaller than header size. Header must be 20 bytes"); } byte[] header = new byte[StunHeader.HEADER_SIZE]; System.arraycopy(message, 0, header, 0, header.length); return header; } private static byte[] getAttributesBytes(byte[] message) throws StunParseException { byte[] attributesBytes = new byte[message.length - StunHeader.HEADER_SIZE]; System.arraycopy(message, 20, attributesBytes, 0, attributesBytes.length); return attributesBytes; } public String toString() { return StunMessageFormatter.formatMessage(this); } }
[ "hal.c.rogers@gmail.com" ]
hal.c.rogers@gmail.com
9fc74f8774d955bebd1eec35d8621489baa9998f
ebafbaaf156fe563f565301704b88ad64719aef4
/controllersvc/src/main/java/com/emc/storageos/volumecontroller/impl/plugins/discovery/smis/processor/ibm/xiv/XIVStorageConfigurationCapabilitiesProcessor.java
efd05dcf6b9faf08e589323eac24749a27553f5f
[]
no_license
SuzyWu2014/coprhd-controller
086ae1043c2c0fefd644e7d4192c982ffbeda533
5a5e0ecc1d54cd387514f588768e2a918c819aa7
refs/heads/master
2021-01-21T09:42:31.339289
2016-09-30T19:21:02
2016-09-30T19:21:02
46,948,031
1
0
null
2015-11-26T21:45:46
2015-11-26T21:45:46
null
UTF-8
Java
false
false
3,667
java
/* * Copyright (c) 2008-2014 EMC Corporation * All Rights Reserved */ package com.emc.storageos.volumecontroller.impl.plugins.discovery.smis.processor.ibm.xiv; import java.util.Arrays; import java.util.Iterator; import java.util.Map; import javax.cim.CIMInstance; import javax.cim.UnsignedInteger16; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.emc.storageos.db.client.DbClient; import com.emc.storageos.db.client.model.StorageSystem; import com.emc.storageos.db.client.model.StorageSystem.SupportedProvisioningTypes; import com.emc.storageos.plugins.AccessProfile; import com.emc.storageos.plugins.BaseCollectionException; import com.emc.storageos.plugins.common.Constants; import com.emc.storageos.plugins.common.Processor; import com.emc.storageos.plugins.common.domainmodel.Operation; public class XIVStorageConfigurationCapabilitiesProcessor extends Processor { private Logger _logger = LoggerFactory .getLogger(XIVStorageConfigurationCapabilitiesProcessor.class); private static final String SUPPORTED_ELEMENT_TYPES = "SupportedStorageElementTypes"; private static final String THIN_VOLUME_SUPPORTED = "5"; private static final String THICK_VOLUME_SUPPORTED = "2"; private DbClient _dbClient; private AccessProfile _profile = null; @Override public void processResult(Operation operation, Object resultObj, Map<String, Object> keyMap) throws BaseCollectionException { @SuppressWarnings("unchecked") final Iterator<CIMInstance> it = (Iterator<CIMInstance>) resultObj; _profile = (AccessProfile) keyMap.get(Constants.ACCESSPROFILE); _dbClient = (DbClient) keyMap.get(Constants.dbClient); try { StorageSystem system = _dbClient.queryObject(StorageSystem.class, _profile.getSystemId()); while (it.hasNext()) { CIMInstance storageConfigurationInstance = it.next(); UnsignedInteger16[] supportedElementTypeArr = (UnsignedInteger16[]) storageConfigurationInstance .getPropertyValue(SUPPORTED_ELEMENT_TYPES); String supportedElementTypes = Arrays .toString(supportedElementTypeArr); if (_logger.isDebugEnabled()) { _logger.debug("Capability:" + supportedElementTypes); } if (supportedElementTypes.contains(THIN_VOLUME_SUPPORTED) && supportedElementTypes .contains(THICK_VOLUME_SUPPORTED)) { system.setSupportedProvisioningType(SupportedProvisioningTypes.THIN_AND_THICK .name()); } else if (supportedElementTypes .contains(THIN_VOLUME_SUPPORTED)) { system.setSupportedProvisioningType(SupportedProvisioningTypes.THIN .name()); } else if (supportedElementTypes .contains(THICK_VOLUME_SUPPORTED)) { system.setSupportedProvisioningType(SupportedProvisioningTypes.THICK .name()); } else { system.setSupportedProvisioningType(SupportedProvisioningTypes.NONE .name()); } break; // should have only one instance } _dbClient.persistObject(system); } catch (Exception e) { _logger.error( "Finding out Storage System Capability on Volume Creation failed: ", e); } } }
[ "review-coprhd@coprhd.org" ]
review-coprhd@coprhd.org
ec8ae0a4d677a6d93b97c5f9d5d2caa58902e999
3fcdca1ea49c02188eb1d9e253f47cbb49380833
/fin_dev/fin.scfw/fin.mkmm-sales/src/main/java/com/yqjr/fin/mkmm/sales/services/ActiveMainService.java
5abad154d6a14c977a1313f83e066d4f6a671c03
[]
no_license
jsdelivrbot/yqjr
f13f50dc765b1c7aa7ad513ee455c9380ab3d7c6
08c7182c3d4dcc303f512b55b4405266dd3ad66c
refs/heads/master
2020-04-10T13:50:37.840713
2018-12-09T11:08:44
2018-12-09T11:08:44
161,060,607
0
0
null
null
null
null
UTF-8
Java
false
false
25,638
java
package com.yqjr.fin.mkmm.sales.services; import com.yqjr.fin.mkmm.sales.condition.ActiveMainAllListCondition; import com.yqjr.fin.mkmm.sales.condition.ActiveMainCondition; import com.yqjr.fin.mkmm.sales.condition.ActiveMainListCondition; import com.yqjr.fin.mkmm.sales.entity.*; import com.yqjr.fin.mkmm.sales.rest.vo.ActiveMainVo; import com.yqjr.scfw.common.pagination.model.PageBounds; import com.yqjr.scfw.common.service.BaseService; import com.yqjr.fin.mkmm.sales.mapper.ActiveMainMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.text.SimpleDateFormat; import java.util.Date; import java.util.List; import java.util.Map; @Service @Transactional(readOnly = true) public class ActiveMainService extends BaseService<ActiveMainMapper, ActiveMain, Long> { //region generated by CodeRobot // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~此线上方代码自动生成,在此下方编写自定义代码。 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //endregion @Autowired private ActiveMainMapper activeMainMapper; public List<ActiveMain> selectByLoanEndTime(String loanEndTime){ //return activeMainMapper.selectAll(); return activeMainMapper.selectByLoanEndTime(loanEndTime); } public List<Map<String,Object>> getActiveMatchData(Long activeId){ return activeMainMapper.getActiveMatchData(activeId); } /** * 根据code查活动主表 * create by fanna 20180604 * @param activeCode * @return */ public List<ActiveMain> selectActiveMainByCode(String activeCode,String company){ return activeMainMapper.selectActiveMainByCode(activeCode,company); } /** * 根据条件查询活动制定 * @param condition * @param of * @return */ public List<ActiveMainVo> selectMainActives(ActiveMainListCondition condition, PageBounds of) { List<ActiveMainVo> activeMainVos = activeMainMapper.selectMainActives(condition,of); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); String systemTime = format.format(new Date()); for (int i = 0 ; i < activeMainVos.size() ; i++){ activeMainVos.get(i).setSystemTime(systemTime); } return activeMainVos; } /** * 根据条件查询综合活动信息 * @param condition * @param of * @return */ public List<ActiveMainVo> selectMainAllActives(ActiveMainAllListCondition condition, PageBounds of) { List<ActiveMainVo> activeMainVos = activeMainMapper.selectMainAllActives(condition,of); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); String systemTime = format.format(new Date()); for (int i = 0 ; i < activeMainVos.size() ; i++){ if (activeMainVos.get(i).getBillStatus() == null || "".equals(activeMainVos.get(i).getBillStatus())){ activeMainVos.get(i).setBillStatus("00"); } activeMainVos.get(i).setSystemTime(systemTime); } return activeMainVos; } /** * 活动附加贷表实体转换 * @param activeAdditionReview * @return */ public ActiveAddition reviewToActiveAddition(ActiveAdditionReview activeAdditionReview){ ActiveAddition activeAddition = new ActiveAddition(); if (activeAdditionReview != null) { activeAddition.setId(activeAdditionReview.getId()); //activeReviewId; activeAddition.setActiveCode(activeAdditionReview.getActiveCode()); activeAddition.setAdditionalCode(activeAdditionReview.getAdditionalCode()); activeAddition.setAdditionalName(activeAdditionReview.getAdditionalName()); activeAddition.setStartTime(activeAdditionReview.getStartTime()); activeAddition.setCreateTime(activeAdditionReview.getCreateTime()); activeAddition.setModifyTime(activeAdditionReview.getModifyTime()); activeAddition.setCreator(activeAdditionReview.getCreator()); activeAddition.setModifier(activeAdditionReview.getModifier()); activeAddition.setCompany(activeAdditionReview.getCompany()); } return activeAddition; } /** * 活动区域表实体转换 * @param activeAreaReview * @return */ public ActiveArea reviewToActiveArea(ActiveAreaReview activeAreaReview){ ActiveArea activeArea = new ActiveArea(); if (activeAreaReview != null) { activeArea.setId(activeAreaReview.getId()); //activeReviewId activeArea.setActiveCode(activeAreaReview.getActiveCode()); activeArea.setSerialNo(activeAreaReview.getSerialNo()); activeArea.setAreaCode(activeAreaReview.getAreaCode()); activeArea.setAreaName(activeAreaReview.getAreaName()); activeArea.setProvinceCode(activeAreaReview.getProvinceCode()); activeArea.setProvinceName(activeAreaReview.getProvinceName()); activeArea.setCityCode(activeAreaReview.getCityCode()); activeArea.setCityName(activeAreaReview.getCityName()); activeArea.setStartTime(activeAreaReview.getStartTime()); activeArea.setCreateTime(activeAreaReview.getCreateTime()); activeArea.setModifyTime(activeAreaReview.getModifyTime()); activeArea.setCreator(activeAreaReview.getCreator()); activeArea.setModifier(activeAreaReview.getModifier()); activeArea.setCompany(activeAreaReview.getCompany()); } return activeArea; } /** * 活动业务实体转换 * @param activeBusinessReview * @return */ public ActiveBusiness reviewToActiveBusiness(ActiveBusinessReview activeBusinessReview){ ActiveBusiness activeBusiness = new ActiveBusiness(); if (activeBusinessReview != null){ activeBusiness.setId(activeBusinessReview.getId()); //activeReviewId activeBusiness.setActiveCode(activeBusinessReview.getActiveCode()); activeBusiness.setBusinessCode(activeBusinessReview.getBusinessCode()); activeBusiness.setBusinessName(activeBusinessReview.getBusinessName()); activeBusiness.setStartTime(activeBusinessReview.getStartTime()); activeBusiness.setCreateTime(activeBusinessReview.getCreateTime()); activeBusiness.setModifyTime(activeBusinessReview.getModifyTime()); activeBusiness.setCreator(activeBusinessReview.getCreator()); activeBusiness.setModifier(activeBusinessReview.getModifier()); activeBusiness.setCompany(activeBusinessReview.getCompany()); } return activeBusiness; } /** * 活动品牌实体转换 * @param activeCarReview * @return */ public ActiveCar reviewToActiveCar(ActiveCarReview activeCarReview){ ActiveCar activeCar = new ActiveCar(); if (activeCarReview != null){ activeCar.setId(activeCarReview.getId()); //activeReviewId; activeCar.setActiveCode(activeCarReview.getActiveCode()); activeCar.setSerialNo(activeCarReview.getSerialNo()); activeCar.setBrandsCode(activeCarReview.getBrandsCode()); activeCar.setBrandsName(activeCarReview.getBrandsName()); activeCar.setSeriesCode(activeCarReview.getSeriesCode()); activeCar.setSeriesName(activeCarReview.getSeriesName()); activeCar.setModerCode(activeCarReview.getModerCode()); activeCar.setModerName(activeCarReview.getModerName()); activeCar.setStartTime(activeCarReview.getStartTime()); activeCar.setCreateTime(activeCarReview.getCreateTime()); activeCar.setModifyTime(activeCarReview.getModifyTime()); activeCar.setCreator(activeCarReview.getCreator()); activeCar.setModifier(activeCarReview.getModifier()); activeCar.setCompany(activeCarReview.getCompany()); } return activeCar; } /** * 活动经销商实体转换 * @param activeDealerReview * @return */ public ActiveDealer reviewToActiveDealer(ActiveDealerReview activeDealerReview){ ActiveDealer activeDealer = new ActiveDealer(); if (activeDealerReview != null) { activeDealer.setId(activeDealerReview.getId()); //activeReviewId; activeDealer.setActiveCode(activeDealerReview.getActiveCode()); activeDealer.setDealerCode(activeDealerReview.getDealerCode()); activeDealer.setDealerName(activeDealerReview.getDealerName()); activeDealer.setActiveNumber(activeDealerReview.getActiveNumber()); activeDealer.setStartTime(activeDealerReview.getStartTime()); activeDealer.setCreateTime(activeDealerReview.getCreateTime()); activeDealer.setModifyTime(activeDealerReview.getModifyTime()); activeDealer.setCreator(activeDealerReview.getCreator()); activeDealer.setModifier(activeDealerReview.getModifier()); activeDealer.setCompany(activeDealerReview.getCompany()); } return activeDealer; } /** * 活动主表实体转换 * @param activeMainReview * @return */ public ActiveMain reviewToActiveMain(ActiveMainReview activeMainReview){ ActiveMain activeMain = new ActiveMain(); if (activeMainReview != null) { activeMain.setId(activeMainReview.getId()); activeMain.setActiveCode(activeMainReview.getActiveCode()); activeMain.setActiveName(activeMainReview.getActiveName()); activeMain.setActiveStartime(activeMainReview.getActiveStartime()); activeMain.setActiveEndtime(activeMainReview.getActiveEndtime()); activeMain.setLoanStartime(activeMainReview.getLoanStartime()); activeMain.setLoanEndtime(activeMainReview.getLoanEndtime()); activeMain.setPatmentBegin(activeMainReview.getPatmentBegin()); activeMain.setPatmentEnd(activeMainReview.getPatmentEnd()); activeMain.setCarReg(activeMainReview.getCarReg()); activeMain.setLoanTermBegin(activeMainReview.getLoanTermBegin()); activeMain.setLoanTermEnd(activeMainReview.getLoanTermEnd()); activeMain.setLoanAmtBegin(activeMainReview.getLoanAmtBegin()); activeMain.setLoanAmtEnd(activeMainReview.getLoanAmtEnd()); activeMain.setAvtiveCriterion(activeMainReview.getAvtiveCriterion()); activeMain.setAdditionFlag(activeMainReview.getAdditionFlag()); activeMain.setAdditionAmtBegin(activeMainReview.getAdditionAmtBegin()); activeMain.setAdditionAmtEnd(activeMainReview.getAdditionAmtEnd()); activeMain.setActiveStatus(activeMainReview.getActiveStatus()); activeMain.setCreateTime(activeMainReview.getCreateTime()); activeMain.setModifyTime(activeMainReview.getModifyTime()); activeMain.setStartTime(activeMainReview.getStartTime()); activeMain.setAnnex(activeMainReview.getAnnex()); activeMain.setCreator(activeMainReview.getCreator()); activeMain.setModifier(activeMainReview.getModifier()); activeMain.setCompany(activeMainReview.getCompany()); activeMain.setPaymentStatus(activeMainReview.getPaymentStatus()); activeMain.setRemark(activeMainReview.getRemark()); activeMain.setExpectedCount(activeMainReview.getExpectedCount()); activeMain.setInputDeale(activeMainReview.getInputDeale()); activeMain.setAdditionalId(activeMainReview.getAdditionalId()); activeMain.setAreaCode(activeMainReview.getAreaCode()); activeMain.setAreaName(activeMainReview.getAreaName()); activeMain.setInputArea(activeMainReview.getInputArea()); } return activeMain; } /** * 营销活动实体转换 * @param activeMarketingReview * @return */ public ActiveMarketing reviewToActiveMarketing(ActiveMarketingReview activeMarketingReview){ ActiveMarketing activeMarketing = new ActiveMarketing(); if (activeMarketingReview != null) { activeMarketing.setId(activeMarketingReview.getId()); //activeReviewId; activeMarketing.setActiveCode(activeMarketingReview.getActiveCode()); activeMarketing.setMarketingCode(activeMarketingReview.getMarketingCode()); activeMarketing.setMarketingName(activeMarketingReview.getMarketingName()); activeMarketing.setStartTime(activeMarketingReview.getStartTime()); activeMarketing.setCreateTime(activeMarketingReview.getCreateTime()); activeMarketing.setModifyTime(activeMarketingReview.getModifyTime()); activeMarketing.setCreator(activeMarketingReview.getCreator()); activeMarketing.setModifier(activeMarketingReview.getModifier()); activeMarketing.setCompany(activeMarketingReview.getCompany()); } return activeMarketing; } /** * 活动产品实体转换 * @param activeProdReview * @return */ public ActiveProd reviewToActiveProd(ActiveProdReview activeProdReview){ ActiveProd activeProd = new ActiveProd(); if (activeProdReview != null) { activeProd.setId(activeProdReview.getId()); //activeReviewId; activeProd.setActiveCode(activeProdReview.getActiveCode()); activeProd.setProdCode(activeProdReview.getProdCode()); activeProd.setProdName(activeProdReview.getProdName()); activeProd.setStartTime(activeProdReview.getStartTime()); activeProd.setCreateTime(activeProdReview.getCreateTime()); activeProd.setModifyTime(activeProdReview.getModifyTime()); activeProd.setCreator(activeProdReview.getCreator()); activeProd.setModifier(activeProdReview.getModifier()); activeProd.setProdType(activeProdReview.getProdType()); activeProd.setCompany(activeProdReview.getCompany()); } return activeProd; } /** * 活动附加贷表实体转换 * @param activeAddition * @return */ public ActiveAdditionHis formalToActiveAdditionHis(ActiveAddition activeAddition){ ActiveAdditionHis activeAdditionHis = new ActiveAdditionHis(); if (activeAddition != null) { activeAdditionHis.setId(activeAddition.getId()); //activeHisId; activeAdditionHis.setActiveCode(activeAddition.getActiveCode()); activeAdditionHis.setAdditionalCode(activeAddition.getAdditionalCode()); activeAdditionHis.setAdditionalName(activeAddition.getAdditionalName()); activeAdditionHis.setStartTime(activeAddition.getStartTime()); activeAdditionHis.setCreateTime(activeAddition.getCreateTime()); activeAdditionHis.setModifyTime(activeAddition.getModifyTime()); activeAdditionHis.setCreator(activeAddition.getCreator()); activeAdditionHis.setModifier(activeAddition.getModifier()); activeAdditionHis.setCompany(activeAddition.getCompany()); } return activeAdditionHis; } /** * 活动区域表实体转换 * @param activeArea * @return */ public ActiveAreaHis formalToActiveAreaHis(ActiveArea activeArea){ ActiveAreaHis activeAreaHis = new ActiveAreaHis(); if (activeArea != null) { activeAreaHis.setId(activeArea.getId()); //activeHisId activeAreaHis.setActiveCode(activeArea.getActiveCode()); activeAreaHis.setSerialNo(activeArea.getSerialNo()); activeAreaHis.setAreaCode(activeArea.getAreaCode()); activeAreaHis.setAreaName(activeArea.getAreaName()); activeAreaHis.setProvinceCode(activeArea.getProvinceCode()); activeAreaHis.setProvinceName(activeArea.getProvinceName()); activeAreaHis.setCityCode(activeArea.getCityCode()); activeAreaHis.setCityName(activeArea.getCityName()); activeAreaHis.setStartTime(activeArea.getStartTime()); activeAreaHis.setCreateTime(activeArea.getCreateTime()); activeAreaHis.setModifyTime(activeArea.getModifyTime()); activeAreaHis.setCreator(activeArea.getCreator()); activeAreaHis.setModifier(activeArea.getModifier()); activeAreaHis.setCompany(activeArea.getCompany()); } return activeAreaHis; } /** * 活动业务实体转换 * @param activeBusiness * @return */ public ActiveBusinessHis formalToActiveBusinessHis(ActiveBusiness activeBusiness){ ActiveBusinessHis activeBusinessHis = new ActiveBusinessHis(); if (activeBusiness != null) { activeBusinessHis.setId(activeBusiness.getId()); //activeHisId activeBusinessHis.setActiveCode(activeBusiness.getActiveCode()); activeBusinessHis.setBusinessCode(activeBusiness.getBusinessCode()); activeBusinessHis.setBusinessName(activeBusiness.getBusinessName()); activeBusinessHis.setStartTime(activeBusiness.getStartTime()); activeBusinessHis.setCreateTime(activeBusiness.getCreateTime()); activeBusinessHis.setModifyTime(activeBusiness.getModifyTime()); activeBusinessHis.setCreator(activeBusiness.getCreator()); activeBusinessHis.setModifier(activeBusiness.getModifier()); } return activeBusinessHis; } /** * 活动品牌实体转换 * @param activeCar * @return */ public ActiveCarHis formalToActiveCarHis(ActiveCar activeCar){ ActiveCarHis activeCarHis = new ActiveCarHis(); if (activeCar != null) { activeCarHis.setId(activeCar.getId()); //activeHisId; activeCarHis.setActiveCode(activeCar.getActiveCode()); activeCarHis.setSerialNo(activeCar.getSerialNo()); activeCarHis.setBrandsCode(activeCar.getBrandsCode()); activeCarHis.setBrandsName(activeCar.getBrandsName()); activeCarHis.setSeriesCode(activeCar.getSeriesCode()); activeCarHis.setSeriesName(activeCar.getSeriesName()); activeCarHis.setModerCode(activeCar.getModerCode()); activeCarHis.setModerName(activeCar.getModerName()); activeCarHis.setStartTime(activeCar.getStartTime()); activeCarHis.setCreateTime(activeCar.getCreateTime()); activeCarHis.setModifyTime(activeCar.getModifyTime()); activeCarHis.setCreator(activeCar.getCreator()); activeCarHis.setModifier(activeCar.getModifier()); activeCarHis.setCompany(activeCar.getCompany()); } return activeCarHis; } /** * 活动经销商实体转换 * @param activeDealer * @return */ public ActiveDealerHis formalToActiveDealerHis(ActiveDealer activeDealer){ ActiveDealerHis activeDealerHis = new ActiveDealerHis(); if (activeDealer != null) { activeDealerHis.setId(activeDealer.getId()); //activeHisId; activeDealerHis.setActiveCode(activeDealer.getActiveCode()); activeDealerHis.setDealerCode(activeDealer.getDealerCode()); activeDealerHis.setDealerName(activeDealer.getDealerName()); activeDealerHis.setActiveNumber(activeDealer.getActiveNumber()); activeDealerHis.setStartTime(activeDealer.getStartTime()); activeDealerHis.setCreateTime(activeDealer.getCreateTime()); activeDealerHis.setModifyTime(activeDealer.getModifyTime()); activeDealerHis.setCreator(activeDealer.getCreator()); activeDealerHis.setModifier(activeDealer.getModifier()); activeDealerHis.setCompany(activeDealer.getCompany()); } return activeDealerHis; } /** * 活动主表实体转换 * @param activeMain * @return */ public ActiveMainHis formalToActiveMainHis(ActiveMain activeMain){ ActiveMainHis activeMainHis = new ActiveMainHis(); if (activeMain != null) { activeMainHis.setId(activeMain.getId()); activeMainHis.setActiveCode(activeMain.getActiveCode()); activeMainHis.setActiveName(activeMain.getActiveName()); activeMainHis.setActiveStartime(activeMain.getActiveStartime()); activeMainHis.setActiveEndtime(activeMain.getActiveEndtime()); activeMainHis.setLoanStartime(activeMain.getLoanStartime()); activeMainHis.setLoanEndtime(activeMain.getLoanEndtime()); activeMainHis.setPatmentBegin(activeMain.getPatmentBegin()); activeMainHis.setPatmentEnd(activeMain.getPatmentEnd()); activeMainHis.setCarReg(activeMain.getCarReg()); activeMainHis.setLoanTermBegin(activeMain.getLoanTermBegin()); activeMainHis.setLoanTermEnd(activeMain.getLoanTermEnd()); activeMainHis.setLoanAmtBegin(activeMain.getLoanAmtBegin()); activeMainHis.setLoanAmtEnd(activeMain.getLoanAmtEnd()); activeMainHis.setAvtiveCriterion(activeMain.getAvtiveCriterion()); activeMainHis.setAdditionFlag(activeMain.getAdditionFlag()); activeMainHis.setAdditionAmtBegin(activeMain.getAdditionAmtBegin()); activeMainHis.setAdditionAmtEnd(activeMain.getAdditionAmtEnd()); activeMainHis.setActiveStatus(activeMain.getActiveStatus()); activeMainHis.setCreateTime(activeMain.getCreateTime()); activeMainHis.setModifyTime(activeMain.getModifyTime()); activeMainHis.setStartTime(activeMain.getStartTime()); activeMainHis.setAnnex(activeMain.getAnnex()); activeMainHis.setCreator(activeMain.getCreator()); activeMainHis.setModifier(activeMain.getModifier()); activeMainHis.setCompany(activeMain.getCompany()); activeMainHis.setPaymentStatus(activeMain.getPaymentStatus()); activeMainHis.setRemark(activeMain.getRemark()); activeMainHis.setExpectedCount(activeMain.getExpectedCount()); //activeMainReviewId; //validStatus; activeMainHis.setAdditionalId(activeMain.getAdditionalId()); activeMainHis.setInputDeale(activeMain.getInputDeale()); activeMainHis.setAreaCode(activeMain.getAreaCode()); activeMainHis.setAreaName(activeMain.getAreaName()); } return activeMainHis; } /** * 营销活动实体转换 * @param activeMarketing * @return */ public ActiveMarketingHis formalToActiveMarketingHis(ActiveMarketing activeMarketing){ ActiveMarketingHis activeMarketingHis = new ActiveMarketingHis(); if (activeMarketing != null) { activeMarketingHis.setId(activeMarketing.getId()); //activeHisId; activeMarketingHis.setActiveCode(activeMarketing.getActiveCode()); activeMarketingHis.setMarketingCode(activeMarketing.getMarketingCode()); activeMarketingHis.setMarketingName(activeMarketing.getMarketingName()); activeMarketingHis.setStartTime(activeMarketing.getStartTime()); activeMarketingHis.setCreateTime(activeMarketing.getCreateTime()); activeMarketingHis.setModifyTime(activeMarketing.getModifyTime()); activeMarketingHis.setCreator(activeMarketing.getCreator()); activeMarketingHis.setModifier(activeMarketing.getModifier()); activeMarketingHis.setCompany(activeMarketing.getCompany()); } return activeMarketingHis; } /** * 活动产品实体转换 * @param activeProd * @return */ public ActiveProdHis formalToActiveProdHis(ActiveProd activeProd){ ActiveProdHis activeProdHis = new ActiveProdHis(); if (activeProd != null) { activeProdHis.setId(activeProd.getId()); //activeHisId; activeProdHis.setActiveCode(activeProd.getActiveCode()); activeProdHis.setProdCode(activeProd.getProdCode()); activeProdHis.setProdName(activeProd.getProdName()); activeProdHis.setStartTime(activeProd.getStartTime()); activeProdHis.setCreateTime(activeProd.getCreateTime()); activeProdHis.setModifyTime(activeProd.getModifyTime()); activeProdHis.setCreator(activeProd.getCreator()); activeProdHis.setModifier(activeProd.getModifier()); activeProdHis.setProdType(activeProd.getProdType()); activeProdHis.setCompany(activeProd.getCompany()); } return activeProdHis; } public Long insertAndReturnId(ActiveMain activeMain){ activeMainMapper.insertAndReturnId(activeMain); return activeMain.getId(); } public void patchByActiveCode(ActiveMain activeMain) { activeMainMapper.patchByActiveCode(activeMain); } public List<ActiveMain> queryActiveMains(ActiveMainCondition activeMainCondition) { return activeMainMapper.queryActiveMains(activeMainCondition); } }
[ "1296345294@qq.com" ]
1296345294@qq.com
cd5623cc4cfaf0f13a9de23296f9e286a830c643
fc6c869ee0228497e41bf357e2803713cdaed63e
/weixin6519android1140/src/sourcecode/com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKManager.java
41f72698be97b1cd5cc5b1c1e1107b7f6778f6ca
[]
no_license
hyb1234hi/reverse-wechat
cbd26658a667b0c498d2a26a403f93dbeb270b72
75d3fd35a2c8a0469dbb057cd16bca3b26c7e736
refs/heads/master
2020-09-26T10:12:47.484174
2017-11-16T06:54:20
2017-11-16T06:54:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
10,280
java
package com.tencent.tmassistantsdk.downloadclient; import android.content.Context; import com.tencent.tmassistantsdk.util.TMLog; import java.util.ArrayList; import java.util.Iterator; public class TMAssistantDownloadSDKManager { protected static TMAssistantDownloadSDKManager mInstance = null; protected static ArrayList<TMAssistantDownloadOpenSDKClient> mOpenSDKClientList = new ArrayList(); protected static ArrayList<TMAssistantDownloadSDKClient> mSDKClientList = new ArrayList(); protected static TMAssistantDownloadSDKSettingClient mSDKSettingClient = null; protected Context mContext = null; protected TMAssistantDownloadSDKManager(Context paramContext) { this.mContext = paramContext; } public static String about() { return "TMAssistantDownloadSDKManager_2014_03_04_17_55_release_25406"; } public static void closeAllService(Context paramContext) { for (;;) { try { TMLog.i("TMAssistantDownloadSDKManager", "closeAllService method!"); if (mInstance == null) { TMLog.i("TMAssistantDownloadSDKManager", "manager minstance == null"); return; } if ((mSDKClientList != null) && (mSDKClientList.size() > 0)) { paramContext = mSDKClientList.iterator(); if (paramContext.hasNext()) { TMAssistantDownloadSDKClient localTMAssistantDownloadSDKClient = (TMAssistantDownloadSDKClient)paramContext.next(); if (localTMAssistantDownloadSDKClient == null) { continue; } localTMAssistantDownloadSDKClient.unInitTMAssistantDownloadSDK(); continue; } mSDKClientList.clear(); } } finally {} if (mSDKSettingClient != null) { mSDKSettingClient.unInitTMAssistantDownloadSDK(); mSDKSettingClient = null; } mInstance = null; } } public static TMAssistantDownloadSDKManager getInstance(Context paramContext) { try { if (mInstance == null) { mInstance = new TMAssistantDownloadSDKManager(paramContext); } paramContext = mInstance; return paramContext; } finally {} } public TMAssistantDownloadOpenSDKClient getDownloadOpenSDKClient(String paramString) { for (;;) { try { Iterator localIterator = mOpenSDKClientList.iterator(); if (localIterator.hasNext()) { TMAssistantDownloadOpenSDKClient localTMAssistantDownloadOpenSDKClient = (TMAssistantDownloadOpenSDKClient)localIterator.next(); boolean bool = localTMAssistantDownloadOpenSDKClient.mClientKey.equals(paramString); if (bool == true) { paramString = localTMAssistantDownloadOpenSDKClient; return paramString; } } else { paramString = new TMAssistantDownloadOpenSDKClient(this.mContext, paramString, "com.tencent.android.qqdownloader.SDKService"); if (paramString.initTMAssistantDownloadSDK()) { mOpenSDKClientList.add(paramString); } else { paramString = null; } } } finally {} } } /* Error */ public TMAssistantDownloadSDKClient getDownloadSDKClient(String paramString) { // Byte code: // 0: aload_0 // 1: monitorenter // 2: aload_1 // 3: ifnull +12 -> 15 // 6: aload_1 // 7: invokevirtual 115 java/lang/String:length ()I // 10: istore_2 // 11: iload_2 // 12: ifgt +9 -> 21 // 15: aconst_null // 16: astore_1 // 17: aload_0 // 18: monitorexit // 19: aload_1 // 20: areturn // 21: getstatic 26 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKManager:mSDKClientList Ljava/util/ArrayList; // 24: invokevirtual 60 java/util/ArrayList:iterator ()Ljava/util/Iterator; // 27: astore 4 // 29: aload 4 // 31: invokeinterface 66 1 0 // 36: ifeq +31 -> 67 // 39: aload 4 // 41: invokeinterface 70 1 0 // 46: checkcast 72 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKClient // 49: astore_3 // 50: aload_3 // 51: getfield 116 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKClient:mClientKey Ljava/lang/String; // 54: aload_1 // 55: invokevirtual 99 java/lang/String:equals (Ljava/lang/Object;)Z // 58: iconst_1 // 59: if_icmpne -30 -> 29 // 62: aload_3 // 63: astore_1 // 64: goto -47 -> 17 // 67: new 72 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKClient // 70: dup // 71: aload_0 // 72: getfield 35 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKManager:mContext Landroid/content/Context; // 75: aload_1 // 76: invokespecial 119 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKClient:<init> (Landroid/content/Context;Ljava/lang/String;)V // 79: astore_1 // 80: aload_1 // 81: invokevirtual 120 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKClient:initTMAssistantDownloadSDK ()Z // 84: pop // 85: getstatic 26 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKManager:mSDKClientList Ljava/util/ArrayList; // 88: aload_1 // 89: invokevirtual 110 java/util/ArrayList:add (Ljava/lang/Object;)Z // 92: pop // 93: goto -76 -> 17 // 96: astore_1 // 97: aload_0 // 98: monitorexit // 99: aload_1 // 100: athrow // Local variable table: // start length slot name signature // 0 101 0 this TMAssistantDownloadSDKManager // 0 101 1 paramString String // 10 2 2 i int // 49 14 3 localTMAssistantDownloadSDKClient TMAssistantDownloadSDKClient // 27 13 4 localIterator Iterator // Exception table: // from to target type // 6 11 96 finally // 21 29 96 finally // 29 62 96 finally // 67 93 96 finally } public TMAssistantDownloadSDKSettingClient getDownloadSDKSettingClient() { try { if (mSDKSettingClient == null) { localTMAssistantDownloadSDKSettingClient = new TMAssistantDownloadSDKSettingClient(this.mContext, "TMAssistantDownloadSDKManager"); mSDKSettingClient = localTMAssistantDownloadSDKSettingClient; localTMAssistantDownloadSDKSettingClient.initTMAssistantDownloadSDK(); } TMAssistantDownloadSDKSettingClient localTMAssistantDownloadSDKSettingClient = mSDKSettingClient; return localTMAssistantDownloadSDKSettingClient; } finally {} } /* Error */ public boolean releaseDownloadSDKClient(String paramString) { // Byte code: // 0: aload_0 // 1: monitorenter // 2: getstatic 26 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKManager:mSDKClientList Ljava/util/ArrayList; // 5: invokevirtual 60 java/util/ArrayList:iterator ()Ljava/util/Iterator; // 8: astore_3 // 9: aload_3 // 10: invokeinterface 66 1 0 // 15: ifeq +49 -> 64 // 18: aload_3 // 19: invokeinterface 70 1 0 // 24: checkcast 72 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKClient // 27: astore 4 // 29: aload 4 // 31: ifnull -22 -> 9 // 34: aload 4 // 36: getfield 116 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKClient:mClientKey Ljava/lang/String; // 39: aload_1 // 40: invokevirtual 99 java/lang/String:equals (Ljava/lang/Object;)Z // 43: iconst_1 // 44: if_icmpne -35 -> 9 // 47: aload 4 // 49: invokevirtual 75 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKClient:unInitTMAssistantDownloadSDK ()V // 52: aload_3 // 53: invokeinterface 129 1 0 // 58: iconst_1 // 59: istore_2 // 60: aload_0 // 61: monitorexit // 62: iload_2 // 63: ireturn // 64: getstatic 28 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKManager:mSDKSettingClient Lcom/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKSettingClient; // 67: ifnull +32 -> 99 // 70: getstatic 28 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKManager:mSDKSettingClient Lcom/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKSettingClient; // 73: getfield 130 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKSettingClient:mClientKey Ljava/lang/String; // 76: aload_1 // 77: invokevirtual 99 java/lang/String:equals (Ljava/lang/Object;)Z // 80: iconst_1 // 81: if_icmpne +18 -> 99 // 84: getstatic 28 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKManager:mSDKSettingClient Lcom/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKSettingClient; // 87: invokevirtual 81 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKSettingClient:unInitTMAssistantDownloadSDK ()V // 90: aconst_null // 91: putstatic 28 com/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKManager:mSDKSettingClient Lcom/tencent/tmassistantsdk/downloadclient/TMAssistantDownloadSDKSettingClient; // 94: iconst_1 // 95: istore_2 // 96: goto -36 -> 60 // 99: iconst_0 // 100: istore_2 // 101: goto -41 -> 60 // 104: astore_1 // 105: aload_0 // 106: monitorexit // 107: aload_1 // 108: athrow // Local variable table: // start length slot name signature // 0 109 0 this TMAssistantDownloadSDKManager // 0 109 1 paramString String // 59 42 2 bool boolean // 8 45 3 localIterator Iterator // 27 21 4 localTMAssistantDownloadSDKClient TMAssistantDownloadSDKClient // Exception table: // from to target type // 2 9 104 finally // 9 29 104 finally // 34 58 104 finally // 64 94 104 finally } } /* Location: D:\tools\apktool\weixin6519android1140\jar\classes3-dex2jar.jar!\com\tencent\tmassistantsdk\downloadclient\TMAssistantDownloadSDKManager.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
[ "robert0825@gmail.com" ]
robert0825@gmail.com
743e5c3880dfad67682154ac9484a0b5a1527e98
c9f827a932c1c7f45f8281232ac4a2477bf2255b
/ruoyi/src/main/java/com/ruoyi/project/tool/gen/util/Analysis.java
17b2a44277945aba09de2f452730251d4a483ab1
[]
no_license
QQUINA/java-springboot-hr
97ae5169465a58d9c7a2bfa632b213fbdf53b4ba
69c530aeb31a0b5e350aa0ecc9f36a5428d74ca7
refs/heads/master
2022-03-30T14:38:06.263148
2020-01-06T06:47:01
2020-01-06T06:47:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
13,393
java
package com.ruoyi.project.tool.gen.util; import com.ruoyi.project.system.domain.SysDept; import com.ruoyi.project.system.domain.SysUser; import com.ruoyi.project.system.domain.User; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.*; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.web.multipart.MultipartFile; import java.io.*; import java.lang.reflect.Field; import java.lang.reflect.Method; import java.text.DecimalFormat; import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * @Author:huang * @Date:2019-09-10 10:29 * @Description:excel文件解析类 */ public class Analysis { public static boolean isHasValues(Object object){ Field[] fields = object.getClass().getDeclaredFields(); boolean flag = false; for (int i = 0; i < fields.length; i++) { String fieldName = fields[i].getName(); String methodName = "get"+fieldName.substring(0, 1).toUpperCase()+fieldName.substring(1); Method getMethod; try { getMethod = object.getClass().getMethod(methodName); Object obj = getMethod.invoke(object); if (null != obj && !"".equals(obj)) { flag = true; break; } } catch (Exception e) { e.printStackTrace(); } } return flag; } public Analysis() { throw new Error("工具类不允许实例化!"); } /** * 获取并解析excel文件,返回一个二维集合 * @param file 上传的文件 * @return 二维集合(第一重集合为行,第二重集合为列,每一行包含该行的列集合,列集合包含该行的全部单元格的值) */ public static List<SysUser> analysis(MultipartFile file) throws IOException { //获取输入流 InputStream in = file.getInputStream(); //获取文件名称 String fileName = file.getOriginalFilename(); //判断excel版本 Workbook workbook = null; if (judegExcelEdition(fileName)) { workbook = new XSSFWorkbook(in); } else { workbook = new HSSFWorkbook(in); } List<SysUser> list = new ArrayList<SysUser>(); // 循环工作表Sheet for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { Sheet hssfSheet = workbook.getSheetAt(numSheet); if (hssfSheet == null) { continue; } // 循环行Row for (int rowNum = 1; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { Row hssfRow = hssfSheet.getRow(rowNum); if (hssfRow == null) { continue; } SysUser exam = new SysUser(); SysDept dept=new SysDept(); // 循环列Cell 用户序号 Cell userid = hssfRow.getCell(0); exam.setUserId(Long.valueOf(Analysis.getValue(userid))); //读取登录名称 Cell userName= hssfRow.getCell(1); exam.setUserName(Analysis.getValue(userName)); //读取用户名称 Cell nickName = hssfRow.getCell(2); exam.setNickName(Analysis.getValue(nickName)); //读取用户邮箱 Cell email = hssfRow.getCell(3); exam.setEmail(Analysis.getValue(email)); //读取手机号码 Cell phonenumber = hssfRow.getCell(4); exam.setPhonenumber(Analysis.getValue(phonenumber)); //读取用户性别 Cell sex= hssfRow.getCell(5); exam.setSex(Analysis.getValue(sex)); /* if("男".equals(Analysis.getValue(sex))){ exam.setSex("0"); }else if("女".equals(Analysis.getValue(sex))){ exam.setSex("1"); }else { exam.setSex("2"); }*/ //读取账号状态 Cell status= hssfRow.getCell(6); String statu=Analysis.getValue(status); if ("正常".equals(statu)){ exam.setStatus("0"); }else if("停用".equals(statu)){ exam.setStatus("1"); } //读取最后登录ip Cell ip= hssfRow.getCell(7); exam.setLoginIp(Analysis.getValue(ip)); //读取最后登录时间 Cell date= hssfRow.getCell(8); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); ParsePosition pos = new ParsePosition(0); Date strtodate = formatter.parse(Analysis.getValue(date), pos); exam.setLoginDate(strtodate); //读取部门名称 Cell name= hssfRow.getCell(9); Cell leader= hssfRow.getCell(10); dept.setDeptName(Analysis.getValue(name)); dept.setLeader(Analysis.getValue(leader)); exam.setDept(dept); list.add(exam); } } return list; } public static List<User> Excel(MultipartFile file) throws IOException { //获取输入流 InputStream in = file.getInputStream(); //获取文件名称 String fileName = file.getOriginalFilename(); //判断excel版本 Workbook workbook = null; if (judegExcelEdition(fileName)) { workbook = new XSSFWorkbook(in); } else { workbook = new HSSFWorkbook(in); } List<User> list = new ArrayList<User>(); // 循环工作表Sheet for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) { Sheet hssfSheet = workbook.getSheetAt(numSheet); if (hssfSheet == null) { continue; } // 循环行Row for (int rowNum = 1; rowNum <= hssfSheet.getLastRowNum(); rowNum++) { Row hssfRow = hssfSheet.getRow(rowNum); if (hssfRow == null) { continue; } User exam = new User(); // 循环列Cell 人员序号 Cell userid = hssfRow.getCell(0); exam.setUserId(Long.valueOf(Analysis.getValue(userid))); //读取人员名称 Cell userName= hssfRow.getCell(1); exam.setUserName(Analysis.getValue(userName)); //读取人员民族 Cell nation = hssfRow.getCell(2); exam.setNation(Analysis.getValue(nation)); //读取人员邮箱 Cell email = hssfRow.getCell(3); exam.setEmail(Analysis.getValue(email)); //读取手机号码 Cell phonenumber = hssfRow.getCell(4); exam.setPhonenumber(Analysis.getValue(phonenumber)); //读取用户性别 Cell sex= hssfRow.getCell(5); if("男".equals(Analysis.getValue(sex))){ exam.setSex("0"); }else if("女".equals(Analysis.getValue(sex))){ exam.setSex("1"); }else { exam.setSex("2"); } //读取人员头像 Cell avatar= hssfRow.getCell(6); exam.setAvatar(Analysis.getValue(avatar)); //读取人员状态 Cell status= hssfRow.getCell(7); String statu=Analysis.getValue(status); if ("正常".equals(statu)){ exam.setStatus("0"); }else if("停用".equals(statu)){ exam.setStatus("1"); } //读取人员生日 Cell birthday= hssfRow.getCell(8); exam.setBorth(Analysis.getValue(birthday)); // exam.setLoginIp(Analysis.getValue(ip)); //读取人员学历 Cell grade= hssfRow.getCell(9); exam.setGrade(Analysis.getValue(grade)); //读取人员毕业院校 Cell school= hssfRow.getCell(10); exam.setGrade(Analysis.getValue(school)); //读取人员所属专业 Cell mayor= hssfRow.getCell(11); exam.setMayor(Analysis.getValue(mayor)); //读取人员所属职称 Cell position= hssfRow.getCell(12); exam.setPosition(Analysis.getValue(position)); //读取人员籍贯 Cell custom= hssfRow.getCell(13); exam.setPosition(Analysis.getValue(custom)); //读取人员户籍 Cell hukou= hssfRow.getCell(14); exam.setHukou(Analysis.getValue(hukou)); //读取健康状况 Cell health= hssfRow.getCell(15); exam.setHealthstatus(Analysis.getValue(health)); //读取人员所熟悉擅长 Cell shanchang= hssfRow.getCell(16); exam.setDirecion(Analysis.getValue(shanchang)); //读取人员通信地址 Cell address= hssfRow.getCell(17); exam.setAddress(Analysis.getValue(address)); //读取人员获奖 Cell raward= hssfRow.getCell(18); exam.setRaward(Analysis.getValue(raward)); //读取人员英语水平 Cell cet= hssfRow.getCell(19); exam.setCetpet(Analysis.getValue(cet)); //读取人员参工日期 Cell cangong= hssfRow.getCell(20); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); ParsePosition pos = new ParsePosition(0); Date strtodate = formatter.parse(Analysis.getValue(cangong), pos); // exam.setLoginDate(strtodate); exam.setTime(strtodate); //读取人员专业职称 Cell professor= hssfRow.getCell(21); exam.setProfessor(Analysis.getValue(professor)); //读取人员执业资格 Cell tile= hssfRow.getCell(22); exam.setTitle(Analysis.getValue(tile)); //读取人员创建日期 Cell chuangjian= hssfRow.getCell(23); SimpleDateFormat formatter1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); ParsePosition pos1 = new ParsePosition(0); Date chuangjiandate = formatter1.parse(Analysis.getValue(chuangjian), pos1); // exam.setLoginDate(strtodate); exam.setTime(chuangjiandate); //读取人员修改日期 Cell xiugai= hssfRow.getCell(24); SimpleDateFormat formatter2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); ParsePosition pos2 = new ParsePosition(0); Date xiugaidate = formatter2.parse(Analysis.getValue(xiugai), pos2); // exam.setLoginDate(strtodate); exam.setTime(xiugaidate); /* SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); ParsePosition pos = new ParsePosition(0); Date strtodate = formatter.parse(Analysis.getValue(date), pos); */ // exam.setLoginDate(strtodate); //读取部门名称 /* Cell name= hssfRow.getCell(9); Cell leader= hssfRow.getCell(10); dept.setDeptName(Analysis.getValue(name)); dept.setLeader(Analysis.getValue(leader)); exam.setDept(dept);*/ list.add(exam); } } return list; } /** * 判断上传的excel文件版本(xls为2003,xlsx为2017) * @param fileName 文件路径 * @return excel2007及以上版本返回true,excel2007以下版本返回false */ public static boolean judegExcelEdition(String fileName){ if (fileName.matches("^.+\\.(?i)(xls)$")){ return false; }else { return true; } } /** * 得到Excel表中的值 * * @param hssfCell * Excel中的每一个格子 * @return Excel中每一个格子中的值 */ public static String getValue(Cell hssfCell) { if (hssfCell.getCellType() == Cell.CELL_TYPE_BOOLEAN) { // 返回布尔类型的值 return String.valueOf(hssfCell.getBooleanCellValue()); } else if (hssfCell.getCellType() == Cell.CELL_TYPE_NUMERIC) { // 返回数值类型的值 DecimalFormat df = new DecimalFormat("0"); String strCell = df.format(hssfCell.getNumericCellValue()); return String.valueOf(strCell); } else { // 返回字符串类型的值 return String.valueOf(hssfCell.getStringCellValue()); } } }
[ "baipengpeng@gtexpress.cn" ]
baipengpeng@gtexpress.cn
d3378c8fd2720fc75fbda0ebafbcd4e0577233fa
616dd4fc2703432dc0df7e5116959acb7140c35a
/back/PrisSpring/src/main/java/com/pris/service/KategorijaServiceImpl.java
b4a2be3fd49508df4fa0c04319175534dd1a761b
[]
no_license
Vulkin996/Udruzenje_Ljubitelja_Filmova
af99d4f041c87ed6ee0c4d71b338dd2ca329be45
f614f243a5f376b9d69c6bac380f70c68ef88962
refs/heads/master
2023-04-28T05:24:29.354444
2021-05-11T07:51:59
2021-05-11T07:51:59
357,486,381
0
0
null
null
null
null
UTF-8
Java
false
false
346
java
package com.pris.service; import java.util.List; import com.pris.repository.KategorijaRepository; import model.Kategorija; public class KategorijaServiceImpl implements KategorijaService{ KategorijaRepository kategorijaRepository; @Override public List<Kategorija> svi() { return kategorijaRepository.findAll(); } }
[ "filip.kristic96@gmail.com" ]
filip.kristic96@gmail.com
7518823aaf11f7a1cb1e1cefda81e1c24067bfc2
6e8ab65c0b56037ac6e891908c0004977a42cded
/app/build/generated/source/buildConfig/debug/com/example/kavanpatel/healdoc/BuildConfig.java
6f6a7d24da0b177b2e99ffbb3e0ef2dc61cf1ec6
[]
no_license
Kavan-Patel/HealDoc
1d696accc254f12ce57823a3c136c4f516932b58
344626b78406306a5c5f124086ab37a70c137cc9
refs/heads/master
2023-02-09T21:06:39.998842
2021-01-09T08:21:10
2021-01-09T08:21:10
145,734,453
0
0
null
null
null
null
UTF-8
Java
false
false
467
java
/** * Automatically generated file. DO NOT MODIFY */ package com.example.kavanpatel.healdoc; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "com.example.kavanpatel.healdoc"; 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"; }
[ "kavanpatel@kavans-MacBook-Pro.local" ]
kavanpatel@kavans-MacBook-Pro.local
f2325fe78fe2acb077dfd9694c875f3e808429e8
92299f488d9a972526e1f587e55824edc75f850b
/src/ChatRewind.java
fe7f09c9f53d41eba3fce4ab216271886d0fe354
[]
no_license
ccrosbyy/chat_rewind
c0787bb2347c917ded9ea6f524eeb9aedad76c4e
d059724f073a6a8ee470b29472f110ffaa0c56f8
refs/heads/master
2023-02-16T11:30:30.685011
2021-01-19T01:42:43
2021-01-19T01:42:43
330,831,570
0
0
null
null
null
null
UTF-8
Java
false
false
50,976
java
import java.lang.reflect.Member; import java.rmi.MarshalException; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.StringTokenizer; public class ChatRewind { HashMap<String, HashMap<GroupMember, Integer>> stats = new HashMap<>(); HashMap<String, Integer> word_freq = new HashMap<>(); String[] words_to_ignore = {"a", "an", "the", "be", "can", "could", "do", "have", "not", "that", "it", "its", "it's", "that's", "there", "but", "when", "u", "in", "and", "is", "to", "i", "you", "my", "for", "just" ,"this", "i'll", "of", "so", "i'm", "me", "on", "was", "as", "with", "if", "what", "we", "at", "your" ,"you're", "are", "up", "get", "don't", "all", "one", "or", "how", "out", "go", "he", "she" , "her", "about", "then", "know", "they", "too", "got", "gonna", "like", "now", "from", "also", "want" , "really", "why", "did", "didn't", "think", "yea", "yeah", "no", "still", "good", "yes", "haha", "hahaha" , "them", "oh", "would", "come", "more", "cause", "here", "were", "him", "had", "will", "even", "tho" , "has", "say", "his", "because", "wanna", ":", "they're", "after", "am", "need", "much", "going" , "let", "dont", "thats", "see", "sounds", "than", "over", "been", "some", "into", "way", "doing" , "their", "though", "he's", "only", "lot", "off", "can't", "said", "1", "2", "3", "4", "5", "6" , "might", "sent", "should", "feel", "right", "back", "well", "someone", "something" , "youre", "ive", "probs", "very", "make", "next", "us", "what's", "coming", "take", "wait", "w" , "i've", "our", "we're", "day", "those", "better", "two", "one", "she's", "few", "by", "rn", "tell" , "before", "doesn't", "does", "where", "things", "who", "asked", "time", "again", "never", "i'd", "isn't" , "im", "first", "pretty", "being", "there's", "thought", "didnt", "thing", "other", "already", "any" , "last"}; String[] profanities = {"fuck", "fucking", "fuckin", "fucker", "shit", "shitty", "shitter", "motherfucker", "bastard", "shithead", "shit", "ass", "asshole", "ass", "fuckwad", "bitch", "cunt", "piss", "prick", "shitting", "goddamn", "damn", "hell", "dumbass", "fatass", "bitchass", "bitchy", "bitching", "bitchin", "bitcher", "bitches", "fucks", "f u c k", "s h i t"}; String[] derogatory_words = {"nigger", "nigga", "gook", "chink", "spic", "kike", "faggot", "homo", "retard"}; String[] attacks = {"fuck you", "hate you", "fuck off", "eat shit", "you suck", "you bitch", "stupid bitch", "get fucked", "you pussy", "you're a pussy", "kill yourself", "kys", "suck a dick", "suck my dick", "smd", "i will kill you", "i'll kill you", "who asked", "i don't care", "you're a bitch", "you dumbass", "i dont care", "dont care", "don't care", "nobody cares", "fuck yourself", "you're stupid", "your stupid", "your dumb", "you're dumb", "bitch boy", "kill your self", "kill you're self", "fuck your self", "you stupid", "you dumb", "eat a dick", "you're ugly", "you're so ugly", "your ugly", "your so ugly", "you are annoying", "you are so annoying", "you're annoying", "you're so annoying", "your annoying", "your so annoying", "you are ugly", "you are so ugly"}; String[] horny_words = new String[]{"horny", "gay", "sex", "penis", "dick", "cock", "anal", "missionary", "doggystyle", "doggy style", "pussy", "clit", "clitoris", "cum", "jizz", "ejaculate", "blowjob", "blow job", "suck dick", "suck his dick", "suck your dick", "jack off", "masturbate", "rub one out", "rubbing one out", "cumming", "coom", "cooming", "jizzing", "ejaculating", "blow him", "blowing him", "suck off", "suck him off", "squeeze", "jerk off", "jerking off", "jerk it", "jerking it", "swallow", "spitters are quitters", "handjob", "hand job", "dildo", "vibrator", "lube", "lubed", "nipple", "nipples", "penises", "penis", "dicks", "cocks", "boner", "erection", "erect", "boned", "boning", "rockhard", "rock hard", "dicked", "dick down", "poundtown", "pound town", "vagina", "slut", "kinky", "kink", "intercourse", "sexual", "sexy", "stroke it", "stroke it off", "docking", "nutting", "nice ass", "make me", "nice body", "aroused", "eat pussy", "go down on", "analingus", "eat ass", "eating ass", "ate ass", "eat out", "eating lunch", "eats lunch", "humping", "grinding", "rimjob", "rim job", "wanna fuck", "to fuck", "would fuck", "would smash", "wanna smash", "i'd smash", "kiss", "kissing", "making out", "make out", "makeout", "he's hot", "that's hot", "thats hot", "hes hot", "id smash", "spread it", "tits", "boobs", "titties", "boobies", "thicc", "thiccc", "thic", "meaty", "meat", "moist", "daddy", "puss", "slutty", "sext", "sexting", "nude", "asspounder", "nudes", "naked", "stripping", "stripper", "porn", "gayporn", "pornography", "pornographic", "pornhub", "porno", "bend over", "bend me over", "pound me", "pound my ass", "pounder", "bulge", "bulging", "pulsing", "throbbing", "sexually", "tie me up", "whip me", "grope", "fondle", "feel up", "fingered", "fingering", "slapping", "smack", "dicking", "stroking", "deepthroat", "deep throat", "deep throating", "gagging on", "take it off", "juicy", "come find out", "i'm gonna pre", "im gonna pre", "blow my load", "blow your load", "blow a load", "top him", "bottom me", "bottoming", "powerbottom", "power bottom", "bear", "bears", "twinks", "twink", "hunk", "hunks", "top me"}; /*String[] horny_words = {"horny", "sex", "gay", "penis", "dick", "cock", "anal", "missionary", "doggystyle", "doggy style", "pussy", "clit", "clitoris", "cum", "jizz", "ejaculate", "blowjob", "blow job", "suck dick", "suck his dick", "suck your dick", "jack off", "masturbate", "rub one out", "rubbing one out", "cumming", "coom", "cooming", "jizzing", "ejaculating", "blow him", "blowing him", "suck off", "suck him off", "squeeze", "jerk off", "jerking off", "jerk it", "jerking it", "swallow", "spitters are quitters", "handjob", "hand job", "dildo", "vibrator", "lube", "lubed", "nipple", "nipples", "penises", "penis", "dicks", "cocks", "boner", "erection", "erect", "boned", "boning", "rockhard", "rock hard", "dicked", "dick down", "poundtown", "pound town", "vagina", "slut", "kinky", "kink", "intercourse", "sexual", "sexy", "stroke it", "stroke it off", "docking", "nutting", "nice ass", "make me", "fleshlight", "nice body", "aroused", "eat pussy", "go down on", "analingus", "eat ass", "eating ass", "ate ass", "eat out", "eating lunch", "eats lunch", "humping", "grinding", "rimjob", "rim job", "wanna fuck", "to fuck", "would fuck", "would smash", "wanna smash", "i'd smash", "kiss", "kissing", "making out", "make out", "makeout", "he's hot", "that's hot", "thats hot", "hes hot", "id smash", "spread it", "tits", "boobs", "titties", "boobies", "thicc", "thiccc", "thic", "meaty", "meat", "moist", "daddy", "puss", "slutty", "sext", "sexting", "nude", "asspounder", "nudes", "naked", "stripping", "stripper", "porn", "gayporn", "pornography", "pornographic", "pornhub", "porno", "bend over", "bend me over", "pound me", "pound my ass", "pounder", "bulge", "bulging", "pulsing", "throbbing", "sexually", "tie me up", "whip me", "grope", "fondle", "feel up", "fingered", "fingering", "slapping", "smack", "dicking", "stroking", "deepthroat", "deep throat", "deep throating", "gagging on", "take it off", "juicy", "come find out", "i'm gonna pre", "im gonna pre", "blow my load", "blow your load", "blow a load", "top him", "bottom me", "bottoming", "powerbottom", "power bottom", "bear", "bears", "twinks", "twink", "hunk", "hunks", "moaned", "moaning", "moan", "arouse", "arousing", "so hot", "hot af", "hot as fuck", "long and hard", "thrust", "thrusting", "i'm hard", "im hard", "so hard", "that ass", "wet dream", "wet dreams", "douched", "douching", "to douche"};*/ public ChatRewind(){ Chat chat = new Chat("messages/inbox/society_ekt-war5ua/message_1.json"); for (int i = 2; i < 6; i++) chat.add_file("messages/inbox/society_ekt-war5ua/message_" + i + ".json"); //RYAN TRAN BROKE THE SYSTEM (THANKS CHRIS) for (GroupMember ryan : chat.getMembers()){ if (ryan.getMessages().isEmpty()){ chat.members.remove(ryan); break; } } // preliminary stats gathering thing yeah gather_message_counts(chat); gather_leave_counts(chat); gather_word_counts(chat); gather_react_counts(chat); gather_longest_messages(chat); find_best_messages(chat); find_lasting_nicknames(chat); //pick stats of interest //print_raw_stat("message count"); calculate_word_frequency(chat); most_frequent_words(chat); horniness(chat); meanness(chat); profaneness(chat); //FOR NOMINATIONS BEST MESSAGE (UTILITY; DO NOT USE IN FINAL PROGRAM) //nominate_messages(chat); /* for (Message m : chat.getMessages()){ if (m.timestamp_date.toLowerCase().endsWith("20")){ System.out.println(m.getTimestampFull()); System.out.println(m.getSenderName()+ ": " + m.getContent()); if (m.getReacts() != null) { for (Reaction react : m.getReacts()) { System.out.println("\t" + react.getActorName() + " reacted with a " + react.vibe); } } System.out.println("\n"); } }*/ //print stats compilation for (GroupMember member : chat.getMembers()){ System.out.println(generate_member_profile(chat, member) + "\n\n\n"); } //print_raw_stat("message count"); //print_raw_stat("meanness"); //print_raw_stat("meanness / message count"); //print_raw_stat("laugh reacts received"); //difference(chat, "laugh reacts received", "laugh reacts sent"); //most_frequent_words(chat); //count_phrase(chat," "); //print_raw_stat("said who asked"); //GET/PRINT TOP TEN WORDS FOR EACH PERSON /*for (int j = 0; j < 8; j++) { chat.getMembers().get(j).findTopTenWords(words_to_ignore); System.out.println(chat.members.get(j).getName() +":"); for (int i = 0; i < 20; i++) { System.out.print(chat.getMembers().get(j).topWords[i] + " "); } System.out.print("\n"); for (int i = 0; i < 20; i++) { System.out.print(chat.getMembers().get(j).word_freq.get(chat.getMembers().get(j).topWords[i]) + " "); } System.out.println("\n"); }*/ /*for (GroupMember member : chat.members){ System.out.println("\n" + member.getName() + "'s longest message: \n" + member.longestMessage.getContent() + "\n"); }*/ //chat.print_msgs(); //print_raw_stat("message count"); //print_raw_stat("word count"); //print_raw_stat("reacts sent"); //print_raw_stat("reacts received"); //print_raw_stat("laugh reacts sent"); //print_raw_stat("laugh reacts received"); //print_react_counts(chat); } public void gather_leave_counts(Chat chat){ stats.put("leave count", new HashMap<>()); for (GroupMember member : chat.getMembers()) { stats.get("leave count").put(member, member.leaveCount); } get_highest("leave count").assignTitle("most leaves"); } public void find_lasting_nicknames(Chat chat){ for (GroupMember member : chat.getMembers()){ member.findLastingNickname(); } } public String generate_member_profile(Chat chat, GroupMember member){ String s = ""; s += member.getName().toUpperCase() + "\n" + member.descriptor + //"\n" + member.getTitles() + "\n----------------------------------------\n\n"; // NICKNAMES if (member.getNicknames().size() > 1) { s += member.getFirstname() + " went by " + member.getNicknames().size() + " different nicknames this year.\n"; s += "...but the name that stuck with them the most this year was " + member.lasting_nickname + ".\n\n"; } else if (!member.getNicknames().isEmpty()){ s += member.getFirstname() + " went by the nickname " + member.getNicknames().get(0) + " this year.\n\n"; } // MESSAGE COUNT s += member.getFirstname() + " sent " + member.getMessages().size() + " messages. \n"; s += "(That's %" + String.format("%.2f", (100.0f * member.getMessages().size())/ chat.getMessages().size()) + " of the chat's messages this year, at an average of " + String.format("%.2f", (1.0f * member.getMessages().size() / 365)) + " messages per day.)\n"; if (member.getTitles().contains("most messages")){ s += "This was also the most messages sent by anybody in the chat! Why not find something better to do?\n"; } else if (member.getTitles().contains("least messages")) { s += "This was also the least messages sent by anybody in the chat! Mysterious...\n"; } s+= "\n"; // WORD FREQUENCY s += "Some of " + member.getFirstname() + "'s favourite words this year were: \n\t"; for (int i = 0; i < 10; i++){ if ((i+1) % 5 != 0) s += member.topWords[i] + ", "; else s += member.topWords[i] + "\n\t"; } s+= "\n"; s+= "Let's take a closer look at " + member.getFirstname() + "'s year in the chat:\n\n"; // HORNINESS //MOST if (member.getTitles().contains("most horny") && member.getTitles().contains("most horny normalized")){ s += "PERVERT:\n\tIn terms of horniness, " + member.getFirstname() + " is the undisputed champion, sending up to " + stats.get("horniness").get(member) + " horny messages, at a rate higher than anybody else.\n\t" + "Time to take a nice cold shower!\n\n"; } else if(member.getTitles().contains("most horny")){ s += "SEXUALLY ACTIVE:\n\tIn terms of horniness, " + member.getFirstname() + " let loose the most, with " + stats.get("horniness").get(member) + " horny messages!\n\t" + "However, " + get_highest("horniness / message count").getFirstname() + " had a higher " + "concentration of horny messages, with " + stats.get("horniness").get( get_highest("horniness / message count")) + " horny texts over " + get_highest("horniness / message count").getMessages().size() + " messages.\n\n"; } else if(member.getTitles().contains("most horny normalized")){ s += "MIND IN THE GUTTER:\n\tIn terms of horniness, " + member.getFirstname() + " had the highest concentration of horniness," + " sending " + stats.get("horniness").get(member) + " horny messages!\n\t" + "However, " + get_highest("horniness").getFirstname() + " outperforms in sheer volume, sending " + stats.get("horniness").get(get_highest("horniness")) + " horny messages.\n\n"; } //LEAST if (member.getTitles().contains("least horny") && member.getTitles().contains("least horny normalized")){ s += "MASTER OF THEIR DOMAIN:\n\t" + member.getFirstname() + " is the least horniest in the chat," + " sending only " + stats.get("horniness").get(member) + " horny messages, at a rate less than" + " anybody else.\n\t" + "Good for him, I guess.\n\n"; } else if(member.getTitles().contains("least horny")){ s += "LOW TESTOSTERONE: \n\tIn terms of horniness, " + member.getFirstname() + " let loose the least, with " + stats.get("horniness").get(member) + " horny messages!\n\t" + "However, " + get_lowest("horniness / message count").getFirstname() + " had a lower " + "concentration of horny messages, with " + stats.get("horniness").get( get_lowest("horniness / message count")) + " horny texts over " + get_lowest("horniness / message count").getMessages().size() + " messages.\n\n"; } else if(member.getTitles().contains("least horny normalized")){ s += "ASEXUAL:\n\t " + member.getFirstname() + "'s messages had the lowest concentration of horniness, (" + stats.get("horniness").get(member) + " horny messages).\n\n"; } // MEANNESS if (member.getTitles().contains("meanest") && member.getTitles().contains("meanest normalized")){ s += "LASHING OUT: \n\t" + member.getFirstname() + " was hands down the meanest person in the chat," + " making up to " + stats.get("meanness").get(member) + " vicious comments, at a rate higher than anybody else.\n\t" + "(Please go talk to somebody)\n\n"; } else if(member.getTitles().contains("meanest")){ s += "BAD VIBES: \n\t" + member.getFirstname() + " sent the most mean messages in the chat (" + stats.get("meanness").get(member) + ").\n\t" + "However, " + get_highest("meanness / message count").getFirstname() + " had a higher " + "concentration of vitriol, with " + stats.get("meanness").get( get_highest("meanness / message count")) + " mean texts over " + get_highest("meanness / message count").getMessages().size() + " messages.\n\n"; } else if(member.getTitles().contains("meanest normalized")){ s += "SHORT FUSE: \n\t" +member.getFirstname() + " was the meanest person in the chat," + " making " + stats.get("meanness").get(member) + " mean comments over " + get_highest("meanness / message count").getMessages().size() + " messages.\n\n"; } //PROFANITY if (member.getTitles().contains("most vulgar") && member.getTitles().contains("most vulgar normalized")){ s += "MOTOR MOUTH: \n\t" + member.getFirstname() + " was hands down the most vulgar person in the chat," + " saying " + stats.get("profaneness").get(member) + " profanities, at a rate higher than anybody else.\n\t" + "(Watch your mouth!)\n\n"; } else if(member.getTitles().contains("most vulgar")){ s += "TOO COMFORTABLE: \n\t" +member.getFirstname() + " sent the most vulgar messages in the chat (" + stats.get("profaneness").get(member) + ").\n" + "However, " + get_highest("profaneness / message count").getFirstname() + " had a higher " + "concentration of profanity, with " + stats.get("meanness").get( get_highest("profaneness / message count")) + " swears over " + get_highest("profaneness / message count").getMessages().size() + " messages.\n\n"; } else if(member.getTitles().contains("most vulgar normalized")){ s += "COLOURFUL VOCABULARY: \n\t" +member.getFirstname() + " was proportionately the most vulgar person in the chat," + " making " + stats.get("profaneness").get(member) + " mean comments over" + get_highest("profaneness / message count").getMessages().size() + " messages.\n\n"; } //TOTAL REACTS RECEIVED if (member.getTitles().contains("most reacts received")) { s += "ATTENTION WHORE: \n\t" + member.getFirstname() + " got the most reactions (" + stats.get("reacts received").get(member) + ") to their messages.\n\t" + "Here's their biggest one:\n\n\t\t" + chat.msg_toString(member.getMostReacted("any")) + "\n\t\t" + member.getMostReacted("any").getTimestampFull() + "\n"; for (Reaction react : member.getMostReacted("any").getReacts()) { s += "\t\t\t" + react.getActorName() + " reacted with a " + react.vibe + "\n"; } s += "\n"; } //LAUGH REACTS RECEIVED if (member.getTitles().contains("most laugh reacts received")){ s += "SEINFELD: \n\t" + member.getFirstname() + " got the most laughs, with " + stats.get("laugh reacts received").get(member) + " laugh reacts given to their messages.\n\t" + "Here's one of their funniest messages this year:\n\n\t\t" + chat.msg_toString(member.getMostReacted("laugh")) + "\n\t\t" + member.getMostReacted("laugh").getTimestampFull() + "\n"; for (Reaction react : member.getMostReacted("laugh").getReacts()){ s += "\t\t\t" + react.getActorName() + " reacted with a " + react.vibe + "\n"; } s += "\n"; if (member.getTitles().contains("most laugh reacted message")) { s += "\t(This message is also one of the most laugh reacted messages this year.)\n\n"; } } else if (member.getTitles().contains("most laugh reacts received normalized")) { s += "QUALITY OVER QUANTITY: \n\t" + member.getFirstname() + " was the most consistently funny, with " + stats.get("laugh reacts received").get(member) + " laugh reacts given to their messages.\n\t" + "Here's one of their funniest messages this year:\n\n\t\t" //+ chat.msg_toString(member.getMostReacted("laugh")) + "\n"; + chat.msg_toString(member.getMostReacted("laugh")) + "\n\t\t" + member.getMostReacted("laugh").getTimestampFull() + "\n"; for (Reaction react : member.getMostReacted("laugh").getReacts()){ s += "\t\t\t" + react.getActorName() + " reacted with a " + react.vibe + "\n"; } s += "\n"; if (member.getTitles().contains("most laugh reacted message")) { s += "\t(This message is also one of the most laugh reacted messages this year.)\n\n"; } } else if (member.getTitles().contains("most laugh reacted message")) { s += "ONE HIT WONDER: \n\t" + member.getFirstname() + " got the most laughs from a single message.\n\t" + "Here it is:\n\n\t\t" + chat.msg_toString(member.getMostReacted("laugh")) + "\n\t\t" + member.getMostReacted("laugh").getTimestampFull() + "\n"; for (Reaction react : member.getMostReacted("laugh").getReacts()){ s += "\t\t\t" + react.getActorName() + " reacted with a " + react.vibe + "\n"; } s += "\n"; } //HEART REACTS SENT/RECEIVED if (member.getTitles().contains("most heart reacts sent")){ s += "LOVEMAKER: \n\t" + member.getFirstname() + " spread the most love, with " + stats.get("heart reacts sent").get(member) + " heart reacts sent.\n\t" + "Here's one of their own messages that got some love this year:\n\n\t\t" + chat.msg_toString(member.getMostReacted("heart")) + "\n\t\t" + member.getMostReacted("heart").getTimestampFull() + "\n"; for (Reaction react : member.getMostReacted("heart").getReacts()){ s += "\t\t\t" + react.getActorName() + " reacted with a " + react.vibe + "\n"; } s += "\n"; if (member.getTitles().contains("most heart reacted message")) { s += "\t(This message is also one of the most heart reacted messages this year.)\n\n"; } } else if (member.getTitles().contains("most heart reacted message")) { s += "LOVE WINS: \n\t" + member.getFirstname() + " got the most hearts from a single message.\n\t" + "Here it is:\n\n\t\t" + chat.msg_toString(member.getMostReacted("heart")) + "\n\t\t" + member.getMostReacted("heart").getTimestampFull() + "\n"; for (Reaction react : member.getMostReacted("heart").getReacts()){ s += "\t\t\t" + react.getActorName() + " reacted with a " + react.vibe + "\n"; } s += "\n"; } //SAD REACTS if (member.getTitles().contains("most sad reacts received")){ s += "PITY PARTY: \n\t" + member.getFirstname() + " got the most sympathy, with " + stats.get("laugh reacts received").get(member) + " sad reacts given to their messages.\n\t" + "Here's one of their saddest messages this year:\n\n\t\t" + chat.msg_toString(member.getMostReacted("sad")) + "\n\t\t" + member.getMostReacted("sad").getTimestampFull() + "\n"; for (Reaction react : member.getMostReacted("sad").getReacts()){ s += "\t\t\t" + react.getActorName() + " reacted with a " + react.vibe + "\n"; } s += "\n"; if (member.getTitles().contains("most sad reacted message")) { s += "\t(This message is also one of the most sad reacted messages this year.)\n\n"; } } else if (member.getTitles().contains("most sad reacted message")) { s += "SOB STORY: \n\t" + member.getFirstname() + " got the most sad reacts from a single message.\n\t" + "Here it is:\n\n\t\t" + chat.msg_toString(member.getMostReacted("sad")) + "\n\t\t" + member.getMostReacted("sad").getTimestampFull() + "\n"; for (Reaction react : member.getMostReacted("sad").getReacts()){ s += "\t\t\t" + react.getActorName() + " reacted with a " + react.vibe + "\n"; } s += "\n"; } //MOST ANGRY REACTS if (member.getTitles().contains("most angry reacted message")) { s += "OUTRAGE CULTURE: \n\t" + member.getFirstname() + " got the most angry reacts from a single message.\n\t" + "Here it is:\n\n\t\t" + chat.msg_toString(member.getMostReacted("angry")) + "\n\t\t" + member.getMostReacted("angry").getTimestampFull() + "\n"; for (Reaction react : member.getMostReacted("angry").getReacts()){ s += "\t\t\t" + react.getActorName() + " reacted with a " + react.vibe + "\n"; } s += "\n"; } //MOST THUMBS DOWN if (member.getTitles().contains("most downvoted message")) { s += "DISAPPROVAL: \n\t" + member.getFirstname() + " sent the most disliked message in the chat.\n\t" + "Here it is:\n\n\t\t" + chat.msg_toString(member.getMostReacted("thumbs down")) + "\n\t\t" + member.getMostReacted("thumbs down").getTimestampFull() + "\n"; for (Reaction react : member.getMostReacted("thumbs down").getReacts()){ s += "\t\t\t" + react.getActorName() + " reacted with a " + react.vibe + "\n"; } s += "\n"; } //MOST WOW REACTS if (member.getTitles().contains("most wow reacted message")) { s += "SHOCKING: \n\t" + member.getFirstname() + " sent the most shocking message in the chat.\n\t" + "Here it is:\n\n\t\t" + chat.msg_toString(member.getMostReacted("wow")) + "\n\t\t" + member.getMostReacted("wow").getTimestampFull() + "\n"; for (Reaction react : member.getMostReacted("wow").getReacts()){ s += "\t\t\t" + react.getActorName() + " reacted with a " + react.vibe + "\n"; } s += "\n"; } //CHAT LEAVES if (member.getTitles().contains("most leaves")) { s += "DISGRACED: \n\t" + member.getFirstname() + " left the chat " + stats.get("leave count").get(member) + " times.\n\tShame on him!"; } //TFW NO TITLES if (member.getTitles().isEmpty()){ s += member.getFirstname() + " said penis " + member.countPhrase("penis") + " times. That's all I got.\n" + "Better luck next year, I guess."; } //TODO ADD METHOD TO FIND OUT RELATIONSHIPS BETWEEN MEMBERS (WHO WAS REACTING MOST CONSISTENTLY TO WHOM, ETC.) return s; } public void meanness(Chat chat){ stats.put("meanness", new HashMap<>()); for (GroupMember member : chat.getMembers()) { stats.get("meanness").put(member, 0); //initialize stat for (String phrase : attacks) stats.get("meanness").put(member, stats.get("meanness").get(member) + member.countPhrase(phrase)); } GroupMember rawtopdog = get_highest("meanness"); GroupMember rawbottom = get_lowest("meanness"); normalize(chat, "meanness"); GroupMember topdog = get_highest("meanness / message count"); GroupMember bottom = get_lowest("meanness / message count"); rawtopdog.assignTitle("meanest"); rawbottom.assignTitle("least mean"); topdog.assignTitle("meanest normalized"); bottom.assignTitle("least mean normalized"); //System.out.println(topdog.getName() + " was the most horny!\n"); //print_raw_stat("horniness"); } public void profaneness(Chat chat){ stats.put("profaneness", new HashMap<>()); for (GroupMember member : chat.getMembers()) { stats.get("profaneness").put(member, 0); //initialize stat for (String phrase : profanities) stats.get("profaneness").put(member, stats.get("profaneness").get(member) + member.countPhrase(phrase)); } GroupMember rawtopdog = get_highest("profaneness"); GroupMember rawbottom = get_lowest("profaneness"); normalize(chat, "profaneness"); GroupMember topdog = get_highest("profaneness / message count"); GroupMember bottom = get_lowest("profaneness / message count"); rawtopdog.assignTitle("most vulgar"); rawbottom.assignTitle("least vulgar"); topdog.assignTitle("most vulgar normalized"); bottom.assignTitle("least vulgar normalized"); //System.out.println(topdog.getName() + " was the most horny!\n"); //print_raw_stat("horniness"); } public void find_best_messages(Chat chat){ stats.put("most reacts", new HashMap<>()); stats.put("most laugh reacts", new HashMap<>()); stats.put("most wow reacts", new HashMap<>()); stats.put("most angry reacts", new HashMap<>()); stats.put("most sad reacts", new HashMap<>()); stats.put("most heart reacts", new HashMap<>()); stats.put("most thumbs up", new HashMap<>()); stats.put("most thumbs down", new HashMap<>()); for (GroupMember member : chat.getMembers()) { //calculate stats member.findMostReacted("any"); member.findMostReacted("laugh"); member.findMostReacted("wow"); member.findMostReacted("sad"); member.findMostReacted("angry"); member.findMostReacted("heart"); member.findMostReacted("thumbs up"); member.findMostReacted("thumbs down"); //gather stats stats.get("most reacts").put(member, member.topReactNum); stats.get("most laugh reacts").put(member, member.topLaughNum); stats.get("most wow reacts").put(member, member.topWowNum); stats.get("most sad reacts").put(member, member.topSadNum); stats.get("most angry reacts").put(member, member.topAngryNum); stats.get("most heart reacts").put(member, member.topHeartNum); stats.get("most thumbs up").put(member, member.topUpNum); stats.get("most thumbs down").put(member, member.topDownNum); /*System.out.println(member.getName() + "'s most reacted message: \n\t" + member.getMostReacted("any").getContent()); if (member.getMostReacted("any").getReacts() != null) { for (Reaction react : member.getMostReacted("any").getReacts()) { System.out.println("\t\t" + react.getActorName() + " reacted with a " + react.vibe); } } System.out.println();*/ } //award titles get_highest("most reacts").assignTitle("most reacted message"); get_highest("most laugh reacts").assignTitle("most laugh reacted message"); get_highest("most wow reacts").assignTitle("most wow reacted message"); get_highest("most sad reacts").assignTitle("most sad reacted message"); get_highest("most angry reacts").assignTitle("most angry reacted message"); get_highest("most heart reacts").assignTitle("most heart reacted message"); get_highest("most thumbs up").assignTitle("most upvoted message"); get_highest("most thumbs down").assignTitle("most downvoted message"); } /** * retrieve the value of a given stat for a given member * @param stat * @param m * @return */ public int get_stat(String stat, GroupMember m){ return stats.get(stat).get(m); } /** * divides another stat by the value of a given stat (message count is default stat2) * @param chat * @param stat */ public void normalize(Chat chat, String stat){ stats.put(stat + " / message count", new HashMap<>()); for (GroupMember member : chat.getMembers()){ float normo = 1.0f* get_stat(stat, member) / get_stat("message count", member); stats.get(stat + " / message count").put(member, (int)(normo * 10000)); } //print_raw_stat(stat + " / message count"); } public void normalize(Chat chat, String stat, String stat2){ stats.put(stat + " / " + stat2, new HashMap<>()); for (GroupMember member : chat.getMembers()){ float normo = 1.0f* get_stat(stat, member) / get_stat(stat2, member); stats.get(stat + " / " + stat2).put(member, (int)(normo * 100)); } //print_raw_stat(stat + " / " + stat2); } /** * subtracts a stat value from an opposing stat value * @param chat * @param stat * @param stat2 */ public void difference(Chat chat, String stat, String stat2){ stats.put("net " + stat, new HashMap<>()); for (GroupMember member : chat.getMembers()){ stats.get("net " + stat).put(member, get_stat(stat, member) - get_stat(stat2, member)); } print_raw_stat("net " + stat); } public void horniness(Chat chat){ stats.put("horniness", new HashMap<>()); for (GroupMember member : chat.getMembers()) { stats.get("horniness").put(member, 0); //initialize stat for (String phrase : horny_words) stats.get("horniness").put(member, stats.get("horniness").get(member) + member.countPhrase(phrase)); } GroupMember rawtopdog = get_highest("horniness"); GroupMember rawbottom = get_lowest("horniness"); normalize(chat, "horniness"); GroupMember topdog = get_highest("horniness / message count"); GroupMember bottom = get_lowest("horniness / message count"); rawtopdog.assignTitle("most horny"); rawbottom.assignTitle("least horny"); topdog.assignTitle("most horny normalized"); bottom.assignTitle("least horny normalized"); //System.out.println(topdog.getName() + " was the most horny!\n"); //print_raw_stat("horniness"); } public void count_phrase(Chat chat, String phrase){ if (phrase.replace(" ", "cum").equals(phrase)){ //System.out.println("single word phrase, redirecting to count_word for maximum efficiency"); count_word(chat, phrase); } else { stats.put("said " + phrase, new HashMap<>()); for (GroupMember member : chat.getMembers()) { stats.get("said " + phrase).put(member, member.countPhrase(phrase)); } GroupMember topdog = get_highest("said " + phrase); topdog.assignTitle("said " + phrase); System.out.println(topdog.getName() + " said " + phrase + " " + stats.get("said " + phrase).get(topdog) + " times!"); } } public void count_word(Chat chat, String word){ stats.put("said " + word, new HashMap<>()); for (GroupMember member : chat.getMembers()) { stats.get("said " + word).put(member, member.countWord(word)); } GroupMember topdog = get_highest("said " + word); topdog.assignTitle("said " + word); System.out.println(topdog.getName() + " said " + word + " " + stats.get("said " + word).get(topdog) + " times!"); } public void most_frequent_words(Chat chat){ String[] topWords = new String[20]; for (Map.Entry<String,Integer> item : word_freq.entrySet()){ // skip stupid words if (Arrays.asList(words_to_ignore).contains(item.getKey())) continue; for (int i = 0; i < topWords.length; i++){ if (topWords[i] == null || item.getValue() > word_freq.get(topWords[i])){ if (topWords[i] != null) { for (int j = topWords.length - 1; j > i; j--) { topWords[j] = topWords[j - 1]; } } topWords[i] = item.getKey(); break; } } } /*for (int i = 0; i < 20; i++) { System.out.print(topWords[i] + " "); } System.out.println("\n");*/ for (GroupMember member : chat.getMembers()){ member.findTopTenWords(words_to_ignore); } } public void gather_frequent_words(Chat chat){ stats.put("most frequent word", new HashMap<>()); for (GroupMember member : chat.getMembers()) { } } public void calculate_word_frequency(Chat chat){ for (Message message : chat.getMessages()){ if (message.content != null) { GroupMember sender = message.getSender(); StringTokenizer st = new StringTokenizer(message.content); while (st.hasMoreTokens()) { String current = st.nextToken(); //remove leading weird characters so that counting is accurate while ((current.startsWith("\"") || current.startsWith("'") || current.startsWith(".") || current.startsWith("(") || current.startsWith(")") || current.startsWith("*")) && current.length() > 1) { current = current.substring(1); } //remove trailing weird characters so that counting is accurate while (current.endsWith("\"") || current.endsWith("'") || current.endsWith("?") || current.endsWith(".") || current.endsWith(":") || current.endsWith("*") || current.endsWith("!") || current.endsWith(")") || current.endsWith("(") || current.endsWith(",")) { if (current.length() > 1) current = current.substring(0, current.length() - 1); else break; } //convert everything to lowercase so that counting is accurate current = current.toLowerCase(); //for total word freq if (word_freq.containsKey(current)) word_freq.put(current, word_freq.get(current) + 1); else word_freq.put(current, 1); //for member word freq if (sender.word_freq.containsKey(current)) sender.word_freq.put(current, sender.word_freq.get(current) + 1); else sender.word_freq.put(current, 1); } } } } /** * longest message by character count * @param chat */ public void gather_longest_messages(Chat chat){ stats.put("longest message", new HashMap<>()); for (GroupMember member : chat.getMembers()) { member.findLongestMessage(); stats.get("longest message").put(member, member.longestMessage.getContent().length()); } get_highest("longest message").assignTitle("longest message"); } public GroupMember get_highest(String stat){ GroupMember topdog = null; int highest = -1; for (Map.Entry<GroupMember,Integer> item : stats.get(stat).entrySet()){ if (item.getValue() > highest){ highest = item.getValue(); topdog = item.getKey(); } } return topdog; } public GroupMember get_lowest(String stat){ GroupMember bottom = null; int lowest = -1; for (Map.Entry<GroupMember,Integer> item : stats.get(stat).entrySet()){ if (item.getValue() < lowest || lowest == -1){ lowest = item.getValue(); bottom = item.getKey(); } } return bottom; } public void gather_message_counts(Chat chat){ stats.put("message count", new HashMap<>()); for (GroupMember member : chat.getMembers()) { stats.get("message count").put(member, member.messages.size()); } get_highest("message count").assignTitle("most messages"); get_lowest("message count").assignTitle("least messages"); } public void gather_word_counts(Chat chat){ stats.put("word count", new HashMap<>()); for (GroupMember member : chat.getMembers()) { stats.get("word count").put(member, member.getWordCount()); } get_highest("word count").assignTitle("most words"); get_lowest("word count").assignTitle("least words"); } public void gather_react_counts(Chat chat){ stats.put("reacts sent", new HashMap<>()); stats.put("reacts received", new HashMap<>()); stats.put("laugh reacts sent", new HashMap<>()); stats.put("laugh reacts received", new HashMap<>()); stats.put("wow reacts sent", new HashMap<>()); stats.put("wow reacts received", new HashMap<>()); stats.put("heart reacts sent", new HashMap<>()); stats.put("heart reacts received", new HashMap<>()); stats.put("sad reacts sent", new HashMap<>()); stats.put("sad reacts received", new HashMap<>()); stats.put("angry reacts sent", new HashMap<>()); stats.put("angry reacts received", new HashMap<>()); stats.put("thumbs up reacts sent", new HashMap<>()); stats.put("thumbs up reacts received", new HashMap<>()); stats.put("thumbs down reacts sent", new HashMap<>()); stats.put("thumbs down reacts received", new HashMap<>()); for (GroupMember member : chat.getMembers()){ member.sortReacts(); stats.get("reacts sent").put(member, member.reactsSent.size()); stats.get("reacts received").put(member, member.reactsReceived.size()); stats.get("laugh reacts sent").put(member, member.laughReactsSent); stats.get("laugh reacts received").put(member, member.laughReactsReceived); stats.get("wow reacts sent").put(member, member.wowReactsSent); stats.get("wow reacts received").put(member, member.wowReactsReceived); stats.get("heart reacts sent").put(member, member.heartReactsSent); stats.get("heart reacts received").put(member, member.heartReactsReceived); stats.get("sad reacts sent").put(member, member.sadReactsSent); stats.get("sad reacts received").put(member, member.sadReactsReceived); stats.get("angry reacts sent").put(member, member.angryReactsSent); stats.get("angry reacts received").put(member, member.angryReactsReceived); stats.get("thumbs up reacts sent").put(member, member.thumbsUpReactsSent); stats.get("thumbs up reacts received").put(member, member.thumbsUpReactsReceived); stats.get("thumbs down reacts sent").put(member, member.thumbsDownReactsSent); stats.get("thumbs down reacts received").put(member, member.thumbsDownReactsReceived); } get_highest("reacts sent").assignTitle("most reacts sent"); get_highest("reacts received").assignTitle("most reacts received"); get_highest("laugh reacts sent").assignTitle("most laugh reacts sent"); get_highest("laugh reacts received").assignTitle("most laugh reacts received"); normalize(chat, "laugh reacts received"); get_highest("laugh reacts received / message count").assignTitle("most laugh reacts received normalized"); get_highest("wow reacts sent").assignTitle("most wow reacts sent"); get_highest("wow reacts received").assignTitle("most wow reacts received"); get_highest("heart reacts sent").assignTitle("most heart reacts sent"); get_highest("heart reacts received").assignTitle("most heart reacts received"); get_highest("sad reacts sent").assignTitle("most sad reacts sent"); get_highest("sad reacts received").assignTitle("most sad reacts received"); get_highest("angry reacts sent").assignTitle("most angry reacts sent"); get_highest("angry reacts received").assignTitle("most angry reacts received"); get_highest("thumbs up reacts sent").assignTitle("most thumbs up reacts sent"); get_highest("thumbs up reacts received").assignTitle("most thumbs up reacts received"); get_highest("thumbs down reacts sent").assignTitle("most thumbs down reacts sent"); get_highest("thumbs down reacts received").assignTitle("most thumbs down reacts received"); } public void print_raw_stat(String stat){ System.out.println("\n" + stat.toUpperCase() + ":"); for (Map.Entry<GroupMember,Integer> item : stats.get(stat).entrySet()){ System.out.println(item.getKey().getName() + ": " + item.getValue()); } System.out.println(); } public void print_react_counts(Chat chat){ for (GroupMember member : chat.getMembers()){ member.sortReacts(); } System.out.println("\nREACTS SENT:"); for (GroupMember member : chat.getMembers()){ System.out.println(member.getName() + ": " + member.reactsSent.size()); } System.out.println("\nREACTS RECEIVED:"); for (GroupMember member : chat.getMembers()){ System.out.println(member.getName() + ": " + member.reactsReceived.size()); } System.out.println("\nLAUGH REACTS:"); for (GroupMember member : chat.getMembers()){ System.out.println(member.getName() + ": " + member.laughReactsSent + " sent, " + member.laughReactsReceived + " received."); } System.out.println("\nWOW REACTS:"); for (GroupMember member : chat.getMembers()){ System.out.println(member.getName() + ": " + member.wowReactsSent + " sent, " + member.wowReactsReceived + " received."); } System.out.println("\nANGRY REACTS:"); for (GroupMember member : chat.getMembers()){ System.out.println(member.getName() + ": " + member.angryReactsSent + " sent, " + member.angryReactsReceived + " received."); } System.out.println("\nSAD REACTS:"); for (GroupMember member : chat.getMembers()){ System.out.println(member.getName() + ": " + member.sadReactsSent + " sent, " + member.sadReactsReceived + " received."); } System.out.println("\nHEART REACTS:"); for (GroupMember member : chat.getMembers()){ System.out.println(member.getName() + ": " + member.heartReactsSent + " sent, " + member.heartReactsReceived + " received."); } System.out.println("\nTHUMBS UP REACTS:"); for (GroupMember member : chat.getMembers()){ System.out.println(member.getName() + ": " + member.thumbsUpReactsSent + " sent, " + member.thumbsUpReactsReceived + " received."); } System.out.println("\nTHUMBS DOWN REACTS:"); for (GroupMember member : chat.getMembers()){ System.out.println(member.getName() + ": " + member.thumbsDownReactsSent + " sent, " + member.thumbsDownReactsReceived + " received."); } } public void nominate_messages(Chat chat){ for (Message m : chat.top_messages){ System.out.print(m.getSenderName()+ ": "); if (m.getContent() != null) System.out.println(m.getContent()); else System.out.println(m.getPhoto()); if (m.getReacts() != null) { for (Reaction react : m.getReacts()) { System.out.println("\t" + react.getActorName() + " reacted with a " + react.vibe); } } System.out.println("\n"); } } public static void main(String[] args){ new ChatRewind(); //chat.print_msgs(); } }
[ "drc244@mail.usask.ca" ]
drc244@mail.usask.ca
11a880e5289f60c37177a09720621592b8d8fa4e
a876f87aa2fab7296fadfeb78635d40658ea6e6f
/build-tool-plugins/juniversal-gradle-plugins/src/main/java/org/juniversal/buildtools/gradle/JavaToObjectiveCPlugin.java
0cd0706a663c88177bbc834986bd0fbd4b169325
[ "MIT" ]
permissive
ralic/juniversal
d8d76f6b0c6b281ce8de3b25fddbf72beccef653
c5cecea5a58cd82604ecd7591dc0a02a7c84643e
refs/heads/master
2021-01-19T21:09:42.536994
2015-03-21T16:19:03
2015-03-21T16:19:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,482
java
/* * Copyright (c) 2012-2015, Microsoft Mobile * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ package org.juniversal.buildtools.gradle; import org.gradle.api.Plugin; import org.gradle.api.Project; /** * Created by Bret on 11/16/2014. */ public class JavaToObjectiveCPlugin implements Plugin<Project> { @Override public void apply(Project target) { target.getTasks().create("javaToObjectiveC", JavaToObjectiveCTask.class); } }
[ "bret.johnson@microsoft.com" ]
bret.johnson@microsoft.com
87786bce499eb966a7514a291852ddd66c3013f5
53d677a55e4ece8883526738f1c9d00fa6560ff7
/com/tencent/tinker/c/a/c/a$2.java
c6b8820a6791159564bb46b9c8bf9d2215402664
[]
no_license
0jinxing/wechat-apk-source
544c2d79bfc10261eb36389c1edfdf553d8f312a
f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d
refs/heads/master
2020-06-07T20:06:03.580028
2019-06-21T09:17:26
2019-06-21T09:17:26
193,069,132
9
4
null
null
null
null
UTF-8
Java
false
false
534
java
package com.tencent.tinker.c.a.c; import com.tencent.tinker.a.a.b.b; import java.io.ByteArrayOutputStream; public final class a$2 implements b { public a$2(a parama, ByteArrayOutputStream paramByteArrayOutputStream) { } public final void writeByte(int paramInt) { this.AyW.write(paramInt); } } /* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes8-dex2jar.jar * Qualified Name: com.tencent.tinker.c.a.c.a.2 * JD-Core Version: 0.6.2 */
[ "172601673@qq.com" ]
172601673@qq.com
93112fcbede0c0782827712ccb8089e1b1d920fc
954c1564cffa23eee8f6bf2ca9bc689fabd2d5a1
/app/src/androidTest/java/psicanagrammer/gevapps/com/psicanagrammer/ApplicationTest.java
c618ba938bb462ca39ea161b2aedd8adebd60807
[]
no_license
MFMolaGit/PsicanagrammerAndroid
6e7a0feea161f52f8ca2dad82b4e51888b64b508
8cfebe3fc955fe731ef39edaf72a03fd88d30cb3
refs/heads/master
2020-05-31T01:34:31.755994
2015-04-14T05:33:30
2015-04-14T05:33:30
31,926,992
0
0
null
null
null
null
UTF-8
Java
false
false
372
java
package psicanagrammer.gevapps.com.psicanagrammer; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "manuelf.mola@gmail.com" ]
manuelf.mola@gmail.com
ebb43ab58103c29c3e6ca74f21c81831d6d3b71a
d4c28379dd2fe6858ab7fba541ae4992bded9516
/src/org/myatsumoto/mechakucha_sex/Size.java
1177f52ca8cefc863f3f3ea34cb5c09034ba9738
[]
no_license
matsumotius/mechakucha-sex
4bca3037fd2c7f0f6cea5077c9e2db192d18b3b9
056efe6afade113bdb3eb14e08feb4891ac8a0b0
refs/heads/master
2016-09-08T05:06:10.199791
2014-02-20T19:49:57
2014-02-20T19:49:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
224
java
package org.myatsumoto.mechakucha_sex; public class Size { public int width = 0; public int height = 0; public Size() { } public Size(int width, int height) { this.width = width; this.height = height; } }
[ "matsumotius8@gmail.com" ]
matsumotius8@gmail.com
7a0db4ac04c2f2fc8a8a4ac93562056e33de07c2
d528fe4f3aa3a7eca7c5ba4e0aee43421e60857f
/src/xgxt/wjdc/comm/wjgl/WjglDAO.java
6debf0b475b8b1345d7c52df95a4925c4abce740
[]
no_license
gxlioper/xajd
81bd19a7c4b9f2d1a41a23295497b6de0dae4169
b7d4237acf7d6ffeca1c4a5a6717594ca55f1673
refs/heads/master
2022-03-06T15:49:34.004924
2019-11-19T07:43:25
2019-11-19T07:43:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
97
java
package xgxt.wjdc.comm.wjgl; import xgxt.DAO.DAO; public class WjglDAO extends DAO { }
[ "1398796456@qq.com" ]
1398796456@qq.com
c9275f153b9a68b5ed33bf4addd62d30e7424f57
c2bbab55eda89d47dee451889d2151814481ecb8
/app/src/main/java/com/example/employee_crud/adapter/EmployeesAdapter.java
476fe69611d5efdcf01f726e970d8df94d2db710
[]
no_license
osundiranay/Android_1MEmployee_CRUD
c37d92af9d7852863833cd91bb907c37c0abd17d
00b2d1834866444893b37783c3b70a0668e00209
refs/heads/master
2023-08-03T16:12:10.518538
2019-12-26T12:36:00
2019-12-26T12:36:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,199
java
package com.example.employee_crud.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import com.example.employee_crud.R; import com.example.employee_crud.model.Employee; import java.util.List; public class EmployeesAdapter extends RecyclerView.Adapter<EmployeesAdapter.EmployeesViewHolder>{ //Context context; //referencing the lists of employees private List<Employee>employeeList; public EmployeesAdapter(List<Employee> employeeList) { this.employeeList = employeeList; } @NonNull @Override public EmployeesViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.employee_recycler,parent,false); return new EmployeesViewHolder(view); } @Override public void onBindViewHolder(@NonNull EmployeesViewHolder holder, int position) { Employee employee = employeeList.get(position); holder.tvId.setText(Integer.toString(employee.getId())); holder.tvName.setText(employee.getEmployee_name()); holder.tvAge.setText(Integer.toString(employee.getEmployee_age())); holder.tvSalary.setText(Float.toString(employee.getEmployee_salary())); holder.tvProfileImg.setText(employee.getProfile_image()); } @Override public int getItemCount() { return employeeList.size(); } public class EmployeesViewHolder extends RecyclerView.ViewHolder{ //referencing the text views TextView tvId, tvName, tvAge, tvSalary, tvProfileImg; public EmployeesViewHolder(@NonNull View itemView) { super(itemView); tvId = itemView.findViewById(R.id.tvId); tvName = itemView.findViewById(R.id.tvName); tvAge = itemView.findViewById(R.id.tvAge); tvSalary = itemView.findViewById(R.id.tvSalary); tvProfileImg = itemView.findViewById(R.id.tvProfileImg); } } }
[ "preranapandit07@gmail.com" ]
preranapandit07@gmail.com
740aa56a2e3f9a22461c69fe9f6e6d48d84addfb
747a9fbd3ea6a3d3e469d63ade02b7620d970ca6
/gmsm/src/main/java/com/getui/gmsm/bouncycastle/asn1/InMemoryRepresentable.java
7b1a7b4510ce7eb860981cd535aaa3caf52493ea
[]
no_license
xievxin/GitWorkspace
3b88601ebb4718dc34a2948c673367ba79c202f0
81f4e7176daa85bf8bf5858ca4462e9475227aba
refs/heads/master
2021-01-21T06:18:33.222406
2019-01-31T01:28:50
2019-01-31T01:28:50
95,727,159
3
0
null
null
null
null
UTF-8
Java
false
false
175
java
package com.getui.gmsm.bouncycastle.asn1; import java.io.IOException; public interface InMemoryRepresentable { DERObject getLoadedObject() throws IOException; }
[ "xiex@getui.com" ]
xiex@getui.com
322ab0c9df9602635200285a4bb8f63b15cc6014
eb69914160e9e3e44cb1d0742cb7b3715165ea91
/GestPymeSOC/GestPymeSOCBusiness/src/main/java/co/com/binariasystems/gestpymesoc/business/utils/GestPymeSOCBusinessUtils.java
fed9d10f2e85139906b27cf606dcec3ff711dc75
[]
no_license
alex8704/BinariaPlatform
c8f7dac63c2ae4d64b9f1de98296aaed6fdac006
a407625e550d3dff1d8a1c16fd23e426e9bf355d
refs/heads/master
2021-01-20T01:22:24.843814
2017-04-24T16:32:14
2017-04-24T16:32:14
89,262,426
0
0
null
null
null
null
UTF-8
Java
false
false
3,450
java
package co.com.binariasystems.gestpymesoc.business.utils; import java.util.List; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort.Direction; import co.com.binariasystems.commonsmodel.constants.SystemConstants; import co.com.binariasystems.fmw.constants.FMWConstants; import co.com.binariasystems.fmw.ioc.IOCHelper; import co.com.binariasystems.fmw.util.ObjectUtils; import co.com.binariasystems.fmw.util.messagebundle.PropertiesManager; import co.com.binariasystems.fmw.util.pagination.ListPage; public class GestPymeSOCBusinessUtils implements GestPymeSOCBusinessConstants, SystemConstants { private static PropertiesManager configProperties; public static String getApplicationName(){ return getConfigProperties().getString(APP_NAME_PROP); } public static String getApplicationVersion(){ return getConfigProperties().getString(APP_VERSION_PROP); } public static String getMainDataSourceName(){ return getConfigProperties().getString(MAIN_DSOURCE_PROP); } public static PropertiesManager getConfigProperties(){ if(configProperties == null){ configProperties = PropertiesManager.forPath("/configuration.properties", false, IOCHelper.getBean(FMWConstants.DEFAULT_LOADER_CLASS, Class.class)); } return configProperties; } public static Sort builSpringSort(co.com.binariasystems.fmw.business.domain.Sort sort){ return builSpringSort(sort, null); } public static Sort builSpringSort(co.com.binariasystems.fmw.business.domain.Sort sort, co.com.binariasystems.fmw.business.domain.Order defaultOrder){ if(sort == null || sort.getOrders().isEmpty()){ return defaultOrder != null ? new Sort(new Sort.Order(Direction.fromStringOrNull(defaultOrder.getDirection().name()), defaultOrder.getProperty())): null; } Sort.Order[] orders = new Sort.Order[sort.getOrders().size()]; for(int i = 0; i < sort.getOrders().size(); i++){ orders[i] = new Sort.Order(Direction.fromStringOrNull(sort.getOrders().get(i).getDirection().name()), sort.getOrders().get(i).getProperty()); } return new Sort(orders); } public static PageRequest buildPageRequest(co.com.binariasystems.fmw.business.domain.PageRequest pageRequest){ return buildPageRequest(pageRequest, null); } public static PageRequest buildPageRequest(co.com.binariasystems.fmw.business.domain.PageRequest pageRequest, co.com.binariasystems.fmw.business.domain.Order defaultOrder){ return new PageRequest(pageRequest.getPage() - 1, pageRequest.getSize(), builSpringSort(pageRequest.getSort(), defaultOrder)); } public static <F, T> co.com.binariasystems.fmw.business.domain.Page<T> toPage(Page<F> page){ return toPage(page, null); } public static <F, T> co.com.binariasystems.fmw.business.domain.Page<T> toPage(Page<F> page, Class<T> targetContentClazz){ if(targetContentClazz != null) return new co.com.binariasystems.fmw.business.domain.Page<T>(page.getTotalPages(), page.getTotalElements(), ObjectUtils.transferProperties(page.getContent(), targetContentClazz)); return new co.com.binariasystems.fmw.business.domain.Page<T>(page.getTotalPages(), page.getTotalElements(), (List<T>) page.getContent()); } public static <T> ListPage<T> pageToListPage(co.com.binariasystems.fmw.business.domain.Page<T> page){ return new ListPage<T>(page.getContent(), page.getTotalElements()); } }
[ "alexander.castro@techsolve.com" ]
alexander.castro@techsolve.com
2655148916fb9a2fdbb6351df0f4080a6dfbe865
ad15b5d01aade0817b36e04835c04b4816bee9b0
/openapi-demo-java-master/src/main/java/Hisign/entity/ConsumableBorrowInfor.java
7fc972028ae6dce20145ee9b7f79481f9f02b57f
[]
no_license
zhyfff/qxb_demo
aaadb1acf56c6393272b710525818f9235dcb75f
433173a6000cf7539e494580fe54a91a72efa88e
refs/heads/master
2020-04-09T11:54:56.536608
2018-12-04T09:07:30
2018-12-04T09:07:30
160,328,596
0
0
null
null
null
null
UTF-8
Java
false
false
4,271
java
package Hisign.entity; /** * 耗材申领 * @author Administrator * */ public class ConsumableBorrowInfor { private String dcnumber; private String userId; private String borrowid; private String borrowname; private String borrowde; private String Recipients_number; private String ptype; private String ptime; private String consumable_type; private String consumable_name; private String specifications; private String consumable_num; private String consum_uprice; private String consum_tprice; private String note; private String audit_name; private String spid; private String audit_type; private String audit_opinion; private String audit_time; private String admins_id; private String admins; private String issue_type; private String evaluate; private String overdate; public String getDcnumber() { return dcnumber; } public void setDcnumber(String dcnumber) { this.dcnumber = dcnumber; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } public String getBorrowid() { return borrowid; } public void setBorrowid(String borrowid) { this.borrowid = borrowid; } public String getBorrowname() { return borrowname; } public void setBorrowname(String borrowname) { this.borrowname = borrowname; } public String getBorrowde() { return borrowde; } public void setBorrowde(String borrowde) { this.borrowde = borrowde; } public String getRecipients_number() { return Recipients_number; } public void setRecipients_number(String recipients_number) { Recipients_number = recipients_number; } public String getPtype() { return ptype; } public void setPtype(String ptype) { this.ptype = ptype; } public String getPtime() { return ptime; } public void setPtime(String ptime) { this.ptime = ptime; } public String getConsumable_type() { return consumable_type; } public void setConsumable_type(String consumable_type) { this.consumable_type = consumable_type; } public String getConsumable_name() { return consumable_name; } public void setConsumable_name(String consumable_name) { this.consumable_name = consumable_name; } public String getSpecifications() { return specifications; } public void setSpecifications(String specifications) { this.specifications = specifications; } public String getConsumable_num() { return consumable_num; } public void setConsumable_num(String consumable_num) { this.consumable_num = consumable_num; } public String getConsum_uprice() { return consum_uprice; } public void setConsum_uprice(String consum_uprice) { this.consum_uprice = consum_uprice; } public String getConsum_tprice() { return consum_tprice; } public void setConsum_tprice(String consum_tprice) { this.consum_tprice = consum_tprice; } public String getNote() { return note; } public void setNote(String note) { this.note = note; } public String getAudit_name() { return audit_name; } public void setAudit_name(String audit_name) { this.audit_name = audit_name; } public String getSpid() { return spid; } public void setSpid(String spid) { this.spid = spid; } public String getAudit_type() { return audit_type; } public void setAudit_type(String audit_type) { this.audit_type = audit_type; } public String getAudit_opinion() { return audit_opinion; } public void setAudit_opinion(String audit_opinion) { this.audit_opinion = audit_opinion; } public String getAudit_time() { return audit_time; } public void setAudit_time(String audit_time) { this.audit_time = audit_time; } public String getAdmins_id() { return admins_id; } public void setAdmins_id(String admins_id) { this.admins_id = admins_id; } public String getAdmins() { return admins; } public void setAdmins(String admins) { this.admins = admins; } public String getIssue_type() { return issue_type; } public void setIssue_type(String issue_type) { this.issue_type = issue_type; } public String getEvaluate() { return evaluate; } public void setEvaluate(String evaluate) { this.evaluate = evaluate; } public String getOverdate() { return overdate; } public void setOverdate(String overdate) { this.overdate = overdate; } }
[ "1204981276@qq.com" ]
1204981276@qq.com
de0dc84591cb29f5684478503e3469f5027eb2b8
0caa4066e984067cd5c1e85ee3eb649faf0e9eb3
/src/com/User.java
05f2eb4a5bcc8f2a03a059440350964a51f76599
[]
no_license
IdentityAndPrivacy/Handin_4
d79cb94db024ac602c54646c95a44a37f92e4763
be49dcb1f85f84da69f59f88fbe2c4a990f2c754
refs/heads/master
2021-04-22T13:02:51.711659
2015-08-08T07:12:17
2015-08-08T07:12:17
40,354,836
0
0
null
2015-08-07T17:11:59
2015-08-07T10:19:37
Java
UTF-8
Java
false
false
845
java
package com; import java.math.BigInteger; import java.security.MessageDigest; import java.util.Random; /** * Created by mixmox on 07/08/15. */ public class User { public BigInteger I; public BigInteger s; public BigInteger v; public User(BigInteger I, BigInteger p, BigInteger g, BigInteger N){ this.I = I; generateRandomSalt(); calculate_v(N, g, p); } private void calculate_v(BigInteger N, BigInteger g, BigInteger p) { BigInteger x; try { MessageDigest md = MessageDigest.getInstance("SHA-1"); x = new BigInteger(md.digest((s.toString() + p.toString()).getBytes())); v = g.modPow( x, N); } catch (Exception e){ } } public void generateRandomSalt(){ s = new BigInteger(10, new Random()); } }
[ "martin2610@gmail.com" ]
martin2610@gmail.com
09516a39f4b223c6826416767cb6c2429e25c99f
1419934acc6e7e257c907ad2ff570121d3a03033
/Gui Programming/lecture 7/InternalFrameEventDemo.java
e7eae3ee5ccd5815cc7a18ef9d01be6f85e732df
[]
no_license
fre556/College
9eaba712c60d74299864905a62e532c47ffa0d00
02138cffe6566b037ec034912cba26a0ab440277
refs/heads/master
2022-11-24T10:18:54.279378
2020-07-20T18:05:43
2020-07-20T18:05:43
281,169,609
0
0
null
null
null
null
UTF-8
Java
false
false
6,957
java
/* * InternalFrameEventDemo.java requires no other files. */ import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; public class InternalFrameEventDemo extends JFrame implements InternalFrameListener, ActionListener { JTextArea display; JDesktopPane desktop; JInternalFrame displayWindow; JInternalFrame listenedToWindow; static final String SHOW = "show"; static final String CLEAR = "clear"; String newline = "\n"; static final int desktopWidth = 500; static final int desktopHeight = 300; public InternalFrameEventDemo(String title) { super(title); //Set up the GUI. desktop = new JDesktopPane(); desktop.putClientProperty("JDesktopPane.dragMode", "outline"); //Because we use pack, it's not enough to call setSize. //We must set the desktop's preferred size. desktop.setPreferredSize(new Dimension(desktopWidth, desktopHeight)); setContentPane(desktop); createDisplayWindow(); desktop.add(displayWindow); //DON'T FORGET THIS!!! Dimension displaySize = displayWindow.getSize(); displayWindow.setSize(desktopWidth, displaySize.height); } //Create the window that displays event information. protected void createDisplayWindow() { JButton b1 = new JButton("Show internal frame"); b1.setActionCommand(SHOW); b1.addActionListener(this); JButton b2 = new JButton("Clear event info"); b2.setActionCommand(CLEAR); b2.addActionListener(this); display = new JTextArea(3, 30); display.setEditable(false); JScrollPane textScroller = new JScrollPane(display); //Have to supply a preferred size, or else the scroll //area will try to stay as large as the text area. textScroller.setPreferredSize(new Dimension(200, 75)); textScroller.setMinimumSize(new Dimension(10, 10)); displayWindow = new JInternalFrame("Event Watcher", true, //resizable false, //not closable false, //not maximizable true); //iconifiable JPanel contentPane = new JPanel(); contentPane.setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS)); b1.setAlignmentX(CENTER_ALIGNMENT); contentPane.add(b1); contentPane.add(Box.createRigidArea(new Dimension(0, 5))); contentPane.add(textScroller); contentPane.add(Box.createRigidArea(new Dimension(0, 5))); b2.setAlignmentX(CENTER_ALIGNMENT); contentPane.add(b2); displayWindow.setContentPane(contentPane); displayWindow.pack(); displayWindow.setVisible(true); } public void internalFrameClosing(InternalFrameEvent e) { displayMessage("Internal frame closing", e); } public void internalFrameClosed(InternalFrameEvent e) { displayMessage("Internal frame closed", e); } public void internalFrameOpened(InternalFrameEvent e) { displayMessage("Internal frame opened", e); } public void internalFrameIconified(InternalFrameEvent e) { displayMessage("Internal frame iconified", e); } public void internalFrameDeiconified(InternalFrameEvent e) { displayMessage("Internal frame deiconified", e); } public void internalFrameActivated(InternalFrameEvent e) { displayMessage("Internal frame activated", e); } public void internalFrameDeactivated(InternalFrameEvent e) { displayMessage("Internal frame deactivated", e); } //Add some text to the text area. void displayMessage(String prefix, InternalFrameEvent e) { String s = prefix + ": " + e.getSource(); display.append(s + newline); display.setCaretPosition(display.getDocument().getLength()); } //Handle events on the two buttons. public void actionPerformed(ActionEvent e) { if (SHOW.equals(e.getActionCommand())) { //They clicked the Show button. //Create the internal frame if necessary. if (listenedToWindow == null) { listenedToWindow = new JInternalFrame("Event Generator", true, //resizable true, //closable true, //maximizable true); //iconifiable //We want to reuse the internal frame, so we need to //make it hide (instead of being disposed of, which is //the default) when the user closes it. listenedToWindow.setDefaultCloseOperation( WindowConstants.HIDE_ON_CLOSE); //Add an internal frame listener so we can see //what internal frame events it generates. listenedToWindow.addInternalFrameListener(this); //And we mustn't forget to add it to the desktop pane! desktop.add(listenedToWindow); //Set its size and location. We'd use pack() to set the size //if the window contained anything. listenedToWindow.setSize(300, 100); listenedToWindow.setLocation( desktopWidth/2 - listenedToWindow.getWidth()/2, desktopHeight - listenedToWindow.getHeight()); } //Show the internal frame. listenedToWindow.setVisible(true); } else { //They clicked the Clear button. display.setText(""); } } /** * Create the GUI and show it. For thread safety, * this method should be invoked from the * event-dispatching thread. */ private static void createAndShowGUI() { //Make sure we have nice window decorations. JFrame.setDefaultLookAndFeelDecorated(true); //Create and set up the window. JFrame frame = new InternalFrameEventDemo( "InternalFrameEventDemo"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); //Display the window. frame.pack(); frame.setVisible(true); } public static void main(String[] args) { //Schedule a job for the event-dispatching thread: //creating and showing this application's GUI. javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } }
[ "fre556@yahoo.com" ]
fre556@yahoo.com
89176b4d5bf909c0a23d16c57458c25e9dfefced
d9ac3b55d13ab95edcfdc2b9382eb59be36286ef
/exsytext/src/easytext.gui/module-info.java
01f3b05092d7b9d19b30aa3b4933cbe9f0b964ab
[]
no_license
lanen/java9demo
e39a493366a611e6fbc9b54d092c4673e9a14f2b
fc5b086b6722834f34567601bfca9644b0d942cd
refs/heads/master
2020-04-18T18:01:10.909121
2019-01-27T09:44:33
2019-01-27T09:44:33
167,671,875
0
0
null
null
null
null
UTF-8
Java
false
false
207
java
module easytext.gui { requires easytext.algorithm.api; requires javafx.graphics; requires javafx.controls; exports com.buyou.easytext.gui to javafx.graphics; uses com.buyou.easytext.api.Analyzer; }
[ "cppmain@gmail.com" ]
cppmain@gmail.com
78d9c0b14f8d14207cd91cc8c4de9edf5f9e0a2c
25dee894857f760cc7539781e3124cf16ecc5940
/aiueo/src/main/java/twitter4j/examples/signin/CallbackServlet.java
03e66e1b9ae09b9c2f6aa70af9847e2c6ad1ff3f
[]
no_license
megascus/deathmar.ch
b460dd70b89487aff020bbb3d871988818bf7db3
c81418c52e70cd23a0062a2b8677972675a8aa02
refs/heads/master
2020-12-29T02:46:12.731601
2012-09-13T02:47:01
2012-09-13T02:47:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,943
java
/* Copyright (c) 2007-2009, Yusuke Yamamoto 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 the Yusuke Yamamoto 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 Yusuke Yamamoto ``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 Yusuke Yamamoto 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 twitter4j.examples.signin; import ch.deathmar.CountYusuke; import ch.deathmar.Store; import twitter4j.Twitter; import twitter4j.TwitterException; import twitter4j.TwitterFactory; import twitter4j.auth.RequestToken; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class CallbackServlet extends HttpServlet { private static final long serialVersionUID = 1657390011452788111L; protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { RequestToken requestToken = (RequestToken) Store.getTemporal(request.getParameter("oauth_token")); String verifier = request.getParameter("oauth_verifier"); try { Twitter twitter = new TwitterFactory().getInstance(); twitter.getOAuthAccessToken(requestToken, verifier); CountYusuke countYusuke = new CountYusuke(); countYusuke.count(twitter); request.getSession().setAttribute("twitter", twitter); request.getSession().setAttribute("progress", countYusuke); request.getSession().removeAttribute("requestToken"); } catch (TwitterException e) { throw new ServletException(e); } response.sendRedirect(request.getContextPath() + "/"); } }
[ "yusuke@mac.com" ]
yusuke@mac.com
7f77c4eb4eace61cabee1e4bcc385a6b4320f0e3
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/10/10_cc794fbbb09b2ff9fdcaaf199dbaa4816a92df87/ConfigurationWizard/10_cc794fbbb09b2ff9fdcaaf199dbaa4816a92df87_ConfigurationWizard_s.java
a798651f0752c2db029fbf9065ae95fcbe761bca
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
18,327
java
/** * Copyright (c) 2013 LEAP Encryption Access Project and contributers * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package se.leap.bitmaskclient; import java.io.IOException; import java.util.Iterator; import org.json.JSONException; import org.json.JSONObject; import se.leap.bitmaskclient.R; import se.leap.bitmaskclient.ProviderAPIResultReceiver.Receiver; import se.leap.bitmaskclient.ProviderListContent.ProviderItem; import android.app.Activity; import android.app.DialogFragment; import android.app.Fragment; import android.app.FragmentManager; import android.app.FragmentTransaction; import android.app.ProgressDialog; import android.content.Intent; import android.content.res.AssetManager; import android.os.Bundle; import android.os.Handler; import android.view.Menu; import android.view.MenuItem; import android.view.View; /** * Activity that builds and shows the list of known available providers. * * It also allows the user to enter custom providers with a button. * * @author parmegv * */ public class ConfigurationWizard extends Activity implements ProviderListFragment.Callbacks, NewProviderDialog.NewProviderDialogInterface, ProviderDetailFragment.ProviderDetailFragmentInterface, Receiver { private ProviderItem mSelectedProvider; private ProgressDialog mProgressDialog; private Intent mConfigState = new Intent(); final public static String TYPE_OF_CERTIFICATE = "type_of_certificate"; final public static String ANON_CERTIFICATE = "anon_certificate"; final public static String AUTHED_CERTIFICATE = "authed_certificate"; final protected static String PROVIDER_SET = "PROVIDER SET"; final protected static String SERVICES_RETRIEVED = "SERVICES RETRIEVED"; public ProviderAPIResultReceiver providerAPI_result_receiver; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.configuration_wizard_activity); providerAPI_result_receiver = new ProviderAPIResultReceiver(new Handler()); providerAPI_result_receiver.setReceiver(this); ConfigHelper.setSharedPreferences(getSharedPreferences(Dashboard.SHARED_PREFERENCES, MODE_PRIVATE)); loadPreseededProviders(); // Only create our fragments if we're not restoring a saved instance if ( savedInstanceState == null ){ // TODO Some welcome screen? // We will need better flow control when we have more Fragments (e.g. user auth) ProviderListFragment providerList = new ProviderListFragment(); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction() .add(R.id.configuration_wizard_layout, providerList, "providerlist") .commit(); } // TODO: If exposing deep links into your app, handle intents here. } @Override public void onReceiveResult(int resultCode, Bundle resultData) { if(resultCode == ProviderAPI.CORRECTLY_UPDATED_PROVIDER_DOT_JSON) { JSONObject provider_json; try { provider_json = new JSONObject(resultData.getString(Provider.KEY)); boolean danger_on = resultData.getBoolean(ProviderItem.DANGER_ON); ConfigHelper.saveSharedPref(Provider.KEY, provider_json); ConfigHelper.saveSharedPref(ProviderItem.DANGER_ON, danger_on); ConfigHelper.saveSharedPref(EIP.ALLOWED_ANON, provider_json.getJSONObject(Provider.SERVICE).getBoolean(EIP.ALLOWED_ANON)); mConfigState.setAction(PROVIDER_SET); if(mProgressDialog != null) mProgressDialog.dismiss(); mProgressDialog = ProgressDialog.show(this, getResources().getString(R.string.config_wait_title), getResources().getString(R.string.config_connecting_provider), true); mProgressDialog.setMessage(getResources().getString(R.string.config_downloading_services)); if(resultData.containsKey(Provider.NAME)) mSelectedProvider = getProvider(resultData.getString(Provider.NAME)); ProviderListFragment providerList = new ProviderListFragment(); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction() .replace(R.id.configuration_wizard_layout, providerList, "providerlist") .commit(); downloadJSONFiles(mSelectedProvider); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); mProgressDialog.dismiss(); //Toast.makeText(this, getResources().getString(R.string.config_error_parsing), Toast.LENGTH_LONG); setResult(RESULT_CANCELED, mConfigState); } } else if(resultCode == ProviderAPI.INCORRECTLY_UPDATED_PROVIDER_DOT_JSON) { String reason_to_fail = resultData.getString(ProviderAPI.ERRORS); showDownloadFailedDialog(getCurrentFocus(), reason_to_fail); mProgressDialog.dismiss(); setResult(RESULT_CANCELED, mConfigState); } else if(resultCode == ProviderAPI.CORRECTLY_DOWNLOADED_JSON_FILES) { if (ConfigHelper.getBoolFromSharedPref(EIP.ALLOWED_ANON)){ mProgressDialog.setMessage(getResources().getString(R.string.config_downloading_certificates)); mConfigState.putExtra(SERVICES_RETRIEVED, true); downloadAnonCert(); } else { mProgressDialog.dismiss(); //Toast.makeText(getApplicationContext(), R.string.success, Toast.LENGTH_LONG).show(); setResult(RESULT_OK); finish(); } } else if(resultCode == ProviderAPI.INCORRECTLY_DOWNLOADED_JSON_FILES) { //Toast.makeText(getApplicationContext(), R.string.incorrectly_downloaded_json_files_message, Toast.LENGTH_LONG).show(); mProgressDialog.dismiss(); String reason_to_fail = resultData.getString(ProviderAPI.ERRORS); showDownloadFailedDialog(getCurrentFocus(), reason_to_fail); setResult(RESULT_CANCELED, mConfigState); } else if(resultCode == ProviderAPI.CORRECTLY_DOWNLOADED_CERTIFICATE) { mProgressDialog.dismiss(); setResult(RESULT_OK); showProviderDetails(getCurrentFocus()); } else if(resultCode == ProviderAPI.INCORRECTLY_DOWNLOADED_CERTIFICATE) { mProgressDialog.dismiss(); //Toast.makeText(getApplicationContext(), R.string.incorrectly_downloaded_certificate_message, Toast.LENGTH_LONG).show(); setResult(RESULT_CANCELED, mConfigState); } } /** * Callback method from {@link ProviderListFragment.Callbacks} * indicating that the item with the given ID was selected. */ @Override public void onItemSelected(String id) { //TODO Code 2 pane view ProviderItem selected_provider = getProvider(id); mProgressDialog = ProgressDialog.show(this, getResources().getString(R.string.config_wait_title), getResources().getString(R.string.config_connecting_provider), true); mSelectedProvider = selected_provider; saveProviderJson(mSelectedProvider); } @Override public void onBackPressed() { try { if(ConfigHelper.getJsonFromSharedPref(Provider.KEY) == null || ConfigHelper.getJsonFromSharedPref(Provider.KEY).length() == 0) { askDashboardToQuitApp(); } else { setResult(RESULT_OK); } } catch (JSONException e) { askDashboardToQuitApp(); } super.onBackPressed(); } private void askDashboardToQuitApp() { Intent ask_quit = new Intent(); ask_quit.putExtra(Dashboard.ACTION_QUIT, Dashboard.ACTION_QUIT); setResult(RESULT_CANCELED, ask_quit); } private ProviderItem getProvider(String id) { Iterator<ProviderItem> providers_iterator = ProviderListContent.ITEMS.iterator(); while(providers_iterator.hasNext()) { ProviderItem provider = providers_iterator.next(); if(provider.id.equalsIgnoreCase(id)) { return provider; } } return null; } /** * Loads providers data from url file contained in the project * @return true if the file was read correctly */ private boolean loadPreseededProviders() { boolean loaded_preseeded_providers = false; AssetManager asset_manager = getAssets(); String[] urls_filepaths = null; try { String url_files_folder = "urls"; //TODO Put that folder in a better place (also inside the "for") urls_filepaths = asset_manager.list(url_files_folder); String provider_name = ""; for(String url_filepath : urls_filepaths) { boolean custom = false; provider_name = url_filepath.subSequence(0, url_filepath.indexOf(".")).toString(); if(ProviderListContent.ITEMS.isEmpty()) //TODO I have to implement a way of checking if a provider new or is already present in that ITEMS list ProviderListContent.addItem(new ProviderItem(provider_name, asset_manager.open(url_files_folder + "/" + url_filepath), custom, false)); loaded_preseeded_providers = true; } } catch (IOException e) { loaded_preseeded_providers = false; } return loaded_preseeded_providers; } /** * Saves provider.json file associated with provider. * * If the provider is custom, the file has already been downloaded so we load it from memory. * If not, the file is updated using the provider's URL. * @param provider */ private void saveProviderJson(ProviderItem provider) { JSONObject provider_json = new JSONObject(); try { if(!provider.custom) { updateProviderDotJson(provider.name, provider.provider_json_url, provider.danger_on); } else { // FIXME!! We should we be updating our seeded providers list at ConfigurationWizard onStart() ? // I think yes, but if so, where does this list live? leap.se, as it's the non-profit project for the software? // If not, we should just be getting names/urls, and fetching the provider.json like in custom entries provider_json = provider.provider_json; ConfigHelper.saveSharedPref(Provider.KEY, provider_json); ConfigHelper.saveSharedPref(EIP.ALLOWED_ANON, provider_json.getJSONObject(Provider.SERVICE).getBoolean(EIP.ALLOWED_ANON)); ConfigHelper.saveSharedPref(ProviderItem.DANGER_ON, provider.danger_on); mProgressDialog.setMessage(getResources().getString(R.string.config_downloading_services)); downloadJSONFiles(mSelectedProvider); } } catch (JSONException e) { setResult(RESULT_CANCELED); finish(); } } /** * Asks ProviderAPI to download provider site's certificate and eip-service.json * * URLs are fetched from the provider parameter * @param provider from which certificate and eip-service.json files are going to be downloaded */ private void downloadJSONFiles(ProviderItem provider) { Intent provider_API_command = new Intent(this, ProviderAPI.class); Bundle parameters = new Bundle(); parameters.putString(Provider.KEY, provider.name); parameters.putString(Provider.CA_CERT, provider.cert_json_url); parameters.putString(EIP.KEY, provider.eip_service_json_url); parameters.putBoolean(ProviderItem.DANGER_ON, provider.danger_on); provider_API_command.setAction(ProviderAPI.DOWNLOAD_JSON_FILES_BUNDLE_EXTRA); provider_API_command.putExtra(ProviderAPI.PARAMETERS, parameters); provider_API_command.putExtra(ProviderAPI.RECEIVER_KEY, providerAPI_result_receiver); startService(provider_API_command); } /** * Asks ProviderAPI to download an anonymous (anon) VPN certificate. */ private void downloadAnonCert() { Intent provider_API_command = new Intent(this, ProviderAPI.class); Bundle parameters = new Bundle(); parameters.putString(TYPE_OF_CERTIFICATE, ANON_CERTIFICATE); provider_API_command.setAction(ProviderAPI.DOWNLOAD_CERTIFICATE); provider_API_command.putExtra(ProviderAPI.PARAMETERS, parameters); provider_API_command.putExtra(ProviderAPI.RECEIVER_KEY, providerAPI_result_receiver); startService(provider_API_command); } /** * Open the new provider dialog */ public void addAndSelectNewProvider() { FragmentTransaction fragment_transaction = getFragmentManager().beginTransaction(); Fragment previous_new_provider_dialog = getFragmentManager().findFragmentByTag(NewProviderDialog.TAG); if (previous_new_provider_dialog != null) { fragment_transaction.remove(previous_new_provider_dialog); } fragment_transaction.addToBackStack(null); DialogFragment newFragment = NewProviderDialog.newInstance(); newFragment.show(fragment_transaction, NewProviderDialog.TAG); } /** * Once selected a provider, this fragment offers the user to log in, * use it anonymously (if possible) * or cancel his/her election pressing the back button. * @param view * @param reason_to_fail */ public void showDownloadFailedDialog(View view, String reason_to_fail) { FragmentTransaction fragment_transaction = getFragmentManager().beginTransaction(); Fragment previous_provider_details_dialog = getFragmentManager().findFragmentByTag(DownloadFailedDialog.TAG); if (previous_provider_details_dialog != null) { fragment_transaction.remove(previous_provider_details_dialog); } fragment_transaction.addToBackStack(null); DialogFragment newFragment = DownloadFailedDialog.newInstance(reason_to_fail); newFragment.show(fragment_transaction, DownloadFailedDialog.TAG); } /** * Once selected a provider, this fragment offers the user to log in, * use it anonymously (if possible) * or cancel his/her election pressing the back button. * @param view */ public void showProviderDetails(View view) { FragmentTransaction fragment_transaction = getFragmentManager().beginTransaction(); Fragment previous_provider_details_dialog = getFragmentManager().findFragmentByTag(ProviderDetailFragment.TAG); if (previous_provider_details_dialog != null) { fragment_transaction.remove(previous_provider_details_dialog); } fragment_transaction.addToBackStack(null); DialogFragment newFragment = ProviderDetailFragment.newInstance(); newFragment.show(fragment_transaction, ProviderDetailFragment.TAG); } @Override public void saveAndSelectProvider(String provider_main_url, boolean danger_on) { Intent provider_API_command = new Intent(this, ProviderAPI.class); Bundle parameters = new Bundle(); parameters.putString(Provider.MAIN_URL, provider_main_url); parameters.putBoolean(ProviderItem.DANGER_ON, danger_on); provider_API_command.setAction(ProviderAPI.DOWNLOAD_NEW_PROVIDER_DOTJSON); provider_API_command.putExtra(ProviderAPI.PARAMETERS, parameters); provider_API_command.putExtra(ProviderAPI.RECEIVER_KEY, providerAPI_result_receiver); startService(provider_API_command); } /** * Asks ProviderAPI to download a new provider.json file * @param provider_name * @param provider_json_url * @param danger_on tells if HTTPS client should bypass certificate errors */ public void updateProviderDotJson(String provider_name, String provider_json_url, boolean danger_on) { Intent provider_API_command = new Intent(this, ProviderAPI.class); Bundle parameters = new Bundle(); parameters.putString(Provider.NAME, provider_name); parameters.putString(Provider.DOT_JSON_URL, provider_json_url); parameters.putBoolean(ProviderItem.DANGER_ON, danger_on); provider_API_command.setAction(ProviderAPI.UPDATE_PROVIDER_DOTJSON); provider_API_command.putExtra(ProviderAPI.PARAMETERS, parameters); provider_API_command.putExtra(ProviderAPI.RECEIVER_KEY, providerAPI_result_receiver); startService(provider_API_command); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.configuration_wizard_activity, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item){ switch (item.getItemId()){ case R.id.about_leap: showAboutFragment(getCurrentFocus()); return true; case R.id.new_provider: addAndSelectNewProvider(); return true; default: return super.onOptionsItemSelected(item); } } /** * Once selected a provider, this fragment offers the user to log in, * use it anonymously (if possible) * or cancel his/her election pressing the back button. * @param view */ public void showAboutFragment(View view) { FragmentTransaction fragment_transaction = getFragmentManager().beginTransaction(); Fragment previous_about_fragment = getFragmentManager().findFragmentByTag(AboutFragment.TAG); if (previous_about_fragment == null) { fragment_transaction.addToBackStack(null); Fragment newFragment = AboutFragment.newInstance(); fragment_transaction.replace(R.id.configuration_wizard_layout, newFragment, AboutFragment.TAG).commit(); } } @Override public void login() { Intent ask_login = new Intent(); ask_login.putExtra(LogInDialog.VERB, LogInDialog.VERB); setResult(RESULT_OK, ask_login); finish(); } @Override public void use_anonymously() { setResult(RESULT_OK); finish(); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
e2cb3cc118df465bc2fc2212fa38faf3604a616d
62dda18d6f404ec6c79e0a53f72fd9ad3fe2a562
/src/test/java/MockTypes/MockByAnnonationTest.java
ba159a5aeb30f45bb14c0281f4e966c4c70ed56f
[]
no_license
Huiliang-M/Mockito_example
41366bdeb03243985f1b52230f724bed93e8999d
6f45fc4cf8a00ffb8ec0660ca52b01cbdadc8dd0
refs/heads/master
2021-07-16T13:55:33.773640
2019-10-31T01:25:10
2019-10-31T01:25:10
218,452,336
0
0
null
null
null
null
UTF-8
Java
false
false
615
java
package MockTypes; import org.junit.Before; import org.junit.Test; import org.mockito.Answers; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import qucikstart.AccoundDao; import qucikstart.Account; public class MockByAnnonationTest { @Before public void init() { MockitoAnnotations.initMocks(this); } // // @Mock // private AccoundDao accounddao; @Mock(answer = Answers.RETURNS_SMART_NULLS) private AccoundDao accounddao; @Test public void testMock() { Account account = accounddao.findAccount("x","x"); System.out.println(account); } }
[ "huilianghuang2010" ]
huilianghuang2010
40a556b95eb578f901934d71fad21c919803e0ed
b4d24a19107b137c8450f9a6c57a00becb642f63
/test/level13/lesson04/task01/Solution.java
2e671cf70a2f8cd6d1179011aeb11dc3661c6865
[]
no_license
Pokoinick/JavaRush-1.0
0b218a4efa7968953be4e72b92f6a72f99205a03
91345436c94faadbff8c38ffba140eccc7f7708c
refs/heads/master
2021-07-05T10:45:04.366954
2017-09-28T17:42:47
2017-09-28T17:42:47
105,180,491
0
0
null
null
null
null
UTF-8
Java
false
false
1,275
java
package com.javarush.test.level13.lesson04.task01; /* Переводчик с английского 1. Создать класс EnglishTranslator, который наследуется от Translator. 2. Реализовать все абстрактные методы. 3. Подумай, что должен возвращать метод getLanguage. 4. Программа должна выводить на экран "Я переводчик с английского". 5. Метод main менять нельзя. */ public class Solution { public static void main(String[] args) throws Exception { EnglishTranslator englishTranslator = new EnglishTranslator(); System.out.println(englishTranslator.translate()); } public static abstract class Translator { public abstract String getLanguage(); public String translate() { return "Я переводчик с " + getLanguage(); } } static class EnglishTranslator extends Translator { @Override public String getLanguage() { return "английского"; } @Override public String translate() { return super.translate(); } } }
[ "pokoi.htc@gmail.com" ]
pokoi.htc@gmail.com
c420bdf49f2e486d420ff957b9b088424c50e469
fa10797f4a7e411c82918281926a9c41211b06bb
/FirstProject/src/Strings/ReplaceTask.java
a0c14c32a3cddb9b61a37ca1bc19587406575d88
[]
no_license
apsalbke/Practice
88ec7c6e5c7e0f0db954156635a49bde3215a6dc
ced3db61d902155cdbee482b808c0a5312c97993
refs/heads/master
2022-12-27T21:10:53.395434
2020-03-26T01:43:59
2020-03-26T01:43:59
235,715,353
0
0
null
2020-10-13T20:39:39
2020-01-23T03:20:37
Java
UTF-8
Java
false
false
995
java
package Strings; import java.util.Scanner; public class ReplaceTask { public static void main(String[] args) { //You have a String with the following value: // -> “We will have a picnic when the weather gets nicer” //First print the given sentence. Then the user is asked to enter the following: the set of characters from // the sentence they want to change, and the set of characters that will show up in place of the ones which // were removed. Print the new sentence. //> input: “w” , “La” //> output: “We Laill have a picnic Lahen the Laeather gets nicer” Scanner input = new Scanner (System.in); String given = "We will have a picnic when the weather gets nicer"; System.out.println(given); String word1= input.nextLine(); String word2= input.nextLine(); String replacement = given.replace(word1,word2); System.out.println(replacement); } }
[ "apasalbekovakanykei@gmail.com" ]
apasalbekovakanykei@gmail.com
7c78706e3c1c69e9a78a91a2bfea692d6da47378
6d58ee5b31666372cf4c24518c57e6cf9f8620fe
/15yan/src/main/java/org/liuyichen/fifteenyan/module/FifteenApiModule.java
b49e0333034cf849a07f3ea44ba8051d1b5bbbc1
[ "Apache-2.0" ]
permissive
jackyglony/15yan
ea1e562bf3defcb897cce7394bf6437f728184b4
c8e614fe60e667c694c39f6ebb45ba90ce1914cf
refs/heads/master
2020-12-11T08:00:50.146577
2015-04-02T12:56:11
2015-04-02T12:56:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,320
java
package org.liuyichen.fifteenyan.module; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import org.liuyichen.fifteenyan.api.FifteenYanService; import org.liuyichen.fifteenyan.fragment.DetailFragment; import org.liuyichen.fifteenyan.fragment.SettingsFragment; import org.liuyichen.fifteenyan.fragment.StoryFragment; import org.liuyichen.fifteenyan.fragment.ViewPagerTabFragment; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import retrofit.RestAdapter; import retrofit.converter.GsonConverter; /** * By liuyichen on 15-3-3 下午4:46. */ @Module(injects = { ViewPagerTabFragment.class, StoryFragment.class, DetailFragment.class, SettingsFragment.class }, complete = false) public class FifteenApiModule { @Provides @Singleton FifteenYanService provideFifteenYanService() { Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create(); RestAdapter restAdapter = new RestAdapter.Builder() .setEndpoint(FifteenYanService.BASE_URL) // .setLogLevel(RestAdapter.LogLevel.FULL) .setConverter(new GsonConverter(gson)) .build(); return restAdapter.create(FifteenYanService.class); } }
[ "liuchen.park@gmail.com" ]
liuchen.park@gmail.com
0b5b5688ab0de3b48bd584d2e96d6fbb6a8a05f1
536337573310799f98241dc784f24d2af7f25422
/src/bi1226day12/TicketDemo.java
0b7430c1f7ac9fefb392187114c1325631bab6f4
[]
no_license
ltt19921124/learnjava_2
349cd7b44003dcf84ca07055b8434d0989139301
d2bbba21e2e3ca13667e74188d7129cee4a38d86
refs/heads/master
2020-12-25T18:44:12.183914
2017-12-28T04:29:26
2017-12-28T04:29:26
93,992,331
0
0
null
null
null
null
UTF-8
Java
false
false
1,910
java
package bi1226day12; /* 需求:卖票。 */ /* 线程安全问题产生的原因: 1,多个线程在操作共享的数据。 2,操作共享数据的线程代码有多条。 当一个线程在执行操作共享数据的多条代码过程中,其他线程参与了运算。 就会导致线程安全问题的产生。 解决思路; 就是将多条操作共享数据的线程代码封装起来,当有线程在执行这些代码的时候, 其他线程时不可以参与运算的。 必须要当前线程把这些代码都执行完毕后,其他线程才可以参与运算。 在java中,用同步代码块就可以解决这个问题。 同步代码块的格式: synchronized(对象) { 需要被同步的代码 ; } 同步的好处:解决了线程的安全问题。 同步的弊端:相对降低了效率,因为同步外的线程的都会判断同步锁。 同步的前提:同步中必须有多个线程并使用同一个锁。 */ class Ticket1 implements Runnable//extends Thread { private int num = 100; Object obj = new Object(); public void run() { while(true) { synchronized(obj) { if(num>0) { try{Thread.sleep(10);}catch (InterruptedException e){} System.out.println(Thread.currentThread().getName()+".....sale...."+num--); } } } } } class TicketDemo { public static void main(String[] args) { Ticket1 t = new Ticket1();//创建一个线程任务对象。 Thread t1 = new Thread(t); Thread t2 = new Thread(t); Thread t3 = new Thread(t); Thread t4 = new Thread(t); t1.start(); t2.start(); t3.start(); t4.start(); /* Ticket t1 = new Ticket(); // Ticket t2 = new Ticket(); // Ticket t3 = new Ticket(); // Ticket t4 = new Ticket(); t1.start(); t1.start();//一个线程不能开启两次,会抛出无效线程状态异常 t1.start(); t1.start(); */ } }
[ "ltt19921124@163.com" ]
ltt19921124@163.com
2e2bd856f19a083ce4d8a2718b3fce971e876154
958c1f41104b0e5d99fa306736cc3e2a4b855c0d
/src/test/java/com/imooc/myo2o/dao/AreaDaoTest.java
67963c56298ffe0d1db3e941f8a216d483a4d8d5
[]
no_license
wantLight/MY-SC-SHOP-v1.0
a46aea7aba9fa6e943bc92bfb20535d808f56252
0fbb06dedb366dde57cf88b1d31902ca3e8ae0e4
refs/heads/master
2020-03-22T17:16:39.050559
2018-09-16T08:00:13
2018-09-16T08:00:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,759
java
package com.imooc.myo2o.dao; import static org.junit.Assert.assertEquals; import java.util.ArrayList; import java.util.Date; import java.util.List; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; import org.springframework.beans.factory.annotation.Autowired; import com.imooc.myo2o.BaseTest; import com.imooc.myo2o.entity.Area; @FixMethodOrder(MethodSorters.NAME_ASCENDING) public class AreaDaoTest extends BaseTest { @Autowired private AreaDao areaDao; @Test public void testQueryArea(){ List<Area> areaList = areaDao.queryArea(); assertEquals(2,areaList.size()); } @Test public void testAInsertArea() throws Exception { Area area = new Area(); area.setAreaName("区域1"); area.setAreaDesc("区域1"); area.setPriority(1); area.setCreateTime(new Date()); area.setLastEditTime(new Date()); int effectedNum = areaDao.insertArea(area); assertEquals(1, effectedNum); } @Test public void testBQueryArea() throws Exception { List<Area> areaList = areaDao.queryArea(); assertEquals(3, areaList.size()); } @Test public void testCUpdateArea() throws Exception { Area area = new Area(); area.setAreaId(1L); area.setAreaName("南苑"); area.setLastEditTime(new Date()); int effectedNum = areaDao.updateArea(area); assertEquals(1, effectedNum); } @Test public void testDDeleteArea() throws Exception { long areaId = -1; List<Area> areaList = areaDao.queryArea(); for (Area myArea : areaList) { if ("区域1".equals(myArea.getAreaName())) { areaId = myArea.getAreaId(); } } List<Long> areaIdList = new ArrayList<Long>(); areaIdList.add(areaId); int effectedNum = areaDao.batchDeleteArea(areaIdList); assertEquals(1, effectedNum); } }
[ "1364932323@qq.com" ]
1364932323@qq.com
a90f695877c37e5b9fad144b9d3f66cae0577b2a
0dad44aecd47b6ca5326a3dcb3e06dcb91832158
/CommonApp/src/com/fss/Common/uiModule/smoothprogressbar/SmoothProgressDrawable.java
d5fe355cabedfe498eebd035afa9d8cf1e9bcd8a
[ "Apache-2.0" ]
permissive
xiu307/CommonLibsForAndroid
8c985e43157dd39323c02fa031f659db145c8fde
2c1b020d6d996e15ede662351d1c7e61172a4946
refs/heads/master
2021-01-20T21:46:24.454349
2014-07-02T09:05:14
2014-07-02T09:05:14
21,447,501
1
0
null
null
null
null
UTF-8
Java
false
false
20,315
java
package com.fss.Common.uiModule.smoothprogressbar; import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.drawable.Animatable; import android.graphics.drawable.Drawable; import android.os.SystemClock; import android.view.animation.AccelerateInterpolator; import android.view.animation.Interpolator; import com.fss.Common.R; /** * Created by castorflex on 11/10/13. */ public class SmoothProgressDrawable extends Drawable implements Animatable { public interface Callbacks { public void onStop(); public void onStart(); } private static final long FRAME_DURATION = 1000 / 60; private final static float OFFSET_PER_FRAME = 0.01f; private final Rect fBackgroundRect = new Rect(); private Callbacks mCallbacks; private Interpolator mInterpolator; private Rect mBounds; private Paint mPaint; private int[] mColors; private int mColorsIndex; private boolean mRunning; private float mCurrentOffset; private int mSeparatorLength; private int mSectionsCount; private float mSpeed; private float mProgressiveStartSpeed; private float mProgressiveStopSpeed; private boolean mReversed; private boolean mNewTurn; private boolean mMirrorMode; private float mMaxOffset; private boolean mFinishing; private boolean mProgressiveStartActivated; private int mStartSection; private int mCurrentSections; private float mStrokeWidth; private Drawable mBackgroundDrawable; private SmoothProgressDrawable(Interpolator interpolator, int sectionsCount, int separatorLength, int[] colors, float strokeWidth, float speed, float progressiveStartSpeed, float progressiveStopSpeed, boolean reversed, boolean mirrorMode, Callbacks callbacks, boolean progressiveStartActivated, Drawable backgroundDrawable) { mRunning = false; mInterpolator = interpolator; mSectionsCount = sectionsCount; mStartSection = 0; mCurrentSections = mSectionsCount; mSeparatorLength = separatorLength; mSpeed = speed; mProgressiveStartSpeed = progressiveStartSpeed; mProgressiveStopSpeed = progressiveStopSpeed; mReversed = reversed; mColors = colors; mColorsIndex = 0; mMirrorMode = mirrorMode; mFinishing = false; mBackgroundDrawable = backgroundDrawable; mStrokeWidth = strokeWidth; mMaxOffset = 1f / mSectionsCount; mPaint = new Paint(); mPaint.setStrokeWidth(strokeWidth); mPaint.setStyle(Paint.Style.STROKE); mPaint.setDither(false); mPaint.setAntiAlias(false); mProgressiveStartActivated = progressiveStartActivated; mCallbacks = callbacks; } //////////////////////////////////////////////////////////////////////////// /////////////////// SETTERS public void setInterpolator(Interpolator interpolator) { if (interpolator == null) throw new IllegalArgumentException("Interpolator cannot be null"); mInterpolator = interpolator; invalidateSelf(); } public void setColors(int[] colors) { if (colors == null || colors.length == 0) throw new IllegalArgumentException("Colors cannot be null or empty"); mColorsIndex = 0; mColors = colors; invalidateSelf(); } public void setColor(int color) { setColors(new int[]{color}); } public void setSpeed(float speed) { if (speed < 0) throw new IllegalArgumentException("Speed must be >= 0"); mSpeed = speed; invalidateSelf(); } public void setProgressiveStartSpeed(float speed) { if (speed < 0) throw new IllegalArgumentException("SpeedProgressiveStart must be >= 0"); mProgressiveStartSpeed = speed; invalidateSelf(); } public void setProgressiveStopSpeed(float speed) { if (speed < 0) throw new IllegalArgumentException("SpeedProgressiveStop must be >= 0"); mProgressiveStopSpeed = speed; invalidateSelf(); } public void setSectionsCount(int sectionsCount) { if (sectionsCount <= 0) throw new IllegalArgumentException("SectionsCount must be > 0"); mSectionsCount = sectionsCount; mMaxOffset = 1f / mSectionsCount; mCurrentOffset %= mMaxOffset; invalidateSelf(); } public void setSeparatorLength(int separatorLength) { if (separatorLength < 0) throw new IllegalArgumentException("SeparatorLength must be >= 0"); mSeparatorLength = separatorLength; invalidateSelf(); } public void setStrokeWidth(float strokeWidth) { if (strokeWidth < 0) throw new IllegalArgumentException("The strokeWidth must be >= 0"); mPaint.setStrokeWidth(strokeWidth); invalidateSelf(); } public void setReversed(boolean reversed) { if (mReversed == reversed) return; mReversed = reversed; invalidateSelf(); } public void setMirrorMode(boolean mirrorMode) { if (mMirrorMode == mirrorMode) return; mMirrorMode = mirrorMode; invalidateSelf(); } public void setBackgroundDrawable(Drawable backgroundDrawable) { if (mBackgroundDrawable == backgroundDrawable) return; mBackgroundDrawable = backgroundDrawable; invalidateSelf(); } public Drawable getBackgroundDrawable() { return mBackgroundDrawable; } public int[] getColors() { return mColors; } public float getStrokeWidth() { return mStrokeWidth; } public void setProgressiveStartActivated(boolean progressiveStartActivated) { mProgressiveStartActivated = progressiveStartActivated; } //////////////////////////////////////////////////////////////////////////// /////////////////// DRAW @Override public void draw(Canvas canvas) { mBounds = getBounds(); canvas.clipRect(mBounds); int boundsWidth = mBounds.width(); if (mReversed) { canvas.translate(boundsWidth, 0); canvas.scale(-1, 1); } drawStrokes(canvas); } private void drawStrokes(Canvas canvas) { float prevValue = 0f; int boundsWidth = mBounds.width(); if (mMirrorMode) boundsWidth /= 2; int width = boundsWidth + mSeparatorLength + mSectionsCount; int centerY = mBounds.centerY(); float xSectionWidth = 1f / mSectionsCount; //new turn if (mNewTurn) { mColorsIndex = decrementColor(mColorsIndex); mNewTurn = false; if (isFinishing()) { mStartSection++; if (mStartSection > mSectionsCount) { stop(); return; } } if (mCurrentSections < mSectionsCount) { mCurrentSections++; } } float startX; float endX; float firstX = 0; float lastX = 0; float prev; float end; float spaceLength; float xOffset; float ratioSectionWidth; float sectionWidth; float drawLength; int currentIndexColor = mColorsIndex; if (mStartSection == mCurrentSections && mCurrentSections == mSectionsCount) { firstX = canvas.getWidth(); } for (int i = 0; i <= mCurrentSections; ++i) { xOffset = xSectionWidth * i + mCurrentOffset; prev = Math.max(0f, xOffset - xSectionWidth); ratioSectionWidth = Math.abs(mInterpolator.getInterpolation(prev) - mInterpolator.getInterpolation(Math.min(xOffset, 1f))); sectionWidth = (int) (width * ratioSectionWidth); if (sectionWidth + prev < width) spaceLength = Math.min(sectionWidth, mSeparatorLength); else spaceLength = 0f; drawLength = sectionWidth > spaceLength ? sectionWidth - spaceLength : 0; end = prevValue + drawLength; if (end > prevValue && i >= mStartSection) { startX = Math.min(boundsWidth, prevValue); endX = Math.min(boundsWidth, end); drawLine(canvas, boundsWidth, startX, centerY, endX, centerY, currentIndexColor); if (i == mStartSection) { // first loop firstX = startX; } } if (i == mCurrentSections) { lastX = prevValue + sectionWidth; //because we want to keep the separator effect } prevValue = end + spaceLength; currentIndexColor = incrementColor(currentIndexColor); } drawBackgroundIfNeeded(canvas, firstX, lastX); } private void drawLine(Canvas canvas, int canvasWidth, float startX, float startY, float stopX, float stopY, int currentIndexColor) { mPaint.setColor(mColors[currentIndexColor]); if (!mMirrorMode) { canvas.drawLine(startX, startY, stopX, stopY, mPaint); } else { if (mReversed) { canvas.drawLine(canvasWidth + startX, startY, canvasWidth + stopX, stopY, mPaint); canvas.drawLine(canvasWidth - startX, startY, canvasWidth - stopX, stopY, mPaint); } else { canvas.drawLine(startX, startY, stopX, stopY, mPaint); canvas.drawLine(canvasWidth * 2 - startX, startY, canvasWidth * 2 - stopX, stopY, mPaint); } } } private void drawBackgroundIfNeeded(Canvas canvas, float firstX, float lastX) { if (mBackgroundDrawable == null) return; fBackgroundRect.top = (int) ((canvas.getHeight() - mStrokeWidth) / 2); fBackgroundRect.bottom = (int) ((canvas.getHeight() + mStrokeWidth) / 2); fBackgroundRect.left = 0; fBackgroundRect.right = mMirrorMode ? canvas.getWidth() / 2 : canvas.getWidth(); mBackgroundDrawable.setBounds(fBackgroundRect); //draw the background if the animation is over if (!isRunning()) { if (mMirrorMode) { canvas.save(); canvas.translate(canvas.getWidth() / 2, 0); drawBackground(canvas, 0, fBackgroundRect.width()); canvas.scale(-1, 1); drawBackground(canvas, 0, fBackgroundRect.width()); canvas.restore(); } else { drawBackground(canvas, 0, fBackgroundRect.width()); } return; } if (!isFinishing() && !isStarting()) return; if (firstX > lastX) { float temp = firstX; firstX = lastX; lastX = temp; } if (firstX > 0) { if (mMirrorMode) { canvas.save(); canvas.translate(canvas.getWidth() / 2, 0); if (mReversed) { drawBackground(canvas, 0, firstX); canvas.scale(-1, 1); drawBackground(canvas, 0, firstX); } else { drawBackground(canvas, canvas.getWidth() / 2 - firstX, canvas.getWidth() / 2); canvas.scale(-1, 1); drawBackground(canvas, canvas.getWidth() / 2 - firstX, canvas.getWidth() / 2); } canvas.restore(); } else { drawBackground(canvas, 0, firstX); } } if (lastX <= canvas.getWidth()) { if (mMirrorMode) { canvas.save(); canvas.translate(canvas.getWidth() / 2, 0); if (mReversed) { drawBackground(canvas, lastX, canvas.getWidth() / 2); canvas.scale(-1, 1); drawBackground(canvas, lastX, canvas.getWidth() / 2); } else { drawBackground(canvas, 0, canvas.getWidth() / 2 - lastX); canvas.scale(-1, 1); drawBackground(canvas, 0, canvas.getWidth() / 2 - lastX); } canvas.restore(); } else { drawBackground(canvas, lastX, canvas.getWidth()); } } } private void drawBackground(Canvas canvas, float fromX, float toX) { int count = canvas.save(); canvas.clipRect(fromX, (int) ((canvas.getHeight() - mStrokeWidth) / 2), toX, (int) ((canvas.getHeight() + mStrokeWidth) / 2)); mBackgroundDrawable.draw(canvas); canvas.restoreToCount(count); } private int incrementColor(int colorIndex) { ++colorIndex; if (colorIndex >= mColors.length) colorIndex = 0; return colorIndex; } private int decrementColor(int colorIndex) { --colorIndex; if (colorIndex < 0) colorIndex = mColors.length - 1; return colorIndex; } /** * Start the animation with the first color. * Calls progressiveStart(0) */ public void progressiveStart() { progressiveStart(0); } /** * Start the animation from a given color. * * @param index */ public void progressiveStart(int index) { resetProgressiveStart(index); start(); } private void resetProgressiveStart(int index) { checkColorIndex(index); mCurrentOffset = 0; mFinishing = false; mStartSection = 0; mCurrentSections = 0; mColorsIndex = index; } /** * Finish the animation by animating the remaining sections. */ public void progressiveStop() { mFinishing = true; mStartSection = 0; } @Override public void setAlpha(int alpha) { mPaint.setAlpha(alpha); } @Override public void setColorFilter(ColorFilter cf) { mPaint.setColorFilter(cf); } @Override public int getOpacity() { return PixelFormat.TRANSPARENT; } /////////////////////////////////////////////////////////////////////////// /////////////////// Animation: based on http://cyrilmottier.com/2012/11/27/actionbar-on-the-move/ @Override public void start() { if (mProgressiveStartActivated) { resetProgressiveStart(0); } if (isRunning()) return; if (mCallbacks != null) { mCallbacks.onStart(); } scheduleSelf(mUpdater, SystemClock.uptimeMillis() + FRAME_DURATION); invalidateSelf(); } @Override public void stop() { if (!isRunning()) return; if (mCallbacks != null) { mCallbacks.onStop(); } mRunning = false; unscheduleSelf(mUpdater); } @Override public void scheduleSelf(Runnable what, long when) { mRunning = true; super.scheduleSelf(what, when); } @Override public boolean isRunning() { return mRunning; } public boolean isStarting() { return mCurrentSections < mSectionsCount; } public boolean isFinishing() { return mFinishing; } private final Runnable mUpdater = new Runnable() { @Override public void run() { if (isFinishing()) { mCurrentOffset += (OFFSET_PER_FRAME * mProgressiveStopSpeed); } else if (isStarting()) { mCurrentOffset += (OFFSET_PER_FRAME * mProgressiveStartSpeed); } else { mCurrentOffset += (OFFSET_PER_FRAME * mSpeed); } if (mCurrentOffset >= mMaxOffset) { mNewTurn = true; mCurrentOffset -= mMaxOffset; } scheduleSelf(mUpdater, SystemClock.uptimeMillis() + FRAME_DURATION); invalidateSelf(); } }; //////////////////////////////////////////////////////////////////////////// /////////////////// Listener public void setCallbacks(Callbacks callbacks) { mCallbacks = callbacks; } //////////////////////////////////////////////////////////////////////////// /////////////////// Checks private void checkColorIndex(int index) { if (index < 0 || index >= mColors.length) { throw new IllegalArgumentException(String.format("Index %d not valid", index)); } } //////////////////////////////////////////////////////////////////////////// /////////////////// BUILDER /** * Builder for SmoothProgressDrawable! You must use it! */ public static class Builder { private Interpolator mInterpolator; private int mSectionsCount; private int[] mColors; private float mSpeed; private float mProgressiveStartSpeed; private float mProgressiveStopSpeed; private boolean mReversed; private boolean mMirrorMode; private float mStrokeWidth; private int mStrokeSeparatorLength; private boolean mProgressiveStartActivated; private boolean mGenerateBackgroundUsingColors; private Drawable mBackgroundDrawableWhenHidden; private Callbacks mOnProgressiveStopEndedListener; public Builder(Context context) { initValues(context); } public SmoothProgressDrawable build() { if (mGenerateBackgroundUsingColors) { mBackgroundDrawableWhenHidden = SmoothProgressBarUtils.generateDrawableWithColors(mColors, mStrokeWidth); } SmoothProgressDrawable ret = new SmoothProgressDrawable( mInterpolator, mSectionsCount, mStrokeSeparatorLength, mColors, mStrokeWidth, mSpeed, mProgressiveStartSpeed, mProgressiveStopSpeed, mReversed, mMirrorMode, mOnProgressiveStopEndedListener, mProgressiveStartActivated, mBackgroundDrawableWhenHidden); return ret; } private void initValues(Context context) { Resources res = context.getResources(); mInterpolator = new AccelerateInterpolator(); mSectionsCount = res.getInteger(R.integer.spb_default_sections_count); mColors = new int[]{res.getColor(R.color.spb_default_color)}; mSpeed = Float.parseFloat(res.getString(R.string.spb_default_speed)); mProgressiveStartSpeed = mSpeed; mProgressiveStopSpeed = mSpeed; mReversed = res.getBoolean(R.bool.spb_default_reversed); mStrokeSeparatorLength = res.getDimensionPixelSize(R.dimen.spb_default_stroke_separator_length); mStrokeWidth = res.getDimensionPixelOffset(R.dimen.spb_default_stroke_width); mProgressiveStartActivated = res.getBoolean(R.bool.spb_default_progressiveStart_activated); } public Builder interpolator(Interpolator interpolator) { if (interpolator == null) throw new IllegalArgumentException("Interpolator can't be null"); mInterpolator = interpolator; return this; } public Builder sectionsCount(int sectionsCount) { if (sectionsCount <= 0) throw new IllegalArgumentException("SectionsCount must be > 0"); mSectionsCount = sectionsCount; return this; } public Builder separatorLength(int separatorLength) { if (separatorLength < 0) throw new IllegalArgumentException("SeparatorLength must be >= 0"); mStrokeSeparatorLength = separatorLength; return this; } public Builder color(int color) { mColors = new int[]{color}; return this; } public Builder colors(int[] colors) { if (colors == null || colors.length == 0) throw new IllegalArgumentException("Your color array must not be empty"); mColors = colors; return this; } public Builder strokeWidth(float width) { if (width < 0) throw new IllegalArgumentException("The width must be >= 0"); mStrokeWidth = width; return this; } public Builder speed(float speed) { if (speed < 0) throw new IllegalArgumentException("Speed must be >= 0"); mSpeed = speed; return this; } public Builder progressiveStartSpeed(float progressiveStartSpeed) { if (progressiveStartSpeed < 0) throw new IllegalArgumentException("progressiveStartSpeed must be >= 0"); mProgressiveStartSpeed = progressiveStartSpeed; return this; } public Builder progressiveStopSpeed(float progressiveStopSpeed) { if (progressiveStopSpeed < 0) throw new IllegalArgumentException("progressiveStopSpeed must be >= 0"); mProgressiveStopSpeed = progressiveStopSpeed; return this; } public Builder reversed(boolean reversed) { mReversed = reversed; return this; } public Builder mirrorMode(boolean mirrorMode) { mMirrorMode = mirrorMode; return this; } public Builder progressiveStart(boolean progressiveStartActivated) { mProgressiveStartActivated = progressiveStartActivated; return this; } public Builder callbacks(Callbacks onProgressiveStopEndedListener) { mOnProgressiveStopEndedListener = onProgressiveStopEndedListener; return this; } public Builder backgroundDrawable(Drawable backgroundDrawableWhenHidden) { mBackgroundDrawableWhenHidden = backgroundDrawableWhenHidden; return this; } public Builder generateBackgroundUsingColors() { mGenerateBackgroundUsingColors = true; return this; } } }
[ "cymcsg@gmail.com" ]
cymcsg@gmail.com
be8105b152a74f84781bfc68980464524fd60bea
36fa2eb37227b28dbe96d03f0076bfc81fdfa4b2
/src/cfern/io/MySelector.java
56a4e7e5ec143cdc89f15fc60b2ff4c575bed0da
[]
no_license
weimingtom/mipsem
842c8f3341a2e7d3bedd754f472dae18268d057a
0253cc7dfa94dc44fb4f84e958d85b17c59d2435
refs/heads/master
2023-03-26T07:08:28.798833
2017-08-26T07:25:02
2017-08-26T07:25:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,376
java
/** * Cfern, a Mips/Unix/C emulator for Java * Alexander Slack alexslack56@hotmail.com */ package cfern.io; import java.io.IOException; import java.nio.channels.*; import java.util.*; import cfern.Driver; import cfern.fs.FileDesc; public class MySelector { private final Selector sel; private final short[] avFd; private final FileDesc[] av; private short[] avRet = null; public static MySelector newInstance(FileDesc[] in, short[] inFd, FileDesc[] out, short[] outFd) { short[] avFd = null, rdFd = null; FileDesc[] av = null, rd = null; if (in != null) { // count how many read fds have channels int c = 0; for (int n = 0; n < in.length; n++) if (in[n].inChannel() != null) c++; // make arrays for channel read fds and non channel read fds if (c > 0) { rd = new FileDesc[c]; rdFd = new short[c]; } if (c < in.length) { av = new FileDesc[in.length - c]; avFd = new short[in.length - c]; } // copy read fds to new arrays for (int n = 0, i = 0, j = 0; n < in.length; n++) { if (in[n].inChannel() != null) { rd[i] = in[n]; rdFd[i++] = inFd[n]; } else { av[j] = in[n]; avFd[j++] = inFd[n]; } } } if (out != null) { // check all write fds have channels for (int n = 0; n < out.length; n++) { if (out[n].outChannel() == null) throw new RuntimeException("cannot select writes on " + out[n]); } } Driver.opt().info("MySelector: av=%s rd=%s wr=%s", Arrays.toString(avFd), Arrays.toString(rdFd), Arrays.toString(outFd)); if (rd == null && av == null && out == null) return null; else return new MySelector(av, avFd, rd, rdFd, out, outFd); } private MySelector(FileDesc[] av, short[] avFd, FileDesc[] rd, short[] rdFd, FileDesc[] wr, short[] wrFd) { Selector sel = null; if (rd != null || wr != null) { try { sel = Selector.open(); if (rd != null) { for (int n = 0; n < rd.length; n++) { FileDesc f = rd[n]; SelectableChannel sc = f.inChannel(); sc.configureBlocking(false); // TODO should probably be OP_ACCEPT if sc is ServerSocketChannel sc.register(sel, SelectionKey.OP_READ, new FD(FD.R, rdFd[n])); } } if (wr != null) { for (int n = 0; n < wr.length; n++) { FileDesc f = wr[n]; SelectableChannel sc = f.outChannel(); sc.configureBlocking(false); sc.register(sel, SelectionKey.OP_WRITE, new FD(FD.W, wrFd[n])); } } } catch (IOException e) { throw new RuntimeException("could not create write selector", e); } } // may be null this.avFd = avFd; this.av = av; this.sel = sel; } public short[][] select() { selectImpl(); return getSelected(); } private int selectImpl() { int ret = 0; while (true) { if (av != null) { for (int n = 0; n < av.length; n++) { FileDesc f = av[n]; if (f.available() != 0) { Driver.opt().info("select: read possible on %s", f, f.available()); avRet = Driver.append(avRet, avFd[n]); ret++; } } } if (sel != null) { try { if (ret == 0) { if (av == null) { // select forever ret += sel.select(); } else { // select and sleep for next av poll ret += sel.select(100); } } else { // results from av waiting, don't delay ret += sel.selectNow(); } } catch (IOException e) { e.printStackTrace(); } } else { try { Thread.sleep(100); } catch (InterruptedException e) { // FIXME select needs to return EINTR e.printStackTrace(); } } if (ret > 0) { Driver.opt().info("select: %d fds ready", ret); return ret; } } } private short[][] getSelected() { short[][] ret = new short[][] { avRet, null }; if (sel != null) { Iterator<SelectionKey> i = sel.selectedKeys().iterator(); for (int n = 0; i.hasNext(); n++) { FD f = ((FD)i.next().attachment()); ret[f.type] = Driver.append(ret[f.type], f.fd); } try { sel.close(); } catch (IOException e) { e.printStackTrace(); } } // sort if many.. which I doubt for (int n = 0; n < 2; n++) { short[] s = ret[n]; if (s != null && s.length > 1) Arrays.sort(s); } Driver.opt().info("select: returning rd=%s wr=%s", Arrays.toString(ret[0]), Arrays.toString(ret[1])); return ret; } } class FD { public final static short R = 0, W = 1; public final short fd; public final short type; FD(short type, short fd) { this.type = type; this.fd = fd; } }
[ "alexslack56@hotmail.com" ]
alexslack56@hotmail.com
99b36456d27720215b7f859bbd08b73a0f746b95
b38ab8815a0540d879e2ad961b61be04e4017b92
/ExtSNSService/src/main/java/com/socialmarketing/model/master/product/Brand.java
ffad32408e55a7e103af8d22cfe17257aee29a11
[]
no_license
cbhandsun/SocialMarketing
a6f0720e97ef4a285cca2414e8cc40119102dbc8
2e2609ad01058befd6f2d5110b015c62c4c7837e
refs/heads/master
2016-08-05T05:20:55.884837
2014-10-05T16:45:57
2014-10-05T16:45:57
7,698,636
2
0
null
null
null
null
UTF-8
Java
false
false
3,140
java
package com.socialmarketing.model.master.product; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import static javax.persistence.GenerationType.IDENTITY; import javax.persistence.Id; import javax.persistence.Table; /** * Brand entity. @author MyEclipse Persistence Tools */ @Entity @Table(name = "pro_brand", catalog = "extsns") public class Brand extends com.socialmarketing.core.model.DataAuditEntityBase implements java.io.Serializable { // Fields /** * */ private static final long serialVersionUID = 872952954666739393L; private Long ID; private String cataCode; private String brandCode; private String brandName; private String brandNameEn; private String desp; private String status; private String url; private String brandStory; // Constructors /** default constructor */ public Brand() { } /** minimal constructor */ public Brand(String cataCode, String brandCode, String brandName) { this.cataCode = cataCode; this.brandCode = brandCode; this.brandName = brandName; } /** full constructor */ public Brand(String cataCode, String brandCode, String brandName, String brandNameEn, String desp, String status, String url, String brandStory) { this.cataCode = cataCode; this.brandCode = brandCode; this.brandName = brandName; this.brandNameEn = brandNameEn; this.desp = desp; this.status = status; this.url = url; this.brandStory = brandStory; } // Property accessors @Id @GeneratedValue(strategy = IDENTITY) @Column(name = "ID", unique = true, nullable = false) public Long getID() { return this.ID; } public void setID(Long ID) { this.ID = ID; } @Column(name = "cataCode", nullable = false, length = 20) public String getCataCode() { return this.cataCode; } public void setCataCode(String cataCode) { this.cataCode = cataCode; } @Column(name = "brandCode", nullable = false, length = 20) public String getBrandCode() { return this.brandCode; } public void setBrandCode(String brandCode) { this.brandCode = brandCode; } @Column(name = "brandName", nullable = false, length = 100) public String getBrandName() { return this.brandName; } public void setBrandName(String brandName) { this.brandName = brandName; } @Column(name = "brandName_en", length = 100) public String getBrandNameEn() { return this.brandNameEn; } public void setBrandNameEn(String brandNameEn) { this.brandNameEn = brandNameEn; } @Column(name = "desp", length = 1000) public String getDesp() { return this.desp; } public void setDesp(String desp) { this.desp = desp; } @Column(name = "status", length = 10) public String getStatus() { return this.status; } public void setStatus(String status) { this.status = status; } @Column(name = "url", length = 100) public String getUrl() { return this.url; } public void setUrl(String url) { this.url = url; } @Column(name = "brandStory", length = 1000) public String getBrandStory() { return this.brandStory; } public void setBrandStory(String brandStory) { this.brandStory = brandStory; } }
[ "cbhandsun@gmail.com" ]
cbhandsun@gmail.com
7483e971347926e3f0f43bbaf21f58b2df7b7105
02eeeb2180b9db5ec3c413775034c0b37b52e9a1
/taotao-portal/src/main/java/com/taotao/portal/pojo/Item.java
c9116f2684e0cc96e80fc1602677e28407987948
[]
no_license
asurajava/taotao
fa713463ad8fb39dab8c78f9c114b927e05d6603
ede5727ab2efea3ebf2be0a3d448c10e8db90ac0
refs/heads/master
2021-01-19T09:18:21.348663
2017-04-20T05:20:19
2017-04-20T05:20:19
87,746,799
0
0
null
null
null
null
UTF-8
Java
false
false
1,485
java
package com.taotao.portal.pojo; /** * Created by Asura on 2017/3/18. */ public class Item { private String id; private String title; private String sell_point; private long price; private String image; private String category_name; private String item_des; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getSell_point() { return sell_point; } public void setSell_point(String sell_point) { this.sell_point = sell_point; } public long getPrice() { return price; } public void setPrice(long price) { this.price = price; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getCategory_name() { return category_name; } public void setCategory_name(String category_name) { this.category_name = category_name; } public String getItem_des() { return item_des; } public void setItem_des(String item_des) { this.item_des = item_des; } public String[] getImages(){ if(image!=null){ String[] images = image.split(","); return images; } return null; } }
[ "2830849518@qq.com" ]
2830849518@qq.com
212ceea21f0e3d108e956843bc7a7a4ec1850551
c8c30e04ffaa2a8122204fda0eef6af2ef86d96e
/app/src/main/java/com/example/practica2adpsp/model/entity/Llamada.java
1e7c13e31f0d1bb81cbf936f731767ba5244e9dc
[]
no_license
vicmog/practica2ADPSP
85429a010fe3c30861728995aa8086f90d4a57ba
dc9fd45a37b35946b656d98cc9d581f9ec2e95f9
refs/heads/master
2023-02-15T11:58:01.548592
2021-01-12T09:22:25
2021-01-12T09:22:25
316,298,590
0
0
null
null
null
null
UTF-8
Java
false
false
1,374
java
package com.example.practica2adpsp.model.entity; import androidx.annotation.NonNull; import androidx.room.ColumnInfo; import androidx.room.Entity; import androidx.room.ForeignKey; import androidx.room.PrimaryKey; @Entity(tableName = "llamadas") public class Llamada { @PrimaryKey(autoGenerate = true) private int id; @NonNull @ColumnInfo(name = "id_amigo") private int id_amigo; @NonNull @ColumnInfo(name = "fecha_llamada") private String fecha_llamada; public Llamada() { } public Llamada(int id_amigo, @NonNull String fecha_llamada) { this.id_amigo = id_amigo; this.fecha_llamada = fecha_llamada; } public int getId() { return id; } public void setId(int id) { this.id = id; } public int getId_amigo() { return id_amigo; } public void setId_amigo(int id_amigo) { this.id_amigo = id_amigo; } @NonNull public String getFecha_llamada() { return fecha_llamada; } public void setFecha_llamada(@NonNull String fecha_llamada) { this.fecha_llamada = fecha_llamada; } @Override public String toString() { return "Llamada{" + "id=" + id + ", id_amigo=" + id_amigo + ", fecha_llamada='" + fecha_llamada + '\'' + '}'; } }
[ "62395770+vicmog@users.noreply.github.com" ]
62395770+vicmog@users.noreply.github.com
3876c69f848fd368a47bdef9061cbaad60bce359
fb07f24d112821b4ef8cf532ac39a67329e1a82f
/bankwithmint/src/main/java/com/bankwithmint/inventorymanagement/controller/OrderController.java
77106d624d6bcce9a126703c804d555e273f58dd
[]
no_license
temitopejoshua/temitope_bankwithmint
2733a32da9e40a24697eec08c2cb8270cd174916
6b7085e307ffa095d5151acce35fe630c2d2ce0b
refs/heads/master
2023-01-21T05:22:37.070329
2020-11-24T21:38:55
2020-11-24T21:38:55
315,757,383
0
0
null
null
null
null
UTF-8
Java
false
false
1,029
java
package com.bankwithmint.inventorymanagement.controller; import com.bankwithmint.inventorymanagement.payload.CreateOrderRequestDTO; import com.bankwithmint.inventorymanagement.service.OrderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @RestController @RequestMapping("/api/v1/order") public class OrderController { @Autowired private OrderService orderService; @PostMapping("/") public ResponseEntity<Object> orderProduct(@Validated @RequestBody CreateOrderRequestDTO requestDTO){ return new ResponseEntity<>(orderService.createOrder(requestDTO), HttpStatus.CREATED); } }
[ "temitope.oyemade@fincode.co.uk" ]
temitope.oyemade@fincode.co.uk
741edeab985e1b8f28e9de30558cddc5ad778e8b
e8104a1239ef91bf100eaec8244029cb8ea68c0a
/Longnt/Asignment4 Spring_DI/src/fasttrackse/main/MainApp.java
f4e044b4bc36b91599f6e5cb87ef1f8f8eecede2
[]
no_license
FASTTRACKSE/FFSE1703.JavaWeb
72b868b34a934bb9504a218011ccce668d278ad6
b659082bf40c5d2128092ab3a3addd3caff770e9
refs/heads/master
2021-06-07T09:22:16.125557
2021-03-05T04:52:01
2021-03-05T04:52:01
137,868,312
0
3
null
null
null
null
UTF-8
Java
false
false
6,788
java
package fasttrackse.main; import java.util.ArrayList; import java.util.List; import org.springframework.context.support.ClassPathXmlApplicationContext; import fasttrackse.entity.DaoTaoDaiHan; import fasttrackse.entity.DaoTaoNganHan; import fasttrackse.entity.GiangVien; import fasttrackse.entity.HocKy; import fasttrackse.entity.HocKy1; import fasttrackse.entity.HocKy2; import fasttrackse.entity.HocKy3; import fasttrackse.entity.HocKy4; import fasttrackse.entity.HocKyJava; import fasttrackse.entity.HocKyWebFullStack; import fasttrackse.entity.LopHoc; import fasttrackse.entity.MonCongNghe; import fasttrackse.entity.MonThucTap; import fasttrackse.entity.MonTiengAnh; import fasttrackse.entity.SinhVien; public class MainApp { public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); DaoTaoDaiHan daoTaoDaiHan = context.getBean("daoTaoDaiHan",DaoTaoDaiHan.class); MonCongNghe monCongNghe1 = context.getBean("monCongNghe", MonCongNghe.class); MonTiengAnh monTiengAnh1 = context.getBean("monTiengAnh", MonTiengAnh.class); MonCongNghe monCongNghe2 = context.getBean("monCongNghe", MonCongNghe.class); MonTiengAnh monTiengAnh2 = context.getBean("monTiengAnh", MonTiengAnh.class); MonCongNghe monCongNghe3 = context.getBean("monCongNghe", MonCongNghe.class); MonThucTap monThucTap = context.getBean("monThucTap", MonThucTap.class); GiangVien giangVienPhuTrach = new GiangVien("Nguyễn Đình Thi.", " Địa chỉ email: TuanCL@gmail.com"); monCongNghe1.setGiangVienChinh(new GiangVien("Lê Cao Thành.", " Địa chỉ email: ThanhCL@gmail.com")); monCongNghe1.setTroGiang( new GiangVien("Trần Minh Thắng.", " Địa chỉ email: ThangTM@gmail.com")); monCongNghe1.setMentor(new GiangVien("Lê Văn Tuấn.", " Địa chỉ email: TuanLV@gmail.com")); monCongNghe1.setTenMonHoc( new GiangVien("Môn: ","Nhập môn lập Trình - HTML,CSS - WebFrontEnd")); monTiengAnh1.setGiangVienChinh(new GiangVien("Lê Thị Mỹ Hồng."," Địa chỉ email: HongLTM@gmail.com")); monTiengAnh1.setTroGiang(new GiangVien("Nguyễn Thị Kiều Mi."," Địa chỉ email: MiNTK@gmail.com")); monCongNghe2.setGiangVienChinh(new GiangVien("Hồ Tấn Sinh.", " Địa chỉ email: Sinh@gmail.com")); monCongNghe2.setTroGiang(new GiangVien("Nguyễn Tất Thành.", " Địa chỉ email: Thanh@gmail.com")); monCongNghe2.setMentor(new GiangVien("Nguyễn Thanh Lộc","Địa chỉ email: Loc@gmail.com")); monCongNghe2.setTenMonHoc(new GiangVien("Môn: ","Java Core - Java Web")); monTiengAnh2.setGiangVienChinh(new GiangVien("Trần Thị Hương."," Địa chỉ email: Huong@gmail.com")); monTiengAnh2.setTroGiang(new GiangVien("Đỗ Thị Nguyên."," Địa chỉ email: Nguyen@gmail.com")); monCongNghe3.setGiangVienChinh(new GiangVien("Hồ Tấn Tài.", " Địa chỉ email: Tai@gmail.com")); monCongNghe3.setTroGiang(new GiangVien("Nguyễn Tất Hoang.", " Địa chỉ email: Hoang@gmail.com")); monCongNghe3.setMentor(new GiangVien("Nguyễn Thanh Phúc","Địa chỉ email: Phuc@gmail.com")); monCongNghe3.setTenMonHoc(new GiangVien("Môn: "," Lập trình Anroid")); monThucTap.setTenMonHoc(new GiangVien("Môn: "," Học kỳ thực tập ")); monThucTap.setGiangVienPhuTrach(giangVienPhuTrach); DaoTaoNganHan daoTaoNganHan = context.getBean("daoTaoNganHan",DaoTaoNganHan.class); MonCongNghe monCongNghe5 = context.getBean("monCongNghe", MonCongNghe.class); MonCongNghe monCongNghe6 = context.getBean("monCongNghe", MonCongNghe.class); monCongNghe5.setGiangVienChinh(new GiangVien("Nguyễn Thanh Long.", " Địa chỉ email: Long@gmail.com")); monCongNghe5.setTroGiang( new GiangVien("Trần Minh Tùng.", " Địa chỉ email: Tung@gmail.com")); monCongNghe5.setMentor(new GiangVien("Lê Văn Huấn.", " Địa chỉ email: Hua@gmail.com")); monCongNghe5.setTenMonHoc( new GiangVien("Môn: "," Chủ đề Java")); monCongNghe6.setGiangVienChinh(new GiangVien("Nguyễn Thanh Hóa.", " Địa chỉ email: Hoa@gmail.com")); monCongNghe6.setTroGiang( new GiangVien("Trần Minh Phú.", " Địa chỉ email: Phu@gmail.com")); monCongNghe6.setMentor(new GiangVien("Lê Văn Hữa.", " Địa chỉ email: Hua@gmail.com")); monCongNghe6.setTenMonHoc( new GiangVien("Môn: "," Chủ đề Web Full Stack")); HocKy1 hocKy1 = context.getBean("hocKy1", HocKy1.class); hocKy1.setMonCongNghe(monCongNghe1); hocKy1.setMonTiengAnh(monTiengAnh1); HocKy2 hocKy2 = context.getBean("hocKy2", HocKy2.class); hocKy2.setMonCongNghe(monCongNghe2); hocKy2.setMonTiengAnh(monTiengAnh2); HocKy3 hocKy3 = context.getBean("hocKy3", HocKy3.class); hocKy3.setMonCongNghe(monCongNghe3); HocKy4 hocKy4 = context.getBean("hocKy4", HocKy4.class); hocKy4.setMonThucTap(monThucTap); HocKyJava hocKyJava = context.getBean("hocKyJava", HocKyJava.class); hocKyJava.setMonCongNghe(monCongNghe5); HocKyWebFullStack hocKyWebFullStack = context.getBean("hocKyWebFullStack", HocKyWebFullStack.class); hocKyWebFullStack.setMonCongNghe(monCongNghe6); List<HocKy> hocKy = new ArrayList<HocKy>(); hocKy.add(hocKy1); hocKy.add(hocKy2); hocKy.add(hocKy3); hocKy.add(hocKy4); List<HocKy> hocKyNH = new ArrayList<HocKy>(); hocKy.add(hocKyJava); hocKy.add(hocKyWebFullStack); daoTaoDaiHan.setHocKy(hocKy); daoTaoNganHan.setHocKy(hocKyNH); LopHoc lop1703 = new LopHoc(); lop1703.setDaoTaoDaiHan(daoTaoDaiHan); lop1703.setSinhVien(new SinhVien("Nguyễn Thanh Long", "509 Ngô Quyền", "LongNT@gmail.com", "SDT: 0974394074")); lop1703.setSinhVien(new SinhVien("Nguyễn Thanh Lộc", "Quảng Trị", "Loc@gmail.com", "SDT: 0947595949")); lop1703.setSinhVien(new SinhVien("Nguyễn Thanh Phước", "GiaLai", "Phuoc@gmail.com", "SDT: 097435522")); lop1703.setSinhVien(new SinhVien("Nguyễn Thanh Đức", "Kim Long", "Duc@gmail.com", "SDT: 0974889024")); lop1703.setSinhVien(new SinhVien("Nguyễn Thanh Hoài", "Hải Quế", "Hoai@gmail.com", "SDT: 0975626330")); LopHoc lop1802 = new LopHoc(); lop1802.setDaoTaoNganHan(daoTaoNganHan); lop1802.setSinhVien(new SinhVien("Nguyễn Thanh Long", "509 Ngô Quyền", "LongNT@gmail.com", "SDT: 0974394074")); lop1802.setSinhVien(new SinhVien("Nguyễn Thanh Lộc", "Quảng Trị", "Loc@gmail.com", "SDT: 0947595949")); lop1802.setSinhVien(new SinhVien("Nguyễn Thanh Phước", "GiaLai", "Phuoc@gmail.com", "SDT: 097435522")); lop1802.setSinhVien(new SinhVien("Nguyễn Thanh Đức", "Kim Long", "Duc@gmail.com", "SDT: 0974889024")); lop1802.setSinhVien(new SinhVien("Nguyễn Thanh Hoài", "Hải Quế", "Hoai@gmail.com", "SDT: 0975626330")); System.out.println(lop1703.mangSachDiHoc()); System.out.println(lop1802.mangSachDiHoc()); context.close(); } }
[ "FFSE1703020@st.fasttrack.edu.vn" ]
FFSE1703020@st.fasttrack.edu.vn
b29cebf6e5ec102238973def41aa3e77781e7886
321b4ed83b6874eeb512027eaa0b17b0daf3c289
/81/81.search-in-rotated-sorted-array-ii.9063871.Accepted.leetcode.java
3f6dce8c283450f27b47252b946ebf2e6a3e50bd
[]
no_license
huangyingw/submissions
7a610613bdb03f1223cdec5f6ccc4391149ca618
bfac1238ecef8b03e54842b852f6fec111abedfa
refs/heads/master
2023-07-25T09:56:46.814504
2023-07-16T07:38:36
2023-07-16T07:38:36
143,352,065
0
1
null
null
null
null
UTF-8
Java
false
false
747
java
public class Solution { public boolean search(int[] A, int target) { int left = 0; int right = A.length - 1; while (left <= right) { int mid = left + (right - left) / 2; if (A[mid] == target) { return true; } if (A[left] < A[mid]) { if (A[left] <= target && target < A[mid]) { right = mid - 1; } else { left = mid + 1; } } else if (A[left] > A[mid]) { if (A[mid] < target && target <= A[right]) { left = mid + 1; } else { right = mid - 1; } } else { left++; } } return false; } }
[ "huangyingw@gmail.com" ]
huangyingw@gmail.com
830d931dad2e04dc0e47343167fae012d528137c
a452771e48c3714a68dc7e8072b34cc8ee41011b
/SentenciaIf.java
6b2ec42e1fdf5faee5723ccfd409e715a2dcb814
[]
no_license
samuelvalverde28/pruebas-git
6b8a29ee0e68525a17dafabef6c68cee5288f394
bcb18365bcdbab708e7be5ea3aec2cde4fea8b38
refs/heads/master
2020-03-29T22:26:41.414396
2018-10-02T07:08:58
2018-10-02T07:08:58
150,420,873
0
0
null
null
null
null
UTF-8
Java
false
false
517
java
import java.util.Scanner; public class SentenciaIf{ public static void main(String[] arg){ String linea; System.out.println("Le voy a decir si el nº introducido es par o impar."); System.out.println("Introduce el numeroº:"); linea = System.console().readLine(); int numero = Integer.parseInt(linea); if ((numero % 2) == 0) { //el numero es par System.out.printf("El numero %d es par.\n",numero); } else { System.out.printf("El numero %d es impar.\n",numero); } } }
[ "samuel.ies.valverde@gmail.com" ]
samuel.ies.valverde@gmail.com
5777d43e92ff296dfbbad0aeca2863ed50b30d04
3dd35c0681b374ce31dbb255b87df077387405ff
/generated/com/guidewire/_generated/entity/GL7LineExclCostInternal.java
d98e9c4f08e73d568a8d1d18aa1510ef34d0cf70
[]
no_license
walisashwini/SBTBackup
58b635a358e8992339db8f2cc06978326fed1b99
4d4de43576ec483bc031f3213389f02a92ad7528
refs/heads/master
2023-01-11T09:09:10.205139
2020-11-18T12:11:45
2020-11-18T12:11:45
311,884,817
0
0
null
null
null
null
UTF-8
Java
false
false
870
java
package com.guidewire._generated.entity; @javax.annotation.Generated(value = "com.guidewire.pl.metadata.codegen.Codegen", comments = "GL7LineExclCost.eti;GL7LineExclCost.eix;GL7LineExclCost.etx") @java.lang.SuppressWarnings(value = {"deprecation", "unchecked"}) public interface GL7LineExclCostInternal extends com.guidewire._generated.entity.GL7CostInternal, com.guidewire._generated.entity.CostInternal, gw.api.domain.financials.CostAdapter { /** * Gets the value of the LineExclusion field. */ @gw.internal.gosu.parser.ExtendedProperty public entity.GL7LineExcl getLineExclusion(); public gw.pl.persistence.core.Key getLineExclusionID(); /** * Sets the value of the LineExclusion field. */ public void setLineExclusion(entity.GL7LineExcl value); public void setLineExclusionID(gw.pl.persistence.core.Key value); }
[ "ashwini@cruxxtechnologies.com" ]
ashwini@cruxxtechnologies.com
2cc83a9ac2732528bf80d9bde62c3dedc79082c4
e618b18b66b819d406446ec222350d947e852385
/src/test/java/org/neo4j/neode/RelateNodesBatchCommandBuilderTest.java
446e54d8eef2315a9dfe74c5363d5ef87ee38895
[]
no_license
sarmbruster/neode
e7122ad4bee3090085fee1008f6e1d3c487059ae
f047720d24dbad94a7bf298944bb55d6d1589774
refs/heads/master
2021-01-18T08:25:51.328992
2013-01-25T20:44:25
2013-01-25T20:44:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,997
java
package org.neo4j.neode; import static java.util.Arrays.asList; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.neo4j.graphdb.DynamicRelationshipType.withName; import java.util.Collections; import org.junit.Test; import org.neo4j.graphdb.Direction; import org.neo4j.graphdb.DynamicRelationshipType; import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.graphdb.Node; import org.neo4j.neode.logging.SysOutLog; import org.neo4j.neode.properties.Property; import org.neo4j.neode.test.Db; public class RelateNodesBatchCommandBuilderTest { @Test public void shouldRelateNodes() throws Exception { // given GraphDatabaseService db = Db.impermanentDb(); DatasetManager dsm = new DatasetManager( db, SysOutLog.INSTANCE ); Dataset dataset = dsm.newDataset( "Test" ); NodeCollection users = new NodeSpecification( "user", Collections.<Property>emptyList(), db ) .create( 3 ).update( dataset ); NodeSpecification product = new NodeSpecification( "product", Collections.<Property>emptyList(), db ); RelationshipSpecification bought = dsm.relationshipSpecification( "BOUGHT" ); final NodeCollection products = product.create( 3 ).update( dataset ); TargetNodesSource targetNodesSource = new TargetNodesSource() { int index = 0; @Override public Iterable<Node> getTargetNodes( int quantity, Node currentNode ) { return asList( products.getNodeByPosition( index++ ) ); } @Override public String label() { return null; } }; TargetNodesStrategyBuilder targetNodesStrategyBuilder = new TargetNodesStrategyBuilder( targetNodesSource ); // when users.createRelationshipsTo( targetNodesStrategyBuilder .numberOfTargetNodes( Range.exactly( 1 ) ) .relationship( bought ) .relationshipConstraints( Range.exactly( 1 ) ) ) .update( dataset ); // then DynamicRelationshipType bought_rel = withName( "BOUGHT" ); Node product1 = db.getNodeById( 1 ); assertTrue( product1.hasRelationship( bought_rel, Direction.OUTGOING ) ); assertEquals( 4l, product1.getSingleRelationship( bought_rel, Direction.OUTGOING ).getEndNode().getId() ); Node product2 = db.getNodeById( 2 ); assertTrue( product2.hasRelationship( bought_rel, Direction.OUTGOING ) ); assertEquals( 5l, product2.getSingleRelationship( bought_rel, Direction.OUTGOING ).getEndNode().getId() ); Node product3 = db.getNodeById( 3 ); assertTrue( product3.hasRelationship( bought_rel, Direction.OUTGOING ) ); assertEquals( 6l, product3.getSingleRelationship( bought_rel, Direction.OUTGOING ).getEndNode().getId() ); } }
[ "iansrobinson@gmail.com" ]
iansrobinson@gmail.com
0fbb67849b951ce91efa02e0d0a50d49f16df3a8
9916ac10978073710208d51e0b5e9b5b32dbd7ea
/NorthwindProjectJava/src/com/northwindx/model/jpa/Customers.java
a686c121dc0e611fdd672b227665e1db741a2b71
[]
no_license
panaroma/northwindproject
d332369de0f17ed65b55b3a0e48d92c8088bd0a9
2e6c1586e485262a5edb115bad55576d68b6c34b
refs/heads/master
2021-01-10T05:24:14.130532
2015-12-02T00:21:33
2015-12-02T00:21:33
47,224,850
0
0
null
null
null
null
UTF-8
Java
false
false
3,660
java
package com.northwindx.model.jpa; import java.io.Serializable; import java.util.Collection; import javax.persistence.Basic; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; @Entity @Table(name = "Customers") public class Customers implements Serializable { private static final long serialVersionUID = 1L; @Id @Basic(optional = false) @Column(name = "CustomerID") private String CustomerID; @Basic(optional = false) @Column(name = "CompanyName") private String CompanyName; @Column(name = "ContactName") private String ContactName; @Column(name = "ContactTitle") private String ContactTitle; @Column(name = "Email") private String Email; @Column(name = "Password") private String Password; @Column(name = "Address") private String Address; @Column(name = "City") private String City; @Column(name = "Region") private String Region; @Column(name = "PostalCode") private String PostalCode; @Column(name = "Country") private String Country; @Column(name = "Phone") private String Phone; @Column(name = "Fax") private String Fax; @OneToMany(cascade = CascadeType.ALL, mappedBy = "Customer") private Collection<Orders> Orders; public Customers() {} public String getCustomerID() { return CustomerID; } public void setCustomerID(String customerID) { CustomerID = customerID; } public String getCompanyName() { return CompanyName; } public void setCompanyName(String companyName) { CompanyName = companyName; } public String getContactName() { return ContactName; } public void setContactName(String contactName) { ContactName = contactName; } public String getContactTitle() { return ContactTitle; } public void setContactTitle(String contactTitle) { ContactTitle = contactTitle; } public String getPassword() { return Password; } public void setPassword(String password) { Password = password; } public String getAddress() { return Address; } public void setAddress(String address) { Address = address; } public String getCity() { return City; } public void setCity(String city) { City = city; } public String getRegion() { return Region; } public void setRegion(String region) { Region = region; } public String getPostalCode() { return PostalCode; } public void setPostalCode(String postalCode) { PostalCode = postalCode; } public String getCountry() { return Country; } public void setCountry(String country) { Country = country; } public String getPhone() { return Phone; } public void setPhone(String phone) { Phone = phone; } public String getFax() { return Fax; } public void setFax(String fax) { Fax = fax; } public Collection<Orders> getOrders() { return Orders; } public void setOrders(Collection<Orders> orders) { Orders = orders; } public String getEmail() { return Email; } public void setEmail(String email) { Email = email; } @Override public int hashCode() { int hash = 0; hash += (CustomerID != null ? CustomerID.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { if (!(object instanceof Customers)) { return false; } Customers other = (Customers) object; if ((this.CustomerID == null && other.CustomerID != null) || (this.CustomerID != null && !this.CustomerID.equals(other.CustomerID))) { return false; } return true; } @Override public String toString() { return "com.northwindx.model.jpa.Customers[customerID=" + CustomerID + "]"; } }
[ "reliantbay@gmail.com" ]
reliantbay@gmail.com
45f72c2caad5f7ec5ca7fd9e7cd4ae2d48aa2673
530a18cbae4919546a66100fdb6de98408e1cd22
/src/main/java/org/systemaudit/model/EmployeeDetails.java
a374c48bebd329da7f11e22d54e4b5095eb8710b
[]
no_license
harikrishnatrivedi/SystemAudit
7302bd4f8e73359c4f32c98395ab036a39a76983
c6f84501b5078c899ffe6b951a7c1d709b1fdc9c
refs/heads/master
2021-01-10T11:33:48.521904
2016-04-22T13:59:30
2016-04-22T13:59:30
50,358,114
0
0
null
null
null
null
UTF-8
Java
false
false
2,952
java
/** * */ package org.systemaudit.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.validation.constraints.Size; import org.hibernate.validator.constraints.NotBlank; /** * @author harikrishna.trivedi * */ @Entity @Table(name = "EMPLOYEE_DETAILS") public class EmployeeDetails { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "EMP_ID", nullable = false) private int empId; @Size(max = 10) @Column(name = "EMP_CODE", nullable = true) private String empCode; @Size(max = 50) @NotBlank @Column(name = "EMP_NAME", nullable = false) private String empLoginName; @Size(max = 15) @NotBlank @Column(name = "EMP_PASSWORD", nullable = false) private String empPassword; @Column(name = "EMP_LOCATION", nullable = true) @Size(max = 30) private String empLocation; @Column(name = "EMP_DESIGNATION", nullable = true) @Size(max = 30) private String empDesignation; /** * @return the empId */ public int getEmpId() { return empId; } /** * @param empId * the empId to set */ public void setEmpId(int empId) { this.empId = empId; } /** * @return the empCode */ public String getEmpCode() { return empCode; } /** * @param empCode * the empCode to set */ public void setEmpCode(String empCode) { this.empCode = empCode; } /** * @return the empLoginName */ public String getEmpLoginName() { return empLoginName; } /** * @param empLoginName * the empLoginName to set */ public void setEmpLoginName(String empLoginName) { this.empLoginName = empLoginName; } /** * @return the empPassword */ public String getEmpPassword() { return empPassword; } /** * @param empPassword * the empPassword to set */ public void setEmpPassword(String empPassword) { this.empPassword = empPassword; } /** * @return the empLocation */ public String getEmpLocation() { return empLocation; } /** * @param empLocation * the empLocation to set */ public void setEmpLocation(String empLocation) { this.empLocation = empLocation; } /** * @return the empDesignation */ public String getEmpDesignation() { return empDesignation; } /** * @param empDesignation * the empDesignation to set */ public void setEmpDesignation(String empDesignation) { this.empDesignation = empDesignation; } @Override public String toString() { return "objEmployee [empId=" + empId + ", empDesignation=" + empDesignation + ", empLoginName=" + empLoginName + ", empPassword=" + empPassword + ", empLocation=" + empLocation + "]"; } }
[ "harikrishna.trivedi@gmail.com" ]
harikrishna.trivedi@gmail.com
040eb4a4c4da666f692b818f316cedcc37d7924e
d71e879b3517cf4fccde29f7bf82cff69856cfcd
/ExtractedJars/PACT_com.pactforcure.app/javafiles/com/fasterxml/jackson/databind/jsonFormatVisitors/JsonStringFormatVisitor.java
60bb08b104b6007998988816cbcd190841f6fdf5
[ "MIT" ]
permissive
Andreas237/AndroidPolicyAutomation
b8e949e072d08cf6c6166c3f15c9c63379b8f6ce
c1ed10a2c6d4cf3dfda8b8e6291dee2c2a15ee8a
refs/heads/master
2020-04-10T02:14:08.789751
2019-05-16T19:29:11
2019-05-16T19:29:11
160,739,088
5
1
null
null
null
null
UTF-8
Java
false
false
691
java
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov. // Jad home page: http://www.kpdus.com/jad.html // Decompiler options: packimports(3) annotate safe package com.fasterxml.jackson.databind.jsonFormatVisitors; // Referenced classes of package com.fasterxml.jackson.databind.jsonFormatVisitors: // JsonValueFormatVisitor public interface JsonStringFormatVisitor extends JsonValueFormatVisitor { public static class Base extends JsonValueFormatVisitor.Base implements JsonStringFormatVisitor { public Base() { // 0 0:aload_0 // 1 1:invokespecial #11 <Method void JsonValueFormatVisitor$Base()> // 2 4:return } } }
[ "silenta237@gmail.com" ]
silenta237@gmail.com
99d53c63b68ac36442ba008cc80e50ea36e493e5
15d7f86bf70eb310a1b9f0cd9424bdf884096d7e
/maven-ES/src/test/java/StartHTMLContentTest.java
9eaec51e76acf432e3642e996b2eb8171f40138e
[]
no_license
CesarCouchinho/grupo9es
d8d9dfec0ea1a8dd6d79c47209abded05fb7dafe
7a5d178c81c3250f63c035195b06edd2be02fde9
refs/heads/master
2022-11-06T02:12:58.710112
2020-06-15T10:09:47
2020-06-15T10:09:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,194
java
import static org.junit.Assert.*; import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; import org.junit.Test; import junit.framework.Assert; public class StartHTMLContentTest { @Test public void test() { HTML html = new HTML(); html.startHTMLcontent(); html.closeHTMLContent(); String conteudoNoHTML = html.conteudoHTML; String conteudoQueDeveriaEstarNoHTML = "<html>\r\n" + "<head>\r\n" + "<title>\r\n" + "Complemento 4 \r\n" + "</title>\r\n" + "<style>" + html.css + "</style>\r\n" + "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />" + "</head>\r\n" + "<body>\r\n" + "<table class=\"blueTable\">\r\n" + "<thead>\r\n" + " <tr>\r\n" + " <th width=\"100px\"><b>File Timestamp</b></th>\r\n" + " <th><b>File Name</b></th>\r\n" + " <th><b>File Tag</b></th>\r\n" + " <th><b>Tag Description</b></th>\r\n" + " <th><b>Spread Visualization Link</b></th>\r\n" + " </tr>\r\n" + "</thead>\r\n" + "<tbody>" + "</tbody>\n</table>\n</body>\n</html>"; assertEquals(conteudoQueDeveriaEstarNoHTML.trim(), conteudoNoHTML.trim()); } }
[ "Pedro Guerra@DESKTOP-JS20F6L" ]
Pedro Guerra@DESKTOP-JS20F6L
735b55bd226832c2f6e76a267913902bdb8d71b4
4d6f449339b36b8d4c25d8772212bf6cd339f087
/netreflected/src/Framework/System,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089/system/componentmodel/design/IComponentInitializer.java
86b58b291ec03708020c356644d03396f2e7be1d
[ "MIT" ]
permissive
lvyitian/JCOReflector
299a64550394db3e663567efc6e1996754f6946e
7e420dca504090b817c2fe208e4649804df1c3e1
refs/heads/master
2022-12-07T21:13:06.208025
2020-08-28T09:49:29
2020-08-28T09:49:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,848
java
/* * MIT License * * Copyright (c) 2020 MASES s.r.l. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ /************************************************************************************** * <auto-generated> * This code was generated from a template using JCOReflector * * Manual changes to this file may cause unexpected behavior in your application. * Manual changes to this file will be overwritten if the code is regenerated. * </auto-generated> *************************************************************************************/ package system.componentmodel.design; import org.mases.jcobridge.*; import org.mases.jcobridge.netreflection.*; // Import section import system.collections.IDictionary; import system.collections.IDictionaryImplementation; /** * The base .NET class managing System.ComponentModel.Design.IComponentInitializer, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089. Implements {@link IJCOBridgeReflected}. * <p> * * See: <a href="https://docs.microsoft.com/en-us/dotnet/api/System.ComponentModel.Design.IComponentInitializer" target="_top">https://docs.microsoft.com/en-us/dotnet/api/System.ComponentModel.Design.IComponentInitializer</a> */ public interface IComponentInitializer extends IJCOBridgeReflected { /** * Fully assembly qualified name: System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 */ public static final String assemblyFullName = "System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"; /** * Assembly name: System */ public static final String assemblyShortName = "System"; /** * Qualified class name: System.ComponentModel.Design.IComponentInitializer */ public static final String className = "System.ComponentModel.Design.IComponentInitializer"; /** * Try to cast the {@link IJCOBridgeReflected} instance into {@link IComponentInitializer}, a cast assert is made to check if types are compatible. */ public static IComponentInitializer ToIComponentInitializer(IJCOBridgeReflected from) throws Throwable { JCOBridge bridge = JCOBridgeInstance.getInstance("System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"); JCType classType = bridge.GetType(className + ", " + (JCOBridgeInstance.getUseFullAssemblyName() ? assemblyFullName : assemblyShortName)); NetType.AssertCast(classType, from); return new IComponentInitializerImplementation(from.getJCOInstance()); } /** * Returns the reflected Assembly name * * @return A {@link String} representing the Fullname of reflected Assembly */ public String getJCOAssemblyName(); /** * Returns the reflected Class name * * @return A {@link String} representing the Fullname of reflected Class */ public String getJCOClassName(); /** * Returns the reflected Class name used to build the object * * @return A {@link String} representing the name used to allocated the object * in CLR context */ public String getJCOObjectName(); /** * Returns the instantiated class * * @return An {@link Object} representing the instance of the instantiated Class */ public Object getJCOInstance(); /** * Returns the instantiated class Type * * @return A {@link JCType} representing the Type of the instantiated Class */ public JCType getJCOType(); // Methods section public void InitializeExistingComponent(IDictionary defaultValues) throws Throwable; public void InitializeNewComponent(IDictionary defaultValues) throws Throwable; // Properties section // Instance Events section }
[ "mario.mastrodicasa@masesgroup.com" ]
mario.mastrodicasa@masesgroup.com
216938d43bfa908c8732a049d2153ebbf1938084
a389fac72faa6f9ba4f8aa9f70d9e6a4cb7bb462
/Chapter 09/Ch09/src/main/java/org/packt/bus/portal/dao/impl/package-info.java
67f79ec7937481b7b36760a6b43c91c86fea6269
[ "MIT" ]
permissive
PacktPublishing/Spring-MVC-Blueprints
a0e481dd7a8977a64fa4aa0876ab48b5c78139d0
14fe9a0889c75f31014f2ebdb2184f40cd7e1da0
refs/heads/master
2023-03-13T01:47:20.470661
2023-01-30T09:03:09
2023-01-30T09:03:09
65,816,732
27
42
MIT
2023-02-22T03:32:27
2016-08-16T12:04:50
Java
UTF-8
Java
false
false
81
java
/** * */ /** * @author sjctrags * */ package org.packt.bus.portal.dao.impl;
[ "vishalm@packtpub.com" ]
vishalm@packtpub.com
8560c77e8979ad968850f3013af0cbb5e494d7d5
7639205ceb0ac2c74c197ee50537c1e95c0a5691
/services/hrdb/src/com/auto_ehappyivjy/hrdb/Employee.java
52ed469f2b6e00da5243209f35f20f42c595cddc
[]
no_license
wavemakerapps/Auto_eHAppyivJy
6ac8ec8fcb5d92c546fd5f6b1b91b6b5464903c0
2ce6938d7452ac5be4d4de226cafb7663e14ac25
refs/heads/master
2020-03-08T16:40:02.634397
2018-04-05T18:22:32
2018-04-05T18:22:32
128,245,819
0
0
null
null
null
null
UTF-8
Java
false
false
8,503
java
/*Copyright (c) 2015-2016 wavemaker.com All Rights Reserved. This software is the confidential and proprietary information of wavemaker.com You shall not disclose such Confidential Information and shall use it only in accordance with the terms of the source code license agreement you entered into with wavemaker.com*/ package com.auto_ehappyivjy.hrdb; /*This is a Studio Managed File. DO NOT EDIT THIS FILE. Your changes may be reverted by Studio.*/ import java.io.Serializable; import java.sql.Date; import java.util.List; import java.util.Objects; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.ForeignKey; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.OneToMany; import javax.persistence.PostPersist; import javax.persistence.Table; import org.hibernate.annotations.Cascade; import org.hibernate.annotations.CascadeType; import org.hibernate.annotations.Fetch; import org.hibernate.annotations.FetchMode; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; /** * Employee generated by WaveMaker Studio. */ @Entity @Table(name = "`EMPLOYEE`") public class Employee implements Serializable { private Integer empId; private String firstname; private String lastname; private String street; private String city; private String state; private String zip; private Date birthdate; private String picurl; private String jobTitle; private Integer deptId; private String username; private String password; private String role; private Integer managerId; private Integer tenantId; private Department department; private Employee employeeByManagerId; private List<Vacation> vacations; private List<Employee> employeesForManagerId; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "`EMP_ID`", nullable = false, scale = 0, precision = 10) public Integer getEmpId() { return this.empId; } public void setEmpId(Integer empId) { this.empId = empId; } @Column(name = "`FIRSTNAME`", nullable = true, length = 255) public String getFirstname() { return this.firstname; } public void setFirstname(String firstname) { this.firstname = firstname; } @Column(name = "`LASTNAME`", nullable = true, length = 255) public String getLastname() { return this.lastname; } public void setLastname(String lastname) { this.lastname = lastname; } @Column(name = "`STREET`", nullable = true, length = 255) public String getStreet() { return this.street; } public void setStreet(String street) { this.street = street; } @Column(name = "`CITY`", nullable = true, length = 255) public String getCity() { return this.city; } public void setCity(String city) { this.city = city; } @Column(name = "`STATE`", nullable = true, length = 2) public String getState() { return this.state; } public void setState(String state) { this.state = state; } @Column(name = "`ZIP`", nullable = true, length = 255) public String getZip() { return this.zip; } public void setZip(String zip) { this.zip = zip; } @Column(name = "`BIRTHDATE`", nullable = true) public Date getBirthdate() { return this.birthdate; } public void setBirthdate(Date birthdate) { this.birthdate = birthdate; } @Column(name = "`PICURL`", nullable = true, length = 255) public String getPicurl() { return this.picurl; } public void setPicurl(String picurl) { this.picurl = picurl; } @Column(name = "`JOB_TITLE`", nullable = true, length = 40) public String getJobTitle() { return this.jobTitle; } public void setJobTitle(String jobTitle) { this.jobTitle = jobTitle; } @Column(name = "`DEPT_ID`", nullable = true, scale = 0, precision = 10) public Integer getDeptId() { return this.deptId; } public void setDeptId(Integer deptId) { this.deptId = deptId; } @Column(name = "`USERNAME`", nullable = true, length = 255) public String getUsername() { return this.username; } public void setUsername(String username) { this.username = username; } @Column(name = "`PASSWORD`", nullable = true, length = 255) public String getPassword() { return this.password; } public void setPassword(String password) { this.password = password; } @Column(name = "`ROLE`", nullable = true, length = 255) public String getRole() { return this.role; } public void setRole(String role) { this.role = role; } @Column(name = "`MANAGER_ID`", nullable = true, scale = 0, precision = 10) public Integer getManagerId() { return this.managerId; } public void setManagerId(Integer managerId) { this.managerId = managerId; } @Column(name = "`TENANT_ID`", nullable = true, scale = 0, precision = 10) public Integer getTenantId() { return this.tenantId; } public void setTenantId(Integer tenantId) { this.tenantId = tenantId; } @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "`DEPT_ID`", referencedColumnName = "`DEPT_ID`", insertable = false, updatable = false, foreignKey = @ForeignKey(name = "`DEPTFKEY`")) @Fetch(FetchMode.JOIN) public Department getDepartment() { return this.department; } public void setDepartment(Department department) { if(department != null) { this.deptId = department.getDeptId(); } this.department = department; } // ignoring self relation properties to avoid circular loops & unwanted fields from the related entity. @JsonIgnoreProperties({"employeeByManagerId", "employeesForManagerId"}) @ManyToOne(fetch = FetchType.EAGER) @JoinColumn(name = "`MANAGER_ID`", referencedColumnName = "`EMP_ID`", insertable = false, updatable = false, foreignKey = @ForeignKey(name = "`MGRFKEY`")) @Fetch(FetchMode.JOIN) public Employee getEmployeeByManagerId() { return this.employeeByManagerId; } public void setEmployeeByManagerId(Employee employeeByManagerId) { if(employeeByManagerId != null) { this.managerId = employeeByManagerId.getEmpId(); } this.employeeByManagerId = employeeByManagerId; } @JsonInclude(Include.NON_EMPTY) @OneToMany(fetch = FetchType.LAZY, mappedBy = "employee") @Cascade({CascadeType.SAVE_UPDATE}) public List<Vacation> getVacations() { return this.vacations; } public void setVacations(List<Vacation> vacations) { this.vacations = vacations; } // ignoring self relation properties to avoid circular loops & unwanted fields from the related entity. @JsonIgnoreProperties({"employeeByManagerId", "employeesForManagerId"}) @JsonInclude(Include.NON_EMPTY) @OneToMany(fetch = FetchType.LAZY, mappedBy = "employeeByManagerId") @Cascade({CascadeType.SAVE_UPDATE}) public List<Employee> getEmployeesForManagerId() { return this.employeesForManagerId; } public void setEmployeesForManagerId(List<Employee> employeesForManagerId) { this.employeesForManagerId = employeesForManagerId; } @PostPersist public void onPostPersist() { if(vacations != null) { for(Vacation vacation : vacations) { vacation.setEmployee(this); } } if(employeesForManagerId != null) { for(Employee employee : employeesForManagerId) { employee.setEmployeeByManagerId(this); } } } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Employee)) return false; final Employee employee = (Employee) o; return Objects.equals(getEmpId(), employee.getEmpId()); } @Override public int hashCode() { return Objects.hash(getEmpId()); } }
[ "automate1@wavemaker.com" ]
automate1@wavemaker.com
a5e7b2f594c6a3684c20943e15f8d897e68aa5a6
9ab13ab6fa59807f6d77636f980ef61e6d640acd
/beerservice/src/test/java/huertix/springbeer/beerservice/BeerserviceApplicationTests.java
4bc2687b3cf8a17442b530804025c42a2d69096e
[]
no_license
Huertix/SpringBeer
f343217074ab28d15216129d87386b9f9c9f22c2
9b9e95508caec703a6caa2a056d647317ae85f53
refs/heads/master
2023-01-22T07:42:54.144780
2020-12-04T09:44:39
2020-12-04T09:44:39
318,470,201
0
0
null
null
null
null
UTF-8
Java
false
false
227
java
package huertix.springbeer.beerservice; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class BeerserviceApplicationTests { @Test void contextLoads() { } }
[ "dhuerta23@gmail.com" ]
dhuerta23@gmail.com
fef4f56fb2ae8e00cdabb6cec1774ae50c675e53
bf194b39219b46b8fe19992ab18d634f84a35d2a
/Estruturais/Bridge/src/br/com/lca/bridge/Main.java
478876bee78f120246b9274edc62349147f24b7a
[]
no_license
lucasabbatepaolo/Padroes-de-Projetos
f14b0d893384c8c013e30aa7c88deb79d70f03dc
518c79b3d2f6ec50aa8c7dad1dedb6d14c306bc1
refs/heads/master
2022-07-28T01:15:19.277765
2020-05-23T22:04:42
2020-05-23T22:04:42
266,424,443
0
0
null
null
null
null
UTF-8
Java
false
false
233
java
package br.com.lca.bridge; public class Main { public static void main(String[] args) { Implementacao implPos = new ImpementacaoProfessorPos(); Professor p = new ProfessorPos(implPos); p.info(); } }
[ "lucasabbatepaolo@gmail.com" ]
lucasabbatepaolo@gmail.com
62e5312580d5abf087e7a7eaac8de263c916c3f9
634e370efa78f4dc86efac49a941c415cf2ba602
/subscriber/src/main/java/com/swh/zookeeper/ManagerServer.java
a167a648e7a8a57548261d767e3e25b1e60d4e92
[]
no_license
swhzy/zookeeper
d2438d58bc148df68f2279f867bde51912db6a77
fc9e3dc04d9fefb7fc39a13a701b280bce4e62bc
refs/heads/master
2020-03-27T04:39:26.218858
2018-09-09T06:47:24
2018-09-09T06:47:24
145,958,622
0
0
null
null
null
null
UTF-8
Java
false
false
3,727
java
package com.swh.zookeeper; import com.alibaba.fastjson.JSON; import org.I0Itec.zkclient.IZkChildListener; import org.I0Itec.zkclient.IZkDataListener; import org.I0Itec.zkclient.ZkClient; import org.I0Itec.zkclient.exception.ZkNoNodeException; import org.I0Itec.zkclient.exception.ZkNodeExistsException; import java.util.List; public class ManagerServer { private String serversPath; private String commandPath; private String configPath; private ZkClient zkClient; private ServerConfig serverConfig; //用于监听server下子节点的变化 private IZkChildListener zkChildListener; //用于监听zookeeper中command节点的数据变化 private IZkDataListener dataListener; // 工作服务器的列表 private List<String> workServerList; public ManagerServer(String serversPath, String commandPath, String configPath, ZkClient zkClient, ServerConfig serverConfig) { this.serversPath = serversPath; this.commandPath = commandPath; this.configPath = configPath; this.zkClient = zkClient; this.serverConfig = serverConfig; //监听zookeeper中server下的子节点信息 this.zkChildListener = new IZkChildListener() { @Override public void handleChildChange(String s, List<String> list) throws Exception { workServerList = list; } }; //监控zookeeper中command节点中的变化 this.dataListener = new IZkDataListener() { @Override public void handleDataChange(String s, Object o) throws Exception { String com = new String((byte[]) o); System.out.println(com); exeCommand(com); } @Override public void handleDataDeleted(String s) throws Exception { } }; } public void start(){ initRunning(); } public void stop(){ zkClient.unsubscribeChildChanges(serversPath,zkChildListener); zkClient.unsubscribeDataChanges(commandPath,dataListener); } private void initRunning() { //执行订阅command节点数据变化和servers节点列表的变化 zkClient.subscribeDataChanges(commandPath,dataListener); zkClient.subscribeChildChanges(serversPath,zkChildListener); } private void exeCommand(String com) { if("list".equals(com)){ exeList(); }else if ("create".equals(com)){ exeCreate(); }else if("modify".equals(com)){ exeModify(); }else { System.out.println("error commamd!"+com); } } private void exeModify() { serverConfig.setDbUser(serverConfig.getDbUser() + "_modify"); try { zkClient.writeData(configPath, JSON.toJSONString(serverConfig).getBytes()); } catch (ZkNoNodeException e) { exeCreate(); } } private void exeCreate() { if(!zkClient.exists(configPath)){ try { zkClient.createPersistent(configPath, JSON.toJSONString(serverConfig).getBytes()); }catch (ZkNodeExistsException e){ // 节点已经存在,直接写入数据 zkClient.writeData(configPath,JSON.toJSONString(serverConfig).getBytes()); }catch (ZkNoNodeException e){ // 父节点不存在 String parentDir = configPath.substring(0, configPath.lastIndexOf('/')); zkClient.createPersistent(parentDir,true); exeCreate(); } } } private void exeList() { System.out.println(workServerList.toString()); } }
[ "951271345@qq.com" ]
951271345@qq.com
f60e6d183812f189f9754d76b2a51d49a012b2ff
4881a86d7faaa5334aeac41fc6e96d216b214ae1
/src/main/java/boundary/BoundaryVisualizzaOrdine.java
4484b834d6a95856bc57da868f637fc0e29af4b5
[]
no_license
Evoi95/ISPW_BSO_Project
f0ed783c29dc00eea0ea3443829a47330b4ba64a
b29241b06118b9b26a220a7017430b7e449ae852
refs/heads/master
2023-04-02T01:56:58.146692
2021-04-14T20:27:56
2021-04-14T20:27:56
357,627,865
0
0
null
null
null
null
UTF-8
Java
false
false
3,735
java
package boundary; import java.io.IOException; import java.net.URL; import java.sql.SQLException; import java.util.ResourceBundle; import controller.ControllerVisualizzaOrdine; import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleStringProperty; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.TableColumn; import javafx.scene.control.TableView; import javafx.scene.control.cell.PropertyValueFactory; import javafx.scene.layout.Pane; import javafx.stage.Stage; import entity.Pagamento; public class BoundaryVisualizzaOrdine implements Initializable { @FXML private Pane panel; @FXML private Label header; @FXML private TableView<Pagamento> table; @FXML private TableColumn<Pagamento, SimpleIntegerProperty> id = new TableColumn<>("Id Operazione"); @FXML private TableColumn<Pagamento, SimpleStringProperty> metodo = new TableColumn<>("Metodo Acquisto"); @FXML private TableColumn<Pagamento, SimpleIntegerProperty> esito = new TableColumn<>("Esito"); @FXML private TableColumn<Pagamento, SimpleStringProperty> nome = new TableColumn<>("Nome Utente"); @FXML private TableColumn<Pagamento, SimpleStringProperty> spesa = new TableColumn<>("Spesa Totale "); @FXML private TableColumn<Pagamento, SimpleStringProperty> acquisto = new TableColumn<>("Tipo Acquisto "); @FXML private TableColumn<Pagamento, SimpleIntegerProperty> id_prod = new TableColumn<>("Id Prodotto "); @FXML private Button buttonI; @FXML private Button buttonHP; @FXML private Button buttonG; private ControllerVisualizzaOrdine cVO; @FXML private void riepilogo() throws SQLException { cVO.getDati(); } @Override public void initialize(URL location, ResourceBundle resources) { id.setCellValueFactory(new PropertyValueFactory<>("id")); metodo.setCellValueFactory(new PropertyValueFactory<>("metodo")); esito.setCellValueFactory(new PropertyValueFactory<>("esito")); //da pagamento nome.setCellValueFactory(new PropertyValueFactory<>("nomeUtente")); //pag spesa.setCellValueFactory(new PropertyValueFactory<>("ammontare")); acquisto.setCellValueFactory(new PropertyValueFactory<>("tipo")); id_prod.setCellValueFactory(new PropertyValueFactory<>("idOg")); //prezzo.setCellValueFactory(new PropertyValueFactory<>("prezzo")); } public BoundaryVisualizzaOrdine() { cVO=new ControllerVisualizzaOrdine(); } @FXML private void acquisti() throws SQLException { table.setItems(cVO.getDati()); } @FXML private void indietro() throws IOException { Stage stage; Parent root; stage = (Stage) buttonI.getScene().getWindow(); root = FXMLLoader.load(getClass().getResource("visualizzaProfilo.fxml")); stage.setTitle("Benvenuto nella schermata del riepilogo dei giornali"); // Parent root = FXMLLoader.load(getClass().getResource("compravendita.fxml")); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); } @FXML private void home() throws IOException { Stage stage; Parent root; stage = (Stage) buttonHP.getScene().getWindow(); root = FXMLLoader.load(getClass().getResource("homePageAfterLogin.fxml")); stage.setTitle("Benvenuto nella schermata del riepilogo dei giornali"); // Parent root = FXMLLoader.load(getClass().getResource("compravendita.fxml")); Scene scene = new Scene(root); stage.setScene(scene); stage.show(); } }
[ "ginoz@Lenovo-14-Gino.station" ]
ginoz@Lenovo-14-Gino.station
00403b54cf40026e768d355eaf694e8d32342809
99f07651e8fc0e03fecc4cf12e1efc9bea729774
/BookExchangeSystem/src/servlet/SearchServlet.java
ab1d3e8dc8144464dea6de4cf65ff2a2ab89dbd5
[]
no_license
JackLinYo/BookExchangeSystem
91aea4a8dea2a8bf3b47a9a23fdca33d563a7643
521b1a04d931701dba9d5b3e7af1e4cd3dbdfcec
refs/heads/master
2021-08-16T22:49:37.676058
2017-11-20T13:05:49
2017-11-20T13:05:49
111,371,533
0
0
null
null
null
null
UTF-8
Java
false
false
1,245
java
package servlet; 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 javax.servlet.http.HttpSession; import java.io.IOException; /** * Created by Steven 臧 on 24/03/2017. */ @WebServlet("/SearchServlet") public class SearchServlet extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { process(request, response); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { process(request, response); } protected void process(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { String search = req.getParameter("search"); HttpSession session=req.getSession(); session.setAttribute("search",search); RequestDispatcher dispatcher = this.getServletContext().getRequestDispatcher("/searchBooks.jsp"); dispatcher.forward(req, resp); } }
[ "akalinyoyo27@gmail.com" ]
akalinyoyo27@gmail.com
154b819ff183705afe2cb798677324164dd7250d
3ac5fe5aaf98149e4e4f6add52081ab01c07596b
/SpringBootTwoMap/src/main/java/com/picc/riskctrl/map/vo/response/Province.java
86abec37c6747838778139927dbf590fee3fca00
[]
no_license
18753377299/SpringBootTwoTest
7ce7cd6f577d70c6a950365dae070537b40e53b2
70306d47ccea8687fd36d80bac714d8d377f0e55
refs/heads/master
2023-05-03T03:30:31.976820
2021-05-13T11:37:51
2021-05-13T11:37:51
307,751,481
0
0
null
null
null
null
UTF-8
Java
false
false
1,257
java
package com.picc.riskctrl.map.vo.response; import java.io.Serializable; import java.util.ArrayList; import java.util.List; public class Province implements Serializable{ /** * 序列化 */ private static final long serialVersionUID = 1L; /*省级中心点经度X*/ private String provinceX; /*省级中心点纬度Y*/ private String provinceY; /*中心点级别*/ private String provinceFlag; /*省级名称*/ private String provinceName; /*省级对应市级的集合*/ List<City> cityList=new ArrayList<City>(); public String getProvinceX() { return provinceX; } public void setProvinceX(String provinceX) { this.provinceX = provinceX; } public String getProvinceY() { return provinceY; } public void setProvinceY(String provinceY) { this.provinceY = provinceY; } public String getProvinceFlag() { return provinceFlag; } public void setProvinceFlag(String provinceFlag) { this.provinceFlag = provinceFlag; } public List<City> getCityList() { return cityList; } public void setCityList(List<City> cityList) { this.cityList = cityList; } public String getProvinceName() { return provinceName; } public void setProvinceName(String provinceName) { this.provinceName = provinceName; } }
[ "1733856225@qq.com" ]
1733856225@qq.com
1fc94e1f6a5d6c32c7c2bd4bb55ef28cf5a8a95d
3245eaa2e90e417d144f282313f57c7fa7e85327
/Integracao/IntegracaoCipEJB/src/br/com/sicoob/sisbr/sicoobdda/integracaocip/xml/modelo/arquivos/ADDA121/GrupoADDA121RR3BaixaOperacComplexType.java
30da0bb7aeae33314a55f7383487e4bd427a832c
[]
no_license
pabllo007/DDA
01ca636fc56cb7200d6d87d4c9f69e9eb68486db
e900c03b37e03231e929a08ce66a7ac0ac269a49
refs/heads/master
2022-11-30T19:00:02.651730
2019-10-27T21:25:14
2019-10-27T21:25:14
217,918,454
0
0
null
2022-11-24T06:24:00
2019-10-27T21:23:22
Java
UTF-8
Java
false
false
11,344
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 // 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: 2016.11.01 at 10:44:26 AM BRST // package br.com.sicoob.sisbr.sicoobdda.integracaocip.xml.modelo.arquivos.ADDA121; import java.math.BigInteger; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import javax.xml.datatype.XMLGregorianCalendar; /** * <p> * Java class for Grupo_ADDA121RR3_BaixaOperacComplexType complex type. * * <p> * The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="Grupo_ADDA121RR3_BaixaOperacComplexType"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="NumIdentcBaixaOperac" type="{http://www.bcb.gov.br/ARQ/ADDA121.xsd}NumIdentcTit" minOccurs="0"/> * &lt;element name="NumRefAtlBaixaOperac" type="{http://www.bcb.gov.br/ARQ/ADDA121.xsd}NumRefCad" minOccurs="0"/> * &lt;element name="NumSeqAtlzBaixaOperac" type="{http://www.bcb.gov.br/ARQ/ADDA121.xsd}NumSeqAtlzCadDDA"/> * &lt;element name="NumRefCadTitBaixaOperac" type="{http://www.bcb.gov.br/ARQ/ADDA121.xsd}NumRefCad" minOccurs="0"/> * &lt;element name="NumRefAtlCadTitBaixaOperac" type="{http://www.bcb.gov.br/ARQ/ADDA121.xsd}NumRefCad" minOccurs="0"/> * &lt;element name="ISPBPartRecbdrBaixaOperac" type="{http://www.bcb.gov.br/ARQ/ADDA121.xsd}ISPB"/> * &lt;element name="CodPartRecbdrBaixaOperac" type="{http://www.bcb.gov.br/ARQ/ADDA121.xsd}CodIF" minOccurs="0"/> * &lt;element name="TpBaixaOperac" type="{http://www.bcb.gov.br/ARQ/ADDA121.xsd}TpBaixaOperac"/> * &lt;element name="SitBaixaOperac" type="{http://www.bcb.gov.br/ARQ/ADDA121.xsd}SitBaixaOperac"/> * &lt;element name="DtHrSitBaixaOperac" type="{http://www.bcb.gov.br/ARQ/ADDA121.xsd}DataHora"/> * &lt;element name="Grupo_ADDA121RR3_DettBaixaOperac" type="{http://www.bcb.gov.br/ARQ/ADDA121.xsd}Grupo_ADDA121RR3_DettBaixaOperacComplexType" maxOccurs="unbounded" minOccurs="0"/> * &lt;element name="Grupo_ADDA121RR3_CanceltBaixaOperac" type="{http://www.bcb.gov.br/ARQ/ADDA121.xsd}Grupo_ADDA121RR3_CanceltBaixaOperacComplexType" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Grupo_ADDA121RR3_BaixaOperacComplexType", propOrder = { "numIdentcBaixaOperac", "numRefAtlBaixaOperac", "numSeqAtlzBaixaOperac", "numRefCadTitBaixaOperac", "numRefAtlCadTitBaixaOperac", "ispbPartRecbdrBaixaOperac", "codPartRecbdrBaixaOperac", "tpBaixaOperac", "sitBaixaOperac", "dtHrSitBaixaOperac", "grupoADDA121RR3DettBaixaOperac", "grupoADDA121RR3CanceltBaixaOperac" }) public class GrupoADDA121RR3BaixaOperacComplexType { @XmlElement(name = "NumIdentcBaixaOperac") private BigInteger numIdentcBaixaOperac; @XmlElement(name = "NumRefAtlBaixaOperac") private BigInteger numRefAtlBaixaOperac; @XmlElement(name = "NumSeqAtlzBaixaOperac", required = true) private BigInteger numSeqAtlzBaixaOperac; @XmlElement(name = "NumRefCadTitBaixaOperac") private BigInteger numRefCadTitBaixaOperac; @XmlElement(name = "NumRefAtlCadTitBaixaOperac") private BigInteger numRefAtlCadTitBaixaOperac; @XmlElement(name = "ISPBPartRecbdrBaixaOperac", required = true) private String ispbPartRecbdrBaixaOperac; @XmlElement(name = "CodPartRecbdrBaixaOperac") private String codPartRecbdrBaixaOperac; @XmlElement(name = "TpBaixaOperac", required = true) private String tpBaixaOperac; @XmlElement(name = "SitBaixaOperac", required = true) private String sitBaixaOperac; @XmlElement(name = "DtHrSitBaixaOperac", required = true) private XMLGregorianCalendar dtHrSitBaixaOperac; @XmlElement(name = "Grupo_ADDA121RR3_DettBaixaOperac") private List<GrupoADDA121RR3DettBaixaOperacComplexType> grupoADDA121RR3DettBaixaOperac; @XmlElement(name = "Grupo_ADDA121RR3_CanceltBaixaOperac") private GrupoADDA121RR3CanceltBaixaOperacComplexType grupoADDA121RR3CanceltBaixaOperac; /** * Gets the value of the numIdentcBaixaOperac property. * * @return possible object is {@link BigInteger } * */ public BigInteger getNumIdentcBaixaOperac() { return numIdentcBaixaOperac; } /** * Sets the value of the numIdentcBaixaOperac property. * * @param value allowed object is {@link BigInteger } * */ public void setNumIdentcBaixaOperac(BigInteger value) { this.numIdentcBaixaOperac = value; } /** * Gets the value of the numRefAtlBaixaOperac property. * * @return possible object is {@link BigInteger } * */ public BigInteger getNumRefAtlBaixaOperac() { return numRefAtlBaixaOperac; } /** * Sets the value of the numRefAtlBaixaOperac property. * * @param value allowed object is {@link BigInteger } * */ public void setNumRefAtlBaixaOperac(BigInteger value) { this.numRefAtlBaixaOperac = value; } /** * Gets the value of the numSeqAtlzBaixaOperac property. * * @return possible object is {@link BigInteger } * */ public BigInteger getNumSeqAtlzBaixaOperac() { return numSeqAtlzBaixaOperac; } /** * Sets the value of the numSeqAtlzBaixaOperac property. * * @param value allowed object is {@link BigInteger } * */ public void setNumSeqAtlzBaixaOperac(BigInteger value) { this.numSeqAtlzBaixaOperac = value; } /** * Gets the value of the numRefCadTitBaixaOperac property. * * @return possible object is {@link BigInteger } * */ public BigInteger getNumRefCadTitBaixaOperac() { return numRefCadTitBaixaOperac; } /** * Sets the value of the numRefCadTitBaixaOperac property. * * @param value allowed object is {@link BigInteger } * */ public void setNumRefCadTitBaixaOperac(BigInteger value) { this.numRefCadTitBaixaOperac = value; } /** * Gets the value of the numRefAtlCadTitBaixaOperac property. * * @return possible object is {@link BigInteger } * */ public BigInteger getNumRefAtlCadTitBaixaOperac() { return numRefAtlCadTitBaixaOperac; } /** * Sets the value of the numRefAtlCadTitBaixaOperac property. * * @param value allowed object is {@link BigInteger } * */ public void setNumRefAtlCadTitBaixaOperac(BigInteger value) { this.numRefAtlCadTitBaixaOperac = value; } /** * Gets the value of the ispbPartRecbdrBaixaOperac property. * * @return possible object is {@link String } * */ public String getISPBPartRecbdrBaixaOperac() { return ispbPartRecbdrBaixaOperac; } /** * Sets the value of the ispbPartRecbdrBaixaOperac property. * * @param value allowed object is {@link String } * */ public void setISPBPartRecbdrBaixaOperac(String value) { this.ispbPartRecbdrBaixaOperac = value; } /** * Gets the value of the codPartRecbdrBaixaOperac property. * * @return possible object is {@link String } * */ public String getCodPartRecbdrBaixaOperac() { return codPartRecbdrBaixaOperac; } /** * Sets the value of the codPartRecbdrBaixaOperac property. * * @param value allowed object is {@link String } * */ public void setCodPartRecbdrBaixaOperac(String value) { this.codPartRecbdrBaixaOperac = value; } /** * Gets the value of the tpBaixaOperac property. * * @return possible object is {@link String } * */ public String getTpBaixaOperac() { return tpBaixaOperac; } /** * Sets the value of the tpBaixaOperac property. * * @param value allowed object is {@link String } * */ public void setTpBaixaOperac(String value) { this.tpBaixaOperac = value; } /** * Gets the value of the sitBaixaOperac property. * * @return possible object is {@link String } * */ public String getSitBaixaOperac() { return sitBaixaOperac; } /** * Sets the value of the sitBaixaOperac property. * * @param value allowed object is {@link String } * */ public void setSitBaixaOperac(String value) { this.sitBaixaOperac = value; } /** * Gets the value of the dtHrSitBaixaOperac property. * * @return possible object is {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getDtHrSitBaixaOperac() { return dtHrSitBaixaOperac; } /** * Sets the value of the dtHrSitBaixaOperac property. * * @param value allowed object is {@link XMLGregorianCalendar } * */ public void setDtHrSitBaixaOperac(XMLGregorianCalendar value) { this.dtHrSitBaixaOperac = value; } /** * Gets the value of the grupoADDA121RR3DettBaixaOperac 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 grupoADDA121RR3DettBaixaOperac property. * * <p> * For example, to add a new item, do as follows: * * <pre> * getGrupoADDA121RR3DettBaixaOperac().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list {@link GrupoADDA121RR3DettBaixaOperacComplexType } * * */ public List<GrupoADDA121RR3DettBaixaOperacComplexType> getGrupoADDA121RR3DettBaixaOperac() { if (grupoADDA121RR3DettBaixaOperac == null) { grupoADDA121RR3DettBaixaOperac = new ArrayList<GrupoADDA121RR3DettBaixaOperacComplexType>(); } return this.grupoADDA121RR3DettBaixaOperac; } /** * Gets the value of the grupoADDA121RR3CanceltBaixaOperac property. * * @return possible object is {@link GrupoADDA121RR3CanceltBaixaOperacComplexType } * */ public GrupoADDA121RR3CanceltBaixaOperacComplexType getGrupoADDA121RR3CanceltBaixaOperac() { return grupoADDA121RR3CanceltBaixaOperac; } /** * Sets the value of the grupoADDA121RR3CanceltBaixaOperac property. * * @param value allowed object is {@link GrupoADDA121RR3CanceltBaixaOperacComplexType } * */ public void setGrupoADDA121RR3CanceltBaixaOperac(GrupoADDA121RR3CanceltBaixaOperacComplexType value) { this.grupoADDA121RR3CanceltBaixaOperac = value; } }
[ "=" ]
=
f22647496ad30db1bdbe7ad9e96fda56e88e846d
78f7fd54a94c334ec56f27451688858662e1495e
/partyanalyst-service/trunk/src/main/java/com/itgrids/partyanalyst/model/NominatedPostApplication.java
06ad51ec21baebde12fd966fba0b8b40c07346df
[]
no_license
hymanath/PA
2e8f2ef9e1d3ed99df496761a7b72ec50d25e7ef
d166bf434601f0fbe45af02064c94954f6326fd7
refs/heads/master
2021-09-12T09:06:37.814523
2018-04-13T20:13:59
2018-04-13T20:13:59
129,496,146
1
0
null
null
null
null
UTF-8
Java
false
false
10,060
java
package com.itgrids.partyanalyst.model; import java.io.Serializable; import java.util.Date; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import org.hibernate.annotations.Cache; import org.hibernate.annotations.CacheConcurrencyStrategy; import org.hibernate.annotations.LazyToOne; import org.hibernate.annotations.LazyToOneOption; import org.hibernate.annotations.NotFoundAction; @Entity @Table(name="nominated_post_application") @Cache(usage = CacheConcurrencyStrategy.READ_WRITE) public class NominatedPostApplication extends BaseModel implements Serializable{ private Long nominatedPostApplicationId; private Long nominationPostCandidateId; private Long departmentId; private Long boardId; private Long positionId; private Long boardLevelId; private Long locationValue; private Long applicationStatusId; private String isDeleted; private Long insertedBy; private Date insertedTime; private Long updatedBy; private Date updatedTime; private Long addressId; private Long postTypeId; private Long nominatedPostMemberId; private UserAddress address; private NominationPostCandidate nominationPostCandidate; private Departments departments; private Board board; private Position position; private BoardLevel boardLevel; private ApplicationStatus applicationStatus; private PostType postType; private NominatedPostMember nominatedPostMember; private String isExpired; private String deletedRemarks; private Long cadreDeletedReasonId; private CadreDeleteReason cadreDeleteReason; @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "nominated_post_application_id", unique = true, nullable = false) public Long getNominatedPostApplicationId() { return nominatedPostApplicationId; } public void setNominatedPostApplicationId(Long nominatedPostApplicationId) { this.nominatedPostApplicationId = nominatedPostApplicationId; } @Column(name = "nomination_post_candidate_id") public Long getNominationPostCandidateId() { return nominationPostCandidateId; } public void setNominationPostCandidateId(Long nominationPostCandidateId) { this.nominationPostCandidateId = nominationPostCandidateId; } @Column(name = "department_id") public Long getDepartmentId() { return departmentId; } public void setDepartmentId(Long departmentId) { this.departmentId = departmentId; } @Column(name = "board_id") public Long getBoardId() { return boardId; } public void setBoardId(Long boardId) { this.boardId = boardId; } @Column(name = "position_id") public Long getPositionId() { return positionId; } public void setPositionId(Long positionId) { this.positionId = positionId; } @Column(name = "board_level_id") public Long getBoardLevelId() { return boardLevelId; } public void setBoardLevelId(Long boardLevelId) { this.boardLevelId = boardLevelId; } @Column(name = "location_value") public Long getLocationValue() { return locationValue; } public void setLocationValue(Long locationValue) { this.locationValue = locationValue; } @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY) @JoinColumn(name="nomination_post_candidate_id", insertable=false, updatable = false) @LazyToOne(LazyToOneOption.NO_PROXY) @org.hibernate.annotations.NotFound(action=NotFoundAction.IGNORE) public NominationPostCandidate getNominationPostCandidate() { return nominationPostCandidate; } public void setNominationPostCandidate( NominationPostCandidate nominationPostCandidate) { this.nominationPostCandidate = nominationPostCandidate; } @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY) @JoinColumn(name="department_id", insertable=false, updatable = false) @LazyToOne(LazyToOneOption.NO_PROXY) @org.hibernate.annotations.NotFound(action=NotFoundAction.IGNORE) public Departments getDepartments() { return departments; } public void setDepartments(Departments departments) { this.departments = departments; } @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY) @JoinColumn(name="board_id", insertable=false, updatable = false) @LazyToOne(LazyToOneOption.NO_PROXY) @org.hibernate.annotations.NotFound(action=NotFoundAction.IGNORE) public Board getBoard() { return board; } public void setBoard(Board board) { this.board = board; } @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY) @JoinColumn(name="position_id", insertable=false, updatable = false) @LazyToOne(LazyToOneOption.NO_PROXY) @org.hibernate.annotations.NotFound(action=NotFoundAction.IGNORE) public Position getPosition() { return position; } public void setPosition(Position position) { this.position = position; } @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY) @JoinColumn(name="board_level_id", insertable=false, updatable = false) @LazyToOne(LazyToOneOption.NO_PROXY) @org.hibernate.annotations.NotFound(action=NotFoundAction.IGNORE) public BoardLevel getBoardLevel() { return boardLevel; } public void setBoardLevel(BoardLevel boardLevel) { this.boardLevel = boardLevel; } @Column(name = "application_status_id") public Long getApplicationStatusId() { return applicationStatusId; } public void setApplicationStatusId(Long applicationStatusId) { this.applicationStatusId = applicationStatusId; } @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY) @JoinColumn(name="application_status_id", insertable=false, updatable = false) @LazyToOne(LazyToOneOption.NO_PROXY) @org.hibernate.annotations.NotFound(action=NotFoundAction.IGNORE) public ApplicationStatus getApplicationStatus() { return applicationStatus; } public void setApplicationStatus(ApplicationStatus applicationStatus) { this.applicationStatus = applicationStatus; } @Column(name = "is_deleted") public String getIsDeleted() { return isDeleted; } public void setIsDeleted(String isDeleted) { this.isDeleted = isDeleted; } @Column(name = "inserted_by") public Long getInsertedBy() { return insertedBy; } public void setInsertedBy(Long insertedBy) { this.insertedBy = insertedBy; } @Column(name = "inserted_time") public Date getInsertedTime() { return insertedTime; } public void setInsertedTime(Date insertedTime) { this.insertedTime = insertedTime; } @Column(name = "updated_by") public Long getUpdatedBy() { return updatedBy; } public void setUpdatedBy(Long updatedBy) { this.updatedBy = updatedBy; } @Column(name = "updated_time") public Date getUpdatedTime() { return updatedTime; } public void setUpdatedTime(Date updatedTime) { this.updatedTime = updatedTime; } @Column(name="address_id") public Long getAddressId() { return addressId; } public void setAddressId(Long addressId) { this.addressId = addressId; } @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY) @JoinColumn(name="address_id", insertable=false, updatable = false) @LazyToOne(LazyToOneOption.NO_PROXY) @org.hibernate.annotations.NotFound(action=NotFoundAction.IGNORE) public UserAddress getAddress() { return address; } public void setAddress(UserAddress address) { this.address = address; } @Column(name="post_type_id") public Long getPostTypeId() { return postTypeId; } public void setPostTypeId(Long postTypeId) { this.postTypeId = postTypeId; } @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY) @JoinColumn(name="post_type_id", insertable=false, updatable = false) @LazyToOne(LazyToOneOption.NO_PROXY) @org.hibernate.annotations.NotFound(action=NotFoundAction.IGNORE) public PostType getPostType() { return postType; } public void setPostType(PostType postType) { this.postType = postType; } @Column(name="nominated_post_member_id") public Long getNominatedPostMemberId() { return nominatedPostMemberId; } public void setNominatedPostMemberId(Long nominatedPostMemberId) { this.nominatedPostMemberId = nominatedPostMemberId; } @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY) @JoinColumn(name="nominated_post_member_id", insertable=false, updatable = false) @LazyToOne(LazyToOneOption.NO_PROXY) @org.hibernate.annotations.NotFound(action=NotFoundAction.IGNORE) public NominatedPostMember getNominatedPostMember() { return nominatedPostMember; } public void setNominatedPostMember(NominatedPostMember nominatedPostMember) { this.nominatedPostMember = nominatedPostMember; } @Column(name="is_expired") public String getIsExpired() { return isExpired; } public void setIsExpired(String isExpired) { this.isExpired = isExpired; } @Column(name="deleted_remarks") public String getDeletedRemarks() { return deletedRemarks; } public void setDeletedRemarks(String deletedRemarks) { this.deletedRemarks = deletedRemarks; } @Column(name="cadre_delete_reason_id") public Long getCadreDeletedReasonId() { return cadreDeletedReasonId; } public void setCadreDeletedReasonId(Long cadreDeletedReasonId) { this.cadreDeletedReasonId = cadreDeletedReasonId; } @ManyToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY) @JoinColumn(name="cadre_delete_reason_id", insertable=false, updatable = false) @LazyToOne(LazyToOneOption.NO_PROXY) @org.hibernate.annotations.NotFound(action=NotFoundAction.IGNORE) public CadreDeleteReason getCadreDeleteReason() { return cadreDeleteReason; } public void setCadreDeleteReason(CadreDeleteReason cadreDeleteReason) { this.cadreDeleteReason = cadreDeleteReason; } }
[ "itgrids@b17b186f-d863-de11-8533-00e0815b4126" ]
itgrids@b17b186f-d863-de11-8533-00e0815b4126
bc194b9c9a63b7b04741cda927e833ff4a501142
7103a97c87af125dd5ac1782a0f7aaa73bd95442
/src/edu/sabanciuniv/testsapp/ui/EditProfileServlet.java
20d15b98197707351b37354114072d532763618c
[]
no_license
handecalli/CodeWars
29a3c23ece8b0f739061c27f981fe1f277421537
d659387724d464e62c037d23de20999550ff7f17
refs/heads/master
2021-01-17T08:25:56.497211
2016-07-27T11:23:17
2016-07-27T11:23:17
60,698,771
0
0
null
2016-06-08T13:21:56
2016-06-08T13:11:24
null
UTF-8
Java
false
false
1,310
java
package edu.sabanciuniv.testsapp.ui; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; /** * Servlet implementation class EditProfileServlet */ @WebServlet("/EditProfileServlet") public class EditProfileServlet extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public EditProfileServlet() { 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 response.getWriter().append("Served at: ").append(request.getContextPath()); } /** * @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); } }
[ "Tugcan@10.50.119.26" ]
Tugcan@10.50.119.26
3fd575ba18e5442a0416d027583654488742b21d
98d313cf373073d65f14b4870032e16e7d5466f0
/gradle-open-labs/example/src/main/java/se/molybden/Class5750.java
19336da41fb4bb04a3ef98906506387cf3f555e8
[]
no_license
Molybden/gradle-in-practice
30ac1477cc248a90c50949791028bc1cb7104b28
d7dcdecbb6d13d5b8f0ff4488740b64c3bbed5f3
refs/heads/master
2021-06-26T16:45:54.018388
2016-03-06T20:19:43
2016-03-06T20:19:43
24,554,562
0
0
null
null
null
null
UTF-8
Java
false
false
109
java
public class Class5750{ public void callMe(){ System.out.println("called"); } }
[ "jocce.nilsson@gmail.com" ]
jocce.nilsson@gmail.com
610a0d70310ca64839b71074135c781f1ee809e5
c6407afa348a0d8165ecd70927342f79a4fd9194
/src/main/java/com/twilio/ee/cdi/doers/UsageReporter.java
c87644c751439153f9a23abd9fbd10887669c1c6
[]
no_license
twilio-java-ee/twilio-java-ee
822e23d0cc40baa948bb543a76b4f4d67fda6b96
6e27ae08cb1b3b2354f0a42f9109790ebba7c46e
refs/heads/master
2020-03-28T01:02:42.189415
2013-11-26T18:29:30
2013-11-26T18:29:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
589
java
package com.twilio.ee.cdi.doers; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.inject.Named; import com.twilio.ee.cdi.doers.simple.SimpleUsageReporter; import com.twilio.ee.inject.configuration.TwilioAccountSid; import com.twilio.ee.inject.configuration.TwilioAuthToken; @Named @RequestScoped public class UsageReporter extends SimpleUsageReporter { @Inject public UsageReporter(@TwilioAccountSid String accountSid, @TwilioAuthToken String authToken) { super(accountSid, authToken); } public UsageReporter() { } }
[ "fiorenzino@gmail.com" ]
fiorenzino@gmail.com
2989413fa3538423555aa582079e4caebc4a1488
15afbd5c44e0c252f6cd224556c930f10572a372
/app/src/main/java/com/example/testxposed/Constant.java
3ad544b9aedc18ef3ffdc651c82c6c9ce9b1dcbf
[]
no_license
marunrun/test-xposed
4eb9fdf3e2b03143d46ae223209dbc7de672c318
8fbca9b72ab931e52e2d020026133dd3fabb763a
refs/heads/master
2023-04-14T17:13:54.511472
2021-04-17T09:36:40
2021-04-17T09:36:40
312,557,552
0
0
null
null
null
null
UTF-8
Java
false
false
572
java
package com.example.testxposed; public interface Constant { interface ShowStart { String PACKAGE_NAME = "com.showstartfans.activity"; } interface Name { String TITLE = "mr-秀动下单助手"; String TAG = "showStart"; } interface Color { int BLUE = 0xFF393A3F; int TOOLBAR = 0xff303030; int TITLE = 0xff004198; int DESC = 0xff303030; } interface XFlag { int ENABLE_TIMER = 0x000002; int TIMER_HOUR = 0x000003; int TIMER_MINUTE = 0x000004; } }
[ "marunrun@163.com" ]
marunrun@163.com
f57fe4fe72767aa77701225cd86fcdc137ea7de5
8790de77157efefe903c3cc2120fbd5ffa487255
/app/src/main/java/com/demo/moviesdemobyankit/fragments/SearchMovieFragment.java
bc049f7fb27ce27ec7ca3744fd99398b715f74c5
[]
no_license
ankit1057/MoviesDBDemoByAnkit
ad69ee0284d2200cd2bf6d181b56c3ca523a084e
ef1256e8cb84143b24c6356ac1f7dc384261f5f2
refs/heads/master
2020-12-30T08:23:19.164667
2020-02-07T13:16:55
2020-02-07T13:16:55
238,927,202
0
0
null
null
null
null
UTF-8
Java
false
false
4,000
java
package com.demo.moviesdemobyankit.fragments; import android.app.ProgressDialog; import android.os.Bundle; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.Toast; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.demo.moviesdemobyankit.R; import com.demo.moviesdemobyankit.adapters.MoviesAdapter; import com.demo.moviesdemobyankit.utils.Constants; import com.demo.moviesdemobyankit.utils.Movies; import com.demo.moviesdemobyankit.utils.MoviesService; import com.demo.moviesdemobyankit.utils.Result; import com.demo.moviesdemobyankit.utils.RetrofitInstance; import java.util.ArrayList; import java.util.List; import retrofit2.Call; import retrofit2.Callback; import retrofit2.Response; /** * A simple {@link Fragment} subclass. */ public class SearchMovieFragment extends Fragment { private RecyclerView moviesRecycler; private MoviesAdapter moviesAdapter; List<Result> moviesList; EditText searchText; ProgressDialog progressdialog; public SearchMovieFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.fragment_search_movie, container, false); moviesRecycler = view.findViewById(R.id.moviesRecycler); searchText = view.findViewById(R.id.etSearchText); searchText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { } @Override public void onTextChanged(CharSequence s, int start, int before, int count) { } @Override public void afterTextChanged(Editable s) { if (String.valueOf(s).length() > 3) { progressdialog = new ProgressDialog(getContext()); progressdialog.setMessage("Please Wait...."); // progressdialog.show(); getSearchedMovie(String.valueOf(s)); } } }); moviesList = new ArrayList<>(); GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 2); moviesRecycler.setLayoutManager(gridLayoutManager); moviesAdapter = new MoviesAdapter(getContext(), moviesList); moviesRecycler.setAdapter(moviesAdapter); getSearchedMovie(String.valueOf(searchText.getText())); return view; } private void getSearchedMovie(String text) { MoviesService moviesService = RetrofitInstance.getService(); Call<Movies> call; call = moviesService.getSearchedMovie(Constants.API_KEY, text); call.enqueue(new Callback<Movies>() { @Override public void onResponse(Call<Movies> call, Response<Movies> response) { if (progressdialog != null) { // progressdialog.dismiss(); } if (response.isSuccessful()) { if (moviesList.size() > 0) { moviesList.clear(); } moviesList.addAll(response.body().getResults()); moviesAdapter.notifyDataSetChanged(); } else { Toast.makeText(getContext(), "Something went wrong " + response.message(), Toast.LENGTH_SHORT).show(); } } @Override public void onFailure(Call<Movies> call, Throwable t) { Toast.makeText(getContext(), "Exception " + t.getMessage(), Toast.LENGTH_SHORT).show(); } }); } }
[ "ankit@chotabeta.com" ]
ankit@chotabeta.com
3453308e04bd77fd903e31aaffbe4541d3d6b252
bd6cceac3d2d30f8ddb7231d532c5d98a755b97e
/edu-backage/src/main/java/com/xgt/controller/video/VideoMaterialController.java
2179fe497887301cd7fbbf54d994a27154d0dabe
[]
no_license
cjy513203427/Sicherheit_Ausbildung
62e7b0680c067e1785bc593a40490df9a2ee0ab4
5bcddd245bd01930ac10e9e6685e1f7dda70d181
refs/heads/master
2020-03-24T03:15:09.340814
2018-07-26T08:34:20
2018-07-26T08:34:20
142,411,127
0
0
null
null
null
null
UTF-8
Java
false
false
12,731
java
package com.xgt.controller.video; import com.xgt.common.BaseController; import com.xgt.common.PageQueryEntity; import com.xgt.constant.SystemConstant; import com.xgt.entity.video.ChapterContent; import com.xgt.entity.video.Video; import com.xgt.entity.video.VideoComment; import com.xgt.service.video.VideoMaterialService; import com.xgt.util.DeleteFileUtil; import com.xgt.util.FileToolUtil; import com.xgt.util.ResultUtil; import com.xgt.util.VideoEncodeUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; 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.ResponseBody; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.util.List; import java.util.Map; import static com.xgt.constant.SystemConstant.COMMA; /** * @author Joanne * @Description 视频材料管理(视频集锦) * @create 2018-06-01 16:05 **/ @Controller @RequestMapping("/video") public class VideoMaterialController extends BaseController{ private static final Logger logger = LoggerFactory.getLogger(VideoMaterialController.class); @Autowired private VideoMaterialService videoMaterialService ; /** * @Description pc-查询视频 * @author Joanne * @create 2018/6/1 17:11 */ @RequestMapping(value = "/videoInfo", produces = "application/json; charset=utf-8") @ResponseBody public Map<String,Object> videoInfo(Video video){ try{ Map<String,Object> videoInfo = videoMaterialService.videoInfo(video); return ResultUtil.createSuccessResult(videoInfo); }catch(Exception e){ logger.error("videotree..........异常 ", e); return ResultUtil.createFailResult("videotree..........异常"); } } /** * @Description pc-视频信息添加 * @author Joanne * @create 2018/6/1 17:13 */ @RequestMapping(value = "/addVideoInfo") @ResponseBody public Map<String,Object> addVideoInfo(Video video){ try{ video.setCreateUserId(getLoginUserId()); videoMaterialService.addVideoInfo(video); return ResultUtil.createSuccessResult(); }catch(Exception e){ logger.error("添加视频信息异常", e); return ResultUtil.createFailResult("添加视频..........异常"); } } /** * @Description pc -修改视频集锦 * @author Joanne * @create 2018/6/2 15:32 */ @RequestMapping(value = "/updateVideoInfo") @ResponseBody public Map<String,Object> updateVideoInfo(Video video,MultipartFile file){ try{ videoMaterialService.updateVideoInfo(video); return ResultUtil.createSuccessResult(); }catch(Exception e){ logger.error("修改视频信息异常", e); return ResultUtil.createFailResult("修改视频..........异常"+e); } } /** * @Description 删除视频集锦,并删除所有章节及视频 * @author Joanne * @create 2018/6/15 10:51 */ @RequestMapping(value = "deleteVideoCollection" ,produces = "application/json; charset=utf-8") @ResponseBody public Map<String,Object> deleteVideoCollection(String ids){ try { videoMaterialService.deleteVideoCollection(ids); return ResultUtil.createSuccessResult(); }catch (Exception e){ logger.error("删除章节异常......",e); return ResultUtil.createFailResult("wrong"+e) ; } } /** * @Description 移动端 -获取视频集锦列表 搜寻条件为按时间(createTime默认)或按热度(点击次数clickNumber) * @author Joanne * @create 2018/6/7 14:51 */ @RequestMapping(value = "/videoCollectionInfo", produces = "application/json; charset=utf-8") @ResponseBody public Map<String,Object> videoCollectionInfo(Video video){ try{ video.setPostType(getLoginLabourer().getPostType()); // video.setPostType("1"); List<Video> videoInfo = videoMaterialService.videoCollectionInfo(video); return ResultUtil.createSuccessResult(videoInfo); }catch(Exception e){ logger.error("videotree..........异常 ", e); return ResultUtil.createFailResult("videotree..........异常"); } } /** * @Description 移动端 -根据集锦ID获取集锦的全部信息(包括视频,章节,简介等) * @author Joanne * @create 2018/6/7 15:10 */ @RequestMapping(value = "/queryDetialByCollectionId", produces = "application/json; charset=utf-8") @ResponseBody public Map<String,Object> queryDetialByCollectionId(Integer collectionId){ try{ Video videoInfo = videoMaterialService.queryDetialByCollectionId(collectionId,getLabourerUserId()); // Video videoInfo = videoMaterialService.queryDetialByCollectionId(collectionId,9); return ResultUtil.createSuccessResult(videoInfo); }catch(Exception e){ logger.error("videotree..........异常 ", e); return ResultUtil.createFailResult("videotree..........异常"); } } /** * @Description 培训系统PC版 获取课程树及节点名称 * @author Joanne * @create 2018/6/26 14:15 */ @RequestMapping(value = "/queryAllCourses", produces = "application/json; charset=utf-8") @ResponseBody public Map<String,Object> queryAllCourses(){ try{ List<Video> allCourses = videoMaterialService.queryAllCourses(); return ResultUtil.createSuccessResult(allCourses); }catch(Exception e){ logger.error("获取课程失败", e); return ResultUtil.createFailResult("coursetree..........异常"); } } /** * @Description 培训系统PC版 - 查询视频集锦 * @author Joanne * @create 2018/7/18 16:45 */ @RequestMapping(value = "/queryCatelog", produces = "application/json; charset=utf-8") @ResponseBody public Map<String,Object> queryCatelog(){ try{ List<Video> catalogs = videoMaterialService.queryCatelog(); return ResultUtil.createSuccessResult(catalogs); }catch(Exception e){ logger.error("获取课程失败", e); return ResultUtil.createFailResult("coursetree..........异常"); } } /** * @Description * 培训系统PC端 - 查询课程树(树包含视频地址) * @author Joanne * @create 2018/7/16 15:44 */ @RequestMapping(value = "/queryCoursesWithVideo", produces = "application/json; charset=utf-8") @ResponseBody public Map<String,Object> queryCoursesWithVideo(Integer programId){ try{ Map map = videoMaterialService.queryCoursesWithVideo(programId); return ResultUtil.createSuccessResult(map); }catch(Exception e){ logger.error("获取课程失败", e); return ResultUtil.createFailResult("coursetree..........异常"+e); } } /** * @Description 移动端- 用户增加评论 * @author Joanne * @create 2018/6/7 20:33 */ @RequestMapping(value = "/addComments", produces = "application/json; charset=utf-8") @ResponseBody public Map<String,Object> addComments(VideoComment videoComment){ try{ videoComment.setCreateId(getLabourerUserId()); videoComment.setCreateUserName(getLoginLabourer().getRealname()); // videoComment.setCreateId(1); //插入评论获取评论id Integer id = videoMaterialService.addComments(videoComment); //根据评论id查询评论信息 videoComment = videoMaterialService.queryCommentsByCommentId(id); return ResultUtil.createSuccessResult(videoComment); }catch(Exception e){ logger.error("videotree..........异常 ", e); return ResultUtil.createFailResult("videotree..........异常"); } } /** * @Description 移动端 - 根据集锦id查询评论,需分页查询 * @author Joanne * @create 2018/6/7 19:36 */ @RequestMapping(value = "/queryCommentsByCollectionId", produces = "application/json; charset=utf-8") @ResponseBody public Map<String,Object> queryCommentsByCollectionId(VideoComment videoComment){ try{ List<VideoComment> videoCommentList = videoMaterialService.queryCommentsByCollectionId(videoComment); return ResultUtil.createSuccessResult(videoCommentList); }catch(Exception e){ logger.error("videotree..........异常 ", e); return ResultUtil.createFailResult("videotree..........异常"); } } /** * @Description 根据视频内容ID查询视频详细信息 * @author Joanne * @create 2018/7/11 15:44 */ @RequestMapping(value = "/queryContentByCourseIds", produces = "application/json; charset=utf-8", method = {RequestMethod.POST}) @ResponseBody public Map<String,Object> queryContentByCourseIds(HttpServletRequest req,PageQueryEntity pageQueryEntity){ try{ String[] array = req.getParameterValues("ids[]"); String ids = ""; for (String string : array) { ids += string+COMMA; } Map<String,Object> courseList = videoMaterialService.queryContentByCourseIds(ids.substring(0,ids.lastIndexOf(COMMA)),pageQueryEntity); return ResultUtil.createSuccessResult(courseList); }catch(Exception e){ logger.error("查询课程详情..........异常 ", e); return ResultUtil.createFailResult("查询课程详情..........异常"); } } // @RequestMapping(value = "/encryptVideo", produces = "application/json; charset=utf-8") // @ResponseBody // public Map<String,Object> encryptVideo(String fileName){ // try{ // videoMaterialService.encryptVideo(fileName); // return ResultUtil.createSuccessResult(); // }catch(Exception e){ // logger.error("encryptVideo..........异常,文件名是 "+fileName, e); // return ResultUtil.createFailResult("encryptVideo..........异常"); // } // } /** * 解密视频文件 * @author liuao * @date 2018/7/20 10:33 */ @RequestMapping(value = "/decryptVideo", produces = "application/json; charset=utf-8") @ResponseBody public Map<String,Object> decryptVideo(String fileName){ try{ videoMaterialService.decryptVideo(fileName); return ResultUtil.createSuccessResult(); }catch(Exception e){ logger.error("decryptVideo..........异常,文件名是 "+fileName, e); return ResultUtil.createFailResult("decryptVideo..........异常"); } } /** * 播放加密MP4 * @param response * @throws IOException */ @RequestMapping("/playMp4") @ResponseBody public void playMp4(HttpServletResponse response,String fileName) throws Exception { // 解密过后的临时文件路径 String tempFilePath = SystemConstant.VIDEO_TEMP_PATH + fileName; FileInputStream inputStream = new FileInputStream(tempFilePath); byte[] data = FileToolUtil.inputStreamToByte(inputStream); String diskfilename = "final.mp4"; response.setContentType("video/mp4"); response.setHeader("Content-Disposition", "attachment; filename=\"" + diskfilename + "\"" ); System.out.println("data.length " + data.length); response.setContentLength(data.length); response.setHeader("Content-Range", "" + Integer.valueOf(data.length-1)); response.setHeader("Accept-Ranges", "bytes"); response.setHeader("Etag", "W/\"9767057-1323779115364\""); byte[] content = new byte[1024]; BufferedInputStream is = new BufferedInputStream(new ByteArrayInputStream(data)); OutputStream os = response.getOutputStream(); while (is.read(content) != -1) { os.write(content); } //先声明的流先关掉! os.close(); is.close(); inputStream.close(); DeleteFileUtil.delete(tempFilePath); } }
[ "634208959@qq.com" ]
634208959@qq.com
b0fd1972e7c1db7468bd336421af932d9d551474
f1069a4063b60d914afab29876d46963c3fac692
/spring-cloud/eureka/eureka_client/src/main/java/com/example/demo/EurekaClientApplication.java
ff43312031afcc4d8241b85ba6fe497986a30fda
[]
no_license
Hepc622/practice
10a405a7ab60b61bad87c59c517cae2bc9b3cd91
4cd146bbf6356ba5129a34836b2c9a3011dae2c3
refs/heads/master
2022-12-21T13:38:33.882072
2019-11-13T09:47:47
2019-11-13T09:47:47
135,300,383
0
1
null
2022-12-16T09:43:16
2018-05-29T13:29:14
Java
UTF-8
Java
false
false
954
java
package com.example.demo; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.EnableEurekaClient; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; @EnableEurekaClient @SpringBootApplication @RestController public class EurekaClientApplication { public static void main(String[] args) { SpringApplication.run(EurekaClientApplication.class, args); } @Value("${server.port}") String port; // @RequestMapping(value = "/hello",method = RequestMethod.GET) // public MemberUser say_hello(){ // MemberUser user = new MemberUser(); // user.setId("1"); // user.setName("hpc"); // user.setMsg(port.toString()); // return user; // } }
[ "874694517@qq.com" ]
874694517@qq.com
538711213354f9b8b94c04d93e0cba72cbc52d9d
e7c2a56226b6c7a267bf2dc8cd03faeacfb4ee69
/WebISproject-master/src/main/java/lms/repository/YearOfStudyRepository.java
0a5a01474710534104d16dfd6fa523a4d7584db4
[]
no_license
lukazec97/Student-service
72b2ee1d6227825ab45e3d487e8581fceab2107f
7c18342176f894605f9891a2fa5c8d30bc227e4e
refs/heads/master
2023-01-10T21:41:12.194187
2020-02-08T14:52:12
2020-02-08T14:52:12
239,148,924
0
0
null
2023-01-07T14:37:00
2020-02-08T14:50:28
Java
UTF-8
Java
false
false
324
java
package lms.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import lms.domain.YearOfStudy; @Repository public interface YearOfStudyRepository extends JpaRepository<YearOfStudy, Long>{ YearOfStudy findFirstByNumberOfYear(int numberOfYear); }
[ "luka.zec97@gmail.com" ]
luka.zec97@gmail.com
7e727c8376d081dba94740ad074a5283f49df71d
3e3eb2b64c1ee904d8e9305ff182fd39292ec730
/src/com/swarawan/doraemon/view/battle/BattleView.java
f1c1da7387ac0a743032d6a20040a73e2ff552f1
[]
no_license
swarawan/doraemon-battle
1f52ef0bc065947e132e4c5ce736c1097921ddf7
2dced0ff7bec98575fe7d943f126cc2ba9874126
refs/heads/master
2020-04-23T19:57:34.370486
2019-02-19T07:04:25
2019-02-19T07:04:25
171,422,995
0
0
null
null
null
null
UTF-8
Java
false
false
447
java
package com.swarawan.doraemon.view.battle; import com.swarawan.doraemon.common.Player; import com.swarawan.doraemon.model.Character; public interface BattleView { void setFirstPlay(Player player); void notEnoughMana(Player player); void enemyDead(Character attacker, Character enemy); void nextRound(Player nextPlayer); void infoAttack(Character character, int choosenSkill); void infoEnemy(Character character); }
[ "swarawan.rio@gmail.com" ]
swarawan.rio@gmail.com
fe341c3445cf78dde37956b63914af42123dc1f5
5167ad82d40d0dfebecda1d23cd8888db5ecc4eb
/src/test/java/jdbctests/dbutildemo.java
ffa7c87084d5ee2647429150bbef12d5e573d67d
[]
no_license
ismailkoembe/JDBC-and-API-works
8bbccae64fca830b48b477fdcff65d08d9606949
87e502f838a6f7dfdc94d89d25e35a29284309ca
refs/heads/master
2023-05-11T03:31:47.903118
2020-02-27T20:40:43
2020-02-27T20:40:43
243,612,231
0
1
null
2023-05-09T18:21:39
2020-02-27T20:39:27
Java
UTF-8
Java
false
false
1,054
java
package jdbctests; import org.testng.annotations.Test; import utilities.DBUtils; import java.util.List; import java.util.Map; public class dbutildemo { @Test public void test1(){ //create the connection to db DBUtils.createConnection(); //save the query result as a list of maps(just like we did together) List<Map<String, Object>> queryData = DBUtils.getQueryResultMap("Select * from departments"); //printing the result for (Map<String, Object> row : queryData) { System.out.println(row); } //close connection DBUtils.destroy(); } @Test public void test2(){ //create the connection to db DBUtils.createConnection(); String query = "Select * from employees where employee_id=101"; //save the query result as a list of maps(just like we did together) Map<String, Object> rowMap = DBUtils.getRowMap(query); System.out.println(rowMap); //close connection DBUtils.destroy(); } }
[ "ismailkombe@gmail.com" ]
ismailkombe@gmail.com
912a580b8acdafe370000a670b3c11fade91156d
0726327c12f5bd04b20b25e1db03c2110b9a9a3d
/src/main/java/com/trl/springsecurityldap/repository/entity/UserEntity.java
ed96a9e1941751397c07c602fbdaa3bfbf8fbd4b
[]
no_license
spring-framework-practices/spring-security-ldap
6b93c06c93cd917f3e6bd0e8dfcf871625297f99
9bf0b13a9b83110de7dea2ef979189ad99597bbd
refs/heads/master
2022-12-13T11:26:33.855381
2020-09-08T00:33:37
2020-09-08T00:33:37
293,488,619
0
0
null
null
null
null
UTF-8
Java
false
false
4,200
java
package com.trl.springsecurityldap.repository.entity; import com.trl.springsecurityldap.service.UserRole; import java.util.Objects; import java.util.Set; public class UserEntity { private Long id; private String firstName; private String lastName; private String userName; private String email; private String password; private Boolean accountNonExpired; private Boolean accountNonLocked; private Boolean credentialsNonExpired; private Boolean enabled; private Set<UserRole> authorities; public UserEntity() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public Boolean getAccountNonExpired() { return accountNonExpired; } public void setAccountNonExpired(Boolean accountNonExpired) { this.accountNonExpired = accountNonExpired; } public Boolean getAccountNonLocked() { return accountNonLocked; } public void setAccountNonLocked(Boolean accountNonLocked) { this.accountNonLocked = accountNonLocked; } public Boolean getCredentialsNonExpired() { return credentialsNonExpired; } public void setCredentialsNonExpired(Boolean credentialsNonExpired) { this.credentialsNonExpired = credentialsNonExpired; } public Boolean getEnabled() { return enabled; } public void setEnabled(Boolean enabled) { this.enabled = enabled; } public Set<UserRole> getAuthorities() { return authorities; } public void setAuthorities(Set<UserRole> authorities) { this.authorities = authorities; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; UserEntity that = (UserEntity) o; return Objects.equals(id, that.id) && Objects.equals(firstName, that.firstName) && Objects.equals(lastName, that.lastName) && Objects.equals(userName, that.userName) && Objects.equals(email, that.email) && Objects.equals(password, that.password) && Objects.equals(accountNonExpired, that.accountNonExpired) && Objects.equals(accountNonLocked, that.accountNonLocked) && Objects.equals(credentialsNonExpired, that.credentialsNonExpired) && Objects.equals(enabled, that.enabled) && Objects.equals(authorities, that.authorities); } @Override public int hashCode() { return Objects.hash(id, firstName, lastName, userName, email, password, accountNonExpired, accountNonLocked, credentialsNonExpired, enabled, authorities); } @Override public String toString() { return "UserEntity{" + "id=" + id + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", userName='" + userName + '\'' + ", email='" + email + '\'' + ", password='" + password + '\'' + ", accountNonExpired=" + accountNonExpired + ", accountNonLocked=" + accountNonLocked + ", credentialsNonExpired=" + credentialsNonExpired + ", enabled=" + enabled + ", authorities=" + authorities + '}'; } }
[ "tsyupryk.roman@gmail.com" ]
tsyupryk.roman@gmail.com
e62acd678bcf897ab7ed90b96f83316f7c854af6
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/33/33_b1bc67c98bb9decc0b7c41db724382e3413dce13/App/33_b1bc67c98bb9decc0b7c41db724382e3413dce13_App_s.java
237eeedbd94a538a6be1fe48beb83f84161d1be8
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
23,290
java
package gui; import middleend.*; import backbone.*; import java.awt.event.KeyEvent; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.awt.Component; import java.awt.Event; import java.awt.BorderLayout; import javax.swing.KeyStroke; import java.awt.Point; import java.util.ArrayList; import java.util.List; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JMenuItem; import javax.swing.JMenuBar; import javax.swing.JMenu; import javax.swing.JFrame; import javax.swing.JDialog; import javax.swing.JRadioButtonMenuItem; import javax.swing.JToolBar; import javax.swing.filechooser.FileNameExtensionFilter; import exception.InvalidRoundException; public class App implements GUIConstants { private MiddleEnd _middleEnd; private JFrame _jFrame; private JToolBar _toolbar; private JPanel _mainContentAndToolbarPane; private JComponent _mainContentPane; private InputPanel _inputPane; private ManagementPanel _managementPane; private JMenuBar _jJMenuBar; private JMenu _fileMenu; private JMenuItem _newTournamentMenuItem; private JMenuItem _openTournamentMenuItem; private JMenuItem _saveTournamentMenuItem; private JMenuItem _importCategoryMenuItem; private JMenuItem _exportCategoryMenuItem; private JMenuItem _exitMenuItem; private JMenu _optionsMenu; private JMenuItem _programOptionsMenuItem; private JDialog _programOptionsDialog; private JPanel _programOptionsContentPane; private JMenuItem _pluginOptionsMenuItem; private JDialog _pluginOptionsDialog; private JPanel _pluginOptionsContentPane; private JMenu _editMenu; private JMenu _viewMenu; private JRadioButtonMenuItem _viewInputMenuItem; private JRadioButtonMenuItem _viewManagementMenuItem; private JMenu _helpMenu; private JMenuItem _aboutMenuItem; private JDialog _aboutDialog; private JPanel _aboutContentPane; private JLabel _aboutVersionLabel; public App(MiddleEnd me) { _middleEnd = me; this.getJFrame().setVisible(true); } public MiddleEnd getMiddleEnd() { return _middleEnd; } /** * This method initializes jFrame * * @return javax.swing.JFrame */ public JFrame getJFrame() { if (_jFrame == null) { _jFrame = new JFrame(); _jFrame.setJMenuBar(getJJMenuBar()); _jFrame.setSize(DEFAULT_SIZE); _jFrame.setMinimumSize(MIN_SIZE); _jFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { _middleEnd.closeThisMiddleEnd(); } }); System.out.println(System.getProperty("user.dir")); if (IMAGESON) { if (FRAMEIMAGE != null) _jFrame.setIconImage(FRAMEIMAGE.getImage()); } getViewInputMenuItem().doClick(); _jFrame.setContentPane(getMainContentAndToolbarPane()); getViewInputMenuItem().setSelected(true); _jFrame.setTitle("TurtleTab v1.0"); } return _jFrame; } /** * This method initializes JToolBar * * @return JToolBar */ public JToolBar getToolbar() { if (_toolbar == null) { _toolbar = new JToolBar(); _toolbar.setSize(TOOLBAR_SIZE); _toolbar.setMinimumSize(TOOLBAR_SIZE); _toolbar.setMaximumSize(TOOLBAR_SIZE); for (int i = 0; i < getEditMenu().getMenuComponentCount(); i++) { Component comp = getEditMenu().getMenuComponent(i); if (comp instanceof JMenuItem) { _toolbar.add(createButtonFromMenuItem((JMenuItem) comp)); _toolbar.add(Box.createRigidArea(SMALLSPACING_SIZE)); } } } return _toolbar; } /** * Creates a JButton from a JMenuItem * * @param JMenuItem * @return JButton */ public JButton createButtonFromMenuItem(final JMenuItem item) { JButton button = new JButton(item.getText()); if (IMAGESON) button.setIcon(ADDBUTTONIMAGE); if (COLORSON) { button.setBackground(BACKGROUND_COLOR); button.setForeground(FOREGROUND_COLOR); } button.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { item.doClick(); } }); return button; } public JPanel getMainContentAndToolbarPane() { if (_mainContentAndToolbarPane == null) { _mainContentAndToolbarPane = new JPanel(); if (COLORSON) { _mainContentAndToolbarPane.setBackground(BACKGROUND_COLOR); _mainContentAndToolbarPane.setForeground(FOREGROUND_COLOR); } _mainContentAndToolbarPane.setLayout(new BorderLayout()); _mainContentAndToolbarPane.add(getToolbar(), BorderLayout.NORTH); _mainContentAndToolbarPane.add(getMainContentPane(), BorderLayout.CENTER); } return _mainContentAndToolbarPane; } public void setMainContentPane(JComponent pane) { getMainContentPane().removeAll(); getMainContentPane().add(pane, BorderLayout.CENTER); } public JComponent getMainContentPane() { if (_mainContentPane == null) { _mainContentPane = new JPanel(); if (COLORSON) { _mainContentPane.setBackground(BACKGROUND_COLOR); _mainContentPane.setForeground(FOREGROUND_COLOR); } _mainContentPane.setLayout(new BorderLayout()); _mainContentPane.add(getInputPanel(), BorderLayout.CENTER); } return _mainContentPane; } /** * This method initializes InputPanel * * @return InputPanel */ public InputPanel getInputPanel() { if (_inputPane == null) { _inputPane = new InputPanel(getMiddleEnd()); } return _inputPane; } /** * This method initializes ManagementPanel * * @return MangementPanel */ public ManagementPanel getManagementPanel() { if (_managementPane == null) { _managementPane = new ManagementPanel(getMiddleEnd()); } return _managementPane; } /** * This method initializes jJMenuBar * * @return javax.swing.JMenuBar */ public JMenuBar getJJMenuBar() { if (_jJMenuBar == null) { _jJMenuBar = new JMenuBar(); _jJMenuBar.add(getFileMenu()); _jJMenuBar.add(getOptionsMenu()); _jJMenuBar.add(getViewMenu()); _jJMenuBar.add(getEditMenu()); _jJMenuBar.add(getHelpMenu()); } return _jJMenuBar; } /** * This method initializes jMenu * * @return javax.swing.JMenu */ public JMenu getFileMenu() { if (_fileMenu == null) { _fileMenu = new JMenu(); _fileMenu.setText("File"); _fileMenu.add(getNewTournamentMenuItem()); _fileMenu.add(getOpenTournamentMenuItem()); _fileMenu.add(getSaveTournamentMenuItem()); _fileMenu.add(getImportCategoryMenuItem()); _fileMenu.add(getExportCategoryMenuItem()); _fileMenu.add(getExitMenuItem()); } return _fileMenu; } /** * This method initializes jMenuItem * * @return javax.swing.JMenuItem */ public JMenuItem getNewTournamentMenuItem() { if (_newTournamentMenuItem == null) { _newTournamentMenuItem = new JMenuItem(); _newTournamentMenuItem.setText("New Tournament..."); _newTournamentMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_T, Event.CTRL_MASK, true)); _newTournamentMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { _middleEnd.openNewMiddleEnd(); } }); } return _newTournamentMenuItem; } /** * This method initializes jMenuItem * * @return javax.swing.JMenuItem */ public JMenuItem getOpenTournamentMenuItem() { if (_openTournamentMenuItem == null) { _openTournamentMenuItem = new JMenuItem(); _openTournamentMenuItem.setText("Open Tournament..."); _openTournamentMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_O, Event.CTRL_MASK, true)); _openTournamentMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setFileFilter(new FileNameExtensionFilter("Tournament File (.tmnt)", TOURNAMENT_EXTENSION)); int returnval = chooser.showOpenDialog(getJFrame()); if (returnval == JFileChooser.APPROVE_OPTION) { if (!getMiddleEnd().openTournament(chooser.getSelectedFile())) { JOptionPane.showMessageDialog(_jFrame, "The selected file was not a valid tournament file.", "Error", JOptionPane.ERROR_MESSAGE); } else { _middleEnd.repaintAll(); } } } }); } return _openTournamentMenuItem; } /** * This method initializes jMenuItem * * @return javax.swing.JMenuItem */ public JMenuItem getSaveTournamentMenuItem() { if (_saveTournamentMenuItem == null) { _saveTournamentMenuItem = new JMenuItem(); _saveTournamentMenuItem.setText("Save Tournament..."); _saveTournamentMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_S, Event.CTRL_MASK, true)); _saveTournamentMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setFileFilter(new FileNameExtensionFilter("Tournament File (.tmnt)", TOURNAMENT_EXTENSION)); int returnval = chooser.showSaveDialog(getJFrame()); if (returnval == JFileChooser.APPROVE_OPTION) { if (!getMiddleEnd().saveTournament(chooser.getSelectedFile())) { JOptionPane.showMessageDialog(_jFrame, "The name specified for the file was invalid.", "Error", JOptionPane.ERROR_MESSAGE); } else { _middleEnd.repaintAll(); } } } }); } return _saveTournamentMenuItem; } /** * This method initializes jMenuItem * * @return javax.swing.JMenuItem */ public JMenuItem getImportCategoryMenuItem() { if (_importCategoryMenuItem == null) { _importCategoryMenuItem = new JMenuItem(); _importCategoryMenuItem.setText("Import Category..."); _importCategoryMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_I, Event.CTRL_MASK, true)); _importCategoryMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JFileChooser chooser = new JFileChooser(); chooser.setFileFilter(new FileNameExtensionFilter("CSV File (.csv)", CATEGORY_EXTENSION)); int returnval = chooser.showOpenDialog(getJFrame()); if (returnval == JFileChooser.APPROVE_OPTION) { if (!getMiddleEnd().importCategory(chooser.getSelectedFile())) { JOptionPane.showMessageDialog(_jFrame, "The name specified for the file was invalid.", "Error", JOptionPane.ERROR_MESSAGE); } else { _middleEnd.repaintAll(); } } } }); } return _importCategoryMenuItem; } /** * This method initializes jMenuItem * * @return javax.swing.JMenuItem */ public JMenuItem getExportCategoryMenuItem() { if (_exportCategoryMenuItem == null) { _exportCategoryMenuItem = new JMenuItem(); _exportCategoryMenuItem.setText("Export Category..."); _exportCategoryMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_E, Event.CTRL_MASK, true)); _exportCategoryMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { ArrayList<Grouping> categories = new ArrayList<Grouping>(_middleEnd.getTournament().getCategories()); ArrayList<String> catnames = new ArrayList<String>(); for (Grouping<Unit> category : categories) catnames.add(category.getName()); String str = (String) JOptionPane.showInputDialog(getJFrame(), "Which category would you like to export?", "Export Category", JOptionPane.PLAIN_MESSAGE, null, catnames.toArray(new String[0]), catnames.get(0)); Grouping toadd = categories.get(catnames.indexOf(str)); JFileChooser chooser = new JFileChooser(); chooser.setFileFilter(new FileNameExtensionFilter("CSV File (.csv)", CATEGORY_EXTENSION)); int returnval = chooser.showSaveDialog(getJFrame()); if (returnval == JFileChooser.APPROVE_OPTION) { if (!getMiddleEnd().exportCategory(toadd, chooser.getSelectedFile())) { JOptionPane.showMessageDialog(_jFrame, "The selected file was not a valid tournament file.", "Error", JOptionPane.ERROR_MESSAGE); } else { _middleEnd.repaintAll(); } } } }); } return _exportCategoryMenuItem; } /** * This method initializes jMenuItem * * @return javax.swing.JMenuItem */ public JMenuItem getExitMenuItem() { if (_exitMenuItem == null) { _exitMenuItem = new JMenuItem(); _exitMenuItem.setText("Exit"); _exitMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, Event.CTRL_MASK, true)); _exitMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { _middleEnd.closeThisMiddleEnd(); } }); } return _exitMenuItem; } /** * This method initializes jMenu * * @return javax.swing.JMenu */ public JMenu getOptionsMenu() { if (_optionsMenu == null) { _optionsMenu = new JMenu(); _optionsMenu.setText("Options"); _optionsMenu.add(getProgramOptionsMenuItem()); _optionsMenu.add(getPluginOptionsMenuItem()); } return _optionsMenu; } /** * This method initializes jMenuItem * * @return javax.swing.JMenuItem */ public JMenuItem getPluginOptionsMenuItem() { if (_pluginOptionsMenuItem == null) { _pluginOptionsMenuItem = new JMenuItem(); _pluginOptionsMenuItem.setText("Plugin Options..."); _pluginOptionsMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JDialog pluginOptionsDialog = getPluginOptionsDialog(); pluginOptionsDialog.pack(); Point loc = getJFrame().getLocation(); loc.translate(20, 20); pluginOptionsDialog.setLocation(loc); pluginOptionsDialog.setVisible(true); } }); } return _pluginOptionsMenuItem; } /** * This method initializes _pluginOptionsPane * * @return javax.swing.JDialog */ private JDialog getPluginOptionsDialog() { if (_pluginOptionsDialog == null) { _pluginOptionsDialog = new JDialog(getJFrame()); _pluginOptionsDialog.setTitle("Plugin Options"); _pluginOptionsDialog.setContentPane(getPluginOptionsContentPane()); } return _pluginOptionsDialog; } /** * This method initializes _pluginOptionsContentPane * * @return javax.swing.JPanel */ private JPanel getPluginOptionsContentPane() { if (_pluginOptionsContentPane == null) { _pluginOptionsContentPane = new JPanel(); if (COLORSON) { _pluginOptionsContentPane.setBackground(BACKGROUND_COLOR); _pluginOptionsContentPane.setForeground(FOREGROUND_COLOR); } _pluginOptionsContentPane.setLayout(new BorderLayout()); } return _pluginOptionsContentPane; } /** * This method initializes jMenuItem * * @return javax.swing.JMenuItem */ public JMenuItem getProgramOptionsMenuItem() { if (_programOptionsMenuItem == null) { _programOptionsMenuItem = new JMenuItem(); _programOptionsMenuItem.setText("Program Options..."); _programOptionsMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JDialog programOptionsDialog = getProgramOptionsDialog(); programOptionsDialog.pack(); Point loc = getJFrame().getLocation(); loc.translate(20, 20); programOptionsDialog.setLocation(loc); programOptionsDialog.setVisible(true); } }); } return _programOptionsMenuItem; } /** * This method initializes _optionsDialog * * @return javax.swing.JDialog */ private JDialog getProgramOptionsDialog() { if (_programOptionsDialog == null) { _programOptionsDialog = new JDialog(getJFrame()); _programOptionsDialog.setTitle("Program Options"); _programOptionsDialog.setContentPane(getProgramOptionsContentPane()); } return _programOptionsDialog; } /** * This method initializes _optionsContentPane * * @return javax.swing.JPanel */ private JPanel getProgramOptionsContentPane() { if (_programOptionsContentPane == null) { _programOptionsContentPane = new JPanel(); if (COLORSON) { _programOptionsContentPane.setBackground(BACKGROUND_COLOR); _programOptionsContentPane.setForeground(FOREGROUND_COLOR); } _programOptionsContentPane.setLayout(new BorderLayout()); } return _programOptionsContentPane; } /** * This method initializes jMenu * * @return javax.swing.JMenu */ public JMenu getViewMenu() { if (_viewMenu == null) { _viewMenu = new JMenu(); _viewMenu.setText("View"); _viewMenu.add(getViewInputMenuItem()); _viewMenu.add(getViewManagementMenuItem()); ButtonGroup viewgroup = new ButtonGroup(); viewgroup.add(getViewInputMenuItem()); viewgroup.add(getViewManagementMenuItem()); } return _viewMenu; } /** * This method initializes jMenuItem * * @return javax.swing.JMenuItem */ public JRadioButtonMenuItem getViewInputMenuItem() { if (_viewInputMenuItem == null) { _viewInputMenuItem = new JRadioButtonMenuItem(); _viewInputMenuItem.setText("View Input Panel"); _viewInputMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, Event.CTRL_MASK, true)); _viewInputMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { getInputPanel().setSize(_jFrame.getContentPane().getSize()); setMainContentPane(getInputPanel()); getMainContentAndToolbarPane().repaint(); getInputPanel().repaintAll(); } }); } return _viewInputMenuItem; } /** * This method initializes jMenuItem * * @return javax.swing.JMenuItem */ public JRadioButtonMenuItem getViewManagementMenuItem() { if (_viewManagementMenuItem == null) { _viewManagementMenuItem = new JRadioButtonMenuItem(); _viewManagementMenuItem.setText("View Management Panel"); _viewManagementMenuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_M, Event.CTRL_MASK, true)); _viewManagementMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent e) { getManagementPanel().setSize(_jFrame.getSize()); setMainContentPane(getManagementPanel()); getMainContentAndToolbarPane().repaint(); getManagementPanel().repaintAll(); } }); } return _viewManagementMenuItem; } /** * This method initializes jMenu * * @return javax.swing.JMenu */ public JMenu getEditMenu() { if (_editMenu == null) { _editMenu = new JMenu(); _editMenu.setText("Edit"); _editMenu.add(getCreateRoundMenuItem()); List<Grouping> groupings = _middleEnd.getTournament().getCategories(); for (Grouping<Unit> g : groupings) { _editMenu.add(createEditMenuItem(g)); } } return _editMenu; } /** * This method initializes jMenuItem * * @return javax.swing.JMenuItem */ public JMenuItem getCreateRoundMenuItem() { JMenuItem item = new JMenuItem(); item.setText("Create new round from existing units..."); item.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try{ _middleEnd.getTournament().createNextRound(); getViewManagementMenuItem().doClick(); }catch(InvalidRoundException err){ err.printStackTrace(); } } }); return item; } /** * This method initializes jMenuItem * * @return javax.swing.JMenuItem */ public JMenuItem createEditMenuItem(final Grouping<Unit> g) { JMenuItem item = new JMenuItem(); item.setText("New " + g.getName() + "..."); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { getInputPanel().getAddingPanel().setAddPanel(g); getViewInputMenuItem().doClick(); } }); return item; } /** * This method initializes jMenu * * @return javax.swing.JMenu */ public JMenu getHelpMenu() { if (_helpMenu == null) { _helpMenu = new JMenu(); _helpMenu.setText("Help"); _helpMenu.add(getAboutMenuItem()); } return _helpMenu; } /** * This method initializes jMenuItem * * @return javax.swing.JMenuItem */ public JMenuItem getAboutMenuItem() { if (_aboutMenuItem == null) { _aboutMenuItem = new JMenuItem(); _aboutMenuItem.setText("About..."); _aboutMenuItem.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { JDialog aboutDialog = getAboutDialog(); aboutDialog.pack(); Point loc = getJFrame().getLocation(); loc.translate(20, 20); aboutDialog.setLocation(loc); aboutDialog.setVisible(true); } }); } return _aboutMenuItem; } /** * This method initializes aboutDialog * * @return javax.swing.JDialog */ public JDialog getAboutDialog() { if (_aboutDialog == null) { _aboutDialog = new JDialog(getJFrame(), true); _aboutDialog.setTitle("About"); _aboutDialog.setContentPane(getAboutContentPane()); } return _aboutDialog; } /** * This method initializes aboutContentPane * * @return javax.swing.JPanel */ public JPanel getAboutContentPane() { if (_aboutContentPane == null) { _aboutContentPane = new JPanel(); if (COLORSON) { _aboutContentPane.setBackground(BACKGROUND_COLOR); _aboutContentPane.setForeground(FOREGROUND_COLOR); } _aboutContentPane.setLayout(new BorderLayout()); _aboutContentPane.add(getAboutVersionLabel(), BorderLayout.CENTER); } return _aboutContentPane; } /** * This method initializes aboutVersionLabel * * @return javax.swing.JLabel */ public JLabel getAboutVersionLabel() { if (_aboutVersionLabel == null) { _aboutVersionLabel = new JLabel(); _aboutVersionLabel.setText("<html><center>Tournament Scheduler - Version 1.0<br>" + "Created by Patrick Clay, Matthew Mahoney, and Aswin Karumbunathan</center></html>"); _aboutVersionLabel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); } return _aboutVersionLabel; } /** * Repaints all the important components. */ public void repaintAll() { getInputPanel().repaintAll(); getManagementPanel().repaintAll(); getMainContentAndToolbarPane().repaint(); } /** * Launches this application * public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { App application = new App(new MiddleEnd()); application.getJFrame().setVisible(true); } }); }*/ }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
f8ea71718014c7997883686e7cfbeccde9811d83
cee49bddcf4d2b53d5a394df04190e50175031b7
/src/main/java/com/themoneypies/service/RuleService.java
7b169771dc4c0ad6f675fda4dcd6a6488e25daea
[ "MIT" ]
permissive
danoprita/themoneypies
65bdbae666d264aebfc0b924c9b9fd299ec05386
0d40364e19f4c9ef35d99b4a58510fd8bbc015c2
refs/heads/master
2021-01-10T12:48:09.315312
2016-02-25T07:57:01
2016-02-25T07:57:01
52,078,895
1
0
null
2016-02-25T12:22:28
2016-02-19T10:01:08
Java
UTF-8
Java
false
false
206
java
package com.themoneypies.service; import com.themoneypies.domain.Rule; import java.util.List; public interface RuleService { boolean isPersisted(Rule rule); void importRules(List<Rule> rules); }
[ "danoprita@gmail.com" ]
danoprita@gmail.com
007cf625b836e53bd8f8e0567a8c2cb98e26b61f
2256e4ad6fcb35d6e84ee610a6b11df0e4122ccd
/src/java/com/viettel/im/client/bean/AppParamsBean.java
75d0ceebb070a4717566315fdd76e4f184789b5f
[]
no_license
tuanns/bccs_sm
cd9ae4da6dc410e4c71909b21c2ae1cf35864fc2
60476a905db7d4e7422061423fe93f7713eebf9c
refs/heads/master
2022-06-21T05:52:49.165156
2020-05-06T19:02:56
2020-05-06T19:02:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
692
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.viettel.im.client.bean; /** * * @author User */ public class AppParamsBean implements java.io.Serializable { private String code; private String name; public AppParamsBean() { } public AppParamsBean(String code, String name) { this.code = code; this.name = name; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "xuanbac1611@gmail.com" ]
xuanbac1611@gmail.com
802e82e239fbd976077635b856adca544799b4c2
521d19cfea558d31263986bf1e22ff9327195ce5
/ProjectSupportSystem/src/com/projectsupport/models/Question.java
d88252502fe62cb101b88cc6fee951d192f257a6
[]
no_license
EGRaY5/ProjectSupportSystem
30a7cfb1462a60b1a1a823272c58f4e43e3c102e
4eeaa29294b8ef826114da0ed87d318009712293
refs/heads/master
2020-03-18T00:58:55.486599
2018-05-20T05:22:54
2018-05-20T05:22:54
134,122,055
0
0
null
null
null
null
UTF-8
Java
false
false
521
java
package com.projectsupport.models; public class Question { private int questionId; private String quest; private String userName; public int getQuestionId() { return questionId; } public void setQuestionId(int questionId) { this.questionId = questionId; } public String getQuestion() { return quest; } public void setQuest(String quest) { this.quest = quest; } public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } }
[ "erandagrero@gmail.com" ]
erandagrero@gmail.com
1832324b237791b2476a302ec95e5dd0efd8299a
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_02a05f82727e3da744b89f8c2ebd2885b4503444/ResultSetNode/2_02a05f82727e3da744b89f8c2ebd2885b4503444_ResultSetNode_s.java
efb59c3d3ce2a418f3c0c2be5b0417f4a21781ab
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
65,459
java
/* Derby - Class org.apache.derby.impl.sql.compile.ResultSetNode Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package org.apache.derby.impl.sql.compile; import java.util.ArrayList; import java.util.List; import java.util.Set; import org.apache.derby.catalog.types.DefaultInfoImpl; import org.apache.derby.iapi.error.StandardException; import org.apache.derby.iapi.reference.ClassName; import org.apache.derby.iapi.services.classfile.VMOpcode; import org.apache.derby.iapi.services.compiler.MethodBuilder; import org.apache.derby.iapi.services.context.ContextManager; import org.apache.derby.iapi.sql.ResultColumnDescriptor; import org.apache.derby.iapi.sql.ResultDescription; import org.apache.derby.iapi.sql.compile.CompilerContext; import org.apache.derby.iapi.sql.compile.CostEstimate; import org.apache.derby.iapi.sql.compile.Optimizer; import org.apache.derby.iapi.sql.compile.OptimizerFactory; import org.apache.derby.iapi.sql.compile.Parser; import org.apache.derby.iapi.sql.compile.RequiredRowOrdering; import org.apache.derby.iapi.sql.compile.Visitable; import org.apache.derby.iapi.sql.compile.Visitor; import org.apache.derby.iapi.sql.conn.LanguageConnectionContext; import org.apache.derby.iapi.sql.dictionary.ColumnDescriptor; import org.apache.derby.iapi.sql.dictionary.DataDictionary; import org.apache.derby.iapi.sql.dictionary.DefaultDescriptor; import org.apache.derby.iapi.sql.dictionary.TableDescriptor; import org.apache.derby.iapi.store.access.TransactionController; import org.apache.derby.iapi.types.DataTypeDescriptor; import org.apache.derby.iapi.util.JBitSet; import org.apache.derby.shared.common.sanity.SanityManager; /** * A ResultSetNode represents a result set, that is, a set of rows. It is * analogous to a ResultSet in the LanguageModuleExternalInterface. In fact, * code generation for a a ResultSetNode will create a "new" call to a * constructor for a ResultSet. * */ public abstract class ResultSetNode extends QueryTreeNode { int resultSetNumber; /* Bit map of referenced tables under this ResultSetNode */ JBitSet referencedTableMap; ResultColumnList resultColumns; boolean statementResultSet; boolean cursorTargetTable; boolean insertSource; CostEstimate costEstimate; CostEstimate scratchCostEstimate; Optimizer optimizer; // Final cost estimate for this result set node, which is the estimate // for this node with respect to the best join order for the top-level // query. Subclasses will set this value where appropriate. CostEstimate finalCostEstimate; ResultSetNode(ContextManager cm) { super(cm); } /** * Convert this object to a String. See comments in QueryTreeNode.java * for how this should be done for tree printing. * * @return This object as a String */ @Override public String toString() { if (SanityManager.DEBUG) { return "resultSetNumber: " + resultSetNumber + "\n" + "referencedTableMap: " + (referencedTableMap != null ? referencedTableMap.toString() : "null") + "\n" + "statementResultSet: " + statementResultSet + "\n" + super.toString(); } else { return ""; } } /** * Prints the sub-nodes of this object. See QueryTreeNode.java for * how tree printing is supposed to work. * * @param depth The depth of this node in the tree */ @Override void printSubNodes(int depth) { if (SanityManager.DEBUG) { super.printSubNodes(depth); if (resultColumns != null) { printLabel(depth, "resultColumns: "); resultColumns.treePrint(depth + 1); } } } /** * Get the resultSetNumber in this ResultSetNode. Expected to be set during * generate(). * * @return int The resultSetNumber. */ public int getResultSetNumber() { return resultSetNumber; } /** * Get the CostEstimate for this ResultSetNode. * * @return The CostEstimate for this ResultSetNode. */ CostEstimate getCostEstimate() { if (SanityManager.DEBUG) { if (costEstimate == null) { SanityManager.THROWASSERT( "costEstimate is not expected to be null for " + getClass().getName()); } } return costEstimate; } /** * Get the final CostEstimate for this ResultSetNode. * * @return The final CostEstimate for this ResultSetNode. */ CostEstimate getFinalCostEstimate() throws StandardException { if (SanityManager.DEBUG) { if (finalCostEstimate == null) { SanityManager.THROWASSERT( "finalCostEstimate is not expected to be null for " + getClass().getName()); } } return finalCostEstimate; } /** * Assign the next resultSetNumber to the resultSetNumber in this ResultSetNode. * Expected to be done during generate(). * * @exception StandardException Thrown on error */ void assignResultSetNumber() throws StandardException { resultSetNumber = getCompilerContext().getNextResultSetNumber(); resultColumns.setResultSetNumber(resultSetNumber); } /** * Bind the non VTI tables in this ResultSetNode. This includes getting their * descriptors from the data dictionary and numbering them. * * @param dataDictionary The DataDictionary to use for binding * @param fromListParam FromList to use/append to. * * @return ResultSetNode * * @exception StandardException Thrown on error */ ResultSetNode bindNonVTITables(DataDictionary dataDictionary, FromList fromListParam) throws StandardException { return this; } /** * Bind the VTI tables in this ResultSetNode. This includes getting their * descriptors from the data dictionary and numbering them. * * @param fromListParam FromList to use/append to. * * @return ResultSetNode * * @exception StandardException Thrown on error */ ResultSetNode bindVTITables(FromList fromListParam) throws StandardException { return this; } /** * Bind the expressions in this ResultSetNode. This means binding the * sub-expressions, as well as figuring out what the return type is for * each expression. * * @param fromListParam FromList to use/append to. * * @exception StandardException Thrown on error */ void bindExpressions(FromList fromListParam) throws StandardException { if (SanityManager.DEBUG) SanityManager.ASSERT(false, "bindExpressions() is not expected to be called for " + this.getClass().toString()); } /** * Bind the expressions in this ResultSetNode if it has tables. This means binding the * sub-expressions, as well as figuring out what the return type is for * each expression. * * @param fromListParam FromList to use/append to. * * @exception StandardException Thrown on error */ void bindExpressionsWithTables(FromList fromListParam) throws StandardException { if (SanityManager.DEBUG) SanityManager.ASSERT(false, "bindExpressionsWithTables() is not expected to be called for " + this.getClass().toString()); } /** * Bind the expressions in the target list. This means binding the * sub-expressions, as well as figuring out what the return type is * for each expression. This is useful for EXISTS subqueries, where we * need to validate the target list before blowing it away and replacing * it with a SELECT true. * * @exception StandardException Thrown on error */ void bindTargetExpressions(FromList fromListParam) throws StandardException { if (SanityManager.DEBUG) SanityManager.ASSERT(false, "bindTargetExpressions() is not expected to be called for " + this.getClass().toString()); } /** * Set the type of each parameter in the result column list for this * table constructor. * * @param typeColumns The ResultColumnList containing the desired result * types. * * @exception StandardException Thrown on error */ void setTableConstructorTypes(ResultColumnList typeColumns) throws StandardException { // VALUES clause needs special handling that's taken care of in a // sub-class. For all other nodes, just go through the result columns // and set the type for dynamic parameters. for (int i = 0; i < resultColumns.size(); i++) { ResultColumn rc = resultColumns.elementAt(i); ValueNode re = rc.getExpression(); if (re != null && re.requiresTypeFromContext()) { ResultColumn typeCol = typeColumns.elementAt(i); re.setType(typeCol.getTypeServices()); } } } /** * Remember that this node is the source result set for an INSERT. */ void setInsertSource() { insertSource = true; } /** * Verify that a SELECT * is valid for this type of subquery. * * @param outerFromList The FromList from the outer query block(s) * @param subqueryType The subquery type * * @exception StandardException Thrown on error */ void verifySelectStarSubquery(FromList outerFromList, int subqueryType) throws StandardException { if (SanityManager.DEBUG) SanityManager.ASSERT(false, "verifySelectStarSubquery() is not expected to be called for " + this.getClass().toString()); } /** * Expand "*" into a ResultColumnList with all of the columns * in the table's result list. * * @param allTableName The qualifier on the "*" * * @return ResultColumnList The expanded list, or {@code null} if * {@code allTableName} is non-null and doesn't match a table name in * this result set * * @exception StandardException Thrown on error */ ResultColumnList getAllResultColumns(TableName allTableName) throws StandardException { if (SanityManager.DEBUG) SanityManager.THROWASSERT( "getAllResultColumns() not expected to be called for " + this.getClass().getName() + this); return null; } /** * Try to find a ResultColumn in the table represented by this FromTable * that matches the name in the given ColumnReference. * * @param columnReference The columnReference whose name we're looking * for in the given table. * * @return A ResultColumn whose expression is the ColumnNode * that matches the ColumnReference. * Returns null if there is no match. * * @exception StandardException Thrown on error */ ResultColumn getMatchingColumn( ColumnReference columnReference) throws StandardException { if (SanityManager.DEBUG) SanityManager.THROWASSERT( "getMatchingColumn() not expected to be called for " + this); return null; } /** * Set the result column for the subquery to a boolean true, * Useful for transformations such as * changing: * where exists (select ... from ...) * to: * where (select true from ...) * * NOTE: No transformation is performed if the ResultColumn.expression is * already the correct boolean constant. * * @param onlyConvertAlls Boolean, whether or not to just convert *'s * @return ResultSetNode whose resultColumn was transformed; defaults * to "this" here, but can be overridden by subclasses. * * @exception StandardException Thrown on error */ ResultSetNode setResultToBooleanTrueNode(boolean onlyConvertAlls) throws StandardException { ResultColumn resultColumn; /* We need to be able to handle both ResultColumn and AllResultColumn * since they are peers. */ if (resultColumns.elementAt(0) instanceof AllResultColumn) { resultColumn = new ResultColumn("", null, getContextManager()); } else if (onlyConvertAlls) { return this; } else { resultColumn = resultColumns.elementAt(0); /* Nothing to do if query is already select TRUE ... */ if (resultColumn.getExpression().isBooleanTrue() && resultColumns.size() == 1) { return this; } } BooleanConstantNode booleanNode = new BooleanConstantNode(true, getContextManager()); resultColumn.setExpression(booleanNode); resultColumn.setType(booleanNode.getTypeServices()); /* VirtualColumnIds are 1-based, RCLs are 0-based */ resultColumn.setVirtualColumnId(1); resultColumns.setElementAt(resultColumn, 0); return this; } /** * Get the FromList. Create and return an empty FromList. (Subclasses * which actuall have FromLists will override this.) This is useful because * there is a FromList parameter to bindExpressions() which is used as * the common FromList to bind against, allowing us to support * correlation columns under unions in subqueries. * * @return FromList * @exception StandardException Thrown on error */ FromList getFromList() throws StandardException { return new FromList(getOptimizerFactory().doJoinOrderOptimization(), getContextManager()); } /** * Bind the result columns of this ResultSetNode when there is no * base table to bind them to. This is useful for SELECT statements, * where the result columns get their types from the expressions that * live under them. * * @param fromListParam FromList to use/append to. * * @exception StandardException Thrown on error */ void bindResultColumns(FromList fromListParam) throws StandardException { resultColumns.bindResultColumnsToExpressions(); } /** * Bind the result columns for this ResultSetNode to a base table. * This is useful for INSERT and UPDATE statements, where the * result columns get their types from the table being updated or * inserted into. * If a result column list is specified, then the verification that the * result column list does not contain any duplicates will be done when * binding them by name. * * @param targetTableDescriptor The TableDescriptor for the table being * updated or inserted into * @param targetColumnList For INSERT statements, the user * does not have to supply column * names (for example, "insert into t * values (1,2,3)". When this * parameter is null, it means that * the user did not supply column * names, and so the binding should * be done based on order. When it * is not null, it means do the binding * by name, not position. * @param statement Calling DMLStatementNode (Insert or Update) * @param fromListParam FromList to use/append to. * * @exception StandardException Thrown on error */ void bindResultColumns(TableDescriptor targetTableDescriptor, FromVTI targetVTI, ResultColumnList targetColumnList, DMLStatementNode statement, FromList fromListParam) throws StandardException { /* For insert select, we need to expand any *'s in the * select before binding the result columns */ if (this instanceof SelectNode) { resultColumns.expandAllsAndNameColumns(((SelectNode)this).fromList); } /* If specified, copy the result column names down to the * source's target list. */ if (targetColumnList != null) { resultColumns.copyResultColumnNames(targetColumnList); } if (targetColumnList != null) { if (targetTableDescriptor != null) { resultColumns.bindResultColumnsByName( targetTableDescriptor, statement); } else { resultColumns.bindResultColumnsByName( targetVTI.getResultColumns(), targetVTI, statement); } } else resultColumns.bindResultColumnsByPosition(targetTableDescriptor); } /** * Bind untyped nulls to the types in the given ResultColumnList. * This is used for binding the nulls in row constructors and * table constructors. In all other cases (as of the time of * this writing), we do nothing. * * @param rcl The ResultColumnList with the types to bind nulls to * * @exception StandardException Thrown on error */ void bindUntypedNullsToResultColumns(ResultColumnList rcl) throws StandardException { } /** * Preprocess a ResultSetNode - this currently means: * o Generating a referenced table map for each ResultSetNode. * o Putting the WHERE and HAVING clauses in conjunctive normal form (CNF). * o Converting the WHERE and HAVING clauses into PredicateLists and * classifying them. * o Ensuring that a ProjectRestrictNode is generated on top of every * FromBaseTable and generated in place of every FromSubquery. * o Pushing single table predicates down to the new ProjectRestrictNodes. * * @param numTables The number of tables in the DML Statement * @param gbl The group by list, if any * @param fromList The from list, if any * * @return ResultSetNode at top of preprocessed tree. * * @exception StandardException Thrown on error */ ResultSetNode preprocess(int numTables, GroupByList gbl, FromList fromList) throws StandardException { if (SanityManager.DEBUG) SanityManager.THROWASSERT( "preprocess() not expected to be called for " + getClass().toString()); return null; } /** * Find the unreferenced result columns and project them out. */ void projectResultColumns() throws StandardException { // It is only necessary for joins } /** * Ensure that the top of the RSN tree has a PredicateList. * * @param numTables The number of tables in the query. * @return ResultSetNode A RSN tree with a node which has a PredicateList on top. * * @exception StandardException Thrown on error */ ResultSetNode ensurePredicateList(int numTables) throws StandardException { if (SanityManager.DEBUG) SanityManager.THROWASSERT( "ensurePredicateList() not expected to be called for " + getClass().toString()); return null; } /** * Add a new predicate to the list. This is useful when doing subquery * transformations, when we build a new predicate with the left side of * the subquery operator and the subquery's result column. * * @param predicate The predicate to add * * @return ResultSetNode The new top of the tree. * * @exception StandardException Thrown on error */ ResultSetNode addNewPredicate(Predicate predicate) throws StandardException { if (SanityManager.DEBUG) SanityManager.THROWASSERT( "addNewPredicate() not expected to be called for " + getClass().toString()); return null; } /** * Evaluate whether or not the subquery in a FromSubquery is flattenable. * Currently, a FSqry is flattenable if all of the following are true: * o Subquery is a SelectNode. (ie, not a RowResultSetNode or a UnionNode) * o It contains no top level subqueries. (RESOLVE - we can relax this) * o It does not contain a group by or having clause * o It does not contain aggregates. * * @param fromList The outer from list * * @return boolean Whether or not the FromSubquery is flattenable. */ boolean flattenableInFromSubquery(FromList fromList) { if (SanityManager.DEBUG) SanityManager.THROWASSERT( "flattenableInFromSubquery() not expected to be called for " + getClass().toString()); return false; } /** * Get a parent ProjectRestrictNode above us. * This is useful when we need to preserve the * user specified column order when reordering the * columns in the distinct when we combine * an order by with a distinct. * * @return A parent ProjectRestrictNode to do column reordering * * @exception StandardException Thrown on error */ ResultSetNode genProjectRestrictForReordering() throws StandardException { /* We get a shallow copy of the ResultColumnList and its * ResultColumns. (Copy maintains ResultColumn.expression for now.) */ ResultColumnList prRCList = resultColumns; resultColumns = resultColumns.copyListAndObjects(); /* Replace ResultColumn.expression with new VirtualColumnNodes * in the ProjectRestrictNode's ResultColumnList. (VirtualColumnNodes include * pointers to source ResultSetNode, this, and source ResultColumn.) * NOTE: We don't want to mark the underlying RCs as referenced, otherwise * we won't be able to project out any of them. */ prRCList.genVirtualColumnNodes(this, resultColumns, false); /* Finally, we create the new ProjectRestrictNode */ return new ProjectRestrictNode( this, prRCList, null, /* Restriction */ null, /* Restriction as PredicateList */ null, /* Project subquery list */ null, /* Restrict subquery list */ null, getContextManager() ); } /** * Optimize a ResultSetNode. This means choosing the best access * path for each table under the ResultSetNode, among other things. * * The only RSNs that need to implement their own optimize() are a * SelectNode and those RSNs that can appear above a SelectNode in the * query tree. Currently, a ProjectRestrictNode is the only RSN that * can appear above a SelectNode. * * @param dataDictionary The DataDictionary to use for optimization * @param predicates The PredicateList to apply. * @param outerRows The number of outer joining rows * * @return ResultSetNode The top of the optimized query tree * * @exception StandardException Thrown on error */ ResultSetNode optimize(DataDictionary dataDictionary, PredicateList predicates, double outerRows) throws StandardException { if (SanityManager.DEBUG) SanityManager.ASSERT(false, "optimize() is not expected to be called for " + this.getClass().toString()); return null; } /** * Modify the access paths according to the decisions the optimizer * made. This can include adding project/restrict nodes, * index-to-base-row nodes, etc. * * @return The modified query tree * * @exception StandardException Thrown on error */ ResultSetNode modifyAccessPaths() throws StandardException { /* Default behavior is to do nothing */ return this; } /** * Modify the access paths according to the decisions the optimizer * made. This can include adding project/restrict nodes, * index-to-base-row nodes, etc. * * @param predList A list of optimizable predicates that should * be pushed to this ResultSetNode, as determined by optimizer. * @return The modified query tree * @exception StandardException Thrown on error */ ResultSetNode modifyAccessPaths(PredicateList predList) throws StandardException { // Default behavior is to call the no-arg version of this method. return modifyAccessPaths(); } ResultColumnDescriptor[] makeResultDescriptors() { return resultColumns.makeResultDescriptors(); } /* ** Check whether the column lengths and types of the result columns ** match the expressions under those columns. This is useful for ** INSERT and UPDATE statements. For SELECT statements this method ** should always return true. There is no need to call this for a ** DELETE statement. ** ** @return true means all the columns match their expressions, ** false means at least one column does not match its ** expression */ boolean columnTypesAndLengthsMatch() throws StandardException { return resultColumns.columnTypesAndLengthsMatch(); } /** * Set the resultColumns in this ResultSetNode * * @param newRCL The new ResultColumnList for this ResultSetNode */ void setResultColumns(ResultColumnList newRCL) { resultColumns = newRCL; } /** * Get the resultColumns for this ResultSetNode * * @return ResultColumnList for this ResultSetNode */ ResultColumnList getResultColumns() { return resultColumns; } /** * Set the referencedTableMap in this ResultSetNode * * @param newRTM The new referencedTableMap for this ResultSetNode */ void setReferencedTableMap(JBitSet newRTM) { referencedTableMap = newRTM; } /** * Get the referencedTableMap for this ResultSetNode * * @return JBitSet Referenced table map for this ResultSetNode */ public JBitSet getReferencedTableMap() { return referencedTableMap; } /** * Fill the referencedTableMap with this ResultSetNode. * * @param passedMap The table map to fill in. */ void fillInReferencedTableMap(JBitSet passedMap) { } /** * Check for (and reject) ? parameters directly under the ResultColumns. * This is done for SELECT statements. * * @exception StandardException Thrown if a ? parameter found * directly under a ResultColumn */ void rejectParameters() throws StandardException { /* Okay if no resultColumns yet - means no parameters there */ if (resultColumns != null) { resultColumns.rejectParameters(); } } /** * Check for (and reject) XML values directly under the ResultColumns. * This is done for SELECT/VALUES statements. We reject values * in this case because JDBC does not define an XML type/binding * and thus there's no standard way to pass such a type back * to a JDBC application. * * @exception StandardException Thrown if an XML value found * directly under a ResultColumn */ void rejectXMLValues() throws StandardException { if (resultColumns != null) { resultColumns.rejectXMLValues(); } } /** * Rename generated result column names as '1', '2' etc... These will be the result * column names seen by JDBC clients. */ void renameGeneratedResultNames() throws StandardException { for (int i=0; i<resultColumns.size(); i++) { ResultColumn rc = resultColumns.elementAt(i); if (rc.isNameGenerated()) rc.setName(Integer.toString(i+1)); } } /** This method is overridden to allow a resultset node to know if it is the one controlling the statement -- i.e., it is the outermost result set node for the statement. */ void markStatementResultSet() { statementResultSet = true; } /** * This ResultSet is the source for an Insert. The target RCL * is in a different order and/or a superset of this RCL. In most cases * we will add a ProjectRestrictNode on top of the source with an RCL that * matches the target RCL. * NOTE - The new or enhanced RCL will be fully bound. * * @param target the target node for the insert * @param inOrder are source cols in same order as target cols? * @param colMap int array representation of correspondence between * RCLs - colmap[i] = -1 -> missing in current RCL * colmap[i] = j -> targetRCL(i) <-> thisRCL(j+1) * @return a node that replaces this node and whose RCL matches the target * RCL. May return this node if no changes to the RCL are needed, or if the * RCL is modified in-place. * * @exception StandardException Thrown on error */ ResultSetNode enhanceRCLForInsert( InsertNode target, boolean inOrder, int[] colMap) throws StandardException { if (!inOrder || resultColumns.visibleSize() < target.resultColumnList.size()) { return generateProjectRestrictForInsert(target, colMap); } return this; } /** * Generate an RCL that can replace the original RCL of this node to * match the RCL of the target for the insert. * * @param target the target node for the insert * @param colMap int array representation of correspondence between * RCLs - colmap[i] = -1 -&gt; missing in current RCL * colmap[i] = j -&gt; targetRCL(i) &lt;-&gt; thisRCL(j+1) * @return an RCL that matches the target RCL */ ResultColumnList getRCLForInsert(InsertNode target, int[] colMap) throws StandardException { // our newResultCols are put into the bound form straight away. ResultColumnList newResultCols = new ResultColumnList(getContextManager()); /* Create a massaged version of the source RCL. * (Much simpler to build new list and then assign to source, * rather than massage the source list in place.) */ int numTargetColumns = target.resultColumnList.size(); for (int index = 0; index < numTargetColumns; index++) { ResultColumn newResultColumn; if (colMap[index] != -1) { // getResultColumn uses 1-based positioning, so offset the colMap entry appropriately newResultColumn = resultColumns.getResultColumn(colMap[index]+1); } else { newResultColumn = genNewRCForInsert( target.targetTableDescriptor, target.targetVTI, index + 1, target.getDataDictionary()); } newResultCols.addResultColumn(newResultColumn); } return newResultCols; } /** * Generate the RC/expression for an unspecified column in an insert. * Use the default if one exists. * * @param targetTD Target TableDescriptor if the target is not a VTI, null if a VTI. * @param targetVTI Target description if it is a VTI, null if not a VTI * @param columnNumber The column number * @param dataDictionary The DataDictionary * @return The RC/expression for the unspecified column. * * @exception StandardException Thrown on error */ private ResultColumn genNewRCForInsert(TableDescriptor targetTD, FromVTI targetVTI, int columnNumber, DataDictionary dataDictionary) throws StandardException { ResultColumn newResultColumn; // the i-th column's value was not specified, so create an // expression containing its default value (null for now) // REVISIT: will we store trailing nulls? if( targetVTI != null) { newResultColumn = targetVTI.getResultColumns().getResultColumn( columnNumber); newResultColumn = newResultColumn.cloneMe(); newResultColumn.setExpressionToNullNode(); } else { // column position is 1-based, index is 0-based. ColumnDescriptor colDesc = targetTD.getColumnDescriptor(columnNumber); DataTypeDescriptor colType = colDesc.getType(); // Check for defaults DefaultInfoImpl defaultInfo = (DefaultInfoImpl) colDesc.getDefaultInfo(); //Column has constant default value , //if it have defaultInfo and not be autoincrement. if (defaultInfo != null && ! colDesc.isAutoincrement()) { //RESOLVEPARAMETER - skip the tree if we have the value /* if (defaultInfo.getDefaultValue() != null) { } else */ { if ( colDesc.hasGenerationClause() ) { // later on we will revisit the generated columns and bind // their generation clauses newResultColumn = createGeneratedColumn( targetTD, colDesc ); } else { // Generate the tree for the default String defaultText = defaultInfo.getDefaultText(); ValueNode defaultTree = parseDefault(defaultText); defaultTree = defaultTree.bindExpression (getFromList(), (SubqueryList) null, (List<AggregateNode>) null); newResultColumn = new ResultColumn( defaultTree.getTypeServices(), defaultTree, getContextManager()); } DefaultDescriptor defaultDescriptor = colDesc.getDefaultDescriptor(dataDictionary); if (SanityManager.DEBUG) { SanityManager.ASSERT(defaultDescriptor != null, "defaultDescriptor expected to be non-null"); } getCompilerContext().createDependency(defaultDescriptor); } } else if (colDesc.isAutoincrement()) { newResultColumn = new ResultColumn(colDesc, null, getContextManager()); newResultColumn.setAutoincrementGenerated(); } else { newResultColumn = new ResultColumn( colType, getNullNode(colType), getContextManager()); } } // Mark the new RC as generated for an unmatched column in an insert newResultColumn.markGeneratedForUnmatchedColumnInInsert(); return newResultColumn; } /** * Generate a ProjectRestrictNode to put on top of this node if it's the * source for an insert, and the RCL needs reordering and/or addition of * columns in order to match the target RCL. * * @param target the target node for the insert * @param colMap int array representation of correspondence between * RCLs - colmap[i] = -1 -&gt; missing in current RCL * colmap[i] = j -&gt; targetRCL(i) &lt;-&gt; thisRCL(j+1) * @return a ProjectRestrictNode whos RCL matches the target RCL */ private ResultSetNode generateProjectRestrictForInsert( InsertNode target, int[] colMap) throws StandardException { // our newResultCols are put into the bound form straight away. ResultColumnList newResultCols = new ResultColumnList(getContextManager()); int numTargetColumns = target.resultColumnList.size(); /* Create a massaged version of the source RCL. * (Much simpler to build new list and then assign to source, * rather than massage the source list in place.) */ for (int index = 0; index < numTargetColumns; index++) { ResultColumn newResultColumn; ResultColumn oldResultColumn; ColumnReference newColumnReference; if (colMap[index] != -1) { // getResultColumn uses 1-based positioning, so offset the // colMap entry appropriately oldResultColumn = resultColumns.getResultColumn(colMap[index] + 1); newColumnReference = new ColumnReference( oldResultColumn.getName(), null, getContextManager()); /* The ColumnReference points to the source of the value */ newColumnReference.setSource(oldResultColumn); // colMap entry is 0-based, columnId is 1-based. newColumnReference.setType(oldResultColumn.getType()); // Source of an insert, so nesting levels must be 0 newColumnReference.setNestingLevel(0); newColumnReference.setSourceLevel(0); // because the insert already copied the target table's // column descriptors into the result, we grab it from there. // alternatively, we could do what the else clause does, // and look it up in the DD again. newResultColumn = new ResultColumn( oldResultColumn.getType(), newColumnReference, getContextManager()); } else { newResultColumn = genNewRCForInsert( target.targetTableDescriptor, target.targetVTI, index + 1, target.getDataDictionary()); } newResultCols.addResultColumn(newResultColumn); } /* The generated ProjectRestrictNode now has the ResultColumnList * in the order that the InsertNode expects. * NOTE: This code here is an exception to several "rules": * o This is the only ProjectRestrictNode that is currently * generated outside of preprocess(). * o The UnionNode is the only node which is not at the * top of the query tree which has ColumnReferences under * its ResultColumnList prior to expression push down. */ return new ProjectRestrictNode(this, newResultCols, null, null, null, null, null, getContextManager()); } /** * Create a ResultColumn for a column with a generation clause. */ private ResultColumn createGeneratedColumn ( TableDescriptor targetTD, ColumnDescriptor colDesc ) throws StandardException { ValueNode dummy = new UntypedNullConstantNode(getContextManager()); ResultColumn newResultColumn = new ResultColumn(colDesc.getType(), dummy, getContextManager()); newResultColumn.setColumnDescriptor( targetTD, colDesc ); return newResultColumn; } /** * Parse a default and turn it into a query tree. * * @param defaultText Text of Default. * * @return The parsed default as a query tree. * * @exception StandardException Thrown on failure */ public ValueNode parseDefault ( String defaultText ) throws StandardException { Parser p; ValueNode defaultTree; LanguageConnectionContext lcc = getLanguageConnectionContext(); /* Get a Statement to pass to the parser */ /* We're all set up to parse. We have to build a compilable SQL statement * before we can parse - So, we goober up a VALUES defaultText. */ String values = "VALUES " + defaultText; /* ** Get a new compiler context, so the parsing of the select statement ** doesn't mess up anything in the current context (it could clobber ** the ParameterValueSet, for example). */ CompilerContext newCC = lcc.pushCompilerContext(); p = newCC.getParser(); /* Finally, we can call the parser */ // Since this is always nested inside another SQL statement, so topLevel flag // should be false Visitable qt = p.parseStatement(values); if (SanityManager.DEBUG) { if (! (qt instanceof CursorNode)) { SanityManager.THROWASSERT( "qt expected to be instanceof CursorNode, not " + qt.getClass().getName()); } CursorNode cn = (CursorNode) qt; if (! (cn.getResultSetNode() instanceof RowResultSetNode)) { SanityManager.THROWASSERT( "cn.getResultSetNode() expected to be instanceof RowResultSetNode, not " + cn.getResultSetNode().getClass().getName()); } } defaultTree = ((CursorNode) qt).getResultSetNode().getResultColumns(). elementAt(0).getExpression(); lcc.popCompilerContext(newCC); return defaultTree; } /** * Make a ResultDescription for use in a ResultSet. * This is useful when generating/executing a NormalizeResultSet, since * it can appear anywhere in the tree. * * @return A ResultDescription for this ResultSetNode. */ public ResultDescription makeResultDescription() { ResultColumnDescriptor[] colDescs = makeResultDescriptors(); return getExecutionFactory().getResultDescription(colDescs, null); } /** Determine if this result set is updatable or not, for a cursor (i.e., is it a cursor-updatable select). This returns false and we expect selectnode to refine it for further checking. * * @exception StandardException Thrown on error */ boolean isUpdatableCursor(DataDictionary dd) throws StandardException { if (SanityManager.DEBUG) SanityManager.DEBUG("DumpUpdateCheck","cursor is not a select result set"); return false; } /** return the target table of an updatable cursor result set. since this is not updatable, just return null. */ FromTable getCursorTargetTable() { return null; } /** Mark this ResultSetNode as the target table of an updatable cursor. Most types of ResultSetNode can't be target tables. @return true if the target table supports positioned updates. */ boolean markAsCursorTargetTable() { return false; } /** Mark this ResultSetNode as *not* the target table of an updatable cursor. */ void notCursorTargetTable() { cursorTargetTable = false; } /** * Put a ProjectRestrictNode on top of this ResultSetNode. * ColumnReferences must continue to point to the same ResultColumn, so * that ResultColumn must percolate up to the new PRN. However, * that ResultColumn will point to a new expression, a VirtualColumnNode, * which points to the FromTable and the ResultColumn that is the source for * the ColumnReference. * (The new PRN will have the original of the ResultColumnList and * the ResultColumns from that list. The FromTable will get shallow copies * of the ResultColumnList and its ResultColumns. ResultColumn.expression * will remain at the FromTable, with the PRN getting a new * VirtualColumnNode for each ResultColumn.expression.) * * This is useful for UNIONs, where we want to generate a DistinctNode above * the UnionNode to eliminate the duplicates, because DistinctNodes expect * their immediate child to be a PRN. * * @return The generated ProjectRestrictNode atop the original ResultSetNode. * * @exception StandardException Thrown on error */ ResultSetNode genProjectRestrict() throws StandardException { /* We get a shallow copy of the ResultColumnList and its * ResultColumns. (Copy maintains ResultColumn.expression for now.) */ ResultColumnList prRCList = resultColumns; resultColumns = resultColumns.copyListAndObjects(); /* Replace ResultColumn.expression with new VirtualColumnNodes * in the ProjectRestrictNode's ResultColumnList. (VirtualColumnNodes include * pointers to source ResultSetNode, this, and source ResultColumn.) */ prRCList.genVirtualColumnNodes(this, resultColumns); /* Finally, we create the new ProjectRestrictNode */ return new ProjectRestrictNode( this, prRCList, null, /* Restriction */ null, /* Restriction as PredicateList */ null, /* Project subquery list */ null, /* Restrict subquery list */ null, getContextManager()); } /** * Put a ProjectRestrictNode on top of each FromTable in the FromList. * ColumnReferences must continue to point to the same ResultColumn, so * that ResultColumn must percolate up to the new PRN. However, * that ResultColumn will point to a new expression, a VirtualColumnNode, * which points to the FromTable and the ResultColumn that is the source for * the ColumnReference. * (The new PRN will have the original of the ResultColumnList and * the ResultColumns from that list. The FromTable will get shallow copies * of the ResultColumnList and its ResultColumns. ResultColumn.expression * will remain at the FromTable, with the PRN getting a new * VirtualColumnNode for each ResultColumn.expression.) * We then project out the non-referenced columns. If there are no referenced * columns, then the PRN's ResultColumnList will consist of a single ResultColumn * whose expression is 1. * * @param numTables Number of tables in the DML Statement * * @return The generated ProjectRestrictNode atop the original FromTable. * * @exception StandardException Thrown on error */ ResultSetNode genProjectRestrict(int numTables) throws StandardException { return genProjectRestrict(); } /** * Generate the code for a NormalizeResultSet. The call must push two items before calling this method <OL> <LI> pushGetResultSetFactoryExpression <LI> the expression to normalize </OL> * * @param acb The ActivationClassBuilder * @param mb The method to put the generated code in * @param resultSetNumber The result set number for the NRS * @param resultDescription The ERD for the ResultSet * * * @exception StandardException Thrown on error */ void generateNormalizationResultSet( ActivationClassBuilder acb, MethodBuilder mb, int resultSetNumber, ResultDescription resultDescription) throws StandardException { int erdNumber = acb.addItem(resultDescription); // instance and first arg are pushed by caller mb.push(resultSetNumber); mb.push(erdNumber); mb.push(getCostEstimate().rowCount()); mb.push(getCostEstimate().getEstimatedCost()); mb.push(false); mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getNormalizeResultSet", ClassName.NoPutResultSet, 6); } /** * The optimizer's decision on the access path for a result set * may require the generation of extra result sets. For example, * if it chooses an index for a FromBaseTable, we need an IndexToBaseRowNode * above the FromBaseTable (and the FromBaseTable has to change its * column list to match the index. * * This method in the parent class does not generate any extra result sets. * It may be overridden in child classes. * * @return A ResultSetNode tree modified to do any extra processing for * the chosen access path * * @exception StandardException Thrown on error */ ResultSetNode changeAccessPath() throws StandardException { return this; } /** * Search to see if a query references the specifed table name. * * @param name Table name (String) to search for. * @param baseTable Whether or not name is for a base table * * @return true if found, else false * * @exception StandardException Thrown on error */ boolean referencesTarget(String name, boolean baseTable) throws StandardException { return false; } /** * Return whether or not this ResultSetNode contains a subquery with a * reference to the specified target. * * @param name The table name. * * @return boolean Whether or not a reference to the table was found. * * @exception StandardException Thrown on error */ boolean subqueryReferencesTarget(String name, boolean baseTable) throws StandardException { return false; } /** * Return whether or not the underlying ResultSet tree will return * a single row, at most. * This is important for join nodes where we can save the extra next * on the right side if we know that it will return at most 1 row. * * @return Whether or not the underlying ResultSet tree will return a single row. * @exception StandardException Thrown on error */ boolean isOneRowResultSet() throws StandardException { // Default is false return false; } /** * Return whether or not the underlying ResultSet tree is for a NOT EXISTS * join. * * @return Whether or not the underlying ResultSet tree if for NOT EXISTS. */ boolean isNotExists() { // Default is false return false; } /** * Get the optimizer for this result set. * * @return If this.optimizer has has already been created by the * getOptimizer() method above, then return it; otherwise, * return null. */ protected OptimizerImpl getOptimizerImpl() { // Note that the optimizer might be null because it's possible that // we'll get here before any calls to getOptimizer() were made, which // can happen if we're trying to save a "best path" but we haven't // actually found one yet. In that case we just return the "null" // value; the caller must check for it and behave appropriately. // Ex. see TableOperatorNode.addOrLoadBestPlanMapping(). return (OptimizerImpl)optimizer; } /** * Get a cost estimate to use for this ResultSetNode. * * @exception StandardException Thrown on error */ protected CostEstimate getNewCostEstimate() throws StandardException { OptimizerFactory optimizerFactory = getLanguageConnectionContext().getOptimizerFactory(); return optimizerFactory.getCostEstimate(); } /** * Accept the visitor for all visitable children of this node. * * @param v the visitor * * @exception StandardException on error */ @Override void acceptChildren(Visitor v) throws StandardException { super.acceptChildren(v); if (resultColumns != null) { resultColumns = (ResultColumnList)resultColumns.accept(v); } } /** * Consider materialization for this ResultSet tree if it is valid and cost effective * (It is not valid if incorrect results would be returned.) * * @return Top of the new/same ResultSet tree. * * @exception StandardException Thrown on error */ ResultSetNode considerMaterialization(JBitSet outerTables) throws StandardException { return this; } /** * Return whether or not to materialize this ResultSet tree. * * @return Whether or not to materialize this ResultSet tree. * would return valid results. * * @exception StandardException Thrown on error */ boolean performMaterialization(JBitSet outerTables) throws StandardException { return false; } /** * Determine whether or not the specified name is an exposed name in * the current query block. * * @param name The specified name to search for as an exposed name. * @param schemaName Schema name, if non-null. * @param exactMatch Whether or not we need an exact match on specified schema and table * names or match on table id. * * @return The FromTable, if any, with the exposed name. * * @exception StandardException Thrown on error */ FromTable getFromTableByName(String name, String schemaName, boolean exactMatch) throws StandardException { if (SanityManager.DEBUG) { SanityManager.THROWASSERT("getFromTableByName() not expected to be called for " + getClass().getName()); } return null; } /** * Decrement (query block) level (0-based) for * all of the tables in this ResultSet tree. * This is useful when flattening a subquery. * * @param decrement The amount to decrement by. */ abstract void decrementLevel(int decrement); /** * Push the order by list down from the cursor node * into its child result set so that the optimizer * has all of the information that it needs to * consider sort avoidance. Presumes a new level * has been initialized by {@link #pushQueryExpressionSuffix()}. * * @param orderByList The order by list */ void pushOrderByList(OrderByList orderByList) { if (SanityManager.DEBUG) { SanityManager.THROWASSERT("pushOrderByList() not expected to be called for " + getClass().getName()); } } /** * Push down the offset and fetch first parameters, if any. This method * should be overridden by the result sets that need this. Presumes a new * level has been initialized by {@link #pushQueryExpressionSuffix()}. * * @param offset the OFFSET, if any * @param fetchFirst the OFFSET FIRST, if any * @param hasJDBClimitClause true if the clauses were added by (and have the semantics of) a JDBC limit clause */ void pushOffsetFetchFirst( ValueNode offset, ValueNode fetchFirst, boolean hasJDBClimitClause ) { if (SanityManager.DEBUG) { SanityManager.THROWASSERT( "pushOffsetFetchFirst() not expected to be called for " + getClass().getName()); } } /** * General logic shared by Core compilation and by the Replication Filter * compiler. A couple ResultSets (the ones used by PREPARE SELECT FILTER) * implement this method. * * @param acb The ExpressionClassBuilder for the class being built * @param mb The method the expression will go into * * * @exception StandardException Thrown on error */ void generateResultSet(ExpressionClassBuilder acb, MethodBuilder mb) throws StandardException { if (SanityManager.DEBUG) { SanityManager.THROWASSERT( "generateResultSet() not expected to be called for " + getClass().getName()); } } /** * Get the lock mode for the target of an update statement * (a delete or update). The update mode will always be row for * CurrentOfNodes. It will be table if there is no where clause. * * @see TransactionController * * @return The lock mode */ int updateTargetLockMode() { return TransactionController.MODE_TABLE; } /** * Mark this node and its children as not being a flattenable join. */ void notFlattenableJoin() { } /** * Return whether or not the underlying ResultSet tree * is ordered on the specified columns. * RESOLVE - This method currently only considers the outermost table * of the query block. * * @param crs The specified ColumnReference[] * @param permuteOrdering Whether or not the order of the CRs in the array can be permuted * @param fbtHolder List that is to be filled with the FromBaseTable * * @return Whether the underlying ResultSet tree * is ordered on the specified column. * * @exception StandardException Thrown on error */ boolean isOrderedOn(ColumnReference[] crs, boolean permuteOrdering, List<FromBaseTable> fbtHolder) throws StandardException { return false; } /** * Return whether or not this ResultSet tree is guaranteed to return * at most 1 row based on heuristics. (A RowResultSetNode and a * SELECT with a non-grouped aggregate will return at most 1 row.) * * @return Whether or not this ResultSet tree is guaranteed to return * at most 1 row based on heuristics. */ boolean returnsAtMostOneRow() { return false; } /** * Replace any DEFAULTs with the associated tree for the default if * allowed, or flag (when inside top level set operator nodes). Subqueries * are checked for illegal DEFAULTs elsewhere. * * @param ttd The TableDescriptor for the target table. * @param tcl The RCL for the target table. * @param allowDefaults true if allowed * * @exception StandardException Thrown on error */ void replaceOrForbidDefaults(TableDescriptor ttd, ResultColumnList tcl, boolean allowDefaults) throws StandardException { if (SanityManager.DEBUG) { SanityManager.THROWASSERT( "replaceOrForbidDefaults() not expected to be called for " + this.getClass().getName()); } } /** * Is it possible to do a distinct scan on this ResultSet tree. * (See SelectNode for the criteria.) * * @param distinctColumns the set of distinct columns * @return Whether or not it is possible to do a distinct scan on this ResultSet tree. */ boolean isPossibleDistinctScan(Set<BaseColumnNode> distinctColumns) { return false; } /** * Mark the underlying scan as a distinct scan. */ void markForDistinctScan() { if (SanityManager.DEBUG) { SanityManager.THROWASSERT( "markForDistinctScan() not expected to be called for " + getClass().getName()); } } /** * Notify the underlying result set tree that the optimizer has chosen * to "eliminate" a sort. Sort elimination can happen as part of * preprocessing (see esp. SelectNode.preprocess(...)) or it can happen * if the optimizer chooses an access path that inherently returns the * rows in the correct order (also known as a "sort avoidance" plan). * In either case we drop the sort and rely on the underlying result set * tree to return its rows in the correct order. * * For most types of ResultSetNodes we automatically get the rows in the * correct order if the sort was eliminated. One exception to this rule, * though, is the case of an IndexRowToBaseRowNode, for which we have * to disable bulk fetching on the underlying base table. Otherwise * the index scan could return rows out of order if the base table is * updated while the scan is "in progress" (i.e. while the result set * is open). * * In order to account for this (and potentially other, similar issues * in the future) this method exists to notify the result set node that * it is expected to return rows in the correct order. The result set * can then take necessary action to satsify this requirement--such as * disabling bulk fetch in the case of IndexRowToBaseRowNode. * * All of that said, any ResultSetNodes for which we could potentially * eliminate sorts should override this method accordingly. So we don't * ever expect to get here. */ void adjustForSortElimination() { if (SanityManager.DEBUG) { SanityManager.THROWASSERT( "adjustForSortElimination() not expected to be called for " + getClass().getName()); } } /** * Same goal as adjustForSortElimination above, but this version * takes a RequiredRowOrdering to allow nodes to adjust based on * the ORDER BY clause, if needed. */ void adjustForSortElimination(RequiredRowOrdering rowOrdering) throws StandardException { /* Default is to ignore the row ordering; subclasses must * override if they need to use it. */ adjustForSortElimination(); } /** * Count the number of distinct aggregates in the list. * By 'distinct' we mean aggregates of the form: * <UL><I>SELECT MAX(DISTINCT x) FROM T<\I><\UL> * * @return number of aggregates */ static int numDistinctAggregates(List<AggregateNode> aggregates) { int count = 0; int size = aggregates.size(); for (int index = 0; index < size; index++) { if ((aggregates.get(index)).isDistinct()) { count++; } } return count; } // It may be we have a SELECT view underneath a LOJ. // Return null for now.. we don't do any optimization. JBitSet LOJgetReferencedTables(int numTables) throws StandardException { if (this instanceof FromTable) { if (((FromTable)this).tableNumber != -1) { JBitSet map = new JBitSet(numTables); map.set(((FromTable)this).tableNumber); return map; } } return null; } /** * For ease of pushing order by, offset and fetch first/next clauses into * nodes. Clauses on the same nesting level have the same index in the * lists, so at any level, any of the lists' elements may be empty. For * example, * * {@code (select * from t order by a fetch next 5 rows only) order by b} * * would have * <pre> * obl[0] = "order by a", * offset[0] = null, * fetchFirst[0] = "next 5 rows" * </pre> * and * <pre> * obl[1] = "order by b", * offset[1] = null * fetchFirst[1] = null * </pre> * * When starting pushing clauses for a new level, always remember to do a * {@link #push} before adding the clauses via {@link #setOffset}, {@link * #setFetchFirst}, {@link #setOrderByList} and {@link * #setHasJDBCLimitClause}. */ static class QueryExpressionClauses { private final List<OrderByList> obl = new ArrayList<OrderByList>(); private final List<ValueNode> offset = new ArrayList<ValueNode>(); private final List<ValueNode> fetchFirst = new ArrayList<ValueNode>(); private final List<Boolean> hasJDBCLimitClause = new ArrayList<Boolean>(); public QueryExpressionClauses() { // Push one level initially; that way we won't get out-of-range // errors when checking in cases where we have no clauses. // When pushing, we reuse unused levels anyway. push(); } int size() { return obl.size(); } void push() { int s = size(); if (s > 0 && obl.get(s-1) == null && offset.get(s-1) == null && fetchFirst.get(s-1) == null) { // Reuse this level's holders since no clauses are present // here "hasJDBCLimitClause" implies offset or fetchFirst are // not null, so we don't need to check that. if (SanityManager.DEBUG) { SanityManager.ASSERT(hasJDBCLimitClause.get(s-1) == null); } } else { // Push holders for a new level obl.add(null); offset.add(null); fetchFirst.add(null); hasJDBCLimitClause.add(null); } } void setOrderByList(OrderByList obl) { this.obl.set(size() - 1, obl); } void setOffset(ValueNode v) { this.offset.set(size() - 1, v); } void setFetchFirst(ValueNode v) { this.fetchFirst.set(size() - 1, v); } void setHasJDBCLimitClause(Boolean b) { this.hasJDBCLimitClause.set(size() - 1, b); } OrderByList getOrderByList(int i) { return obl.get(i); } void setOrderByList(int i, OrderByList obl) { this.obl.set(i, obl); } ValueNode getOffset(int i) { return offset.get(i); } void setOffset(int i, ValueNode v) { this.offset.set(i, v); } ValueNode getFetchFirst(int i) { return fetchFirst.get(i); } void setFetchFirst(int i, ValueNode v) { this.fetchFirst.set(i, v); } Boolean[] getHasJDBCLimitClause() { return hasJDBCLimitClause.toArray(new Boolean[1]); } boolean hasOffsetFetchFirst() { for (ValueNode o : offset) { if (o != null) { return true; } } for (ValueNode ff : fetchFirst) { if (ff != null) { return true; } } return false; } } /** * Set up a new level for order by and fetch/offset clauses. * See Javadoc for {@link QueryExpressionClauses}. * Overridden by implementors of pushOrderByNode, pushOffsetFetchFirst. */ void pushQueryExpressionSuffix() { if (SanityManager.DEBUG) { SanityManager.NOTREACHED(); } } void printQueryExpressionSuffixClauses( int depth, QueryExpressionClauses qec) { for (int i = 0; i < qec.size(); i++) { OrderByList obl = qec.getOrderByList(i); if ( obl != null ) { printLabel(depth, "orderByLists[" + i + "]:"); obl.treePrint(depth + 1); } ValueNode offset = qec.getOffset(i); if (offset != null) { printLabel(depth, "offset:"); offset.treePrint(depth + 1); } ValueNode fetchFirst = qec.getFetchFirst(i); if (fetchFirst != null) { printLabel(depth, "fetch first/next:"); fetchFirst.treePrint(depth + 1); } Boolean hasJDBCLimitClause = qec.getHasJDBCLimitClause()[i]; if (hasJDBCLimitClause != null) { printLabel(depth, "hasJDBCLimitClause:" + hasJDBCLimitClause + "\n"); } } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
9e078461a564bc637819bbcff17e9fbe71b5faab
2c70ed46aadc343149103d0b80fa22fd21e91363
/src/main/java/Input.java
5ba2d81f8b16ff3962aadeec2f0e47ba5dba6757
[]
no_license
arthur-gamboa/maven-exercises
12407cc95ea5a9d0f9a0418728639c1fcdfa25e5
0358dd0ebed81d873f7897339955b5c15e74724d
refs/heads/main
2023-03-02T08:14:16.675979
2021-02-12T20:43:52
2021-02-12T20:43:52
338,389,215
0
0
null
null
null
null
UTF-8
Java
false
false
2,691
java
import java.util.Scanner; import java.util.Scanner; //TODO: Inside of util, create a class named Input that has a private property named scanner. public class Input { private Scanner scanner; //TODO: When an instance of this object is created, the scanner property should be set to a new instance of the Scanner class. public Input() { this.scanner = new Scanner(System.in); } //TODO: The class should have the following methods, all of which return command line input from the user: public String getString() { // return this.scanner.nextLine(); return getString("Please enter a string: "); } //TODO BONUS: Allow all of your methods for getting input to accept an optional String parameter named prompt. If passed, the method should show the given prompt to the user before parsing the input. String getString(String prompt) { System.out.println(prompt); return this.scanner.nextLine(); } public boolean yesNo() { String answer = this.scanner.nextLine(); return (answer.toLowerCase().equals("y") || answer.toLowerCase().equals("yes")); // return this.scanner.nextBoolean(); } public int getInt() { System.out.println("Please enter an integer: %n"); return this.scanner.nextInt(); // Exceptions and Error Handling Exercise Edits // int number = Integer.valueOf(getString()); // Exceptions and Error Handling Exercise Edits // return number; } public int getInt(int min, int max) { while (true) { System.out.printf("Please enter an integer between %d and %d: %n", min, max); int answer = this.scanner.nextInt(); // Exceptions and Error Handling Exercise int number; try { number = Integer.valueOf(getString()); return number; } catch (NumberFormatException nfe) { System.out.println("Wrong input, try again!"); return getInt(); } // Exceptions and Error Handling Exercise // if (answer >= min && answer <= max) { // return answer; // } } } public double getDouble() { return this.scanner.nextDouble(); } double getDouble(double min, double max) { while (true) { double answer = this.scanner.nextDouble(); if (answer >= min && answer <= max) { return answer; } } } // public int getInt(String s) { // } public static void main(String[] args) { Input in = new Input(); } }
[ "arthur.j.gamboa@gmail.com" ]
arthur.j.gamboa@gmail.com
b95bb4d099deb5daa14a959fed6578b36bf4f793
8f731ad4c5309f3e71ddd8466931b4eaee379d69
/mc2_engine/src/test/java/it/mcsquared/engine/manager/LabelsManagerTest.java
d296b66ff51212b60491429940d19e4a5ebd0332
[]
no_license
mcorallo/mc2
e0434d1dac7c523532a385229a8fa07bdce49d1a
0e8b7c74308d6b20b819a75d14fdef6a42ae51e0
refs/heads/master
2021-01-10T07:25:53.136235
2016-01-07T22:17:59
2016-01-07T22:17:59
49,230,366
1
0
null
null
null
null
UTF-8
Java
false
false
3,773
java
package it.mcsquared.engine.manager; import static org.junit.Assert.assertEquals; import java.text.DecimalFormatSymbols; import java.util.Locale; import org.junit.Test; import it.mcsquared.engine.Mc2Engine; import it.mcsquared.engine.test.GenericTest; public class LabelsManagerTest extends GenericTest { private Mc2Engine engine = getEngine(); @Test public void getLabelTest() throws Exception { LabelsManager labelsManager = engine.newLabelsManager(); String label; //default locale not found test label = labelsManager.get("none"); assertEquals("NOT FOUND: none [en_US]", label); //default locale empty test //used in test environments when no label value has been defined, but the label is declared. in production env the result would be an empty string label = labelsManager.get("test.empty"); assertEquals("EMPTY: test.empty [en_US]", label); //default locale test label = labelsManager.get("test"); assertEquals("test english", label); //specific locale test label = labelsManager.getLabel(Locale.ITALY.toString(), "test"); assertEquals("test italiano", label); //other specific locale test label = labelsManager.getLabel(Locale.US.toString(), "test"); assertEquals("test english", label); //default locale test label = labelsManager.get("test"); assertEquals("test english", label); //change instance locale test labelsManager.setLocale(Locale.ITALY); label = labelsManager.get("test"); assertEquals("test italiano", label); //fallback to default locale label = labelsManager.getLabel("FAKE", "test"); assertEquals("test english", label); } @Test public void getLabelFormattedTest() throws Exception { LabelsManager labelsManager = engine.newLabelsManager(); labelsManager.setDefaultLocale(); String label; //formatted string test label = labelsManager.getLabelFormatted("test.formatted.string", "engine"); assertEquals("test engine", label); //formatted integer test label = labelsManager.getLabelFormatted("test.formatted.integer", 100); assertEquals("test 100", label); //formatted decimal test label = labelsManager.getLabelFormatted("test.formatted.decimal", 100d); String c = System.getProperty("user.country"); String l = System.getProperty("user.language"); char decimalSeparator = new DecimalFormatSymbols(Locale.forLanguageTag(l + "-" + c)).getDecimalSeparator(); assertEquals("test 100" + decimalSeparator + "000000", label); } @Test public void getHtmlTest() throws Exception { LabelsManager labelsManager = engine.newLabelsManager(); labelsManager.setDefaultLocale(); String label; //html string test label = labelsManager.getEscapedHtml("test.html"); assertEquals("&lt;span&gt;this is an html test &amp;gt;&lt;/span&gt;", label); } @Test public void getLabelValuesTest() throws Exception { LabelsManager labelsManager = engine.newLabelsManager(); labelsManager.setDefaultLocale(); String[] labels; //default locale test labels = labelsManager.getLabelValues("test.values"); assertEquals(2, labels.length); //specific locale test labels = labelsManager.getLabelValues(Locale.ITALY.toString(), "test.values"); assertEquals(3, labels.length); //other specific locale test labels = labelsManager.getLabelValues(Locale.US.toString(), "test.values"); assertEquals(2, labels.length); //default locale test labels = labelsManager.getLabelValues("test.values"); assertEquals(2, labels.length); //change instance locale test labelsManager.setLocale(Locale.ITALY); labels = labelsManager.getLabelValues("test.values"); assertEquals(3, labels.length); //fallback to default locale labels = labelsManager.getLabelValues("FAKE", "test.values"); assertEquals(2, labels.length); } }
[ "mcorallo74@gmail.com" ]
mcorallo74@gmail.com
ed85d77f5ec5c60101876830c952a7c554c65c5c
db89bb6f57ca6b31a744a891a3b6525f838af215
/src/main/java/finalyear/project/cse/database/YouTubeObject.java
2ba522de1b60173a11582c293eae341c2a2b02ca
[]
no_license
KamalAres/FinalYearProject
8a476e443f037c1aa8308cb0e9b5b1ee5f2a8881
d8b6b6fa968c99cd6bdc5999b638bce7e7ef8972
refs/heads/main
2023-06-25T10:10:45.702063
2021-07-30T11:43:07
2021-07-30T11:43:07
391,010,606
0
0
null
null
null
null
UTF-8
Java
false
false
5,077
java
package finalyear.project.cse.database; import com.google.api.client.util.ArrayMap; import com.google.api.services.youtube.model.ResourceId; import finalyear.project.cse.comments.ImageCache; import javafx.scene.image.Image; import java.io.Serializable; import java.util.Objects; import java.util.stream.Stream; /** * Similarities between GroupItem, YouTubeChannel, YouTubeComment, and YouTubeVideo. * */ public abstract class YouTubeObject implements ImageCache, Serializable { private String id; private String title; private String thumbUrl; // Transient, we don't want this in export file. private transient YType typeId; /** * This field differs from what's returned by {@link #buildYouTubeLink()} because it is used solely by * {@link GroupItem} as part of field duplication. */ private transient String youTubeLink; public YouTubeObject() { typeId = YType.UNKNOWN; } /** * @param id id of the youtube video, playlist, channel * @param title video title, playlist name, channel name * @param thumbUrl url of thumbnail, profile picture */ public YouTubeObject(final String id, final String title, final String thumbUrl) { this.id = id; this.title = title; this.thumbUrl = thumbUrl; } /** * Constructor for SearchResult where search results could be of any type (video, channel, playlist) * * @param id resourceId from {@link com.google.api.services.youtube.model.SearchResult} * @param title video title, playlist name, channel name * @param thumbUrl url of thumbnail, profile picture */ public YouTubeObject(final ResourceId id, final String title, final String thumbUrl) { this.id = getIdFromResource(id); this.title = title; this.thumbUrl = thumbUrl; } public YType getTypeId() { return typeId; } public void setTypeId(YType typeId) { this.typeId = typeId; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getThumbUrl() { return thumbUrl; } public void setThumbUrl(String thumbUrl) { this.thumbUrl = thumbUrl; } public String getYouTubeLink() { return youTubeLink; } public void setYouTubeLink(String youTubeLink) { this.youTubeLink = youTubeLink; } public String getTypeName() { return typeId.getDisplay(); } /** * The Default Thumb is a letter avatar generated by the first character in the {@link #title}. * <p> * Since the default thumb is generated, there is no load time compared to the loading * of a new Image(thumbUrl); * <p> * The actual thumb can be loaded separately in a temporary thread and replace this * default thumbnail. * * @return letter avatar image of first char of {@link #title} */ public Image getDefaultThumb() { return ImageCache.toLetterAvatar(this); } /** * Returns a full youtube link for videos, channels, playlists, and comments. * * @return full youtube link for the associated object's type */ public String buildYouTubeLink() { switch (typeId) { case VIDEO: return "https://youtu.be/" + id; case CHANNEL: return "https://www.youtube.com/channel/" + id; case PLAYLIST: return "https://www.youtube.com/playlist?list=" + id; case COMMENT: return "https://www.youtube.com/watch?v=" + (this instanceof YouTubeComment ? ((YouTubeComment) this).getVideoId() + "&lc=" + id : id); default: return "https://www.youtube.com/error/" + id; } } public String toString() { return getId(); } public boolean equals(Object o) { return o instanceof YouTubeObject && ((YouTubeObject) o).getId() != null && ((YouTubeObject) o).getId().equals(id); } /** * For some reason this value returns as an ArrayMap? Cast and return correct value from it. * * @return channelId */ public static String getChannelIdFromObject(final Object authorChannelId) { if (authorChannelId instanceof ArrayMap) { ArrayMap<String, String> value = (ArrayMap) authorChannelId; return value.get("value"); } return authorChannelId.toString(); } /** * @return id of video, channel, or playlist */ public static String getIdFromResource(final ResourceId resourceId) { return Stream.of(resourceId.getVideoId(), resourceId.getChannelId(), resourceId.getPlaylistId()) .filter(Objects::nonNull) .findFirst() .orElse(null); } }
[ "kamalkannanares@gmail.com" ]
kamalkannanares@gmail.com
18b99780832b52010fde48a577c077d99d72664d
47b71ff8a12367c10573e58289d6abbd41c2436f
/android/device/softwinner/fiber-common/prebuild/packages/TvdFileManager/src/com/softwinner/TvdFileManager/MediaProvider.java
2e0a10daeda7e69b4839fcbefd1009d7d6a9ec80
[]
no_license
BPI-SINOVOIP/BPI-A31S-Android
d567fcefb8881bcca67f9401c5a4cfa875df5640
ed63ae00332d2fdab22efc45a4a9a46ff31b8180
refs/heads/master
2022-11-05T15:39:21.895636
2017-04-27T16:58:45
2017-04-27T16:58:45
48,844,096
2
4
null
2022-10-28T10:10:24
2015-12-31T09:34:31
null
UTF-8
Java
false
false
11,437
java
package com.softwinner.TvdFileManager; import java.io.File; import java.io.FileFilter; import java.io.FileOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Comparator; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.media.videoeditor.MediaItem.GetThumbnailListCallback; import android.net.Uri; import android.os.StatFs; import android.util.Log; /** * * @author chenjd * @help <br> * 1.用于缩略图的管理 <br> * getImageThumbFromDB(String path) 从数据库中获取缩略图,返回null表示数据库中没保存该图片的缩略图数据 <br> * getImageThumbFromMK(String path) 直接生成缩略图,建议先调用第一个从数据库中取,如果没找到再调用这个方法 <br> * clearThumbnailData()清除数据库中保存的缩略图数据,调用这方法后, * 数据库中将只保留最新的MaxThumbnailNum个缩略图数据 <br> * 2.用于文件夹目录下的文件列表生成 <br> * 定义了几种的文件过滤类 <br> * getList(String, FileFilter) 根据文件的过滤类型滤出文件夹内的文件列表 */ public class MediaProvider { public static final String RETURN = "../"; public static final String NETWORK_NEIGHBORHOOD = "NetworkNeighborhoodList"; public static final String NFS_SHARE = "NFSServerList"; public static final int AUDIOTYPE = 0x01; public static final int IMAGETYPE = 0x02; public static final int VIDEOTYPE = 0x04; public static final int ALLTYPE = 0x08; public static final int DIRTYPE = 0x00; private static final int MaxThumbnailNum = 200; private int filesNum = 0; private Context context; private ImageDatabase imageDB; private static final String TAG = "MediaProvider"; private ArrayList<String> mlist; private ThumbnailCreator thumbCreator = null; public MediaProvider(Context context) { this.context = context; this.imageDB = new ImageDatabase(context); mlist = new ArrayList<String>(); } /* 定义排序方式 */ public static final Comparator alph = new Comparator<String>() { @Override public int compare(String arg0, String arg1) { File f0 = new File(arg0); File f1 = new File(arg1); /* "返回"指示永远排在第一个 */ if (arg0.equals(RETURN)) { return -1; } if (arg1.equals(RETURN)) { return 1; } /* 文件夹永远排在前面 */ try { if (f0.isDirectory() && !f1.isDirectory()) { return -1; } if (!f0.isDirectory() && f1.isDirectory()) { return 1; } } catch (SecurityException e) { e.printStackTrace(); return -1; } try { /* 否则根据名字排序 */ String str0 = arg0.substring(arg0.lastIndexOf("/") + 1); String str1 = arg1.substring(arg1.lastIndexOf("/") + 1); return str0.compareToIgnoreCase(str1); } catch (IndexOutOfBoundsException e) { e.printStackTrace(); return -1; } } }; public static final Comparator lastModified = new Comparator<String>() { @Override public int compare(String arg0, String arg1) { File f0 = new File(arg0); File f1 = new File(arg1); /* "返回"指示永远排在第一个 */ if (arg0.equals(RETURN)) { return -1; } if (arg1.equals(RETURN)) { return 1; } try { /* 文件夹永远排在前面 */ if (f0.isDirectory() && !f1.isDirectory()) { return -1; } if (!f0.isDirectory() && f1.isDirectory()) { return 1; } /* 否则根据名字排序 */ if (f0.lastModified() > f1.lastModified()) return -1; else if (f0.lastModified() == f1.lastModified()) return 0; else return 1; } catch (SecurityException e) { e.printStackTrace(); return -1; } } }; public static final Comparator size = new Comparator<String>() { @Override public int compare(String arg0, String arg1) { File f0 = new File(arg0); File f1 = new File(arg1); if (arg0.equals(RETURN)) { return -1; } if (arg1.equals(RETURN)) { return 1; } try { if (f0.isDirectory() && !f1.isDirectory()) { return -1; } if (!f0.isDirectory() && f1.isDirectory()) { return 1; } if (f0.length() > f1.length()) return -1; else if (f0.length() == f1.length()) return 0; else return 1; } catch (SecurityException e) { e.printStackTrace(); return -1; } } }; /* 定义文件过滤器 */ public FileFilter MUSIC_FILTER = new FileFilter() { @Override public boolean accept(File pathname) { // TODO Auto-generated method stub // keep all needed files try { if (pathname.isDirectory()) { filesNum++; return true; } } catch (SecurityException e) { e.printStackTrace(); return false; } String name = pathname.getAbsolutePath(); if (TypeFilter.isMusicFile(name)) { filesNum++; return true; } return false; } }; public FileFilter MOVIE_FILTER = new FileFilter() { @Override public boolean accept(File pathname) { // TODO Auto-generated method stub // keep all needed files try { if (pathname.isDirectory()) { filesNum++; return true; } } catch (SecurityException e) { e.printStackTrace(); return false; } String name = pathname.getAbsolutePath(); if (TypeFilter.isMovieFile(name)) { filesNum++; return true; } return false; } }; public FileFilter PICTURE_FILTER = new FileFilter() { @Override public boolean accept(File pathname) { // TODO Auto-generated method stub // keep all needed files try { if (pathname.isDirectory()) { filesNum++; return true; } } catch (SecurityException e) { e.printStackTrace(); return false; } String name = pathname.getAbsolutePath(); if (TypeFilter.isPictureFile(name)) { filesNum++; return true; } return false; } }; public FileFilter ALLTYPE_FILTER = new FileFilter() { @Override public boolean accept(File pathname) { filesNum++; return true; } }; public int getFilesNum() { return filesNum; } public ArrayList<String> getList(String path, FileFilter type) { filesNum = 0; mlist.clear(); mlist.add(RETURN); File file = new File(path); File[] fileList = null; if (file.canRead()) { fileList = file.listFiles(type); } DeviceManager devMng = new DeviceManager(context); int i = 0; if (fileList != null) { /* 处理多分区的情况 */ if (devMng.getLocalDevicesList().contains(path) && devMng.hasMultiplePartition(path)) { for (i = 0; i < fileList.length; i++) { try { String child = fileList[i].getAbsolutePath(); StatFs statFs = new StatFs(child); Log.d("chen", "child:" + child + " block num:" + statFs.getBlockCount() + " avail block num:" + statFs.getAvailableBlocks()); if (statFs.getBlockCount() != 0) { mlist.add(child); } } catch (Exception e) { } } } else { for (i = 0; i < fileList.length; i++) { scanFile(fileList[i]); mlist.add(fileList[i].getAbsolutePath()); } } } return (ArrayList<String>) mlist.clone(); } private void scanFile(File file) { String path = file.getAbsolutePath(); if (TypeFilter.isMusicFile(path)) { /* * notify the media to scan */ Uri mUri = Uri.fromFile(file); Intent mIntent = new Intent(); mIntent.setData(mUri); mIntent.setAction(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); context.sendBroadcast(mIntent); } } /** * 从数据库中查询返回缩略图 * * @param origPath * @return null如果查询不到该缩略图文件 */ public Bitmap getImageThumbFromDB(String origPath) { final int ORIG_PATH_COLUMN = 0; final int THUMB_PATH_COLUMN = 1; String[] columns = { ImageDatabase.ORIG_PATH, ImageDatabase.THUMB_PATH }; String selection = ImageDatabase.ORIG_PATH + "=?"; String Args[] = { origPath }; Bitmap thumbnail = null; Cursor c = imageDB.query(columns, selection, Args, null); // 如果从数据库中找到该原图的缩量图,则直接使用 if (c != null) { try { while (c.moveToNext()) { String thumbPath = c.getString(THUMB_PATH_COLUMN); thumbnail = BitmapFactory.decodeFile(thumbPath); break; } } finally { c.close(); c = null; } } return thumbnail; } /** * * @param origPath * 源图片文件路径 * @param width * 缩略图设定宽度 * @param height * 缩略图设定高度 * @return 返回缩略图,失败返回null */ public Bitmap getImageThumbFromMK(String origPath, int width, int height) { // 产生缩略图,并把该文件存到指定目录下,更新数据库中图片信息 Bitmap thumbnail = null; Log.d(TAG, origPath + ":make thumbnail and insert message in database"); ThumbnailCreator mCreator = new ThumbnailCreator(width, height); thumbnail = mCreator.createThumbnail(origPath); if (thumbnail == null) { return null; } String name = null; try { name = origPath.substring(origPath.lastIndexOf("/") + 1, origPath.lastIndexOf(".")); } catch (IndexOutOfBoundsException e) { e.printStackTrace(); return null; } try { File f = new File(imageDB.getAppDir() + "/" + name); FileOutputStream fOut = null; fOut = new FileOutputStream(f); thumbnail.compress(Bitmap.CompressFormat.JPEG, 100, fOut); fOut.flush(); fOut.close(); imageDB.insert(origPath, f.getPath()); } catch (Exception e) { // TODO Auto-generated catch block Log.d(TAG, "create temp file false"); e.printStackTrace(); } return thumbnail; } /** * 清除数据库中暂存的缩略图信息及对应的缩略图文件,需要在每次退出程序前清除过时的信息,只保留MaxThumbnailNum个缩略图信息, * 防止暂存区不断扩大 */ public void clearThumbnailData() { final int ORIG_PATH_COLUMN = 0; final int THUMB_PATH_COLUMN = 1; final int CREATE_TIME = 2; String[] columns = { ImageDatabase.ORIG_PATH, ImageDatabase.THUMB_PATH, ImageDatabase.CREATE_TIME }; String sort = ImageDatabase.CREATE_TIME + " DESC"; // 按降序整理查询的结果 Cursor c = imageDB.query(columns, null, null, sort); int i = 0; if (c != null) { try { while (c.moveToNext()) { i++; // 删除第MaxThumbnailNum以后个图片及其信息 if (i > MaxThumbnailNum) { String thumbPath = c.getString(THUMB_PATH_COLUMN); String origPath = c.getString(ORIG_PATH_COLUMN); File file = new File(thumbPath); try { if (file.delete()) { imageDB.delete(origPath); } } catch (SecurityException e) { } } } } finally { c.close(); c = null; } } else { Log.d(TAG, "cursor is null"); } } public void closeDB() { imageDB.closeDatabase(); } }
[ "mingxin.android@gmail.com" ]
mingxin.android@gmail.com
0d246f8b38cc46dc74064a1311b27ccc5e61ea89
a0dbf31feae5bac7b50936eebeca0cea20e0f9d8
/mycms-main/src/main/java/pl/codecity/main/controller/guest/PageDescribeController.java
87a2f91769abe84e08904f7cbe266f906895374b
[ "Apache-2.0" ]
permissive
stamich/myCms
bbfdf299acd9817e5e01cc9db3dac0d2aa35c21a
6a51e5fa7448041d34a7bda5977291da568f11ba
refs/heads/master
2020-04-05T03:23:41.773092
2019-02-06T11:18:19
2019-02-06T11:18:19
156,512,631
1
1
null
null
null
null
UTF-8
Java
false
false
3,530
java
package pl.codecity.main.controller.guest; import org.springframework.util.AntPathMatcher; import org.springframework.util.CollectionUtils; import org.springframework.util.PathMatcher; import org.springframework.web.servlet.HandlerMapping; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.mvc.AbstractController; import org.springframework.web.util.UrlPathHelper; import pl.codecity.main.controller.support.BlogLanguageMethodArgumentResolver; import pl.codecity.main.controller.support.HttpNotFoundException; import pl.codecity.main.controller.support.LanguageUrlPathHelper; import pl.codecity.main.model.Blog; import pl.codecity.main.model.BlogLanguage; import pl.codecity.main.model.Page; import pl.codecity.main.model.Post; import pl.codecity.main.request.PageSearchRequest; import pl.codecity.main.service.BlogService; import pl.codecity.main.service.PageService; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.Map; public class PageDescribeController extends AbstractController { private static final String PATH_PATTERN = "/**/{code}"; private BlogService blogService; private PageService pageService; private UrlPathHelper urlPathHelper; public PageDescribeController(BlogService blogService, PageService pageService) { this.blogService = blogService; this.pageService = pageService; this.urlPathHelper = new LanguageUrlPathHelper(blogService); } public BlogService getBlogService() { return blogService; } public PageService getPageService() { return pageService; } @Override protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { BlogLanguage blogLanguage = (BlogLanguage) request.getAttribute(BlogLanguageMethodArgumentResolver.BLOG_LANGUAGE_ATTRIBUTE); if (blogLanguage == null) { Blog blog = blogService.getBlogById(Blog.DEFAULT_ID); blogLanguage = blog.getLanguage(blog.getDefaultLanguage()); } String path = urlPathHelper.getLookupPathForRequest(request); PathMatcher pathMatcher = new AntPathMatcher(); if (!pathMatcher.match(PATH_PATTERN, path)) { throw new HttpNotFoundException(); } Map<String, String> variables = pathMatcher.extractUriTemplateVariables(PATH_PATTERN, path); request.setAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE, variables); Page page = pageService.getPageByCode(variables.get("code"), blogLanguage.getLanguage()); if (page == null) { page = pageService.getPageByCode(variables.get("code"), blogLanguage.getBlog().getDefaultLanguage()); } if (page == null) { throw new HttpNotFoundException(); } if (page.getStatus() != Post.Status.PUBLISHED) { throw new HttpNotFoundException(); } return createModelAndView(page); } protected ModelAndView createModelAndView(Page page) { ModelAndView modelAndView = new ModelAndView(); List<Long> ids = pageService.getPageIds(new PageSearchRequest().withStatus(Post.Status.PUBLISHED)); if (!CollectionUtils.isEmpty(ids)) { int index = ids.indexOf(page.getId()); if (index < ids.size() - 1) { Page next = pageService.getPageById(ids.get(index + 1)); modelAndView.addObject("next", next); } if (index > 0) { Page prev = pageService.getPageById(ids.get(index - 1)); modelAndView.addObject("prev", prev); } } modelAndView.addObject("page", page); modelAndView.setViewName("page/describe"); return modelAndView; } }
[ "m.ski@poczta.fm" ]
m.ski@poczta.fm
dd1f91fd472f101b11677dfa22d9b205de101b4f
dede54d45b6e21b908657bc1bd5a17d88f282127
/src/main/java/com/san/pro/service/CredentialService.java
5a738968b1e2c6b9b6727f0a30775da52ac6ea86
[]
no_license
sandy1516/ManageCredentials
ba35acb8ce68c2845baecc8474e9978e52d0e4f7
098e0c29cbf4ed7cae260300ce96e9776c2fa364
refs/heads/master
2021-01-19T10:00:17.590878
2018-04-13T11:24:05
2018-04-13T11:24:05
87,809,867
0
0
null
null
null
null
UTF-8
Java
false
false
215
java
package com.san.pro.service; import java.util.List; import com.san.pro.model.Credential; public interface CredentialService { public void addCredential(Credential credential); public List<Credential> list(); }
[ "sandeep_k@MEDUSA.LOCAL" ]
sandeep_k@MEDUSA.LOCAL
b47b3a6ea04ec1494a812e2520e91e486ef0afeb
976fcae6b351df56b7764d64fb3c50fae9ce0849
/src/main/java/com/tutorial/java/JavaApplication.java
16b9701bf7dbe9fb131d853f895dd26986ed3984
[]
no_license
SidaouiBilel/Spring
04cac902917780c41e236de5ad2ff5c6e41ef86b
c5842da2b092a084b4aff4a3564d6152afc55ab6
refs/heads/master
2020-04-08T07:55:07.878571
2018-11-26T11:14:00
2018-11-26T11:14:00
159,157,010
0
0
null
null
null
null
UTF-8
Java
false
false
305
java
package com.tutorial.java; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class JavaApplication { public static void main(String[] args) { SpringApplication.run(JavaApplication.class, args); } }
[ "bilel.sidaoui@ensi-uma.tn" ]
bilel.sidaoui@ensi-uma.tn
b46b0ce9ace0c7cf575c75eb94ea4b5a58c811c7
8d64c5f1a65b6ed55f4f76bb0d165c2cdd0a9e57
/src/main/java/com/geekcattle/controller/console/DistribController.java
c50423962ade33f0ea7bd6465b9f3c2113022b21
[ "Apache-2.0" ]
permissive
amanifree/SpringBootAdmin-master
9870dfea17c20b4ec2dfe2f68b38e74191e36859
c331dbbbde4367f6bf87c646c3169a2b41d682bd
refs/heads/master
2021-05-02T12:08:43.371782
2018-02-08T08:48:18
2018-02-08T08:48:18
120,737,047
0
0
null
null
null
null
UTF-8
Java
false
false
14,083
java
/* * Copyright (c) 2017 <l_iupeiyu@qq.com> All rights reserved. */ package com.geekcattle.controller.console; import com.geekcattle.model.console.Admin; import com.geekcattle.model.console.Distrib; import com.geekcattle.model.console.Role; import com.geekcattle.service.console.AdminRoleService; import com.geekcattle.service.console.DistribService; import com.geekcattle.service.console.RoleService; import com.geekcattle.util.DateUtil; import com.geekcattle.util.ReturnUtil; import com.geekcattle.util.UuidUtil; import com.github.pagehelper.PageInfo; import org.apache.commons.lang3.StringUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.Model; import org.springframework.ui.ModelMap; import org.springframework.validation.BindingResult; import org.springframework.validation.ObjectError; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import javax.validation.Valid; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import static com.geekcattle.core.shiro.AdminShiroUtil.getUserInfo; /** * author geekcattle * date 2016/10/21 0021 下午 15:58 */ @Controller @RequestMapping("/console/distrib") public class DistribController { private Logger logger = LoggerFactory.getLogger(this.getClass()); @Autowired private AdminRoleService adminRoleService; @Autowired private RoleService roleService; @Autowired private DistribService distribService; @RequiresPermissions("distrib:index") @RequestMapping(value = "/index", method = {RequestMethod.GET}) public String index(Model model) { return "console/distrib/index"; } @RequiresPermissions("distrib:edit") @RequestMapping(value = "/form", method = {RequestMethod.GET}) public String from(Distrib distrib, Model model) { String checkRoleId = ""; if (!StringUtils.isEmpty(distrib.getUid())) { distrib = distribService.getById(distrib.getUid()); if (!"null".equals(distrib)) { distrib.setUpdatedat(DateUtil.getCurrentTime()); } }else { } model.addAttribute("distrib", distrib); return "/console/distrib/form"; } @RequiresPermissions("distrib:edit") @RequestMapping(value = "/formlayer", method = {RequestMethod.GET}) public String fromlayer(Distrib distrib, Model model) { String checkRoleId = ""; if (!StringUtils.isEmpty(distrib.getUid())) { distrib = distribService.getById(distrib.getUid()); if (!"null".equals(distrib)) { distrib.setUpdatedat(DateUtil.getCurrentTime()); } }else { } model.addAttribute("distrib", distrib); return "/console/distrib/formlayer"; } /* private List<Distrib> getDistribList() { ModelMap map = new ModelMap(); List<Distrib> DistribList = distribService.getFromAll(); return DistribList; }*/ @RequiresPermissions("distrib:index") @RequestMapping(value = "/list", method = {RequestMethod.GET}) @ResponseBody public ModelMap list(Distrib distrib) { ModelMap map = new ModelMap(); List<Distrib> Lists = distribService.getPageList(distrib); map.put("pageInfo", new PageInfo<Distrib>(Lists)); map.put("queryParam", distrib); return ReturnUtil.Success("加载成功", map, null); } @RequiresPermissions("distrib:index") @RequestMapping(value = "/listrole", method = {RequestMethod.GET}) @ResponseBody public ModelMap listRole(Distrib distrib) { HashMap<String,Object> params = new HashMap<>(); ModelMap map = new ModelMap(); List<Integer> list = new ArrayList<>(); Admin admin = getUserInfo(); List<Role> rolelist = roleService.selectRoleListByAdminId(admin.getUid()); for (Role role : rolelist) { if (role.getRoleName().equals("配送单据录入")){ list.add(1); list.add(2); list.add(3); list.add(4); list.add(5); list.add(6); list.add(7); list.add(8); list.add(9); list.add(10); list.add(11); } /*if (role.getRoleName().equals("数据部数据")){ list.add(1); } if (role.getRoleName().equals("仓储配货复核")){ list.add(2); } if (role.getRoleName().equals("配送物流数据")){ list.add(3); list.add(4); //list.add(5); }*/ } params.put("list",list); List<Distrib> Lists = distribService.getPageListByRole(params); map.put("pageInfo", new PageInfo<Distrib>(Lists)); map.put("queryParam", distrib); return ReturnUtil.Success("加载成功", map, null); } @Transactional @RequiresPermissions("distrib:save") @RequestMapping(value = "/save", method = {RequestMethod.POST}) @ResponseBody public ModelMap save(@Valid Distrib distrib, BindingResult result) { if (result.hasErrors()) { for (ObjectError er : result.getAllErrors()) return ReturnUtil.Error(er.getDefaultMessage(), null, null); } try { if (StringUtils.isEmpty(distrib.getUid())) { distrib.setUid(UuidUtil.getUUID()); distrib.setCreatedat(DateUtil.getCurrentTime()); distrib.setUpdatedat(DateUtil.getCurrentTime()); timeEmptyToNull(distrib); distrib.setState(1); distribService.insert(distrib); } else { distrib.setUpdatedat(DateUtil.getCurrentTime()); timeEmptyToNull(distrib); distrib.setState(distrib.getState()+1); distribService.save(distrib); } return ReturnUtil.Success("操作成功", null, "/console/distrib/index"); } catch (Exception e) { e.printStackTrace(); return ReturnUtil.Error("操作失败", null, null); } } /* public ModelMap save(@Valid Distrib Distrib, BindingResult result) { try { if (result.hasErrors()) { for (ObjectError er : result.getAllErrors()) return ReturnUtil.Error(er.getDefaultMessage(), null, null); } if (StringUtils.isEmpty(Distrib.getUid())) { Example example = new Example(Admin.class); example.createCriteria().andCondition("username = ", Distrib.getUsername()); Integer userCount = distribService.getCount(example); if (userCount > 0) { return ReturnUtil.Error("用户名已存在", null, null); } if (StringUtils.isEmpty(Distrib.getPassword())) { return ReturnUtil.Error("密码不能为空", null, null); } String Id = UuidUtil.getUUID(); admin.setUid(Id); String salt = new SecureRandomNumberGenerator().nextBytes().toHex(); admin.setSalt(salt); String password = PasswordUtil.createAdminPwd(admin.getPassword(), admin.getCredentialsSalt()); admin.setPassword(password); admin.setIsSystem(0); admin.setCreatedAt(DateUtil.getCurrentTime()); admin.setUpdatedAt(DateUtil.getCurrentTime()); adminService.insert(admin); } else { Admin updateAdmin = adminService.getById(admin.getUid()); if (!"null".equals(updateAdmin)) { admin.setSalt(updateAdmin.getSalt()); if (!StringUtils.isEmpty(admin.getPassword())) { String password = PasswordUtil.createAdminPwd(admin.getPassword(), updateAdmin.getCredentialsSalt()); admin.setPassword(password); } else { admin.setPassword(updateAdmin.getPassword()); } admin.setUpdatedAt(DateUtil.getCurrentTime()); adminService.save(admin); } else { return ReturnUtil.Error("操作失败", null, null); } } if (admin.getRoleId() != null) { adminRoleService.deleteAdminId(admin.getUid()); for (String roleid : admin.getRoleId()) { AdminRole adminRole = new AdminRole(); adminRole.setAdminId(admin.getUid()); adminRole.setRoleId(roleid); adminRoleService.insert(adminRole); } }else{ adminRoleService.deleteAdminId(admin.getUid()); } return ReturnUtil.Success("操作成功", null, "/console/admin/index"); } catch (Exception e) { e.printStackTrace(); return ReturnUtil.Error("操作失败", null, null); } }*/ /* @RequiresPermissions("Distrib:editpwd") @RequestMapping(value = "/savepwd", method = {RequestMethod.POST}) @ResponseBody public ModelMap editPwd(String uid, String password) { try { if (StringUtils.isNotEmpty(uid) && StringUtils.isNotEmpty(password)) { Admin admin = adminService.getById(uid); if (!"null".equals(admin)) { String newPassword = PasswordUtil.createAdminPwd(password, admin.getSalt()); Admin pwdAdmin = new Admin(); pwdAdmin.setPassword(newPassword); Example example = new Example(Admin.class); example.createCriteria().andCondition("uid", uid); adminService.updateExample(pwdAdmin, example); return ReturnUtil.Success("操作成功", null, null); } else { return ReturnUtil.Error("对像不存在,修改失败", null, null); } } else { return ReturnUtil.Error("参数错误,修改失败", null, null); } } catch (Exception e) { e.printStackTrace(); return ReturnUtil.Error("修改失败", null, null); } }*/ @RequiresPermissions("distrib:delete") @RequestMapping(value = "/delete", method = {RequestMethod.GET}) @ResponseBody public ModelMap delete(String[] ids) { try { if (ids != null) { if (StringUtils.isNotBlank(ids.toString())) { for (String id : ids) { //adminRoleService.deleteAdminId(id); distribService.deleteById(id); } } return ReturnUtil.Success("删除成功", null, null); } else { return ReturnUtil.Error("删除失败", null, null); } } catch (Exception e) { e.printStackTrace(); return ReturnUtil.Error("删除失败", null, null); } } public Distrib timeEmptyToNull(Distrib distrib){ if(!distrib.getShipmentTime().equals(null) && distrib.getShipmentTime().isEmpty()){ distrib.setShipmentTime(null); }; if(!distrib.getOrderBegin().equals(null) && distrib.getOrderBegin().isEmpty()){ distrib.setOrderBegin(null); }; if(!distrib.getOrderEnd().equals(null) && distrib.getOrderEnd().isEmpty()){ distrib.setOrderEnd(null); }; //if( "".equals(distrib.getPickBegin())){ if(!distrib.getPickBegin().equals(null) && distrib.getPickBegin().isEmpty()){ distrib.setPickBegin(null); }; if(!distrib.getPickEnd().equals(null) && distrib.getPickEnd().isEmpty()){ distrib.setPickEnd(null); }; if(!distrib.getDataBegin().equals(null) && distrib.getDataBegin().isEmpty()){ distrib.setDataBegin(null); }; if(!distrib.getDataEnd().equals(null) && distrib.getDataEnd().isEmpty()){ distrib.setDataEnd(null); }; if(!distrib.getDistribCheckBegin().equals(null) && distrib.getDistribCheckBegin().isEmpty()){ distrib.setDistribCheckBegin(null); }; if(!distrib.getDistribCheckEnd().equals(null) && distrib.getDistribCheckEnd().isEmpty()){ distrib.setDistribCheckEnd(null); }; if(!distrib.getDistribPackBegin().equals(null) && distrib.getDistribPackBegin().isEmpty()){ distrib.setDistribPackBegin(null); }; if(!distrib.getDistribPackEnd().equals(null) && distrib.getDistribPackEnd().isEmpty()){ distrib.setDistribPackEnd(null); }; if(!distrib.getDistribBegin().equals(null) && distrib.getDistribBegin().isEmpty()){ distrib.setDistribBegin(null); }; if(!distrib.getDistribEnd().equals(null) && distrib.getDistribEnd().isEmpty()){ distrib.setDistribEnd(null); }; if(!distrib.getSendoutTime().equals(null) && distrib.getSendoutTime().isEmpty()){ distrib.setSendoutTime(null); }; if(!distrib.getArrivalTime().equals(null) && distrib.getArrivalTime().isEmpty()){ distrib.setArrivalTime(null); }; if(!distrib.getCreatedat().equals(null) && distrib.getCreatedat().isEmpty()){ distrib.setCreatedat(null); }; return distrib; }; }
[ "nh_hyf@163.com" ]
nh_hyf@163.com
6001b79f121b095e4163b53daae452632e0ede62
05b4eada05984343dd343672b688fa0ccb85f65a
/src/main/java/com/cssl/vo/UsersVo.java
c1f016d27dc2b1e14128e3b1b14f0246bd61e874
[]
no_license
startym/easyui
e390bd54af5120a1093dece880de924c8544638d
cbe21614471d14e5542d7692774d7e21dce9c345
refs/heads/master
2020-04-12T21:57:43.707372
2018-12-22T03:11:10
2018-12-22T03:11:10
162,777,408
1
1
null
null
null
null
UTF-8
Java
false
false
987
java
package com.cssl.vo; import java.util.Date; public class UsersVo { private int id; private String username; private String password; private Date bornDate; private Message msg; public Message getMsg() { return msg; } public void setMsg(Message msg) { this.msg = msg; } public Date getBornDate() { return bornDate; } public void setBornDate(Date bornDate) { this.bornDate = bornDate; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getUsername() { return username; } public void setUsername(String username) { System.out.println("set:"+username); this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public UsersVo(int id, String username, String password) { super(); this.id = id; this.username = username; this.password = password; } public UsersVo() { super(); } }
[ "183031250@qq.com" ]
183031250@qq.com
1a6d0619da496dace45d90f512764ef6f5fe41c8
a634abe28714c187057cdf9e0b469a6de1b3647e
/app/src/main/java/org/jboss/hal/client/accesscontrol/GroupColumn.java
464639585f8604969eef948d14ef9e0e74b98baa
[ "Apache-2.0" ]
permissive
hal/console
23328a2ee8dd640e53cff81eaf1c519e3a98f024
32cbfefaa7ca9254e439dbd787bda58d8490b6e7
refs/heads/main
2023-08-21T11:06:39.446971
2023-08-16T06:17:17
2023-08-16T06:17:17
38,317,187
31
105
Apache-2.0
2023-09-14T21:26:53
2015-06-30T15:26:19
Java
UTF-8
Java
false
false
2,227
java
/* * Copyright 2022 Red Hat * * 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 org.jboss.hal.client.accesscontrol; import javax.inject.Inject; import javax.inject.Provider; import org.jboss.hal.config.User; import org.jboss.hal.core.accesscontrol.AccessControl; import org.jboss.hal.core.accesscontrol.Principal; import org.jboss.hal.core.finder.ColumnActionFactory; import org.jboss.hal.core.finder.Finder; import org.jboss.hal.dmr.dispatch.Dispatcher; import org.jboss.hal.flow.Progress; import org.jboss.hal.resources.Ids; import org.jboss.hal.resources.Resources; import org.jboss.hal.spi.AsyncColumn; import org.jboss.hal.spi.Footer; import org.jboss.hal.spi.Requires; import com.google.web.bindery.event.shared.EventBus; import static org.jboss.hal.client.accesscontrol.AddressTemplates.EXCLUDE_ADDRESS; import static org.jboss.hal.client.accesscontrol.AddressTemplates.INCLUDE_ADDRESS; @AsyncColumn(Ids.GROUP) @Requires({ INCLUDE_ADDRESS, EXCLUDE_ADDRESS }) public class GroupColumn extends PrincipalColumn { @Inject public GroupColumn(Finder finder, ColumnActionFactory columnActionFactory, Dispatcher dispatcher, EventBus eventBus, @Footer Provider<Progress> progress, User currentUser, AccessControl accessControl, AccessControlTokens tokens, AccessControlResources accessControlResources, Resources resources) { super(finder, Ids.GROUP, resources.constants().group(), Principal.Type.GROUP, columnActionFactory, dispatcher, eventBus, progress, currentUser, accessControl, tokens, accessControlResources, resources); } }
[ "harald.pehl@gmail.com" ]
harald.pehl@gmail.com
c8e9391dcdc54fdc88185032971356e20afafe69
6dd240858d413bcaff8ea544677525d70ba6c774
/src/org/unclesniper/puppeteer/config/SCPCopyToWordEmitter.java
0cab61094313bf511b990008bb8e1588131efa0a
[]
no_license
UncleSniper/puppeteer
31829e5c7a94f44befd7a5fa9efd896e7b0ae1dd
9379ace198c1292eddf2b2b9ec680cee498a916b
refs/heads/master
2022-11-14T16:06:43.691015
2020-07-07T22:32:26
2020-07-07T22:32:26
264,326,276
0
0
null
null
null
null
UTF-8
Java
false
false
856
java
package org.unclesniper.puppeteer.config; import java.util.function.Consumer; import org.unclesniper.puppeteer.CopySlave; import org.unclesniper.puppeteer.PuppetException; import org.unclesniper.puppeteer.util.ShorthandName; import org.unclesniper.puppeteer.AbstractCopyToWordEmitter; @ShorthandName("scpCopyToWord") public class SCPCopyToWordEmitter extends AbstractCopyToWordEmitter { private SSHConfig config; public SCPCopyToWordEmitter() {} public SCPCopyToWordEmitter(SSHConfig config) { this.config = config; } public SSHConfig getConfig() { return config; } public void setConfig(SSHConfig config) { this.config = config; } @Override protected void buildArgvImpl(CopySlave.CopyToInfo info, Consumer<String> sink) throws PuppetException { AbstractSSHConfig.buildSCPCommand(config, info.machine, info.execHost, sink); } }
[ "simon@bausch-alfdorf.de" ]
simon@bausch-alfdorf.de
59e4ceddd121a21f6329ec288d932b3c473a1786
26a82b328efd59666b25fcc5ffbb365860446738
/SpringBoot_MicroService_MyProject_01/docker-test/src/main/java/com/controller/TestController.java
db6e9e12ff271b9d58103aa19061b241418a6776
[]
no_license
eugenfazekas/SpringBoot-MicroServices-MyProjects
a8a49db91e4cba99c52c4634719f5c62f5cdc032
851d8314b469f3350c45c7dcc92de6e3a2e05466
refs/heads/master
2023-06-12T07:43:28.527063
2021-07-06T19:12:50
2021-07-06T19:12:50
383,477,075
0
0
null
null
null
null
UTF-8
Java
false
false
264
java
package com.controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; @RestController public class TestController { @GetMapping("test") public String test() { return "Hello!"; } }
[ "skybolt83@gmail.com" ]
skybolt83@gmail.com
40833ac7d5fbdb1ae5110bfca2767da5d23e6d6a
8c85b56cc769031fc2e9ed7e62e49eb9b693e4f4
/flyme_android/app/src/main/java/me/smart/flyme/upnp/dlna/server/object/format/ImageIOFormat.java
a87c27e1dbb5d61ddc6011e93191247f5c866aae
[]
no_license
iceleeyo/FlyIM
48a1e242bce6a30f95a20f554975846f38579a65
adad01b7874678ed73d202da3ef306c46a0603be
refs/heads/master
2020-06-22T10:57:32.003802
2016-09-07T13:11:29
2016-09-07T13:11:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,154
java
/****************************************************************** * * MediaServer for CyberLink * * Copyright (C) Satoshi Konno 2003-2004 * * File : ImageIOPlugIn.java * * Revision: * * 01/25/04 * - first revision. * ******************************************************************/ package me.smart.flyme.upnp.dlna.server.object.format; import org.cybergarage.xml.AttributeList; import java.io.File; import me.smart.flyme.upnp.dlna.server.object.Format; import me.smart.flyme.upnp.dlna.server.object.FormatObject; /* import javax.imageio.*; import javax.imageio.stream.*; */ public abstract class ImageIOFormat extends Header implements Format, FormatObject { //////////////////////////////////////////////// // Member //////////////////////////////////////////////// private File imgFile; //////////////////////////////////////////////// // Constroctor //////////////////////////////////////////////// public ImageIOFormat() { imgFile = null; /* imgReader = null; */ } public ImageIOFormat(File file) { imgFile = file; /* Iterator readers = ImageIO.getImageReadersBySuffix(Header.getSuffix(file)); if (readers.hasNext() == false) return; imgReader = (ImageReader)readers.next(); try { ImageInputStream stream = ImageIO.createImageInputStream(file); imgReader.setInput(stream); } catch (Exception e) { Debug.warning(e); } */ } //////////////////////////////////////////////// // Abstract Methods //////////////////////////////////////////////// public abstract boolean equals(File file); public abstract FormatObject createObject(File file); public abstract String getMimeType(); public String getMediaClass() { return "object.item.imageItem.photo"; } public AttributeList getAttributeList() { AttributeList attrList = new AttributeList(); /* ======= /* >>>>>>> .r88 try { // Resolution (Width x Height) int imgWidth = imgReader.getWidth(0); int imgHeight = imgReader.getHeight(0); String resStr = Integer.toString(imgWidth) + "x" + Integer.toString(imgHeight); Attribute resAttr = new Attribute(ItemNode.RESOLUTION, resStr); attrList.add(resAttr); // Size long fsize = imgFile.length(); Attribute sizeStr = new Attribute(ItemNode.SIZE, Long.toString(fsize)); attrList.add(sizeStr); } catch (Exception e) { Debug.warning(e); } <<<<<<< .mine */ return attrList; } public String getTitle() { String fname = imgFile.getName(); int idx = fname.lastIndexOf("."); if (idx < 0) return ""; String title = fname.substring(0, idx); return title; } public String getCreator() { return ""; } //////////////////////////////////////////////// // print //////////////////////////////////////////////// public void print() { } //////////////////////////////////////////////// // main //////////////////////////////////////////////// /* public static void main(String args[]) { Debug.on(); try { ID3 id3 = new ID3(new File("C:/eclipse/workspace/upnp-media-server/images/SampleBGM01.mp3")); id3.print(); } catch (Exception e) { Debug.warning(e); } } */ }
[ "1067939689@qq.com" ]
1067939689@qq.com
fb5fba721cae7383d0a2208808bb98262f65aacf
759c3446a43bbaf85c1b2c4a5f5eb46351930573
/app/src/main/java/com/csii/androidviewtest/TestAndPractice/TestPathRegion.java
f6dca9732a3b657703264be3d2da9acaff5dc770
[]
no_license
zqhead/AndroidViewTest
6a14b6c2d5e92b93bc7554485178fb287faa4c62
1628ccb9d71e5a42bf5500df11760cb63f505063
refs/heads/master
2021-05-11T23:18:12.714620
2018-10-09T10:33:48
2018-10-09T10:33:48
117,511,437
1
0
null
null
null
null
UTF-8
Java
false
false
6,068
java
package com.csii.androidviewtest.TestAndPractice; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Path; import android.graphics.RectF; import android.graphics.Region; import android.support.annotation.Nullable; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; /** * 测试Path和Region的联动 * Created by zqhead on 2018/3/13. */ public class TestPathRegion extends View { private Region mRegion, centerR, upR, leftR, bottomR, rightR; private Path centerP, upP, leftP, bottomP, rightP; private Paint mPaint; private int mViewWidth, mViewHeight; private Matrix inverseMatrix; private final static int NOTHING = 0; private final static int LEFT = 1; private final static int BOTTOM = 2; private final static int RIGHT = 3; private final static int TOP = 4; private final static int CENTER = 5; private int onTouch; public TestPathRegion(Context context) { this(context, null); } public TestPathRegion(Context context, @Nullable AttributeSet attrs) { this(context, attrs, 0); } public TestPathRegion(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(); } private void init() { mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mPaint.setStyle(Paint.Style.FILL); mPaint.setColor(Color.GRAY); centerP = new Path(); upP = new Path(); leftP = new Path(); bottomP = new Path(); rightP = new Path(); centerR = new Region(); upR = new Region(); leftR = new Region(); bottomR = new Region(); rightR = new Region(); onTouch = 0; } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); mViewHeight = h; mViewWidth = w; int minWidth = w > h ? h : w; minWidth *= 0.8; RectF outerRectF = new RectF(-minWidth / 2, -minWidth / 2, minWidth / 2, minWidth / 2); RectF innerRectF = new RectF(-minWidth / 4, -minWidth / 4, minWidth / 4, minWidth / 4); mRegion = new Region(-w, -h, w, h); int outerSweepAngle = 60; int innerSweepAngle = -60; centerP.addCircle(0, 0, (float) (minWidth * 0.2), Path.Direction.CW); centerR.setPath(centerP, mRegion); /** * Path 弧度复习 两种连接方式 * addArc() 直接将arc加入Path中 无视lastPoint的位置 * ArcTo() 对比addArc多了一个boolean forceMoveTo ,true 时 和addArc相同(将path的lastPoint移动到圆弧的起始点),false时 会先将lastPoint lineTo到圆弧的起始点 ,当不设置这个参数时,默认为false * */ upP.addArc(outerRectF, 240, outerSweepAngle); upP.arcTo(innerRectF, 300, innerSweepAngle); upP.close(); upR.setPath(upP, mRegion);//setPath 可以理解为将path与mRegion的交集设置为upR的区域 rightP.addArc(outerRectF, 330, outerSweepAngle); rightP.arcTo(innerRectF, 30, innerSweepAngle); rightP.close(); rightR.setPath(rightP, mRegion); bottomP.addArc(outerRectF, 60, outerSweepAngle); bottomP.arcTo(innerRectF, 120, innerSweepAngle); bottomP.close(); bottomR.setPath(bottomP, mRegion); leftP.addArc(outerRectF, 150, outerSweepAngle); leftP.arcTo(innerRectF, 210, innerSweepAngle); leftP.close(); leftR.setPath(leftP, mRegion); } @Override protected void onDraw(Canvas canvas) { canvas.translate(mViewWidth / 2, mViewHeight / 2); if (inverseMatrix == null) { inverseMatrix = new Matrix(); canvas.getMatrix().invert(inverseMatrix); } mPaint.setColor(Color.GRAY); canvas.drawPath(centerP, mPaint); canvas.drawPath(upP, mPaint); canvas.drawPath(rightP, mPaint); canvas.drawPath(bottomP, mPaint); canvas.drawPath(leftP, mPaint); mPaint.setColor(Color.LTGRAY); if (onTouch == LEFT) { canvas.drawPath(leftP, mPaint); } else if (onTouch == BOTTOM) { canvas.drawPath(bottomP, mPaint); } else if (onTouch == RIGHT) { canvas.drawPath(rightP, mPaint); } else if (onTouch == TOP) { canvas.drawPath(upP, mPaint); } else if (onTouch == CENTER) { canvas.drawPath(centerP, mPaint); } } @Override public boolean onTouchEvent(MotionEvent event) { float[] op = new float[2]; op[0] = event.getRawX(); op[1] = event.getRawY(); //全屏幕的默认矩阵就是一个单位矩阵,通过A*A的逆=E的公式, 让全局点乘以view的canvas的矩阵的逆,就能得到全局点相对于canvas坐标系的坐标了 inverseMatrix.mapPoints(op); int x = (int)op[0]; int y = (int)op[1]; switch (event.getActionMasked()) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_MOVE: checkContains(x, y); invalidate(); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: onTouch = NOTHING; invalidate(); break; } return true; } private void checkContains(int x, int y) { if (leftR.contains(x, y)){ onTouch = LEFT; } else if (bottomR.contains(x, y)) { onTouch = BOTTOM; } else if (rightR.contains(x, y)) { onTouch = RIGHT; } else if (upR.contains(x, y)) { onTouch = TOP; } else if (centerR.contains(x, y)) { onTouch = CENTER; } else { onTouch = NOTHING; } } }
[ "zqhead@sina.com" ]
zqhead@sina.com
b753ca9064a5db53911d0c389d113cec67a637c3
447520f40e82a060368a0802a391697bc00be96f
/apks/playstore_apps/de_number26_android/source/android/support/v4/view/v.java
4f72d24a027fc80a4bf6d04dd018f05a3d90b25e
[ "Apache-2.0" ]
permissive
iantal/AndroidPermissions
7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465
d623b732734243590b5f004d167e542e2e2ae249
refs/heads/master
2023-07-19T01:29:26.689186
2019-09-30T19:01:42
2019-09-30T19:01:42
107,239,248
0
0
Apache-2.0
2023-07-16T07:41:38
2017-10-17T08:22:57
null
UTF-8
Java
false
false
1,025
java
package android.support.v4.view; import android.os.Build.VERSION; import android.support.a.a.a; import android.view.ViewGroup; public final class v { static final c a = new c(); static { if (Build.VERSION.SDK_INT >= 21) { a = new b(); return; } if (Build.VERSION.SDK_INT >= 18) { a = new a(); return; } } public static boolean a(ViewGroup paramViewGroup) { return a.a(paramViewGroup); } static class a extends v.c { a() {} } static class b extends v.a { b() {} public boolean a(ViewGroup paramViewGroup) { return paramViewGroup.isTransitionGroup(); } } static class c { c() {} public boolean a(ViewGroup paramViewGroup) { Boolean localBoolean = (Boolean)paramViewGroup.getTag(a.a.tag_transition_group); return ((localBoolean != null) && (localBoolean.booleanValue())) || (paramViewGroup.getBackground() != null) || (t.m(paramViewGroup) != null); } } }
[ "antal.micky@yahoo.com" ]
antal.micky@yahoo.com
1a948e5872cd368294adb30710d94ce791f8bb01
8472528c8d35995ccf963ecdc3198eb3e65051f0
/hk-core-jdbc/src/main/java/com/hk/core/jdbc/dialect/OracleDialect.java
05ade83f8d41416106a22073cf378c21f2bb22a0
[]
no_license
huankai/hk-core
a314499cf5796ddd81452ce66f6f8343e131f345
f97f346aefeab9471d5219a9b505e216bbf457ad
refs/heads/master
2021-05-26T08:01:20.342175
2019-12-31T09:52:12
2020-01-02T00:59:45
127,990,324
9
3
null
2019-10-11T09:35:42
2018-04-04T01:36:50
Java
UTF-8
Java
false
false
1,758
java
package com.hk.core.jdbc.dialect; import com.hk.commons.util.StringUtils; /** * @author kevin * @date 2018-09-19 10:06 */ public class OracleDialect implements Dialect { @Override public String getLimitSql(String sql, int offset, int rows) { return getLimitString(sql, offset, rows); } /** * 将sql变成分页sql语句,提供将offset及limit使用占位符号(placeholder)替换. * <pre> * 如mysql * dialect.getLimitString("select * from user", 12, ":offset",0,":limit") 将返回 * select * from user limit :offset,:limit * </pre> * * @param sql 实际SQL语句 * @param offset 分页开始纪录条数 * @return 包含占位符的分页sql */ private String getLimitString(String sql, int offset, int rows) { sql = sql.trim(); var isForUpdate = false; if (StringUtils.endsWithIgnoreCase(sql, " FOR UPDATE")) { sql = sql.substring(0, sql.length() - 11); isForUpdate = true; } var pagingSelect = new StringBuilder(sql.length() + 100); if (offset > 0) { pagingSelect.append("SELECT * FROM ( SELECT row_.*, rownum rownum_ from ( "); } else { pagingSelect.append("SELECT * FROM ( "); } pagingSelect.append(sql); if (offset > 0) { String endString = offset + "+" + rows; pagingSelect.append(" ) row_ WHERE rownum <= ").append(endString).append(") WHERE rownum_ > ").append(offset); } else { pagingSelect.append(" ) WHERE rownum <= ").append(rows); } if (isForUpdate) { pagingSelect.append(" FOR UPDATE"); } return pagingSelect.toString(); } }
[ "huankai@139.com" ]
huankai@139.com
01a2b4996664b3faff2a2020ca5f87b200b479df
0e9cc2e105437c0c7016ad53c0ff860fda5972a3
/spring/day01_eesy_01jdbc/src/main/java/com/king/service/impl/AccountServiceImpl_OLD.java
6f9bd2ab52fee05aa3cb32f6ab42e0fd4397ea61
[]
no_license
KingBoyAndGirl/Frame
8152a84dfc861a112544c21dbd223d30fe272782
96158c54f1ac130f17ef4900600aad701054df8f
refs/heads/master
2022-12-23T13:41:56.969543
2019-11-13T12:26:03
2019-11-13T12:26:03
201,935,965
0
0
null
2022-12-16T05:05:51
2019-08-12T13:28:58
JavaScript
UTF-8
Java
false
false
4,601
java
package com.king.service.impl; import com.king.dao.IAccountDao; import com.king.domain.Account; import com.king.service.IAccountService; import com.king.utils.TransactionManager; import java.util.List; /** * 账户的业务层实现类 */ public class AccountServiceImpl_OLD implements IAccountService { private IAccountDao accountDao; private TransactionManager transactionManager; public void setTransactionManager(TransactionManager transactionManager) { this.transactionManager = transactionManager; } public void setAccountDao(IAccountDao accountDao) { this.accountDao = accountDao; } @Override public List<Account> findAllAccount() { try { //1.开启事务 transactionManager.beginTransaction(); //2.执行操作 List<Account> accounts = accountDao.findAllAccount(); //3.提交事务 transactionManager.commit(); //4.返回结果 return accounts; } catch (Exception e) { //5.回滚操作 transactionManager.rollback(); throw new RuntimeException(e); } finally { //6.释放连接 transactionManager.release(); } } @Override public Account findAccountById(Integer accountId) { try { //1.开启事务 transactionManager.beginTransaction(); //2.执行操作 Account account = accountDao.findAccountById(accountId); //3.提交事务 transactionManager.commit(); //4.返回结果 return account; } catch (Exception e) { //5.回滚操作 transactionManager.rollback(); throw new RuntimeException(e); } finally { //6.释放连接 transactionManager.release(); } } @Override public void saveAccount(Account account) { try { //1.开启事务 transactionManager.beginTransaction(); //2.执行操作 accountDao.saveAccount(account); //3.提交事务 transactionManager.commit(); } catch (Exception e) { //5.回滚操作 transactionManager.rollback(); } finally { //6.释放连接 transactionManager.release(); } } @Override public void updateAccount(Account account) { try { //1.开启事务 transactionManager.beginTransaction(); //2.执行操作 accountDao.updateAccount(account); //3.提交事务 transactionManager.commit(); } catch (Exception e) { //5.回滚操作 transactionManager.rollback(); } finally { //6.释放连接 transactionManager.release(); } } @Override public void deleteAccount(Integer accountId) { try { //1.开启事务 transactionManager.beginTransaction(); //2.执行操作 accountDao.deleteAccount(accountId); //3.提交事务 transactionManager.commit(); } catch (Exception e) { //5.回滚操作 transactionManager.rollback(); } finally { //6.释放连接 transactionManager.release(); } } @Override public void transfer(String sourceName, String targetName, float money) { try { //1.开启事务 transactionManager.beginTransaction(); //2.执行操作 //2.1.根据名称查询转出账户 Account source=accountDao.findAccountByName(sourceName); //2.2.根据名称查询转入账户 Account target=accountDao.findAccountByName(targetName); //2.3.转出账户减钱 source.setMoney(source.getMoney()-money); //2.4.转入账户加钱 target.setMoney(target.getMoney()+money); //2.5.更新转出账户 accountDao.updateAccount(source); int i=1/0; //2.6.更新转入账户 accountDao.updateAccount(target); //3.提交事务 transactionManager.commit(); } catch (Exception e) { //4.回滚操作 transactionManager.rollback(); e.printStackTrace(); } finally { //5.释放连接 transactionManager.release(); } } }
[ "1782635977@qq.com" ]
1782635977@qq.com