blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 4
410
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 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
689M
⌀ | 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 131
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 32
values | content
stringlengths 3
9.45M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
313
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
56e222b28b65de6883467d67133c5bc9949eed92 | fbd783cf4eeb0757c564bd269a846180d4ea8e70 | /src/main/java/com/o2o/interceptor/shopadmin/ShopLoginInterceptor.java | cd95f95fac8ae8b0f40928512c51fd2934113c3e | [] | no_license | rzhidong/springbooto2o | 4ccd9676282971660339c3305d081e90dc2476f5 | 80dd491c101c3994d0f6148c97132ce16e4e7ca6 | refs/heads/master | 2020-04-23T00:43:21.908167 | 2019-02-18T02:50:21 | 2019-02-18T02:50:21 | 170,789,639 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,660 | java | package com.o2o.interceptor.shopadmin;
import java.io.PrintWriter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import com.o2o.entity.PersonInfo;
/**
* 店家管理系统登录验证拦截器
*
* @author ZhouCC
*
*/
public class ShopLoginInterceptor extends HandlerInterceptorAdapter {
/**
* 主要做事前拦截,即用户操作发生前,改写preHandle里的逻辑,进行拦截
*/
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
// 从session中取出用户信息来
Object userObj = request.getSession().getAttribute("user");
if (userObj != null) {
// 若用户信息不为空则将session里的用户信息转换成PersonInfo实体类对象
PersonInfo user = (PersonInfo) userObj;
// 做空值判断,确保userId不为空并且该帐号的可用状态为1,//并且用户类型为店家
if (user != null && user.getUserId() != null && user.getUserId() > 0 && user.getEnableStatus() == 1) {
// 若通过验证则返回true,拦截器返回true之后,用户接下来的操作得以正常执行
return true;
}
}
// 若不满足登录验证,则直接跳转到帐号登录页面
PrintWriter out = response.getWriter();
out.println("<html>");
out.println("<script>");
out.println("window.open ('" + request.getContextPath() + "/local/login?usertype=2','_self')");
out.println("</script>");
out.println("</html>");
return false;
}
}
| [
"[email protected]"
] | |
4c71834de97c15725e9550e1a1e3496444b04436 | e5b3a71a8eecdea42a18749527646057b29b9fbd | /src/main/java/com/nhom25/btl_cnpm/entity/Household.java | 2bcba58a7ed888c370c4ad8e638ef382235ff78d | [] | no_license | tuanbm00/BTL_CNPM | e39874b63955f27ab73944b4916f4292e5669c88 | 734b3c8b1f9f0928343f6f987eb92d8a1ca3eb05 | refs/heads/master | 2022-12-24T16:21:22.493816 | 2020-10-01T09:50:08 | 2020-10-01T09:50:08 | 300,228,795 | 1 | 0 | null | 2020-10-01T09:52:01 | 2020-10-01T09:52:01 | null | UTF-8 | Java | false | false | 354 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package com.nhom25.btl_cnpm.entity;
/**
*
* @author hungn
*/
public class Household {
// viết các thuộc tính
// constructor
// getter and setter
}
| [
"[email protected]"
] | |
0b005f7a22cf9fd16c947da5141fbc19f868326e | ec7e323338a72f99b8194bffab3245a9a02fb3af | /qa/test-db-instance-migration/test-fixture-710/src/main/java/org/camunda/bpm/qa/upgrade/timestamp/MeterLogTimestampScenario.java | f951257030179f754cf27ba0e3eb192a3a8ce917 | [
"Apache-2.0"
] | permissive | rezza72/camunda-bpm-platform | 9d76d20d6af609764deb644f9c0b74dc6800cce5 | 969fe56d45080589fc825c7066a769126d533fd7 | refs/heads/master | 2020-05-05T11:21:15.055791 | 2019-04-05T12:38:14 | 2019-04-05T12:38:30 | 179,986,423 | 1 | 0 | Apache-2.0 | 2019-04-07T15:37:42 | 2019-04-07T15:37:42 | null | UTF-8 | Java | false | false | 2,028 | java | /*
* Copyright © 2013-2019 camunda services GmbH and various authors ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.camunda.bpm.qa.upgrade.timestamp;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.camunda.bpm.engine.impl.interceptor.Command;
import org.camunda.bpm.engine.impl.interceptor.CommandContext;
import org.camunda.bpm.engine.impl.persistence.entity.MeterLogEntity;
import org.camunda.bpm.qa.upgrade.DescribesScenario;
import org.camunda.bpm.qa.upgrade.ScenarioSetup;
import org.camunda.bpm.qa.upgrade.Times;
/**
* @author Nikola Koevski
*/
public class MeterLogTimestampScenario extends AbstractTimestampMigrationScenario {
protected static final String REPORTER_NAME = "MeterLogTimestampTest";
@DescribesScenario("initMeterLogTimestamp")
@Times(1)
public static ScenarioSetup initMeterLogTimestamp() {
return new ScenarioSetup() {
@Override
public void execute(ProcessEngine processEngine, String s) {
((ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration())
.getCommandExecutorTxRequired()
.execute(new Command<Void>() {
@Override
public Void execute(CommandContext commandContext) {
commandContext.getMeterLogManager()
.insert(new MeterLogEntity(REPORTER_NAME, REPORTER_NAME, 1L, TIMESTAMP));
return null;
}
});
}
};
}
} | [
"[email protected]"
] | |
2d841d9c86a2bf8130854069b0a8363523c258e0 | 28552d7aeffe70c38960738da05ebea4a0ddff0c | /google-ads/src/main/java/com/google/ads/googleads/v5/services/LandingPageViewServiceGrpc.java | 74662b7dad37125098c567153d7f2466cb6479fb | [
"Apache-2.0"
] | permissive | PierrickVoulet/google-ads-java | 6f84a3c542133b892832be8e3520fb26bfdde364 | f0a9017f184cad6a979c3048397a944849228277 | refs/heads/master | 2021-08-22T08:13:52.146440 | 2020-12-09T17:10:48 | 2020-12-09T17:10:48 | 250,642,529 | 0 | 0 | Apache-2.0 | 2020-03-27T20:41:26 | 2020-03-27T20:41:25 | null | UTF-8 | Java | false | false | 13,354 | java | package com.google.ads.googleads.v5.services;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
/**
* <pre>
* Service to fetch landing page views.
* </pre>
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler",
comments = "Source: google/ads/googleads/v5/services/landing_page_view_service.proto")
public final class LandingPageViewServiceGrpc {
private LandingPageViewServiceGrpc() {}
public static final String SERVICE_NAME = "google.ads.googleads.v5.services.LandingPageViewService";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<com.google.ads.googleads.v5.services.GetLandingPageViewRequest,
com.google.ads.googleads.v5.resources.LandingPageView> getGetLandingPageViewMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "GetLandingPageView",
requestType = com.google.ads.googleads.v5.services.GetLandingPageViewRequest.class,
responseType = com.google.ads.googleads.v5.resources.LandingPageView.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<com.google.ads.googleads.v5.services.GetLandingPageViewRequest,
com.google.ads.googleads.v5.resources.LandingPageView> getGetLandingPageViewMethod() {
io.grpc.MethodDescriptor<com.google.ads.googleads.v5.services.GetLandingPageViewRequest, com.google.ads.googleads.v5.resources.LandingPageView> getGetLandingPageViewMethod;
if ((getGetLandingPageViewMethod = LandingPageViewServiceGrpc.getGetLandingPageViewMethod) == null) {
synchronized (LandingPageViewServiceGrpc.class) {
if ((getGetLandingPageViewMethod = LandingPageViewServiceGrpc.getGetLandingPageViewMethod) == null) {
LandingPageViewServiceGrpc.getGetLandingPageViewMethod = getGetLandingPageViewMethod =
io.grpc.MethodDescriptor.<com.google.ads.googleads.v5.services.GetLandingPageViewRequest, com.google.ads.googleads.v5.resources.LandingPageView>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetLandingPageView"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.google.ads.googleads.v5.services.GetLandingPageViewRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.google.ads.googleads.v5.resources.LandingPageView.getDefaultInstance()))
.setSchemaDescriptor(new LandingPageViewServiceMethodDescriptorSupplier("GetLandingPageView"))
.build();
}
}
}
return getGetLandingPageViewMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static LandingPageViewServiceStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<LandingPageViewServiceStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<LandingPageViewServiceStub>() {
@java.lang.Override
public LandingPageViewServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LandingPageViewServiceStub(channel, callOptions);
}
};
return LandingPageViewServiceStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static LandingPageViewServiceBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<LandingPageViewServiceBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<LandingPageViewServiceBlockingStub>() {
@java.lang.Override
public LandingPageViewServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LandingPageViewServiceBlockingStub(channel, callOptions);
}
};
return LandingPageViewServiceBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static LandingPageViewServiceFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<LandingPageViewServiceFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<LandingPageViewServiceFutureStub>() {
@java.lang.Override
public LandingPageViewServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LandingPageViewServiceFutureStub(channel, callOptions);
}
};
return LandingPageViewServiceFutureStub.newStub(factory, channel);
}
/**
* <pre>
* Service to fetch landing page views.
* </pre>
*/
public static abstract class LandingPageViewServiceImplBase implements io.grpc.BindableService {
/**
* <pre>
* Returns the requested landing page view in full detail.
* </pre>
*/
public void getLandingPageView(com.google.ads.googleads.v5.services.GetLandingPageViewRequest request,
io.grpc.stub.StreamObserver<com.google.ads.googleads.v5.resources.LandingPageView> responseObserver) {
asyncUnimplementedUnaryCall(getGetLandingPageViewMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getGetLandingPageViewMethod(),
asyncUnaryCall(
new MethodHandlers<
com.google.ads.googleads.v5.services.GetLandingPageViewRequest,
com.google.ads.googleads.v5.resources.LandingPageView>(
this, METHODID_GET_LANDING_PAGE_VIEW)))
.build();
}
}
/**
* <pre>
* Service to fetch landing page views.
* </pre>
*/
public static final class LandingPageViewServiceStub extends io.grpc.stub.AbstractAsyncStub<LandingPageViewServiceStub> {
private LandingPageViewServiceStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected LandingPageViewServiceStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LandingPageViewServiceStub(channel, callOptions);
}
/**
* <pre>
* Returns the requested landing page view in full detail.
* </pre>
*/
public void getLandingPageView(com.google.ads.googleads.v5.services.GetLandingPageViewRequest request,
io.grpc.stub.StreamObserver<com.google.ads.googleads.v5.resources.LandingPageView> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getGetLandingPageViewMethod(), getCallOptions()), request, responseObserver);
}
}
/**
* <pre>
* Service to fetch landing page views.
* </pre>
*/
public static final class LandingPageViewServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<LandingPageViewServiceBlockingStub> {
private LandingPageViewServiceBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected LandingPageViewServiceBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LandingPageViewServiceBlockingStub(channel, callOptions);
}
/**
* <pre>
* Returns the requested landing page view in full detail.
* </pre>
*/
public com.google.ads.googleads.v5.resources.LandingPageView getLandingPageView(com.google.ads.googleads.v5.services.GetLandingPageViewRequest request) {
return blockingUnaryCall(
getChannel(), getGetLandingPageViewMethod(), getCallOptions(), request);
}
}
/**
* <pre>
* Service to fetch landing page views.
* </pre>
*/
public static final class LandingPageViewServiceFutureStub extends io.grpc.stub.AbstractFutureStub<LandingPageViewServiceFutureStub> {
private LandingPageViewServiceFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected LandingPageViewServiceFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LandingPageViewServiceFutureStub(channel, callOptions);
}
/**
* <pre>
* Returns the requested landing page view in full detail.
* </pre>
*/
public com.google.common.util.concurrent.ListenableFuture<com.google.ads.googleads.v5.resources.LandingPageView> getLandingPageView(
com.google.ads.googleads.v5.services.GetLandingPageViewRequest request) {
return futureUnaryCall(
getChannel().newCall(getGetLandingPageViewMethod(), getCallOptions()), request);
}
}
private static final int METHODID_GET_LANDING_PAGE_VIEW = 0;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final LandingPageViewServiceImplBase serviceImpl;
private final int methodId;
MethodHandlers(LandingPageViewServiceImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
case METHODID_GET_LANDING_PAGE_VIEW:
serviceImpl.getLandingPageView((com.google.ads.googleads.v5.services.GetLandingPageViewRequest) request,
(io.grpc.stub.StreamObserver<com.google.ads.googleads.v5.resources.LandingPageView>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
private static abstract class LandingPageViewServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
LandingPageViewServiceBaseDescriptorSupplier() {}
@java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return com.google.ads.googleads.v5.services.LandingPageViewServiceProto.getDescriptor();
}
@java.lang.Override
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
return getFileDescriptor().findServiceByName("LandingPageViewService");
}
}
private static final class LandingPageViewServiceFileDescriptorSupplier
extends LandingPageViewServiceBaseDescriptorSupplier {
LandingPageViewServiceFileDescriptorSupplier() {}
}
private static final class LandingPageViewServiceMethodDescriptorSupplier
extends LandingPageViewServiceBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
LandingPageViewServiceMethodDescriptorSupplier(String methodName) {
this.methodName = methodName;
}
@java.lang.Override
public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
return getServiceDescriptor().findMethodByName(methodName);
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (LandingPageViewServiceGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(new LandingPageViewServiceFileDescriptorSupplier())
.addMethod(getGetLandingPageViewMethod())
.build();
}
}
}
return result;
}
}
| [
"[email protected]"
] | |
df04768601d1b7160e3d313bd36b8ca053b12914 | 340ede9aa27127cd8f02a80fe0c8af9ebce0142c | /src/org/geometerplus/android/fbreader/preferences/PreferenceActivity.java | fcd429fb005edb1067943be13ee35a1fe75bd36f | [] | no_license | neur0maner/FBReaderJ | c0f68d547ebe4bba6a08785b2c08868bad901630 | a9c363ede63994538ed6e0e3e1cfd1d99ba44f96 | refs/heads/master | 2021-01-18T19:36:13.193278 | 2011-01-30T03:02:27 | 2011-01-30T03:02:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,714 | java | /*
* Copyright (C) 2009-2011 Geometer Plus <[email protected]>
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
package org.geometerplus.android.fbreader.preferences;
import android.content.Intent;
import org.geometerplus.zlibrary.core.options.ZLIntegerOption;
import org.geometerplus.zlibrary.core.options.ZLIntegerRangeOption;
import org.geometerplus.zlibrary.text.view.style.*;
import org.geometerplus.zlibrary.ui.android.library.ZLAndroidApplication;
import org.geometerplus.zlibrary.ui.android.view.AndroidFontUtil;
import org.geometerplus.fbreader.fbreader.*;
import org.geometerplus.fbreader.Paths;
import org.geometerplus.fbreader.bookmodel.FBTextKind;
public class PreferenceActivity extends ZLPreferenceActivity {
public PreferenceActivity() {
super("Preferences");
}
@Override
protected void init(Intent intent) {
final FBReaderApp fbReader = (FBReaderApp)FBReaderApp.Instance();
final ZLAndroidApplication androidApp = ZLAndroidApplication.Instance();
final ColorProfile profile = fbReader.getColorProfile();
final Screen directoriesScreen = createPreferenceScreen("directories");
directoriesScreen.addOption(Paths.BooksDirectoryOption(), "books");
if (AndroidFontUtil.areExternalFontsSupported()) {
directoriesScreen.addOption(Paths.FontsDirectoryOption(), "fonts");
}
directoriesScreen.addOption(Paths.WallpapersDirectoryOption(), "wallpapers");
final Screen appearanceScreen = createPreferenceScreen("appearance");
appearanceScreen.addOption(androidApp.AutoOrientationOption, "autoOrientation");
appearanceScreen.addOption(androidApp.ShowStatusBarOption, "showStatusBar");
final Screen textScreen = createPreferenceScreen("text");
final ZLTextStyleCollection collection = ZLTextStyleCollection.Instance();
final ZLTextBaseStyle baseStyle = collection.getBaseStyle();
textScreen.addPreference(new FontOption(
this, textScreen.Resource, "font",
baseStyle.FontFamilyOption, false
));
textScreen.addPreference(new ZLIntegerRangePreference(
this, textScreen.Resource.getResource("fontSize"),
baseStyle.FontSizeOption
));
textScreen.addPreference(new FontStylePreference(
this, textScreen.Resource, "fontStyle",
baseStyle.BoldOption, baseStyle.ItalicOption
));
final ZLIntegerRangeOption spaceOption = baseStyle.LineSpaceOption;
final String[] spacings = new String[spaceOption.MaxValue - spaceOption.MinValue + 1];
for (int i = 0; i < spacings.length; ++i) {
final int val = spaceOption.MinValue + i;
spacings[i] = (char)(val / 10 + '0') + "." + (char)(val % 10 + '0');
}
textScreen.addPreference(new ZLChoicePreference(
this, textScreen.Resource, "lineSpacing",
spaceOption, spacings
));
final String[] alignments = { "left", "right", "center", "justify" };
textScreen.addPreference(new ZLChoicePreference(
this, textScreen.Resource, "alignment",
baseStyle.AlignmentOption, alignments
));
textScreen.addPreference(new ZLBooleanPreference(
this, baseStyle.AutoHyphenationOption,
textScreen.Resource, "autoHyphenations"
));
final Screen moreStylesScreen = textScreen.createPreferenceScreen("more");
byte styles[] = {
FBTextKind.REGULAR,
FBTextKind.TITLE,
FBTextKind.SECTION_TITLE,
FBTextKind.SUBTITLE,
FBTextKind.H1,
FBTextKind.H2,
FBTextKind.H3,
FBTextKind.H4,
FBTextKind.H5,
FBTextKind.H6,
FBTextKind.ANNOTATION,
FBTextKind.EPIGRAPH,
FBTextKind.AUTHOR,
FBTextKind.POEM_TITLE,
FBTextKind.STANZA,
FBTextKind.VERSE,
FBTextKind.CITE,
FBTextKind.INTERNAL_HYPERLINK,
FBTextKind.EXTERNAL_HYPERLINK,
FBTextKind.FOOTNOTE,
FBTextKind.ITALIC,
FBTextKind.EMPHASIS,
FBTextKind.BOLD,
FBTextKind.STRONG,
FBTextKind.DEFINITION,
FBTextKind.DEFINITION_DESCRIPTION,
FBTextKind.PREFORMATTED,
FBTextKind.CODE
};
for (int i = 0; i < styles.length; ++i) {
final ZLTextStyleDecoration decoration = collection.getDecoration(styles[i]);
if (decoration == null) {
continue;
}
ZLTextFullStyleDecoration fullDecoration =
decoration instanceof ZLTextFullStyleDecoration ?
(ZLTextFullStyleDecoration)decoration : null;
final Screen formatScreen = moreStylesScreen.createPreferenceScreen(decoration.getName());
formatScreen.addPreference(new FontOption(
this, textScreen.Resource, "font",
decoration.FontFamilyOption, true
));
formatScreen.addPreference(new ZLIntegerRangePreference(
this, textScreen.Resource.getResource("fontSizeDifference"),
decoration.FontSizeDeltaOption
));
formatScreen.addPreference(new ZLBoolean3Preference(
this, textScreen.Resource, "bold",
decoration.BoldOption
));
formatScreen.addPreference(new ZLBoolean3Preference(
this, textScreen.Resource, "italic",
decoration.ItalicOption
));
if (fullDecoration != null) {
final String[] allAlignments = { "unchanged", "left", "right", "center", "justify" };
formatScreen.addPreference(new ZLChoicePreference(
this, textScreen.Resource, "alignment",
fullDecoration.AlignmentOption, allAlignments
));
}
formatScreen.addPreference(new ZLBoolean3Preference(
this, textScreen.Resource, "allowHyphenations",
decoration.AllowHyphenationsOption
));
if (fullDecoration != null) {
formatScreen.addPreference(new ZLIntegerRangePreference(
this, textScreen.Resource.getResource("spaceBefore"),
fullDecoration.SpaceBeforeOption
));
formatScreen.addPreference(new ZLIntegerRangePreference(
this, textScreen.Resource.getResource("spaceAfter"),
fullDecoration.SpaceAfterOption
));
formatScreen.addPreference(new ZLIntegerRangePreference(
this, textScreen.Resource.getResource("leftIndent"),
fullDecoration.LeftIndentOption
));
formatScreen.addPreference(new ZLIntegerRangePreference(
this, textScreen.Resource.getResource("rightIndent"),
fullDecoration.RightIndentOption
));
formatScreen.addPreference(new ZLIntegerRangePreference(
this, textScreen.Resource.getResource("firstLineIndent"),
fullDecoration.FirstLineIndentDeltaOption
));
final ZLIntegerOption spacePercentOption = fullDecoration.LineSpacePercentOption;
final int[] spacingValues = new int[17];
final String[] spacingKeys = new String[17];
spacingValues[0] = -1;
spacingKeys[0] = "unchanged";
for (int j = 1; j < spacingValues.length; ++j) {
final int val = 4 + j;
spacingValues[j] = 10 * val;
spacingKeys[j] = (char)(val / 10 + '0') + "." + (char)(val % 10 + '0');
}
formatScreen.addPreference(new ZLIntegerChoicePreference(
this, textScreen.Resource, "lineSpacing",
spacePercentOption, spacingValues, spacingKeys
));
}
}
final ZLPreferenceSet footerPreferences = new ZLPreferenceSet();
final ZLPreferenceSet bgPreferences = new ZLPreferenceSet();
final Screen colorsScreen = createPreferenceScreen("colors");
colorsScreen.addPreference(new WallpaperPreference(
this, profile, colorsScreen.Resource, "background"
) {
@Override
protected void onDialogClosed(boolean result) {
super.onDialogClosed(result);
bgPreferences.setEnabled("".equals(getValue()));
}
});
bgPreferences.add(
colorsScreen.addOption(profile.BackgroundOption, "backgroundColor")
);
bgPreferences.setEnabled("".equals(profile.WallpaperOption.getValue()));
/*
colorsScreen.addOption(profile.SelectionBackgroundOption, "selectionBackground");
*/
colorsScreen.addOption(profile.HighlightingOption, "highlighting");
colorsScreen.addOption(profile.RegularTextOption, "text");
colorsScreen.addOption(profile.HyperlinkTextOption, "hyperlink");
colorsScreen.addOption(profile.FooterFillOption, "footer");
final Screen marginsScreen = createPreferenceScreen("margins");
marginsScreen.addPreference(new ZLIntegerRangePreference(
this, marginsScreen.Resource.getResource("left"),
fbReader.LeftMarginOption
));
marginsScreen.addPreference(new ZLIntegerRangePreference(
this, marginsScreen.Resource.getResource("right"),
fbReader.RightMarginOption
));
marginsScreen.addPreference(new ZLIntegerRangePreference(
this, marginsScreen.Resource.getResource("top"),
fbReader.TopMarginOption
));
marginsScreen.addPreference(new ZLIntegerRangePreference(
this, marginsScreen.Resource.getResource("bottom"),
fbReader.BottomMarginOption
));
final Screen statusLineScreen = createPreferenceScreen("scrollBar");
final String[] scrollBarTypes = {"hide", "show", "showAsProgress", "showAsFooter"};
statusLineScreen.addPreference(new ZLChoicePreference(
this, statusLineScreen.Resource, "scrollbarType",
fbReader.ScrollbarTypeOption, scrollBarTypes
) {
@Override
protected void onDialogClosed(boolean result) {
super.onDialogClosed(result);
footerPreferences.setEnabled(
findIndexOfValue(getValue()) == FBView.SCROLLBAR_SHOW_AS_FOOTER
);
}
});
footerPreferences.add(statusLineScreen.addPreference(new ZLIntegerRangePreference(
this, statusLineScreen.Resource.getResource("footerHeight"),
fbReader.FooterHeightOption
)));
footerPreferences.add(statusLineScreen.addOption(profile.FooterFillOption, "footerColor"));
footerPreferences.add(statusLineScreen.addOption(fbReader.FooterShowTOCMarksOption, "tocMarks"));
/*
String[] footerLongTaps = {"longTapRevert", "longTapNavigate"};
footerPreferences.add(statusLineScreen.addPreference(new ZLChoicePreference(
this, statusLineScreen.Resource, "footerLongTap",
fbReader.FooterLongTapOption, footerLongTaps
)));
*/
footerPreferences.add(statusLineScreen.addOption(fbReader.FooterShowClockOption, "showClock"));
footerPreferences.add(statusLineScreen.addOption(fbReader.FooterShowBatteryOption, "showBattery"));
footerPreferences.add(statusLineScreen.addOption(fbReader.FooterShowProgressOption, "showProgress"));
footerPreferences.add(statusLineScreen.addOption(fbReader.FooterIsSensitiveOption, "isSensitive"));
footerPreferences.add(statusLineScreen.addPreference(new FontOption(
this, statusLineScreen.Resource, "font",
fbReader.FooterFontOption, false
)));
footerPreferences.setEnabled(
fbReader.ScrollbarTypeOption.getValue() == FBView.SCROLLBAR_SHOW_AS_FOOTER
);
final Screen displayScreen = createPreferenceScreen("display");
displayScreen.addPreference(new ZLBooleanPreference(
this,
fbReader.AllowScreenBrightnessAdjustmentOption,
displayScreen.Resource,
"allowScreenBrightnessAdjustment"
) {
public void onAccept() {
super.onAccept();
if (!isChecked()) {
androidApp.ScreenBrightnessLevelOption.setValue(0);
}
}
});
displayScreen.addPreference(new BatteryLevelToTurnScreenOffPreference(
this,
androidApp.BatteryLevelToTurnScreenOffOption,
displayScreen.Resource,
"dontTurnScreenOff"
));
/*
displayScreen.addPreference(new ZLBooleanPreference(
this,
androidApp.DontTurnScreenOffDuringChargingOption,
displayScreen.Resource,
"dontTurnScreenOffDuringCharging"
));
*/
/*
final Screen colorProfileScreen = createPreferenceScreen("colorProfile");
final ZLResource resource = colorProfileScreen.Resource;
colorProfileScreen.setSummary(ColorProfilePreference.createTitle(resource, fbreader.getColorProfileName()));
for (String key : ColorProfile.names()) {
colorProfileScreen.addPreference(new ColorProfilePreference(
this, fbreader, colorProfileScreen, key, ColorProfilePreference.createTitle(resource, key)
));
}
*/
final Screen scrollingScreen = createPreferenceScreen("scrolling");
final ScrollingPreferences scrollingPreferences = ScrollingPreferences.Instance();
scrollingScreen.addOption(scrollingPreferences.FingerScrollingOption, "fingerScrolling");
scrollingScreen.addOption(fbReader.EnableDoubleTapOption, "enableDoubleTapDetection");
final ZLPreferenceSet volumeKeysPreferences = new ZLPreferenceSet();
scrollingScreen.addPreference(new ZLBooleanPreference(
this, scrollingPreferences.VolumeKeysOption, scrollingScreen.Resource, "volumeKeys"
) {
@Override
protected void onClick() {
super.onClick();
volumeKeysPreferences.setEnabled(isChecked());
}
});
volumeKeysPreferences.add(scrollingScreen.addOption(
scrollingPreferences.InvertVolumeKeysOption, "invertVolumeKeys"
));
volumeKeysPreferences.setEnabled(scrollingPreferences.VolumeKeysOption.getValue());
scrollingScreen.addOption(scrollingPreferences.AnimationOption, "animation");
scrollingScreen.addOption(scrollingPreferences.HorizontalOption, "horizontal");
final Screen dictionaryScreen = createPreferenceScreen("dictionary");
dictionaryScreen.addPreference(new DictionaryPreference(
this,
dictionaryScreen.Resource,
"dictionary"
));
dictionaryScreen.addPreference(new ZLBooleanPreference(
this,
fbReader.NavigateAllWordsOption,
dictionaryScreen.Resource,
"navigateOverAllWords"
));
dictionaryScreen.addOption(fbReader.DictionaryTappingActionOption, "tappingAction");
}
}
| [
"[email protected]"
] | |
a37360122b07b136e424c5347b2b88998fc54aea | 883d561da84d11457402785696f4e2a746a0b5a7 | /app/src/main/java/com/example/LViewModelProviders.java | c4a456fd091a574127d86193f64ae54048eccfa7 | [] | no_license | Zhangyc1998/Rxjava_Retrofit | 423c73601d26d56ae09819aa626e030a77dcde81 | 0810fc00509d06cf851788db57f992be1e38cdbf | refs/heads/master | 2023-03-12T10:53:33.157425 | 2021-02-25T10:24:37 | 2021-02-25T10:24:37 | 342,111,360 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 736 | java | package com.example;
import com.example.basis.base.BaseViewModel;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.lifecycle.ViewModelProviders;
public class LViewModelProviders {
public static <T extends BaseViewModel> T of(@NonNull FragmentActivity activity, Class<T> modelClass) {
T t = ViewModelProviders.of(activity).get(modelClass);
t.setLifecycleOwner(activity);
return t;
}
public static <T extends BaseViewModel> T of(@NonNull Fragment activity, Class<T> modelClass) {
T t = ViewModelProviders.of(activity).get(modelClass);
t.setLifecycleOwner(activity);
return t;
}
}
| [
"[email protected]"
] | |
3a479c86808e964286492fb62af1253267a18407 | 46167791cbfeebc8d3ddc97112764d7947fffa22 | /quarkus/src/main/java/com/justexample/entity/Entity1443.java | d8504ff13af05ecd18255bc62633b56c8f5054bd | [] | no_license | kahlai/unrealistictest | 4f668b4822a25b4c1f06c6b543a26506bb1f8870 | fe30034b05f5aacd0ef69523479ae721e234995c | refs/heads/master | 2023-08-25T09:32:16.059555 | 2021-11-09T08:17:22 | 2021-11-09T08:17:22 | 425,726,016 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,130 | java | package com.example.entity;
import java.sql.Timestamp;
import javax.persistence.Entity;
import javax.persistence.Id;
@Entity
public class Entity1443 {
@Id
private Long id;
private String code;
private String name;
private String status;
private int seq;
private Timestamp createdDate;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
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;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public int getSeq() {
return seq;
}
public void setSeq(int seq) {
this.seq = seq;
}
public Timestamp getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Timestamp createdDate) {
this.createdDate = createdDate;
}
}
| [
"[email protected]"
] | |
9f066e2a0bbe3966d1069c1eb4258fbbb621eabc | 19bb95e44892855823bb63de44e44c2ae63eddb2 | /sch/src/com/huahong/admin/action/SchLogUrlFilter.java | dab4ab07e9325d9f2a1b723c67ad8cd502765db1 | [] | no_license | tgactga/sch | e1199d37f69defcbc4d5c51cf8253d26ba51fbfb | 1539e02f8f65448b3fd4964d05245b1fe1ed726c | refs/heads/master | 2020-12-31T04:41:16.442932 | 2016-01-26T08:45:52 | 2016-01-26T08:45:52 | 47,875,446 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,246 | java | package com.huahong.admin.action;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class SchLogUrlFilter implements Filter{
public void destroy() {
}
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse,
FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest)servletRequest;
HttpServletResponse response = (HttpServletResponse)servletResponse;
HttpSession session = request.getSession();
String requestUrl = request.getServletPath() + (request.getPathInfo() == null ? "" : request.getPathInfo());
System.out.println(requestUrl);
System.out.println(request.getRemoteAddr());
if(requestUrl.endsWith(".do") || requestUrl.endsWith(".jsp")){
}else{
}
filterChain.doFilter(servletRequest, servletResponse);
}
public void init(FilterConfig arg0) throws ServletException {
}
}
| [
"[email protected]"
] | |
34dff28a23a2493b0700aa23922cd2ae3c755db2 | 0d3f69e7d2d800c1b80454e914d0610eb3421b58 | /EventListeners/app/src/androidTest/java/android/comm/eventlisteners/ApplicationTest.java | e8dcc86bce9efbc8ad2da142290c866c48fc8771 | [] | no_license | thevarungupta1/Android-Training-Demos | 336efecee4083c0cb89c4666e373ead194c1f38b | 7ebfde0f439aeaf5b403e2727b7c7d03dd6b74d3 | refs/heads/master | 2021-01-11T10:31:41.206188 | 2016-12-18T13:49:30 | 2016-12-18T13:49:30 | 76,372,911 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 358 | java | package android.comm.eventlisteners;
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);
}
} | [
"[email protected]"
] | |
6775e4521e51a8c93d572bf6790bbcf012f1b2db | 38da315c5c7295ed80fa3ad8b3cabd10e2e4641e | /litemall-db/src/main/java/org/linlinjava/litemall/db/dao/LitemallUserCardMapper.java | e5c82c6b612c32a5ac5ecb5e96a7819fd81eacb5 | [] | no_license | Moutday/litemall | fe52299409ea132bc80bc362d7697e12029d0035 | 26282f437cb192d4dd8d8ad736e6249ac7d1cdb3 | refs/heads/master | 2023-02-17T19:42:47.427191 | 2021-01-16T09:50:44 | 2021-01-16T09:50:44 | 327,228,608 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,926 | java | package org.linlinjava.litemall.db.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.linlinjava.litemall.db.domain.LitemallUserCard;
import org.linlinjava.litemall.db.domain.LitemallUserCardExample;
public interface LitemallUserCardMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
long countByExample(LitemallUserCardExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
int deleteByExample(LitemallUserCardExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
int insert(LitemallUserCard record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
int insertSelective(LitemallUserCard record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
LitemallUserCard selectOneByExample(LitemallUserCardExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
LitemallUserCard selectOneByExampleSelective(@Param("example") LitemallUserCardExample example, @Param("selective") LitemallUserCard.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
List<LitemallUserCard> selectByExampleSelective(@Param("example") LitemallUserCardExample example, @Param("selective") LitemallUserCard.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
List<LitemallUserCard> selectByExample(LitemallUserCardExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
LitemallUserCard selectByPrimaryKeySelective(@Param("id") Integer id, @Param("selective") LitemallUserCard.Column ... selective);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
LitemallUserCard selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
LitemallUserCard selectByPrimaryKeyWithLogicalDelete(@Param("id") Integer id, @Param("andLogicalDeleted") boolean andLogicalDeleted);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") LitemallUserCard record, @Param("example") LitemallUserCardExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
int updateByExample(@Param("record") LitemallUserCard record, @Param("example") LitemallUserCardExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(LitemallUserCard record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
int updateByPrimaryKey(LitemallUserCard record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
int logicalDeleteByExample(@Param("example") LitemallUserCardExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table litemall_user_card
*
* @mbg.generated
*/
int logicalDeleteByPrimaryKey(Integer id);
} | [
"[email protected]"
] | |
98117d73c34113a755f45255b274e4589e3cda30 | e2c5b17fad8cbe2099b1dff4258d344af5eec0fe | /src/com/biz/grade/dao/ScoreDaoImp.java | 3fb7d1fe5b624556f1f625138dbddab8a7cb54ad | [] | no_license | haileyan/DBGrade_01 | 660ed3689b3b232c9cf871a9714b9ee1569ef92c | 3e8f527232b97f070720b003d36ea9cc9fed6cce | refs/heads/master | 2020-04-14T19:44:02.354953 | 2019-01-04T06:46:08 | 2019-01-04T06:46:08 | 164,069,282 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,974 | java | package com.biz.grade.dao;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;
import com.biz.grade.vo.ScoreVO;
public class ScoreDaoImp implements ScoreDao {
Connection dbConn;
public ScoreDaoImp() {
// TODO Auto-generated constructor stub
this.dbConnection();
}
private void dbConnection() {
String dbDriver = "oracle.jdbc.driver.OracleDriver";
try {
// Driver Loading
Class.forName(dbDriver);
// DB 접속 profile
String url = "jdbc:oracle:thin:@localhost:1521:xe";
String user = "gradeuser";
String password = "1234";
dbConn = DriverManager.getConnection(url, user, password);
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
@Override
public void insert(ScoreVO vo) {
// TODO Auto-generated method stub
}
@Override
public List<ScoreVO> selectAll() {
// TODO Auto-generated method stub
return null;
}
@Override
public ScoreVO findByNum(String sc_num) {
// TODO 학생의 학번으로 점수조회
String sql = " SELECT * FROM tbl_score ";
sql += " WHERE sc_num = '" + sc_num + "'";
PreparedStatement ps;
try {
ps = dbConn.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
if(rs.next()) {
ScoreVO vo = new ScoreVO(
rs.getString("sc_num"),
rs.getInt("sc_kor"),
rs.getInt("sc_eng"),
rs.getInt("sc_math")
);
return vo;
}
return null;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
@Override
public int update(ScoreVO vo) {
// TODO Auto-generated method stub
return 0;
}
@Override
public int delete(String sc_num) {
// TODO Auto-generated method stub
return 0;
}
}
| [
"[email protected]"
] | |
642b4572b7e2819f8456482e5e44daf5e84134a6 | 97675dccdda1db7746e6fd09851df3e129a8c14a | /src/demo3/KeyScanner.java | 735668b7baa812e6896d89a3287acb8981a3814b | [] | no_license | wenbingshen/jvm-serviceability-examples | c59070f7dc55d69dd7fb4ac4f354065ed5a03ee7 | 579baf68fa4b9e718069233e99c1538e9e59559b | refs/heads/master | 2021-09-14T20:43:47.514752 | 2018-05-19T00:16:26 | 2018-05-19T00:16:26 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,095 | java | package demo3;
import sun.jvm.hotspot.oops.*;
import sun.jvm.hotspot.runtime.VM;
import sun.jvm.hotspot.tools.Tool;
public class KeyScanner extends Tool {
@Override
public void run() {
Klass privateKeyKlass = VM.getVM().getSystemDictionary()
.find("java/security/PrivateKey", null, null);
VM.getVM().getObjectHeap().iterateObjectsOfKlass(new DefaultHeapVisitor() {
@Override
public boolean doObj(Oop oop) {
InstanceKlass holder = (InstanceKlass) oop.getKlass();
OopField field = (OopField) holder.findField("key", "[B");
print((TypeArray) field.getValue(oop));
return false;
}
}, privateKeyKlass);
}
private void print(TypeArray array) {
long length = array.getLength();
for (long i = 0; i < length; i++) {
System.out.printf("%02x", array.getByteAt(i));
}
System.out.println();
}
public static void main(String[] args) {
new KeyScanner().execute(new String[]{""});
}
}
| [
"[email protected]"
] | |
c5dc58c3b3dac90cfa20cde22f46d87dc82c1b8b | c88bd924e0d1f687fb60a74db82ae81f3702b016 | /Leaflets/src/main/java/org/wheat/leaflets/activity/TestUploadPhotoActivity.java | 6dc889ff75f8639d6464f2d62a20f3bf5ac7d0a3 | [] | no_license | mhhwheat/ElectronicLeafletsProject | df3de402fb5cb083093d8979652d58d6990d0e8c | 20af31204ea28309236f653554b35f56229e8ef3 | refs/heads/master | 2020-03-26T17:14:07.434210 | 2015-05-03T11:05:46 | 2015-05-03T11:05:46 | 34,519,176 | 0 | 0 | null | null | null | null | IBM852 | Java | false | false | 1,944 | java | /**
* descriptionú║
* @author wheat
* date: 2015-4-10
* time: ¤┬╬š8:23:30
*/
package org.wheat.leaflets.activity;
import java.io.File;
import java.util.Date;
import org.wheat.leaflets.R;
import org.wheat.leaflets.loader.HttpUploadMethods;
import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Environment;
import android.view.View;
import android.widget.Button;
/**
* description:
* @author wheat
* date: 2015-4-10
* time: ¤┬╬š8:23:30
*/
public class TestUploadPhotoActivity extends Activity
{
private Button bt;
private String photoPath;
private File photo;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_test_upload_photo);
bt=(Button)findViewById(R.id.upload);
photoPath=Environment.getExternalStorageDirectory()+"/DCIM/Camera/Ë▓┼╠╝ý▓Ô1.png";
photo=new File(photoPath);
bt.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new UploadPhotoTask(photo, "[email protected]", "primary").execute();
}
});
}
private class UploadPhotoTask extends AsyncTask<Void, Void, Integer>
{
private File photo;
private String photoName;
private String photoType;
public UploadPhotoTask(File photo,String photoName,String photoType)
{
Date date=new Date();
this.photo=photo;
this.photoName=photoName+date.getTime();
this.photoType=photoType;
}
@Override
protected Integer doInBackground(Void... params) {
int returnCode=-1;
try
{
returnCode=HttpUploadMethods.uploadPhoto(photo, photoName, photoType);
}
catch(Exception e)
{
e.printStackTrace();
}
return returnCode;
}
@Override
protected void onPostExecute(Integer result) {
// TODO Auto-generated method stub
super.onPostExecute(result);
}
}
}
| [
"[email protected]"
] | |
7795e05b39664e15e5b63d231cfc07a20ebe03b1 | a0de3b5d832e2de4d3288b25588c2429bf982c11 | /INVENTARIO_DOMINIO/src/main/java/es/enaire/inventario/dtos/FamiliaInstalacionDTO.java | d68b348f1e8a549fc583fd80637b8e6e0a69f623 | [] | no_license | josega1983/inventarioETNA | 1ac462fb30e795dbb896ec05ed213b1e640142b7 | 063fe7eea78fce08b721756bb4b82b1defb5b2e5 | refs/heads/master | 2021-05-14T10:53:43.762821 | 2018-01-08T14:49:52 | 2018-01-08T14:49:52 | 116,363,392 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,987 | java | package es.enaire.inventario.dtos;
import java.io.Serializable;
import java.util.Date;
import es.enaire.inventario.annotations.IdTarget;
/**
* Clase de mapeo con la informacion de familia instalaciones.
*
*/
public class FamiliaInstalacionDTO implements Serializable {
/**
* Indicador de serializacion
*/
private static final long serialVersionUID = -8016867573096305531L;
/**
* El id
*/
@IdTarget
private Long id;
/**
* Nombre
*/
private String nombre;
/**
* Area
*/
private String area;
/**
* Observaciones
*/
private String observaciones;
/**
* Activo
*/
private String activo;
/**
* Fecha de Alta
*/
private Date fechaAlta;
/**
* Fecha de baja
*/
private Date fechaBaja;
/**
* Opciones a mostrar en el estado del menu
*/
private String estadoMenu;
/**
* Obtiene el id
* @return el id
*/
public Long getId() {
return id;
}
/**
* Establece el id
* @param id el id
*/
public void setId(Long id) {
this.id = id;
}
/**
* Obtiene el nombre
* @return el nombre
*/
public String getNombre() {
return nombre;
}
/**
* Establece el nombre
* @param nombre el nombre
*/
public void setNombre(String nombre) {
this.nombre = nombre;
}
/**
* Obtiene el area
* @return el area
*/
public String getArea() {
return area;
}
/**
* Establece el area
* @param area el area
*/
public void setArea(String area) {
this.area = area;
}
/**
* Obtiene las observaciones
* @return las observaciones
*/
public String getObservaciones() {
return observaciones;
}
/**
* Establece las observaciones
* @param observaciones las observaciones
*/
public void setObservaciones(String observaciones) {
this.observaciones = observaciones;
}
/**
* Obtiene si es activo
* @return si es activo
*/
public String getActivo() {
return activo;
}
/**
* Establece si es activo
* @param activo si es activo
*/
public void setActivo(String activo) {
this.activo = activo;
}
/**
* Obtiene el area
* @return el area
*/
public Date getFechaAlta() {
return fechaAlta;
}
/**
* Establece el area
* @param fechaAlta el area
*/
public void setFechaAlta(Date fechaAlta) {
this.fechaAlta = fechaAlta;
}
/**
* Obtiene la fecha de baja
* @return la fecha de baja
*/
public Date getFechaBaja() {
return fechaBaja;
}
/**
* Establece la fecha de baja
* @param fechaBaja la fecha de baja
*/
public void setFechaBaja(Date fechaBaja) {
this.fechaBaja = fechaBaja;
}
/**
* Obtiene el estado del menu
* @return El estado del menu
*/
public String getEstadoMenu() {
return estadoMenu;
}
/**
* Establece el estado del menu
* @param estadoMenu El estado de menu a establecer
*/
public void setEstadoMenu(String estadoMenu) {
this.estadoMenu = estadoMenu;
}
}
| [
"[email protected]"
] | |
261cd17c8ce2b28b3bdae91e5af94c1dafcad6a2 | c24e883bba5235840239de3bd5640d92e0c8db66 | /commons/core/src/main/java/com/smart/website/common/core/utils/AesUtil.java | 17f75ca4d3151a04c70934aa2c3c351bfa4d00b6 | [] | no_license | hotHeart48156/mallwebsite | 12fe2f7d4e108ceabe89b82eacca75898d479357 | ba865c7ea22955009e2de7b688038ddd8bc9febf | refs/heads/master | 2022-11-23T23:22:28.967449 | 2020-01-07T15:27:27 | 2020-01-07T15:27:27 | 231,905,626 | 0 | 0 | null | 2022-11-15T23:54:56 | 2020-01-05T11:14:43 | Java | UTF-8 | Java | false | false | 4,200 | java | package com.smart.website.common.core.utils;
import lombok.experimental.UtilityClass;
import org.springframework.util.Assert;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.Charset;
import java.util.Arrays;
/**
* 完全兼容微信所使用的AES加密方式。
* aes的key必须是256byte长(比如32个字符),可以使用AesKit.genAesKey()来生成一组key
* <p>
* 参考自:jFinal AESKit,优化,方便使用
*
* @author L.cm
*/
@UtilityClass
public class AesUtil {
public static String genAesKey() {
return StringUtil.random(32);
}
public static byte[] encrypt(byte[] content, String aesTextKey) {
return encrypt(content, aesTextKey.getBytes(Charsets.UTF_8));
}
public static byte[] encrypt(String content, String aesTextKey) {
return encrypt(content.getBytes(Charsets.UTF_8), aesTextKey.getBytes(Charsets.UTF_8));
}
public static byte[] encrypt(String content, Charset charset, String aesTextKey) {
return encrypt(content.getBytes(charset), aesTextKey.getBytes(Charsets.UTF_8));
}
public static byte[] decrypt(byte[] content, String aesTextKey) {
return decrypt(content, aesTextKey.getBytes(Charsets.UTF_8));
}
public static String decryptToStr(byte[] content, String aesTextKey) {
return new String(decrypt(content, aesTextKey.getBytes(Charsets.UTF_8)), Charsets.UTF_8);
}
public static String decryptToStr(byte[] content, String aesTextKey, Charset charset) {
return new String(decrypt(content, aesTextKey.getBytes(Charsets.UTF_8)), charset);
}
public static byte[] encrypt(byte[] content, byte[] aesKey) {
Assert.isTrue(aesKey.length == 32, "IllegalAesKey, aesKey's length must be 32");
try {
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
SecretKeySpec keySpec = new SecretKeySpec(aesKey, "AES");
IvParameterSpec iv = new IvParameterSpec(aesKey, 0, 16);
cipher.init(Cipher.ENCRYPT_MODE, keySpec, iv);
return cipher.doFinal(Pkcs7Encoder.encode(content));
} catch (Exception e) {
throw Exceptions.unchecked(e);
}
}
public static byte[] decrypt(byte[] encrypted, byte[] aesKey) {
Assert.isTrue(aesKey.length == 32, "IllegalAesKey, aesKey's length must be 32");
try {
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
SecretKeySpec keySpec = new SecretKeySpec(aesKey, "AES");
IvParameterSpec iv = new IvParameterSpec(Arrays.copyOfRange(aesKey, 0, 16));
cipher.init(Cipher.DECRYPT_MODE, keySpec, iv);
return Pkcs7Encoder.decode(cipher.doFinal(encrypted));
} catch (Exception e) {
throw Exceptions.unchecked(e);
}
}
/**
* 提供基于PKCS7算法的加解密接口.
*/
private static class Pkcs7Encoder {
private static int BLOCK_SIZE = 32;
private static byte[] encode(byte[] src) {
int count = src.length;
// 计算需要填充的位数
int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE);
if (amountToPad == 0) {
amountToPad = BLOCK_SIZE;
}
// 获得补位所用的字符
byte pad = (byte) (amountToPad & 0xFF);
byte[] pads = new byte[amountToPad];
for (int index = 0; index < amountToPad; index++) {
pads[index] = pad;
}
int length = count + amountToPad;
byte[] dest = new byte[length];
System.arraycopy(src, 0, dest, 0, count);
System.arraycopy(pads, 0, dest, count, amountToPad);
return dest;
}
private static byte[] decode(byte[] decrypted) {
int pad = decrypted[decrypted.length - 1];
if (pad < 1 || pad > BLOCK_SIZE) {
pad = 0;
}
if (pad > 0) {
return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad);
}
return decrypted;
}
}
}
| [
"[email protected]"
] | |
17a2e01421c86b465f710aad4f4734cf9a91694f | 91ae1e4a9372e54486ea1d5cad8880c1c27c47a4 | /Leetcode/Java/P0019_Remove_nth_Node_from_End_of_List.java | e8939006520711fd3cba50c79b0af76e822884b2 | [] | no_license | Cornelllz348/coding | 759a83033dff270ab6dff4f6e57741f7c8c1112d | 52bd45eec2d05f01c7be35ad2c9f5ad38d3c7599 | refs/heads/master | 2022-11-17T06:47:25.200035 | 2022-11-13T22:25:59 | 2022-11-13T22:25:59 | 237,693,267 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 553 | java | package leetcode;
public class P0019_Remove_nth_Node_from_End_of_List {
public ListNode removeNthFromEnd(ListNode head, int n) {
ListNode dummy = new ListNode(-1);
dummy.next = head;
ListNode curr = dummy;
ListNode prev = dummy;
int i = n;
while (i > 0) {
curr = curr.next;
i--;
}
while (curr.next != null) {
curr = curr.next;
prev = prev.next;
}
prev.next = prev.next.next;
return dummy.next;
}
} | [
"[email protected]"
] | |
0fdd51632b8b9515e3696a282158581f5ff8c16e | 80563d747a42e3e5f6f9fd32a3ac9cfa19d2de2b | /core/src/main/java/core/mapper/TaskMapper.java | bb71e78b22a0dc2341eeb9d2b99932538a6f8c9e | [] | no_license | dream-interactive/atlas.resource.service | 002cfc88c78ac226eb2f5058ed3c0c72b7f76126 | 3351f8900c30a1f055e6d924d80ee1f95201c6a3 | refs/heads/main | 2023-06-03T12:30:45.198706 | 2021-06-25T07:46:53 | 2021-06-25T07:46:53 | 292,042,226 | 0 | 0 | null | 2021-06-25T07:02:49 | 2020-09-01T15:54:43 | Java | UTF-8 | Java | false | false | 325 | java | package core.mapper;
import api.dto.TaskDTO;
import core.entity.Task;
import org.mapstruct.InjectionStrategy;
import org.mapstruct.Mapper;
@Mapper(componentModel = "spring", injectionStrategy = InjectionStrategy.CONSTRUCTOR)
public interface TaskMapper {
Task toEntity(TaskDTO dto);
TaskDTO toDTO(Task entity);
}
| [
"[email protected]"
] | |
37c4b6f69bc83623fe3b3deb3a28b82d2fdd9fdd | b449d1c5fcfc09d2c9305ab4811784b9658d1e8a | /app/src/main/java/com/sadi/sreda/MyApplication.java | 4d01a0e0fd6ff4f55583abd33a78af599aad745d | [] | no_license | shahkutub/MonitoringAttendense | c7444bc819302458669263d809f8c14aa23bc1fb | 7eaf2c1ae3f707f28ffa6999c05164272c7b8d87 | refs/heads/master | 2021-04-30T08:39:26.436061 | 2018-05-17T17:18:49 | 2018-05-17T17:18:49 | 121,380,459 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 369 | java | package com.sadi.sreda;
import android.app.Application;
import com.sadi.sreda.utils.TypefaceUtil;
/**
* Created by Sadi on 2/18/2018.
*/
public class MyApplication extends Application{
@Override
public void onCreate() {
super.onCreate();
TypefaceUtil.overrideFont(getApplicationContext(), "SERIF", "fonts/SolaimanLipi_reg.ttf");
}
}
| [
"[email protected]"
] | |
37acc1ed00172656c861e50f002042c7c89e1975 | 07a762ff475d1951757e4dfec031682ecb326095 | /src/main/java/co/makestar/sbvmaker/model/SubElement.java | 806412127bb021009c399e916fa4ceb54679c08c | [] | no_license | JungkwanBan/Subtitle_Maker_V2 | c88733265b6e3a2f4b25615bab991cba5eba1ef7 | 69c8c37e0183ad61c9c1986ebfe4f9d2b6a430d7 | refs/heads/master | 2020-04-23T20:17:13.438675 | 2019-02-19T08:20:01 | 2019-02-19T08:20:01 | 171,432,466 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 233 | java | package co.makestar.sbvmaker.model;
import lombok.Data;
@Data
public class SubElement {
TimeCode startTime;
TimeCode endTime;
String subTextKo;
String subTextJa;
String subTextEn;
String subTextZh;
String subStyle;
}
| [
"[email protected]"
] | |
4e761bf624ae42fd83f54a9c8156c5991b39a14f | de703694c2831e55a5ddaec78d9e14bb12ec38d5 | /ch06/src/sec13/exam02_constructor_access/package2/C.java | fb55da49b32d5231b23b40cf2b94baae32929aee | [] | no_license | witch49/Java | f4a0b184b21ff3d7701eafdf4232cfd7067a3ec4 | a367654d6482916e72f8b7d2514af9f1b75908e5 | refs/heads/master | 2020-04-28T19:36:14.886919 | 2019-05-31T01:51:58 | 2019-05-31T01:51:58 | 175,516,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 311 | java | package sec13.exam02_constructor_access.package2;
import sec13.exam02_constructor_access.package1.A;
public class C {
// Field
A a1 = new A(true);
// A a2 = new A(1); // 컴파일 에러. default 생성자 접근 불가
// A a3 = new A("문자열"); // 컴파일 에러. private 생성자 접근 불가
}
| [
"[email protected]"
] | |
6c9adac362a32966a2b0f650f826dbad866f57bf | 62c67d2d03170103515f25e07c0e7a735288a273 | /src/main/java/net/vectromc/vnitrogen/listeners/starterlisteners/ACStarterListener.java | 99093d40e34db1dffe27ce1eea33f45c47a8c486 | [] | no_license | AndyReckt/vCores | 9a70924f0cda3a4f48ccc60d94005b73c8e82ed5 | 6de2b359f8f7929040e4294087299fed1f73b1d6 | refs/heads/main | 2023-08-26T06:52:57.008409 | 2021-10-27T14:46:33 | 2021-10-27T14:46:33 | 377,546,745 | 1 | 0 | null | 2021-06-16T15:40:38 | 2021-06-16T15:40:38 | null | UTF-8 | Java | false | false | 1,526 | java | package net.vectromc.vnitrogen.listeners.starterlisteners;
import net.vectromc.vnitrogen.vNitrogen;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
public class ACStarterListener implements Listener {
private vNitrogen plugin;
public ACStarterListener() {
plugin = vNitrogen.getPlugin(vNitrogen.class);
}
@EventHandler
public void onChat(AsyncPlayerChatEvent event) {
Player player = event.getPlayer();
String message = event.getMessage();
if (message.startsWith("@ ")) {
if (player.hasPermission(plugin.getConfig().getString("AdminChat.permission"))) {
event.setCancelled(true);
String str = message.replaceFirst("@ ", "");
String world = player.getWorld().getName();
plugin.setPlayerColor(player);
for (Player managers : Bukkit.getOnlinePlayers()) {
if (managers.hasPermission(plugin.getConfig().getString("AdminChat.permission"))) {
managers.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("AdminChat.format").replaceAll("%world%", world).replaceAll("%player%", player.getDisplayName()).replaceAll("%message%", str)));
}
}
}
}
}
}
| [
"[email protected]"
] | |
def38ebf401d48df4b42c1357086c8d683bd3c05 | 48e835e6f176a8ac9ae3ca718e8922891f1e5a18 | /benchmark/training/org/pentaho/di/core/row/RowTest.java | a916a61e76d34f732300d0f8b2c8d73ee23adce8 | [] | 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 | 5,442 | java | /**
* ! ******************************************************************************
*
* Pentaho Data Integration
*
* Copyright (C) 2002-2018 by Hitachi Vantara : http://www.pentaho.com
*
* ******************************************************************************
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ****************************************************************************
*/
package org.pentaho.di.core.row;
import java.math.BigDecimal;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.junit.Assert;
import org.junit.ClassRule;
import org.junit.Test;
import org.pentaho.di.junit.rules.RestorePDIEnvironment;
public class RowTest {
@ClassRule
public static RestorePDIEnvironment env = new RestorePDIEnvironment();
@Test
public void testNormalStringConversion() throws Exception {
SimpleDateFormat fmt = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS");
Object[] rowData1 = new Object[]{ "sampleString", fmt.parse("2007/05/07 13:04:13.203"), new Double(9123.0), new Long(12345), new BigDecimal("123456789012345678.9349"), Boolean.TRUE };
RowMetaInterface rowMeta1 = createTestRowMetaNormalStringConversion1();
Assert.assertEquals("sampleString", rowMeta1.getString(rowData1, 0));
Assert.assertEquals("2007/05/07 13:04:13.203", rowMeta1.getString(rowData1, 1));
Assert.assertEquals("9,123.00", rowMeta1.getString(rowData1, 2));
Assert.assertEquals("0012345", rowMeta1.getString(rowData1, 3));
Assert.assertEquals("123456789012345678.9349", rowMeta1.getString(rowData1, 4));
Assert.assertEquals("Y", rowMeta1.getString(rowData1, 5));
fmt = new SimpleDateFormat("yyyyMMddHHmmss");
Object[] rowData2 = new Object[]{ null, fmt.parse("20070507130413"), new Double(9123.9), new Long(12345), new BigDecimal("123456789012345678.9349"), Boolean.FALSE };
RowMetaInterface rowMeta2 = createTestRowMetaNormalStringConversion2();
Assert.assertTrue(((rowMeta2.getString(rowData2, 0)) == null));
Assert.assertEquals("20070507130413", rowMeta2.getString(rowData2, 1));
Assert.assertEquals("9.123,9", rowMeta2.getString(rowData2, 2));
Assert.assertEquals("0012345", rowMeta2.getString(rowData2, 3));
Assert.assertEquals("123456789012345678.9349", rowMeta2.getString(rowData2, 4));
Assert.assertEquals("false", rowMeta2.getString(rowData2, 5));
}
@Test
public void testIndexedStringConversion() throws Exception {
String[] colors = new String[]{ "Green", "Red", "Blue", "Yellow", null };
// create some timezone friendly dates
SimpleDateFormat fmt = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss.SSS");
Date[] dates = new Date[]{ fmt.parse("2007/05/07 13:04:13.203"), null, fmt.parse("2007/05/05 05:15:49.349"), fmt.parse("2007/05/05 19:08:44.736") };
RowMetaInterface rowMeta = createTestRowMetaIndexedStringConversion1(colors, dates);
Object[] rowData1 = new Object[]{ Integer.valueOf(0), Integer.valueOf(0) };
Object[] rowData2 = new Object[]{ Integer.valueOf(1), Integer.valueOf(1) };
Object[] rowData3 = new Object[]{ Integer.valueOf(2), Integer.valueOf(2) };
Object[] rowData4 = new Object[]{ Integer.valueOf(3), Integer.valueOf(3) };
Object[] rowData5 = new Object[]{ Integer.valueOf(4), Integer.valueOf(0) };
Assert.assertEquals("Green", rowMeta.getString(rowData1, 0));
Assert.assertEquals("2007/05/07 13:04:13.203", rowMeta.getString(rowData1, 1));
Assert.assertEquals("Red", rowMeta.getString(rowData2, 0));
Assert.assertTrue((null == (rowMeta.getString(rowData2, 1))));
Assert.assertEquals("Blue", rowMeta.getString(rowData3, 0));
Assert.assertEquals("2007/05/05 05:15:49.349", rowMeta.getString(rowData3, 1));
Assert.assertEquals("Yellow", rowMeta.getString(rowData4, 0));
Assert.assertEquals("2007/05/05 19:08:44.736", rowMeta.getString(rowData4, 1));
Assert.assertTrue((null == (rowMeta.getString(rowData5, 0))));
Assert.assertEquals("2007/05/07 13:04:13.203", rowMeta.getString(rowData5, 1));
}
@Test
public void testExtractDataWithTimestampConversion() throws Exception {
RowMetaInterface rowMeta = createTestRowMetaNormalTimestampConversion();
Timestamp constTimestamp = Timestamp.valueOf("2012-04-05 04:03:02.123456");
Timestamp constTimestampForDate = Timestamp.valueOf("2012-04-05 04:03:02.123");
makeTestExtractDataWithTimestampConversion(rowMeta, " Test1", constTimestamp, constTimestamp);
makeTestExtractDataWithTimestampConversion(rowMeta, " Test2", new Date(constTimestamp.getTime()), constTimestampForDate);
makeTestExtractDataWithTimestampConversion(rowMeta, " Test3", new java.sql.Date(constTimestamp.getTime()), constTimestampForDate);
}
}
| [
"[email protected]"
] | |
4938430e1a88976df973e97c76b853fc9571d6c4 | fd3341a3aff59195f717f575b3582ea6767f3564 | /C86-S3-Ppk-springmvc/src/main/java/com/yc/damai/bean/Result.java | ae0f94b2c2e3d8afff69038d172ba1b5805e6c84 | [] | no_license | PK-git27/C86-Ppk | 7963324e807195ad2624b611fe8afd985e232dcd | d8c7c0f1645aa1d40ca5902eddf0dc094f11af03 | refs/heads/master | 2022-12-12T14:10:45.395010 | 2020-09-14T12:07:47 | 2020-09-14T12:07:47 | 285,532,225 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 824 | java | package com.yc.damai.bean;
public class Result {
private int code; //0失败,1成功
private String msg; //返回的信息
private Object data; //返回的数据
public Result() {
}
public Result(int code, String msg, Object data) {
this.code = code;
this.msg = msg;
this.data = data;
}
public Result(int code, String msg) {
this.code = code;
this.msg = msg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
@Override
public String toString() {
return "Result [code=" + code + ", msg=" + msg + ", data=" + data + "]";
}
}
| [
"pk@DESKTOP-V98436E"
] | pk@DESKTOP-V98436E |
96201934c8ca27301c4206ce2269bd3ffe3d4cfb | b6b2d056fbcfa544a6ae07e91ed9cedad9a19726 | /app/src/test/java/com/facol/giovani/bebumsenso/ExampleUnitTest.java | e156d3dc97a25fb53d04653a5ea0729ce160a112 | [] | no_license | GamerSenior/BebumSenso | 2a5d58351b2187e040fec88f1607bb7f999e28a8 | eec7aedb323938e2ee92d31a1b6aff5e7e9fd8be | refs/heads/master | 2021-04-12T08:18:34.177520 | 2018-03-21T00:55:47 | 2018-03-21T00:55:47 | 126,102,020 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 406 | java | package com.facol.giovani.bebumsenso;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
} | [
"[email protected]"
] | |
86e1c9abf93c86882596646b7ec8fe02289cff51 | d4a66f65524001d0b33d90f6d839981bf6f8c67c | /src/test/java/com/illud/redalert/repository/timezone/DateTimeWrapperRepository.java | f2a3e3b3ba45e86160a144351836dcb0be64bb1e | [] | no_license | illudtechzone/redAlert-Gateway | ea80fa5429d7a74f56addd7024aa75f2ba9d314f | f4ac4737526d3f195a8978497d27c145c0e74895 | refs/heads/master | 2023-05-14T14:36:20.082351 | 2019-07-22T06:58:24 | 2019-07-22T06:58:24 | 189,348,490 | 0 | 0 | null | 2023-05-01T06:08:43 | 2019-05-30T05:02:06 | Java | UTF-8 | Java | false | false | 337 | java | package com.illud.redalert.repository.timezone;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
/**
* Spring Data JPA repository for the DateTimeWrapper entity.
*/
@Repository
public interface DateTimeWrapperRepository extends JpaRepository<DateTimeWrapper, Long> {
}
| [
"[email protected]"
] | |
9f9f905e45bb055df8f683d88273f901453af1c6 | 154a40970b7d38230aea37153f3e9f89dfb07d03 | /Enterprise Application Development/17-EJB/src/br/com/fiap/bean/CursoBean.java | 8de74dacd3051dcbe00a11be0db8eab775b86648 | [] | no_license | chrizera/FIAP_EnterpriseAppDev | 968b460bf32d17eddf21247050bcd6019f96ce4c | 9e22849572183033ab3f6b9cf6d1e4473c22b339 | refs/heads/master | 2021-01-22T05:43:13.062556 | 2017-05-17T23:53:43 | 2017-05-17T23:53:43 | 81,689,003 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 816 | java | package br.com.fiap.bean;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import br.com.fiap.bo.CursoBO;
@ManagedBean
public class CursoBean {
private float nac, am, ps, enade, media;
@EJB
private CursoBO bo;
public void calcular() {
media = bo.calcularMedia(nac, ps, am, enade);
}
public float getNac() {
return nac;
}
public void setNac(float nac) {
this.nac = nac;
}
public float getAm() {
return am;
}
public void setAm(float am) {
this.am = am;
}
public float getPs() {
return ps;
}
public void setPs(float ps) {
this.ps = ps;
}
public float getEnade() {
return enade;
}
public void setEnade(float enade) {
this.enade = enade;
}
public float getMedia() {
return media;
}
public void setMedia(float media) {
this.media = media;
}
}
| [
"[email protected]"
] | |
0b4945279863c8575c2120e09c198769b7055bbe | 5aa4d6e75dff32e54ccaa4b10709e7846721af05 | /samples/j2ee/snippets/com.ibm.sbt.automation.test/src/main/java/com/ibm/sbt/test/controls/grid/CommunityRenderer.java | 930cf2e0b74986c94f6fe63e4a67e9e561606822 | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | gnuhub/SocialSDK | 6bc49880e34c7c02110b7511114deb8abfdee924 | 02cc3ac4d131b7a094f6983202c1b5e0043b97eb | refs/heads/master | 2021-01-16T20:08:07.509051 | 2014-07-09T08:53:03 | 2014-07-09T08:53:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,043 | java | /*
* � Copyright IBM Corp. 2012
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
package com.ibm.sbt.test.controls.grid;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import com.ibm.sbt.automation.core.test.BaseGridTest;
/**
* @author mwallace
*
* @date 5 Mar 2013
*/
public class CommunityRenderer extends BaseGridTest {
@Test
public void testGrid() {
assertTrue("Expected the test to generate a grid", checkGrid("Toolkit_Controls_Grid_CommunityRenderer", true));
}
}
| [
"[email protected]"
] | |
4bf1cb08733c6c60635ad581c4d56668489359b3 | baf6cbeaae61cc72ff468c67a6edd65786a34474 | /src/main/java/com/hananins/mysite/interceptor/MyInterceptor2.java | 052392867246e1b9f0ec4924889509d56501855d | [] | no_license | Choyoungju/realsite | 4acbf768b7f93908b5f10da9bc4e3c7d81cc401b | 0abc6876a8fb434073ca7696d7419813393c258a | refs/heads/master | 2023-04-08T16:11:28.775344 | 2023-03-18T16:46:40 | 2023-03-18T16:46:40 | 51,117,373 | 0 | 0 | null | 2023-03-18T16:46:41 | 2016-02-05T01:04:20 | Java | UTF-8 | Java | false | false | 474 | java | package com.hananins.mysite.interceptor;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
public class MyInterceptor2 extends HandlerInterceptorAdapter {
@Override
public boolean preHandle(HttpServletRequest request,
HttpServletResponse response, Object handler) throws Exception {
System.out.println(" 프리 콜");
return true;
}
}
| [
"[email protected]"
] | |
1bbb3cfc722b31cff6f42297fc76f9fecceed62f | 1ce45d6046c2cb37740c2cc65c1d42f2e9bd97b2 | /src/chap13/textbook/s130601/Person.java | d0026c525b5372ae41a1b8a5659ce658fe18d509 | [] | no_license | hyelee-jo/java20200929 | 52f9c06078586abaa79179ed18df6834513897d0 | e4b29bd0b51e07e6ee6e014bd52a497f84dad354 | refs/heads/master | 2023-02-20T19:11:46.953681 | 2021-01-15T03:29:24 | 2021-01-15T03:29:24 | 299,485,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 202 | java | package chap13.textbook.s130601;
public class Person {
private String name;
public Person(String name) {
this.name = name;
}
@Override
public String toString() {
return this.name;
}
}
| [
"[email protected]"
] | |
160cc0a24b684b5eab6c63761734e994f5789245 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/1/1_13897e71ebfd68d3562c5535712926cdd6c4af63/SmartSleep/1_13897e71ebfd68d3562c5535712926cdd6c4af63_SmartSleep_t.java | 5711a16842fee73506bfa5c4871beb4f3ac42e43 | [] | 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 | 2,523 | java | package robot.engine.relist.ocr;
import java.awt.image.BufferedImage;
import ocr.Ocr;
import org.sikuli.api.ScreenRegion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import robot.engine.commons.Controller;
import robot.engine.commons.ImageLogger;
import robot.region.TradePileRegion;
public class SmartSleep {
private static final int DEFAULT_SLEEP_IN_MILLIS = 3600000; // default to 1 hour
private TradePileRegion tradePileRegion;
private Controller controller;
private Ocr ocr;
public SmartSleep(Controller controller, TradePileRegion tradePileRegion) {
this.controller = controller;
this.tradePileRegion = tradePileRegion;
ocr = new Ocr();
}
private boolean clickFirstCard() {
Logger logger = LoggerFactory.getLogger(this.getClass());
ScreenRegion firstCard = tradePileRegion.findFirstCard(1000);
boolean successful = false;
logger.info("looking for first card...");
if(firstCard != null) {
logger.info("clicking first card");
controller.clickCenterOf(firstCard);
successful = true;
}
return successful;
}
private int parseRemainingTime(String s) {
Logger logger = LoggerFactory.getLogger(this.getClass());
logger.info("Parsing Raw Time Ramaining String");
return new TimeParser(s).getInMillis();
}
private int calculateFromRemaining(BufferedImage timeBox) {
Logger logger = LoggerFactory.getLogger(this.getClass());
logger.info("OCR Time Remaining - start");
String s = ocr.recognizeCharacters(timeBox);
logger.info("OCR aquired: {}", s);
int timeRemaining = parseRemainingTime(s);
logger.info("OCR parsed: {} millis", timeRemaining);
return timeRemaining;
}
// ensure full screen refresh first - wait for a second :)
private void sleepForASec() throws InterruptedException {
Thread.sleep(1000);
}
public int getRequiredSleepTime() throws InterruptedException {
int sleepTime = DEFAULT_SLEEP_IN_MILLIS;
Logger logger = LoggerFactory.getLogger(this.getClass());
sleepForASec();
if(clickFirstCard()) {
logger.info("looking for time remaining");
ScreenRegion timeRemaining = tradePileRegion.findTimeRemaining(2000);
if(timeRemaining != null) {
sleepForASec();
BufferedImage timeBox = timeRemaining.capture();
ImageLogger.getLogger().logToResource(timeBox);
sleepTime = calculateFromRemaining(timeBox);
}
else {
logger.info("could not find time remaining!");
}
}
return sleepTime;
}
}
| [
"[email protected]"
] | |
313d1fa021e05da50db54beaaf315aa2d9970695 | faf0682f5b489cc12f1e58498e2dd41fc0e82111 | /app/src/main/java/com/gcu/liam/muccoursework/laMapActivity.java | e99a5734761c14a33cebb0b4709a3bb8aeb961dd | [] | no_license | Baranzo94/MUC-Coursework | 0c02f1a84c79a367366aae93f9c3bfaf534338e0 | cf484b34be35fc32bac354e06b841cc3183060c5 | refs/heads/master | 2021-05-02T13:08:26.014805 | 2015-12-15T22:05:46 | 2015-12-15T22:05:46 | 44,912,991 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,421 | java | package com.gcu.liam.muccoursework;
import android.annotation.TargetApi;
import android.content.pm.ActivityInfo;
import android.os.Build;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import android.support.v4.app.FragmentActivity;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
/**
* Created by Liam on 08/12/2015.
*/
public class laMapActivity extends AppCompatActivity
{
List<laMapData> mapDataList;
private Marker[] mapDataMarkerList = new Marker[5];
private GoogleMap maplunchtime;
private float markerColours[] = {210.0f, 120.0f, 300.0f, 330.0f, 270.0f};
private LatLng latLngGlasgowCentre = new LatLng (55.861201, -4.250385);
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
setContentView(R.layout.la_map_view);
mapDataList = new ArrayList<laMapData>();
laMapDataDBMgr mapDB = new laMapDataDBMgr(this,"lunchtimeInfo.s3db",null,1);
try {
mapDB.dbCreate();
} catch (IOException e) {
e.printStackTrace();
}
mapDataList = mapDB.allMapData();
SetUpMap();
AddMarkers();
}
public void SetUpMap()
{
maplunchtime = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
if (maplunchtime != null)
{
maplunchtime.moveCamera(CameraUpdateFactory.newLatLngZoom(latLngGlasgowCentre, 12));
maplunchtime.setMyLocationEnabled(true);
maplunchtime.getUiSettings().setCompassEnabled(true);
maplunchtime.getUiSettings().setMyLocationButtonEnabled(true);
maplunchtime.getUiSettings().setRotateGesturesEnabled(true);
}
}
public void AddMarkers()
{
MarkerOptions marker;
laMapData mapData;
String mrkTitle;
String mrkText;
for(int i = 0; i < mapDataList.size(); i++)
{
mapData = mapDataList.get(i);
mrkTitle = mapData.getVenue();
mrkText = "Lunch Choice";
marker = SetMarker(mrkTitle, mrkText, new LatLng(mapData.getLatitude(), mapData.getLongitude()), markerColours[i],true);
mapDataMarkerList[i] = maplunchtime.addMarker(marker);
}
}
public MarkerOptions SetMarker (String title, String snippet, LatLng position, float markerColour, boolean centreAnchor)
{
float anchorX;
float anchorY;
if (centreAnchor)
{
anchorX = 0.5f;
anchorY = 0.5f;
}
else
{
anchorX = 0.05f;
anchorY = 1.0f;
}
MarkerOptions marker = new MarkerOptions().title(title).snippet(snippet).icon(BitmapDescriptorFactory.defaultMarker(markerColour)).anchor(anchorX, anchorY).position(position);
return marker;
}
}
| [
"[email protected]"
] | |
7162b673b21f3abd9770a10b01d5c968305aac42 | 2c1a40e80228db30410370f3b4f2ce04b2f03c01 | /serverv2/src/main/java/com/kiwihouse/shiro/realm/JwtRealm.java | f92852583aebd3a8b337e012a17d418e72367091 | [] | no_license | SxxGDZB/SxxGDZB-customization | 5bbc6508dae521812d8e72ee7cd4fc8e90b13a16 | 85873f6033b6c2bd81018d0197aba52566d85a80 | refs/heads/master | 2023-02-16T23:33:19.442961 | 2021-01-11T07:16:29 | 2021-01-11T07:16:29 | 289,149,752 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,070 | java | package com.kiwihouse.shiro.realm;
import com.kiwihouse.shiro.token.JwtToken;
import com.kiwihouse.util.JsonWebTokenUtil;
import io.jsonwebtoken.MalformedJwtException;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationInfo;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.SimpleAuthenticationInfo;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.realm.AuthorizingRealm;
import org.apache.shiro.subject.PrincipalCollection;
import java.util.Map;
import java.util.Set;
/**
* @author tomsun28
* @date 18:07 2018/3/3
*/
public class JwtRealm extends AuthorizingRealm {
private static final String JWT = "jwt:";
private static final int NUM_4 = 4;
private static final char LEFT = '{';
private static final char RIGHT = '}';
@Override
public Class<?> getAuthenticationTokenClass() {
// 此realm只支持jwtToken
return JwtToken.class;
}
@Override
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principalCollection) {
String payload = (String) principalCollection.getPrimaryPrincipal();
// likely to be json, parse it:
if (payload.startsWith(JWT) && payload.charAt(NUM_4) == LEFT
&& payload.charAt(payload.length() - 1) == RIGHT) {
Map<String, Object> payloadMap = JsonWebTokenUtil.readValue(payload.substring(4));
Set<String> roles = JsonWebTokenUtil.split((String)payloadMap.get("roles"));
Set<String> permissions = JsonWebTokenUtil.split((String)payloadMap.get("perms"));
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
if(null!=roles&&!roles.isEmpty()) {
info.setRoles(roles);
}
if(null!=permissions&&!permissions.isEmpty()) {
info.setStringPermissions(permissions);
}
return info;
}
return null;
}
@Override
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken authenticationToken) throws AuthenticationException {
if (!(authenticationToken instanceof JwtToken)) {
return null;
}
JwtToken jwtToken = (JwtToken)authenticationToken;
String jwt = (String)jwtToken.getCredentials();
String payload = null;
try{
// 预先解析Payload
// 没有做任何的签名校验
payload = JsonWebTokenUtil.parseJwtPayload(jwt);
} catch(MalformedJwtException e){
//令牌格式错误
throw new AuthenticationException("errJwt");
} catch(Exception e){
//令牌无效
throw new AuthenticationException("errsJwt");
}
if(null == payload){
//令牌无效
throw new AuthenticationException("errJwt");
}
return new SimpleAuthenticationInfo("jwt:"+payload,jwt,this.getName());
}
}
| [
"[email protected]"
] | |
5d232041ba8351f1fa3265f4472849f26fbae2a5 | f7f1066e9ece490f9a7b061d232ee398813c6348 | /ExercicioGit1/src/Main.java | 148d3b45100b2be13a3ed565a187084afa32a486 | [] | no_license | nestoraugusto/ExercicioGit1 | 7fd10b5afc86073a0a92d07ea256cfda95b7077c | 2686a7e348d817978e845332a83572c3921ac775 | refs/heads/master | 2021-01-23T11:47:43.488409 | 2015-04-07T00:57:17 | 2015-04-07T00:57:30 | 33,513,522 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 123 | java |
public class Main {
public static void main(String[] args) {
System.out.println("Eu sei Criar isso");
}
}
| [
"[email protected]"
] | |
3f4900d52d5e212601d6055f3a5faf9fbca4b55c | 4efd66eae04919addaae948c9a6f93a2f8da46bf | /Coding/src/basicAlgorithm/Comb43.java | 5838345db3c49d20a2926bb00c1788add0e2595d | [] | no_license | Mezier/Java-Practice | d23d741cb1fa40fca06e0d242c9014f9e91096d3 | 12241591a8fd6d7b484557c689badaaa2519a4f2 | refs/heads/master | 2021-09-12T18:17:27.959208 | 2018-04-19T20:36:28 | 2018-04-19T20:36:28 | 106,926,256 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 323 | java | package basicAlgorithm;
public class Comb43 {
private static int com(int n){
int sum=0;
for(int i=0;i<=n;i++){
for(int j=0;j<=n;j++){
if((i*10+j)%2==0){
sum++;
}
}
}
return sum;
}
public static void main(String[] args) {
System.out.println(com(7));
}
}
| [
"[email protected]"
] | |
f45bb894f3d23f7123c84b187a6e027c74f23970 | 182d0f4acc532472514c1a5f292436866145726a | /src/com/shangde/edu/cus/domain/Experience.java | 93b7f9648fd8c8f1a2a66de62918496d5119f556 | [] | no_license | fairyhawk/sedu_admin-Deprecated | 1c018f17381cd195a1370955b010b3278d893309 | eb3d22edc44b2c940942d16ffe2b4b7e41eddbfb | refs/heads/master | 2021-01-17T07:08:44.802635 | 2014-01-25T10:28:03 | 2014-01-25T10:28:03 | 8,679,677 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 951 | java | package com.shangde.edu.cus.domain;
import java.io.Serializable;
public class Experience implements Serializable{
/**
* 当前经验值
*/
private int expValue;
/**
* 下一级的经验值
*/
private int nextExpValue;
/**
* 当前级别名称
*/
private String expName;
/**
* 当前等级
*/
private int expLevel;
public int getExpValue() {
return expValue;
}
public void setExpValue(int expValue) {
this.expValue = expValue;
}
public int getNextExpValue() {
return nextExpValue;
}
public void setNextExpValue(int nextExpValue) {
this.nextExpValue = nextExpValue;
}
public String getExpName() {
return expName;
}
public void setExpName(String expName) {
this.expName = expName;
}
public int getExpLevel() {
return expLevel;
}
public void setExpLevel(int expLevel) {
this.expLevel = expLevel;
}
}
| [
"[email protected]"
] | |
27b0a82f581f45992b6231affb74e6d3c951c03d | c6d0f30f0a1476b573986f4c412740ed01e66989 | /bottle-api/src/main/java/com/teorange/magic/bottle/api/model/cache/QiniuToken.java | 95662e6c18817539ecc22dad331c94ee0341ccb1 | [
"Apache-2.0"
] | permissive | kellen0903/magic-bottle | 0bc31ca634c703fe7d5fab9197d97a77d0c41a59 | 4128e11bf4d27495c3d66a4b2c25c1f4f264335b | refs/heads/master | 2022-11-09T10:11:21.041112 | 2020-03-10T22:40:24 | 2020-03-10T22:40:24 | 246,284,006 | 34 | 12 | Apache-2.0 | 2022-10-12T20:37:32 | 2020-03-10T11:34:13 | Java | UTF-8 | Java | false | false | 280 | java | package com.teorange.magic.bottle.api.model.cache;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* Created by kellen on 2018/5/30.
*/
@Data
public class QiniuToken implements Serializable {
private String token;
private Date expireTime;
}
| [
"[email protected]"
] | |
5e26219146502d06b31338866b4c372867bd15d0 | 095557569d3596125f1291359b044b1d0849b780 | /core/src/main/java/com/cc/core/wechat/hook/DbHooks.java | 97d61c665f9788800fc4898f5144e969fad398dd | [] | no_license | 907043175/MMCtl | 1d6692f02a6a72391d21fb88614a49350d11a9a4 | d7f2b3dd697dfa45873085558a3a37be8537de16 | refs/heads/master | 2020-05-04T10:35:42.733782 | 2019-02-25T15:44:03 | 2019-02-25T15:44:03 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,332 | java | package com.cc.core.wechat.hook;
import com.cc.core.command.Callback;
import com.cc.core.data.db.DbService;
import com.cc.core.data.db.model.DBPassword;
import com.cc.core.log.KLog;
import com.cc.core.wechat.Wechat;
import com.cc.core.xposed.BaseXposedHook;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XposedHelpers;
public class DbHooks extends BaseXposedHook {
@Override
public void hook(ClassLoader classLoader) {
Class classSQLiteDatabase = XposedHelpers.findClass("com.tencent.wcdb.database.SQLiteDatabase", classLoader);
Class classSQLiteDatabaseConfiguration = XposedHelpers.findClass("com.tencent.wcdb.database.SQLiteDatabaseConfiguration", classLoader);
Class classSQLiteCipherSpec = XposedHelpers.findClass("com.tencent.wcdb.database.SQLiteCipherSpec", classLoader);
XposedHelpers.findAndHookMethod("com.tencent.wcdb.database.SQLiteConnectionPool",
classLoader,
"open",
classSQLiteDatabase,
classSQLiteDatabaseConfiguration,
byte[].class,
classSQLiteCipherSpec,
int.class,
new XC_MethodHook() {
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
byte[] passwordBuffer = (byte[]) param.args[2];
if (passwordBuffer == null) {
return;
}
String path = (String) XposedHelpers.getObjectField(param.args[1], "path");
if (!path.endsWith("EnMicroMsg.db")) {
return;
}
Wechat.DB_PATH = path;
Wechat.DB_PASSWORD = new String(passwordBuffer);
boolean hmacEnabled = XposedHelpers.getBooleanField(param.args[3], "hmacEnabled");
int kdfIteration = XposedHelpers.getIntField(param.args[3], "kdfIteration");
int pageSize = XposedHelpers.getIntField(param.args[3], "pageSize");
String sql = String.format(
"PRAGMA key = '%s';" +
"PRAGMA cipher_use_hmac = %s;" +
"PRAGMA cipher_page_size = %d;" +
"PRAGMA kdf_iter = %d;", Wechat.DB_PASSWORD, hmacEnabled ? "ON" : "OFF", pageSize, kdfIteration);
DBPassword password = new DBPassword();
password.setDecryptSql(sql);
password.setPassword(new String(passwordBuffer));
password.setPath(path);
password.setWechatId(Wechat.LoginWechatId);
/*DbService.getInstance().insertDbPassword(password, new Callback() {
@Override
public void onResult(String result) {
KLog.d("password has saved");
}
});*/
KLog.e("XPosed", "----- path: " + path + ", decrypt sql: " + sql);
}
});
}
}
| [
"[email protected]"
] | |
218a4b6f2467f1d3cda7bbfb663491abd7291d21 | 446d682a06969b04ff637f83fa71b2448fda423f | /tinker/common/IActiveLogic.java | 6c1e60d6bf769c34ce47828a200a40ec7f82f68b | [] | no_license | agaricusb/TinkersConstruct | 21ad2db01f867a1397788e80be334c7b5bab9213 | 2f5d798753d1642eb5ee5f15270b6fe73bfdce3c | refs/heads/master | 2021-01-16T00:17:33.310208 | 2013-03-09T11:49:04 | 2013-03-09T11:49:04 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 124 | java | package tinker.common;
public interface IActiveLogic
{
public boolean getActive();
public void setActive(boolean flag);
} | [
"[email protected]"
] | |
b24ef74efef23e65db94688448cb889d57523b9b | 32ca101b67386e514d4521e4d0d857181bde0919 | /javaSE_20180801/src/com/test113/Main.java | e750e490257a19a933a9e90c166b51dcee0c3538 | [] | no_license | JeonEunmi/javaSE | a51fb8f4631bfba963d47b806e17eff9464c7fc0 | cbbde15cc71eb6257b6e3baa27679be9bd4c8cc7 | refs/heads/master | 2020-04-11T10:39:50.453601 | 2018-12-14T07:23:50 | 2018-12-14T07:23:50 | 161,722,611 | 0 | 0 | null | null | null | null | UHC | Java | false | false | 438 | java | package com.test113;
public class Main {
public static void main(String[] args) {
// Box<T> 클래스에 대한 객체 생성
// -> 타입파라미터에 대한 명시적 자료형 지정 필요
// String, Integer로 지정한 경우
Box<String, Integer> box1 = new Box<String, Integer>("M01", 100);
System.out.println(box1.getKey()); //"M01"
System.out.println(box1.getValue()); // 100
}
}
| [
"[email protected]"
] | |
33de74023cdc18a141c97c908ccffeeb7aa53cc3 | 355238dbe3a312bb055f57d9f7aaeac93bdf7f6b | /app/src/main/java/com/muli/m_pos/ui/login/LoadingActivity.java | 1853de05b8b19655b82e7aadaec07b98271d34f7 | [] | no_license | DeroMuli/M-POS | 9d2f8f0f88c943708f62b573fd0968fe8911eeaf | 8114e0d6ba13cb50eb6b9602c4411b7c9383fb00 | refs/heads/master | 2023-03-26T06:33:50.279596 | 2021-03-19T08:44:10 | 2021-03-19T08:44:10 | 349,347,038 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,556 | java | package com.muli.m_pos.ui.login;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.database.Cursor;
import android.os.AsyncTask;
import android.os.Bundle;
import com.muli.m_pos.R;
import com.muli.m_pos.model.AccountInfoProvider;
import com.muli.m_pos.model.ItemCardData;
import com.muli.m_pos.model.SetUpProductNCategories;
import com.muli.m_pos.ui.main.MainActivity;
import java.util.ArrayList;
import java.util.HashMap;
public class LoadingActivity extends AppCompatActivity {
public static ArrayList<String> Categories = new ArrayList<>();
public static HashMap<String,ArrayList> Products = new HashMap<>();
public static HashMap<Integer,String> id_name_mapping = new HashMap<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_loading);
SetUp setUp = new SetUp();
setUp.execute();
Load load = new Load();
load.execute();
}
private class Load extends AsyncTask<Void,Void, Boolean>{
@Override
protected Boolean doInBackground(Void... voids) {
String selecion = AccountInfoProvider.LOGGED + " = ? ";
Cursor c = getContentResolver().query(AccountInfoProvider.Offline_Uri,null,selecion,new String[]{AccountInfoProvider.Logged_In},null);
if(c.moveToFirst())
return true;
else
return false;
}
@Override
protected void onPostExecute(Boolean s) {
super.onPostExecute(s);
if(s == false){
Intent intent = new Intent(getBaseContext(),LoginActivity.class);
startActivity(intent);
}
else {
Intent intent = new Intent(getBaseContext(), MainActivity.class);
startActivity(intent);
}
}
}
private class SetUp extends AsyncTask<Void,Void,Void>{
@Override
protected Void doInBackground(Void... voids) {
Cursor category_cursor = getContentResolver().query(AccountInfoProvider.Category_Uri, null, null, null, null);
if (category_cursor.moveToFirst()) {
do {
String category_name = category_cursor.getString(1);
int id = category_cursor.getInt(0);
Categories.add(category_name);
id_name_mapping.put(id, category_name);
} while (category_cursor.moveToNext());
}
for (int i : id_name_mapping.keySet()) {
ArrayList<ItemCardData> arrayList = new ArrayList<>();
String select = AccountInfoProvider.Category_id + " = ? ";
Cursor product_cursor = getContentResolver().query(AccountInfoProvider.Product_Uri, null, select, new String[]{String.valueOf(i)}, null);
if (product_cursor.moveToFirst()) {
do {
String name = product_cursor.getString(1);
int price = product_cursor.getInt(2);
String image = product_cursor.getString(3);
ItemCardData itemCardData = new ItemCardData(image, name, price);
arrayList.add(itemCardData);
} while (product_cursor.moveToNext());
}
Products.put(id_name_mapping.get(i), arrayList);
}
return null;
}
}
} | [
"[email protected]"
] | |
49acf2b0d1ddad32e60eee90da4afdc239d6cd32 | 32ad774f5dc75bc74533bb72304d05d6c514e7a8 | /03-java-spring/03-spring-data-ii/03-products-and-categories/src/main/java/com/jeremyakatsa/productsandcategories/models/Association.java | c2b8dd4ab7f1dc8fd2ad28d2e013b026e9666a3f | [] | no_license | Java-September-2020/JeremyA-Assignments | 4ea768e0253621187baed6185105772848cd680a | b56bec9c41880eca1becb4e4054d5ef36b02e8f3 | refs/heads/master | 2022-12-30T18:34:59.904635 | 2020-10-22T01:54:53 | 2020-10-22T01:54:53 | 292,137,154 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,675 | java | package com.jeremyakatsa.productsandcategories.models;
import java.util.Date;
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.PostPersist;
import javax.persistence.PrePersist;
import javax.persistence.Table;
@Entity
@Table(name="associations")
public class Association {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private Long id;
@Column(updatable=false)
private Date createdAt;
private Date updatedAt;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="product_id")
private Product product;
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="category_id")
private Category category;
public Association() {
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Date getCreatedAt() {
return createdAt;
}
public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}
public Date getUpdatedAt() {
return updatedAt;
}
public void setUpdatedAt(Date updatedAt) {
this.updatedAt = updatedAt;
}
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
public Category getCategory() {
return category;
}
public void setCategory(Category category) {
this.category = category;
}
@PrePersist
protected void onCreate() {
this.createdAt = new Date();
}
@PostPersist
protected void onUpdate() {
this.updatedAt = new Date();
}
}
| [
"[email protected]"
] | |
7b930b974663d68f8d0f56669047d48ede80cbba | 03af346931a0ffe709893029e62cde771be865bc | /app/src/main/java/com/example/ElectronicsStore/DiscountChain.java | c4a7fb40cdec8f33604994ab60086e79b3c28736 | [] | no_license | DannyBrassil/ElectronicsStore | 20ce1ee21fd430142f4a786b60f0deb97166955d | 07405e6909872cf5ae9461f572cd83108967ec64 | refs/heads/master | 2023-04-10T08:52:01.202352 | 2021-04-18T22:02:57 | 2021-04-18T22:02:57 | 355,619,569 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 189 | java | package com.example.ElectronicsStore;
public interface DiscountChain {
public void setNextChain(DiscountChain nextChain);
public abstract boolean apply(DiscountOption option);
}
| [
"[email protected]"
] | |
e3d0039a54e95f17ac7002718c6743e57ac81a4b | 2eac37e1db2a1d823fec8e30aa0375addeec250a | /03. Backups/2016-06-25/BkavSignatures/src/com/bkav/bkavsignature/test/CertificateRevocationTest.java | bc29045e312ede43fa1ec9d000d4464c95389870 | [] | no_license | tuanbs232/Digital-Signatures | d9e0cbab1a910ffe0f9643e104d95d0c80d29617 | 8a531b3fb567cb732bf170435c04ac829931b650 | refs/heads/master | 2020-12-25T16:55:20.137301 | 2016-08-09T09:38:55 | 2016-08-09T09:38:55 | 53,737,294 | 2 | 2 | null | null | null | null | UTF-8 | Java | false | false | 11,596 | java | package com.bkav.bkavsignature.test;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.security.interfaces.RSAPublicKey;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.log4j.Logger;
import com.bkav.bkavsignature.utils.BkavSignaturesException;
import com.bkav.bkavsignature.utils.CryptoToken;
import com.bkav.bkavsignature.utils.CryptoTokenUtil;
import com.bkav.bkavsignature.validationservice.CertificateValidator;
import com.bkav.bkavsignature.validationservice.OCSPValidator;
import com.itextpdf.text.pdf.codec.Base64;
public class CertificateRevocationTest {
private static final Logger LOG = Logger
.getLogger(CertificateRevocationTest.class);
static String SUB_RA_CERT_1 = "MIIEHDCCAwSgAwIBAgIQVAMv2cWFTP8PWmh0TMCYxTANBgkqhkiG9w0BAQUFADBJMQswCQYDVQQGEwJWTjEOMAwGA1UEBxMFSGFub2kxGTAXBgNVBAoTEEJrYXYgQ29ycG9yYXRpb24xDzANBgNVBAMTBkJrYXZDQTAeFw0xNTA2MjMxNDIzMjBaFw0xNjA2MjIxNDIzMjBaMIGTMR4wHAYKCZImiZPyLGQBAQwOTVNUOjAyMDEyOTUxMDYxOjA4BgNVBAMMMUPDtG5nIFR5IFROSEggxJDhuqd1IFTGsCBE4buLY2ggVuG7pSBIb8OgbmcgUGjDoXQxETAPBgNVBAcMCEjhuqNpIEFuMRUwEwYDVQQIDAxI4bqjaSBQaMOybmcxCzAJBgNVBAYTAlZOMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMkCd4cDDHKgUoGlp3CXWwbL6Vceid8l4QVh4sohsvUpAMbpHXheIP+YqmLZCcndrnSV4FPo36kxtDLwNt+zIgtbPmYw2WYvuf57CfVNH4ObLX0kIG9cdMQwHhoFYmCswQ7hs/s/lk8PriQqXl+6bor4mce7uduKpxp3PWXnuXyQIDAQABo4IBNzCCATMwMQYIKwYBBQUHAQEEJTAjMCEGCCsGAQUFBzABhhVodHRwOi8vb2NzcC5ia2F2Y2Eudm4wHQYDVR0OBBYEFNizSU2eCIhn0J0sJ3mJnY8b8E+WMAwGA1UdEwEB/wQCMAAwHwYDVR0jBBgwFoAUHrAPSJff0MNnp0aEO1g7iA1TlIYwfwYDVR0fBHgwdjB0oCOgIYYfaHR0cDovL2NybC5ia2F2Y2Eudm4vQmthdkNBLmNybKJNpEswSTEPMA0GA1UEAwwGQmthdkNBMRkwFwYDVQQKDBBCa2F2IENvcnBvcmF0aW9uMQ4wDAYDVQQHDAVIYW5vaTELMAkGA1UEBhMCVk4wDgYDVR0PAQH/BAQDAgeAMB8GA1UdJQQYMBYGCCsGAQUFBwMEBgorBgEEAYI3CgMMMA0GCSqGSIb3DQEBBQUAA4IBAQCPqZU1E3MRNU+jldlfbsUs3ImrTWh4lQSlnax5ytIyLHmShl6LABpkLyFO+yETSlYh6wAei+ERACEd118msatnkxJEfMSrh4QEhQvD/d9WyOVpMIz+Kc+wxgwUP26ow64ot24EUKNg63q9dTVCPRPlUV/nZC1avxCky7BJNaonbBGIpugxkhla0e7YAvIQsOfbo3moUlvltmUAdAuwDVfrzd2DQqpQsg0peJMy2bEQhu3twosl/0T4pukHo4ghivpNJla0mmkcJanCu/JcQv2oE8TBbcZix2/W1UGDtQXJ8C9Rt4UEN383tKgz/Ppp6arWMzCGv0q01Bq9O6dMOZ3m";
static String SUB_RA_CERT_3 = "MIIEGDCCAwCgAwIBAgIQVAMJeRoHzrj4PnxycQ1nfjANBgkqhkiG9w0BAQUFADBJMQswCQYDVQQGEwJWTjEOMAwGA1UEBxMFSGFub2kxGTAXBgNVBAoTEEJrYXYgQ29ycG9yYXRpb24xDzANBgNVBAMTBkJrYXZDQTAeFw0xNTA2MjAyMzI0MDdaFw0xNjA2MTkyMzI0MDdaMIGPMR4wHAYKCZImiZPyLGQBAQwOTVNUOjAyMDA5MDk1OTMxNTAzBgNVBAMMLEPDtG5nIFR5IEPhu5UgUGjhuqduIFRoxrDGoW5nIE3huqFpIFbEqW5oIFZ5MRIwEAYDVQQHDAlMw6ogQ2jDom4xFTATBgNVBAgMDEjhuqNpIFBow7JuZzELMAkGA1UEBhMCVk4wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKTPOek4HQ9Chd3Xm+Dy9SgnEmhj0pjIkPNcwnBI5wLa6NQ8VbbLmu2862J05TNsr08/LrsMGKC57g87p7028aLR5HUXrExOK2+YgpaMmZw4VSBhlfPZM/K+ANjRooBN164Nz/8nk/EhxY9VxFgJvwSJNHuX1gcGc2leMl6K0AnfAgMBAAGjggE3MIIBMzAxBggrBgEFBQcBAQQlMCMwIQYIKwYBBQUHMAGGFWh0dHA6Ly9vY3NwLmJrYXZjYS52bjAdBgNVHQ4EFgQUIKt0BcolkINBN6/UlQnvmJPL1bowDAYDVR0TAQH/BAIwADAfBgNVHSMEGDAWgBQesA9Il9/Qw2enRoQ7WDuIDVOUhjB/BgNVHR8EeDB2MHSgI6Ahhh9odHRwOi8vY3JsLmJrYXZjYS52bi9Ca2F2Q0EuY3Jsok2kSzBJMQ8wDQYDVQQDDAZCa2F2Q0ExGTAXBgNVBAoMEEJrYXYgQ29ycG9yYXRpb24xDjAMBgNVBAcMBUhhbm9pMQswCQYDVQQGEwJWTjAOBgNVHQ8BAf8EBAMCB4AwHwYDVR0lBBgwFgYIKwYBBQUHAwQGCisGAQQBgjcKAwwwDQYJKoZIhvcNAQEFBQADggEBAHdy3LzE3+5op+YipX82IP383AlKW0zeK4/K4A+LLdRwpkbahbbYZPsO1J9E3dBY5piKy644Ff/hSwgzfX9ZqiALRf2sGDfoG0DWOLB0sSCsarBsKwmMe5lcQojB3F3C3P5kAqURVYPYGLgUkyjTVFp866fQAPZ6D0I4c832dbD4fPx81OTuXxRSiRG9I3SeGMrxs1cHCAHWALvLwbgI9/NTGqFJMfGY2WGKskNBqydqxEJPiRxCqf2JkVs35wVZofM68r58OYl4SQnJaRySInH9nPvItnFKRYjAI3oiehhdeDzXM763kQjjWE9R/Zb3++INxkNrZJ8t6K33JYvZ58M=";
static String SUB_RA_CERT_2 = "MIIEHzCCAwegAwIBAgIQVANw4UlPXfr43CWcIUYVpjANBgkqhkiG9w0BAQUFADBJMQswCQYDVQQGEwJWTjEOMAwGA1UEBxMFSGFub2kxGTAXBgNVBAoTEEJrYXYgQ29ycG9yYXRpb24xDzANBgNVBAMTBkJrYXZDQTAeFw0xNTA2MjAyMzI0MzhaFw0xNjA2MTkyMzI0MzhaMIGWMR4wHAYKCZImiZPyLGQBAQwOTVNUOjAyMDA2NDg3MTExOTA3BgNVBAMMMEPDtG5nIFR5IEPhu5UgUGjhuqduIFRoxrDGoW5nIE3huqFpIE1p4buBbiBC4bqvYzEVMBMGA1UEBwwMTmfDtCBRdXnhu4FuMRUwEwYDVQQIDAxI4bqjaSBQaMOybmcxCzAJBgNVBAYTAlZOMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCuONjk43L6lKGYKFGRCx9w/wowfpKM4vPx5SYlNBaiq6C8+H6EHalUMLgYpyob9iPhh+HmKBWDR08FAojrDTpKvAWJBOPG60rkPFoo+NExbIcc61GcdEiBAzOHZEAMI0hoCRA9LLCCMjLU4P0AAaL4H7FCAR8T2GWiqA5IePlRvQIDAQABo4IBNzCCATMwMQYIKwYBBQUHAQEEJTAjMCEGCCsGAQUFBzABhhVodHRwOi8vb2NzcC5ia2F2Y2Eudm4wHQYDVR0OBBYEFK1znt/rvwdaMADClYBIk6V7z1tvMAwGA1UdEwEB/wQCMAAwHwYDVR0jBBgwFoAUHrAPSJff0MNnp0aEO1g7iA1TlIYwfwYDVR0fBHgwdjB0oCOgIYYfaHR0cDovL2NybC5ia2F2Y2Eudm4vQmthdkNBLmNybKJNpEswSTEPMA0GA1UEAwwGQmthdkNBMRkwFwYDVQQKDBBCa2F2IENvcnBvcmF0aW9uMQ4wDAYDVQQHDAVIYW5vaTELMAkGA1UEBhMCVk4wDgYDVR0PAQH/BAQDAgeAMB8GA1UdJQQYMBYGCCsGAQUFBwMEBgorBgEEAYI3CgMMMA0GCSqGSIb3DQEBBQUAA4IBAQB576Qyl7opDWM7BoTvWUeEblRx4D5v5RAoxHrSAi6HrIQbza+8hJU56VqbVJWKHyiaawdJ9GKC8heUc75YzIenqqP7U6/P3pm95VPyHIZXayCtJBS2VHBDwWYSl+cEKBOAJyI8PKiQL1nhix5mFXYlO1i5i4Wc+HuQbadtG473WAXYXgwhx6jr6xCaD3LlwGC5/7JwJNZ1+hLk0yRZbGPYsDa6e500LAz1kQCnKJVczCMomaMB8ePuHLlm6HBa2DWh2A4be/O4X2dgPGCt1J+G7pntKM4Ejswi5eCgtos7GXbBgs26o8Unf4iAKunfiQ+tq4NyBYrs1fqD5Lg5ztgS";
public static void main(String[] args) {
testCertOK();
}
public static void checkCertificate(String base64CertData) {
try {
X509Certificate x509Cert = getCertFromBase64(base64CertData);
int code = CertificateValidator.verify(x509Cert, null, new Date(),
true, CertificateValidator.ONLY_CRL);
System.out.println("" + code + ": "
+ CertificateValidator.getVerifyErrorName(code));
} catch (CertificateException e) {
e.printStackTrace();
} catch (BkavSignaturesException e) {
e.printStackTrace();
}
}
private static X509Certificate getCertFromBase64(String input)
throws BkavSignaturesException, CertificateException {
X509Certificate result = null;
if (!isBase64(input)) {
LOG.error("Invalid Certificate data");
throw new BkavSignaturesException("Invalid Certificate data");
}
byte[] inputBytes = Base64.decode(input);
ByteArrayInputStream inStream = new ByteArrayInputStream(inputBytes);
try {
CertificateFactory factory = CertificateFactory.getInstance("X509");
Certificate cert = factory.generateCertificate(inStream);
if (cert instanceof X509Certificate) {
result = (X509Certificate) cert;
}
} catch (CertificateException e) {
LOG.error("" + e.getMessage());
throw e;
}
return result;
}
private static boolean isBase64(String input) {
String pattern = "^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$";
Pattern regex = Pattern.compile(pattern);
Matcher matcher = regex.matcher(input);
return matcher.matches();
}
public static void crossCertificateTest1() {
String certPath = "S:/WORK/2016/01-2016/ClientCA1.cer";
try {
CertificateFactory factory = CertificateFactory.getInstance("X509");
X509Certificate clientCert = (X509Certificate) factory
.generateCertificate(
new FileInputStream(new File(certPath)));
Date signingTime = createDate(2016, 01, 10);
int code = CertificateValidator.verify(clientCert, null,
signingTime);
System.out.println(code);
} catch (CertificateException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public static void crossCertificateTest() {
String certPath = "S:/WORK/2016/01-2016/ClientCA1.cer";
String ca2Path = "C:/BkavCA/Certificates/CA2.cer";
try {
CertificateFactory factory = CertificateFactory.getInstance("X509");
X509Certificate clientCert = (X509Certificate) factory
.generateCertificate(
new FileInputStream(new File(certPath)));
X509Certificate ca2 = (X509Certificate) factory.generateCertificate(
new FileInputStream(new File(ca2Path)));
Date signingTime = new Date();
int code = OCSPValidator.getRevocationStatus(clientCert, ca2,
signingTime);
System.out.println(code);
} catch (CertificateException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public static void testBkavOldAndNew() {
String certOldPath = "S:/WORK/2015/12-2015/BkavCA.cer";
String certNewPath = "S:/WORK/2015/12-2015/BkavCA_new.cer";
try {
CertificateFactory factory = CertificateFactory.getInstance("X509");
X509Certificate certOld = (X509Certificate) factory
.generateCertificate(
new FileInputStream(new File(certOldPath)));
X509Certificate certNew = (X509Certificate) factory
.generateCertificate(
new FileInputStream(new File(certNewPath)));
RSAPublicKey pubOld = (RSAPublicKey) certOld.getPublicKey();
System.out.println("OLD: " + pubOld.getModulus());
RSAPublicKey pubNew = (RSAPublicKey) certNew.getPublicKey();
System.out.println("NEW: " + pubNew.getModulus());
} catch (CertificateException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public static void testCertOK() {
String serial = "5403530ff2f88cf3cde9c5d6edb47321";
CryptoToken token = null;
try {
token = CryptoTokenUtil.initFromTokenCSP(serial);
} catch (BkavSignaturesException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Not before: 2015/04/16 Not after: 2015/07/14 Revoked: 2015/05/27
// 16:38:05
if (token != null) {
X509Certificate signerCert = token.getSignerCert();
Certificate[] certChain = token.getCertChain();
System.out.println(signerCert.getNotBefore());
System.out.println(signerCert.getNotAfter());
Date signingTime = createDate(2015, 8, 18);
CertificateValidator.verify(signerCert, certChain, signingTime,
CertificateValidator.ONLY_CRL);
}
}
public static void testCertRevoked() {
String keystorePath = "E:\\Company\\BKAV\\Code_Demo\\540346B323887B4E02744AC4EC6D4460_Revoked_d3jpWqicAsRZ.p12";
String keystorePass = "d3jpWqicAsRZ";
// String keystorePath = "S:/WORK/2015/12-2015/BCSE_Client.p12";
// String keystorePass = "12345678";
FileInputStream inStream = null;
try {
inStream = new FileInputStream(new File(keystorePath));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
CryptoToken token = null;
try {
token = CryptoTokenUtil.initFromPkcs12(inStream, keystorePass);
} catch (BkavSignaturesException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// Not before: 2015/04/16 Not after: 2015/07/14 Revoked: 2015/05/27
// 16:38:05
X509Certificate signerCert = token.getSignerCert();
Certificate[] certChain = token.getCertChain();
System.out.println(signerCert.getNotBefore());
System.out.println(signerCert.getNotAfter());
Date signingTime = createDate(2015, 6, 24);
int code = CertificateValidator.verify(signerCert, certChain,
signingTime, CertificateValidator.ONLY_OCSP);
System.out.println("RESULT: " + code);
}
private static Date createDate(int year, int month, int day) {
String source = year + "/" + month + "/" + day;
SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd");
try {
return df.parse(source);
} catch (ParseException e) {
return new Date();
}
}
}
| [
"[email protected]"
] | |
fde3046bbf0e2ccece02e912c780fc49ce3cf20f | 54ac2b3b2968219d6982e0bc2bbf96ae26c197dd | /src/main/java/cn/sihai/soft/api/service/AddressService.java | 13c4e2595d5ebe6042817d212f4921aa823d0f59 | [] | no_license | zhengxiangchen/mall--api | 75af9aff82678d5e30da778d48f8e8421af15a20 | ccb27cb526a5710078b92e6edda0f2e93400dc12 | refs/heads/master | 2020-04-06T13:55:52.508194 | 2018-11-15T09:52:26 | 2018-11-15T09:52:26 | 157,520,143 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 564 | java | package cn.sihai.soft.api.service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.sihai.soft.api.dao.AddressDao;
import cn.sihai.soft.api.entity.AddressEntity;
@Service
public class AddressService {
@Autowired
private AddressDao addressDao;
/**
* 保存/修改用户信息
* @param address
*/
public void saveOrUpdate(AddressEntity address){
addressDao.save(address);
}
public AddressEntity getAddress(String openid) {
return addressDao.getAddress(openid);
}
}
| [
"[email protected]"
] | |
ab08f5b020b9613a3f5d2246c8bd8778a8e01fe6 | 03a9ef0f70b9d00c635be0b3c31a8eaa797bc013 | /ERP_system/src/Interfaces/EmployeeMan/Report.java | d70b2e284b2e4a3d0348131e13fe8ecb43412859 | [] | no_license | chamila1997/ERP-Projct | 1f2d94c5d255d292663bad1f230034503b2ccd19 | e30dc8b4cc0a60cb901524b59dd2c9658ae0be2f | refs/heads/master | 2020-07-29T23:16:07.801313 | 2019-09-21T14:20:49 | 2019-09-21T14:20:49 | 209,997,475 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 36,888 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Interfaces.EmployeeMan;
import com.itextpdf.text.BaseColor;
import com.itextpdf.text.pdf.PdfWriter;
import java.awt.Dimension;
import java.awt.Toolkit;
import com.itextpdf.text.Document;
import com.itextpdf.text.DocumentException;
import com.itextpdf.text.Element;
import com.itextpdf.text.Font.FontFamily;
import com.itextpdf.text.FontFactory;
import com.itextpdf.text.Paragraph;
import com.itextpdf.text.Phrase;
import com.itextpdf.text.pdf.GrayColor;
import com.itextpdf.text.pdf.PdfPCell;
import com.itextpdf.text.pdf.PdfWriter;
import com.itextpdf.text.pdf.PdfPTable;
import dbConnect.DBconnect;
import java.awt.Font;
import java.awt.event.MouseListener;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import java.util.Date;
import java.util.GregorianCalendar;
import javax.swing.plaf.basic.BasicInternalFrameUI;
/**
*
* @author SAHAN
*/
public class Report extends javax.swing.JInternalFrame {
Connection con = null;
ResultSet rs=null;
PreparedStatement pst = null;
/**
* Creates new form Report
*/
public Report() {
initComponents();
setVisible(true);//not moving jinternal frame
BasicInternalFrameUI basicInternalFrameUI = (javax.swing.plaf.basic.BasicInternalFrameUI)this.getUI(); //not moving jinternal frame
for(MouseListener listener : basicInternalFrameUI.getNorthPane().getMouseListeners()){ //not moving jinternal frame
basicInternalFrameUI.getNorthPane().removeMouseListener(listener); //not moving jinternal frame
}
//DB connection
con = DBconnect.connect();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
jButton1 = new javax.swing.JButton();
jButton3 = new javax.swing.JButton();
jComboBox1 = new javax.swing.JComboBox<>();
jSeparator1 = new javax.swing.JSeparator();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
amount = new javax.swing.JTextField();
jLabel4 = new javax.swing.JLabel();
amount1 = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jButton4 = new javax.swing.JButton();
jSeparator2 = new javax.swing.JSeparator();
jLabel3 = new javax.swing.JLabel();
setBackground(new java.awt.Color(255, 255, 255));
jPanel1.setBackground(new java.awt.Color(102, 153, 255));
jButton1.setBackground(new java.awt.Color(255, 255, 255));
jButton1.setFont(new java.awt.Font("Agency FB", 1, 24)); // NOI18N
jButton1.setForeground(new java.awt.Color(204, 0, 0));
jButton1.setText("Generate Report");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
}
});
jButton3.setBackground(new java.awt.Color(255, 255, 255));
jButton3.setFont(new java.awt.Font("Agency FB", 1, 24)); // NOI18N
jButton3.setForeground(new java.awt.Color(204, 0, 0));
jButton3.setText("Generate Report");
jButton3.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt);
}
});
jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Executive", "Non-executive" }));
jSeparator1.setBackground(new java.awt.Color(0, 0, 0));
jLabel1.setBackground(new java.awt.Color(0, 0, 0));
jLabel1.setFont(new java.awt.Font("Arial Black", 1, 18)); // NOI18N
jLabel1.setForeground(new java.awt.Color(204, 0, 0));
jLabel1.setText(" Employee Details");
jLabel1.setBorder(javax.swing.BorderFactory.createMatteBorder(3, 3, 3, 3, new java.awt.Color(204, 255, 204)));
jLabel2.setBackground(new java.awt.Color(0, 0, 0));
jLabel2.setFont(new java.awt.Font("Arial Black", 1, 18)); // NOI18N
jLabel2.setForeground(new java.awt.Color(204, 0, 0));
jLabel2.setText(" Salary NetPay >");
jLabel2.setBorder(javax.swing.BorderFactory.createMatteBorder(3, 3, 3, 3, new java.awt.Color(204, 255, 204)));
jLabel4.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
jLabel4.setText(" Enter The Amount :");
jLabel5.setBackground(new java.awt.Color(0, 0, 0));
jLabel5.setFont(new java.awt.Font("Arial Black", 1, 18)); // NOI18N
jLabel5.setForeground(new java.awt.Color(204, 0, 0));
jLabel5.setText(" Salary NetPay <");
jLabel5.setBorder(javax.swing.BorderFactory.createMatteBorder(3, 3, 3, 3, new java.awt.Color(204, 255, 204)));
jLabel6.setFont(new java.awt.Font("Tahoma", 1, 13)); // NOI18N
jLabel6.setText(" Enter The Amount :");
jButton4.setBackground(new java.awt.Color(255, 255, 255));
jButton4.setFont(new java.awt.Font("Agency FB", 1, 24)); // NOI18N
jButton4.setForeground(new java.awt.Color(204, 0, 0));
jButton4.setText("Generate Report");
jButton4.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jButton4ActionPerformed(evt);
}
});
jSeparator2.setBackground(new java.awt.Color(0, 0, 0));
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(68, 68, 68)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 30, Short.MAX_VALUE)
.addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(109, 109, 109))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(69, 69, 69)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(amount1, javax.swing.GroupLayout.PREFERRED_SIZE, 227, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 198, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 220, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(amount, javax.swing.GroupLayout.PREFERRED_SIZE, 227, javax.swing.GroupLayout.PREFERRED_SIZE))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(jSeparator2)
.addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(64, 64, 64)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(jComboBox1)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE))
.addGap(45, 45, 45)
.addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 48, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 19, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addComponent(jLabel4)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE)
.addComponent(amount))
.addGap(46, 46, 46)
.addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(31, 31, 31)
.addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 16, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel6)
.addGap(18, 18, 18)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel5, javax.swing.GroupLayout.DEFAULT_SIZE, 53, Short.MAX_VALUE)
.addComponent(amount1))
.addGap(46, 46, 46)
.addComponent(jButton4, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(38, 38, 38))
);
jLabel3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/erp_system/wallpaper.gif"))); // NOI18N
jLabel3.setText("jLabel2");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(18, 18, 18)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 999, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap(25, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 741, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(24, 24, 24))))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
JFileChooser dialog = new JFileChooser();
dialog.setSelectedFile(new File("Employees Report.pdf"));
int dialogResult = dialog.showSaveDialog(null);
if (dialogResult==JFileChooser.APPROVE_OPTION){
String filePath = dialog.getSelectedFile().getPath();
try {
// TODO add your handling code here:
String position = jComboBox1.getSelectedItem().toString();
String sql ="select * from employee where position = '"+position+"'";
pst=con.prepareStatement(sql);
rs=pst.executeQuery();
Document myDocument = new Document();
PdfWriter myWriter = PdfWriter.getInstance(myDocument, new FileOutputStream(filePath ));
PdfPTable table = new PdfPTable(16);
myDocument.open();
// float[] columnWidths = new float[]{10f, 20f, 10f, 20f,20f,20f,20f,20f,20f,20f,20f,20f,20f,20f,20f};
//table.setWidths(columnWidths);
float[] columnWidths = new float[] {20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20};
table.setWidths(columnWidths);
table.setWidthPercentage(100); //set table width to 100%
//newly added
//table.getDefaultCell().setUseAscender(true);
// table.getDefaultCell().setUseDescender(true);
myDocument.add(new Paragraph("Employees List",FontFactory.getFont(FontFactory.TIMES_BOLD,20,Font.BOLD )));
myDocument.add(new Paragraph(new Date().toString()));
myDocument.add(new Paragraph("-------------------------------------------------------------------------------------------"));
table.addCell(new PdfPCell(new Paragraph("ID",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Name",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Age",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Street",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("City",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("State",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("NIC",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Phone",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Department",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("E-mail",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Salary",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Position",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("BRA",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Incentive",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Transport",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("EPF NO",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
while(rs.next())
{
table.addCell(new PdfPCell(new Paragraph(rs.getString(1),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(2),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(3),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(4),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(5),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(6),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(7),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(8),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(9),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(10),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(11),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(12),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(13),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(14),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(15),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(16),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
}
myDocument.add(table);
myDocument.add(new Paragraph("--------------------------------------------------------------------------------------------"));
myDocument.close();
JOptionPane.showMessageDialog(null,"Report was successfully generated");
}
catch(Exception e){
JOptionPane.showMessageDialog(null,e);
}
finally {
try{
rs.close();
pst.close();
}
catch(Exception e){
JOptionPane.showMessageDialog(null,e);
}
}
}
}//GEN-LAST:event_jButton1ActionPerformed
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
JFileChooser dialog = new JFileChooser();
dialog.setSelectedFile(new File("Salary Report.pdf"));
int dialogResult = dialog.showSaveDialog(null);
if (dialogResult==JFileChooser.APPROVE_OPTION){
String filePath = dialog.getSelectedFile().getPath();
try {
// TODO add your handling code here:
String Amount = amount.getText();
String sql ="select * from salary where NetPay > '"+Amount+"'";
pst=con.prepareStatement(sql);
rs=pst.executeQuery();
Document myDocument = new Document();
PdfWriter myWriter = PdfWriter.getInstance(myDocument, new FileOutputStream(filePath ));
PdfPTable table = new PdfPTable(19);
myDocument.open();
// float[] columnWidths = new float[]{10f, 20f, 10f, 20f,20f,20f,20f,20f,20f,20f,20f,20f,20f,20f,20f};
//table.setWidths(columnWidths);
float[] columnWidths = new float[] {20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20};
table.setWidths(columnWidths);
table.setWidthPercentage(100); //set table width to 100%
//newly added
//table.getDefaultCell().setUseAscender(true);
// table.getDefaultCell().setUseDescender(true);
myDocument.add(new Paragraph("Employees List",FontFactory.getFont(FontFactory.TIMES_BOLD,20,Font.BOLD )));
myDocument.add(new Paragraph(new Date().toString()));
myDocument.add(new Paragraph("-------------------------------------------------------------------------------------------"));
table.addCell(new PdfPCell(new Paragraph("ID",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Name",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Basic Salary",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("BRA",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Incentive",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Transport",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Normal_OT",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Holiday_OT",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Attendance",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("No-Pay",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("EPF",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("ETF",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Medical",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("OtherIncntv",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("OtherDeductn",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Loan",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Advance",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("NetPay",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("EpfNo",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
while(rs.next())
{
table.addCell(new PdfPCell(new Paragraph(rs.getString(1),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(2),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(3),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(4),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(5),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(6),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(7),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(8),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(9),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(10),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(11),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(12),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(13),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(14),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(15),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(16),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(17),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(18),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(19),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
}
myDocument.add(table);
myDocument.add(new Paragraph("--------------------------------------------------------------------------------------------"));
myDocument.close();
JOptionPane.showMessageDialog(null,"Report was successfully generated");
}
catch(Exception e){
JOptionPane.showMessageDialog(null,e);
}
finally {
try{
rs.close();
pst.close();
}
catch(Exception e){
JOptionPane.showMessageDialog(null,e);
}
}
}
}//GEN-LAST:event_jButton3ActionPerformed
private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
JFileChooser dialog = new JFileChooser();
dialog.setSelectedFile(new File("Salary Report.pdf"));
int dialogResult = dialog.showSaveDialog(null);
if (dialogResult==JFileChooser.APPROVE_OPTION){
String filePath = dialog.getSelectedFile().getPath();
try {
// TODO add your handling code here:
String Amount = amount.getText();
String sql ="select * from salary where NetPay < '"+Amount+"'";
pst=con.prepareStatement(sql);
rs=pst.executeQuery();
Document myDocument = new Document();
PdfWriter myWriter = PdfWriter.getInstance(myDocument, new FileOutputStream(filePath ));
PdfPTable table = new PdfPTable(19);
myDocument.open();
// float[] columnWidths = new float[]{10f, 20f, 10f, 20f,20f,20f,20f,20f,20f,20f,20f,20f,20f,20f,20f};
//table.setWidths(columnWidths);
float[] columnWidths = new float[] {20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20,20};
table.setWidths(columnWidths);
table.setWidthPercentage(100); //set table width to 100%
//newly added
//table.getDefaultCell().setUseAscender(true);
// table.getDefaultCell().setUseDescender(true);
myDocument.add(new Paragraph("Employees List",FontFactory.getFont(FontFactory.TIMES_BOLD,20,Font.BOLD )));
myDocument.add(new Paragraph(new Date().toString()));
myDocument.add(new Paragraph("-------------------------------------------------------------------------------------------"));
table.addCell(new PdfPCell(new Paragraph("ID",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Name",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Basic Salary",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("BRA",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Incentive",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Transport",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Normal_OT",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Holiday_OT",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Attendance",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("No-Pay",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("EPF",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("ETF",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Medical",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("OtherIncntv",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("OtherDeductn",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Loan",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("Advance",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("NetPay",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
table.addCell(new PdfPCell(new Paragraph("EpfNo",FontFactory.getFont(FontFactory.TIMES_ROMAN,9,Font.BOLD))));
while(rs.next())
{
table.addCell(new PdfPCell(new Paragraph(rs.getString(1),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(2),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(3),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(4),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(5),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(6),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(7),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(8),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(9),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(10),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(11),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(12),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(13),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(14),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(15),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(16),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(17),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(18),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
table.addCell(new PdfPCell(new Paragraph(rs.getString(19),FontFactory.getFont(FontFactory.TIMES_ROMAN,8,Font.PLAIN))));
}
myDocument.add(table);
myDocument.add(new Paragraph("--------------------------------------------------------------------------------------------"));
myDocument.close();
JOptionPane.showMessageDialog(null,"Report was successfully generated");
}
catch(Exception e){
JOptionPane.showMessageDialog(null,e);
}
finally {
try{
rs.close();
pst.close();
}
catch(Exception e){
JOptionPane.showMessageDialog(null,e);
}
}
}
}//GEN-LAST:event_jButton4ActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField amount;
private javax.swing.JTextField amount1;
private javax.swing.JButton jButton1;
private javax.swing.JButton jButton3;
private javax.swing.JButton jButton4;
private javax.swing.JComboBox<String> jComboBox1;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JPanel jPanel1;
private javax.swing.JSeparator jSeparator1;
private javax.swing.JSeparator jSeparator2;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
a75ca1a4ddc6f15eac4d7fd425e9792273c26ed5 | 130f06f9910f8d650736d3a23a32398200396bea | /TestingWithSBDCode/src/org/usfirst/frc/team5822/robot/commands/StopIntake.java | 6dea941e6becfebca3cbff3ce72aa99973af7eb3 | [] | no_license | SICPRobotics/2017-Robot-Code | 740621bc545ca19e51cd70d954c1c6cb90f499c4 | 71a451f7b0feee591802608f8139ab6616360376 | refs/heads/master | 2021-01-09T05:28:50.123122 | 2017-12-14T22:29:36 | 2017-12-14T22:29:36 | 80,773,694 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,239 | java | package org.usfirst.frc.team5822.robot.commands;
import org.usfirst.frc.team5822.robot.Robot;
import edu.wpi.first.wpilibj.command.Command;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
/**
*
*/
public class StopIntake extends Command {
public StopIntake() {
// Use requires() here to declare subsystem dependencies
// eg. requires(chassis);
requires(Robot.intake);
}
// Called just before this Command runs the first time
protected void initialize() {
SmartDashboard.putBoolean("Intake", false);
SmartDashboard.putBoolean("Outtake Fast", false);
SmartDashboard.putBoolean("Outtake Slow", false);
}
// Called repeatedly when this Command is scheduled to run
protected void execute()
{
Robot.intake.doNothing();
System.out.println("Stop intake.");
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return true;
}
// Called once after isFinished returns true
protected void end() {
}
// Called when another command which requires one or more of the same
// subsystems is scheduled to run
protected void interrupted() {
}
}
| [
"[email protected]"
] | |
e7d198c3473156eaa98c72ffcd3423aaa4ed09cf | 602fdc5c23e5cb8b872566a34eaefe81ab910051 | /src/main/java/com/example/demo/model/Cozinha.java | b2e348580a146453e7e26ec275d1a701e669a3a0 | [] | no_license | marlusmarcos/teinamento-Spring | b5fcd2bdfaa21eaa2ae04bc3fcead51d8f68fa40 | 33083878ab95229050db0fb9bac443635c2e30bf | refs/heads/main | 2023-08-16T18:55:49.639545 | 2021-10-08T19:29:42 | 2021-10-08T19:29:42 | 415,079,299 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 917 | java | package com.example.demo.model;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class Cozinha {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column (nullable = false)
private String nome;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
@Override
public int hashCode() {
return Objects.hash(id);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Cozinha other = (Cozinha) obj;
return Objects.equals(id, other.id);
}
}
| [
"[email protected]"
] | |
cb0ad14a556484697ba3b7935f09e3e3e8865b6c | 4b74bd7ff6c3f5a9d57b1f6012d0b241b24b94fc | /frontend/src/main/java/com/epam/qa/website/WebSite.java | 8b6967090d6b48a40b166489d34593fcfdd759f4 | [] | no_license | Savostytskyi/tc_project | b941049717ce1b554a93b25f37666c1a33e9d7b1 | 1976cd2de92abefea40fddf2ff6ad2ad71a7b46b | refs/heads/master | 2021-05-12T01:03:15.349046 | 2018-01-17T17:23:31 | 2018-01-17T17:23:31 | 117,549,765 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 60 | java | package com.epam.qa.website;
public interface WebSite {
}
| [
"[email protected]"
] | |
36a45d71d2b4a71fdfda76937f481185be1302e9 | aefabe7c745166d18fa335b8d02f4dd9872a8112 | /src/main/java/de/cron3x/cor3/commands/StatusCommand.java | 006be6d6f5a92ff55f217fea1cf5f9275dd8b5f7 | [] | no_license | Cron3x/Cor3-Minecraft-Paper-Plugin | 090fedd336f754b04fa99fe1a992327dc05b5f26 | 58fc4e753163ccb10fa429a01a5374b5592bf354 | refs/heads/main | 2023-06-23T19:18:53.115780 | 2021-07-27T12:50:01 | 2021-07-27T12:50:01 | 376,135,839 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,109 | java | package de.cron3x.cor3.commands;
import de.cron3x.cor3.Cor3;
import net.md_5.bungee.api.ChatColor;
import net.wesjd.anvilgui.AnvilGUI;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabExecutor;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.Team;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.function.Consumer;
public class StatusCommand implements TabExecutor, Listener {
/*
*
* TODO:
* register in plugin.yml
* ---------------
* Status Command;
* Select Ui
* ---------------
* with out Argument - open ui
* Menu - (Building) , Admin , Custom -> Anvil , Survival
*
*/
private final String GUI_NAME = "Change Status";
public void openGUI(Player player){
Inventory inventory = Bukkit.createInventory(null, 9*1, GUI_NAME);
ItemStack item = new ItemStack(Material.IRON_SWORD);
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(ChatColor.RESET+"" + ChatColor.WHITE+"Survival");
item.setItemMeta(itemMeta);
inventory.setItem(0, item);
itemMeta.setDisplayName(ChatColor.RESET+"" + ChatColor.WHITE+"Creative");
item.setType(Material.GRASS_BLOCK);
item.setItemMeta(itemMeta);
inventory.setItem(1, item);
itemMeta.setDisplayName(ChatColor.RESET+"" + ChatColor.WHITE+"Custom");
item.setType(Material.NAME_TAG);
item.setItemMeta(itemMeta);
inventory.setItem(8, item);
player.openInventory(inventory);
}
public void openCustomGUI(Player player){
new AnvilGUI.Builder()
.open(player);
}
@EventHandler
public void handleGuiClick(InventoryClickEvent event){
if (!(event.getWhoClicked() instanceof Player)) return;
Player player = (Player) event.getWhoClicked();
if (event.getView().getTitle().equalsIgnoreCase(GUI_NAME)){
if (event.getCurrentItem().getItemMeta() == null) return;
Bukkit.broadcastMessage(event.getCurrentItem().getItemMeta().getDisplayName().substring(1).toLowerCase());
switch (event.getCurrentItem().getItemMeta().getDisplayName().substring(1).toLowerCase()){
case "fsurvival":
Bukkit.broadcastMessage("Survival");
changePrefix(player, "survival", ChatColor.WHITE+"Survival | ");
break;
case "fcreative":
Bukkit.broadcastMessage("Creative");
changePrefix(player, "creative", ChatColor.BLUE+"Creative | ");
break;
case "fcustom":
Bukkit.broadcastMessage("Custom");
event.setCancelled(true);
event.getClickedInventory().close();
openCustomGUI(player);
//open Custom Name Inv (text input)
break;
default:
break;
}
event.setCancelled(true);
event.getClickedInventory().close();
}
}
public void changePrefix(Player player, String name,String prefix){
Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
Team team = null;
if (scoreboard.getTeam(name) == null) {
scoreboard.registerNewTeam(name);
}
team = scoreboard.getTeam(name);
team.setPrefix(prefix);
team.addPlayer(player);
}
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
if (sender instanceof Player){
Player player = (Player) sender;
if (args.length==0){
openGUI(player);
}
if (args.length==1){
if (args[0].equalsIgnoreCase("admin") && player.isOp()){
Bukkit.broadcastMessage("admin");
}
if (args[0].equalsIgnoreCase("build")){
Bukkit.broadcastMessage("build");
}
if (args[0].equalsIgnoreCase("survival")){
Bukkit.broadcastMessage("survival");
}
if (args[0].equalsIgnoreCase("custom")){
Bukkit.broadcastMessage("custom");
Inventory Inv = Bukkit.createInventory(player, InventoryType.ANVIL, ChatColor.GOLD + "Custom Anvil");
for (int i = 0; i < Inv.getSize(); i++) {
ItemStack air = new ItemStack(Material.AIR,1);
Inv.setItem(i, air);
}
player.openInventory(Inv);
}
if (args[0].equalsIgnoreCase("ui")){
Bukkit.broadcastMessage("ui");
}
}
}
return true;
}
@Override
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender, @NotNull Command command, @NotNull String alias, @NotNull String[] args) {
if (args.length == 1) {
Cor3.getInstance().log("len 3");
ArrayList<String> subcommandsArguments = new ArrayList<>();
subcommandsArguments.add("admin");
subcommandsArguments.add("build");
subcommandsArguments.add("survival");
subcommandsArguments.add("custom");
subcommandsArguments.add("ui");
return subcommandsArguments;
}
return null;
}
} | [
"[email protected]"
] | |
1abaa3b4a4401b570f378266cdf0a63b4a7737d2 | 339115ccc6874040dd4a05873d55d6f991437458 | /app/src/main/java/app/bennsandoval/com/woodmin/Woodmin.java | 398d2693a2540438289a2b3727ff0ac002ecce8c | [
"Apache-2.0"
] | permissive | mnafian/Woodmin | b7c1e0708533c815be4b5a8a53b08fe09bf7d652 | 11c1c845f7335b63e1d84e4e46d89aedf5d9d551 | refs/heads/master | 2021-01-16T22:10:45.637625 | 2015-05-21T04:57:39 | 2015-05-21T04:57:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 426 | java | package app.bennsandoval.com.woodmin;
import android.app.Application;
import com.crashlytics.android.Crashlytics;
import io.fabric.sdk.android.Fabric;
/**
* Created by Mackbook on 1/10/15.
*/
public class Woodmin extends Application {
public final String LOG_TAG = Woodmin.class.getSimpleName();
@Override public void onCreate() {
super.onCreate();
Fabric.with(this, new Crashlytics());
}
}
| [
"bennsandoval"
] | bennsandoval |
b1d0994eb5b0b8aa735dd2f7b4c2db9266c418e1 | a9a4a49505040c2dbf0c3ed1ee8e8b4c38380e72 | /spring-aot/src/test/java/org/springframework/aot/context/bootstrap/generator/infrastructure/nativex/NativeSerializationEntryTests.java | ab6c3f9b29e33920f0a0a9e9f37d6cbea2433412 | [
"Apache-2.0",
"LicenseRef-scancode-generic-cla"
] | permissive | saki-osive/spring-native | bf9b798b259f8991718b77702c74fab4b7e5c347 | 32dbf6190ed6ad90dd638f5fdcb3b6e826fd75e4 | refs/heads/main | 2023-08-26T05:30:05.882182 | 2021-11-07T02:00:23 | 2021-11-07T02:00:23 | 425,388,113 | 0 | 0 | Apache-2.0 | 2021-11-07T01:36:10 | 2021-11-07T01:36:09 | null | UTF-8 | Java | false | false | 2,022 | java | /*
* Copyright 2019-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* 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.springframework.aot.context.bootstrap.generator.infrastructure.nativex;
import org.junit.jupiter.api.Test;
import org.springframework.nativex.domain.serialization.SerializationDescriptor;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
/**
* Tests for {@link NativeSerializationEntry}.
*
* @author Sebastien Deleuze
*/
public class NativeSerializationEntryTests {
@Test
void ofTypeWithNull() {
assertThatIllegalArgumentException().isThrownBy(() -> NativeSerializationEntry.ofType(null));
}
@Test
void contributeType() {
SerializationDescriptor serializationDescriptor = new SerializationDescriptor();
NativeSerializationEntry.ofType(String.class).contribute(serializationDescriptor);
assertThat(serializationDescriptor.getSerializableTypes()).singleElement().isEqualTo(String.class.getName());
}
@Test
void ofTypeNameWithNull() {
assertThatIllegalArgumentException().isThrownBy(() -> NativeSerializationEntry.ofTypeName(null));
}
@Test
void contributeTypeName() {
SerializationDescriptor serializationDescriptor = new SerializationDescriptor();
NativeSerializationEntry.ofTypeName(String.class.getName()).contribute(serializationDescriptor);
assertThat(serializationDescriptor.getSerializableTypes()).singleElement().isEqualTo(String.class.getName());
}
}
| [
"[email protected]"
] | |
f3bdd50491b22c9e5dc441064d602eb1b750c8d8 | 6e2e383a00778d826c451a4d9274fc49e0cff41c | /hackerrank/src/Leecode/Prob_986.java | df4c8edfcf52503e443d4ec917cfa5ce7382c50e | [] | no_license | kenvifire/AlgorithmPractice | d875df9d13a76a02bce9ce0b90a8fad5ba90f832 | e16315ca2ad0476f65f087f608cc9424710e0812 | refs/heads/master | 2022-12-17T23:45:37.784637 | 2020-09-22T14:45:46 | 2020-09-22T14:45:46 | 58,105,208 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,739 | java | package Leecode;
import lib.Interval;
import utils.AssertUtils;
import utils.IntervalUtils;
import java.util.ArrayList;
import java.util.List;
public class Prob_986 {
public Interval[] intervalIntersection(Interval[] A, Interval[] B) {
List<Interval> temp = new ArrayList<>();
int a = 0, b = 0;
while (a < A.length && b < B.length) {
Interval intelA = A[a];
Interval intelB = B[b];
Interval intersect = getIntersect(intelA, intelB);
if(intersect == null) {
if(intelA.end < intelB.start) {
a++;
} else {
b++;
}
} else {
temp.add(intersect);
if(intelA.end < intelB.end) {
a++;
} else if (intelB.end < intelA.end){
b++;
} else {
a++;
b++;
}
}
}
Interval[] result = new Interval[temp.size()];
temp.toArray(result);
return result;
}
private Interval getIntersect(Interval A, Interval B) {
int start = Math.max(A.start, B.start);
int end = Math.min(A.end, B.end);
if(start <= end) return new Interval(start, end);
return null;
}
public static void main(String[] args) {
Prob_986 prob = new Prob_986();
AssertUtils.equals("[[1,2],[5,5],[8,10],[15,23],[24,24],[25,25]]",
IntervalUtils.toString(prob.intervalIntersection(IntervalUtils.fromString("[[0,2],[5,10],[13,23],[24,25]]"),
IntervalUtils.fromString("[[1,5],[8,12],[15,24],[25,26]]"))));
}
}
| [
"[email protected]"
] | |
3f122fce8928f32a6ddcbf348a513ca82b6b9fd1 | 43c55843b76363355f7c45d2dd3c3117b145d8e1 | /src/Aph/DAO/Impl/UI/signInUI.java | a4c355367cf03a8cbc8d570a985896590511197a | [] | no_license | rmedard/Rwandaform-Stock-Manager | 90cbfff703f5f36434d1ba4b184bd70b66d5d85a | 48d0653ba9e3bc21deb554ad430b5479e501c33a | refs/heads/master | 2021-01-20T01:03:10.823612 | 2013-06-23T20:52:46 | 2013-06-23T20:52:46 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 13,451 | java | package Aph.DAO.Impl.UI;
import Aph.DAO.ConnectionInit;
import Aph.User;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
/*
* signInUI.java
*
* Created on Dec 18, 2010, 12:01:23 PM
*/
/**
*
* @author Medard
*/
public class signInUI extends javax.swing.JFrame {
private String nomUtilisateur;
private String motDePasse, status;
private Statement stmt;
private UsersUI usersUI;
private Gestion_Citerne gestionCiterne;
private Gestion_Produit gestionProduit;
private Gestion_blocks gestionBlocks;
private ConnectionInit connectionInit;
private Connection con = null;
private DAOS daos;
/** Creates new form signInUI */
public signInUI() {
initComponents();
connectionInit = new ConnectionInit();
gestionCiterne = new Gestion_Citerne();
gestionProduit = new Gestion_Produit();
gestionBlocks = new Gestion_blocks();
usersUI = new UsersUI();
gestionCiterne.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
gestionProduit.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
gestionBlocks.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
usersUI.setDefaultCloseOperation(DISPOSE_ON_CLOSE);
con = connectionInit.getCon();
this.setTitle("Login");
daos = new DAOS();
}
public DAOS getDaos() {
return daos;
}
public JPasswordField getPswdMotDePasse() {
return pswdMotDePasse;
}
public void setPswdMotDePasse(JPasswordField pswdMotDePasse) {
this.pswdMotDePasse = pswdMotDePasse;
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
brownSugar1 = new com.jgoodies.looks.plastic.theme.BrownSugar();
desertBlue1 = new com.jgoodies.looks.plastic.theme.DesertBlue();
desertBlue2 = new com.jgoodies.looks.plastic.theme.DesertBlue();
jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
txtUtilisateur = new javax.swing.JTextField();
jLabel3 = new javax.swing.JLabel();
cbxStatus = new javax.swing.JCheckBox();
btnLogin = new javax.swing.JButton();
btnAnnuler = new javax.swing.JButton();
pswdMotDePasse = new javax.swing.JPasswordField();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenuItem2 = new javax.swing.JMenuItem();
jMenu2 = new javax.swing.JMenu();
jMenuItem3 = new javax.swing.JMenuItem();
jMenuItem4 = new javax.swing.JMenuItem();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
jLabel1.setFont(new java.awt.Font("Colonna MT", 3, 24));
jLabel1.setText("Nouvelle session ");
jLabel2.setFont(new java.awt.Font("Tahoma", 1, 12));
jLabel2.setText("Nom d'utilisateur");
jLabel3.setFont(new java.awt.Font("Tahoma", 1, 12));
jLabel3.setText("Mot de passe");
cbxStatus.setText("Rester connecté");
cbxStatus.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cbxStatusActionPerformed(evt);
}
});
btnLogin.setBackground(java.awt.Color.lightGray);
btnLogin.setFont(new java.awt.Font("Tahoma", 1, 10));
btnLogin.setText("Connecter");
btnLogin.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnLoginActionPerformed(evt);
}
});
btnAnnuler.setBackground(java.awt.Color.lightGray);
btnAnnuler.setFont(new java.awt.Font("Tahoma", 1, 10));
btnAnnuler.setText("Annuler");
btnAnnuler.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
btnAnnulerActionPerformed(evt);
}
});
jMenu1.setText("File");
jMenuItem1.setText("Login");
jMenu1.add(jMenuItem1);
jMenuItem2.setText("Cancel");
jMenu1.add(jMenuItem2);
jMenuBar1.add(jMenu1);
jMenu2.setText("Help");
jMenuItem3.setText("About");
jMenu2.add(jMenuItem3);
jMenuItem4.setText("Help");
jMenu2.add(jMenuItem4);
jMenuBar1.add(jMenu2);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(97, 97, 97)
.addComponent(jLabel1))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel2)
.addComponent(jLabel3))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(pswdMotDePasse)
.addComponent(txtUtilisateur, javax.swing.GroupLayout.DEFAULT_SIZE, 134, Short.MAX_VALUE)
.addComponent(cbxStatus, javax.swing.GroupLayout.Alignment.TRAILING))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(btnAnnuler, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(btnLogin, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(txtUtilisateur, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnLogin))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(btnAnnuler)
.addComponent(pswdMotDePasse, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(cbxStatus)
.addContainerGap(11, Short.MAX_VALUE))
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void btnLoginActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnLoginActionPerformed
nomUtilisateur = txtUtilisateur.getText();
motDePasse = new String(pswdMotDePasse.getPassword());
String userName = null;
String passWord = null;
String grade = null;
try {
if (nomUtilisateur.length() == 0) {
JOptionPane.showMessageDialog(null, "Veuillez entrer votre nom d'utilisateur", "Halte", JOptionPane.ERROR_MESSAGE);
txtUtilisateur.requestFocus();
} else if (motDePasse.length() == 0) {
JOptionPane.showMessageDialog(null, "Veuillez entrer votre mot de passe", "Halte", JOptionPane.ERROR_MESSAGE);
pswdMotDePasse.requestFocus();
} else {
try {
stmt = con.createStatement();
String sql = "SELECT username,password FROM aphrodis.user WHERE username = '" + nomUtilisateur + "'";
ResultSet rs = stmt.executeQuery(sql);
rs.next();
userName = rs.getString("username");
passWord = rs.getString("password");
if (userName == null || passWord == null) {
JOptionPane.showMessageDialog(null, "Nom d'utilisateur n'existe pas. Veuillez réessayer" + userName + passWord, "Halte", JOptionPane.ERROR_MESSAGE);
} else {
User user = getDaos().getUserDAO().getUserByUsername(userName);
if (user.getPassword().equals(motDePasse)) {
String logger = "SELECT grade FROM aphrodis.user WHERE username = \'" + userName + "\'";
ResultSet rsLogger = stmt.executeQuery(logger);
while (rsLogger.next()) {
grade = rsLogger.getString("grade");
if (grade.equals("admin")) {
usersUI.setVisible(true);
} else if (grade.equals("citerne")) {
gestionCiterne.setVisible(true);
} else if (grade.equals("mat_prm")) {
gestionProduit.setVisible(true);
} else if (grade.equals("prod_sfini")) {
gestionBlocks.setVisible(true);
gestionBlocks.setSignIn(this);
}
}
} else {
JOptionPane.showMessageDialog(null, "Nom d'utilisateur ou mot de passe érroné", "Halte", JOptionPane.ERROR_MESSAGE);
}
}
} catch (SQLException e) {
JOptionPane.showMessageDialog(null, "Connection échouée, vérifiez vos paramètres de connectivité", "Erreur", JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
}
}
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Erreur de connectivité", "Erreur", JOptionPane.ERROR_MESSAGE);
}
}//GEN-LAST:event_btnLoginActionPerformed
private void btnAnnulerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAnnulerActionPerformed
int i = JOptionPane.showConfirmDialog(null, "Voulez-vous quitter l'application?", "Confirmer", JOptionPane.YES_NO_CANCEL_OPTION);
if (i == JOptionPane.YES_OPTION) {
System.exit(0);
}
}//GEN-LAST:event_btnAnnulerActionPerformed
private void cbxStatusActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbxStatusActionPerformed
if (cbxStatus.isSelected()) {
status = "on";
} else {
status = "off";
}
}//GEN-LAST:event_cbxStatusActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new signInUI().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private com.jgoodies.looks.plastic.theme.BrownSugar brownSugar1;
private javax.swing.JButton btnAnnuler;
private javax.swing.JButton btnLogin;
private javax.swing.JCheckBox cbxStatus;
private com.jgoodies.looks.plastic.theme.DesertBlue desertBlue1;
private com.jgoodies.looks.plastic.theme.DesertBlue desertBlue2;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem jMenuItem3;
private javax.swing.JMenuItem jMenuItem4;
public javax.swing.JPasswordField pswdMotDePasse;
private javax.swing.JTextField txtUtilisateur;
// End of variables declaration//GEN-END:variables
}
| [
"[email protected]"
] | |
b2c912122266a11d6deef5cbc469448d7208690f | b95dbc699136d004b2ca85d8cacb5419d2a23cc5 | /SlideToUnlockView/src/main/java/com/qdong/slide_to_unlock_view/CustomSlideToUnlockView.java | b99c122280a6ffb04521f82106319397189be65d | [] | no_license | TangfeiJi/SlideToUnlockProject | f04aa581d136f85c857ba2c7b3b2945ead33c97e | 8b316219e008fbe9bc4520accd4d58fa8ab6704a | refs/heads/master | 2020-08-11T13:23:25.224475 | 2019-10-12T03:28:50 | 2019-10-12T03:28:50 | 214,571,719 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 14,512 | java | package com.qdong.slide_to_unlock_view;
import android.content.Context;
import android.content.res.TypedArray;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.github.florent37.viewanimator.AnimationListener;
import com.github.florent37.viewanimator.ViewAnimator;
import com.nineoldandroids.view.ViewHelper;
/**
**/
public class CustomSlideToUnlockView extends RelativeLayout {
private static final String TAG="CustomSlideToUnlockView";
private static final long DEAFULT_DURATIN_LONG = 200;//左弹回,动画时长
private static final long DEAFULT_DURATIN_SHORT = 100;//右弹,动画时长
private static final boolean LOG = true;//打印开关
private static int DISTANCE_LIMIT = 600;//滑动阈值
private static float THRESHOLD = 0.5F;//滑动阈值比例:默认是0.5,即滑动超过父容器宽度的一半再松手就会触发
protected Context mContext;
private ImageView iv_slide;//滑块
private TextView tv_hint;//提示文本
private RelativeLayout rl_slide;//滑动view
private RelativeLayout rl_root;//父容器
private boolean mIsUnLocked;//已经滑到最右边,将不再响应touch事件
private CallBack mCallBack;//回调
private int slideImageViewWidth;//滑块宽度
private int slideImageViewResId;//滑块资源
private int slideImageViewResIdAfter;//滑动到右边时,滑块资源id
private int viewBackgroundResId;//root 背景
private String textHint;//文本
private int textSize;//单位是sp,只拿数值
private int textColorResId;//颜色,@color
public CustomSlideToUnlockView(Context mContext) {
super(mContext);
this.mContext = mContext;
initView();
}
public CustomSlideToUnlockView(Context mContext, AttributeSet attrs) {
super(mContext, attrs);
this.mContext = mContext;
TypedArray mTypedArray = mContext.obtainStyledAttributes(attrs,
R.styleable.SlideToUnlockView);
init(mTypedArray);
initView();
}
public CustomSlideToUnlockView(Context mContext, AttributeSet attrs, int defStyleAttr) {
super(mContext, attrs, defStyleAttr);
this.mContext = mContext;
TypedArray mTypedArray = mContext.obtainStyledAttributes(attrs,
R.styleable.SlideToUnlockView);
init(mTypedArray);
initView();
}
/**
**/
private void init(TypedArray mTypedArray) {
slideImageViewWidth= (int) mTypedArray.getDimension(R.styleable.SlideToUnlockView_slideImageViewWidth, DensityUtil.dp2px(getContext(), 50));
slideImageViewResId= mTypedArray.getResourceId(R.styleable.SlideToUnlockView_slideImageViewResId, -1);
slideImageViewResIdAfter= mTypedArray.getResourceId(R.styleable.SlideToUnlockView_slideImageViewResIdAfter, -1);
viewBackgroundResId= mTypedArray.getResourceId(R.styleable.SlideToUnlockView_viewBackgroundResId, -1);
textHint=mTypedArray.getString(R.styleable.SlideToUnlockView_textHint);
textSize=mTypedArray.getInteger(R.styleable.SlideToUnlockView_textSize, 7);
textColorResId= mTypedArray.getColor(R.styleable.SlideToUnlockView_textColorResId, getResources().getColor(android.R.color.white));
THRESHOLD=mTypedArray.getFloat(R.styleable.SlideToUnlockView_slideThreshold, 0.5f);
mTypedArray.recycle();
}
private int mActionDownX, mLastX, mSlidedDistance;
/**
* 初始化界面布局
*/
protected void initView() {
LayoutInflater.from(mContext).inflate(R.layout.layout_view_slide_to_unlock,
this, true);
rl_root = (RelativeLayout) findViewById(R.id.rl_root);
rl_slide = (RelativeLayout) findViewById(R.id.rl_slide);
iv_slide = (ImageView) findViewById(R.id.iv_slide);
tv_hint = (TextView) findViewById(R.id.tv_hint);
LayoutParams params= (LayoutParams) iv_slide .getLayoutParams();
//获取当前控件的布局对象
params.width= slideImageViewWidth;//设置当前控件布局的高度
iv_slide.setLayoutParams(params);//将设置好的布局参数应用到控件中
setImageDefault();
if(viewBackgroundResId>0){
// rl_slide.setBackgroundResource(viewBackgroundResId);//rootView设置背景
}
MarginLayoutParams tvParams = (MarginLayoutParams) tv_hint.getLayoutParams();
tvParams.setMargins(0, 0, slideImageViewWidth, 0);//textview的marginRight设置为和滑块的宽度一致
tv_hint.setLayoutParams(tvParams);
tv_hint.setTextSize(DensityUtil.sp2px(getContext(), textSize));
tv_hint.setTextColor(textColorResId);
tv_hint.setText(TextUtils.isEmpty(textHint)? mContext.getString(R.string.hint):textHint);
//添加滑动监听
rl_slide.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
DISTANCE_LIMIT= (int) (CustomSlideToUnlockView.this.getWidth()*THRESHOLD);//默认阈值是控件宽度的一半
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN://按下时记录纵坐标
if(mIsUnLocked){//滑块已经在最右边则不处理touch
return false;
}
mLastX = (int) event.getRawX();//最后一个action时x值
mActionDownX = (int) event.getRawX();//按下的瞬间x
logI(TAG, mLastX + "X,=============================ACTION_DOWN");
break;
case MotionEvent.ACTION_MOVE://上滑才处理,如果用户一开始就下滑,则过掉不处理
logI(TAG, "=============================ACTION_MOVE");
logI(TAG, "event.getRawX()============================="+event.getRawX());
int dX = (int) event.getRawX() - mLastX;
logI(TAG, "dX============================="+dX);
mSlidedDistance = (int) event.getRawX() - mActionDownX;
logI(TAG, "mSlidedDistance============================="+ mSlidedDistance);
final MarginLayoutParams params = (MarginLayoutParams) v.getLayoutParams();
int left = params.leftMargin;
int top = params.topMargin;
int right = params.rightMargin;
int bottom = params.bottomMargin;
logI(TAG, "left:"+left+",top:"+top+",right:"+right+",bottom"+bottom);
int leftNew = left + dX;
int rightNew =right - dX;
if (mSlidedDistance > 0) {//直接通过margin实现滑动
params.setMargins(leftNew, top, rightNew, bottom);
logI(TAG, leftNew + "=============================MOVE");
v.setLayoutParams(params);
resetTextViewAlpha(mSlidedDistance);
//回调
if(mCallBack!=null){
mCallBack.onSlide(mSlidedDistance);
}
mLastX = (int) event.getRawX();
} else {
return true;
}
break;
case MotionEvent.ACTION_UP:
logI(TAG, "MotionEvent.ACTION_UP,之前移动的偏移值:" + ViewHelper.getTranslationY(v));
if (Math.abs(mSlidedDistance) > DISTANCE_LIMIT) {
scrollToRight(v);//右边
// scrollToLeft(v);//左边
} else {
scrollToLeft(v);//左边
}
break;
case MotionEvent.ACTION_CANCEL:
// try {
// if (vTracker != null) {
// vTracker.recycle();
// vTracker = null;
// }
// vTracker.recycle();
// } catch (Exception e) {
// e.printStackTrace();
// }
break;
}
return true;
}
});
}
private void logI(String tag,String content){
if(LOG){
Log.i(tag,content);
}
}
/**
* @method name:resetTextViewAlpha
* @des: 重置提示文本的透明度
* @param :[mSlidedDistance]
* @return type:void
* @date 创建时间:2017/5/24
* @author Chuck
**/
private void resetTextViewAlpha(int distance) {
if(Math.abs(distance)>=Math.abs(DISTANCE_LIMIT)){
tv_hint.setAlpha(0.0f);
}
else{
tv_hint.setAlpha(1.0f-Math.abs(distance)*1.0f/Math.abs(DISTANCE_LIMIT));
}
}
/**
* @method name:scrollToLeft
* @des: 滑动未到阈值时松开手指,弹回到最左边
* @param :[v]
* @return type:void
* @date 创建时间:2017/5/24
* @author Chuck
**/
private void scrollToLeft(final View v) {
final MarginLayoutParams params1 = (MarginLayoutParams) v.getLayoutParams();
logI(TAG, "scrollToLeft,ViewHelper.getTranslationX(v):" + ViewHelper.getTranslationX(v));
logI(TAG, "scrollToLeft,params1.leftMargin:" + params1.leftMargin);
logI(TAG, "scrollToLeft, params1.rightMargin:" + params1.rightMargin);
ViewAnimator
.animate( rl_slide)
.translationX(ViewHelper.getTranslationX(v), -params1.leftMargin+15)
.interpolator(new AccelerateInterpolator())
.duration(DEAFULT_DURATIN_LONG)
.onStop(new AnimationListener.Stop() {
@Override
public void onStop() {
MarginLayoutParams para = (MarginLayoutParams) v.getLayoutParams();
logI(TAG, "scrollToLeft动画结束para.leftMargin:" + para.leftMargin);
logI(TAG, "scrollToLeft动画结束para.rightMargin:" + para.rightMargin);
logI(TAG, "scrollToLeft动画结束,ViewHelper.getTranslationX(v):" + ViewHelper.getTranslationX(v));
mSlidedDistance = 0;
tv_hint.setAlpha(1.0f);
mIsUnLocked=false;
if(mCallBack!=null){
mCallBack.onSlide(mSlidedDistance);
}
setImageDefault();
}
})
.start();
}
/**
* @method name:scrollToRight
* @des:滑动到右边,并触发回调
* @param :[v]
* @return type:void
* @date 创建时间:2017/5/24
* @author Chuck
**/
private void scrollToRight(final View v) {
final MarginLayoutParams params1 = (MarginLayoutParams) v.getLayoutParams();
logI(TAG, "scrollToRight,ViewHelper.getTranslationX(v):" + ViewHelper.getTranslationX(v));
logI(TAG, "scrollToRight,params1.leftMargin:" + params1.leftMargin);
logI(TAG, "scrollToRight, params1.rightMargin:" + params1.rightMargin);
//移动到最右端 移动的距离是 父容器宽度-leftMargin
ViewAnimator
.animate( rl_slide)
//.translationX(ViewHelper.getTranslationX(v), ViewHelper.getTranslationX(v)+100)
.translationX(ViewHelper.getTranslationX(v), -params1.leftMargin+15)
// .translationX(ViewHelper.getTranslationX(v), ( rl_slide.getWidth() - params1.leftMargin-slideImageViewWidth))
//.translationX(params1.leftMargin, ( rl_slide.getWidth() - params1.leftMargin-100))
.interpolator(new AccelerateInterpolator())
.duration(DEAFULT_DURATIN_SHORT)
.onStop(new AnimationListener.Stop() {
@Override
public void onStop() {
MarginLayoutParams para = (MarginLayoutParams) v.getLayoutParams();
logI(TAG, "scrollToRight动画结束para.leftMargin:" + para.leftMargin);
logI(TAG, "scrollToRight动画结束para.rightMargin:" + para.rightMargin);
logI(TAG, "scrollToRight动画结束,ViewHelper.getTranslationX(v):" + ViewHelper.getTranslationX(v));
mSlidedDistance = 0;
tv_hint.setAlpha(1.0f);
mIsUnLocked=false;
// if(slideImageViewResIdAfter>0){
// iv_slide.setImageResource(slideImageViewResIdAfter);//滑块imagview设置资源
// }
//回调
if(mCallBack!=null){
mCallBack.onUnlocked();
}
}
})
.start();
}
public void resetView(){
mIsUnLocked=false;
setImageDefault();
scrollToLeft(rl_slide);
}
private void setImageDefault() {
/**
* @method name:setImageDefault
* @des: 设置默认图片
* @param :[]
* @return type:void
* @date 创建时间:2017/5/25
* @author Chuck
**/
if(slideImageViewResId>0){
iv_slide.setImageResource(slideImageViewResId);//滑块imagview设置资源
}
}
public interface CallBack{
void onSlide(int distance);//右滑距离回调
void onUnlocked();//滑动到了右边,事件回调
}
public CallBack getmCallBack() {
return mCallBack;
}
public void setmCallBack(CallBack mCallBack) {
this.mCallBack = mCallBack;
}
}
| [
"[email protected]"
] | |
5cf900768b8f43c9ddef8fda403c390375726d08 | 157d84f8aafc76ba9ea0dbbf08ede744966b4250 | /code/iaas/model/src/main/java/io/cattle/platform/core/dao/ProcessSummaryDao.java | 8e343e476fef2510ba269804253a158938c61135 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | rancher/cattle | 81d165a0339a41950561fe534c7529ec74203c56 | 82d154a53f4089fecfb9f320caad826bb4f6055f | refs/heads/v1.6 | 2023-08-27T20:19:31.989806 | 2020-05-01T18:15:55 | 2020-05-01T20:11:28 | 18,023,059 | 487 | 233 | Apache-2.0 | 2022-01-03T18:07:33 | 2014-03-23T00:19:52 | Java | UTF-8 | Java | false | false | 203 | java | package io.cattle.platform.core.dao;
import io.cattle.platform.core.addon.ProcessSummary;
import java.util.List;
public interface ProcessSummaryDao {
List<ProcessSummary> getProcessSummary();
}
| [
"[email protected]"
] | |
04272e95a2cd8b8cf4e7d065125c3e45c5a63afe | e964cddd911fd8116bda9820a1c6a1a0d5837f1c | /src/chatroom/GroupServer.java | 9813fd89e58673fa75dd76260af995f9c6ef0109 | [] | no_license | lwy123-wq/chatroom | 8e4219e63ba5a99a938305e10698757038f54eb1 | 7f05d26447d2643d8b437e9be7d8fb20a7885d29 | refs/heads/master | 2023-04-17T05:10:38.753993 | 2021-05-10T08:23:08 | 2021-05-10T08:23:08 | 365,969,454 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,227 | java | package chatroom;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.*;
import java.nio.charset.StandardCharsets;
import java.util.Iterator;
public class GroupServer {
private Selector selector;
private ServerSocketChannel listenChannel;
private static final int PORT=5556;
public GroupServer() {
try {
selector=Selector.open();
listenChannel=ServerSocketChannel.open();
listenChannel.socket().bind(new InetSocketAddress(PORT));
listenChannel.configureBlocking(false);
listenChannel.register(selector, SelectionKey.OP_ACCEPT);
} catch (IOException e) {
e.printStackTrace();
}
}
public void listen(){
try {
while (true){
int count=selector.select(2000);
if(count>0){
Iterator<SelectionKey> iterator = selector.selectedKeys().iterator();
while(iterator.hasNext()){
SelectionKey key=iterator.next();
if(key.isAcceptable()){
SocketChannel sc=listenChannel.accept();
sc.configureBlocking(false);
sc.register(selector,SelectionKey.OP_READ);
System.out.println(sc.getRemoteAddress()+"high lines............");
}
if(key.isReadable()){
readDate(key);
}
iterator.remove();
}
}else {
System.out.println("wait..................");
}
}
}catch (IOException e){
e.printStackTrace();
}finally {
}
}
public void readDate(SelectionKey key){
SocketChannel channel=null;
try {
channel=(SocketChannel) key.channel();
ByteBuffer buffer=ByteBuffer.allocate(1024);
int count=channel.read(buffer);
if(count>0){
String a=new String(buffer.array());
System.out.println("from client"+a);
sendToClient(a,channel);
}
} catch (IOException e) {
try {
System.out.println(channel.getRemoteAddress()+"offline");
key.channel();
channel.close();
}catch (IOException e1){
e1.printStackTrace();
}
}
}
private void sendToClient(String a,SocketChannel self)throws IOException{
System.out.println("The server forwards the message");
for (SelectionKey key:selector.keys()){
Channel target=key.channel();
if(target instanceof SocketChannel && target!=self){
SocketChannel dest=(SocketChannel) target;
ByteBuffer buffer=ByteBuffer.wrap(a.getBytes());
dest.write(buffer);
}
}
}
public static void main(String[] args) {
GroupServer groupServer=new GroupServer();
groupServer.listen();
}
}
| [
"[email protected]"
] | |
6eae8fdc61e94db18fe5ebd00fae19ff56b28a28 | fccd5805e92854fa860530b212b99695f9f2cc1c | /src/main/java/com/digitalfeonix/hydrogel/block/HydroGelBlock.java | 60652d802b5d651f75b589e8c3b6f7720357f2e6 | [] | no_license | Shadows-of-Fire/HydroGel | c650c38dee4538ed3b163ed87e4200a0d7fe94a8 | f5a4f2a8d3b633280bb210a091b770df643ee015 | refs/heads/master | 2023-02-17T07:15:47.392000 | 2021-01-18T19:28:41 | 2021-01-18T19:28:41 | 114,837,729 | 1 | 1 | null | 2021-01-18T19:21:33 | 2017-12-20T03:17:34 | Java | UTF-8 | Java | false | false | 1,684 | java | package com.digitalfeonix.hydrogel.block;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.FlowingFluidBlock;
import net.minecraft.block.ILiquidContainer;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.material.PushReaction;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.FluidState;
import net.minecraft.fluid.Fluids;
import net.minecraft.item.BlockItemUseContext;
import net.minecraft.state.IntegerProperty;
import net.minecraft.state.StateContainer.Builder;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
public class HydroGelBlock extends Block implements ILiquidContainer {
public static final IntegerProperty LEVEL = FlowingFluidBlock.LEVEL;
public HydroGelBlock() {
super(Block.Properties.create(Material.WATER).hardnessAndResistance(1).sound(SoundType.SLIME));
}
@Override
protected void fillStateContainer(Builder<Block, BlockState> builder) {
builder.add(LEVEL);
}
@Override
public boolean isReplaceable(BlockState state, BlockItemUseContext ctx) {
return false;
}
@Override
public PushReaction getPushReaction(BlockState state) {
return PushReaction.NORMAL;
}
@Override
public FluidState getFluidState(BlockState p_204507_1_) {
return Fluids.WATER.getDefaultState();
}
@Override
public boolean canContainFluid(IBlockReader worldIn, BlockPos pos, BlockState state, Fluid fluidIn) {
return false;
}
@Override
public boolean receiveFluid(IWorld worldIn, BlockPos pos, BlockState state, FluidState fluidStateIn) {
return false;
}
}
| [
"[email protected]"
] | |
e58efd6f1d1c056441d6e6fba4a18373aef909d8 | 0e3c2253904a31d15300cdf76e83c5850a8e2f40 | /java-core/challenges-mix/004-end-of-file/src/main/java/com/ivan/polovyi/challenges/EndOfFile.java | 6eba812c519a4f7a7508e156c5abc23aa44a0b33 | [] | no_license | polovyivan/challenges-mix | 9db86ce7ffb92b96583f8896248b4eb29e77a846 | 266c4859a16b514136765ffb4fb705613a08ca55 | refs/heads/master | 2021-07-12T09:40:20.677903 | 2021-02-11T00:45:35 | 2021-02-11T00:45:35 | 231,290,205 | 1 | 0 | null | 2020-03-05T13:17:50 | 2020-01-02T02:05:49 | Java | UTF-8 | Java | false | false | 360 | java | package com.ivan.polovyi.challenges;
import java.util.Scanner;
public class EndOfFile {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int count = 1;
while(s.hasNext()) {
String ns = s.nextLine();
System.out.println(count + " " + ns);
count++;
}
}
}
| [
"[email protected]"
] | |
0788ab2843c62d11fda0ee1a1482fd4d3cfdab18 | 6a922e840b33f11ab3d0f154afa0b33cff272676 | /src/xlsx4j/java/org/xlsx4j/sml/CTCalculatedMember.java | f0d5a798ced92650f87d1aa917065ea176170bb6 | [
"Apache-2.0"
] | permissive | baochanghong/docx4j | 912fc146cb5605e6f7869c4839379a83a8b4afd8 | 4c83d8999c9396067dd583b82a6fc892469a3919 | refs/heads/master | 2021-01-12T15:30:26.971311 | 2016-10-20T00:44:25 | 2016-10-20T00:44:25 | 71,792,895 | 3 | 0 | null | 2016-10-24T13:39:57 | 2016-10-24T13:39:57 | null | UTF-8 | Java | false | false | 8,104 | java | /*
* Copyright 2010-2013, Plutext Pty Ltd.
*
* This file is part of xlsx4j, a component of docx4j.
docx4j is licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package org.xlsx4j.sml;
import javax.xml.bind.Unmarshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import org.jvnet.jaxb2_commons.ppp.Child;
/**
* <p>Java class for CT_CalculatedMember complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="CT_CalculatedMember">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence minOccurs="0">
* <element name="extLst" type="{http://schemas.openxmlformats.org/spreadsheetml/2006/main}CT_ExtensionList" minOccurs="0"/>
* </sequence>
* <attribute name="name" use="required" type="{http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes}ST_Xstring" />
* <attribute name="mdx" use="required" type="{http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes}ST_Xstring" />
* <attribute name="memberName" type="{http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes}ST_Xstring" />
* <attribute name="hierarchy" type="{http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes}ST_Xstring" />
* <attribute name="parent" type="{http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes}ST_Xstring" />
* <attribute name="solveOrder" type="{http://www.w3.org/2001/XMLSchema}int" default="0" />
* <attribute name="set" type="{http://www.w3.org/2001/XMLSchema}boolean" default="false" />
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CT_CalculatedMember", propOrder = {
"extLst"
})
public class CTCalculatedMember implements Child
{
protected CTExtensionList extLst;
@XmlAttribute(name = "name", required = true)
protected String name;
@XmlAttribute(name = "mdx", required = true)
protected String mdx;
@XmlAttribute(name = "memberName")
protected String memberName;
@XmlAttribute(name = "hierarchy")
protected String hierarchy;
@XmlAttribute(name = "parent")
protected String parent;
@XmlAttribute(name = "solveOrder")
protected Integer solveOrder;
@XmlAttribute(name = "set")
protected Boolean set;
@XmlTransient
private Object parentObj;
/**
* Gets the value of the extLst property.
*
* @return
* possible object is
* {@link CTExtensionList }
*
*/
public CTExtensionList getExtLst() {
return extLst;
}
/**
* Sets the value of the extLst property.
*
* @param value
* allowed object is
* {@link CTExtensionList }
*
*/
public void setExtLst(CTExtensionList value) {
this.extLst = value;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the mdx property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMdx() {
return mdx;
}
/**
* Sets the value of the mdx property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMdx(String value) {
this.mdx = value;
}
/**
* Gets the value of the memberName property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getMemberName() {
return memberName;
}
/**
* Sets the value of the memberName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMemberName(String value) {
this.memberName = value;
}
/**
* Gets the value of the hierarchy property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getHierarchy() {
return hierarchy;
}
/**
* Sets the value of the hierarchy property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setHierarchy(String value) {
this.hierarchy = value;
}
/**
* Gets the value of the parent property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getParentAttr() {
return parent;
}
/**
* Sets the value of the parent property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setParent(String value) {
this.parent = value;
}
/**
* Gets the value of the solveOrder property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public int getSolveOrder() {
if (solveOrder == null) {
return 0;
} else {
return solveOrder;
}
}
/**
* Sets the value of the solveOrder property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setSolveOrder(Integer value) {
this.solveOrder = value;
}
/**
* Gets the value of the set property.
*
* @return
* possible object is
* {@link Boolean }
*
*/
public boolean isSet() {
if (set == null) {
return false;
} else {
return set;
}
}
/**
* Sets the value of the set property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setSet(Boolean value) {
this.set = value;
}
/**
* Gets the parent object in the object tree representing the unmarshalled xml document.
*
* @return
* The parent object.
*/
public Object getParent() {
return this.parentObj;
}
public void setParent(Object parent) {
this.parentObj = parent;
}
/**
* This method is invoked by the JAXB implementation on each instance when unmarshalling completes.
*
* @param parent
* The parent object in the object tree.
* @param unmarshaller
* The unmarshaller that generated the instance.
*/
public void afterUnmarshal(Unmarshaller unmarshaller, Object parent) {
setParent(parent);
}
}
| [
"[email protected]"
] | |
148f8528414984e97c4a1961f7cc410e0eba51ce | b0b4c1eeaf86989567dc7dc41ec8758c9b5d6442 | /src/main/java/permissions/seeders/UserTableSeeder.java | f82c3f3bf991f5afc4b6158675b921af95e6ead9 | [] | no_license | axmedbek/permission_control_system | 066d5810bc37bd8bfec266d7b18fb9fa29383f43 | cf09e5405836a74e190f003dbe5ab96d5fc2cbae | refs/heads/master | 2022-12-21T07:39:40.394346 | 2019-07-30T14:04:39 | 2019-07-30T14:04:39 | 199,502,440 | 0 | 0 | null | 2022-12-16T00:38:56 | 2019-07-29T17:58:32 | Java | UTF-8 | Java | false | false | 63 | java | package permissions.seeders;
public class UserTableSeeder {
}
| [
"[email protected]"
] | |
19ac885d4b0bf8384ac94966c9d5a80dc246166e | c2897fbdd23438c0c6cf4ffa368a415b29de93d9 | /Autoi/src/com/autoiinnovations/beans/WHUserBean.java | 90048c8207ab17325eaa3b079f89fdd2f32007d4 | [] | no_license | soumyajit405/git | 3592eaf6edd2efa641a6a372a9c070a0bf6a11cc | 9dd8a3c03516b40faf7702e693c0429bbb16f20d | refs/heads/master | 2020-04-05T11:05:25.440821 | 2018-12-25T14:03:05 | 2018-12-25T14:03:05 | 156,821,724 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 1,317 | java | package com.autoiinnovations.beans;
public class WHUserBean {
private int id;
private String userId;
private String name;
private String phone;
private String password;
private String mode;
private String extraInfo1;
private String extraInfo2;
private String email;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getMode() {
return mode;
}
public void setMode(String mode) {
this.mode = mode;
}
public String getExtraInfo1() {
return extraInfo1;
}
public void setExtraInfo1(String extraInfo1) {
this.extraInfo1 = extraInfo1;
}
public String getExtraInfo2() {
return extraInfo2;
}
public void setExtraInfo2(String extraInfo2) {
this.extraInfo2 = extraInfo2;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
| [
"[email protected]"
] | |
b7dae0736a141b48e61ecd11b0353bd1e62d9fbd | d106cebc84ae90bbe36ab56409014abcde14278f | /src/main/java/cn/trasen/tsrelease/service/IndividualityService.java | 312785da934cd82028b0910d1c45fa7346d82a61 | [] | no_license | ts-imsi/ts-release | ed0441fa42d85fa00d6728569d997582554fd264 | fa7993c4855a7910df46ae76ce490b8f1bee0c5d | refs/heads/master | 2021-05-03T11:03:28.306188 | 2018-02-27T07:08:54 | 2018-02-27T07:08:54 | 120,544,281 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,153 | java | package cn.trasen.tsrelease.service;
import cn.trasen.tsrelease.dao.TbIndividualityMapper;
import cn.trasen.tsrelease.model.TbFile;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import cn.trasen.tsrelease.model.TbIndividuality;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* @author luoyun
* @ClassName: IntelliJ IDEA
* @Description: 操作类型
* @date 2018/2/24
*/
@Service
public class IndividualityService {
@Autowired
TbIndividualityMapper tbIndividualityMapper;
@Autowired
FileService fileService;
public PageInfo<TbIndividuality> getIndividualityList(Integer page,Integer rows,String hospitalName){
PageHelper.startPage(page,rows);
List<TbIndividuality> tbIndividualities=tbIndividualityMapper.getIndividualityList(hospitalName);
PageInfo<TbIndividuality> pagehelper = new PageInfo<TbIndividuality>(tbIndividualities);
return pagehelper;
}
public void saveIndividuality(TbIndividuality tbIndividuality){
tbIndividualityMapper.saveIndividuality(tbIndividuality);
}
@Transactional(rollbackFor = Exception.class)
public boolean saveFileAndInviduality(MultipartFile[] files,String type,TbIndividuality tbIndividuality){
boolean boo=false;
String pkid="";
Long size=0L;
if(files!=null){
for(MultipartFile file:files){
TbFile tbFile=fileService.saveFileOne(file,type);
if(tbFile!=null){
pkid=pkid+tbFile.getPkid()+",";
size=tbFile.getSize()+size;
}else{
return boo;
}
}
}
tbIndividuality.setSize(size.intValue());
tbIndividuality.setFileId(pkid);
//todo 鉴权
tbIndividuality.setOperator("system");
saveIndividuality(tbIndividuality);
boo=true;
return boo;
}
}
| [
"[email protected]"
] | |
977715ad89fe02202a696279e7836076133a0101 | 45ff924de64ae9eb263a30b48d7f92e1466b7d1a | /zabbix-service/src/main/java/az/ldap/zabbix/repository/HostInterfaceRepository.java | 89ba477d25d0a57746c1fffbc169a1b6417da501 | [] | no_license | ibrahimazn/cnct | 0b883c566184a1fe178a25f22d8cd44aff70765c | 27b02048e17b434290d6d453bf5a144802c6e514 | refs/heads/master | 2020-03-25T23:45:09.099571 | 2018-08-18T13:42:46 | 2018-08-18T13:42:46 | 144,290,859 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 697 | java | package az.ldap.zabbix.repository;
import java.util.List;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.stereotype.Repository;
import az.ldap.zabbix.entity.HostInterface;
/** MongoDB repository for Host interface. */
@Repository
public interface HostInterfaceRepository extends MongoRepository<HostInterface, String> {
@Query("{interfaceId : ?0}")
HostInterface findByInterfaceId(String interfaceId);
@Query("{hostId : ?0}")
List<HostInterface> findByHostId(String hostId);
@Query("{port : ?0, ipAddress : ?1}")
List<HostInterface> findByPortAndIP(String port, String ip);
}
| [
"[email protected]"
] | |
da28e12a28d46082021083c24ee7655029b52871 | 644dbd428086bbe0b8686846a980136122dfcd16 | /src/main/java/de/thatsich/core/guice/IPostInit.java | b3d9517ee708c020572ed04df8ea2e1a83d32989 | [] | no_license | thatsIch/OpenFX | e9deb7adbd012ac208082c361966242d1a9d5dd1 | 2674d47fd22d65ea43cbac0de90e20f7bf2d2999 | refs/heads/master | 2021-01-21T21:39:49.456425 | 2016-03-13T12:14:14 | 2016-03-13T12:14:14 | 12,842,210 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 86 | java | package de.thatsich.core.guice;
public interface IPostInit
{
void init();
}
| [
"[email protected]"
] | |
2a21cf35b359034024ac55ea1ff0833053b4566b | dc316cd4c8008c8a2651a9d95e9aacdd011c21dd | /commons-crypto/src/main/java/com/mizhousoft/commons/ecc/EccGenerator.java | 9c029703d466a063380a37ce8afeede691d87546 | [
"BSD-3-Clause"
] | permissive | 63966367/mizhousoft-commons | 5bc124f692daf44c7643d5a0ed527e774240979a | e6e1fa50b50031ee4e3d364c64178e3873d88993 | refs/heads/main | 2023-05-05T21:20:16.396637 | 2021-06-01T03:33:36 | 2021-06-01T03:33:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,044 | java | package com.mizhousoft.commons.ecc;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.SecureRandom;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import com.mizhousoft.commons.crypto.CryptoException;
import com.mizhousoft.commons.lang.HexUtils;
/**
* ECC生成器
*
* @version
*/
public abstract class EccGenerator
{
public static KeyPair genKeyPair() throws CryptoException
{
try
{
KeyPairGenerator keyPairGenerator = KeyPairGenerator.getInstance("EC", "BC");
keyPairGenerator.initialize(256, new SecureRandom());
return keyPairGenerator.generateKeyPair();
}
catch (Exception e)
{
throw new CryptoException("Generate key pair failed.");
}
}
public static String encodePublicKey(PublicKey publicKey)
{
return HexUtils.encodeHexString(publicKey.getEncoded(), false);
}
public static String encodePrivateKey(PrivateKey privateKey)
{
return HexUtils.encodeHexString(privateKey.getEncoded(), false);
}
public static PublicKey decodePublicKey(String keyStr) throws CryptoException
{
try
{
byte[] keyBytes = HexUtils.decodeHex(keyStr);
X509EncodedKeySpec keySpec = new X509EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance("EC", "BC");
return keyFactory.generatePublic(keySpec);
}
catch (Exception e)
{
throw new CryptoException("Decode public key failed.");
}
}
public static PrivateKey decodePrivateKey(String keyStr) throws CryptoException
{
try
{
byte[] keyBytes = HexUtils.decodeHex(keyStr);
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(keyBytes);
KeyFactory keyFactory = KeyFactory.getInstance("EC", "BC");
return keyFactory.generatePrivate(keySpec);
}
catch (Exception e)
{
throw new CryptoException("Decode private key failed.");
}
}
}
| [
"[email protected]"
] | |
e0dbf4a9247b648a5f10cb6028aaf59cce9dd424 | 13c2d3db2d49c40c74c2e6420a9cd89377f1c934 | /program_data/JavaProgramData/53/1613.java | 581b01cccd103dc30a5a57953a680405edcbb12f | [
"MIT"
] | permissive | qiuchili/ggnn_graph_classification | c2090fefe11f8bf650e734442eb96996a54dc112 | 291ff02404555511b94a4f477c6974ebd62dcf44 | refs/heads/master | 2021-10-18T14:54:26.154367 | 2018-10-21T23:34:14 | 2018-10-21T23:34:14 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 933 | java | package <missing>;
public class GlobalMembers
{
public static int Main()
{
int[] x = new int[300];
int[] y = new int[300];
int i;
int j;
int k = 0;
int n;
int sign;
String tempVar = ConsoleInput.scanfRead();
if (tempVar != null)
{
n = Integer.parseInt(tempVar);
}
for (i = 0;i < n;i++)
{
String tempVar2 = ConsoleInput.scanfRead();
if (tempVar2 != null)
{
x[i] = Integer.parseInt(tempVar2);
}
}
for (i = 0;i < n;i++)
{
for (sign = 0,j = 0;j < i;j++)
{
if (x[i] == x[j])
{
sign = 1;
break;
}
}
if (sign == 0)
{
y[k] = x[i];
k++;
}
}
System.out.printf("%d",y[0]);
for (i = 1;i < k;i++)
{
System.out.printf(",%d",y[i]);
}
String tempVar3 = ConsoleInput.scanfRead();
if (tempVar3 != null)
{
n = Integer.parseInt(tempVar3);
}
return 0;
}
}
| [
"[email protected]"
] | |
a976134f86e327fb836aac47155aac7a1ef890bb | b4db8f5f994b4f0711a78cae4847459220e55a25 | /src/main/java/models/EnglishDeck.java | 781a66ca94c1c07b4c1b4f1364a8e0e098190618 | [] | no_license | cs361-W16/Group13-2 | 3aa59268f6a1c2b81d9d37507e2947078acc9304 | b72ca4a8cab9b29db4f2358de0b6d063d9b6dfe8 | refs/heads/master | 2016-08-11T14:40:08.150380 | 2016-02-20T08:04:50 | 2016-02-20T08:04:50 | 50,548,712 | 0 | 4 | null | 2016-02-20T08:04:51 | 2016-01-28T02:38:25 | HTML | UTF-8 | Java | false | false | 390 | java | package models;
public class EnglishDeck extends Deck {
public EnglishDeck(){}
public void build(){
for(int i = 2; i < 15; i++){
deck.add(new Card(i,Suit.Clubs));
deck.add(new Card(i,Suit.Hearts));
deck.add(new Card(i,Suit.Diamonds));
deck.add(new Card(i,Suit.Spades));
}
}
} | [
"user.email"
] | user.email |
b11e7ae647c17656a5699c66f7299d64a17142d6 | 0af8b92686a58eb0b64e319b22411432aca7a8f3 | /single-large-project/src/test/java/org/gradle/test/performancenull_141/Testnull_14093.java | 3684bd3914c80784a0e6c9b0882f8ec5e3cccf57 | [] | no_license | gradle/performance-comparisons | b0d38db37c326e0ce271abebdb3c91769b860799 | e53dc7182fafcf9fedf07920cbbea8b40ee4eef4 | refs/heads/master | 2023-08-14T19:24:39.164276 | 2022-11-24T05:18:33 | 2022-11-24T05:18:33 | 80,121,268 | 17 | 15 | null | 2022-09-30T08:04:35 | 2017-01-26T14:25:33 | null | UTF-8 | Java | false | false | 308 | java | package org.gradle.test.performancenull_141;
import static org.junit.Assert.*;
public class Testnull_14093 {
private final Productionnull_14093 production = new Productionnull_14093("value");
@org.junit.Test
public void test() {
assertEquals(production.getProperty(), "value");
}
} | [
"[email protected]"
] | |
2958b5b4ba603368f8a62c4ddeeb75ee87714b3f | 33f1285003506bc50c1b9abd4ef4ca047f6904c3 | /app/src/main/java/skot92/hu/unideb/hu/kiadaskezelo/service/BalanceService.java | 42c9483a681c43bc21c9be0339c40f8b6fe1e0e3 | [] | no_license | skot92/KiadasKezelo | 81e38a7fd80871402db413060d543fd8ebd1bdf0 | bee409fe69dccac8dbd2fd5dc45c6545c3a4136d | refs/heads/master | 2021-03-19T14:05:04.115379 | 2017-03-07T20:00:56 | 2017-03-07T20:00:56 | 43,171,582 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 884 | java | package skot92.hu.unideb.hu.kiadaskezelo.service;
import android.content.Context;
import skot92.hu.unideb.hu.kiadaskezelo.core.dao.BalanceDAO;
import skot92.hu.unideb.hu.kiadaskezelo.core.entity.BalanceEntity;
/**
* Created by skot9 on 2015. 11. 12..
*/
public class BalanceService {
BalanceDAO balanceDAO;
InComeService inComeService;
ExpenseService expenseService;
public BalanceService(Context context) {
inComeService = new InComeService(context);
expenseService = new ExpenseService(context);
balanceDAO = new BalanceDAO(context);
}
public long save(BalanceEntity balance) {
return balanceDAO.save(balance);
}
public int findBalance() {
int income = inComeService.getSumAmount();
int expense = -1 * expenseService.getSumAmount();
int a = income - expense;
return a;
}
}
| [
"[email protected]"
] | |
b35c81012fc357ae1018ba75fcd5c48f06e3d130 | 2507428bc492a61b501c8d2c4ccc5f7523d9a5bb | /elwood-web/src/main/java/org/lyeung/elwood/web/controller/build/command/GetBuildJobCommand.java | 38981215a5d6fe759fca4dcd85ef83e425973dd6 | [
"Apache-2.0"
] | permissive | lyeung/elwood-parent | 6c3c63bc8929f3e8384dfb523cee8ae73752f723 | b200d77ce63f60d425a44a83ba51d3cfcfbb4ece | refs/heads/master | 2020-03-28T01:39:36.154162 | 2016-09-27T03:27:01 | 2016-09-27T03:27:01 | 62,131,350 | 0 | 0 | null | 2016-09-27T03:27:01 | 2016-06-28T10:14:02 | Java | UTF-8 | Java | false | false | 919 | java | /*
*
* Copyright (C) 2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.lyeung.elwood.web.controller.build.command;
import org.lyeung.elwood.common.command.Command;
import org.lyeung.elwood.web.model.BuildJob;
/**
* Created by lyeung on 3/08/2015.
*/
public interface GetBuildJobCommand extends Command<String, BuildJob> {
// do-nothing
}
| [
"[email protected]"
] | |
f5ed75057a1c34afbd451de28bbed410f2dcdab7 | f46badd9fe1f73c2eca86c947d782d3db42924b2 | /src/com/servlet/AddrServlet.java | 1e440f1dfcc47fd58c922850458b59b75601032d | [] | no_license | kyutaeks/Exam | ee3e39153e0754bee7a56d7fa32337aa190500eb | e94fa010d679e29dfc4c44e66b6710f5f3c61396 | refs/heads/master | 2022-08-17T03:59:09.767186 | 2019-04-19T08:45:51 | 2019-04-19T08:45:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,661 | java | package com.servlet;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
import java.util.Map;
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 com.common.Common;
import com.service.AddrService;
import com.service.impl.AddrServiceImpl;
@WebServlet(urlPatterns = { "/addr/list", "/addr/one" })
public class AddrServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private AddrService as = new AddrServiceImpl();
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
PrintWriter pw = response.getWriter();
String cmd = Common.getCmd(request);
String url = "/views/addr/" + cmd;
if ("list".equals(cmd)) {
Map<String, String> addr = Common.getSingleMap(request);
List<Map<String, String>> addrList = as.selectAddrList(addr);
request.setAttribute("list", addrList);
} else if ("one".equals(cmd)) {
Map<String, String> addr = Common.getSingleMap(request);
Map<String, String> map = as.selectAddr(addr);
request.setAttribute("view", map);
}
RequestDispatcher rd = request.getRequestDispatcher(url);
rd.forward(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
| [
"[email protected]"
] | |
9b0495de7ce387117bf74ca586d408cbbe6b82a5 | 4f95aee5f176e7c07fcb93636b4a849f79333800 | /app/src/main/java/top/wzmyyj/zymk/view/fragment/F_1.java | 6ce7575c6e5341019416886f8ee273e54cebcd14 | [] | no_license | yinjunChic/ZYMK | b845ae80a75a8876e9c34f704cbb270a8e5c967f | 8e4cd999393a9d8d06a7275164e6e0a73636798c | refs/heads/master | 2020-03-27T00:43:41.362930 | 2018-08-21T09:16:17 | 2018-08-21T09:16:17 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,231 | java | package top.wzmyyj.zymk.view.fragment;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import java.util.List;
import butterknife.BindView;
import butterknife.OnClick;
import top.wzmyyj.wzm_sdk.tools.T;
import top.wzmyyj.zymk.R;
import top.wzmyyj.zymk.app.bean.FavorBean;
import top.wzmyyj.zymk.common.utils.StatusBarUtil;
import top.wzmyyj.zymk.presenter.HomePresenter;
import top.wzmyyj.zymk.view.fragment.base.BaseFragment;
import top.wzmyyj.zymk.view.iv.IF_1View;
import top.wzmyyj.zymk.view.panel.HomeFavorPanel;
import top.wzmyyj.zymk.view.panel.HomeNestedScrollPanel;
/**
* Created by yyj on 2018/06/28. email: [email protected]
*/
public class F_1 extends BaseFragment<HomePresenter> implements IF_1View {
@Override
protected void initPresenter() {
mPresenter = new HomePresenter(activity, this);
}
@Override
protected int getLayoutId() {
return R.layout.fragment_1;
}
@Override
protected void initPanels() {
super.initPanels();
addPanels(new HomeNestedScrollPanel(context, mPresenter));
addPanels(new HomeFavorPanel(context, mPresenter));
}
@BindView(R.id.fl_panel)
FrameLayout fl_panel;
@OnClick(R.id.img_a)
public void fff() {
T.s("这是一个预留按钮>_<");
}
@OnClick(R.id.img_search)
public void search() {
mPresenter.goSearch();
}
@BindView(R.id.ll_top)
LinearLayout ll_top;
@BindView(R.id.v_top_0)
View v0;
@BindView(R.id.v_top_1)
View v1;
@BindView(R.id.v_top_2)
View v2;
@Override
protected void initView() {
super.initView();
StatusBarUtil.fitsStatusBarView(v0, v1, v2);
fl_panel.addView(getPanelView(0));
fl_panel.addView(getPanelView(1));
getPanel(0).bingViews(ll_top);
}
@Override
protected void initData() {
super.initData();
mPresenter.loadData();
mPresenter.updateLoadFavor();
}
@Override
public void update(int w, Object... objs) {
getPanel(0).f(w, objs);
}
@Override
public void loadFavor(List<FavorBean> list) {
getPanel(1).f(0, list);
}
}
| [
"[email protected]"
] | |
73e48e49b7cc10b52af98fc53a94c78340f07370 | 6dac76f33cfbd45bd44b74ed322dd9b6ee7cb2b4 | /src/main/java/com/datangliang/app/web/rest/EnterpriseInfoResource.java | d5ef7fd4bdf275bc4e33eaf878163fe2bab4a3f4 | [] | no_license | ouyangshixiong/dtl-app-mock | 2ebb4755b7d03330838462918a49be099f662ec3 | f90e6621411d24f7d15064801a7396bc4cb43124 | refs/heads/master | 2021-07-01T06:37:35.956464 | 2019-01-15T06:50:59 | 2019-01-15T06:50:59 | 165,581,779 | 0 | 1 | null | 2020-09-18T10:53:42 | 2019-01-14T02:25:15 | Java | UTF-8 | Java | false | false | 5,000 | java | package com.datangliang.app.web.rest;
import com.codahale.metrics.annotation.Timed;
import com.datangliang.app.domain.EnterpriseInfo;
import com.datangliang.app.service.EnterpriseInfoService;
import com.datangliang.app.web.rest.errors.BadRequestAlertException;
import com.datangliang.app.web.rest.util.HeaderUtil;
import io.github.jhipster.web.util.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.List;
import java.util.Optional;
/**
* REST controller for managing EnterpriseInfo.
*/
@RestController
@RequestMapping("/api")
public class EnterpriseInfoResource {
private final Logger log = LoggerFactory.getLogger(EnterpriseInfoResource.class);
private static final String ENTITY_NAME = "enterpriseInfo";
private final EnterpriseInfoService enterpriseInfoService;
public EnterpriseInfoResource(EnterpriseInfoService enterpriseInfoService) {
this.enterpriseInfoService = enterpriseInfoService;
}
/**
* POST /enterprise-infos : Create a new enterpriseInfo.
*
* @param enterpriseInfo the enterpriseInfo to create
* @return the ResponseEntity with status 201 (Created) and with body the new enterpriseInfo, or with status 400 (Bad Request) if the enterpriseInfo has already an ID
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PostMapping("/enterprise-infos")
@Timed
public ResponseEntity<EnterpriseInfo> createEnterpriseInfo(@RequestBody EnterpriseInfo enterpriseInfo) throws URISyntaxException {
log.debug("REST request to save EnterpriseInfo : {}", enterpriseInfo);
if (enterpriseInfo.getId() != null) {
throw new BadRequestAlertException("A new enterpriseInfo cannot already have an ID", ENTITY_NAME, "idexists");
}
EnterpriseInfo result = enterpriseInfoService.save(enterpriseInfo);
return ResponseEntity.created(new URI("/api/enterprise-infos/" + result.getId()))
.headers(HeaderUtil.createEntityCreationAlert(ENTITY_NAME, result.getId().toString()))
.body(result);
}
/**
* PUT /enterprise-infos : Updates an existing enterpriseInfo.
*
* @param enterpriseInfo the enterpriseInfo to update
* @return the ResponseEntity with status 200 (OK) and with body the updated enterpriseInfo,
* or with status 400 (Bad Request) if the enterpriseInfo is not valid,
* or with status 500 (Internal Server Error) if the enterpriseInfo couldn't be updated
* @throws URISyntaxException if the Location URI syntax is incorrect
*/
@PutMapping("/enterprise-infos")
@Timed
public ResponseEntity<EnterpriseInfo> updateEnterpriseInfo(@RequestBody EnterpriseInfo enterpriseInfo) throws URISyntaxException {
log.debug("REST request to update EnterpriseInfo : {}", enterpriseInfo);
if (enterpriseInfo.getId() == null) {
throw new BadRequestAlertException("Invalid id", ENTITY_NAME, "idnull");
}
EnterpriseInfo result = enterpriseInfoService.save(enterpriseInfo);
return ResponseEntity.ok()
.headers(HeaderUtil.createEntityUpdateAlert(ENTITY_NAME, enterpriseInfo.getId().toString()))
.body(result);
}
/**
* GET /enterprise-infos : get all the enterpriseInfos.
*
* @return the ResponseEntity with status 200 (OK) and the list of enterpriseInfos in body
*/
@GetMapping("/enterprise-infos")
@Timed
public List<EnterpriseInfo> getAllEnterpriseInfos() {
log.debug("REST request to get all EnterpriseInfos");
return enterpriseInfoService.findAll();
}
/**
* GET /enterprise-infos/:id : get the "id" enterpriseInfo.
*
* @param id the id of the enterpriseInfo to retrieve
* @return the ResponseEntity with status 200 (OK) and with body the enterpriseInfo, or with status 404 (Not Found)
*/
@GetMapping("/enterprise-infos/{id}")
@Timed
public ResponseEntity<EnterpriseInfo> getEnterpriseInfo(@PathVariable Long id) {
log.debug("REST request to get EnterpriseInfo : {}", id);
Optional<EnterpriseInfo> enterpriseInfo = enterpriseInfoService.findOne(id);
return ResponseUtil.wrapOrNotFound(enterpriseInfo);
}
/**
* DELETE /enterprise-infos/:id : delete the "id" enterpriseInfo.
*
* @param id the id of the enterpriseInfo to delete
* @return the ResponseEntity with status 200 (OK)
*/
@DeleteMapping("/enterprise-infos/{id}")
@Timed
public ResponseEntity<Void> deleteEnterpriseInfo(@PathVariable Long id) {
log.debug("REST request to delete EnterpriseInfo : {}", id);
enterpriseInfoService.delete(id);
return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert(ENTITY_NAME, id.toString())).build();
}
}
| [
"[email protected]"
] | |
d9e7113505cb324c992627708daf61a6957fbc78 | a7425280b46e9846b9981be2f11c4d3874fd879b | /lista_encadeada/src/lista_encadeada/Lista.java | 39a88b885080db2d77d7fe71af95ec691cd043f7 | [] | no_license | flaviojnr100/Estruturas-de-dados-em-Java | ad57dbbbb8e290f837d1c260bf59a18a68afe087 | d9de83ae1aacbbec9c401408929b28cf3ba1e7d6 | refs/heads/master | 2020-04-27T10:01:32.424443 | 2019-03-07T00:05:32 | 2019-03-07T00:05:32 | 174,237,030 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 4,420 | java | package lista_encadeada;
public class Lista {
private No Primeiro;
private No Ultimo;
private int tamanho = 0;
public void Inserir_inicio(Object elemento) {
No novo = new No(this.Primeiro, elemento);
this.Primeiro = novo;
if (this.tamanho == 0) {
this.Ultimo = this.Primeiro;
}
this.tamanho++;
}
public void Inserir_ultimo(Object elemento) {
if (this.tamanho == 0) {
this.Inserir_inicio(elemento);
}else {
No novo = new No(null,elemento);
this.Ultimo.setProximo(novo);
this.Ultimo = novo;
this.tamanho++;
}
}
public String toString() {
if (this.tamanho == 0) {
return "[]";
}else {
StringBuilder builder = new StringBuilder("[");
No atual = this.Primeiro;
for(int i = 0; i <this.tamanho-1;i++) {
builder.append(atual.getElemento());
builder.append(", ");
atual = atual.getProximo();
}
builder.append(atual.getElemento());
builder.append("]");
return builder.toString();
}
}
private boolean posicaoOcupada(int posicao) {
return posicao >=0 && posicao <this.tamanho;
}
private No pegaCelula(int posicao) {
if(!this.posicaoOcupada(posicao)) {
throw new IllegalArgumentException("Posição errada!!");
}
No atual = this.Primeiro;
for(int i = 0;i<posicao;i++) {
atual = atual.getProximo();
}
return atual;
}
public void Adicionar(int posicao,Object elemento) {
if (posicao ==0) {
this.Inserir_inicio(elemento);
}else if(posicao == this.tamanho) {
this.Inserir_ultimo(elemento);
}else {
No anterior = this.pegaCelula(posicao-1);
No novo = new No(anterior.getProximo(),elemento);
anterior.setProximo(novo);
this.tamanho++;
}
}
public Object pega(int posicao) {
return this.pegaCelula(posicao).getElemento();
}
public void removeDoComeco() {
if (!this.posicaoOcupada(0)) {
throw new IllegalArgumentException("Posição não existe");
}
No proximo = this.Primeiro.getProximo();
this.Primeiro.setProximo(null);
this.Primeiro = proximo;
this.tamanho--;
if (this.tamanho == 0) {
this.Primeiro = null;
this.Ultimo = null;
}
}
public void removeDoFim() {
if (!this.posicaoOcupada(0)) {
throw new IllegalArgumentException("Posição não existe");
}
if(this.tamanho==1) {
this.Primeiro = null;
this.Ultimo = null;
}else {
No anterior = this.pegaCelula(this.tamanho-1);
anterior.setProximo(null);
this.Ultimo = anterior;
}
this.tamanho--;
}
public void remover(Object elemento) {
if (!this.posicaoOcupada(0)) {
throw new IllegalArgumentException("Posição não existe");
}
if(this.tamanho==1) {
this.Primeiro = null;
this.Ultimo = null;
}else if(this.Ultimo.getElemento() == elemento) {
this.removeDoFim();
}else if(this.Primeiro.getElemento() == elemento) {
this.removeDoComeco();
}else {
No atual = this.Primeiro;
int i =0;
while (atual != null){
if (atual.getElemento() == elemento) {
No anterior = this.pegaCelula(i-1);
No proximo = this.pegaCelula(i+1);
anterior.setProximo(proximo);
this.tamanho--;
return;
}
i++;
atual = atual.getProximo();
}
if(atual==null) {
throw new IllegalArgumentException("O elemento não existe!!");
}
}
}
public Object Pop(int posicao) {
if (!this.posicaoOcupada(0)) {
throw new IllegalArgumentException("Posição não existe");
}
if(posicao==0) {
No elemento = this.pegaCelula(posicao);
this.removeDoComeco();
return elemento.getElemento();
}else if(posicao==this.tamanho-1) {
No elemento = this.pegaCelula(posicao);
this.removeDoFim();
return elemento.getElemento();
}else if(posicao>0 && posicao<this.tamanho) {
No atual = this.pegaCelula(posicao);
No anterior = this.pegaCelula(posicao-1);
No proximo = this.pegaCelula(posicao+1);
anterior.setProximo(proximo);
this.tamanho--;
return atual.getElemento();
}
return null;
}
public static void main(String[] args) {
Lista lista = new Lista();
lista.Inserir_inicio("D");
lista.Inserir_inicio("C");
lista.Inserir_inicio("A");
lista.Adicionar(3, "B");
System.out.println(lista.toString());
lista.remover("D");
System.out.println(lista.toString());
}
}
| [
"[email protected]"
] | |
a22e4b1a9530d5bad77bb6c485af14173e7fb831 | d69ce52f1998e83fd2447102f001e7598a71e91c | /src/main/java/com/dt/controller/VedioSectionController.java | 884654efadc4c4a81d72bf49ceeea26a2b31776e | [] | no_license | NDCFL/KoreanTV | 276f836bd1b79e16561e1bf4a271be69e01f0629 | 0c206867a956ee56c0139c02c35d4df4de78c316 | refs/heads/master | 2020-03-21T08:06:27.891485 | 2018-08-17T05:34:40 | 2018-08-17T05:34:40 | 138,320,812 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,393 | java | package com.dt.controller;
import com.dt.common.Message;
import com.dt.common.PageQuery;
import com.dt.common.PagingBean;
import com.dt.common.StatusQuery;
import com.dt.enums.ActiveStatusEnum;
import com.dt.service.VedioSectionService;
import com.dt.vo.Select2Vo;
import com.dt.vo.UserVo;
import com.dt.vo.VedioSectionVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import javax.servlet.http.HttpSession;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
* Created by chenfeilong on 2017/10/21.
*/
@Controller
@RequestMapping("vedioSection")
public class VedioSectionController {
@Resource
private VedioSectionService vedioSectionService;
@RequestMapping("vedioSectionList")
@ResponseBody
public PagingBean vedioSectionList(int pageSize, int pageIndex, Long vedioId, HttpSession session) throws Exception{
UserVo userVo = (UserVo) session.getAttribute("userVo");
PageQuery pageQuery = new PageQuery();
pageQuery.setId(vedioId);
PagingBean pagingBean = new PagingBean();
pagingBean.setPageSize(pageSize);
pagingBean.setCurrentPage(pageIndex);
pageQuery.setPageSize(pagingBean.getPageSize());
pageQuery.setPageNo(pagingBean.getStartIndex());
pagingBean.setTotal(vedioSectionService.count(pageQuery));
pagingBean.setrows(vedioSectionService.listPage(pageQuery));
return pagingBean;
}
@RequestMapping("findVedioSectionLists")
@ResponseBody
public PagingBean findVedioSectionLists(int pageSize, int pageIndex, VedioSectionVo vedioSectionVo, HttpSession session) throws Exception{
UserVo userVo = (UserVo) session.getAttribute("userVo");
PageQuery pageQuery = new PageQuery();
PagingBean pagingBean = new PagingBean();
pagingBean.setPageSize(pageSize);
pagingBean.setCurrentPage(pageIndex);
pageQuery.setPageSize(pagingBean.getPageSize());
pageQuery.setPageNo(pagingBean.getStartIndex());
pagingBean.setTotal(vedioSectionService.findVedioSectionCount(pageQuery,vedioSectionVo));
pagingBean.setrows(vedioSectionService.findVedioSectionList(pageQuery,vedioSectionVo));
return pagingBean;
}
@RequestMapping("/vedioSectionAddSave")
@ResponseBody
public Message addSavevedioSection(VedioSectionVo vedioSection, HttpSession session) throws Exception {
try{
UserVo userVo = (UserVo) session.getAttribute("userVo");
vedioSection.setIsActive(ActiveStatusEnum.ACTIVE.getValue().byteValue());
vedioSectionService.save(vedioSection);
return Message.success("新增成功!");
}catch (Exception E){
return Message.fail("新增失败!");
}
}
@RequestMapping("/updateVedio")
@ResponseBody
public Message updateVedio(VedioSectionVo vedioSection) throws Exception {
try{
vedioSectionService.updateVedio(vedioSection);
return Message.success("视频修改成功!");
}catch (Exception E){
return Message.fail("视频修改失败!");
}
}
@RequestMapping("/findVedioSection/{id}")
@ResponseBody
public VedioSectionVo findvedioSection(@PathVariable("id") long id){
VedioSectionVo vedioSection = vedioSectionService.getById(id);
return vedioSection;
}
@RequestMapping("/getSectionList/{id}")
@ResponseBody
public List<Select2Vo> getSectionList(@PathVariable("id") long id){
return vedioSectionService.getSectionList(id);
}
@RequestMapping("/findVedioSectionList")
@ResponseBody
public List<VedioSectionVo> findVedioSectionList(long id){
return vedioSectionService.getList(id);
}
@RequestMapping("/vedioSectionUpdateSave")
@ResponseBody
public Message updatevedioSection(VedioSectionVo vedioSection) throws Exception{
try{
vedioSectionService.update(vedioSection);
return Message.success("修改成功!");
}catch (Exception e){
return Message.fail("修改失败!");
}
}
@RequestMapping("/deleteManyVedioSection")
@ResponseBody
public Message deleteManyvedioSection(@Param("manyId") String manyId,Integer status) throws Exception{
try{
String str[] = manyId.split(",");
for (String s: str) {
vedioSectionService.updateStatus(new StatusQuery(Long.parseLong(s),status));
}
return Message.success("批量修改状态成功!");
}catch (Exception e){
e.printStackTrace();
return Message.fail("批量修改状态失败!");
}
}
@RequestMapping("/deleteVedioSection/{id}")
@ResponseBody
public Message deletevedioSection(@PathVariable("id") long id) throws Exception{
try{
vedioSectionService.removeById(id);
return Message.success("删除成功!");
}catch (Exception e){
e.printStackTrace();
return Message.fail("删除失败!");
}
}
@RequestMapping("/vedioSectionPage")
public String table() throws Exception{
return "vedio/vedioSectionList";
}
@RequestMapping("updateStatus/{id}/{status}")
@ResponseBody
public Message updateStatus(@PathVariable("id") long id,@PathVariable("status") int status) throws Exception{
try{
vedioSectionService.updateStatus(new StatusQuery(id,status));
return Message.success("ok");
}catch (Exception e){
return Message.fail("fail");
}
}
@InitBinder
public void initBinder(WebDataBinder binder) {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
dateFormat.setLenient(false);
binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
}
}
| [
"[email protected]"
] | |
6ba20c5237b6283de50c33c43d53d62cb8103416 | 6883c617e4439b8fa5497373f5c24152d843a1ba | /src/main/java/com/lothrazar/cyclicmagic/gui/component/GuiCheckboxTooltip.java | b013cfedc7a2dbd4dc802c39ed549b27d8a1a0f8 | [
"MIT"
] | permissive | sandtechnology/Cyclic | b84c8ba00d9d3ec099bb15c24069e2289bd62844 | a668cfe42db63c0c2d660d3e6abebc21ac7a50b4 | refs/heads/develop | 2021-08-18T00:01:12.701994 | 2019-12-31T05:30:04 | 2019-12-31T05:30:04 | 131,421,090 | 0 | 0 | MIT | 2019-06-09T10:32:57 | 2018-04-28T15:25:17 | Java | UTF-8 | Java | false | false | 2,159 | java | /*******************************************************************************
* The MIT License (MIT)
*
* Copyright (C) 2014-2018 Sam Bassett (aka Lothrazar)
*
* 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 com.lothrazar.cyclicmagic.gui.component;
import java.util.ArrayList;
import java.util.List;
import com.lothrazar.cyclicmagic.data.ITooltipButton;
import com.lothrazar.cyclicmagic.util.UtilChat;
import net.minecraftforge.fml.client.config.GuiCheckBox;
public class GuiCheckboxTooltip extends GuiCheckBox implements ITooltipButton {
public GuiCheckboxTooltip(int buttonId, int x, int y, String buttonText, boolean ch) {
super(buttonId, x, y, buttonText, ch);
}
private List<String> tooltip = new ArrayList<String>();
@Override
public List<String> getTooltips() {
return tooltip;
}
public void setTooltips(List<String> t) {
tooltip = t;
}
public void setTooltip(final String t) {
List<String> remake = new ArrayList<String>();
remake.add(UtilChat.lang(t));
tooltip = remake;
}
}
| [
"[email protected]"
] | |
c1ff51a62fd967f87e340430a45cb59e222a335e | 1f4c06ca5ea137c7d4566c5f514fbc2c2b13d45d | /src/main/java/com/gotofinal/messages/api/chat/component/ComponentBuilder.java | 5fbf7f3bd2e1d64fb6c855cf3205bd337eeaa522 | [] | no_license | GotoFinal/MessagesAPI | 68070930d43bcc0251025ba100b710a40decf55b | 898086fd9e3f2fd20428befc975f5066b24ad35e | refs/heads/master | 2021-01-10T16:42:17.095135 | 2016-02-21T08:09:35 | 2016-02-21T08:09:35 | 51,719,200 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,641 | java | /*
* The MIT License (MIT)
*
* Copyright (c) 2016. Diorite (by Bartłomiej Mazur (aka GotoFinal))
*
* 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 com.gotofinal.messages.api.chat.component;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.gotofinal.messages.api.chat.ChatColor;
/**
* Builder class for easier building chat messages.
*/
public class ComponentBuilder
{
private final TextComponent parts = new TextComponent("");
private BaseComponent current;
/**
* Construct new ComponentBuilder as copy of old one.
*
* @param original ComponentBuilder to copy.
*/
protected ComponentBuilder(final ComponentBuilder original)
{
this.current = new TextComponent(original.current);
original.parts.getExtra().stream().map(BaseComponent::duplicate).forEach(this.parts::addExtra);
}
/**
* Construct new ComponentBuilder strating from given string ({@link TextComponent}).
*
* @param text first element of message.
*/
protected ComponentBuilder(final String text)
{
this.current = new TextComponent(text);
}
/**
* Add previously edited component to other parts, and set given component as current one.
*
* @param component new component to edit and add.
*
* @return this same ComponentBuilder for method chains.
*/
public ComponentBuilder append(final BaseComponent component)
{
this.parts.addExtra(this.current);
this.current = component;
return this;
}
/**
* Add previously edited component to other parts, and set given component as current one.
*
* @param text new component to edit and add as legacy string. {@link TextComponent#fromLegacyText(String)}
*
* @return this same ComponentBuilder for method chains.
*/
public ComponentBuilder appendLegacy(final String text)
{
this.parts.addExtra(this.current);
this.current = TextComponent.fromLegacyText(text);
return this;
}
/**
* Add previously edited component to other parts, and set given component as current one.
*
* @param text new component to edit and add as string.
*
* @return this same ComponentBuilder for method chains.
*/
public ComponentBuilder append(final String text)
{
this.parts.addExtra(this.current);
this.current = new TextComponent(text);
return this;
}
/**
* Set color of current element to given one, may be null.
*
* @param color color to use, may be null.
*
* @return this same ComponentBuilder for method chains.
*/
public ComponentBuilder color(final ChatColor color)
{
this.current.setColor(color);
return this;
}
/**
* Set bold style flag of current element to given one, may be null.
*
* @param bold bold style flag to use, may be null.
*
* @return this same ComponentBuilder for method chains.
*/
public ComponentBuilder bold(final Boolean bold)
{
this.current.setBold(bold);
return this;
}
/**
* Set italic style flag of current element to given one, may be null.
*
* @param italic italic style flag to use, may be null.
*
* @return this same ComponentBuilder for method chains.
*/
public ComponentBuilder italic(final Boolean italic)
{
this.current.setItalic(italic);
return this;
}
/**
* Set underlined style flag of current element to given one, may be null.
*
* @param underlined underlined style flag to use, may be null.
*
* @return this same ComponentBuilder for method chains.
*/
public ComponentBuilder underlined(final Boolean underlined)
{
this.current.setUnderlined(underlined);
return this;
}
/**
* Set strikethrough style flag of current element to given one, may be null.
*
* @param strikethrough strikethrough style flag to use, may be null.
*
* @return this same ComponentBuilder for method chains.
*/
public ComponentBuilder strikethrough(final Boolean strikethrough)
{
this.current.setStrikethrough(strikethrough);
return this;
}
/**
* Set obfuscated style flag of current element to given one, may be null.
*
* @param obfuscated obfuscated style flag to use, may be null.
*
* @return this same ComponentBuilder for method chains.
*/
public ComponentBuilder obfuscated(final Boolean obfuscated)
{
this.current.setObfuscated(obfuscated);
return this;
}
/**
* Set click event of current element to given one, may be null.
*
* @param clickEvent click event to use, may be null.
*
* @return this same ComponentBuilder for method chains.
*/
public ComponentBuilder event(final ClickEvent clickEvent)
{
this.current.setClickEvent(clickEvent);
return this;
}
/**
* Set hover event of current element to given one, may be null.
*
* @param hoverEvent hover event to use, may be null.
*
* @return this same ComponentBuilder for method chains.
*/
public ComponentBuilder event(final HoverEvent hoverEvent)
{
this.current.setHoverEvent(hoverEvent);
return this;
}
/**
* Finish builder, and create {@link TextComponent} with all created parts.
*
* @return builded {@link TextComponent}.
*/
public TextComponent create()
{
this.parts.addExtra(this.current);
return this.parts;
}
/**
* Construct new ComponentBuilder strating from given string ({@link TextComponent}).
*
* @param text first element of message.
*
* @return new ComponentBuilder instance.
*/
public static ComponentBuilder start(final String text)
{
return new ComponentBuilder(text);
}
/**
* Construct new ComponentBuilder as copy of old one.
*
* @param original ComponentBuilder to copy.
*
* @return new ComponentBuilder instance.
*/
public static ComponentBuilder start(final ComponentBuilder original)
{
return new ComponentBuilder(original);
}
@Override
public String toString()
{
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).appendSuper(super.toString()).append("parts", this.parts).append("current", this.current).toString();
}
}
| [
"[email protected]"
] | |
8afaff9d9cf96296cd599bb8fc2573eab0b956bd | 39c9a605fb35aebd06fc4ad0f49f945848ab2582 | /src/main/java/com/prime/task/prime/common/mappers/ProjectMapper.java | 4b7a6b760ee42ce52f1fe8e0c9a30b96b1ff7f57 | [] | no_license | endritsheholliAltima/Prime | e1d49f1f8109bdc25f755099212dd67507ce0f95 | 17bf8f4b32801e4dd5d9c92ad3b6a50c9d72072b | refs/heads/master | 2023-04-17T12:12:30.184485 | 2021-04-20T20:01:42 | 2021-04-20T20:01:42 | 358,727,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,076 | java | package com.prime.task.prime.common.mappers;
import com.prime.task.prime.dto.ProjectDTO;
import com.prime.task.prime.model.Project;
import org.modelmapper.ModelMapper;
import java.util.Set;
import java.util.function.Function;
import java.util.stream.Collectors;
public class ProjectMapper {
public static ProjectDTO toProjectDTO(Project project) {
ModelMapper modelMapper = new ModelMapper();
return modelMapper.map(project, ProjectDTO.class);
}
public static Project toProject(ProjectDTO projectDTO) {
ModelMapper modelMapper = new ModelMapper();
return modelMapper.map(projectDTO, Project.class);
}
public static Function<Project, Set<ProjectDTO>> findSiblings = person -> person.getParent().getChildren().stream()
.map(p -> ProjectDTO.builder().id(p.getId()).name(p.getName()).build()).collect(Collectors.toSet());
public static Function<Project, ProjectDTO> mapToProjectDTO = p -> ProjectDTO.builder().id(p.getId()).name(p.getName()).parent(p.getParent()).children(p.getChildren()).build();
}
| [
"[email protected]"
] | |
c6c29be38c375fe29d1e78e46533b91ab32f954e | 2941f2e847d36c2e4ed58a28296ff79635857372 | /src/cafeteria/ui/users/CustomerLoginDialog.java | 35b7fea4a9f35ca6fec05c84fc8a259e0735e0b3 | [] | no_license | yatharthk2/OOP_Mninprojec-master | 52e55fb35936000a016bb0ac083170d7a2549518 | 78a2d735463c64b6ae6959d198816af9913e75c8 | refs/heads/master | 2023-05-20T01:02:28.226026 | 2021-06-09T16:54:29 | 2021-06-09T16:54:29 | 373,394,809 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,454 | java | package cafeteria.ui.users;
import java.awt.BorderLayout;
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import cafeteria.core.Customer;
import cafeteria.dao.CustomerDAO;
import cafeteria.dao.FoodDAO;
import cafeteria.dao.OrderDAO;
import cafeteria.ui.BillingApp;
import javax.swing.JTextField;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import java.awt.Font;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.sql.SQLException;
import java.awt.event.ActionEvent;
import javax.swing.JPasswordField;
@SuppressWarnings("serial")
public class CustomerLoginDialog extends JDialog {
private FoodDAO foodDAO;
private CustomerDAO customerDAO;
private OrderDAO orderDAO;
private final JPanel contentPanel = new JPanel();
private JLabel lblWelcomeToCafeteria;
private JPanel credentialpanel;
private JTextField emailTextField;
private JPasswordField passwordField;
public CustomerLoginDialog(CustomerDAO customerDAO, FoodDAO foodDAO, OrderDAO orderDAO){
this();
this.customerDAO = customerDAO;
this.foodDAO = foodDAO;
this.orderDAO = orderDAO;
addWindowListener(new WindowAdapter() {
@Override
public void windowClosing(WindowEvent we)
{
int PromptResult = JOptionPane.showConfirmDialog(null, "Exit application ?",
"Confirm exit", JOptionPane.OK_CANCEL_OPTION);
if(PromptResult== JOptionPane.OK_OPTION)
{
System.exit(0);
}
}
});
}
public CustomerLoginDialog() {
//this.setResizable(false);
setTitle("MIT WPU Cafeteria - Log In");
setBounds(100, 100, 450, 300);
getContentPane().setLayout(new BorderLayout());
contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
getContentPane().add(contentPanel, BorderLayout.CENTER);
contentPanel.setLayout(new BorderLayout(0, 0));
{
JPanel lblpanel = new JPanel();
FlowLayout flowLayout = (FlowLayout) lblpanel.getLayout();
flowLayout.setVgap(10);
contentPanel.add(lblpanel, BorderLayout.NORTH);
{
lblWelcomeToCafeteria = new JLabel("Welcome to Cafeteria Billing System");
lblWelcomeToCafeteria.setFont(new Font("Sylfaen", Font.BOLD, 16));
lblpanel.add(lblWelcomeToCafeteria);
}
}
{
credentialpanel = new JPanel();
contentPanel.add(credentialpanel, BorderLayout.CENTER);
credentialpanel.setLayout(null);
JLabel lblEmail = new JLabel("E-mail");
lblEmail.setFont(new Font("Sylfaen", Font.PLAIN, 15));
lblEmail.setBounds(21, 19, 46, 14);
credentialpanel.add(lblEmail);
emailTextField = new JTextField();
emailTextField.setBounds(86, 16, 180, 20);
credentialpanel.add(emailTextField);
emailTextField.setColumns(30);
JLabel lblPassword = new JLabel("Password");
lblPassword.setFont(new Font("Sylfaen", Font.PLAIN, 15));
lblPassword.setBounds(10, 50, 70, 14);
credentialpanel.add(lblPassword);
JButton btnLogIn = new JButton("Log in");
btnLogIn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
performLogin();
}
});
btnLogIn.setBounds(177, 78, 89, 23);
credentialpanel.add(btnLogIn);
JLabel lblNewUser = new JLabel("New user ?");
lblNewUser.setFont(new Font("Sylfaen", Font.PLAIN, 15));
lblNewUser.setBounds(34, 121, 80, 14);
credentialpanel.add(lblNewUser);
JButton btnSignUp = new JButton("Sign up");
btnSignUp.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
CustomerSignUpDialog dialog = new CustomerSignUpDialog(CustomerLoginDialog.this, customerDAO);
dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
//dissolve current dialog and create new dialog
dispose();
//setVisible(false); can use this also but dispose() is preferred to release memory
dialog.setVisible(true);
}
});
btnSignUp.setBounds(110, 117, 89, 23);
credentialpanel.add(btnSignUp);
passwordField = new JPasswordField();
passwordField.setBounds(86, 47, 180, 20);
credentialpanel.add(passwordField);
}
}
private void performLogin(){
String email = emailTextField.getText();
String plainTextPassword = new String(passwordField.getPassword());
try {
Customer customer = customerDAO.searchCustomer(email); //if not NULL, customer records found in database
if(customer == null){
JOptionPane.showMessageDialog(CustomerLoginDialog.this, "Customer not found", "OOPS!",
JOptionPane.INFORMATION_MESSAGE);
return;
}
//Authentication check
boolean check = customerDAO.authenticate(plainTextPassword, customer);
if(check){
System.out.println("Customer authenticated");
emailTextField.setText("");
passwordField.setText("");
BillingApp frame = new BillingApp(CustomerLoginDialog.this, orderDAO, foodDAO, customer);
frame.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);;
dispose();
frame.setVisible(true);
}
else{
JOptionPane.showMessageDialog(CustomerLoginDialog.this, "Invalid password!", "Invalid login",
JOptionPane.ERROR_MESSAGE);
return;
}
}
catch (SQLException e) {
JOptionPane.showMessageDialog(CustomerLoginDialog.this, "Error logging in: "
+ e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
}
}
}
| [
"[email protected]"
] | |
357390a2ff924c127cbf852e3321ab9d38512fcd | 55bf3cf97644af0bcbec091532fe83c99ba592f6 | /org/w3c/css/properties/css2/CssCursor.java | a525072ac5b1a128cb1c4a98ab571153e81c0014 | [
"W3C-20150513",
"W3C"
] | permissive | w3c/css-validator | dda4f191ff839b392440d91f9012ba2d2d63d0c6 | 6874d1990af57d3260fdc2a9420b09077cf2ed06 | refs/heads/main | 2023-09-03T12:40:19.427371 | 2023-03-13T13:59:56 | 2023-03-13T13:59:56 | 40,552,697 | 223 | 124 | NOASSERTION | 2023-09-13T17:38:37 | 2015-08-11T16:28:14 | Java | UTF-8 | Java | false | false | 4,508 | java | // $Id$
// Author: Yves Lafon <[email protected]>
//
// (c) COPYRIGHT MIT, ERCIM and Keio University, 2012.
// Please first read the full copyright statement in file COPYRIGHT.html
package org.w3c.css.properties.css2;
import org.w3c.css.util.ApplContext;
import org.w3c.css.util.InvalidParamException;
import org.w3c.css.values.CssExpression;
import org.w3c.css.values.CssIdent;
import org.w3c.css.values.CssLayerList;
import org.w3c.css.values.CssTypes;
import org.w3c.css.values.CssValue;
import java.util.ArrayList;
import static org.w3c.css.values.CssOperator.COMMA;
/**
* @spec http://www.w3.org/TR/2008/REC-CSS2-20080411/ui.html#cursor-props
*/
public class CssCursor extends org.w3c.css.properties.css.CssCursor {
public static CssIdent[] allowed_values;
static {
String[] _allowed_values = {
"auto", "crosshair", "default", "pointer", "move",
"e-resize", "ne-resize", "nw-resize", "n-resize",
"se-resize", "sw-resize", "s-resize", "w-resize",
"text", "wait", "help"};
allowed_values = new CssIdent[_allowed_values.length];
int i = 0;
for (String s : _allowed_values) {
allowed_values[i++] = CssIdent.getIdent(s);
}
}
public static CssIdent getMatchingIdent(CssIdent ident) {
for (CssIdent id : allowed_values) {
if (id.equals(ident)) {
return id;
}
}
return null;
}
/**
* Create a new CssCursor
*/
public CssCursor() {
}
/**
* Creates a new CssCursor
*
* @param expression The expression for this property
* @throws org.w3c.css.util.InvalidParamException
* Expressions are incorrect
*/
public CssCursor(ApplContext ac, CssExpression expression, boolean check)
throws InvalidParamException {
setByUser();
CssValue val;
char op;
CssValue lastIdent = null;
ArrayList<CssValue> values = new ArrayList<CssValue>();
while (!expression.end()) {
val = expression.getValue();
op = expression.getOperator();
switch (val.getType()) {
case CssTypes.CSS_URL:
if (lastIdent != null) {
throw new InvalidParamException("value",
val.toString(),
getPropertyName(), ac);
}
values.add(val);
break;
case CssTypes.CSS_IDENT:
if (inherit.equals(val)) {
if (expression.getCount() > 1) {
throw new InvalidParamException("value",
inherit.toString(),
getPropertyName(), ac);
}
value = inherit;
break;
}
if (lastIdent == null) {
lastIdent = getMatchingIdent((CssIdent) val);
// not recognized... exit
if (lastIdent == null) {
throw new InvalidParamException("value",
val.toString(),
getPropertyName(), ac);
}
values.add(val);
break;
}
default:
throw new InvalidParamException("value",
val.toString(),
getPropertyName(), ac);
}
expression.next();
if (!expression.end() && (op != COMMA)) {
throw new InvalidParamException("operator",
Character.toString(op), ac);
}
}
if (value != inherit) {
// check if we got the mandatory ident
if (lastIdent == null) {
// TODO better errormsg
throw new InvalidParamException("value",
expression.toString(),
getPropertyName(), ac);
}
value = (values.size() == 1) ? values.get(0) : new CssLayerList(values);
}
}
public CssCursor(ApplContext ac, CssExpression expression)
throws InvalidParamException {
this(ac, expression, false);
}
}
| [
"[email protected]"
] | |
0c12024c65a31d15cc799edb18f82230621e2019 | 1624de67cbed074dd130a1250b6e02965c399a2f | /JavaPhotoEditor/src/operations/BasicOperation11.java | 9100485960367c6d35628fcd946852a4a1bdc5e3 | [] | no_license | Ognjenjebot/PhotoEditor | 445e7213af6b5374f6c432a802ff919a815f8af8 | 4ec7a5f684b60043222279eafdcbbb6918b36ac8 | refs/heads/main | 2023-07-04T00:48:13.693377 | 2021-07-22T15:20:37 | 2021-07-22T15:20:37 | 388,486,159 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,100 | java | package operations;
import java.util.ArrayList;
import gui.Layer;
import gui.Selection;
public class BasicOperation11 extends Operation {
@Override
public void execute(Layer i, int num) {
Selection s = i.parent.getSelection();
ArrayList<Integer> indexes = s.pixelSelection(i.width, i.height);
if (indexes.size() == 0) {//cela slika
for (int j=0; j<i.pixels.size(); j++) {
if(i.pixels.get(j).A < num)
i.pixels.get(j).A = (byte) num;
if(i.pixels.get(j).R < num)
i.pixels.get(j).R = (byte) num;
if(i.pixels.get(j).G < num)
i.pixels.get(j).G = (byte) num;
if(i.pixels.get(j).B < num)
i.pixels.get(j).B = (byte) num;
}
} else { //selekcija
for (int j=0; j<indexes.size(); j++) {
int index = indexes.get(j).intValue();
if(i.pixels.get(index).A < num)
i.pixels.get(index).A = (byte) num;
if(i.pixels.get(index).R < num)
i.pixels.get(index).R = (byte) num;
if(i.pixels.get(index).G < num)
i.pixels.get(index).G = (byte) num;
if(i.pixels.get(index).B < num)
i.pixels.get(index).B = (byte) num;
}
}
}
}
| [
"[email protected]"
] | |
a7059dbc521d0c25a6028d9bb518b0caddd244b2 | 8b76bd5e7139000d22734a200e998a273de5ab85 | /src/main/java/com/spring/royallife/controller/AdminPageController.java | 03fc8b1d174043d681f69d495de44c3db649023b | [] | no_license | jitumeher01/royallifeapi | 24002dc280ce960912e5834940477fa648c79df0 | 33587f9059d0da6d86ac7e422a5769f2e2b88c48 | refs/heads/master | 2021-07-06T05:57:27.651969 | 2017-10-02T15:00:05 | 2017-10-02T15:00:05 | 104,493,385 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,852 | java | //package com.spring.royallife.controller;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.http.HttpStatus;
//import org.springframework.http.ResponseEntity;
//import org.springframework.web.bind.annotation.RequestBody;
//import org.springframework.web.bind.annotation.RequestHeader;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RestController;
//
//import com.spring.royallife.entity.AdminEntity;
//import com.spring.royallife.facade.AdminFacade;
//import com.spring.royallife.form.UserForm;
//import com.spring.royallife.service.AdminService;
//
//@RestController("/api/rest/admin")
//public class AdminPageController {
//
// @Autowired
// private AdminFacade adminFacade;
//
// @Autowired
// private AdminService adminService;
//
// @RequestMapping(value = "/adminlogin", method = RequestMethod.POST)
// public ResponseEntity<?> register(@RequestBody UserForm userForm) {
//
// AdminEntity adminEntity = adminFacade.findByAdminIdAandPassword(userForm.getUserId(), userForm.getPassword());
// if (adminEntity != null) {
// return ResponseEntity.status(HttpStatus.OK).body(adminEntity);
// } else {
// return ResponseEntity.status(HttpStatus.NOT_FOUND).body("Invalid Admin Id/Password !");
// }
// }
//
// @RequestMapping(value = "/allUser", method = RequestMethod.GET)
// public ResponseEntity<?> getAllUser(@RequestHeader(value = "token") String token) {
// AdminEntity adminEntity = adminService.verifyToken(token);
// if (adminEntity != null) {
// return ResponseEntity.status(HttpStatus.OK).body(adminFacade.findAllUser());
// } else {
// return ResponseEntity.status(HttpStatus.NOT_FOUND).body("Session Time Out !");
// }
// }
//
// @RequestMapping(value = "/singleUser", method = RequestMethod.GET)
// public ResponseEntity<?> getUserById(@RequestHeader(value = "token") String token,@RequestBody UserForm userForm) {
// AdminEntity adminEntity = adminService.verifyToken(token);
// if (adminEntity != null) {
// return ResponseEntity.status(HttpStatus.OK).body(adminFacade.findUserById(userForm.getUserId()));
// } else {
// return ResponseEntity.status(HttpStatus.NOT_FOUND).body("Session Time Out !");
// }
// }
//
// @RequestMapping(value = "/updateUser", method = RequestMethod.GET)
// public ResponseEntity<?> updateUser(@RequestHeader(value = "token") String token,@RequestBody UserForm userForm) {
// AdminEntity adminEntity = adminService.verifyToken(token);
// if (adminEntity != null) {
// adminFacade.updateUser(userForm);
// return ResponseEntity.status(HttpStatus.OK).body("User Data Updated !");
// } else {
// return ResponseEntity.status(HttpStatus.NOT_FOUND).body("Session Time Out !");
// }
// }
//
//}
| [
"[email protected]"
] | |
7a90fefc5e0a88d7409c8d5cb8199ed09ffd0311 | 610156b0ea12328faea46fc27954f959735af3e7 | /AlgoritmosGeneticos/AlgoritmosGeneticos/src/PaqueteMochila/Poblacion.java | 0e76c767984231f971ffb14c5d7610a5957c26a2 | [] | no_license | Treicysg/Analisis_algoritmos | 24cb6b86e9cdf24c9f8d4d4912f7e302980d8043 | 979a39dd6492c7da74cf3fd9d441fa2f1532d859 | refs/heads/master | 2021-03-12T23:56:58.297597 | 2014-11-21T05:02:12 | 2014-11-21T05:02:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,057 | java | package PaqueteMochila;
import PaqueteMochila.Individuo;
import java.util.ArrayList;
public class Poblacion {
Individuo[] individuos;
public Poblacion (ArrayList<Individuo> x){
individuos = new Individuo [x.size()];
for (int i=0;i<x.size();i++){
almacenarIndividuo(i,x.get(i));
}
}
public Poblacion(int tamanoPoblacion,boolean inicializar){
individuos = new Individuo [tamanoPoblacion];
if (inicializar){
for (int i=0;i<tamanoPoblacion;i++){
Individuo nuevo = new Individuo();
nuevo.generarIndividuo();
almacenarIndividuo(i,nuevo);
}
}
}
public void almacenarIndividuo(int index,Individuo indiv){
individuos[index] = indiv;
}
public Individuo getIndividuo(int index){
return individuos[index];
}
public Individuo getFittest(){
Individuo fittest = individuos[0];
for (int i=0;i<individuos.length;i++){
if (fittest.getFitness()<= getIndividuo(i).getFitness()){
fittest=getIndividuo(i);
}
}
return fittest;
}
public Poblacion() {
// TODO Auto-generated constructor stub
}
}
| [
"[email protected]"
] | |
0f73bf55c1fd09e5f364e1aaf4d55289a13308d4 | 34d55e0fd0ad83cd01b998c2e5f60e9e9fe67c57 | /app/src/main/java/com/comment/tek/fragment/HomePageFragment.java | 2ea752ca851f5bb3db040e96b199c81e13bf1948 | [] | no_license | kevinStrange/app-android-comment | 3f25b9cd3217b7e4101c4131cef739c300bc5fd0 | a08895464a119b9ad89cef71a6fd6bc7b715cea6 | refs/heads/master | 2020-03-27T15:12:03.098401 | 2018-09-04T05:44:10 | 2018-09-04T05:44:10 | 146,703,898 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,731 | java | package com.comment.tek.fragment;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.comment.banner.interfaces.IOnBannerListener;
import com.comment.banner.util.BannerConfig;
import com.comment.banner.view.Banner;
import com.comment.tek.activity.R;
import com.comment.tek.base.BaseApplication;
import com.comment.tek.base.BaseFragment;
import com.comment.tek.widget.GlideImageLoader;
/**
* Created by huanghongfa on 2018/8/24.
* 首页
*/
public class HomePageFragment extends BaseFragment implements View.OnClickListener, IOnBannerListener {
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
return inflater.inflate(R.layout.fragment_home_page, null);
}
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
initView();
}
@Override
public void initView() {
super.initView();
Banner banner2 = findViewById(R.id.banner2);
banner2.setImages(BaseApplication.banner_images)
.setBannerTitles(BaseApplication.banner_titles)
.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE)
.setImageLoader(new GlideImageLoader())
.setOnBannerListener(this)
.start();
}
@Override
public void onClick(View v) {
switch (v.getId()) {
}
}
@Override
public void OnBannerClick(int position) {
toast("点击了" + position);
}
}
| [
"[email protected]"
] | |
699c6f490d90f73a8cb9ddeb0ebce332aeb883c6 | 87f6841613373f509c2f3579ed562e624c1a670a | /week5-093.PersonExtended/src/Person.java | daf85baf676ea0ff4c177e4ca00f73e7f1720058 | [] | no_license | PiotrKrolwsb/2013-OOProgrammingWithJava-PART1 | 6a34030bf02b29a3a9e843efaff67ec9d396b82c | 182876a38fa6d8d16daedb3cec6903754e209fb4 | refs/heads/master | 2021-01-10T16:01:07.428671 | 2016-03-25T22:52:45 | 2016-03-25T22:52:45 | 53,681,722 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,675 | java | import java.util.Calendar;
public class Person
{
private String name;
private MyDate birthday;
public Person(String name)
{
this.name = name;
this.birthday = new MyDate(Calendar.getInstance().get(Calendar.DATE), Calendar.getInstance().get(Calendar.MONTH) + 1, Calendar.getInstance().get(Calendar.YEAR));
}
public Person(String name, int pp, int kk, int vv)
{
this(name);
this.birthday = new MyDate(pp, kk, vv);
}
public Person(String name, MyDate birthday)
{
this(name);
this.birthday = birthday;
}
public int age() {
// calculate the age based on the birthday and the current day
// you get the current day as follows:
// Calendar.getInstance().get(Calendar.DATE);
// Calendar.getInstance().get(Calendar.MONTH) + 1; // January is 0 so we add one
// Calendar.getInstance().get(Calendar.YEAR);
MyDate birthYear = new MyDate(Calendar.getInstance().get(Calendar.DATE),
Calendar.getInstance().get(Calendar.MONTH) + 1,
Calendar.getInstance().get(Calendar.YEAR));
int difference = birthday.differenceInYears(birthYear);
return difference;
}
public boolean olderThan(Person compared)
{
if (this.birthday.earlier(compared.birthday))
{
return true;
}
else
{
return false;
}
}
public String getName()
{
return this.name;
}
public String toString()
{
return this.name + ", born " + this.birthday;
}
}
| [
"[email protected]"
] | |
80536c6e3c430e3bf156848a3fd6541211e9f178 | 69a52bf241d2ed0286d73755a617db044b404e9c | /VisitorDesignPattern/test/src/edu/umb/cs/cs680/hw10/VisitorsTest.java | fff4f2214cde858abae22ffba56302de1cb762de | [] | no_license | SunayanShaik/Object-Oriented-Design-Programming | 2df102b9de634fcd2de6f6724f54fa1c1e35b03b | dd63264edaea3a1885daa15b424e0964efb0e525 | refs/heads/master | 2020-03-18T20:21:36.478245 | 2018-05-28T21:41:45 | 2018-05-28T21:41:45 | 135,210,489 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,214 | java | package edu.umb.cs.cs680.hw10;
import static org.junit.Assert.*;
import java.util.Date;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import edu.umb.cs.cs68.hw10.CountingVisitor;
import edu.umb.cs.cs68.hw10.Directory;
import edu.umb.cs.cs68.hw10.File;
import edu.umb.cs.cs68.hw10.FileSearchVisitor;
import edu.umb.cs.cs68.hw10.FileSystem;
import edu.umb.cs.cs68.hw10.Link;
import edu.umb.cs.cs68.hw10.VirusCheckingVisitor;
public class VisitorsTest {
private Directory rootDir, systemDir, homeDir, picturesDir;
private File a, b, c, d, e, f;
private Link x, y;
private FileSearchVisitor fsVisitor1, fsVisitor2, fsVisitor3;
private CountingVisitor countingVisitor1, countingVisitor2, countingVisitor3;
@Before
public void setUp() throws Exception {
Date created = new Date(System.currentTimeMillis() - 3600 * 1000);
Date modified = new java.util.Date();
rootDir = new Directory(null, "root", "sunayan", created, modified, 0, false);
systemDir = new Directory(rootDir, "system", "sunayan", created, modified, 0, false);
homeDir = new Directory(rootDir, "home", "sunayan", created, modified, 0, false);
picturesDir = new Directory(homeDir, "pictures", "sunayan", created, modified, 0, false);
rootDir.appendChild(systemDir);
rootDir.appendChild(homeDir);
a = new File(systemDir, "a.txt", "sunayan", created, modified, 10, true);
b = new File(systemDir, "b.txt", "sunayan", created, modified, 20, true);
c = new File(systemDir, "c.pdf", "sunayan", created, modified, 30, true);
systemDir.appendChild(a);
systemDir.appendChild(b);
systemDir.appendChild(c);
d = new File(homeDir, "d.doc", "sunayan", created, modified, 40, true);
x = new Link(homeDir, systemDir, "x", "sunayan", created, modified, 0, false);
homeDir.appendChild(d);
homeDir.appendChild(x);
homeDir.appendChild(picturesDir);
e = new File(picturesDir, "e.txt", "sunayan",created, modified, 50, true);
f = new File(picturesDir, "f.pdf", "sunayan",created, modified, 60, true);
y = new Link(picturesDir, e, "y", "sunayan",created, modified, 0, false);
picturesDir.appendChild(e);
picturesDir.appendChild(f);
picturesDir.appendChild(y);
a.setHasVirus(true);
d.setHasVirus(true);
f.setHasVirus(true);
}
@After
public void tearDown() throws Exception {
fsVisitor1 = null;
fsVisitor2 = null;
fsVisitor3 = null;
countingVisitor1 = null;
countingVisitor2 = null;
countingVisitor3 = null;
}
@Test
public void showAllElementsTest() {
System.out.println("----------------------------------------------------------------------");
System.out.println("Tree Structure: ");
System.out.println("----------------------------------------------------------------------");
FileSystem fileSystem = FileSystem.getFileSystem(rootDir);
fileSystem.showAllElements();
}
@Test
public void testFileSearchVisitorOnRoot() {
int expectedTxtFileSize = 3;
int expectedPdfSize = 2;
int expectedDocSize = 1;
fsVisitor1 = new FileSearchVisitor(".txt");
fsVisitor2 = new FileSearchVisitor(".pdf");
fsVisitor3 = new FileSearchVisitor(".doc");
rootDir.accept(fsVisitor1);
rootDir.accept(fsVisitor2);
rootDir.accept(fsVisitor3);
int actualTxtFieldSize = fsVisitor1.getFoundFiles().size();
int actualPdfSize = fsVisitor2.getFoundFiles().size();
int actualDocSize = fsVisitor3.getFoundFiles().size();
assertEquals(expectedTxtFileSize, actualTxtFieldSize);
assertEquals(expectedPdfSize, actualPdfSize);
assertEquals(expectedDocSize, actualDocSize);
System.out.println("----------------------------------------------------------------------");
System.out.println("FileSearchVisitor sizes in a tree :");
System.out.println("----------------------------------------------------------------------");
System.out.println("For '.txt' files in rootDir : " +actualTxtFieldSize);
System.out.println("For '.pdf' files in rootDir : " +actualPdfSize);
System.out.println("For '.doc' files in rootDir : " +actualDocSize);
}
@Test
public void testCountingVisitorOnDirNum() {
int expectedRootDirCount = 4;
int expectedHomeDirCount = 2;
int expectedPicturesDirCount = 1;
countingVisitor1 = new CountingVisitor();
countingVisitor2 = new CountingVisitor();
countingVisitor3 = new CountingVisitor();
rootDir.accept(countingVisitor1);
homeDir.accept(countingVisitor2);
picturesDir.accept(countingVisitor3);
int actualRootDirCount = countingVisitor1.getDirNum();
int actualHomeDirCount = countingVisitor2.getDirNum();
int actualPicturesDirCount = countingVisitor3.getDirNum();
assertEquals(expectedRootDirCount, actualRootDirCount);
assertEquals(expectedHomeDirCount, actualHomeDirCount);
assertEquals(expectedPicturesDirCount, actualPicturesDirCount);
System.out.println("----------------------------------------------------------------------");
System.out.println("Counting Number of Dir in a tree :");
System.out.println("----------------------------------------------------------------------");
System.out.println("On rootDir : " +actualRootDirCount);
System.out.println("On homeDir : " +actualHomeDirCount);
System.out.println("On picturesDir : " +actualPicturesDirCount);
}
@Test
public void testCountingVisitorOnFileNum() {
int expectedRootFilesCount = 6;
int expectedHomeFilesCount = 3;
int expectedPicturesFilesDirCount = 2;
countingVisitor1 = new CountingVisitor();
countingVisitor2 = new CountingVisitor();
countingVisitor3 = new CountingVisitor();
rootDir.accept(countingVisitor1);
homeDir.accept(countingVisitor2);
picturesDir.accept(countingVisitor3);
int actualRootFilesCount = countingVisitor1.getFileNum();
int actualHomeFilesCount = countingVisitor2.getFileNum();
int actualPicturesFilesCount = countingVisitor3.getFileNum();
assertEquals(expectedRootFilesCount, actualRootFilesCount);
assertEquals(expectedHomeFilesCount, actualHomeFilesCount);
assertEquals(expectedPicturesFilesDirCount, actualPicturesFilesCount);
System.out.println("----------------------------------------------------------------------");
System.out.println("Counting Number of Files in a tree :");
System.out.println("----------------------------------------------------------------------");
System.out.println("On rootDir : " +actualRootFilesCount);
System.out.println("On homeDir : " +actualHomeFilesCount);
System.out.println("On picturesDir : " +actualPicturesFilesCount);
}
@Test
public void testCountingVisitorOnLinksNum() {
int expectedRootLinksCount = 2;
int expectedHomeLinksCount = 2;
int expectedPicturesLinksCount = 1;
countingVisitor1 = new CountingVisitor();
countingVisitor2 = new CountingVisitor();
countingVisitor3 = new CountingVisitor();
rootDir.accept(countingVisitor1);
homeDir.accept(countingVisitor2);
picturesDir.accept(countingVisitor3);
int actualRootLinksCount = countingVisitor1.getLinkNum();
int actualHomeLinksCount = countingVisitor2.getLinkNum();
int actualPicturesLinksCount = countingVisitor3.getLinkNum();
assertEquals(expectedRootLinksCount, actualRootLinksCount);
assertEquals(expectedHomeLinksCount, actualHomeLinksCount);
assertEquals(expectedPicturesLinksCount, actualPicturesLinksCount);
System.out.println("----------------------------------------------------------------------");
System.out.println("Counting Number of Links in a tree :");
System.out.println("----------------------------------------------------------------------");
System.out.println("On rootDir : " +actualRootLinksCount);
System.out.println("On homeDir : " +actualHomeLinksCount);
System.out.println("On picturesDir : " +actualPicturesLinksCount);
}
@Test
public void testVirusCheckingVisitor() {
int expectedRootQuarantinedNum = 3;
int expectedHomeQuarantinedNum = 2;
int expectedPicturesQuarantinedNum = 1;
VirusCheckingVisitor virusCheckVisitor1 , virusCheckVisitor2, virusCheckVisitor3;
virusCheckVisitor1 = new VirusCheckingVisitor();
virusCheckVisitor2 = new VirusCheckingVisitor();
virusCheckVisitor3 = new VirusCheckingVisitor();
rootDir.accept(virusCheckVisitor1);
homeDir.accept(virusCheckVisitor2);
picturesDir.accept(virusCheckVisitor3);
int actualRootQuarantinedNum = virusCheckVisitor1.getQuarantinedNum();
int actualHomeQuarantinedNum = virusCheckVisitor2.getQuarantinedNum();
int actualPicturesQuarantinedNum = virusCheckVisitor3.getQuarantinedNum();
assertEquals(expectedRootQuarantinedNum, actualRootQuarantinedNum);
assertEquals(expectedHomeQuarantinedNum, actualHomeQuarantinedNum);
assertEquals(expectedPicturesQuarantinedNum, actualPicturesQuarantinedNum);
System.out.println("----------------------------------------------------------------------");
System.out.println("Checking Virus in tree :");
System.out.println("----------------------------------------------------------------------");
System.out.println("On rootDir : " +actualRootQuarantinedNum);
System.out.println("On homeDir : " +actualHomeQuarantinedNum);
System.out.println("On picturesDir : " +actualPicturesQuarantinedNum);
}
}
| [
"[email protected]"
] | |
e2dfc74b1b9aee25b616e1a40604f81fd7971119 | 30bcffad9c9b44e647c82df9c9b6c32023c0235c | /app/src/main/java/com/example/myfitnessbuddy/utils/CometChatUtil.java | d98a068be483bf711c290e86b6cde07a29f2755a | [] | no_license | Nonoka22/MyFitnessBuddy | aa1c37afc5407a285dc687fd986b7cc29fcdfd23 | 582f96945e14b579943bb878a77a58b079dcad23 | refs/heads/master | 2021-02-12T08:46:24.493398 | 2020-07-03T16:44:34 | 2020-07-03T16:44:34 | 244,578,964 | 0 | 0 | null | 2020-07-03T16:29:37 | 2020-03-03T08:16:54 | Java | UTF-8 | Java | false | false | 6,529 | java | package com.example.myfitnessbuddy.utils;
import android.content.Context;
import android.util.Log;
import com.cometchat.pro.constants.CometChatConstants;
import com.cometchat.pro.core.AppSettings;
import com.cometchat.pro.core.CometChat;
import com.cometchat.pro.core.MessagesRequest;
import com.cometchat.pro.exceptions.CometChatException;
import com.cometchat.pro.models.BaseMessage;
import com.cometchat.pro.models.CustomMessage;
import com.cometchat.pro.models.MediaMessage;
import com.cometchat.pro.models.TextMessage;
import com.cometchat.pro.models.User;
import com.example.myfitnessbuddy.BuildConfig;
import com.example.myfitnessbuddy.models.MessageWrapper;
import com.stfalcon.chatkit.commons.models.IMessage;
import com.stfalcon.chatkit.messages.MessagesListAdapter;
import java.util.ArrayList;
import java.util.List;
import timber.log.Timber;
public class CometChatUtil {
public static void initCometChat(Context context){
String appID = BuildConfig.APP_ID;
String region = Constants.REGION;
AppSettings appSettings=new AppSettings.AppSettingsBuilder().subscribePresenceForAllUsers().setRegion(region).build();
CometChat.init(context, appID, appSettings, new CometChat.CallbackListener<String>() {
@Override
public void onSuccess(String successMessage) {
Timber.i("Initialization completed successfully");
}
@Override
public void onError(CometChatException e) {
Timber.i("Initialization failed with exception: %s", e.getMessage());
}
});
}
public static void createCometChatUser(String userId,String username){
String authKey = BuildConfig.AUTH_KEY;
User user = new User();
user.setUid(userId);
user.setName(username);
CometChat.createUser(user, authKey, new CometChat.CallbackListener<User>() {
@Override
public void onSuccess(User user) {
Log.i("Noemi","createUser"+ user.toString());
//login CometChatUser
loginCometChatUser(userId);
}
@Override
public void onError(CometChatException e) {
Log.i("Noemi","createUser fail :"+ e.getMessage());
}
});
}
public static void loginCometChatUser(String UID){
String authKey = BuildConfig.AUTH_KEY;
if (CometChat.getLoggedInUser() == null) {
CometChat.login(UID, authKey, new CometChat.CallbackListener<User>() {
@Override
public void onSuccess(User user) {
Log.i("Noemi", "Login Successful : " + user.toString());
}
@Override
public void onError(CometChatException e) {
Log.i("Noemi", "Login failed with exception: " + e.getMessage());
}
});
}
else {
// User already logged in
Log.i("Noemi", "User is already logged in");
}
}
public static void logoutCometChat(){
CometChat.logout(new CometChat.CallbackListener<String>() {
@Override
public void onSuccess(String successMessage) {
Log.i("Noemi", "Logout completed successfully");
}
@Override
public void onError(CometChatException e) {
Log.i("Noemi", "Logout failed with exception: " + e.getMessage());
}
});
}
public static void sendCometChatMessage(String receiverID, String messageText, MessagesListAdapter<MessageWrapper> adapter){
String receiverType = CometChatConstants.RECEIVER_TYPE_USER;
TextMessage textMessage = new TextMessage(receiverID, messageText, receiverType);
CometChat.sendMessage(textMessage, new CometChat.CallbackListener <TextMessage> () {
@Override
public void onSuccess(TextMessage textMessage) {
Log.i("Noemi", "Message sent successfully: " + textMessage.toString());
addCometChatMessage(textMessage,adapter);
}
@Override
public void onError(CometChatException e) {
Log.i("Noemi", "Message sending failed with exception: " + e.getMessage());
}
});
}
public static void listenerForRealTimeMessages(MessagesListAdapter<MessageWrapper> adapter){
String listenerID = "CHAT_ACTIVITY";
CometChat.addMessageListener(listenerID, new CometChat.MessageListener() {
@Override
public void onTextMessageReceived(TextMessage textMessage) {
Log.i("Noemi", "Text message received successfully: " + textMessage.toString());
addCometChatMessage(textMessage,adapter);
}
@Override
public void onMediaMessageReceived(MediaMessage mediaMessage) {
Log.i("Noemi", "Media message received successfully: " + mediaMessage.toString());
}
@Override
public void onCustomMessageReceived(CustomMessage customMessage) {
Log.i("Noemi", "Custom message received successfully: " +customMessage.toString());
}
});
}
public static void removeCometChatMessageListener(){
String listenerID = "CHAT_ACTIVITY";
CometChat.removeMessageListener(listenerID);
}
private static void addCometChatMessage(TextMessage textMessage, MessagesListAdapter<MessageWrapper> adapter){
adapter.addToStart(new MessageWrapper(textMessage),true);
}
public static void fetchMissedMessages(String UID,MessagesListAdapter<MessageWrapper> adapter){
MessagesRequest messagesRequest = new MessagesRequest.MessagesRequestBuilder().setUID(UID).build();
messagesRequest.fetchPrevious(new CometChat.CallbackListener<List<BaseMessage>>() {
@Override
public void onSuccess(List <BaseMessage> list) {
for (BaseMessage message: list) {
if (message instanceof TextMessage) {
addCometChatMessage((TextMessage) message , adapter);
} else if (message instanceof MediaMessage) {}
}
}
@Override
public void onError(CometChatException e) {
Log.i("Noemi", "Message fetching failed with exception: " + e.getMessage());
}
});
}
}
| [
"[email protected]"
] | |
45f2188ad42340c2d2a8ddb79d69190c1dbf45cb | 07d3ee1e5e1db281bf3fb054118eccddbe42d248 | /stagemonitor-tracing-elasticsearch/src/main/java/org/stagemonitor/tracing/elasticsearch/ElasticsearchTracingPlugin.java | 296669d04365fec71080385dc29df558beb09e5c | [
"Apache-2.0",
"BSD-3-Clause",
"MIT"
] | permissive | Halliburton-Landmark/stagemonitor | c307ec3cda3926dd520fa6f3f14f7fc863b28113 | 95d793502763de82a9aaf0159ff11f05a1feeb0d | refs/heads/master | 2021-01-22T06:12:06.975257 | 2017-05-26T15:04:10 | 2017-05-26T15:04:10 | 92,530,226 | 0 | 1 | null | 2017-05-26T16:43:59 | 2017-05-26T16:43:59 | null | UTF-8 | Java | false | false | 3,447 | java | package org.stagemonitor.tracing.elasticsearch;
import org.stagemonitor.configuration.ConfigurationOption;
import org.stagemonitor.core.CorePlugin;
import org.stagemonitor.core.StagemonitorPlugin;
import org.stagemonitor.core.elasticsearch.ElasticsearchClient;
public class ElasticsearchTracingPlugin extends StagemonitorPlugin {
public static final String ELASTICSEARCH_TRACING_PLUGIN = "Elasticsearch trace storage plugin";
private final ConfigurationOption<Boolean> onlyLogElasticsearchSpanReports = ConfigurationOption.booleanOption()
.key("stagemonitor.requestmonitor.elasticsearch.onlyLogElasticsearchRequestTraceReports")
.dynamic(true)
.label("Only log Elasticsearch request trace reports")
.description(String.format("If set to true, the spans won't be reported to elasticsearch but instead logged in bulk format. " +
"The name of the logger is %s. That way you can redirect the reporting to a separate log file and use logstash or a " +
"different external process to send the spans to elasticsearch.", ElasticsearchSpanReporter.ES_SPAN_LOGGER))
.tags("reporting")
.configurationCategory(ELASTICSEARCH_TRACING_PLUGIN)
.buildWithDefault(false);
/* Storage */
private final ConfigurationOption<String> spanIndexTemplate = ConfigurationOption.stringOption()
.key("stagemonitor.requestmonitor.elasticsearch.spanIndexTemplate")
.dynamic(false)
.label("ES Request Span Template")
.description("The classpath location of the index template that is used for the stagemonitor-spans-* indices. " +
"By specifying the location to your own template, you can fully customize the index template.")
.configurationCategory(ELASTICSEARCH_TRACING_PLUGIN)
.tags("elasticsearch")
.buildWithDefault("stagemonitor-elasticsearch-span-index-template.json");
private final ConfigurationOption<Integer> deleteSpansAfterDays = ConfigurationOption.integerOption()
.key("stagemonitor.requestmonitor.deleteRequestTracesAfterDays")
.dynamic(true)
.label("Delete spans after (days)")
.description("When set, spans will be deleted automatically after the specified days. " +
"Set to a negative value to never delete spans.")
.configurationCategory(ELASTICSEARCH_TRACING_PLUGIN)
.buildWithDefault(7);
@Override
public void initializePlugin(InitArguments initArguments) throws Exception {
final CorePlugin corePlugin = initArguments.getPlugin(CorePlugin.class);
final ElasticsearchClient elasticsearchClient = corePlugin.getElasticsearchClient();
final String spanMappingJson = ElasticsearchClient.modifyIndexTemplate(
spanIndexTemplate.getValue(), corePlugin.getMoveToColdNodesAfterDays(), corePlugin.getNumberOfReplicas(), corePlugin.getNumberOfShards());
elasticsearchClient.sendMappingTemplateAsync(spanMappingJson, "stagemonitor-spans");
if (!corePlugin.getElasticsearchUrls().isEmpty()) {
elasticsearchClient.sendClassPathRessourceBulkAsync("kibana/stagemonitor-spans-kibana-index-pattern.bulk");
elasticsearchClient.sendClassPathRessourceBulkAsync("kibana/Request-Analysis.bulk");
elasticsearchClient.sendClassPathRessourceBulkAsync("kibana/Web-Analytics.bulk");
elasticsearchClient.scheduleIndexManagement("stagemonitor-external-requests-",
corePlugin.getMoveToColdNodesAfterDays(), deleteSpansAfterDays.getValue());
}
}
public boolean isOnlyLogElasticsearchSpanReports() {
return onlyLogElasticsearchSpanReports.getValue();
}
}
| [
"[email protected]"
] | |
e22789f02903a24dfe65a8a69cd3ee2ccd0eb7eb | 585403956837456778b9da4a8bd88af082ca70d9 | /devbeginner-news-facebook/src/test/java/com/jojoldu/devbeginnernews/facebook/FacebookTokenExchangerRealTest.java | c534959c55e2435a24cc50a079a51cd0b304e375 | [] | no_license | rheehot/devbeginner-news | 827c31d19c6a810ea7f9e75be269f0b06d535323 | d228bece0a9b6d0b771b14548103d27f1cc0d435 | refs/heads/master | 2022-03-27T16:59:50.954082 | 2020-01-01T23:13:44 | 2020-01-01T23:13:44 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,387 | java | package com.jojoldu.devbeginnernews.facebook;
import com.jojoldu.devbeginnernews.core.token.FacebookUserTokenRepository;
import com.jojoldu.devbeginnernews.facebook.service.FacebookTokenExchanger;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.client.HttpClientErrorException;
import static com.jojoldu.devbeginnernews.core.token.FacebookUserToken.DEFAULT_USER;
/**
* Created by [email protected] on 08/11/2019
* Blog : http://jojoldu.tistory.com
* Github : http://github.com/jojoldu
*/
@RunWith(SpringRunner.class)
@SpringBootTest
public class FacebookTokenExchangerRealTest {
@Autowired
private FacebookUserTokenRepository facebookUserTokenRepository;
@Autowired
private FacebookTokenExchanger facebookTokenExchanger;
@After
public void tearDown() throws Exception {
facebookUserTokenRepository.deleteAll();
}
@Test(expected = HttpClientErrorException.class)
public void 토큰이잘못되면_HttpClientErrorException이_반환된다() {
//given
String userToken = "a";
//when
facebookTokenExchanger.exchangeAll(DEFAULT_USER, userToken);
}
}
| [
"[email protected]"
] | |
3f00ba40e6d1223894a6a27fd378b09faea80d62 | 180e78725121de49801e34de358c32cf7148b0a2 | /dataset/protocol1/kylin/testing/937/UserService.java | 85c6c5148189bee09a6467e5faafe413b5f9cd13 | [] | no_license | ASSERT-KTH/synthetic-checkstyle-error-dataset | 40e8d1e0a7ebe7f7711def96a390891a6922f7bd | 40c057e1669584bfc6fecf789b5b2854660222f3 | refs/heads/master | 2023-03-18T12:50:55.410343 | 2019-01-25T09:54:39 | 2019-01-25T09:54:39 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,613 | 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.kylin.rest.service;
import java.io.IOException;
import java.util.List;
import org.apache.kylin.rest.security.ManagedUser;
import org.springframework.security.provisioning.UserDetailsManager;
public interface UserService extends UserDetailsManager {
boolean isEvictCacheFlag();
void setEvictCacheFlag(boolean evictCacheFlag);
List<ManagedUser> listUsers() throws IOException;
List<String> listAdminUsers() throws IOException;
//For performance consideration, list all users may be incomplete(eg. not load user's authorities until authorities has benn used).
//So it's an extension point that can complete user's information latter.
//loadUserByUsername() has guarantee that the return user is complete.
void completeUserInfo(ManagedUser user);
}
| [
"[email protected]"
] | |
c274066367b0c475fb2089ab7424d0870572c272 | e49213f91a2d4e6e89c49fdae5dd0239c03b9240 | /src/main/java/com/mynegocio/app/service/InvalidPasswordException.java | 991bf7442108ef8e8c401d02f0762be0af273c5b | [] | no_license | efacu/hjisterapp | 576faaeffdb706c407fe90a0eb8e5de0baa559b4 | 7401cd995f61ea19cc55dfeff4c40d703b00b78a | refs/heads/master | 2022-12-24T02:25:34.631939 | 2019-09-19T19:16:44 | 2019-09-19T19:16:44 | 209,631,139 | 0 | 0 | null | 2022-12-16T05:05:41 | 2019-09-19T19:16:28 | Java | UTF-8 | Java | false | false | 188 | java | package com.mynegocio.app.service;
public class InvalidPasswordException extends RuntimeException {
public InvalidPasswordException() {
super("Incorrect password");
}
}
| [
"[email protected]"
] | |
1bf2bc6d09536561170ab8666821164e5c182550 | 5b4c86c8297f350ecba93ac89a327cde4da5bd80 | /Ejercicio 14/src/ejercicio/pkg14/Ejercicio14.java | 62d246e3c187965cd2f0d1b83a46ccb9cff418b2 | [] | no_license | AdanReLo34/ReLoAd_Programaci-nAvanzada-Gate | 797d07c90d82cc04e5d0b7ec7837091c08e4cd90 | da1b1d9b613efb41dd084b38893ef8c2b74ded70 | refs/heads/master | 2022-07-31T03:15:40.717202 | 2020-05-21T19:48:48 | 2020-05-21T19:48:48 | 265,935,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 579 | java | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ejercicio.pkg14;
import javax.swing.JFrame;
public class Ejercicio14 {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
Teclas teclas = new Teclas();
teclas.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
teclas.setSize( 350, 200 );
teclas.setVisible( true );
}
}
| [
"[email protected]"
] | |
e94ee3136c1b89d0a3f03ca043970a851bcdfa2d | 78663f79712c4db4b77c5bdaf6f246c0948cd498 | /app/src/main/java/com/codedwar/edwar/mascotas/MainActivity.java | 23bf6a0675534462311f771960f26142729c2f46 | [] | no_license | edwarsare/MascotasActualizado | 1ebd46bb909e69cb3f7a29a504bd9ff0d546cb8b | a576dc3adfd5611762bc91c0824e301a94c6bd1c | refs/heads/master | 2021-06-01T22:01:29.663492 | 2016-09-14T04:03:52 | 2016-09-14T04:03:52 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,617 | java | package com.codedwar.edwar.mascotas;
import android.content.Intent;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import com.codedwar.edwar.mascotas.Adapter.PageAdapter;
import com.codedwar.edwar.mascotas.Fragments.DetalleFragment;
import com.codedwar.edwar.mascotas.Fragments.MascotasFragment;
import java.util.ArrayList;
public class MainActivity extends AppCompatActivity {
private Toolbar toolbar;
private TabLayout tabLayout;
private ViewPager viewPager;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
toolbar = (Toolbar)findViewById(R.id.appBar);
tabLayout = (TabLayout) findViewById(R.id.tabLayout);
viewPager = (ViewPager) findViewById(R.id.viewPager);
if(toolbar != null) {
setSupportActionBar(toolbar);
}
setUpViewPager();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main,menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch(item.getItemId()){
case R.id.mContacto:
Intent intent = new Intent(this,Contactos.class);
startActivity(intent);
break;
case R.id.mAcercaDe:
Intent intent2 = new Intent(this,AcercaDe.class);
startActivity(intent2);
break;
case R.id.avFavoritos:
Intent intent3 = new Intent(this,MascotasFavoritas.class);
startActivity(intent3);
break;
}
return super.onOptionsItemSelected(item);
}
public ArrayList<Fragment> agregarFragments(){
ArrayList<Fragment> lista = new ArrayList<>();
lista.add(new MascotasFragment());
lista.add(new DetalleFragment());
return lista;
}
public void setUpViewPager(){
viewPager.setAdapter(new PageAdapter(getSupportFragmentManager(),agregarFragments()));
tabLayout.setupWithViewPager(viewPager);
tabLayout.getTabAt(0).setIcon(R.drawable.ic_action_house);
tabLayout.getTabAt(1).setIcon(R.drawable.ic_action_dog);
}
}
| [
"[email protected]"
] | |
05e92efbfd38ab605b25a285ee6a0801dcb1e9ea | d602ee56d416f750fb034f11e790a87e217ee673 | /Mockito/src/main/java/mockito/velosidad/Carretera.java | a1db1a594f97be7c1375f4ec01d47136c0bb384a | [] | no_license | AgustinArielGalarza/PracticasBP4 | 4b99738683de2d296683211789b2274e2e13eb7b | 09a1c6baa9140894a6734e5353edcf0d768cf4d9 | refs/heads/master | 2022-12-28T00:57:07.833502 | 2020-10-02T13:43:15 | 2020-10-02T13:43:15 | 300,015,941 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 390 | java | package mockito.velosidad;
public class Carretera {
private VerificaLimites verificaLimites;
public boolean check;
public Carretera(VerificaLimites verificaLimites){
this.verificaLimites = verificaLimites;
this.check = false;
}
public boolean manejar(Velosidades vel){
check = verificaLimites.deVelosidad(vel);
return check;
}
}
| [
"[email protected]"
] | |
335870a7553254dfb21923dc13848948012f9878 | ddf98b8111ace2ffad45ecb6fc40c264686328f0 | /TeliverCustomerMedical/app/build/generated/source/r/debug/com/google/android/gms/R.java | 4a0406f477037c9ab7b33f089105c69b5751d714 | [] | no_license | teliver/teliver-medical-delivery-android | c26f299855bd4964aa741cf0d8161864f204c11c | ca3392e754b7a722d1c25bf1b68e0c851f346f48 | refs/heads/master | 2020-04-23T23:09:04.639082 | 2017-08-05T13:57:30 | 2017-08-05T13:57:30 | 98,511,838 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,167 | java | /* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* gradle plugin from the resource data it found. It
* should not be modified by hand.
*/
package com.google.android.gms;
public final class R {
public static final class attr {
public static final int ambientEnabled = 0x7f010126;
public static final int buttonSize = 0x7f010150;
public static final int cameraBearing = 0x7f010117;
public static final int cameraMaxZoomPreference = 0x7f010128;
public static final int cameraMinZoomPreference = 0x7f010127;
public static final int cameraTargetLat = 0x7f010118;
public static final int cameraTargetLng = 0x7f010119;
public static final int cameraTilt = 0x7f01011a;
public static final int cameraZoom = 0x7f01011b;
public static final int circleCrop = 0x7f010115;
public static final int colorScheme = 0x7f010151;
public static final int imageAspectRatio = 0x7f010114;
public static final int imageAspectRatioAdjust = 0x7f010113;
public static final int latLngBoundsNorthEastLatitude = 0x7f01012b;
public static final int latLngBoundsNorthEastLongitude = 0x7f01012c;
public static final int latLngBoundsSouthWestLatitude = 0x7f010129;
public static final int latLngBoundsSouthWestLongitude = 0x7f01012a;
public static final int liteMode = 0x7f01011c;
public static final int mapType = 0x7f010116;
public static final int scopeUris = 0x7f010152;
public static final int uiCompass = 0x7f01011d;
public static final int uiMapToolbar = 0x7f010125;
public static final int uiRotateGestures = 0x7f01011e;
public static final int uiScrollGestures = 0x7f01011f;
public static final int uiTiltGestures = 0x7f010120;
public static final int uiZoomControls = 0x7f010121;
public static final int uiZoomGestures = 0x7f010122;
public static final int useViewLifecycle = 0x7f010123;
public static final int zOrderOnTop = 0x7f010124;
}
public static final class color {
public static final int common_google_signin_btn_text_dark = 0x7f0c006f;
public static final int common_google_signin_btn_text_dark_default = 0x7f0c001f;
public static final int common_google_signin_btn_text_dark_disabled = 0x7f0c0020;
public static final int common_google_signin_btn_text_dark_focused = 0x7f0c0021;
public static final int common_google_signin_btn_text_dark_pressed = 0x7f0c0022;
public static final int common_google_signin_btn_text_light = 0x7f0c0070;
public static final int common_google_signin_btn_text_light_default = 0x7f0c0023;
public static final int common_google_signin_btn_text_light_disabled = 0x7f0c0024;
public static final int common_google_signin_btn_text_light_focused = 0x7f0c0025;
public static final int common_google_signin_btn_text_light_pressed = 0x7f0c0026;
public static final int common_google_signin_btn_tint = 0x7f0c0071;
}
public static final class drawable {
public static final int common_full_open_on_phone = 0x7f020055;
public static final int common_google_signin_btn_icon_dark = 0x7f020056;
public static final int common_google_signin_btn_icon_dark_focused = 0x7f020057;
public static final int common_google_signin_btn_icon_dark_normal = 0x7f020058;
public static final int common_google_signin_btn_icon_dark_normal_background = 0x7f020059;
public static final int common_google_signin_btn_icon_disabled = 0x7f02005a;
public static final int common_google_signin_btn_icon_light = 0x7f02005b;
public static final int common_google_signin_btn_icon_light_focused = 0x7f02005c;
public static final int common_google_signin_btn_icon_light_normal = 0x7f02005d;
public static final int common_google_signin_btn_icon_light_normal_background = 0x7f02005e;
public static final int common_google_signin_btn_text_dark = 0x7f02005f;
public static final int common_google_signin_btn_text_dark_focused = 0x7f020060;
public static final int common_google_signin_btn_text_dark_normal = 0x7f020061;
public static final int common_google_signin_btn_text_dark_normal_background = 0x7f020062;
public static final int common_google_signin_btn_text_disabled = 0x7f020063;
public static final int common_google_signin_btn_text_light = 0x7f020064;
public static final int common_google_signin_btn_text_light_focused = 0x7f020065;
public static final int common_google_signin_btn_text_light_normal = 0x7f020066;
public static final int common_google_signin_btn_text_light_normal_background = 0x7f020067;
public static final int googleg_disabled_color_18 = 0x7f02006e;
public static final int googleg_standard_color_18 = 0x7f02006f;
}
public static final class id {
public static final int adjust_height = 0x7f0d0041;
public static final int adjust_width = 0x7f0d0042;
public static final int auto = 0x7f0d002d;
public static final int center = 0x7f0d002f;
public static final int dark = 0x7f0d004e;
public static final int hybrid = 0x7f0d0043;
public static final int icon_only = 0x7f0d004b;
public static final int light = 0x7f0d004f;
public static final int none = 0x7f0d0017;
public static final int normal = 0x7f0d0019;
public static final int radio = 0x7f0d006e;
public static final int satellite = 0x7f0d0044;
public static final int standard = 0x7f0d004c;
public static final int terrain = 0x7f0d0045;
public static final int text = 0x7f0d00b0;
public static final int text2 = 0x7f0d00ae;
public static final int toolbar = 0x7f0d0099;
public static final int wide = 0x7f0d004d;
public static final int wrap_content = 0x7f0d002c;
}
public static final class integer {
public static final int google_play_services_version = 0x7f0b0006;
}
public static final class string {
public static final int common_google_play_services_enable_button = 0x7f070013;
public static final int common_google_play_services_enable_text = 0x7f070014;
public static final int common_google_play_services_enable_title = 0x7f070015;
public static final int common_google_play_services_install_button = 0x7f070016;
public static final int common_google_play_services_install_text = 0x7f070017;
public static final int common_google_play_services_install_title = 0x7f070018;
public static final int common_google_play_services_notification_ticker = 0x7f070019;
public static final int common_google_play_services_unknown_issue = 0x7f07001a;
public static final int common_google_play_services_unsupported_text = 0x7f07001b;
public static final int common_google_play_services_update_button = 0x7f07001c;
public static final int common_google_play_services_update_text = 0x7f07001d;
public static final int common_google_play_services_update_title = 0x7f07001e;
public static final int common_google_play_services_updating_text = 0x7f07001f;
public static final int common_google_play_services_wear_update_text = 0x7f070020;
public static final int common_open_on_phone = 0x7f070021;
public static final int common_signin_button_text = 0x7f070022;
public static final int common_signin_button_text_long = 0x7f070023;
public static final int fcm_fallback_notification_channel_label = 0x7f070037;
}
public static final class styleable {
public static final int[] LoadingImageView = { 0x7f010113, 0x7f010114, 0x7f010115 };
public static final int LoadingImageView_circleCrop = 2;
public static final int LoadingImageView_imageAspectRatio = 1;
public static final int LoadingImageView_imageAspectRatioAdjust = 0;
public static final int[] MapAttrs = { 0x7f010116, 0x7f010117, 0x7f010118, 0x7f010119, 0x7f01011a, 0x7f01011b, 0x7f01011c, 0x7f01011d, 0x7f01011e, 0x7f01011f, 0x7f010120, 0x7f010121, 0x7f010122, 0x7f010123, 0x7f010124, 0x7f010125, 0x7f010126, 0x7f010127, 0x7f010128, 0x7f010129, 0x7f01012a, 0x7f01012b, 0x7f01012c };
public static final int MapAttrs_ambientEnabled = 16;
public static final int MapAttrs_cameraBearing = 1;
public static final int MapAttrs_cameraMaxZoomPreference = 18;
public static final int MapAttrs_cameraMinZoomPreference = 17;
public static final int MapAttrs_cameraTargetLat = 2;
public static final int MapAttrs_cameraTargetLng = 3;
public static final int MapAttrs_cameraTilt = 4;
public static final int MapAttrs_cameraZoom = 5;
public static final int MapAttrs_latLngBoundsNorthEastLatitude = 21;
public static final int MapAttrs_latLngBoundsNorthEastLongitude = 22;
public static final int MapAttrs_latLngBoundsSouthWestLatitude = 19;
public static final int MapAttrs_latLngBoundsSouthWestLongitude = 20;
public static final int MapAttrs_liteMode = 6;
public static final int MapAttrs_mapType = 0;
public static final int MapAttrs_uiCompass = 7;
public static final int MapAttrs_uiMapToolbar = 15;
public static final int MapAttrs_uiRotateGestures = 8;
public static final int MapAttrs_uiScrollGestures = 9;
public static final int MapAttrs_uiTiltGestures = 10;
public static final int MapAttrs_uiZoomControls = 11;
public static final int MapAttrs_uiZoomGestures = 12;
public static final int MapAttrs_useViewLifecycle = 13;
public static final int MapAttrs_zOrderOnTop = 14;
public static final int[] SignInButton = { 0x7f010150, 0x7f010151, 0x7f010152 };
public static final int SignInButton_buttonSize = 0;
public static final int SignInButton_colorScheme = 1;
public static final int SignInButton_scopeUris = 2;
}
}
| [
"[email protected]"
] | |
eafce87e5d330728df1385776c836fcfa7b0a417 | bbaea60ac13f36292cb8d89244bab6c61c1a57f7 | /src/graph/ShortestPathUnweightedGraph.java | 6138c1ee29312a27c45242aa78cb020585dd9b70 | [] | no_license | niteshadj/DataStructure | 22ebac889d137b2e7dc0f7ef61bce669c573d657 | 4fa37577abefc71b43f32ded08fe8342d48b0727 | refs/heads/master | 2023-07-13T20:17:00.494600 | 2021-08-27T02:51:36 | 2021-08-27T02:51:36 | 282,468,328 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,227 | java | package graph;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Queue;
public class ShortestPathUnweightedGraph {
public static void main(String[] args) {
ArrayList<ArrayList<Integer>> graph = new ArrayList<ArrayList<Integer>>();
graph.add(new ArrayList(Arrays.asList(1, 2, 4)));
graph.add(new ArrayList(Arrays.asList(0, 3)));
graph.add(new ArrayList(Arrays.asList(0, 3, 4)));
graph.add(new ArrayList(Arrays.asList(1, 2, 5)));
graph.add(new ArrayList(Arrays.asList(0, 2, 5)));
graph.add(new ArrayList(Arrays.asList(3, 4)));
BFS(graph, 0, 6);
}
public static void BFS(ArrayList<ArrayList<Integer>> graph, int source, int v) {
boolean[] visited = new boolean[v];
Queue<Integer> queue = new ArrayDeque<>();
queue.add(source);
visited[0] = true;
int count = 0;
int size = 1;
while (!queue.isEmpty()) {
if (size == 0) {
count++;
size = queue.size();
}
int u = queue.poll();
size--;
System.out.println(count);
for (int i = 0; i < graph.get(u).size(); i++) {
if (!visited[graph.get(u).get(i)]) {
queue.add(graph.get(u).get(i));
visited[graph.get(u).get(i)] = true;
}
}
}
// return res;
}
}
| [
"[email protected]"
] | |
1d7c022ef0a11e82cbc4cea3e5eef1a0b41e6a88 | 5d4abdc348e628331480da95fdbc659ebb7f170c | /J13_Hybernate/src/beans/Transaction.java | 4f336838105aa029833ac740d4df8fa8824aa69c | [] | no_license | Louis-Saglio/TP-Java | 13575c440b39cc91352d30ff2ec52c6a3cc3737a | e20172928aff85092fbe2b01563b1cb4cd80daba | refs/heads/master | 2020-12-30T14:44:14.707809 | 2017-12-01T07:41:19 | 2017-12-01T07:41:19 | 91,075,874 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 574 | java | package beans;
public class Transaction {
private Client client;
private Produit produit;
private int qtt;
private String date;
public Transaction(Client client, Produit produit, int qtt, String date) {
this.client = client;
this.produit = produit;
this.qtt = qtt;
this.date = date;
this.client.addTransaction(this);
this.produit.addTransaction(this);
}
public Client getClient() {
return client;
}
public Produit getProduit() {
return produit;
}
public int getQtt() {
return qtt;
}
public String getDate() {
return date;
}
}
| [
"[email protected]"
] | |
fd4899afdc214c80c9dfef8c1ee9197f644b7301 | 1abc346a663c11718ed37e9cdb7005a6cb8e487b | /src/main/java/com/banshion/portal/web/sys/dao/UserInfoMapper.java | 7ce85f09274401e9d8d35bfc0970ba539c2f8058 | [] | no_license | zhangrw/portal | 6bed670dfbe1fb61c22dea53be0e6e8b72548d74 | 90769e20cc298278c0f04ce5ec7dbe952e6e11ae | refs/heads/master | 2021-01-20T19:59:40.330188 | 2017-06-16T03:17:55 | 2017-06-16T03:17:55 | 64,605,961 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 974 | java | package com.banshion.portal.web.sys.dao;
import com.banshion.portal.util.intf.MyBatisRepository;
import com.banshion.portal.web.sys.domain.UserInfoExample;
import com.banshion.portal.web.sys.domain.UserInfo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@MyBatisRepository
public interface UserInfoMapper {
int countByExample(UserInfoExample example);
int deleteByExample(UserInfoExample example);
int deleteByPrimaryKey(Integer id);
int insert(UserInfo record);
int insertSelective(UserInfo record);
List<UserInfo> selectByExample(UserInfoExample example);
UserInfo selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") UserInfo record, @Param("example") UserInfoExample example);
int updateByExample(@Param("record") UserInfo record, @Param("example") UserInfoExample example);
int updateByPrimaryKeySelective(UserInfo record);
int updateByPrimaryKey(UserInfo record);
} | [
"[email protected]"
] | |
ebd7b52bf237da60b7014ef0ee71891a49978b1f | 0c604bfab4b0d1ca179aaf1d49056689ce774b94 | /GAPSO/src/GAPSO.java | b038e9221750e340224bdce94ebc1ddd55d61301 | [] | no_license | daolei/GA-PSO | d1b9f249c899ab78d64d7593d7ac48eb7b84fbc9 | c463835716de5b74d1a8a40d7c462e6ea35841ad | refs/heads/master | 2020-06-14T17:42:24.204612 | 2016-01-22T13:37:42 | 2016-01-22T13:37:42 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,175 | java | /*
*********************************************
* Benetatou Persefoni *
* Athens 2014 *
* *
* Exercise for Artificial Intelligence *
* University of Piraeus *
*********************************************
*/
/*
* GAPSO: Defines the hybrid algorithm Generic Algorithm - Particle Swarm Optimization
*
* Methods:
* - Selection(): defines the selection operator.
* - Crossover(): defines the crossover operator.
* - Mutate(): defines the mutation operator.
* - Execute(): executes previous methods is one iteration.
*/
import java.util.*;
public class GAPSO
{
// Particle population.
private Particle[] population;
// Constants of the algorithm.
private final double w = 0.8;
private final double c1 = 1.5;
private final double c2 = 1.5;
private final double f1 = randValue();
private final double f2 = randValue();
private final double crossoverProbability = 0.7;
private final double mutationProbability = 0.1;
/*
* Constructor.
*/
public GAPSO()
{
// Set the size of particles population.
this.population = new Particle[ Settings.getSizeOfPopulation() ];
// Loop through the population and create random particles (randomFlag = true).
for (int i = 0; i < this.population.length; i++)
{
this.population[i] = new Particle(true);
}
}
/*
* Return a random value between (0, 1).
*/
private static double randValue()
{
double value;
// Get random value between [0, 1).
value = Math.random();
// While value equals 0.0, get a new random value between [0, 1).
while (value == 0.0)
{
value = Math.random();
}
return value;
}
/*
* Selection operator:
* Calculate selection and accumulated probability of every
* particle of the population, and then create a new population
* according to those probabilities.
*/
private void selection()
{
/*
* Calculate total value of every particle's path fitness function.
*/
double totalValue = 0.0;
// Loop through every particle of the population.
for (Particle p : this.population)
{
totalValue += p.getPath().fitnessFunction();
}
/*
* Calculate selection probability of every particle.
*/
// Loop through every particle of the population.
for (Particle p : this.population)
{
// Selection probability of a particle =
// its path fitness function / total value of every
// particle's path fitness function.
double selectionProbability = p.getPath().fitnessFunction() / totalValue;
// Set selection probability of each particle.
p.setSelectionProb(selectionProbability);
}
/*
* Calculate accumulated probability of each particle.
*/
// Calculate and set cumulative probability of the first (0) particle of the population.
double probability = this.population[0].getSelectionProb();
this.population[0].setCumulativeProb(probability);
// Loop through every particle of the population, except the first one.
for (int i = 1; i < this.population.length; i++)
{
// Calculate and set cumulative probability of each particle.
probability += this.population[i].getSelectionProb();
this.population[i].setCumulativeProb(probability);
}
/*
* Create new population.
*/
// Create new population of particles with the same population size.
Particle[] newPopulation = new Particle[Settings.getSizeOfPopulation()];
// Loop through the OLD particle population.
for (int i = 0; i < this.population.length; i++)
{
// New random number between (0, 1).
double rand = randValue();
// Create new null particle.
Particle newParticle = null;
// If the random number is less or equal to
// the OLD populations cumulative probability
// of the first (0) particle.
if (rand <= this.population[0].getCumulativeProb())
{
// then the new particle becomes equal
// to the first (0) particle of the OLD population.
newParticle = this.population[0];
}
else
{
// Else loop through every particle j of the population, except the first one.
for (int j = 1; j < this.population.length; j++)
{
// rand number is between the cumulative probabilities of particles
// j - 1 and j, then the new particle becomes equal
// to the particle j of the OLD population.
if (this.population[j - 1].getCumulativeProb() < rand &&
rand <= this.population[j].getCumulativeProb())
{
newParticle = this.population[j];
}
}
}
// Clone the new Particle.
Particle newselectedParticle = newParticle.clone();
// Add the particle into the new population.
newPopulation[i] = newselectedParticle;
}
// Set OLD population equal to the new one.
this.population = newPopulation;
}
/*
* Return the position of population's best particle,
* meaning the particle with the biggest fitness function.
*
* If all population positions are null -1 is returned.
*/
private int particleBestPosition()
{
// Initialize position.
int position = -1;
// Initialize maximum fitness function value.
double maxFitness = 0;
// Loop through every particle of the population.
for (int i = 0; i < this.population.length; i++)
{
// If the particle is not null AND its fitness function is greater that the maximum.
if (this.population[i] != null && this.population[i].getPath().fitnessFunction() > maxFitness)
{
// Set new maximum value.
maxFitness = this.population[i].getPath().fitnessFunction();
// Set new position.
position = i;
}
}
// Return the position.
return position;
}
/*
* Return an ArrayList with all nodes that two particles
* have in common.
*/
private ArrayList<Node> getCrossoverNodes(Particle p1, Particle p2)
{
// Initialize nodes' ArrayList.
ArrayList<Node> crossoverNodes = new ArrayList<>();
// Loop through every node of the first particle's Path.
for (Node node : p1.getPath().getPath())
{
// If the node exists in the second particle's Path too.
if (p2.getPath().getPath().contains(node))
{
// Add the node into the ArrayList.
crossoverNodes.add(node);
}
}
// Delete the first and last node of the ArrayList,
// because they are node number 0 and node number 99,
// which exist in every particle.
crossoverNodes.remove(0);
crossoverNodes.remove(crossoverNodes.size() - 1);
// Return ArrayList of the nodes.
return crossoverNodes;
}
/*
* Create two new offsprings (paths) from two particles.
*
* The offsprings will be created according to
* a random crossover node of the two particles.
*/
private void crossoverOffsprings(Particle p1, Particle p2)
{
// Random number generator.
Random rand = new Random();
// Create an ArrayList with all common nodes of particle p1 and p2 paths.
ArrayList<Node> crossoverNodes = this.getCrossoverNodes(p1,p2);
// Initialize new offspring paths.
Path firstOffspring = new Path();
Path secondOffspring = new Path();
// While the ArrayList with the common nodes is not empty.
while (!crossoverNodes.isEmpty())
{
// Get a random node from the crossoverNodes ArrayList.
Node crossNode = crossoverNodes.get(rand.nextInt(crossoverNodes.size()));
// Get the position of the common node in both p1 and p2.
int pos1 = p1.getPath().getNodePosition(crossNode);
int pos2 = p2.getPath().getNodePosition(crossNode);
/*
* Creation of the two possible offsprings.
*/
// Initialize a node ArrayList for the first possible offspring.
ArrayList<Node> firstOffspringNodeList = new ArrayList<>();
// Loop through all nodes of the path of particle p1,
// from position 0 to position pos1 (position of common node in p1),
// and add them to the node ArrayList of the first offspring.
for (int i = 0; i <= pos1; i++)
{
firstOffspringNodeList.add(p1.getPath().getNode(i));
}
// Loop through all nodes of the path of particle p2,
// from position pos2 (position of common node in p2) to the last position,
// and add them to the node ArrayList of the first offspring.
for (int i = pos2+1; i < p2.getPath().getSize(); i++)
{
firstOffspringNodeList.add(p2.getPath().getNode(i));
}
// Create first offspring from the node ArrayList.
firstOffspring.setPath(firstOffspringNodeList);
// If the first offspring that was created has double nodes in it.
if (firstOffspring.hasDoubleNodes())
{
// The node that was randomly selected from the
// common node list of the two particles
// is now removed and the process of the creation
// of the offsprings starts from the beginning.
// (while loop starts over)
crossoverNodes.remove(crossNode);
continue;
}
// Initialize a node ArrayList for the second possible offspring.
ArrayList<Node> secondOffspringNodeList = new ArrayList<>();
// Loop through all nodes of the path of particle p2,
// from position 0 to position pos2 (position of common node in p2),
// and add them to the node ArrayList of the second offspring.
for (int i = 0; i <= pos2; i++)
{
secondOffspringNodeList.add(p2.getPath().getNode(i));
}
// Loop through all nodes of the path of particle p1,
// from position pos1 (position of common node in p1) to the last position,
// and add them to the node ArrayList of the second offspring.
for (int i = pos1+1; i < p1.getPath().getSize(); i++)
{
secondOffspringNodeList.add(p1.getPath().getNode(i));
}
// Create second offspring from the node ArrayList.
secondOffspring.setPath(secondOffspringNodeList);
// If the second offspring that was created has double nodes in it.
if (secondOffspring.hasDoubleNodes())
// The node that was randomly selected from the
// common node list of the two particles
// is now removed and the process of the creation
// of the offsprings starts from the beginning.
// (while loop starts over)
crossoverNodes.remove(crossNode);
else
{
// Else the paths of the two particles p1 and p2
// are replaced from the new offsprings and the
// process of their creation stops. (end of while loop).
// (when the else statement is reached, the two
// offsprings are created without problems).
p1.setPath(firstOffspring);
p2.setPath(secondOffspring);
break;
}
}
}
/*
* Crossover operator:
* Get all the particles of the population that will be crossed,
* for every couple of those particles get their offspring paths,
* and change them with the originals,
* then create a new population with those particles.
*/
private void crossover()
{
// Initialize ArrayList of the particles that will get crossed.
ArrayList<Particle> crossoverParticles = new ArrayList<>();
// Loop through every particle of the population.
for (int i = 0; i < this.population.length; i++)
{
// Get a random number between (0, 1).
double rand = randValue();
// If the random number is less than the crossover probability.
if (rand < this.crossoverProbability)
{
// The particle will get crossed so it is added
// in the crossover particle ArrayList.
crossoverParticles.add(this.population[i]);
// and it gets "removed" from the particle population.
this.population[i] = null;
}
}
// If the number of the particles in the crossover ArrayList is odd.
if (crossoverParticles.size() % 2 == 1)
{
// Get the position of the best particle of the population.
int bestParticlePos = this.particleBestPosition();
// If the position is -1, there are no more particles
// in the population, so every one of them has been
// added in the crossover ArrayList.
if (bestParticlePos == -1)
{
// Remove the first particle of the crossover ArrayList and add it
// to the particle population.
this.population[0] = crossoverParticles.get(0);
crossoverParticles.remove(0);
}
else
{
// Else add the best particle of the population in the
// crossover ArrayList and "remove" it for the population.
crossoverParticles.add(this.population[bestParticlePos]);
this.population[bestParticlePos] = null;
}
}
// For every couple (i and i + 1) of particles in the crossover ArrayList.
for (int i = 0; i < crossoverParticles.size(); i += 2)
{
// Get their offsprings, (create new paths)
crossoverOffsprings(crossoverParticles.get(i), crossoverParticles.get(i + 1));
}
// Loop through the particles population,
// and add the particles of the crossover ArrayList
// into the null positions of the population.
for (int i = 0; i < this.population.length; i++)
{
if (this.population[i] == null)
{
this.population[i] = crossoverParticles.get(0);
crossoverParticles.remove(0);
}
}
}
/*
* Mutation operator:
* Create a new path between two randomly selected
* nodes of the existing path, of each particle of
* of the population.
*/
private void mutate()
{
// Random number generator.
Random rand = new Random();
// Loop through every particle of the population.
for (Particle currentParticle : this.population)
{
// Get a random number between (0, 1).
double randNumber = randValue();
// If the random number is less that the mutation probability
// then the particle will be mutated.
if (randNumber < mutationProbability)
{
// Initialize new nodes as null.
Node firstNode = null;
Node secondNode = null;
while (true)
{
// Get two random nodes from the current particle of the population.
firstNode = currentParticle.getPath().getNode(rand.
nextInt(currentParticle.getPath().getSize()));
secondNode = currentParticle.getPath().getNode(rand.
nextInt(currentParticle.getPath().getSize()));
// If the two nodes are equal or the absolute value of their difference is 1
// get two new random nodes from the current particle of the population.
// (start over the while loop).
if (firstNode == secondNode || Math.abs(firstNode.getNumber() - secondNode.getNumber()) == 1)
{
continue;
}
else
{
// else keep those two nodes.
// (end the while loop).
break;
}
}
// Get the positions of the two random nodes, in the path of the current particle.
int firstPos = currentParticle.getPath().getNodePosition(firstNode);
int secondPos = currentParticle.getPath().getNodePosition(secondNode);
// If the position of the first node is greater than the position of the second one
// (the second node is before the first one in the path)
// then change the name of their variables.
if (firstPos > secondPos)
{
Node temp = firstNode;
firstNode = secondNode;
secondNode = temp;
firstPos = currentParticle.getPath().getNodePosition(firstNode);
secondPos = currentParticle.getPath().getNodePosition(secondNode);
}
/*
* Create a new path from the first node to the second one.
*/
// Initialize the path.
Path offspringPath = new Path();
// Copy the path from position 0 until the position of the first node
// that was randomly selected.
for (int i = 0; i < firstPos; i++)
{
offspringPath.getPath().add(currentParticle.getPath().getNode(i));
}
// Create a new random path from the first node to the second one.
// If the new random path is null, meaning it could not be created,
// then mutate the next particle of the population.
// (continue the "for each" loop)
if (!offspringPath.pathCreation(firstNode.getNumber(), secondNode.getNumber()))
{
continue;
}
// Copy the path from the position of the second node to the last position.
for (int i = secondPos + 1; i < currentParticle.getPath().getSize(); i++)
{
offspringPath.getPath().add(currentParticle.getPath().getNode(i));
}
// If the new path has not double nodes in it
// then set the path of the current particle
// as the new created path.
if (!offspringPath.hasDoubleNodes())
{
currentParticle.setPath(offspringPath);
}
}
} // end of for loop.
}
/*
* Execute GA-PSO algorithm.
*/
public Particle execute()
{
// For the number of iterations that has been set in the Settings Class.
for (int i = 0; i < Settings.getIterations(); i++)
{
// Execute three main steps of the Generic Algorithm (GA).
this.selection();
this.crossover();
this.mutate();
/*
* Execute PSO algorithm.
*
*
* Note: the pbest of every particle was automatically
* updated through the crossover and mutation operators.
*/
// Find the gbest (best position) of the population,
// and save it in every particle of the population.
Particle gbest = this.population[this.particleBestPosition()];
for (Particle p : this.population)
{
p.setGbest(gbest.getPath());
}
// Update the position - velocity of each particle of the population.
for (Particle p : this.population)
{
p.update(w,c1,c2,f1,f2);
}
}
// After all iterations are done, return the best particle of the population.
return this.population[this.particleBestPosition()];
}
}
| [
"[email protected]"
] | |
922e47b82ac8d1c421d1e219f266078440de1525 | 8ac358ed6d73745bca51088e108a7914d7ebca9c | /nlp-endpoint/src/main/java/com/gooyave/nlp/endpoint/model/TextResponse.java | 7211de2c02c681f76ddcf0f70cbc1c1590e9d6bc | [] | no_license | muskacirca/nlp-server-test | 4082a5e5917dd2ac9a927511f0afa82dcdb6095b | 4b3cc7ef861fcf65dae603efe68aec8ad09ece8b | refs/heads/master | 2021-01-19T12:10:15.194809 | 2017-02-22T12:42:22 | 2017-02-22T12:42:22 | 82,290,313 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 424 | java | package com.gooyave.nlp.endpoint.model;
public class TextResponse {
private String accessToken;
private String raw;
public String getAccessToken() {
return accessToken;
}
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
public String getRaw() {
return raw;
}
public void setRaw(String raw) {
this.raw = raw;
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.