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
6a48e18a40867ca8f9af04260caef11268b077a5
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/7/7_d2f824d8fc3b422da65b715e837b3bc2d01b2517/CRActivePathRequestProcessor/7_d2f824d8fc3b422da65b715e837b3bc2d01b2517_CRActivePathRequestProcessor_s.java
e60c2e3dcdf6bac8c91eb6a87306dace58c2bf34
[]
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
6,283
java
package com.gentics.cr; import java.util.Collection; import java.util.Iterator; import java.util.Vector; import org.apache.log4j.Logger; import com.gentics.api.lib.datasource.Datasource; import com.gentics.api.lib.datasource.DatasourceException; import com.gentics.api.lib.exception.ParserException; import com.gentics.api.lib.expressionparser.ExpressionParserException; import com.gentics.api.lib.expressionparser.filtergenerator.DatasourceFilter; import com.gentics.api.lib.resolving.Resolvable; import com.gentics.cr.exceptions.CRException; import com.gentics.cr.util.ArrayHelper; import com.gentics.cr.util.RequestWrapper; /** * This RequestProcessor fetches the active path from a child element * passed in the request as contentid to the root element. * Either a root element is given, or it will go up until there is no further * parent. * It does not support doNavigation. * Last changed: $Date: 2010-04-01 15:24:02 +0200 (Do, 01 Apr 2010) $ * @version $Revision: 541 $ * @author $Author: [email protected] $ * */ public class CRActivePathRequestProcessor extends RequestProcessor { /** * Root id key. */ private static final String ROOT_ID = "rootid"; /** * Logger. */ private static final Logger LOG = Logger .getLogger(CRActivePathRequestProcessor.class); /** * Create a new instance of CRRequestProcessor. * @param config configuration. * @throws CRException in case of error. */ public CRActivePathRequestProcessor(final CRConfig config) throws CRException { super(config); } /** * * Fetch the matching objects using the given CRRequest. * @param request CRRequest * @param doNavigation defines if to fetch children * @return resulting objects * @throws CRException in case of error. */ public final Collection<CRResolvableBean> getObjects( final CRRequest request, final boolean doNavigation) throws CRException { Datasource ds = null; DatasourceFilter dsFilter; Collection<CRResolvableBean> collection = null; RequestWrapper rW = request.getRequestWrapper(); String rootId = rW.getParameter(ROOT_ID); if (request != null) { // Parse the given expression and create a datasource filter try { ds = this.config.getDatasource(); if (ds == null) { throw (new DatasourceException("No Datasource available.")); } dsFilter = request.getPreparedFilter(config, ds); // add base resolvables if (this.resolvables != null) { for (Iterator<String> it = this.resolvables .keySet().iterator(); it.hasNext();) { String name = it.next(); dsFilter.addBaseResolvable(name, this.resolvables.get(name)); } } CRResolvableBean bean = loadSingle(ds, request); if (bean != null) { collection = getParents(ds, bean, rootId, request); if (collection == null) { collection = new Vector<CRResolvableBean>(); } collection.add(bean); } } catch (ParserException e) { LOG.error("Error getting filter for Datasource.", e); throw new CRException(e); } catch (ExpressionParserException e) { LOG.error("Error getting filter for Datasource.", e); throw new CRException(e); } catch (DatasourceException e) { LOG.error("Error getting result from Datasource.", e); throw new CRException(e); } finally { CRDatabaseFactory.releaseDatasource(ds); } } return collection; } /** * Create prefill attributes. * @param request request object * @return attributes as string array */ private String[] getPrefillAttributes(final CRRequest request) { String[] prefillAttributes = request.getAttributeArray(); prefillAttributes = ArrayHelper.removeElements( prefillAttributes, "contentid", "updatetimestamp"); return prefillAttributes; } /** * Fetch a single element. * @param ds datasource * @param request request * @return element * @throws DatasourceException in case of error * @throws ParserException in case of error * @throws ExpressionParserException in case of error */ private CRResolvableBean loadSingle(final Datasource ds, final CRRequest request) throws DatasourceException, ParserException, ExpressionParserException { CRResolvableBean bean = null; String[] attributes = getPrefillAttributes(request); Collection<Resolvable> col = this.toResolvableCollection(ds.getResult( request.getPreparedFilter(config, ds), attributes, request.getStart().intValue(), request.getCount().intValue(), request.getSorting())); if (col != null && col.size() > 0) { bean = new CRResolvableBean(col.iterator().next(), attributes); } return bean; } /** * Fetches the parents. * @param ds datasource * @param current current child element * @param rootContentId id of the desired root * @param request request object * @return collection of parrents. * @throws CRException * @throws ExpressionParserException * @throws ParserException * @throws DatasourceException */ private Collection<CRResolvableBean> getParents(final Datasource ds, final CRResolvableBean current, final String rootContentId, final CRRequest request) throws CRException, DatasourceException, ParserException, ExpressionParserException { Collection<CRResolvableBean> ret = null; String mother = current.getMother_id(); if (mother != null && !(current.getMother_type() + "." + mother) .equals(rootContentId) && !"0".equals(mother)) { CRRequest nRequest = request.Clone(); nRequest.setRequestFilter(null); nRequest.setContentid(current.getMother_type() + "." + mother); CRResolvableBean parent = loadSingle(ds, nRequest); ret = getParents(ds, parent, rootContentId, nRequest); if (ret == null) { ret = new Vector<CRResolvableBean>(); } ret.add(parent); } return ret; } @Override public void finalize() { } }
3de9fc3ecdfd0a6528e688b83f4c590d23f325c4
afc5e5ae723777b014233c3ed457605146cb5888
/GG1Simulator/src/gg1simulator/Jobs.java
ec39f9fa1181602745e5afb4fd3f4b67e739eead
[]
no_license
XP928/qsim
859a574245b3c45744d563096aba194689959e9a
a02885f062c4b295a04a4a328420541f27d5b9b7
refs/heads/master
2021-01-13T01:44:18.861225
2014-08-02T04:05:49
2014-08-02T04:05:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,200
java
/* * Jobs.java */ package gg1simulator; public class Jobs implements Comparable<Jobs> { private int jobId; private double startTime; private double arrivalTime; private double lastArrivalTime; private double startServiceTime; private double midArrivalTime; private double midDepartureTime; private double departureTime; public Jobs(int jobId, double arrivalTime, double lastArrivalTime) { this.jobId = jobId; this.arrivalTime = arrivalTime; this.lastArrivalTime = lastArrivalTime; } public Jobs(int jobId, double startTime, double lastArrivalTime, double departureTime){ this.jobId = jobId; this.startTime = startTime; this.lastArrivalTime = lastArrivalTime; this.departureTime = departureTime; } public int getJobId() { return jobId; } public void setJobId(int jobId) { this.jobId = jobId; } public double getStartTime(){ return startTime; } public double getArrivalTime() { return arrivalTime; } public double getMidArrivalTime() { return midArrivalTime; } public double getLastArrivalTime() { return lastArrivalTime; } public void setLastArrivaltime(double lastArrivalTime) { this.lastArrivalTime = lastArrivalTime; } public void setMidArrivalTime(double midArrivalTime) { this.midArrivalTime = midArrivalTime; } public double getMidDepartureTime() { return midDepartureTime; } public void setMidDepartureTime(double midDepartureTime) { this.midDepartureTime = midDepartureTime; } public double getDepartureTime() { return departureTime; } public void setDepartureTime(double departureTime) { this.departureTime = departureTime; } public double getStartServiceTime() { return startServiceTime; } public void setStartServiceTime(double startServiceTime) { this.startServiceTime = startServiceTime; } @Override public int compareTo(Jobs jobs) { return Double.compare(lastArrivalTime, jobs.lastArrivalTime); } }
3b7c639804cde041c1240fa7a24b923daaa76245
29957da0b6883456ee753d85aff5e739f4af1530
/src/lib/evaluation/RelevanceJudgmentException.java
7268d7b48a189e355455ab2b0741227da7487337
[]
no_license
tonilam/Java__CAB431_Asgn1
05f676bd532219527a6560046e1b7a4553e72d3e
66e2ead195b29d97178925457e8cc1db4a5c37ac
refs/heads/master
2021-01-20T13:45:35.379641
2017-05-07T10:44:25
2017-05-07T10:44:25
90,525,038
0
0
null
null
null
null
UTF-8
Java
false
false
1,124
java
package lib.evaluation; /** * RelevanceJudgmentException completely inherits java.lang.Exception without modification. * It aims to throw the exception in an apt name. * @author Toni Lam * * @since 1.0 * @version 2.0, Apr 24, 2017 */ public class RelevanceJudgmentException extends Exception { /** * Implementation of Serializable needs a serialVersionUID. */ private static final long serialVersionUID = 1L; public RelevanceJudgmentException() { // TODO Auto-generated constructor stub } public RelevanceJudgmentException(String message) { super(message); // TODO Auto-generated constructor stub } public RelevanceJudgmentException(Throwable cause) { super(cause); // TODO Auto-generated constructor stub } public RelevanceJudgmentException(String message, Throwable cause) { super(message, cause); // TODO Auto-generated constructor stub } public RelevanceJudgmentException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); // TODO Auto-generated constructor stub } }
61fefa6b251e37e3e9df4a2ada3065a40bacf7d5
04ff09bc1c3178fc020a2d17e318d5b29da599e6
/main/src/main/java/com/sxjs/jd/composition/login/changepassage/ChangePasswordPresenterModule.java
46bf3acb0eb71f6d33796cead8e81c22f73da8e4
[ "Apache-2.0" ]
permissive
XiePengLearn/refactor-frontend-android
b9b820007ed216c20b7b590c39639e161c63bbdc
5a08db4065ae4d7a9dc676a4d5328c8f928a8167
refs/heads/master
2020-07-26T08:45:39.313596
2019-09-26T09:00:15
2019-09-26T09:00:15
208,593,612
1
0
null
null
null
null
UTF-8
Java
false
false
747
java
package com.sxjs.jd.composition.login.changepassage; import com.sxjs.jd.MainDataManager; import dagger.Module; import dagger.Provides; /** * @Auther: xp * @Date: 2019/9/15 10:49 * @Description: */ @Module public class ChangePasswordPresenterModule { private ChangePasswordContract.View view; private MainDataManager mainDataManager; public ChangePasswordPresenterModule(ChangePasswordContract.View view, MainDataManager mainDataManager) { this.view = view; this.mainDataManager = mainDataManager; } @Provides ChangePasswordContract.View providerMainContractView() { return view; } @Provides MainDataManager providerMainDataManager() { return mainDataManager; } }
2d15254ee371698137186dbd6c063419a7aec002
9f98e41c1745181e7d2552f2b7629b1b5e0bab04
/QMSRest/src/main/java/com/qms/rest/repository/MemberRepository.java
d67a2edfd9620c6b45fe5b34ee865dc122c3b79f
[]
no_license
dharishbabu007/HEALTHINSIGHTS
649d330958833d851c4515daa36dc68230a50049
7be3fa1053eeab5834d5a9faf20e612767474420
refs/heads/master
2023-03-07T21:18:19.740770
2023-02-19T05:22:30
2023-02-19T05:22:30
135,386,834
2
1
null
2023-02-19T05:22:31
2018-05-30T04:11:22
HTML
UTF-8
Java
false
false
488
java
package com.qms.rest.repository; import com.qms.rest.model.DimMember; import com.qms.rest.model.QualityProgram; import org.springframework.data.repository.CrudRepository; import org.springframework.data.repository.query.Param; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @RepositoryRestResource public interface MemberRepository extends CrudRepository<DimMember, Integer> { DimMember findDimMemberByMemberId(@Param("memberId") String memberId); }
5056178ccce9e7aab199060e47276e510fd71cf5
6654fded19d77b7adc1de87efdaf9c74fcef885f
/app/src/main/java/com/msm/chatapp/Fragments/CallsFragment.java
6e287136a493dcb4c0cb6bd38f2fa711d9adec7a
[]
no_license
manasmuda/ChatApp
7e4a33c855680c2fa139a13d30b6f6259b7e4f0a
99eb4e7f21afaea0af9e70d1e6b595cffd1a5634
refs/heads/master
2022-11-20T15:52:56.377163
2020-07-22T03:51:22
2020-07-22T03:51:22
281,488,080
0
0
null
null
null
null
UTF-8
Java
false
false
4,078
java
package com.msm.chatapp.Fragments; import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.os.Handler; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import com.msm.chatapp.Adapters.CallsAdapter; import com.msm.chatapp.Adapters.ChatsAdapter; import com.msm.chatapp.CallBacks.LoadingCallBack; import com.msm.chatapp.DataBase.CallDB; import com.msm.chatapp.DataBase.ChatDB; import com.msm.chatapp.R; public class CallsFragment extends Fragment { private static CallsFragment callsFragment; private static Context mContext; private Activity activity; private static LoadingCallBack lcb; private RecyclerView callList; private LinearLayoutManager layoutManager; public static CallsAdapter callsAdapter; private boolean scroll=true; public CallsFragment() { // Required empty public constructor } public static CallsFragment getInstance(Context context,LoadingCallBack lcb) { if(callsFragment==null) { callsFragment = new CallsFragment(); mContext=context; CallsFragment.lcb=lcb; } return callsFragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); activity=getActivity(); } @Nullable @Override public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { View view=inflater.inflate(R.layout.calls_fragment,container,false); callList=view.findViewById(R.id.call_list); layoutManager=new LinearLayoutManager(mContext); callList.setLayoutManager(layoutManager); callsAdapter=new CallsAdapter(mContext); callList.setAdapter(callsAdapter); callsAdapter.setCallModelList(CallDB.getPage(callsAdapter.getSize())); callList.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); } @Override public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { super.onScrolled(recyclerView, dx, dy); int visibleItemCount = layoutManager.getChildCount(); int totalItemCount = layoutManager.getItemCount(); int firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition(); Log.i("abc","vic"+String.valueOf(visibleItemCount)); Log.i("abc","tic"+String.valueOf(totalItemCount)); Log.i("abc","fvip"+String.valueOf(firstVisibleItemPosition)); if(scroll) { if ((visibleItemCount + firstVisibleItemPosition) >= totalItemCount && firstVisibleItemPosition >= 0 && totalItemCount >= 8) { Log.i("abc", "addItems"); lcb.loading(true); final Handler handler = new Handler(); scroll=false; handler.postDelayed(new Runnable() { @Override public void run() { // Do something after 5s = 5000ms callsAdapter.setCallModelList(CallDB.getPage(callsAdapter.getSize())); lcb.loading(false); scroll=true; } }, 1000); } } } }); return view; } }
76abe006e4487356a29ae6ccc3952fde9660a136
19a84113a5e00cb53b39bf1e4b2f701a978fa3c5
/z_cloud4_nacos_client/src/main/java/com/cloud4/nacos/ZCloud4NacosClientApplication.java
61bf2ef05c5dff9b4d802eea0727f9ebc4296dc8
[]
no_license
liuheyong/z_alibabacloud_parent2
49b19051763f3afd0102be03a72fe11a0fe241fb
e76041b90c8b61749d273e636c15862eafad36d4
refs/heads/master
2020-06-15T05:10:49.230487
2019-07-17T03:34:37
2019-07-17T03:34:37
195,211,411
0
0
null
null
null
null
UTF-8
Java
false
false
760
java
package com.cloud4.nacos; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.loadbalancer.LoadBalanced; import org.springframework.context.annotation.Bean; import org.springframework.web.reactive.function.client.WebClient; @EnableDiscoveryClient @SpringBootApplication public class ZCloud4NacosClientApplication { public static void main(String[] args) { SpringApplication.run(ZCloud4NacosClientApplication.class, args); } @Bean @LoadBalanced public WebClient.Builder loadBalancedWebClientBuilder() { return WebClient.builder(); } }
58d8dfaac982e9245d97e21ddd02cfeaf653e891
5989f2eacadd43feb5e5a6fab0d86893149239c1
/player_sdk/src/test/java/com/cmcm/v/player_sdk/ExampleUnitTest.java
997718ecdfaa2dd9dc9f00e1c34d1b578e9de27c
[]
no_license
xunmengyoufeng/xplayer
a5d4b26fba7157d6260ba383bac20aa0bce2dcab
cc5be4ad88837d8d12e97c1e10927dc3f103d055
refs/heads/master
2020-12-24T11:17:42.613787
2016-12-13T07:30:55
2016-12-13T07:30:55
73,039,505
0
0
null
null
null
null
UTF-8
Java
false
false
399
java
package com.cmcm.v.player_sdk; 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); } }
52e88608af20ca3b99fc4d1e5efe776cc4ffd9fc
8923ce39164747a6778a4efa0cfdfcfc8dec161f
/src/com/pogo/model/CsvFile.java
83e13858846016c9abebabcdccdaf14a6e4c2790
[]
no_license
dks31mar/pogoerp
26bbd17e075ee4550f732af94749979a5dc04d15
7d695d09b6b7caaded83878c544bc32d444c402a
refs/heads/master
2021-01-12T15:44:01.119709
2016-12-22T06:36:03
2016-12-22T06:36:14
71,873,627
0
0
null
null
null
null
UTF-8
Java
false
false
1,310
java
package com.pogo.model; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import org.springframework.web.multipart.MultipartFile; @Entity @Table(name="csvfile") public class CsvFile { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private int id ; @Column(name = "filename") private String filename; @Column(name="size") private long size; @Column(name = "date") private Date date; /*private MultipartFile file; public MultipartFile getFile() { return file; } public void setFile(MultipartFile file) { this.file = file; }*/ public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFilename() { return filename; } public void setFilename(String filename) { this.filename = filename; } public long getSize() { return size; } public void setSize(long size) { this.size = size; } public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } }
0a66cad1dd9b96a91e58190400165de57c76f1d7
7302554ae8b5017fefb5e2567e08b727bc5e0ae7
/src/main/java/com/github/zerkseez/jdbc/wrapper/WrappedStruct.java
80f4299b3601790a2ad90b43f88e8770f1a117cb
[ "Apache-2.0" ]
permissive
zerkseez/jdbc-wrapper
fa85e2594bd24ad98d0cbbca523b76e72dc1ee16
19da9adb9db05b0e03a366a69417b1c7f0905bb4
refs/heads/master
2021-01-13T09:45:25.503850
2016-10-01T23:15:58
2016-10-01T23:15:58
69,768,553
2
0
null
2016-10-01T23:15:59
2016-10-01T23:05:47
null
UTF-8
Java
false
false
1,573
java
/******************************************************************************* * Copyright 2016 Xerxes Tsang * * 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.github.zerkseez.jdbc.wrapper; import javax.annotation.Generated; @Generated("com.github.zerkseez.codegen.wrappergenerator.WrapperGenerator") public class WrappedStruct implements java.sql.Struct { private final java.sql.Struct wrappedObject; public WrappedStruct(final java.sql.Struct wrappedObject) { this.wrappedObject = wrappedObject; } @Override public Object[] getAttributes() throws java.sql.SQLException { return wrappedObject.getAttributes(); } @Override public Object[] getAttributes(final java.util.Map<String, Class<?>> p0) throws java.sql.SQLException { return wrappedObject.getAttributes(p0); } @Override public String getSQLTypeName() throws java.sql.SQLException { return wrappedObject.getSQLTypeName(); } }
056b2aa533eca3d52c37d5b318b1adb7086f257b
7ca8ffcdfb39ab4ffc2d8ff291e46ffabc8db6a2
/hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/fairness/RouterRpcFairnessConstants.java
5e84317293f9952fd3fc65180a6de83055644059
[ "CC-PDDC", "CC0-1.0", "CC-BY-3.0", "LicenseRef-scancode-unknown-license-reference", "LGPL-2.1-only", "LicenseRef-scancode-other-permissive", "CDDL-1.0", "GCC-exception-3.1", "MIT", "EPL-1.0", "Classpath-exception-2.0", "BSD-3-Clause", "GPL-2.0-only", "Apache-2.0", "LicenseRef-scancode-public-domain", "LicenseRef-scancode-jdom", "CDDL-1.1", "BSD-2-Clause", "LicenseRef-scancode-unknown" ]
permissive
apache/hadoop
ea2a4a370dd00d4a3806dd38df5b3cf6fd5b2c64
42b4525f75b828bf58170187f030b08622e238ab
refs/heads/trunk
2023-08-18T07:29:26.346912
2023-08-17T16:56:34
2023-08-17T16:56:34
23,418,517
16,088
10,600
Apache-2.0
2023-09-14T16:59:38
2014-08-28T07:00:08
Java
UTF-8
Java
false
false
1,103
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.hadoop.hdfs.server.federation.fairness; public class RouterRpcFairnessConstants { /** Name service keyword to identify fan-out calls. */ public static final String CONCURRENT_NS = "concurrent"; /* Hidden constructor */ protected RouterRpcFairnessConstants() { } }
0e66b0d011dcd91291c760d5169c400a7a1bd30c
ac1f61b5e9b3d61b13b2a221e3256828f3eac8cb
/src/main/java/com/jeeplus/modules/ehr/dao/UserMemberDao.java
d0461055562edd23a73d262a91642c6b6412d6f6
[]
no_license
zj312404325/jyoaoa
aaede1961779921a0c087077eed55dc5efb71baf
9fb5df634b76eec1f1fcaf14bb29cf25528896df
refs/heads/master
2020-04-05T06:55:07.262154
2020-01-15T08:38:44
2020-01-15T08:38:44
156,656,437
0
1
null
2019-10-29T16:52:46
2018-11-08T05:48:08
JavaScript
UTF-8
Java
false
false
559
java
/** * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved. */ package com.jeeplus.modules.ehr.dao; import com.jeeplus.common.persistence.CrudDao; import com.jeeplus.common.persistence.annotation.MyBatisDao; import com.jeeplus.modules.ehr.entity.UserInfo; import com.jeeplus.modules.ehr.entity.UserMember; /** * 入职员工信息登记DAO接口 * @author yc * @version 2017-10-18 */ @MyBatisDao public interface UserMemberDao extends CrudDao<UserMember> { public void deleteByUserinfoid(UserInfo userInfo); }
9fcdbc9457e56302daa6703cd2fc11aa615a7071
d87c529a1f4aacfd09550af732fdd5b97443211e
/src/main/java/service/UserProcService.java
16fbbd04f7e182cc70fd5d69f819283c792ce8fb
[]
no_license
zpc0921/practice
be22c2861e299f7d21095b09ac2e7b73e490e300
9510a17f87192d0a69980fc19d58e7ac78c82606
refs/heads/master
2020-07-06T11:38:36.062847
2019-08-18T14:27:08
2019-08-18T14:27:08
203,005,011
0
0
null
null
null
null
UTF-8
Java
false
false
974
java
package service; import model.User; import utils.FileUtil; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; public class UserProcService { private List<User> userList; public void proc(String fileName) { final String userInfos = FileUtil.read(fileName); if (Objects.isNull(userInfos)) { // } final List<String> userStrList = Arrays.asList(userInfos.split("\r\n")); this.userList = userStrList.stream().map(item -> { final String[] userStr = item.split(", "); User user = new User(); user.setFirstName(userStr[0]); user.setLastName(userStr[1]); user.setBirthDay(userStr[2]); user.setEmail(userStr[3]); return user; }).collect(Collectors.toList()); } public List<User> getUserList() { return userList; } }
b143d0eb21f143d554d8647d9cc1bd0dfe5333ac
87f3f6827d27720c23faf3c603842e4fc513b8a0
/src/test/java/com/proshomon/elasticsearch/nokkhotroelastic/proshomon/InsertHouseHoldRFIDTest.java
f5e7e8e55052e69ec5ed15edfc6a0578379009e4
[]
no_license
meraihan/nokkhotro-elastic
d14fe5f32b431f50b837b06fdfde2f421a17d4d1
3b22a873ac0023c277557aa49b9bd9d7d10510e1
refs/heads/master
2022-07-05T04:01:49.720576
2019-06-11T05:39:33
2019-06-11T05:39:33
185,194,073
0
0
null
null
null
null
UTF-8
Java
false
false
2,055
java
package com.proshomon.elasticsearch.nokkhotroelastic.proshomon; import com.proshomon.elasticsearch.nokkhotroelastic.repository.HouseholdRepository; import lombok.extern.slf4j.Slf4j; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.junit.Ignore; 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 java.io.File; import java.io.FileInputStream; @Slf4j @SpringBootTest @RunWith(SpringRunner.class) public class InsertHouseHoldRFIDTest { @Autowired HouseholdRepository householdRepository; public static final String XLSX_FILE_PATH = "./190521 Final_HH_Data_Sheet-Uppercase 内码.xlsx"; @Test @Ignore public void readWriteFromExcel() throws Exception { FileInputStream file = new FileInputStream(new File(XLSX_FILE_PATH)); XSSFWorkbook workbook = new XSSFWorkbook(file); XSSFSheet sheet = workbook.getSheetAt(0); Row row = sheet.createRow(0); for(int i=1; i<=sheet.getLastRowNum(); i++){ row = sheet.getRow(i); String id; if(row.getCell(0)==null){id = "0";} else { id = row.getCell(0).toString(); } String cardNo; Cell cNo = row.getCell(3, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK); if (cNo != null) { cNo.setCellType(CellType.STRING); cardNo = "0" + cNo.getStringCellValue(); } else { cardNo = null; } try { householdRepository.update(cardNo, id); } catch (Exception e){ log.error("Inserting Data Failed: {}", e); } } } }
107d3dbece408545b315bdb603f63d1cfc472d5b
ff17aa326a62de027a014fab99a652f593c7381f
/module_mine/src/main/java/com/example/operator/OperatorView.java
b05714812eb0f2e90f97b400d52b1741623bea06
[]
no_license
majiaxue/jikehui
401aa2db1a3846bbbef9d29a29cdb934cb18b4c2
9b30feb8dbf058954fe59676303fd260ab5282c8
refs/heads/master
2022-08-22T18:25:08.014789
2020-05-23T10:40:22
2020-05-23T10:40:22
263,837,386
1
1
null
null
null
null
UTF-8
Java
false
false
384
java
package com.example.operator; import android.support.v4.view.PagerAdapter; import com.example.mvp.IView; import com.example.operator.adapter.YysFactorAdapter; import com.example.operator.adapter.YysQuanyiAdapter; public interface OperatorView extends IView { void loadQuanyi(YysQuanyiAdapter adapter); void loadVp(PagerAdapter adapter); void loadFactor(String s); }
85c6bb4c6bd850c5e2d3d469588b276360caed85
ad073825582364c0e7158a8ab9542b413cc3ebd2
/PlayWall/src/main/java/de/tobias/playpad/server/ServerImpl.java
ca60c2c7bd416bf8da2e0b263172e9affec19ea1
[]
no_license
Tobisaninfo/PlayWallDesktop
aa78aa8787106f7772b5d5cbc703f9a7d0d7487c
35d341308189fb65ff2efb5876df8e33f74d2393
refs/heads/master
2023-03-30T23:18:26.626721
2021-10-31T22:25:29
2021-10-31T22:25:29
106,997,431
1
2
null
2023-03-28T22:46:28
2017-10-15T08:59:58
Java
UTF-8
Java
false
false
13,717
java
package de.tobias.playpad.server; import com.google.gson.Gson; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.reflect.TypeToken; import com.neovisionaries.ws.client.WebSocket; import com.neovisionaries.ws.client.WebSocketException; import com.neovisionaries.ws.client.WebSocketFactory; import de.thecodelabs.logger.Logger; import de.thecodelabs.utils.application.ApplicationUtils; import de.thecodelabs.utils.application.container.PathType; import de.thecodelabs.utils.threading.Worker; import de.thecodelabs.versionizer.service.UpdateService; import de.tobias.playpad.PlayPadMain; import de.tobias.playpad.PlayPadPlugin; import de.tobias.playpad.plugin.ModernPlugin; import de.tobias.playpad.project.Project; import de.tobias.playpad.project.ProjectJsonReader; import de.tobias.playpad.project.ProjectJsonWriter; import de.tobias.playpad.project.ref.ProjectReference; import de.tobias.playpad.server.sync.command.CommandManager; import de.tobias.playpad.server.sync.command.CommandStore; import de.tobias.playpad.server.sync.command.Commands; import de.tobias.playpad.server.sync.command.pad.*; import de.tobias.playpad.server.sync.command.pad.settings.PadSettingsAddCommand; import de.tobias.playpad.server.sync.command.pad.settings.PadSettingsUpdateCommand; import de.tobias.playpad.server.sync.command.pad.settings.design.DesignAddCommand; import de.tobias.playpad.server.sync.command.pad.settings.design.DesignUpdateCommand; import de.tobias.playpad.server.sync.command.page.PageAddCommand; import de.tobias.playpad.server.sync.command.page.PageRemoveCommand; import de.tobias.playpad.server.sync.command.page.PageUpdateCommand; import de.tobias.playpad.server.sync.command.path.PathAddCommand; import de.tobias.playpad.server.sync.command.path.PathRemoveCommand; import de.tobias.playpad.server.sync.command.project.ProjectAddCommand; import de.tobias.playpad.server.sync.command.project.ProjectRemoveCommand; import de.tobias.playpad.server.sync.command.project.ProjectUpdateCommand; import de.tobias.playpad.server.sync.conflict.Version; import io.github.openunirest.http.HttpResponse; import io.github.openunirest.http.JsonNode; import io.github.openunirest.http.Unirest; import io.github.openunirest.http.exceptions.UnirestException; import javafx.beans.property.ObjectProperty; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import org.json.JSONArray; import org.json.JSONObject; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.lang.reflect.Type; import java.net.URL; import java.nio.charset.StandardCharsets; import java.nio.file.*; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.UUID; import java.util.stream.Collectors; /** * Created by tobias on 10.02.17. */ public class ServerImpl implements Server, ChangeListener<ConnectionState> { private static final String OK = "OK"; private static final String CACHE_FOLDER = "Cache"; private static final String PROTOCOL = "https"; private static final String WS_PROTOCOL = "wss"; private final String host; private WebSocket websocket; private final ServerSyncListener syncListener; ServerImpl(String host) { this.host = host; this.syncListener = new ServerSyncListener(); this.syncListener.connectionStateProperty().addListener(this); try { loadStoredFiles(); } catch (IOException e) { Logger.error(e); } registerCommands(); } private void registerCommands() { CommandManager.register(Commands.PROJECT_ADD, new ProjectAddCommand()); CommandManager.register(Commands.PROJECT_UPDATE, new ProjectUpdateCommand()); CommandManager.register(Commands.PROJECT_REMOVE, new ProjectRemoveCommand()); CommandManager.register(Commands.PAGE_ADD, new PageAddCommand()); CommandManager.register(Commands.PAGE_UPDATE, new PageUpdateCommand()); CommandManager.register(Commands.PAGE_REMOVE, new PageRemoveCommand()); CommandManager.register(Commands.PAD_ADD, new PadAddCommand()); CommandManager.register(Commands.PAD_UPDATE, new PadUpdateCommand()); CommandManager.register(Commands.PAD_CLEAR, new PadClearCommand()); CommandManager.register(Commands.PAD_REMOVE, new PadRemoveCommand()); CommandManager.register(Commands.PAD_MOVE, new PadMoveCommand()); CommandManager.register(Commands.PATH_ADD, new PathAddCommand()); CommandManager.register(Commands.PATH_REMOVE, new PathRemoveCommand()); CommandManager.register(Commands.DESIGN_ADD, new DesignAddCommand()); CommandManager.register(Commands.DESIGN_UPDATE, new DesignUpdateCommand()); CommandManager.register(Commands.PAD_SETTINGS_ADD, new PadSettingsAddCommand()); CommandManager.register(Commands.PAD_SETTINGS_UPDATE, new PadSettingsUpdateCommand()); } @Override public String getHost() { return host; } @Override public List<ModernPlugin> getPlugins() throws IOException { URL url = new URL(PROTOCOL + "://" + host + "/plugins"); Reader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8); Type listType = new TypeToken<List<ModernPlugin>>() { }.getType(); Gson gson = new Gson(); return gson.fromJson(reader, listType); } @Override public ModernPlugin getPlugin(String id) throws IOException { URL url = new URL(PROTOCOL + "://" + host + "/plugins/" + id); Reader reader = new InputStreamReader(url.openStream(), StandardCharsets.UTF_8); Gson gson = new Gson(); return gson.fromJson(reader, ModernPlugin.class); } @Override public void loadPlugin(ModernPlugin plugin, UpdateService.RepositoryType channel) throws IOException { Path destination = ApplicationUtils.getApplication().getPath(PathType.LIBRARY, plugin.getFileName()); String url = PROTOCOL + "://" + host + "/plugins/raw/" + plugin.getId(); Logger.debug("Load server resource: {0}", destination); try { HttpResponse<InputStream> response = Unirest.get(url).asBinary(); Files.copy(response.getBody(), destination, StandardCopyOption.REPLACE_EXISTING); } catch (UnirestException e) { throw new IOException(e.getMessage()); } } @Override public String getSession(String username, String password) throws IOException, LoginException { String url = PROTOCOL + "://" + host + "/sessions"; try { HttpResponse<JsonNode> response = Unirest.post(url) .queryString("username", username) .queryString("password", password) .asJson(); JSONObject object = response.getBody().getObject(); // Account Error if (!object.getString("status").equals(OK)) { throw new LoginException(object.getString("message")); } // Session Key return object.getString("key"); } catch (UnirestException e) { throw new IOException(e.getMessage()); } } @Override public void logout(String username, String password, String key) throws IOException { String url = PROTOCOL + "://" + host + "/sessions"; try { Unirest.post(url) .queryString("username", username) .queryString("password", password) .queryString("session", key) .asJson(); } catch (UnirestException e) { throw new IOException(e.getMessage()); } } @Override public List<ProjectReference> getSyncedProjects() throws IOException, LoginException { String url = PROTOCOL + "://" + host + "/projects"; try { Session session = PlayPadMain.getProgramInstance().getSession(); HttpResponse<JsonNode> request = Unirest.get(url) .queryString("session", session.getKey()) .asJson(); JsonNode body = request.getBody(); if (body.isArray()) { JSONArray array = body.getArray(); List<ProjectReference> projects = new ArrayList<>(); for (int i = 0; i < array.length(); i++) { JSONObject object = array.getJSONObject(i); UUID uuid = UUID.fromString(object.getString("uuid")); String name = object.getString("name"); ProjectReference ref = new ProjectReference(uuid, name, true); projects.add(ref); } return projects; } else { throw new LoginException(body.getObject().getString("message")); } } catch (UnirestException e) { throw new IOException(e.getMessage()); } catch (SessionNotExistsException ignored) { return new ArrayList<>(); } } @Override public Project getProject(ProjectReference ref) throws IOException { String url = PROTOCOL + "://" + host + "/projects/" + ref.getUuid(); Session session = PlayPadMain.getProgramInstance().getSession(); try { HttpResponse<JsonNode> response = Unirest.get(url) .queryString("session", session.getKey()) .asJson(); JSONObject object = response.getBody().getObject(); ProjectJsonReader reader = new ProjectJsonReader(object); return reader.read(ref); } catch (UnirestException e) { throw new IOException(e.getMessage()); } catch (SessionNotExistsException ignored) { return null; } } @Override public void postProject(Project project) throws IOException { String url = PROTOCOL + "://" + host + "/projects"; Session session = PlayPadMain.getProgramInstance().getSession(); try { ProjectJsonWriter writer = new ProjectJsonWriter(); String value = writer.write(project).toString(); Unirest.post(url) .queryString("session", session.getKey()) .queryString("project", value) .asJson(); } catch (UnirestException e) { throw new IOException(e.getMessage(), e); } catch (SessionNotExistsException ignored) { } } @Override public Version getLastServerModification(ProjectReference ref) throws IOException { String url = PROTOCOL + "://" + host + "/projects/modification/" + ref.getUuid(); Session session = PlayPadMain.getProgramInstance().getSession(); try { HttpResponse<JsonNode> response = Unirest.get(url) .queryString("session", session.getKey()) .asJson(); JSONObject object = response.getBody().getObject(); String remoteSession = object.getString("session"); long time = object.getLong("time"); return new Version(time, remoteSession, false); } catch (UnirestException e) { throw new IOException(e.getMessage()); } catch (SessionNotExistsException ignored) { return null; } } @Override public void connect(String key) { try { WebSocketFactory webSocketFactory = new WebSocketFactory(); webSocketFactory.setConnectionTimeout(5000); if (PlayPadMain.sslContext != null) { webSocketFactory.setSSLContext(PlayPadMain.sslContext); } websocket = webSocketFactory.createSocket(WS_PROTOCOL + "://" + host + "/project"); websocket.addHeader("key", key); websocket.addListener(syncListener); websocket.connect(); } catch (WebSocketException | IOException e) { Logger.error("Failed to connect to server: " + e.getMessage()); } } @Override public void disconnect() { Logger.info("Disconnect from Server"); websocket.disconnect(); try { saveStoredCommands(); } catch (IOException e) { Logger.error(e); } } @Override public boolean push(String data) { if (websocket.isOpen()) { if (ApplicationUtils.getApplication().isDebug()) { Logger.debug("Send: " + data); } // Send to Server websocket.sendText(data); return true; } return false; } @Override public boolean push(JsonElement json) { return push(json.toString()); } // Reconnect @Override public void changed(ObservableValue<? extends ConnectionState> observable, ConnectionState oldValue, ConnectionState newValue) { if (newValue == ConnectionState.CONNECTION_REFUSED) { Worker.runLater(this::reconnect); } } @Override public ConnectionState getConnectionState() { return syncListener.connectionStateProperty().get(); } @Override public ObjectProperty<ConnectionState> connectionStateProperty() { return syncListener.connectionStateProperty(); } private void loadStoredFiles() throws IOException { Path path = ApplicationUtils.getApplication().getPath(PathType.DOCUMENTS, CACHE_FOLDER); if (Files.exists(path)) { try (final DirectoryStream<Path> directoryStream = Files.newDirectoryStream(path)) { for (Path file : directoryStream) { loadStoredFile(file); } } } } private void loadStoredFile(Path path) throws IOException { List<String> lines = Files.readAllLines(path); JsonParser parser = new JsonParser(); List<JsonObject> commands = lines.stream().map(line -> (JsonObject) parser.parse(line)).collect(Collectors.toList()); CommandStore executor = (CommandStore) PlayPadPlugin.getCommandExecutorHandler().getCommandExecutor(); executor.setStoredCommands(path.getFileName().toString(), commands); } private void saveStoredCommands() throws IOException { Path folder = ApplicationUtils.getApplication().getPath(PathType.DOCUMENTS, CACHE_FOLDER); if (Files.notExists(folder)) { Files.createDirectories(folder); } CommandStore executor = (CommandStore) PlayPadPlugin.getCommandExecutorHandler().getCommandExecutor(); Map<UUID, List<JsonObject>> storedCommands = executor.getStoredCommands(); for (Map.Entry<UUID, List<JsonObject>> entry : storedCommands.entrySet()) { Path file = folder.resolve(entry.getKey().toString()); List<String> lines = entry.getValue().stream().map(JsonElement::toString).collect(Collectors.toList()); Files.write(file, lines, StandardOpenOption.CREATE); } } private void reconnect() { boolean connected = false; int count = 0; while (!connected && count < 20) { count++; try { websocket = websocket.recreate().connect(); connected = true; Thread.sleep(30 * 1000L); } catch (InterruptedException e) { break; } catch (WebSocketException | IOException ignored) { } } } }
707f13bf8c7ca0cd96ec999c59134df6704369e3
f0f1f1cf4eaa91a18b709da811d52b874d0d2d8a
/src/main/java/edu/pingpong/bicipalma/BiciPalma/BiciPalma.java
1af45e8f35c8b56dab28ef438bc9f8fa83c20f26
[]
no_license
sgonzalezb/Bicipalma2
4cacd2ad80286a8317cbea380a762ba5d9bb40dd
21ff24f1f3334421903fa4ef7dcb51072964a451
refs/heads/main
2023-03-05T22:12:57.691616
2021-02-22T09:29:02
2021-02-22T09:29:02
339,191,188
0
0
null
null
null
null
UTF-8
Java
false
false
2,237
java
package edu.pingpong.bicipalma.BiciPalma; import edu.pingpong.bicipalma.domain.bicicleta.Bicicleta; import edu.pingpong.bicipalma.domain.estacion.Estacion; import edu.pingpong.bicipalma.domain.tarjetausuario.TarjetaUsuario; public class BiciPalma { public static void main(String[] args) { Estacion estacion = new Estacion(1, "Manacor", 6); /** * caso TEST visualizar estado de la estacion: * muestra id, direccion, anclaje */ System.out.println("\n **** caso TEST visualizar estado de la estacion **** \n"); estacion.consultarEstacion(); /** * caso TEST visualizar anclajes libres */ System.out.println("\n **** caso TEST visualizar anclajes libres **** \n"); System.out.println("anclajesLibres: " + estacion.anclajesLibre()); estacion.consultarAnclajes(); /** * caso TEST anclar bicicleta(s) */ System.out.println("\n **** caso TEST anclar bicicleta(s) **** \n"); int[] bicicletas = { 291, 292, 293, 294 }; Bicicleta bicicleta = null; for (int id : bicicletas) { bicicleta = new Bicicleta(id); estacion.anclarBicicleta(bicicleta); } System.out.println("anclajes libres tras generar " + bicicletas.length + " bicis: " + estacion.anclajesLibre()); /** * Caso TEST consultar bicicletas ancladas */ System.out.println("\n **** caso TEST consultar bicicletas ancladas **** \n"); estacion.consultarAnclajes(); /** * Caso TEST retirar bicicleta */ System.out.println("\n **** caso TEST retirar bicicleta **** \n"); TarjetaUsuario tarjetaUsuario = new TarjetaUsuario("000456789", true); System.out.println("¿tarjeta de usuario activada? (true/false): " + estacion.leerTarjetaUsuario(tarjetaUsuario)); estacion.retirarBicicleta(tarjetaUsuario); estacion.consultarAnclajes(); System.out.println("anclajesLibres: " + estacion.anclajesLibre()); /** * Caso TEST tarjeta inactiva */ System.out.println("\n **** caso TEST tarjeta inactiva **** \n"); tarjetaUsuario.setActivada(false); System.out.println("¿tarjeta de usuario activada? (true/false): " + estacion.leerTarjetaUsuario(tarjetaUsuario)); estacion.retirarBicicleta(tarjetaUsuario); estacion.consultarAnclajes(); } }
85213cfc3550be4b6388b7085eb3533a4bc02a3b
d89c8bdd54ebedd3190f8d1bd76e60ec94a37b03
/app/src/main/java/com/example/xueyangzou/sqlapp/MainActivity.java
2ac25de31888b5a86fb4d7ac2ba9c683871911e2
[]
no_license
x124zou/551android
c63746c50a9b7f288fd979db8339219579f50c7e
006982354586ffa31f133d53b12f07ed80de139d
refs/heads/master
2021-01-10T01:16:41.911187
2016-03-16T18:35:36
2016-03-16T18:35:36
54,057,394
0
0
null
null
null
null
UTF-8
Java
false
false
5,479
java
package com.example.xueyangzou.sqlapp; import android.net.Uri; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.view.Menu; import android.view.MenuItem; import android.widget.Button; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.TextView; import android.widget.Toast; import com.google.android.gms.appindexing.Action; import com.google.android.gms.appindexing.AppIndex; import com.google.android.gms.common.api.GoogleApiClient; public class MainActivity extends AppCompatActivity { private static RadioGroup radio_g; private static RadioButton radio_b; private static Button button_search; /** * ATTENTION: This was auto-generated to implement the App Indexing API. * See https://g.co/AppIndexing/AndroidStudio for more information. */ private GoogleApiClient client; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG) .setAction("Action", null).show(); } }); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. client = new GoogleApiClient.Builder(this).addApi(AppIndex.API).build(); onClickListenerButton(); } public void onClickListenerButton() { radio_g = (RadioGroup) findViewById(R.id.rg_restaurants); button_search = (Button) findViewById(R.id.button_search); button_search.setOnClickListener( new View.OnClickListener(){ @Override public void onClick(View v){ int selected_id = radio_g.getCheckedRadioButtonId(); radio_b = (RadioButton) findViewById(selected_id); Toast.makeText(MainActivity.this, radio_b.getText().toString(), Toast.LENGTH_SHORT).show(); /*use radio_b.getText().toString() and upload it into the SQLite db * also, the click of search should start another activity*/ } } ); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @Override public void onStart() { super.onStart(); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. client.connect(); Action viewAction = Action.newAction( Action.TYPE_VIEW, // TODO: choose an action type. "Main Page", // TODO: Define a title for the content shown. // TODO: If you have web page content that matches this app activity's content, // make sure this auto-generated web page URL is correct. // Otherwise, set the URL to null. Uri.parse("http://host/path"), // TODO: Make sure this auto-generated app deep link URI is correct. Uri.parse("android-app://com.example.xueyangzou.sqlapp/http/host/path") ); AppIndex.AppIndexApi.start(client, viewAction); } @Override public void onStop() { super.onStop(); // ATTENTION: This was auto-generated to implement the App Indexing API. // See https://g.co/AppIndexing/AndroidStudio for more information. Action viewAction = Action.newAction( Action.TYPE_VIEW, // TODO: choose an action type. "Main Page", // TODO: Define a title for the content shown. // TODO: If you have web page content that matches this app activity's content, // make sure this auto-generated web page URL is correct. // Otherwise, set the URL to null. Uri.parse("http://host/path"), // TODO: Make sure this auto-generated app deep link URI is correct. Uri.parse("android-app://com.example.xueyangzou.sqlapp/http/host/path") ); AppIndex.AppIndexApi.end(client, viewAction); client.disconnect(); } }
19814cd3941ef6f6122a285d49e3ac867d9feaa8
184eb3780ea8619ee44ebca31d470ef6d1f46a6a
/src/main/java/com/example/demo/jobs/ElasticJobFactory.java
6511894bd257358e43c1b7748f3e2204bf7adba4
[]
no_license
fancky2019/SpringBootProject
f2ffab05f5af805efd74baf5600b602ee26bcd6a
635e74813f45876bfa0764c405598c170440e488
refs/heads/master
2023-08-12T03:48:06.909002
2023-07-22T04:18:21
2023-07-22T04:18:21
162,677,730
0
0
null
2022-06-20T22:46:20
2018-12-21T06:54:06
Java
UTF-8
Java
false
false
2,171
java
package com.example.demo.jobs; import org.apache.shardingsphere.elasticjob.api.JobConfiguration; import org.apache.shardingsphere.elasticjob.infra.listener.ElasticJobListener; import org.apache.shardingsphere.elasticjob.lite.api.bootstrap.impl.ScheduleJobBootstrap; import org.apache.shardingsphere.elasticjob.lite.internal.schedule.JobRegistry; import org.apache.shardingsphere.elasticjob.reg.base.CoordinatorRegistryCenter; import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperConfiguration; import org.apache.shardingsphere.elasticjob.reg.zookeeper.ZookeeperRegistryCenter; import org.apache.shardingsphere.elasticjob.simple.job.SimpleJob; import org.springframework.stereotype.Component; //import sun.reflect.generics.tree.VoidDescriptor; import javax.annotation.Resource; import java.util.TimeZone; @Component public class ElasticJobFactory { @Resource private ZookeeperRegistryCenter registryCenter; // private static class StaticInnerClass{ // private static final ElasticJobFactory instance=new ElasticJobFactory(); // } // // public static ElasticJobFactory getInstance() { // return StaticInnerClass.instance; // } public void setUpSimpleJob(String jobName, String cron) { //jobName 不能重复 new ScheduleJobBootstrap(registryCenter, new NoShardingJob(), JobConfiguration.newBuilder(jobName, 1) .cron(cron).shardingItemParameters("0=Beijing,1=Shanghai,2=Guangzhou").build()).schedule(); } public void updateJob(String jobName, String cron) { JobRegistry.getInstance().getJobScheduleController(jobName).rescheduleJob(cron, TimeZone.getDefault().getID()); } public void shutDownJob(String jobName) { JobRegistry.getInstance().getJobScheduleController(jobName).shutdown(); } // private static CoordinatorRegistryCenter setUpRegistryCenter() { // ZookeeperConfiguration zkConfig = new ZookeeperConfiguration(ZOOKEEPER_CONNECTION_STRING, JOB_NAMESPACE); // CoordinatorRegistryCenter result = new ZookeeperRegistryCenter(zkConfig); // result.init(); // return result; // } }
f0e40d8eb20705f5801a03d461f27ef5a0325bb6
42696694e9a31d684cf4c274d53b2267a34b6d06
/src/main/java/com/github/ddm4j/api/document/config/DocumentConfig.java
69805cf6fdad4b7ed51e63c9549e70780b74a790
[]
no_license
DDM916951890/spring-boot-api-document
319c2ecb5db07a3c68a9c0caa503118c8bb86df1
1421829631741e789987dfd4f0c87a2679ffb589
refs/heads/master
2022-11-20T10:42:26.022845
2020-07-12T03:15:16
2020-07-12T03:15:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,302
java
package com.github.ddm4j.api.document.config; import java.util.HashMap; import java.util.Map; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; import com.github.ddm4j.api.document.config.bean.LoginBean; import com.github.ddm4j.api.document.config.bean.RequestHeaderBean; /** * 文档配置 */ @Component @ConfigurationProperties(prefix = "api-document.document") public class DocumentConfig { // 是否启用 private boolean enable = true; // 扫描路径 private String path; // 前缀 // private String prefix; // 项目名称 private String name; // 项目版本 private String version; // 描述 private String describe; // 登录配置 private LoginBean login; // 请求头配置 private Map<String, RequestHeaderBean> header = new HashMap<String, RequestHeaderBean>(); // 获取统一路径 @Value("${server.servlet.context-path:}") private String contextPath = ""; public boolean isEnable() { return enable; } public void setEnable(boolean enable) { this.enable = enable; } public String getPath() { return path; } public void setPath(String path) { this.path = path; } // public String getPrefix() { // return prefix; // } // // public void setPrefix(String prefix) { // this.prefix = prefix; // } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getVersion() { return version; } public void setVersion(String version) { this.version = version; } public String getDescribe() { return describe; } public void setDescribe(String describe) { this.describe = describe; } public LoginBean getLogin() { return login; } public void setLogin(LoginBean login) { this.login = login; } public String getContextPath() { return contextPath; } public void setContextPath(String contextPath) { this.contextPath = contextPath; } public Map<String, RequestHeaderBean> getHeader() { return header; } public void setHeader(Map<String, RequestHeaderBean> header) { this.header = header; } }
d2eb5e663a39aa389de90658f1499f93389de31d
74bc5c65b984fe13233a6ef29eff1eed631af89d
/Test1/src/Generic/BoundedGenericMethod.java
1e7fdf2469a8e825a900cfa0717fccc42206afec
[]
no_license
hyeonorcle/javaStudy
d0feb91b8b21c87cf9180782b89102dc8a89e203
c04ae9e042d3b0a28c673de8c11a6b2ed9caa62e
refs/heads/master
2020-03-22T23:16:18.492755
2018-07-20T08:33:31
2018-07-20T08:33:31
140,799,889
0
0
null
null
null
null
UTF-8
Java
false
false
745
java
package Generic; /*class Box<T> { private T ob; public void set(T o) { ob = o; } public T get() { return ob; } }*/ class BoxFactory { public static <T extends Number> Box<T> makeBox(T o) { Box<T> box = new Box<T>(); box.set(o); System.out.println("Boxed data: " + o.intValue()); return box; } } class Unboxer { public static <T extends Number> T openBox(Box<T> box) { System.out.println("Unboxed data: "+ box.get().intValue()); return box.get(); } } public class BoundedGenericMethod { public static void main(String[] args) { Box<Integer> sBox = BoxFactory.makeBox(new Integer(5959)); int n = Unboxer.openBox(sBox); System.out.println("Returned data: " + n); } }
[ "User@YD02-08" ]
User@YD02-08
cce311d22621a4c55b3b4a1bcd2a8d1eac63cd44
e129cc3d79473f21a95a4ed0067623a74f53858f
/src/main/java/br/com/rafaelcarvalho/libraryapi/LibraryApiApplication.java
cf5e40ada078a109dbe8fad4e69225ce090c2914
[]
no_license
rafael2911/book-api
e0ee82f0baed6914aa6286dd69271cd12defd73a
199401153fca0ad27b52eb85a9d5d1cb10d3b72d
refs/heads/master
2020-12-21T11:00:08.248718
2020-02-03T01:44:48
2020-02-03T01:44:48
236,410,871
0
0
null
null
null
null
UTF-8
Java
false
false
495
java
package br.com.rafaelcarvalho.libraryapi; import org.modelmapper.ModelMapper; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; @SpringBootApplication public class LibraryApiApplication { @Bean public ModelMapper modelMapper(){ return new ModelMapper(); } public static void main(String[] args) { SpringApplication.run(LibraryApiApplication.class, args); } }
341e206876a37ee0ec16c317c2481a59b33287ac
0b7fd8738088bd93403a005ecf9ea65da4d93259
/src/main/java/tonegod/gui/controls/extras/emitter/ImpulseInfluencer.java
847e4e88a77c91cc06e38530c4c78dce250f037c
[ "BSD-2-Clause-Views" ]
permissive
repetti/jmegui
0b4fef68caadc6d6215cbe3222a5310961091e71
598a2f6bfc5797ef12499108eb31c771d06fadd9
refs/heads/master
2020-05-28T09:42:22.090479
2015-04-12T21:39:55
2015-04-12T21:39:55
33,828,306
0
0
null
null
null
null
UTF-8
Java
false
false
1,564
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package tonegod.gui.controls.extras.emitter; import com.jme3.math.FastMath; import com.jme3.math.Vector2f; import tonegod.gui.controls.extras.emitter.ElementEmitter.ElementParticle; /** * * @author t0neg0d */ public class ImpulseInfluencer extends InfluencerBase { private boolean isEnabled = true; private Vector2f temp = new Vector2f(); private Vector2f temp2 = new Vector2f(); private float variationStrength = 0.35f; public ImpulseInfluencer(ElementEmitter emitter) { super(emitter); } @Override public void update(ElementParticle particle, float tpf) { if (isEnabled) { float incX = FastMath.nextRandomFloat(); if (FastMath.rand.nextBoolean()) incX = -incX; float incY = FastMath.nextRandomFloat(); if (FastMath.rand.nextBoolean()) incY = -incY; temp.set(particle.velocity).addLocal(incX, incY); particle.velocity.interpolate(temp, (variationStrength)); } } @Override public void initialize(ElementParticle particle) { } @Override public boolean getIsEnabled() { return this.isEnabled; } @Override public void setIsEnabled(boolean isEnabled) { this.isEnabled = isEnabled; } public void setVariationStrength(float variationStrength) { this.variationStrength = variationStrength; } @Override public ImpulseInfluencer clone() { ImpulseInfluencer clone = new ImpulseInfluencer(emitter); clone.setVariationStrength(variationStrength); clone.setIsEnabled(isEnabled); return clone; } }
26ed2e1dfc43894aed0b78eb3e6181f14e213a53
5f14a75cb6b80e5c663daa6f7a36001c9c9b778c
/src/com/ubercab/payment/internal/vendor/baidu/BaiduApi.java
3a75f4af7f181364775a99cdb77fa1d089b94ce3
[]
no_license
MaTriXy/com.ubercab
37b6f6d3844e6a63dc4c94f8b6ba6bb4eb0118fb
ccd296d27e0ecf5ccb46147e8ec8fb70d2024b2c
refs/heads/master
2021-01-22T11:16:39.511861
2016-03-19T20:58:25
2016-03-19T20:58:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
568
java
package com.ubercab.payment.internal.vendor.baidu; import com.ubercab.payment.internal.vendor.baidu.model.AuthorizationDetails; import retrofit.Callback; import retrofit.http.GET; import retrofit.http.Query; abstract interface BaiduApi { @GET("/rt/riders/baidu-wallet/connect") public abstract void getAuthorizationDetails(@Query("pageUrl") String paramString, Callback<AuthorizationDetails> paramCallback); } /* Location: * Qualified Name: com.ubercab.payment.internal.vendor.baidu.BaiduApi * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
d0b97be92c90e4dd2db61e44f7f24c42fdbe06a5
d1ea794384b809075a4a3395cddf90a8ab514f51
/src/bank/model/CheckingAccount.java
6ff7d11cb2357d302ee1548606e1377bb03aba3f
[]
no_license
gfasil/Finco
09d186823f78e7388eae8297fcb4dbf91ee85700
4bcc395b69ca4427b262bfa726cf3b8e21995720
refs/heads/master
2020-11-25T03:29:10.931110
2019-12-19T17:29:16
2019-12-19T17:29:16
228,481,124
0
1
null
2019-12-17T22:48:08
2019-12-16T21:43:20
Java
UTF-8
Java
false
false
393
java
package bank.model; import framework.model.AbstractAccount; import framework.model.ICustomer; public class CheckingAccount extends AbstractAccount { public CheckingAccount(ICustomer owner) { super(owner); } @Override public double getInterest() { return 0.00967; } @Override public String getType() { return "CheckingAccount"; } }
5c1a9df27d6173d11f474b0720506336419b2b8f
07d17b649f6e3d6816806a408024b25ef2936854
/src/main/java/com/example/demo/Instructor.java
8e55b8bfc292b244168acce8d9e5c5a8d230cfbb
[]
no_license
long-stephen-michael/SpringClassroom
021a21581870598d94d50668483448a4a53b8a4b
d7ad3837ddde10d3df6c9a31aa27e5061cfce915
refs/heads/main
2023-01-05T22:34:02.749673
2020-11-02T02:29:36
2020-11-02T02:29:36
309,224,601
0
0
null
2020-11-02T01:15:20
2020-11-02T01:15:19
null
UTF-8
Java
false
false
678
java
package com.example.demo; public class Instructor extends Person implements Teacher{ Instructor(long id, String name) { super(id, name); // TODO Auto-generated constructor stub } public static void main(String[] args) { // TODO Auto-generated method stub } @Override public void teach(Learner learner, double numberOfHours) { // TODO Auto-generated method stub } @Override public void lecture(Iterable<? extends Learner> learners, double numberOfHours) { // TODO Auto-generated method stub //double numberOfHoursPerLearner = numberOfHours / learners.length; } public static int size() { // TODO Auto-generated method stub return 0; } }
6d5a024d361845fa52a1f4ccade2d847562ba363
45a4ca5915fbed0cf63cedd5ac65b33bbea324df
/LinkedList/src/Nodo.java
bca17409f91c682304d1f6ae075d81d897d3be49
[]
no_license
Andxtorres/Estructura-de-Datos-Enero-2018
a742e3a83b25c4831205225ee0905f5a67128c17
7fc91e26a88687151429bf2e8c7ce8bf9311d676
refs/heads/master
2021-04-24T19:14:16.290925
2018-05-07T21:02:38
2018-05-07T21:02:38
117,579,701
2
1
null
null
null
null
UTF-8
Java
false
false
386
java
public class Nodo<T> { private T elemento; private Nodo<T> siguiente; public Nodo(T elemento){ this.elemento=elemento; } public T getElemento() { return elemento; } public void setElemento(T elemento) { this.elemento = elemento; } public Nodo<T> getSiguiente() { return siguiente; } public void setSiguiente(Nodo<T> siguiente) { this.siguiente = siguiente; } }
b017427ec7f2970d42d571aecd5e24a8fff7e87a
881dc9478bd27f7621515b454343e70bd1aa4ee5
/ecomerce/ecomerce/src/main/java/br/com/unialfa/ecomerce/produto/repository/ProdutoRepository.java
3834090297fdd4abc1eb8b1391003dae6ffe12bc
[]
no_license
VictorMachado38/dev-para-internet
feeca9d00c2d799b0b9c1d53bc0a71678cc62dc4
4ab443d062a738dba0c26ad255131ae4baae9951
refs/heads/master
2023-07-04T18:51:34.780471
2021-08-27T16:05:43
2021-08-27T16:05:43
349,587,778
0
0
null
null
null
null
UTF-8
Java
false
false
244
java
package br.com.unialfa.ecomerce.produto.repository; import br.com.unialfa.ecomerce.produto.domain.Produto; import org.springframework.data.repository.CrudRepository; public interface ProdutoRepository extends CrudRepository<Produto,Long> { }
bef6718bcc50d89c5a3866d1ffbf91d5d48a7c7c
cef342c3b590b48a9f9b495dc2036b1d75314601
/app/src/main/java/daniele/iterinteractive/it/discoverpalermo/util/SystemUiHiderBase.java
a4790aa2be299d1e6d3328862e1dd4160ec76954
[]
no_license
danielemontemaggiore/iterinteractive
e6433a8b2bbf9e230e37aea489d29db3784b0bd4
c40fd97a5c17c65b1a3e8768ae21bb4a6f3d3ef7
refs/heads/master
2020-04-05T14:36:29.206845
2016-08-31T07:56:05
2016-08-31T07:56:05
59,473,553
0
0
null
null
null
null
UTF-8
Java
false
false
2,037
java
package daniele.iterinteractive.it.discoverpalermo.util; import android.app.Activity; import android.view.View; import android.view.WindowManager; /** * A base implementation of {@link SystemUiHider}. Uses APIs available in all * API levels to show and hide the status bar. */ public class SystemUiHiderBase extends SystemUiHider { /** * Whether or not the system UI is currently visible. This is a cached value * from calls to {@link #hide()} and {@link #show()}. */ private boolean mVisible = true; /** * Constructor not intended to be called by clients. Use * {@link SystemUiHider#getInstance} to obtain an instance. */ protected SystemUiHiderBase(Activity activity, View anchorView, int flags) { super(activity, anchorView, flags); } @Override public void setup() { if ((mFlags & FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES) == 0) { mActivity.getWindow().setFlags( WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } } @Override public boolean isVisible() { return mVisible; } @Override public void hide() { if ((mFlags & FLAG_FULLSCREEN) != 0) { mActivity.getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); } mOnVisibilityChangeListener.onVisibilityChange(false); mVisible = false; } @Override public void show() { if ((mFlags & FLAG_FULLSCREEN) != 0) { mActivity.getWindow().setFlags( 0, WindowManager.LayoutParams.FLAG_FULLSCREEN); } mOnVisibilityChangeListener.onVisibilityChange(true); mVisible = true; } }
bcd59a6437c0925faae44b02db63253deb4003af
0ad51dde288a43c8c2216de5aedcd228e93590ac
/src/com/vmware/converter/ConverterInvalidTargetProductVersion.java
c0aef0f0f9be67310f994e18f5264ebec2eaab7f
[]
no_license
YujiEda/converter-sdk-java
61c37b2642f3a9305f2d3d5851c788b1f3c2a65f
bcd6e09d019d38b168a9daa1471c8e966222753d
refs/heads/master
2020-04-03T09:33:38.339152
2019-02-11T15:19:04
2019-02-11T15:19:04
155,151,917
0
0
null
null
null
null
UTF-8
Java
false
false
4,684
java
/** * ConverterInvalidTargetProductVersion.java * * This file was auto-generated from WSDL * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. */ package com.vmware.converter; public class ConverterInvalidTargetProductVersion extends com.vmware.converter.ConverterConverterFault implements java.io.Serializable { private java.lang.String targetProductVersion; public ConverterInvalidTargetProductVersion() { } public ConverterInvalidTargetProductVersion( com.vmware.converter.LocalizedMethodFault faultCause, com.vmware.converter.LocalizableMessage[] faultMessage, java.lang.String targetProductVersion) { super( faultCause, faultMessage); this.targetProductVersion = targetProductVersion; } /** * Gets the targetProductVersion value for this ConverterInvalidTargetProductVersion. * * @return targetProductVersion */ public java.lang.String getTargetProductVersion() { return targetProductVersion; } /** * Sets the targetProductVersion value for this ConverterInvalidTargetProductVersion. * * @param targetProductVersion */ public void setTargetProductVersion(java.lang.String targetProductVersion) { this.targetProductVersion = targetProductVersion; } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof ConverterInvalidTargetProductVersion)) return false; ConverterInvalidTargetProductVersion other = (ConverterInvalidTargetProductVersion) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = super.equals(obj) && ((this.targetProductVersion==null && other.getTargetProductVersion()==null) || (this.targetProductVersion!=null && this.targetProductVersion.equals(other.getTargetProductVersion()))); __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = super.hashCode(); if (getTargetProductVersion() != null) { _hashCode += getTargetProductVersion().hashCode(); } __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(ConverterInvalidTargetProductVersion.class, true); static { typeDesc.setXmlType(new javax.xml.namespace.QName("urn:converter", "ConverterInvalidTargetProductVersion")); org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc(); elemField.setFieldName("targetProductVersion"); elemField.setXmlName(new javax.xml.namespace.QName("urn:converter", "targetProductVersion")); elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string")); elemField.setNillable(false); typeDesc.addFieldDesc(elemField); } /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } /** * Get Custom Serializer */ public static org.apache.axis.encoding.Serializer getSerializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanSerializer( _javaType, _xmlType, typeDesc); } /** * Get Custom Deserializer */ public static org.apache.axis.encoding.Deserializer getDeserializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanDeserializer( _javaType, _xmlType, typeDesc); } /** * Writes the exception data to the faultDetails */ public void writeDetails(javax.xml.namespace.QName qname, org.apache.axis.encoding.SerializationContext context) throws java.io.IOException { context.serialize(qname, null, this); } }
81706ab35edbb62c9fc6ae0f49cf1e9a549ff2a0
1578433be82bd9b09636b2681d84eaba232fd3a5
/mainmenu/src/main/java/jankowiak/kamil/mainmenu/App.java
1734af368f54b8439f5079d7b4e16150c819d987
[]
no_license
kjdeveloper/SimpleShoppingManagement
65b3b7625683da023f37bc0431cac331b64d5ec9
35540e25809ab728f00cc268fa0277be081c508e
refs/heads/master
2022-05-30T04:50:02.302434
2019-06-05T15:02:55
2019-06-05T15:02:55
189,732,417
0
0
null
null
null
null
UTF-8
Java
false
false
703
java
package jankowiak.kamil.mainmenu; import jankowiak.kamil.mainmenu.menu.MenuService; public class App { public static void main(String[] args) { /*DataGeneratorService dataGeneratorService = new DataGeneratorService(); dataGeneratorService.saveToFile("C:\\Programowanie\\ShoppingManagementFinal\\persistence\\src\\main\\java\\jankowiak\\kamil\\persistence\\resources\\shoppingManagementOrderList.json");*/ var filename = "C:\\Users\\Admin\\Desktop\\Git\\ShoppingManagement\\persistence\\src\\main\\java\\jankowiak\\kamil\\persistence\\resources\\shoppingManagementOrderList.json"; var menuService = new MenuService(filename); menuService.mainMenu(); } }
4f0b69b86c4b9824abf14ab929730fca1d075e1a
3d846bff897cfeae52c2fc29ee6725d3c098c3c2
/src/com/tsekhanovich/functional/practice6/Task2.java
76756f5aa2fdcf8a3f0997e975d6fc46933d0c3a
[]
no_license
PavelTsekhanovich/JavaFunctional
2f250ab3d90472e7473fb6d697ca42443e6f9f37
a33a281ac0a062d2f9f21de5095b1c0fb38dad35
refs/heads/master
2021-06-26T03:25:24.471267
2020-10-21T14:19:09
2020-10-21T14:19:09
157,601,666
0
0
null
null
null
null
UTF-8
Java
false
false
892
java
package com.tsekhanovich.functional.practice6; import java.util.function.Function; /** * @author Pavel Tsekhanovcih 10.11.2018 * <p> * Using closure write a lambda expression that adds prefix (before) and suffix (after) to its single string argument; * prefix and suffix are final variables and will be available in the context during testing. * All whitespaces on the both ends of the argument must be removed. Do not trim prefix, suffix and the result string. * Solution format. Submit your lambda expression in any valid format with ; on the end. * <p> * Examples: (x, y) -> x + y; (x, y) -> { return x + y; } */ public class Task2 { public static void main(String[] args) { String prefix = "<"; String suffix = ">"; Function<String, String> example1 = s -> prefix + s.trim() + suffix; System.out.println(example1.apply("Test")); } }
c703e859c69c993e2fe80747811bfb577cb62cea
b0b7dd4867f90f50c2299fb4da3c9d318441e7a8
/takinmq-jafka/src/main/java/io/jafka/mx/ServerInfoMBean.java
572926ce2d19f22e7500a9f2caba2cbceed2949a
[ "Apache-2.0" ]
permissive
lemonJun/TakinMQ
a0a5e9d0ecf5e5afdfaa1e3e03ee96b0791df57b
dcb26f95737e023698ddef46ba2c12ba77001e8c
refs/heads/master
2021-01-22T02:39:49.302258
2017-06-15T03:26:22
2017-06-15T03:26:22
81,061,837
0
1
null
null
null
null
UTF-8
Java
false
false
1,065
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 io.jafka.mx; /** * Server information * @author adyliu ([email protected]) * @since 1.1 */ public interface ServerInfoMBean { String getVersion(); String getStartupTime(); String getStartedTime(); String getRunningTime(); }
4939bfcf2434b716e2a77965cedd93b45855e904
cd1ca0766bb062935fa7af416620ad3b95f6971b
/演示代码备份/第4章 Hibernate框架/HibernateHQL/src/dps/test/hibernateTest.java
253af87d3be1c35c7ad129807d35c6bc57d93883
[]
no_license
CXH2015/ppt_code
a0deecaa726fc891daca4f382e40fb08e6ce8421
02dada29e9cfa96036a353736f87cd6a6675cc4e
refs/heads/master
2021-07-25T09:04:42.155926
2017-11-07T12:16:19
2017-11-07T12:16:19
109,831,161
0
0
null
null
null
null
UTF-8
Java
false
false
2,327
java
package dps.test; import java.util.Date; import java.util.HashSet; import java.util.List; import java.util.Set; import org.hibernate.Session; import org.hibernate.Transaction; import dps.bean.MyClass; import dps.bean.Student; import dps.util.HibernateSessionFactory; public class hibernateTest { /** * @param args */ public static void main(String[] args) { hibernateTest test = new hibernateTest(); test.OpHqlTest2(); } //使用HQL查询年龄小于21岁的学生记录--位置参数 public void OpHqlTest() { Session session = HibernateSessionFactory.getSession(); String strHQl = "from Student s where s.sage<? "; List<Student> myList = session.createQuery(strHQl).setParameter(0, 21).list(); for(Student s:myList) { System.out.println(s); } HibernateSessionFactory.closeSession(); } //使用HQL查询年龄小于21岁的学生记录--命名参数 public void OpHqlTest2() { Session session = HibernateSessionFactory.getSession(); String strHQl = "from Student s where s.sage<:age "; List<Student> myList = session.createQuery(strHQl).setParameter("age", 21).list(); for(Student s:myList) { System.out.println(s); } HibernateSessionFactory.closeSession(); } //向数据库中添加记录 public void OpAdd() { Session session = HibernateSessionFactory.getSession(); Transaction tx = session.beginTransaction(); Student s1 = new Student("2014123001", "学生1", 20, new Date()); Student s2 = new Student("2014123002", "学生2", 19, new Date()); Student s3 = new Student("2014123003", "学生3", 21, new Date()); Student s4 = new Student("2014123004", "学生4", 20, new Date()); Student s5 = new Student("2014123005", "学生5", 24, new Date()); Student s6 = new Student("2014123006", "学生6", 20, new Date()); Student s7 = new Student("2014123007", "学生7", 22, new Date()); MyClass myClass = new MyClass("2014Java专业 "); s1.setMyClass(myClass); s2.setMyClass(myClass); s3.setMyClass(myClass); s4.setMyClass(myClass); s5.setMyClass(myClass); s6.setMyClass(myClass); s7.setMyClass(myClass); session.save(s1); session.save(s2); session.save(s3); session.save(s4); session.save(s5); session.save(s6); session.save(s7); tx.commit(); HibernateSessionFactory.closeSession(); } }
b9cc8c14804f46f6e5ad561afaed0dce56226dc6
3da7df7f993ed58a607f983ef6fdbabb895df4b1
/mypush-im-route/src/main/java/com/lyh/route/config/RedisConfig.java
80e59b93f2e3603d53b56629a4bcda9b16f48703
[]
no_license
lyhixx/mypush
3b14990479a669600312b8390ea0f6910caf0191
5772f93f767c2e46c62385f3e71c24ea20d1999b
refs/heads/master
2023-08-08T05:13:08.690182
2019-09-19T07:15:47
2019-09-19T07:15:47
201,185,865
2
1
null
2023-07-22T13:00:50
2019-08-08T05:40:34
Java
UTF-8
Java
false
false
2,122
java
package com.lyh.route.config; import org.redisson.Redisson; import org.redisson.api.RedissonClient; import org.redisson.config.Config; import org.redisson.config.SingleServerConfig; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; import com.axdoctor.tools.redis.RedisPool; import com.axdoctor.tools.redis.RedisUtil; import com.lyh.common.cache.redis.ServerNodeCache; import com.lyh.common.cache.redis.UserTokenCache; @Component @PropertySource(value= "classpath:/application.properties") public class RedisConfig { @Value("${redis.host}") public String redisHost; public RedisPool redisPool(){ RedisPool redisPool = new RedisPool(); redisPool.setServerHostMaster(redisHost); redisPool.init(); return redisPool; } @Bean("redisUtil") public RedisUtil redisUtil(){ RedisUtil redisUtil = new RedisUtil(); redisUtil.setJedisPool(redisPool()); return redisUtil; } @Bean("redissonClient") public RedissonClient redissonClient() { Config config = new Config(); SingleServerConfig singleServerConfig = config.useSingleServer(); // String schema = "redis://"; singleServerConfig.setAddress(redisHost + ":" + 6379); singleServerConfig.setConnectionPoolSize(10); // 其他配置项都先采用默认值 return Redisson.create(config); } @Bean("serverNodeCache") public ServerNodeCache serverNodeCache(RedisUtil redisUtil,RedissonClient redissonClient){ ServerNodeCache serverNodeCache = new ServerNodeCache(); serverNodeCache.setRedisUtil(redisUtil); serverNodeCache.setRedissonClient(redissonClient); serverNodeCache.init(); return serverNodeCache; } @Bean("userTokenCache") public UserTokenCache userTokenCache(RedisUtil redisUtil,ServerNodeCache serverNodeCache){ UserTokenCache userTokenCache = new UserTokenCache(); userTokenCache.setRedisUtil(redisUtil); userTokenCache.setServerNodeCache(serverNodeCache); return userTokenCache; } }
647e4a29a7a76b0ab45a4d08c249fcc7dd081422
8eeee50505f6515a74a37323eb444225b52489af
/src/test/java/com/app/up/Aes256EncryptionServiceApplicationTests.java
93861775bd938205907d04dff087c433bf3e01d1
[]
no_license
pratikw1859/AES-256-Encryption-Service
7e52f7ad815cc04500f146f5d8d4e07af3d74e16
2e819ccf93e11dd9bc76ea9d70af58743d947749
refs/heads/master
2021-01-26T03:36:05.636009
2020-02-27T03:39:49
2020-02-27T03:39:49
243,292,431
0
0
null
null
null
null
UTF-8
Java
false
false
219
java
package com.app.up; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class Aes256EncryptionServiceApplicationTests { @Test void contextLoads() { } }
12f791bc3ff49050c6498adcaf498055daf1fad0
129f58086770fc74c171e9c1edfd63b4257210f3
/src/testcases/CWE80_XSS/CWE80_XSS__CWE182_getCookies_Servlet_06.java
701dd8ffedbc1bb13e8ebdaa67ebe69744d589b5
[]
no_license
glopezGitHub/Android23
1bd0b6a6c7ce3c7439a74f1e4dcef2c4c0fac4ba
6215d0684c4fbdc7217ccfbedfccfca69824cc5e
refs/heads/master
2023-03-07T15:14:59.447795
2023-02-06T13:59:49
2023-02-06T13:59:49
6,856,387
0
3
null
2023-02-06T18:38:17
2012-11-25T22:04:23
Java
UTF-8
Java
false
false
5,380
java
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE80_XSS__CWE182_getCookies_Servlet_06.java Label Definition File: CWE80_XSS__CWE182.label.xml Template File: sources-sink-06.tmpl.java */ /* * @description * CWE: 80 Cross Site Scripting (XSS) * BadSource: getCookies_Servlet Read data from the first cookie using getCookies() * GoodSource: A hardcoded string * BadSink: Display of data in web page after using replaceAll() to remove script tags, which will still allow XSS (CWE 182: Collapse of Data into Unsafe Value) * Flow Variant: 06 Control flow: if(private_final_five==5) and if(private_final_five!=5) * * */ package testcases.CWE80_XSS; import testcasesupport.*; import javax.servlet.http.*; import javax.servlet.http.*; public class CWE80_XSS__CWE182_getCookies_Servlet_06 extends AbstractTestCaseServlet { /* The variable below is declared "final", so a tool should be able to identify that reads of this will always give its initialized value. */ private final int private_final_five = 5; /* uses badsource and badsink */ public void bad(HttpServletRequest request, HttpServletResponse response) throws Throwable { String data; if(private_final_five == 5) { data = ""; /* initialize data in case there are no cookies */ /* Read data from cookies */ { Cookie cookieSources[] = request.getCookies(); if (cookieSources != null) { /* POTENTIAL FLAW: Read data from the first cookie value */ data = cookieSources[0].getValue(); } } } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ /* FIX: Use a hardcoded string */ data = "foo"; } if (data != null) { /* POTENTIAL FLAW: Display of data in web page after using replaceAll() to remove script tags, which will still allow XSS with strings like <scr<script>ipt> (CWE 182: Collapse of Data into Unsafe Value) */ response.getWriter().println("<br>bad(): data = " + data.replaceAll("(<script>)", "")); } } /* goodG2B1() - use goodsource and badsink by changing private_final_five==5 to private_final_five!=5 */ private void goodG2B1(HttpServletRequest request, HttpServletResponse response) throws Throwable { String data; if(private_final_five != 5) { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ data = ""; /* initialize data in case there are no cookies */ /* Read data from cookies */ { Cookie cookieSources[] = request.getCookies(); if (cookieSources != null) { /* POTENTIAL FLAW: Read data from the first cookie value */ data = cookieSources[0].getValue(); } } } else { /* FIX: Use a hardcoded string */ data = "foo"; } if (data != null) { /* POTENTIAL FLAW: Display of data in web page after using replaceAll() to remove script tags, which will still allow XSS with strings like <scr<script>ipt> (CWE 182: Collapse of Data into Unsafe Value) */ response.getWriter().println("<br>bad(): data = " + data.replaceAll("(<script>)", "")); } } /* goodG2B2() - use goodsource and badsink by reversing statements in if */ private void goodG2B2(HttpServletRequest request, HttpServletResponse response) throws Throwable { String data; if(private_final_five == 5) { /* FIX: Use a hardcoded string */ data = "foo"; } else { /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */ data = ""; /* initialize data in case there are no cookies */ /* Read data from cookies */ { Cookie cookieSources[] = request.getCookies(); if (cookieSources != null) { /* POTENTIAL FLAW: Read data from the first cookie value */ data = cookieSources[0].getValue(); } } } if (data != null) { /* POTENTIAL FLAW: Display of data in web page after using replaceAll() to remove script tags, which will still allow XSS with strings like <scr<script>ipt> (CWE 182: Collapse of Data into Unsafe Value) */ response.getWriter().println("<br>bad(): data = " + data.replaceAll("(<script>)", "")); } } public void good(HttpServletRequest request, HttpServletResponse response) throws Throwable { goodG2B1(request, response); goodG2B2(request, response); } /* Below is the main(). It is only used when building this testcase on its own for testing or for building a binary to use in testing binary analysis tools. It is not used when compiling all the testcases as one application, which is how source code analysis tools are tested. */ public static void main(String[] args) throws ClassNotFoundException, InstantiationException, IllegalAccessException { mainFromParent(args); } }
cecd538cf4c8bcd2d4c446be5591fd4d140fd93c
8da943247ff17374c7ff916f99c28897c8abc269
/src/main/java/com/qa/todo/ToDoListApiApplication.java
4a3d175c22463ee1eef2ebfa0284125c639d108e
[]
no_license
JHarry444/To-Do-List-API
1cb09bb1f612008d905f3e20149ed59ce98d4834
47c8549dc965cad0973fb0438bb7f3ea634f42c5
refs/heads/master
2020-06-27T17:27:22.586545
2019-08-01T08:28:45
2019-08-01T08:28:45
200,008,396
0
0
null
2019-08-22T09:27:16
2019-08-01T08:18:27
Java
UTF-8
Java
false
false
314
java
package com.qa.todo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ToDoListApiApplication { public static void main(String[] args) { SpringApplication.run(ToDoListApiApplication.class, args); } }
d7e47d19a3fc2a25c153a4330c4a00df04df646b
12e8f5460a8a25d5f431d6695cfdd9614af556f8
/src/pl/projectspace/idea/plugins/php/phpspec/core/PhpSpecDescribedClass.java
ff1da7fe96f0eb2d6729e8a04b9d60c3610e9529
[]
no_license
samrastin/phpstorm-phpspec
6f32dad22d277aeb0bab6281bdf024234387a1a8
a0f3b4de4149c0903f8f4d78a83b8cec431eed2e
refs/heads/master
2021-01-14T12:35:32.536435
2016-01-07T18:11:43
2016-01-07T18:11:43
49,221,506
0
0
null
2016-01-07T18:08:59
2016-01-07T18:08:58
Java
UTF-8
Java
false
false
1,288
java
package pl.projectspace.idea.plugins.php.phpspec.core; import com.jetbrains.php.lang.psi.elements.PhpClass; import pl.projectspace.idea.plugins.commons.php.psi.element.PhpClassDecorator; import pl.projectspace.idea.plugins.commons.php.psi.exceptions.MissingElementException; import pl.projectspace.idea.plugins.php.phpspec.PhpSpecProject; import pl.projectspace.idea.plugins.php.phpspec.core.services.PhpSpecLocator; import pl.projectspace.idea.plugins.php.phpspec.core.services.PsiTreeUtils; /** * @author Michal Przytulski <[email protected]> */ public class PhpSpecDescribedClass extends PhpSpecClassDecorator { protected PhpSpecClass spec = null; public PhpSpecDescribedClass(PhpClass phpClass) { super(phpClass); } @Override public boolean hasRelatedClass() { try { getSpec(); return true; } catch (MissingElementException e) { return false; } } public PhpSpecClass getSpecClass() throws MissingElementException { return getSpec(); } protected PhpSpecClass getSpec() throws MissingElementException { if (spec == null) { spec = getService(PhpSpecLocator.class).locateSpecFor(getDecoratedObject()); } return spec; } }
71c0bc02234f95d564bad4b60d59d7b7bba88d53
1d5523f7ed838c0b628b8f05a7c7b79b13f44dae
/surefire-integration-tests/src/test/resources/fork-mode/src/test/java/forkMode/Test3.java
deb9296b5d9e761ad3b7185b94c8c51ca50eb347
[]
no_license
atlassian/maven-surefire
7afb81bb31581ab93b9c29f25c3707b190e634a2
c033855a81a1412aefcc86ea4f212de15bec0e64
refs/heads/trunk
2023-08-24T07:59:39.795919
2020-05-10T21:14:05
2020-05-10T21:14:05
1,638,122
0
6
null
2023-04-04T01:40:59
2011-04-19T23:37:13
Java
UTF-8
Java
false
false
212
java
package forkMode; import java.io.IOException; import junit.framework.TestCase; public class Test3 extends TestCase { public void test3() throws IOException { Test1.dumpPidFile(this); } }
8da8d7781b68aff5ec66c70539cfadba3bd78caa
f86938ea6307bf6d1d89a07b5b5f9e360673d9b8
/CodeComment_Data/Code_Jam/val/Revenge_of_the_Pancakes/S/pancakes(147).java
d8e4ff1277f1407f338068c569c805bbcab22aa3
[]
no_license
yxh-y/code_comment_generation
8367b355195a8828a27aac92b3c738564587d36f
2c7bec36dd0c397eb51ee5bd77c94fa9689575fa
refs/heads/master
2021-09-28T18:52:40.660282
2018-11-19T14:54:56
2018-11-19T14:54:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,604
java
package methodEmbedding.Revenge_of_the_Pancakes.S.LYD798; //DANIEL YANG CODEJAM import java.util.*; import java.math.*; import java.io.*; import java.lang.*; public class pancakes{ public static void main(String args[]) throws IOException { BufferedReader f = new BufferedReader(new FileReader("pancakes.in")); PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter("pancakes.out"))); StringTokenizer st = new StringTokenizer(f.readLine()); int N = Integer.parseInt(st.nextToken()); String temp, x; int caseNum = 1; int result = 0; for(int z = 0; z < N; z++) { temp = f.readLine(); //System.out.println(temp); for(int i = temp.length()-1; i >= 0; i--)//if last character is +/- { if(temp.charAt(i) == '+') continue; else { for(int k = 0; k <= i; k++)//flips pancake { if(temp.charAt(k) == '+') x = temp.substring(0, k) + "-" + temp.substring(k+1); else x = temp.substring(0, k) + "+" + temp.substring(k+1); //System.out.println(temp.substring(0, k)+ " " + temp.substring(k+1)); temp = x; // System.out.println(temp); } } result ++; } out.println("Case #" + caseNum + ": " + result); caseNum++; result = 0; } out.close(); } }
25c1ea17faaabfc3ce068b319d4161bdbf2dbcb5
5d180276957df094f09ee511e05786316537f25d
/src/main/java/aspectj/example02/HelloWorld.java
2708e92391e3f0ab582c0bb7a0ff3366cdab8423
[ "Apache-2.0" ]
permissive
SomberOfShadow/Local
f727189f1791de203f1efd5cd76b8f241857e473
474e71024f72af5adf65180e5468de19ad5fdfd8
refs/heads/main
2023-07-18T04:11:49.240683
2021-09-07T15:55:28
2021-09-07T15:55:28
389,494,221
0
0
null
null
null
null
UTF-8
Java
false
false
184
java
package aspectj.example02; public class HelloWorld implements HelloWorldInterface { @Override public void sayHello() { System.out.println("Hello, World!"); } }
545f75533ca5dc12280af8929b337e52f25c4c0d
ca313720181e65d33d2756e58877f0287586452a
/Intro to Computer Networks /Project3/RequestDecoder.java
d984579b2a310cad363a5aca67232196c0d2c539
[]
no_license
ljyjl/Auburn-University
cb0eeab76570bff0b0c65ce5e03442cdbd9ba3ff
3fb3378a06e91cf294a9b90aad950a41b22e679b
refs/heads/master
2023-01-23T04:52:11.992939
2020-11-30T02:16:26
2020-11-30T02:16:26
315,834,525
0
0
null
null
null
null
UTF-8
Java
false
false
255
java
import java.io.*; // for InputStream and IOException import java.net.*; // for DatagramPacket public interface RequestDecoder { Request decode(InputStream source) throws IOException; Request decode(DatagramPacket packet) throws IOException; }
697205a324e444e702bba7fc83d989a36b0c9908
dfb7ea27499fadfb14989be3601e10dc39608dcf
/web/src/main/java/com/hpd/butler/web/SysDictTypeController.java
3e10c9a2c7d4ffb2b38253bbeceebcf43e2409d2
[]
no_license
monkekey/monkekey
2314106881e9a62c1289c7606f78ec2779ab2b29
85515f013e54682acddcf6803fd8955d5047a59a
refs/heads/master
2020-03-14T00:41:43.488385
2018-05-17T03:59:54
2018-05-17T03:59:54
131,362,005
0
0
null
null
null
null
UTF-8
Java
false
false
4,915
java
package com.hpd.butler.web; import com.hpd.butler.common.RequestResult; import com.hpd.butler.constant.CommonFlag; import com.hpd.butler.domain.ISCategoryRepository; import com.hpd.butler.domain.SCategory; import com.hpd.butler.utils.HeaderUtils; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Sort; import org.springframework.data.jpa.repository.Modifying; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; import javax.validation.constraints.NotNull; import java.util.Date; /** * Created by zy on 2018/2/6. */ @RestController @RequestMapping("/sys/dicttype") @Api(value = "SysDictTypeController", description = "字典类型相关接口") public class SysDictTypeController { @Autowired private ISCategoryRepository isCategoryRepository; @ApiOperation(value = "SysDictType|列表") @GetMapping("") public RequestResult getAll(@RequestParam(value = "pageIdx", required = false, defaultValue = "0") Integer pageIdx, @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize, @RequestParam(value = "keywords") String keywords){ PageRequest pageRequest= new PageRequest(pageIdx, pageSize, Sort.Direction.ASC, "id"); Page<SCategory> sCategoryPage = null; if(keywords != null && !keywords.equals("")){ sCategoryPage = isCategoryRepository.findByCategoryNameContainingAndFlag(keywords,pageRequest,CommonFlag.VALID.getValue()); }else{ sCategoryPage = isCategoryRepository.findByFlag(pageRequest, CommonFlag.VALID.getValue()); } return RequestResult.success(sCategoryPage); } @ApiOperation(value = "All SysDictType|列表") @GetMapping("/all") public RequestResult getAllDictType(){ return RequestResult.success(isCategoryRepository.findByFlag(CommonFlag.VALID.getValue())); } @ApiOperation(value = "SysDictType|详情") @GetMapping("/{dtid}") public RequestResult getDictType(@NotNull @PathVariable("dtid") long dtid) { SCategory sCategory = isCategoryRepository.findOne(dtid); if(null == sCategory){ return RequestResult.fail("无法获取记录"); } return RequestResult.success(sCategory); } @ApiOperation(value = "新增|SysDictType") @PostMapping("") @Transactional public RequestResult add(@RequestBody SCategory sCategory){ //Authorization:Bearer + " " + token sCategory.setCategoryCode("CG"+new Date().getTime()); sCategory.setCategoryCrateby(HeaderUtils.getCurrentUser()); sCategory.setCategoryCratetime(new Date()); sCategory.setCategoryLastby(HeaderUtils.getCurrentUser()); sCategory.setCategoryLasttime(new Date()); sCategory.setFlag(CommonFlag.VALID.getValue()); sCategory = isCategoryRepository.saveAndFlush(sCategory); return RequestResult.success(sCategory); } @ApiOperation(value = "更新|SysDictType") @RequestMapping(value = "/{sdtid}", method = RequestMethod.PUT) @Modifying @Transactional public RequestResult update(@PathVariable("sdtid") long sdtid, @RequestBody SCategory sysDictType){ SCategory old_sCategory = isCategoryRepository.findOne(sdtid); if(null == old_sCategory){ return RequestResult.fail("无法获取记录"); } old_sCategory.setCategoryName(sysDictType.getCategoryName()); old_sCategory.setCategoryIsFixed(sysDictType.getCategoryIsFixed()); old_sCategory.setCategoryLastby(HeaderUtils.getCurrentUser()); old_sCategory.setCategoryLasttime(new Date()); old_sCategory = isCategoryRepository.saveAndFlush(old_sCategory); return RequestResult.success(old_sCategory); } @ApiOperation(value = "删除|SysDictType") @DeleteMapping("") public RequestResult delete(@RequestHeader("Authorization") String Authorization, @RequestParam(value = "id", required = true) long sdtid) { SCategory sCategory = isCategoryRepository.findOne(sdtid); if(null == sCategory){ return RequestResult.fail("无法获取记录"); } if(sCategory.getCategoryIsFixed() == CommonFlag.VALID.getValue()){ return RequestResult.fail("系统默认,不可删除"); } //sysDictTypeRepository.delete(sysDictType); sCategory.setFlag(CommonFlag.DELETED.getValue()); isCategoryRepository.saveAndFlush(sCategory); return RequestResult.success("ok"); } }
fec91b87c859bdc703801cd7a14e9df1c23ac632
75d57f06e1ec08a2bd7e42115c75e233532efe32
/micro-boot-jpa/src/main/java/com/microboot/cn/controller/BaseController.java
37e227129d628fff5b7bcd3cf2bc1f7ff3e07717
[ "Apache-2.0" ]
permissive
javasunCN/Micro-Framework
6eebd1ae010558025c69c8bc29e812464cec05d8
d00d1781804251d59c54cf2df43a80377a9b44fc
refs/heads/master
2022-06-28T19:52:50.404140
2020-05-11T09:53:29
2020-05-11T09:53:29
262,485,395
0
0
null
null
null
null
UTF-8
Java
false
false
70
java
package com.microboot.cn.controller; public class BaseController { }
c72a4883dbe253e7ce573e5d3a199d0a127d7a2c
1506ae5c46a08f0d6dcd122251aeb3a3a149c8fb
/app/src/main/java/com/whoami/gcxhzz/until/ObjectUtils.java
3afe9c1951bb0964d341ba4145a617881635859b
[]
no_license
newPersonKing/gcxhzz
b416e1d82a546a69146ebabaee3bd1876bc6b56c
07d825efe05d63264908c7dae392bcb923733461
refs/heads/master
2020-04-22T19:18:48.522149
2019-08-30T00:41:16
2019-08-30T00:41:16
170,604,135
0
0
null
null
null
null
UTF-8
Java
false
false
1,552
java
package com.whoami.gcxhzz.until; import java.util.List; import java.util.Map; /** * 对象判断 * Created by Josn on 2017/11/10. */ public class ObjectUtils { /** * 判断字符串是否为空, * @param obj * @return */ public static final boolean isNull(Object obj) { if(obj == null) return true; String type = obj.getClass().getSimpleName(); switch (type) { case "String": String str = (String) obj; if (str == null /*|| str.isEmpty()*/ || str.equals("null") || str.equals("")) return true; break; case "List": case "ArrayList": case "LinkedList": List list = (List) obj; if (list == null /*|| list.isEmpty()*/) return true; break; case "Map": case "HashMap": case "LinkedHashMap": case "TreeMap": Map map = (Map) obj; if (map == null /*|| map.isEmpty()*/) return true; break; default: /** * 在判断一次 */ if (null == obj || "".equals(obj)||"null".equals(obj)||"".equals(obj.toString().trim())) { return true; } break; } return false; } public static final boolean isNotNull(Object obj){ return !isNull(obj); } }
e407b468ac65916fe46cf0e37c84069a3925d8b7
1b242dedbe39f775cd9345ff8469c36af3fed727
/src/main/java/fluffybunny/malbunny/entity/UserRole.java
c6c3e834bf8b93f24dae0852432746f8b47ef921
[]
no_license
Fircoal/animebunny
af28c0e327e4a22b2606f32595afa2a2c96f0d98
426dba438ed0688e5769b993d20156b3a99e7ee8
refs/heads/master
2020-03-21T11:48:35.038718
2018-06-25T02:10:57
2018-06-25T02:10:57
138,522,514
0
0
null
null
null
null
UTF-8
Java
false
false
760
java
package fluffybunny.malbunny.entity; import static javax.persistence.GenerationType.IDENTITY; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; @Entity @Table(name = "UserRole") public class UserRole implements Serializable{ @Id @GeneratedValue(strategy = GenerationType.SEQUENCE) private Integer userId; private String role; public Integer getUserId() { return this.userId; } public void setUserId(Integer userId) { this.userId = userId; } public String getRole() { return this.role; } public void setRole(String role) { this.role = role; } }
083cdbb321c687b962f0c14d6eac90b38d1a69ba
ff32a49b4691966aff0328181f500fcd4ba82366
/src/com/wzx/entity/Account.java
b2e8cd85bd4ccc2fb6b0c9210135aa259418e693
[]
no_license
WSGsety/BookStore
703c0d438436f488604e051c45de8181ece80f9d
7371a18fcbacf99a13ca00907efce58bcc1b4b95
refs/heads/master
2021-01-13T18:01:58.986060
2020-02-23T03:28:40
2020-02-23T03:28:40
242,449,984
0
0
null
null
null
null
UTF-8
Java
false
false
1,613
java
package com.wzx.entity; public class Account { String userid; String email; String firstname; String lastname; String status; String addr1; String addr2; String city; String state; String zip; String country; String phone; public String getUserid() { return userid; } public void setUserid(String userid) { this.userid = userid; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getFirstname() { return firstname; } public void setFirstname(String firstname) { this.firstname = firstname; } public String getLastname() { return lastname; } public void setLastname(String lastname) { this.lastname = lastname; } public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } public String getAddr1() { return addr1; } public void setAddr1(String addr1) { this.addr1 = addr1; } public String getAddr2() { return addr2; } public void setAddr2(String addr2) { this.addr2 = addr2; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getState() { return state; } public void setState(String state) { this.state = state; } public String getZip() { return zip; } public void setZip(String zip) { this.zip = zip; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getPhone() { return phone; } public void setPhone(String phone) { this.phone = phone; } }
1b031f8af04bd95e08f6b9261435befa55755660
2f2cb1d3d1012a082aa83ad893d1e596701002c7
/src/main/java/guiframe/LoadFrame.java
c924da3ea412b38c1ce3af5297d823b42f9bea52
[]
no_license
PhilipBao/record-manager
263d124e05829d396064ba8680083738583eec28
d00ebc8d078136140f6f0a6ccbadc3c258bfb013
refs/heads/master
2021-05-29T18:18:46.422030
2015-01-14T22:01:35
2015-01-14T22:01:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,727
java
package guiframe; import java.awt.*; import java.awt.event.*; import javax.swing.*; import java.io.*; public class LoadFrame extends JDialog implements ActionListener { private static final long serialVersionUID = 7157883588675034571L; private static final int WIDTH = 190; private static final int HEIGHT = 120; private static final String TYPE = "wwj"; private final String HOMEPATH = "D:/"; boolean ok = false; private JLabel fileName; String name = ""; int nameInd = 0; JButton loadButton = new JButton("Load!"); JButton cancelButton = new JButton("Cancel"); String[] nameInd0; JComboBox <String> nameIndAcc; public LoadFrame(Frame owner, int lastNameInd) { super(owner,"Load",true); setSize(WIDTH,HEIGHT); setResizable(false); setLayout(new BorderLayout()); setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2 - WIDTH / 2, Toolkit.getDefaultToolkit() .getScreenSize().height / 2 - HEIGHT / 2); //set the frame in the middle of the screen initiallize(lastNameInd); nameIndAcc = new JComboBox<String>(nameInd0); fileName = new JLabel(""); fileName.setBounds(60, 140, 300, 20); loadButton.setActionCommand("load"); cancelButton.setActionCommand("cancel"); JPanel fileNameInput = new JPanel(new FlowLayout()); fileNameInput.add(new JLabel("Please choose a file ")); fileNameInput.add(nameIndAcc); add(fileNameInput, BorderLayout.NORTH); JPanel display = new JPanel(new FlowLayout()); display.add(new JLabel("The file you choose is ")); fileName.setText(" "); display.add(fileName); add(display, BorderLayout.CENTER); JPanel button = new JPanel(new GridLayout(1, 2)); button.add(loadButton); button.add(cancelButton); add(button, BorderLayout.SOUTH); nameIndAcc.addActionListener(this); loadButton.addActionListener(this); cancelButton.addActionListener(this); loadButton.setEnabled(false); setVisible(true); } private void initiallize(int max) { nameInd0 = new String[max+2]; for(int i=1; i<=max+1; i++){ int value = i-1; nameInd0[i] = "" + value; } nameInd0[0] = ""; } public int getValue() { return nameInd; } public boolean getState() { return ok; } public void actionPerformed(ActionEvent e) { String temp = (String)nameIndAcc.getSelectedItem(); if(temp.compareTo("")==0) loadButton.setEnabled(false); else { loadButton.setEnabled(true); nameInd = Integer.valueOf(temp).intValue(); try{ File file = new File(HOMEPATH+"david/out"+nameInd+"."+TYPE); System.out.println(nameInd); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(file))); String line = null; while((line = bufferedReader.readLine())!= null ){ // \\s+ means any number of whitespaces between tokens String [] tokens = line.split("\\s+"); if(tokens[0].compareTo("Name")==0) { name = line.substring(5); } } bufferedReader.close(); } catch (Exception ex){} fileName.setText(name); } String cmd = e.getActionCommand(); if(cmd.equals("load")) { ok = true; setVisible(false); System.out.println("load"); return; } if(cmd.equals("cancel")) { ok = false; setVisible(false); System.out.println("cancel"); return; } } public static void main(String[] args) { @SuppressWarnings("unused") LoadFrame loadFrame = new LoadFrame(null, 8); } }
f9b2b79fe3f79f5f3d436c301c78e3f2d1ef679e
b215446d8e1fbdd421d69da8bea3c63bf8be34d0
/src/test/java/com/lukefowles/mocking/PersonServiceTest.java
c0c4d8986ecbf7cd91279bc2bbbe2b60f95f27c6
[]
no_license
lukefowles/Java_Testing
2af9828240469d6b53ab22fd41986fd4c428739c
efbed0a797f0e2dee752ca2741788793d984c608
refs/heads/main
2023-08-20T14:03:28.911921
2021-10-29T16:27:58
2021-10-29T16:27:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,383
java
package com.lukefowles.mocking; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.ArgumentCaptor; import java.util.List; import java.util.Optional; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThatThrownBy; import static org.mockito.Mockito.*; class PersonServiceTest { private PersonDAO personDAO; private PersonService underTest; @BeforeEach void setUp() { // TODO: create a mock for personDAO personDAO = mock(PersonDAO.class); // TODO: create an instance of underTest and pass personDAO into it underTest = new PersonService(personDAO); } /* TODO: Test all these methods. You might need to create additional methods. Check test coverage */ // Good luck :) @Test void itCanSavePerson() { //Given //A new instance of a person Person person = new Person(5, "Luke", 24); //Person nullPerson = new Person(null, null, null); //Give an EXPECTED return value of 1 when the savePerson method is called on the personDAO mock when(personDAO.savePerson(person)).thenReturn(1); //When the getPeople method is called on the person DAO then return a list of one person with //a different ID when(personDAO.getPeople()).thenReturn(List.of(new Person(6, "John", 23))); //When int actualValue = underTest.savePerson(person); //Then //Return value should be 1 (i.e. the method of savePerson is called on the DAO implementation assertThat( actualValue).isEqualTo(1); //the argument of the method savePerson should be person ArgumentCaptor<Person> personArgumentCaptor = ArgumentCaptor.forClass(Person.class); //this line verifies that the argument being passed to save person method is an instance of the person class verify(personDAO).savePerson(personArgumentCaptor.capture()); //this line gets the value of the person passed as the argument in the save person method Person personSent = personArgumentCaptor.getValue(); //this line asserts that person passed to the argument is the correct person given assertThat(personSent).isEqualTo(person); } @Test void itWillThrowErrorWhenPersonHasSameID () { //Given Person person = new Person(5, "Luke", 24); when(personDAO.savePerson(person)).thenReturn(1); //and that the getPeople() method when called on the personDAO returns //a list with a person with the sameID when(personDAO.getPeople()).thenReturn(List.of(new Person(5, "John", 23))); //Then assertThatThrownBy(() -> underTest.savePerson(person)) .hasMessage("person with id " + person.getId() + " already exists") .isInstanceOfAny(IllegalStateException.class); } @Test void itWillThrowErrorWhenEmptyPersonSaved () { //Given Person person = new Person(null, null, null); //and that the getPeople() method when called on the personDAO returns when(personDAO.getPeople()).thenReturn(List.of(new Person(6, "John", 23))); //Then assertThatThrownBy(() -> underTest.savePerson(person)) .hasMessage("Person cannot have empty fields") .isInstanceOfAny(IllegalStateException.class); } @Test void itCanDeletePerson() { //Given Integer id = 5; when(personDAO.getPeople()).thenReturn(List.of(new Person(5, "Luke", 24))); //When when(personDAO.deletePerson(id)).thenReturn(1); Integer actualValue = underTest.deletePerson(id); //Then //Return value should be 1 (i.e. the method of savePerson is called on the DAO implementation assertThat(actualValue).isEqualTo(1); //the argument of the method savePerson should be person ArgumentCaptor <Integer> IDArgumentCaptor = ArgumentCaptor.forClass(Integer.class); //this line verifies that the argument being passed to save person method is an instance of the person class verify(personDAO).deletePerson(IDArgumentCaptor.capture()); //this line gets the value of the person passed as the argument in the save person method Integer IDSent = IDArgumentCaptor.getValue(); //this line asserts that person passed to the argument is the correct person given assertThat(IDSent).isEqualTo(id); } @Test void canGetPeopleFromDB() { //Given List<Person> expected = List.of(new Person(6, "John", 23)); when(personDAO.getPeople()).thenReturn(List.of(new Person(6, "John", 23))); //When List actual = underTest.getPeople(); //Then assertThat(actual).isEqualTo(expected); } @Test void canGetPersonById() { //Given Optional <Person> expected = Optional.of(new Person(6, "John", 23)); when(personDAO.getPeople()).thenReturn(List.of(new Person(6, "John", 23), new Person(7, "Ron", 23), new Person(9, "Vohn", 23))); Integer id = 6; //When Optional<Person> actual = underTest.getPersonById(id); //Then assertThat(actual).isEqualTo(expected); } }
bc6a1b2ecf4df986afbacfb201fdb33218f95b85
4ccb7a0df5e04097f7b5d8c00740b1f0d78d174b
/src/main/java/com/example/demo/user/controller/UserController.java
69e800ae7222b5bccc5df7086c9269f17073b4d8
[]
no_license
caidl95/Reservation
dfc5fe3d3c7001f2a7cc0bfe6bcb114cf29fc7b1
e92e40a6ffcf025cca292c011013772c35950f44
refs/heads/master
2022-06-29T00:42:03.195957
2019-08-10T08:42:10
2019-08-10T08:42:10
201,603,550
0
0
null
2022-06-17T02:23:37
2019-08-10T08:40:27
TSQL
UTF-8
Java
false
false
4,522
java
package com.example.demo.user.controller; import com.example.demo.common.code.Const; import com.example.demo.common.controller.BaseController; import com.example.demo.common.serverResponse.ServerResponse; import com.example.demo.user.entity.User; import com.example.demo.user.service.IUserService; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpSession; import java.util.List; @RestController @RequestMapping("/users") public class UserController extends BaseController<IUserService> { /** * 登录 * @param session * @param loginname * @param password * @return */ @PostMapping("/login") public ServerResponse<User> login(HttpSession session, String loginname, String password){ ServerResponse<User> response = service.login(loginname,password); if (response.isSuccess()) session.setAttribute(Const.SESSION_CURRENT_USER,response.getData()); return response; } /** * 退出登录 * @param session * @return */ @PostMapping("/logout") public ServerResponse<String> logout(HttpSession session){ session.removeAttribute(Const.SESSION_CURRENT_USER); return ServerResponse.createBySuccess(); } /** * 添加一个新用户 * @param user * @return */ @PostMapping("/reg") public ServerResponse<String> register(User user){ return service.insert(user); } /** * 获取当前登录用户信息 * @param session * @return */ @GetMapping("/get_user") public ServerResponse<User> getUserInfo(HttpSession session){ return ServerResponse.createBySuccess(getUserFromSession(session)); } /** * 根据用户名获取密保问题 * @param loginname * @return */ @GetMapping("/forget_get_question") public ServerResponse<String> forgetGetQuestion(String loginname){ return service.selectQuestion(loginname); } /** * 根据用户名密保问题答案验证身份 * @param loginname * @param question * @param answer * @return token */ @PostMapping("/forget_check_answer") public ServerResponse<String> forgetCheckAnswer(String loginname,String question,String answer){ return service.checkAnswer(loginname,question,answer); } /** * 根据用户名token 更改新的密码 */ @PostMapping("/forget_rest_password") public ServerResponse<String> forgetRestPassword(String loginname,String passwordNew,String forgetToken){ return service.forgetRestPassword(loginname,passwordNew,forgetToken); } /** * 在线更改密码 * @param session * @param passwordOld * @param passwordNew * @return */ @PostMapping("/reset_password") public ServerResponse<String> resetPassword(HttpSession session, String passwordOld, String passwordNew){ return service.resetPassword(passwordOld,passwordNew,getUserFromSession(session)); } /** * 在线更新用户个人信息 * @param session * @param user * @return */ @PostMapping("/update_information") public ServerResponse<User> updateInformation(HttpSession session, User user){ User currentUser = getUserFromSession(session); user.setId(currentUser.getId()); user.setLoginname(currentUser.getLoginname()); ServerResponse response = service.updateByPrimaryKey(user); if (response.isSuccess()) session.setAttribute(Const.SESSION_CURRENT_USER,response.getData()); return response; } @GetMapping("/") public ServerResponse<List<User>> getListUser(){ return service.getListUser(); } @GetMapping("/delete") public ServerResponse delete(Integer id){ return service.deleteByPrimaryKey(id); } @GetMapping("/get_user_id") public ServerResponse<User> getUser(Integer id){ return service.selectByPrimaryKey(id); } @PostMapping("/update_id") public ServerResponse updateById(HttpSession session,User user){ if (getRoleAdminFromSession(session)){ return service.updateByPrimaryKey(user); } return ServerResponse.createByErrorMessage("无此操作权限!"); } }
db511f0f908f12d67a6949af1196760e405a3ed3
2355f04606960dde1194abcca76725226e82ea6b
/app/src/main/java/com/sean/chatroom/UploadProgressRequestBody.java
5214a382a75f5f00c984b3a479b775b49dc17a38
[]
no_license
SeanWang0403/Chatroom
0adef34389c7902b66a43f44555d5e3a6e36c610
d7ad7ba8df0db9d02a20b36130898f3cf958b4ff
refs/heads/master
2020-06-14T11:30:21.864687
2019-08-25T02:17:40
2019-08-25T02:17:40
194,992,938
1
0
null
null
null
null
UTF-8
Java
false
false
1,411
java
package com.sean.chatroom; import java.io.File; import java.io.IOException; import okhttp3.MediaType; import okhttp3.RequestBody; import okhttp3.ResponseBody; import okio.Buffer; import okio.BufferedSink; import okio.Okio; import okio.Source; public class UploadProgressRequestBody extends RequestBody { private RequestBody mRequestBody; private FileUploadObserver<ResponseBody> fileUploadObserver; private File file; public UploadProgressRequestBody(File file, FileUploadObserver<ResponseBody> fileUploadObserver) { this.file = file; this.mRequestBody = RequestBody.create(MediaType.parse("application/octet-stream"), file); this.fileUploadObserver = fileUploadObserver; } @Override public MediaType contentType() { return mRequestBody.contentType(); } @Override public long contentLength() throws IOException { return mRequestBody.contentLength(); } @Override public void writeTo(BufferedSink sink) throws IOException { long max = contentLength(); Source source = Okio.source(file); Buffer buffer = new Buffer(); long length ; long sum = 0; while ((length = source.read(buffer, 1024)) != -1) { sink.write(buffer, length); sum += length; fileUploadObserver.onProgressChange(sum, max); } buffer.flush(); } }
e0aacfa01f4307e8e5814723d9bbdd3c00f36397
1dba7b01a2c8b3d6aa8ffdfd7d9f97f17ae57c8f
/hrms/src/main/java/kodlamaio/hrms/core/utilities/results/ErrorDataResult.java
aefb96ccd00090ef80c65df3e847a7ad81ac2b64
[]
no_license
FurkanBulut00/Hrms
d6922ad3732fbbdf69edf52c3817fc31f24830c1
b81130657f83ef4c3b8679109e7a75e2fc57ba67
refs/heads/main
2023-06-19T12:51:06.380248
2021-07-02T14:57:06
2021-07-02T14:57:06
366,849,108
3
1
null
null
null
null
UTF-8
Java
false
false
402
java
package kodlamaio.hrms.core.utilities.results; public class ErrorDataResult<T> extends DataResult<T> { public ErrorDataResult(T data, String message) { super(data, false, message); } public ErrorDataResult(T data) { super(data, false); } public ErrorDataResult(String message) { super(null, false, message); } public ErrorDataResult() { super(null, false); } }
[ "bulut@DESKTOP-UUTUELV" ]
bulut@DESKTOP-UUTUELV
525dec7375311eae2b3603751198f1357d23c00b
db3c5e38da92e698556342d9513e662ba26ea719
/och03/src/och03/DoWhile01.java
05a4514ca586a602393ebbe7fbd83b20512ecdfd
[]
no_license
start0ys/Java
a1f88487f3c767906979ac870ced0e99302ce3d1
a7fad295437b1e7c0d42c021420d4dce364f5ffc
refs/heads/main
2023-04-17T05:29:37.151397
2021-04-27T08:40:54
2021-04-27T08:40:54
360,715,496
0
0
null
null
null
null
UTF-8
Java
false
false
281
java
package och03; public class DoWhile01 { public static void main(String[] args) { int sum = 0 ,i=1; do { sum+=i; System.out.printf("i(증가) -> %d sum(합계)->%d \n ",i,sum); i++; }while(i<=10); System.out.println("합계 : "+sum); } }
5f08b63fdec0125af2ed070fe80919b9fb0baa15
bdc1d2a153a097235a56580ce4577ace43c046e2
/nirvana/nirvana.ccard.bill.rest/src/main/java/com/caiyi/financial/nirvana/bill/util/mail/TencentMail.java
90d6e8cc3959dc100c3ac7fc37345191ebb3d6db
[]
no_license
gahaitao177/CompanyProject
8ffb6da0edb994d49e3bfb7367e68b85194186ba
caca31a321b1a0729ee2897cea3ec1a5ea1322af
refs/heads/master
2021-01-21T09:49:52.006332
2017-08-10T07:37:08
2017-08-10T07:37:08
91,668,269
2
6
null
null
null
null
UTF-8
Java
false
false
16,431
java
package com.caiyi.financial.nirvana.bill.util.mail; import com.caiyi.financial.nirvana.bill.util.BankHelper; import com.caiyi.financial.nirvana.ccard.bill.bean.Channel; import com.caiyi.financial.nirvana.core.util.CheckUtil; import com.hsk.cardUtil.HpClientUtil; import org.apache.http.client.CookieStore; import org.apache.http.client.config.RequestConfig; import org.apache.http.impl.client.BasicCookieStore; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.protocol.BasicHttpContext; import org.apache.http.protocol.HttpContext; import org.json.JSONObject; import org.slf4j.Logger; import java.awt.image.BufferedImage; import java.io.IOException; import java.util.HashMap; import java.util.Map; /** * Created by lichuanshun on 16/7/13. * 腾讯邮箱登录相关 */ public class TencentMail extends BaseMail{ /** * * @param bean * @return */ public static int login(Channel bean,Logger logger) { String mailaddress=bean.getLoginname(); CloseableHttpClient httpclient = HttpClients.createDefault(); CookieStore cookieStore = new BasicCookieStore(); HttpContext localContext = new BasicHttpContext(); // 设置请求和传输超时时间 RequestConfig.custom().setConnectTimeout(20000); RequestConfig.custom().setSocketTimeout(20000); RequestConfig.custom().setConnectionRequestTimeout(20000); RequestConfig requestConfig = RequestConfig.custom().build(); Map<String, String> requestHeaderMap=new HashMap<String, String>(); requestHeaderMap.put("Accept-Encoding", "gzip, deflate, sdch"); requestHeaderMap.put("Accept-Language", "zh-CN,zh;q=0.8"); requestHeaderMap.put("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 9_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13C75 Safari/601.1"); requestHeaderMap.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"); requestHeaderMap.put("Connection", "Keep-Alive"); // add by lcs 20160216 if (!CheckUtil.isNullString(bean.getIpAddr())){ requestHeaderMap.put("X-Forwarded-For", bean.getIpAddr()); } localContext.setAttribute("http.cookie-store", cookieStore); String url=""; String errorContent=""; //load首页链接的地址 /*url="https://w.mail.qq.com/cgi-bin/loginpage?f=xhtml&kvclick="+URLEncoder.encode("loginpage|app_push|enter|ios", "utf-8")+"&&ad=false&f=xhtml&kvclick=loginpage%7Capp_push%7Center%7Cios%26ad%3Dfalse&s=session_timeout&f=xhtml&autologin=n&uin=&aliastype=&from=&tiptype="; errorContent=HpClientUtil.httpGet(url, requestHeaderMap, httpclient, localContext, "UTF-8", false , requestConfig); System.out.println(errorContent); if (!CheckUtil.isNullString(errorContent)) { return; }*/ url="https://ui.ptlogin2.qq.com/cgi-bin/login?style=9&appid=522005705&daid=4&s_url=https%3A%2F%2Fw.mail.qq.com%2Fcgi-bin%2Flogin%3Fvt%3Dpassport%26vm%3Dwsk%26delegate_url%3D%26f%3Dxhtml%26target%3D&hln_css=http%3A%2F%2Fmail.qq.com%2Fzh_CN%2Fhtmledition%2Fimages%2Flogo%2Fqqmail%2Fqqmail_logo_default_200h.png&low_login=1&hln_autologin=%E8%AE%B0%E4%BD%8F%E7%99%BB%E5%BD%95%E7%8A%B6%E6%80%81&pt_no_onekey=1"; errorContent= HpClientUtil.httpGet(url, requestHeaderMap, httpclient, localContext, "UTF-8",false,requestConfig); url="https://ssl.ptlogin2.qq.com/check?pt_tea=1&uin="+mailaddress+"&appid=522005705&ptlang=2052&r="+Math.random(); errorContent=HpClientUtil.httpGet(url, requestHeaderMap, httpclient, localContext, "UTF-8",false,requestConfig); // 正确格式 ptui_checkVC('0','!LAW','\x00\x00\x00\x00\x13\xb6\xcb\xd9','3df476d7145c143ff34d20cc5cbf4681346df9b88315ecde935267a395182964fdb93effe66ad368e059171453f37126f6480c7999c0ec97','0'); if (!errorContent.contains("ptui_checkVC")||!errorContent.contains("(")||!errorContent.contains(")")) { bean.setBusiErrCode(0); bean.setBusiErrDesc("邮箱登录失败,请稍后再试或联系客服询问"); logger.info(bean.getCuserId()+ " 接口参数格式不正确 ptui_checkVC="+errorContent); return 0; } String ptui_checkVC=errorContent.substring(errorContent.indexOf("(")+1, errorContent.indexOf(")")).replaceAll("'", ""); String [] prs=ptui_checkVC.split(","); if (prs.length!=5) { bean.setBusiErrCode(0); bean.setBusiErrDesc("邮箱登录失败,请稍后再试或联系客服询问"); logger.info(bean.getCuserId()+ " 接口参数格式不正确 ptui_checkVC="+errorContent); return 0; } String pcode=prs[0]; cc.set(bean.getCuserId()+"QQMailCookie"+mailaddress, cookieStore, 1000*60*30); logger.info(bean.getCuserId()+"QQMailCookie"+mailaddress,cookieStore); if ("0".equals(pcode)) {//正常登录 bean.setBankSessionId(ptui_checkVC); bean.setBusiErrCode(1); }else if ("1".equals(pcode)) {//异地登录 cc.set(bean.getCuserId()+"QQMailPtui_checkVC"+mailaddress, ptui_checkVC, 1000*60*30); bean.setBusiErrCode(3); bean.setBusiErrDesc("异地登录需要验证码"); bean.setCurrency(getVerifyCode(bean,logger)); logger.info(bean.getCuserId()+ " 异地登录 ptui_checkVC["+errorContent+"] mailaddress["+mailaddress+"]"); return 0; }else { bean.setBusiErrCode(0); bean.setBusiErrDesc("帐号格式不正确,请检查"); return 0; } return 1; } /** * 获取验证码 * @param bean * @param logger * @return * @throws IOException */ public static String getVerifyCode(Channel bean,Logger logger){ BufferedImage localBufferedImage=null; String mailaddress=bean.getLoginname(); String base64Str = null; String url=""; String errorContent=""; try { Object object=cc.get(bean.getCuserId()+"QQMailCookie"+mailaddress); Object object2=cc.get(bean.getCuserId()+"QQMailPtui_checkVC"+mailaddress); logger.info("getQQEmailVcode" + bean.getCuserId()+"QQMailCookie"+mailaddress); if (object==null||object2==null) { // bean.setBusiErrCode(0); // bean.setBusiErrDesc("请求已失效请重新操作"); return null; } CookieStore cookieStore=(CookieStore) object; String ptui_checkVC=String.valueOf(object2); CloseableHttpClient httpclient = HttpClients.createDefault(); HttpContext localContext = new BasicHttpContext(); // 设置请求和传输超时时间 RequestConfig.custom().setConnectTimeout(20000); RequestConfig.custom().setSocketTimeout(20000); RequestConfig.custom().setConnectionRequestTimeout(20000); RequestConfig requestConfig = RequestConfig.custom().build(); Map<String, String> requestHeaderMap=new HashMap<String, String>(); requestHeaderMap.put("Accept-Encoding", "gzip, deflate, sdch"); requestHeaderMap.put("Accept-Language", "zh-CN,zh;q=0.8"); requestHeaderMap.put("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 9_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13C75 Safari/601.1"); requestHeaderMap.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"); requestHeaderMap.put("Connection", "Keep-Alive"); localContext.setAttribute("http.cookie-store", cookieStore); String [] prs=ptui_checkVC.split(","); String verifycode=prs[1]; // update by lcs 20161122 接口修改 start // url="https://ssl.captcha.qq.com/cap_union_show?captype=3&lang=2052&aid=522005705&uin="+mailaddress+"&cap_cd="+verifycode+"&pt_style=9&v="+Math.random(); url = "https://ssl.captcha.qq.com/cap_union_show_new?aid=522005705&captype=&protocol=https&clientype=1" + "&disturblevel=&apptype=2&noheader=0&uin=" + mailaddress + "&color=&" + "cap_cd=" + verifycode + "&rnd=" + Math.random(); errorContent=HpClientUtil.httpGet(url, requestHeaderMap, httpclient, localContext, "UTF-8",false,requestConfig); // update by lcs 20161122 接口修改 end // add test by lcs 20160704 cc.add("testqqvcode" + bean.getCuserId(), errorContent,3600000); if (!errorContent.contains("g_click_cap_sig")||!errorContent.contains("g_cap_postmsg_seq")) { // bean.setBusiErrCode(0); // bean.setBusiErrDesc("邮箱登录失败,请稍后再试或联系客服询问!"); logger.info(bean.getCuserId()+ " 接口参数格式不正确 g_click_cap_sig="+errorContent); return null; } // update by lcs 20160704 获取sig 方式修改 start // String vsig=errorContent.substring(errorContent.indexOf("g_click_cap_sig"),errorContent.indexOf("g_cap_postmsg_seq")); // String vsig=errorContent.substring(errorContent.indexOf("var g_click_cap_sig=\"") + "var g_click_cap_sig=\"".length(),errorContent.indexOf("\",g_cap_postmsg_seq=1,")); // vsig=vsig.substring(vsig.indexOf("\"")+1, vsig.lastIndexOf("\"")); // logger.info(bean.getCuserId()+" 获取到接口访问参数vsig["+vsig+"]"); // update by lcs 20160704 获取sig 方式修改 end // url="https://ssl.captcha.qq.com/getQueSig?aid=522005705&uin="+mailaddress+"&captype=48&sig="+vsig+"*&"+Math.random(); // errorContent=HpClientUtil.httpGet(url, requestHeaderMap, httpclient, localContext, "UTF-8",false,requestConfig); // // String mgsig=errorContent.substring(errorContent.indexOf("cap_getCapBySig"),errorContent.lastIndexOf("\"")); // mgsig=mgsig.substring(mgsig.indexOf("\"")+1); // String mgsig = vsig; String mgsig = getSigFromHtml(errorContent, bean.getCuserId(),logger); logger.info(bean.getCuserId()+" 获取到接口访问参数mgsig["+mgsig+"]"); if (CheckUtil.isNullString(mgsig)){ // bean.setBusiErrCode(0); // bean.setBusiErrDesc("获取图片验证码失败"); return null; } url="https://ssl.captcha.qq.com/getimgbysig?aid=522005705&uin="+mailaddress+"&sig="+mgsig; localBufferedImage=HpClientUtil.getRandomImageOfJPEG(url, requestHeaderMap, httpclient, localContext, requestConfig); cc.set(bean.getCuserId()+"QQMailCookie"+mailaddress, cookieStore, 1000*60*30); cc.set(bean.getCuserId()+"QQMailPtui_checkVC"+mailaddress, ptui_checkVC); cc.set(bean.getCuserId()+"QQMailmgsig"+mailaddress, mgsig); base64Str = BankHelper.GetImageBase64(localBufferedImage,"jpeg"); } catch (Exception e) { logger.error(bean.getCuserId()+" getQQEmailVcode异常 errorContent["+errorContent+"]", e); // bean.setBusiErrCode(0); base64Str = null; } if (CheckUtil.isNullString(base64Str)){ bean.setBusiErrCode(0); bean.setBusiErrDesc("获取验证码失败"); } return base64Str; } // private static String getSigFromHtml(String htmlContent,String cuserid,Logger logger){ String sig = ""; try{ int indexOne = htmlContent.indexOf("var g_click_cap_sig=\"") + "var g_click_cap_sig=\"".length(); int index2 = htmlContent.indexOf("g_cap_postmsg_seq=1,"); logger.info("index1=" + indexOne + ",index2:" + index2); sig = htmlContent.substring(indexOne,index2).replace("\",", ""); }catch(Exception e){ e.printStackTrace(); logger.error(cuserid+" getQQEmailVcodegetSigFromHtml异常 errorContent", e); } return sig; } public static int checkEmailCode(Channel bean,Logger logger){ String mailaddress=bean.getLoginname(); String url=""; String errorContent=""; try { if (CheckUtil.isNullString(bean.getCode())) { bean.setBusiErrCode(0); bean.setBusiErrDesc("验证码不能为空"); return 0; } Object object=cc.get(bean.getCuserId()+"QQMailCookie"+mailaddress); Object object2=cc.get(bean.getCuserId()+"QQMailPtui_checkVC"+mailaddress); Object object3=cc.get(bean.getCuserId()+"QQMailmgsig"+mailaddress); if (object==null||object2==null||object3==null) { bean.setBusiErrCode(0); bean.setBusiErrDesc("请求已失效请重新操作"); return 0; } CookieStore cookieStore=(CookieStore) object; String ptui_checkVC=String.valueOf(object2); String mgsig=String.valueOf(object3); CloseableHttpClient httpclient = HttpClients.createDefault(); HttpContext localContext = new BasicHttpContext(); // 设置请求和传输超时时间 RequestConfig.custom().setConnectTimeout(20000); RequestConfig.custom().setSocketTimeout(20000); RequestConfig.custom().setConnectionRequestTimeout(20000); RequestConfig requestConfig = RequestConfig.custom().build(); Map<String, String> requestHeaderMap=new HashMap<String, String>(); requestHeaderMap.put("Accept-Encoding", "gzip, deflate, sdch"); requestHeaderMap.put("Accept-Language", "zh-CN,zh;q=0.8"); requestHeaderMap.put("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 9_2 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13C75 Safari/601.1"); requestHeaderMap.put("Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"); requestHeaderMap.put("Connection", "Keep-Alive"); // add by lcs 20160216 if (!CheckUtil.isNullString(bean.getIpAddr())){ requestHeaderMap.put("X-Forwarded-For", bean.getIpAddr()); } localContext.setAttribute("http.cookie-store", cookieStore); String [] prs=ptui_checkVC.split(","); String pcode=prs[0]; String verifycode=prs[1]; String randstr=verifycode; String st=prs[2]; String sig=prs[3]; String rcode=prs[4]; url="https://ssl.captcha.qq.com/cap_union_verify?aid=522005705&uin="+mailaddress+"&captype=48&ans="+bean.getCode()+"&sig="+mgsig+"&"+Math.random(); errorContent=HpClientUtil.httpGet(url, requestHeaderMap, httpclient, localContext, "UTF-8",false,requestConfig); // add by lcs 20160414 增加异常日志 测试消除后删除 if (CheckUtil.isNullString(errorContent)){ logger.info("templog" + bean.getCuserId() + "," + mailaddress + "," + bean.getMailPwd() + "," + bean.getCode()); bean.setBusiErrCode(0); bean.setBusiErrDesc("远程服务器异常,请重试"); return 0; } String json=errorContent.substring(errorContent.indexOf("(")+1, errorContent.lastIndexOf(")")); JSONObject jsonOBJ=new JSONObject(json); randstr=String.valueOf(jsonOBJ.get("randstr")); sig=String.valueOf(jsonOBJ.get("sig")); rcode=String.valueOf(jsonOBJ.get("rcode")); if (!"0".equals(rcode)) { bean.setBusiErrCode(3); bean.setBusiErrDesc("验证码错误,请重试"); bean.setCurrency(getVerifyCode(bean,logger)); logger.info(bean.getCuserId()+" 验证码错误,请重试["+errorContent+"]"); return 0; } cc.set(bean.getCuserId()+"QQMailCookie"+mailaddress, cookieStore, 1000*60*30); bean.setBankSessionId(pcode+","+randstr+","+st+","+sig+","+rcode); return 1; } catch (Exception e) { logger.error(bean.getCuserId()+" checkQQEmailCode异常 errorContent["+errorContent+"]", e); } return 0; } }
3cd79b5f81b7305e718ba4393646176997cd4b6f
6ef0b36c1226a2b8147b0e8db08ebee64f4f62a7
/osgp/platform/osgp-adapter-ws-distributionautomation/src/test/java/org/opensmartgridplatform/adapter/ws/da/infra/jms/messageprocessors/DomainResponseMessageProcessorTest.java
cae2f6b18e7b3b2987758d830cc2ac826b058238
[ "Apache-2.0" ]
permissive
mohbadar/open-smart-grid-platform
702d749b803327322f06a58bcd0dc101b83a507b
d6d5554143e89eaef5419c6f9d3f21190644874a
refs/heads/master
2020-06-16T06:22:17.980221
2019-06-13T10:48:51
2019-06-13T10:48:51
195,500,096
2
0
Apache-2.0
2019-07-06T05:09:34
2019-07-06T05:09:34
null
UTF-8
Java
false
false
4,290
java
/** * Copyright 2019 Smart Society Services B.V. * * 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 */ package org.opensmartgridplatform.adapter.ws.da.infra.jms.messageprocessors; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyString; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import javax.jms.JMSException; import javax.jms.ObjectMessage; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; import org.opensmartgridplatform.adapter.ws.schema.distributionautomation.notification.NotificationType; import org.opensmartgridplatform.adapter.ws.shared.services.NotificationService; import org.opensmartgridplatform.adapter.ws.shared.services.ResponseDataService; import org.opensmartgridplatform.shared.infra.jms.Constants; @RunWith(MockitoJUnitRunner.class) public class DomainResponseMessageProcessorTest { @Mock private NotificationService notificationService; @Mock private ResponseDataService responseDataService; @InjectMocks private DomainResponseMessageProcessor responseMessageProcessor = new DomainResponseMessageProcessor(); @Test public void testProcessGetHealthStatusResponseOkMessage() throws JMSException { this.testProcessResponse("OK", "GET_HEALTH_STATUS"); } @Test public void testProcessGetHealthStatusResponseNotOkMessage() throws JMSException { this.testProcessResponse("NOT_OK", "GET_HEALTH_STATUS"); } @Test public void testProcessGetPowerQualityResponseOkMessage() throws JMSException { this.testProcessResponse("OK", "GET_POWER_QUALITY_VALUES"); } @Test public void testProcessGetPowerQualityResponseNotOkMessage() throws JMSException { this.testProcessResponse("NOT_OK", "GET_POWER_QUALITY_VALUES"); } @Test public void testProcessGetMeasurementReportResponseOkMessage() throws JMSException { this.testProcessResponse("OK", "GET_MEASUREMENT_REPORT"); } @Test public void testProcessGetMeasurementReportResponseNotOkMessage() throws JMSException { this.testProcessResponse("NOT_OK", "GET_MEASUREMENT_REPORT"); } @Test /** * Tests processing an incoming message, which has an unknown notification * type. The system should discard the message. * * @throws JMSException, * which should never occur. */ public void testProcessUnknownMessageTypeResponseMessage() throws JMSException { // Arrange final ObjectMessage myMessage = Mockito.mock(ObjectMessage.class); when(myMessage.getJMSType()).thenReturn("FAKE_UNKNOWN_NOTIFICATION_TYPE"); // Act this.responseMessageProcessor.processMessage(myMessage); // Assert // Verify no notification was sent verify(this.notificationService, times(0)).sendNotification(anyString(), anyString(), eq("OK"), anyString(), anyString(), any()); // Verify no response was enqueued for storage verify(this.responseDataService, times(0)).enqueue(any()); } private void testProcessResponse(final String result, final String notificationName) throws JMSException { // Arrange final ObjectMessage myMessage = Mockito.mock(ObjectMessage.class); when(myMessage.getJMSType()).thenReturn(notificationName); when(myMessage.getStringProperty(Constants.RESULT)).thenReturn(result); // Act this.responseMessageProcessor.processMessage(myMessage); // Assert // Verify a notification was sent verify(this.notificationService).sendNotification(anyString(), anyString(), eq(result), anyString(), anyString(), eq(NotificationType.valueOf(notificationName))); // Verify a response was enqueued for storage verify(this.responseDataService).enqueue(any()); } }
0169569cd86aa572b239ddd2b9601e21a1793246
bc034dd74cd2b67307b20697df86a1a06e08b0ab
/broadbus-api/src/main/java/me/skyun/broadcastex/api/Utils.java
3d37373fd4f6a0c6f4c04c51ca585187e466ae59
[]
no_license
skyuning/BroadBus
3bb9c419f1b19e6267f5de22adef348138ab0fa4
8a61c55922c3c6fabc5f908eebc14a497c424cd0
refs/heads/master
2021-06-08T03:59:16.326090
2016-12-02T09:19:57
2016-12-02T09:19:57
73,155,580
1
0
null
null
null
null
UTF-8
Java
false
false
1,204
java
package me.skyun.broadcastex.api; import android.content.IntentFilter; import android.text.TextUtils; import android.util.Log; import java.io.PrintWriter; import java.io.StringWriter; /** * Created by linyun on 16/11/12. */ class Utils { public static void logException(Exception e) { StringWriter writer = new StringWriter(); PrintWriter printWriter = new PrintWriter(writer); e.printStackTrace(printWriter); printWriter.flush(); printWriter.close(); Log.d(e.getStackTrace()[0].getMethodName(), writer.toString()); } public static String filterToString(IntentFilter filter) { StringBuilder sb = new StringBuilder("[action: "); for (int i=0; i<filter.countActions(); i++) { sb.append(filter.getAction(i)).append(", "); } sb.append("]"); sb.append(" categories["); for (int i=0; i<filter.countCategories(); i++) { sb.append(filter.getCategory(i)).append(","); } sb.append("]"); return sb.toString(); } public static String paramTypesToString(String[] paramTypes) { return "(" + TextUtils.join(", ", paramTypes) + ")"; } }
db8ad80c7b1d44a80b10b880f12495c5ceddff4a
ceae88bfd71fe2d8499d55cbd35012dc2316c25d
/src/main/java/com/github/carlinhafuji/iotserver/domain/notification/Notification.java
5b03a188b0c350caf4c2f0a1d3bae9a8db0becbb
[ "MIT" ]
permissive
carlinhafuji/Iot-server
71b329d5e7b93559cd160c79d0b409820aed0af2
6f2a136dd7f165ff9f1ffcb4663424ec6a69a46d
refs/heads/master
2020-12-04T18:16:26.392251
2016-10-24T01:07:40
2016-10-24T01:07:40
67,307,361
1
1
null
null
null
null
UTF-8
Java
false
false
1,153
java
package com.github.carlinhafuji.iotserver.domain.notification; import com.github.carlinhafuji.iotserver.domain.Mobile; public class Notification { private String title; private String body; private Mobile recipient; public Notification(String title, String body, Mobile recipient) { this.body = body; this.title = title; this.recipient = recipient; } public String title() { return title; } public String body() { return body; } public Mobile recipient() { return recipient; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Notification that = (Notification) o; if (!title.equals(that.title)) return false; if (!body.equals(that.body)) return false; return recipient.equals(that.recipient); } @Override public int hashCode() { int result = title.hashCode(); result = 31 * result + body.hashCode(); result = 31 * result + recipient.hashCode(); return result; } }
a58a3a66ec2ba97823afdc0e3eb9859f43d1fd0e
1ed9ce32e6ef48ddde3b230d57d4aa5fb1640156
/src/main/java/cpu/Runner.java
b1370ea3f6409ccbafdee99e4ed1d13b943968f6
[]
no_license
adavidoaiei/cpu-dojo
6843df4a90c34a03bc682d5c945299229e332b63
6f80fcd705bfea5e9fb42132a2cdf345835cab69
refs/heads/master
2021-05-28T13:27:51.770124
2014-11-12T12:59:52
2014-11-12T12:59:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
488
java
package cpu; import assembler.Assembler; import java.nio.file.Files; import java.nio.file.Paths; public class Runner { public static void main(String[] arguments) throws Exception { String content = new String(Files.readAllBytes(Paths.get("src/main/resources/", arguments[0]))); Assembler assembler = new Assembler(); assembler.parse(content); CPU cpu = new CPU(assembler.memory()); cpu.execute(); cpu.printAsciiMemory(); } }
0af5d59cf94621f2bdc9f7b17d66cb20960c6e33
c8688db388a2c5ac494447bac90d44b34fa4132c
/sources/com/google/android/gms/internal/ads/ih0.java
f62513d583c4864417162d78637d18b510accfc5
[]
no_license
mred312/apk-source
98dacfda41848e508a0c9db2c395fec1ae33afa1
d3ca7c46cb8bf701703468ddc88f25ba4fb9d975
refs/heads/master
2023-03-06T05:53:50.863721
2021-02-23T13:34:20
2021-02-23T13:34:20
341,481,669
0
0
null
null
null
null
UTF-8
Java
false
false
538
java
package com.google.android.gms.internal.ads; import android.app.Activity; import android.app.Application; /* compiled from: com.google.android.gms:play-services-ads@@19.5.0 */ final class ih0 implements zzrf { /* renamed from: a */ private final /* synthetic */ Activity f9326a; ih0(gh0 gh0, Activity activity) { this.f9326a = activity; } public final void zza(Application.ActivityLifecycleCallbacks activityLifecycleCallbacks) { activityLifecycleCallbacks.onActivityStarted(this.f9326a); } }
fb807274c691eea09689b02085178b536cc7f500
96bb95eca232a4d5f045a6bea54e20048397a0c0
/src/main/java/com/lbruges/bowling/board/impl/Game.java
f8fdbc1133d23d18e3fe3b6b2eba3876dbd21863
[]
no_license
lbruges/bowling_game
9f632da5619a4aefb2b47ce981e7c8d12fac98ba
27830095d99711575905eea49bdc304d17c651c1
refs/heads/main
2023-02-03T06:04:45.619263
2020-12-21T17:29:41
2020-12-21T17:29:41
322,865,986
0
0
null
null
null
null
UTF-8
Java
false
false
1,224
java
package com.lbruges.bowling.board.impl; import com.lbruges.bowling.board.BoardObserver; import com.lbruges.bowling.board.BoardSubject; import com.lbruges.bowling.calculator.GameScoreCalculator; import com.lbruges.bowling.model.frame.IFrame; import com.lbruges.bowling.model.score.IScore; import java.util.LinkedList; import java.util.List; /** * Single player bowling game representation. * * @author Laura Bruges */ public class Game implements BoardSubject { private String playerName; private List<IFrame> frameList; private List<BoardObserver> observers; public Game(String playerName, List<IFrame> frameList) { this.playerName = playerName; this.frameList = frameList; observers = new LinkedList<>(); } public void setFrameList(List<IFrame> frameList) { this.frameList = frameList; } @Override public void registerObserver(BoardObserver observer) { observers.add(observer); } @Override public void notifyObservers() { List<IScore> scoreList = (new GameScoreCalculator(frameList)).scoreGame(); for (BoardObserver o : observers) { o.update(playerName, frameList, scoreList); } } }
9fba3673d1532f23c32aab56bc555aead1e91eb6
5bec3a47a2051788072774b701889af6223b4087
/src/test/java/com/example/demo/DemoCicdEksEcrApplicationTests.java
5dc744da3d7b599d9d3720f47f6882e4713b02fc
[]
no_license
srdsoumya/demo-cicd-eks-ecr
ed21cda2b44714630222b96f32094ce432c6f990
c71d54b7c1b64408ae4e9da5bf221512e9f46d09
refs/heads/master
2023-08-14T04:30:29.853100
2021-10-11T16:52:26
2021-10-11T16:52:26
415,586,575
0
0
null
null
null
null
UTF-8
Java
false
false
216
java
package com.example.demo; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class DemoCicdEksEcrApplicationTests { @Test void contextLoads() { } }
978295b3e5b1dfb13750606733a159283065dcb7
99a1c8600d7a8984d3918010776aebb7c23da407
/src/main/java/com/backendmadrid/aemet/dao/EstacionDAO.java
a8f7e9d68d68df568298c866c158d97f83fb8983
[]
no_license
ClimaViz/ClimaViz
5d0d9c53627e5eaa0fcc69219f6831db0ad39e75
110452ae56c1569011944b02a4f61d26c5b902e7
refs/heads/master
2021-09-06T22:21:27.163401
2018-02-12T13:07:04
2018-02-12T13:07:04
121,248,272
0
1
null
null
null
null
UTF-8
Java
false
false
745
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.backendmadrid.aemet.dao; import com.backendmadrid.aemet.modelos.Estacion; import java.time.LocalDate; import java.util.List; /** * * @author USUARIO */ public interface EstacionDAO { public List<Estacion> listar(); public List<Estacion> listarFecha(LocalDate fecha); public void insertar (Estacion e); public void borrar (String nombre); public List<Estacion> buscar(String nombre); public List<Estacion> getEstacionesProvincia(int idProvincia); }
[ "" ]
e2e790d31fb05c8896be410ccd4f8bc9e5f6f3c6
0cb4847bbf36b7f80fd14df411db93bec97c9981
/src/main/java/executable/ExtractionTesting.java
5716554586ea8a4d8aedf53bd63016217d9994e7
[ "Apache-2.0" ]
permissive
chorlang/chor-extractor
69705aafd5ca32c85f73eb426aa7810d9cfa6919
fd91df26f7c772344fb6cbc2af390c544b6d4779
refs/heads/master
2022-06-03T01:21:39.927765
2022-05-16T17:42:12
2022-05-16T17:42:12
244,318,288
3
0
Apache-2.0
2021-09-08T16:17:22
2020-03-02T08:29:24
Java
UTF-8
Java
false
false
3,937
java
package executable; import executable.tests.Benchmarks; import executable.tests.CruzFilipeLarsenMontesi17; import executable.tests.LangeTuostoYoshida15; import executable.tests.LangeTuostoYoshida15Sequential; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.Map; import java.util.Scanner; public class ExtractionTesting { private static record Command(Runnable runnable, String description) { } private static final Map<String, Command> commands = Map.of( "help", new Command(ExtractionTesting::printHelp, "Prints this help information"), "theory", new Command(() -> runTests(new CruzFilipeLarsenMontesi17()), "Run the tests from the original theoretical paper [Cruz-Filipe, Larsen, Montesi @ FoSSaCS 2017]"), "lty15", new Command(() -> runTests(new LangeTuostoYoshida15()), "Run the tests from the paper [Lange, Tuosto, Yoshida @ POPL 2015]"), "lty15-seq", new Command(() -> runTests(new LangeTuostoYoshida15Sequential()), "Run the tests from the paper [Lange, Tuosto, Yoshida @ POPL 2015] *with parallelization disabled*"), "benchmark", new Command(ExtractionTesting::runBenchmarks, "Run the extraction benchmarking suite"), "bisimcheck", new Command(ExtractionTesting::runBisimilarity, "Check that the choreographies extracted in the benchmark are correct, i.e., they are bisimilar to the respective originals"), "exit", new Command(() -> System.out.println("Goodbye"), "Closes the application") ); public static void main(String []args){ if (args.length == 0) { printHelp(); CMDInterface(); } else{ Command toExecute = commands.get(args[0]); if (toExecute == null){ System.out.println("Could not recognize argument " + args[0]); printHelp(); System.exit(1); } toExecute.runnable.run(); } } private static void CMDInterface(){ var inputReader = new Scanner(System.in); String command; do { System.out.println("Enter command: "); command = inputReader.next().toLowerCase(); Command toExecute = commands.get(command); if (toExecute == null){ System.out.println("Could not recognize command"); printHelp(); } else{ toExecute.runnable.run(); } } while (!command.equals("exit")); } private static void runTests(Object testClass){ for (Method method : testClass.getClass().getDeclaredMethods()){ try { var inst = testClass.getClass(); var startTime = System.currentTimeMillis(); System.out.println("Running " + method.getName()); method.invoke(testClass); System.out.println("Elapsed time: " + (System.currentTimeMillis() - startTime) + "ms\n"); } catch (IllegalAccessException | InvocationTargetException e){ System.out.println("ERROR: Could not invoke method in class " + testClass.getClass().getName()); e.printStackTrace(); } } } private static void printHelp() { System.out.println("List of available commands (<name of command>\t<description>)"); commands.forEach((key, value) -> System.out.println("\t" + key + "\t\t" + value.description)); } private static void runBenchmarks(){ System.out.println("=== Extracting all test networks from directory tests ===\n"); Benchmarks.INSTANCE.extractionTest(); } private static void runBisimilarity(){ System.out.println("=== Checking that all extracted choreographies are correct, using bisimilarity ===\n"); Benchmarks.INSTANCE.extractionSoundness(); } }
2e6f18b560a324c4d2ece717092b560d7aee730a
38cfa6155a905495bef2634ccf103e8c9a540212
/ink.core/src/main/java/org/ink/core/vm/lang/internal/annotations/CoreInstanceValuesLocation.java
f1be89887e499c245ddbb159fdef29e0b97f3ee9
[]
no_license
rodrigovilar/ink
3feb9d164289b5f3965d7f57f950effd05530072
12f2065934f17a4c616616cffa548b728f7b5bd4
refs/heads/master
2021-01-10T04:23:27.691216
2013-11-02T18:55:36
2013-11-02T18:55:36
53,296,299
0
0
null
null
null
null
UTF-8
Java
false
false
294
java
package org.ink.core.vm.lang.internal.annotations; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; /** * @author Lior Schachter */ @Retention(RetentionPolicy.RUNTIME) public @interface CoreInstanceValuesLocation { public byte[] indexes(); }
d9e530e2b1c6809902949f284c7819be5c1f151e
aafdc711689797a76bada418d022714495b7894c
/Workspaces/intelij/work/AE_SEM_CS_Interface/ESPInterfaceGenerate/src/main/java/net/aconite/affina/espinterface/xmlmapping/sem/ScriptType.java
f89b2c5e705b1c4c03d4cf95174c9d2ee8e151f2
[]
no_license
wakmo/WakWork
07561a1f9d7e089b6ae6a59c33d4187a033ddfbc
b062b35f71721b9d10ca2cf93cc5740e277cb001
refs/heads/master
2020-06-04T10:02:31.843536
2014-09-16T13:56:14
2014-09-16T13:56:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
22,527
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-833 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2014.07.11 at 04:22:05 PM BST // package net.aconite.affina.espinterface.xmlmapping.sem; import java.math.BigInteger; import java.util.ArrayList; import java.util.List; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for ScriptType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="ScriptType"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="scriptCommands"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="scriptCommand" maxOccurs="unbounded"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="dataItems"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence maxOccurs="unbounded" minOccurs="0"> * &lt;element name="dataItem" type="{}TagType"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * &lt;/sequence> * &lt;attribute name="CLA" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="INS" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="P1" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="P2" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * &lt;element name="validPeriod"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;attribute name="startDate" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="endDate" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * &lt;/sequence> * &lt;attribute name="businessFunctionID" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="businessFunctionGroup" use="required" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" /> * &lt;attribute name="scriptType" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="validDevices" use="required" type="{http://www.w3.org/2001/XMLSchema}integer" /> * &lt;attribute name="priority" use="required" type="{http://www.w3.org/2001/XMLSchema}integer" /> * &lt;attribute name="autoRestageLimit" use="required" type="{http://www.w3.org/2001/XMLSchema}integer" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "ScriptType", propOrder = { "scriptCommands", "validPeriod" }) public class ScriptType { @XmlElement(required = true) protected ScriptType.ScriptCommands scriptCommands; @XmlElement(required = true) protected ScriptType.ValidPeriod validPeriod; @XmlAttribute(required = true) protected String businessFunctionID; @XmlAttribute(required = true) @XmlSchemaType(name = "nonNegativeInteger") protected BigInteger businessFunctionGroup; @XmlAttribute(required = true) protected String scriptType; @XmlAttribute(required = true) protected BigInteger validDevices; @XmlAttribute(required = true) protected BigInteger priority; @XmlAttribute(required = true) protected BigInteger autoRestageLimit; /** * Gets the value of the scriptCommands property. * * @return * possible object is * {@link ScriptType.ScriptCommands } * */ public ScriptType.ScriptCommands getScriptCommands() { return scriptCommands; } /** * Sets the value of the scriptCommands property. * * @param value * allowed object is * {@link ScriptType.ScriptCommands } * */ public void setScriptCommands(ScriptType.ScriptCommands value) { this.scriptCommands = value; } /** * Gets the value of the validPeriod property. * * @return * possible object is * {@link ScriptType.ValidPeriod } * */ public ScriptType.ValidPeriod getValidPeriod() { return validPeriod; } /** * Sets the value of the validPeriod property. * * @param value * allowed object is * {@link ScriptType.ValidPeriod } * */ public void setValidPeriod(ScriptType.ValidPeriod value) { this.validPeriod = value; } /** * Gets the value of the businessFunctionID property. * * @return * possible object is * {@link String } * */ public String getBusinessFunctionID() { return businessFunctionID; } /** * Sets the value of the businessFunctionID property. * * @param value * allowed object is * {@link String } * */ public void setBusinessFunctionID(String value) { this.businessFunctionID = value; } /** * Gets the value of the businessFunctionGroup property. * * @return * possible object is * {@link BigInteger } * */ public BigInteger getBusinessFunctionGroup() { return businessFunctionGroup; } /** * Sets the value of the businessFunctionGroup property. * * @param value * allowed object is * {@link BigInteger } * */ public void setBusinessFunctionGroup(BigInteger value) { this.businessFunctionGroup = value; } /** * Gets the value of the scriptType property. * * @return * possible object is * {@link String } * */ public String getScriptType() { return scriptType; } /** * Sets the value of the scriptType property. * * @param value * allowed object is * {@link String } * */ public void setScriptType(String value) { this.scriptType = value; } /** * Gets the value of the validDevices property. * * @return * possible object is * {@link BigInteger } * */ public BigInteger getValidDevices() { return validDevices; } /** * Sets the value of the validDevices property. * * @param value * allowed object is * {@link BigInteger } * */ public void setValidDevices(BigInteger value) { this.validDevices = value; } /** * Gets the value of the priority property. * * @return * possible object is * {@link BigInteger } * */ public BigInteger getPriority() { return priority; } /** * Sets the value of the priority property. * * @param value * allowed object is * {@link BigInteger } * */ public void setPriority(BigInteger value) { this.priority = value; } /** * Gets the value of the autoRestageLimit property. * * @return * possible object is * {@link BigInteger } * */ public BigInteger getAutoRestageLimit() { return autoRestageLimit; } /** * Sets the value of the autoRestageLimit property. * * @param value * allowed object is * {@link BigInteger } * */ public void setAutoRestageLimit(BigInteger value) { this.autoRestageLimit = value; } /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="scriptCommand" maxOccurs="unbounded"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="dataItems"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence maxOccurs="unbounded" minOccurs="0"> * &lt;element name="dataItem" type="{}TagType"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * &lt;/sequence> * &lt;attribute name="CLA" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="INS" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="P1" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="P2" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "scriptCommand" }) public static class ScriptCommands { @XmlElement(required = true) protected List<ScriptType.ScriptCommands.ScriptCommand> scriptCommand; /** * Gets the value of the scriptCommand property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the scriptCommand property. * * <p> * For example, to add a new item, do as follows: * <pre> * getScriptCommand().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link ScriptType.ScriptCommands.ScriptCommand } * * */ public List<ScriptType.ScriptCommands.ScriptCommand> getScriptCommand() { if (scriptCommand == null) { scriptCommand = new ArrayList<ScriptType.ScriptCommands.ScriptCommand>(); } return this.scriptCommand; } /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="dataItems"> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence maxOccurs="unbounded" minOccurs="0"> * &lt;element name="dataItem" type="{}TagType"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * &lt;/element> * &lt;/sequence> * &lt;attribute name="CLA" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="INS" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="P1" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="P2" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "dataItems" }) public static class ScriptCommand { @XmlElement(required = true) protected ScriptType.ScriptCommands.ScriptCommand.DataItems dataItems; @XmlAttribute(name = "CLA", required = true) protected String cla; @XmlAttribute(name = "INS", required = true) protected String ins; @XmlAttribute(name = "P1", required = true) protected String p1; @XmlAttribute(name = "P2", required = true) protected String p2; /** * Gets the value of the dataItems property. * * @return * possible object is * {@link ScriptType.ScriptCommands.ScriptCommand.DataItems } * */ public ScriptType.ScriptCommands.ScriptCommand.DataItems getDataItems() { return dataItems; } /** * Sets the value of the dataItems property. * * @param value * allowed object is * {@link ScriptType.ScriptCommands.ScriptCommand.DataItems } * */ public void setDataItems(ScriptType.ScriptCommands.ScriptCommand.DataItems value) { this.dataItems = value; } /** * Gets the value of the cla property. * * @return * possible object is * {@link String } * */ public String getCLA() { return cla; } /** * Sets the value of the cla property. * * @param value * allowed object is * {@link String } * */ public void setCLA(String value) { this.cla = value; } /** * Gets the value of the ins property. * * @return * possible object is * {@link String } * */ public String getINS() { return ins; } /** * Sets the value of the ins property. * * @param value * allowed object is * {@link String } * */ public void setINS(String value) { this.ins = value; } /** * Gets the value of the p1 property. * * @return * possible object is * {@link String } * */ public String getP1() { return p1; } /** * Sets the value of the p1 property. * * @param value * allowed object is * {@link String } * */ public void setP1(String value) { this.p1 = value; } /** * Gets the value of the p2 property. * * @return * possible object is * {@link String } * */ public String getP2() { return p2; } /** * Sets the value of the p2 property. * * @param value * allowed object is * {@link String } * */ public void setP2(String value) { this.p2 = value; } /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence maxOccurs="unbounded" minOccurs="0"> * &lt;element name="dataItem" type="{}TagType"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "dataItem" }) public static class DataItems { protected List<TagType> dataItem; /** * Gets the value of the dataItem property. * * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the dataItem property. * * <p> * For example, to add a new item, do as follows: * <pre> * getDataItem().add(newItem); * </pre> * * * <p> * Objects of the following type(s) are allowed in the list * {@link TagType } * * */ public List<TagType> getDataItem() { if (dataItem == null) { dataItem = new ArrayList<TagType>(); } return this.dataItem; } } } } /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;attribute name="startDate" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;attribute name="endDate" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "") public static class ValidPeriod { @XmlAttribute(required = true) protected String startDate; @XmlAttribute(required = true) protected String endDate; /** * Gets the value of the startDate property. * * @return * possible object is * {@link String } * */ public String getStartDate() { return startDate; } /** * Sets the value of the startDate property. * * @param value * allowed object is * {@link String } * */ public void setStartDate(String value) { this.startDate = value; } /** * Gets the value of the endDate property. * * @return * possible object is * {@link String } * */ public String getEndDate() { return endDate; } /** * Sets the value of the endDate property. * * @param value * allowed object is * {@link String } * */ public void setEndDate(String value) { this.endDate = value; } } }
d4cac1951fead5610474ee06ae01f353fb138914
018333929fce0efaba1b8656ceb1b09c19e88ced
/customers/src/test/java/com/customer/service/CustomersApplicationTests.java
914fd1d6505c3c1bfa7263fe168e1f261035d562
[]
no_license
ruchikabobade/customer-order-app
e12e4c9f9eb954a8c0c468293d72190b3ab528e2
bdb21b5fcd4fd06d94a6edec7f4fb215bc0d60d1
refs/heads/master
2020-03-25T21:01:27.304601
2018-08-24T06:14:43
2018-08-24T06:14:43
144,155,919
0
0
null
null
null
null
UTF-8
Java
false
false
2,070
java
package com.customer.service; import static org.junit.Assert.assertEquals; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.ArrayList; import java.util.List; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class CustomersApplicationTests { @Mock private CustomerRepository customerRepository; @InjectMocks private CustomerController customerController; @Before public void setup(){ MockitoAnnotations.initMocks(this); } @Test public void testGetCustomers(){ List<Customer> customerList = new ArrayList<Customer>(); customerList.add(new Customer("priya","mg road","koramangla",23,123654)); customerList.add(new Customer("madhu","asv", "suntek park",23,123654)); customerList.add(new Customer("tanvi","hinjewadi","pune",23,123654)); when(customerRepository.findAll()).thenReturn(customerList); List<Customer> result = customerController.getCustomers(); assertEquals(3, result.size()); } @Test public void testSaveCustomer(){ Customer customer = new Customer("priya","mg road","koramangla",23,123654); when(customerRepository.save(customer)).thenReturn(customer); Customer result = customerController.addCustomerTest(customer); assertEquals("priya", result.getName()); assertEquals("mg road", result.getAddressLine1()); assertEquals("koramangla", result.getAddressLine2()); assertEquals(23, result.getAge()); assertEquals(123654, result.getPostCode()); } @Test public void testDeleteCustomer(){ Customer customer = new Customer("priya","mg road","koramangla",23,123654); customerController.deleteCustomer(customer.getId()); verify(customerRepository, times(1)).deleteById(customer.getId()); } }
aa36cf61b910bdc9d29a9d29d6ac90c5441833d2
08aee698f98619aaacfb4f6ebf429bfabfa6586c
/src/main/java/com/learn/mongodb/dao/HelloDao.java
8e4446b4bc86785953fb50d86eabd064ab8e28bd
[]
no_license
wu00yu11/learn-mongodb
90d12c663e01af7e2b680c9b537fffd9d5cb6961
01da5ca57940e08c264d2519f831de20c2dd60ce
refs/heads/master
2023-03-29T08:12:12.041060
2021-04-09T14:22:47
2021-04-09T14:22:47
355,979,633
0
0
null
null
null
null
UTF-8
Java
false
false
269
java
package com.learn.mongodb.dao; import com.learn.mongodb.model.HelloEntity; public interface HelloDao { void saveDemo(HelloEntity helloEntity); void removeDemo(Long id); void updateDemo(HelloEntity helloEntity); HelloEntity findDemoById(Long id); }
47d84a67ff23199316dce1fe0ca0174b1adf1228
a88360218e6e1d56f2b0f010b3ac41e77f65d8cb
/app/src/main/java/easycommute/EaCeWithMetro/interfaces/FragmentListener.java
d163b0c8b1b79aa61b74a69eed4d303f14f446aa
[]
no_license
Easycommute/EaCeWithMetro
530f701f20a9129b455dfaeb43284078b00a2cff
8d1446409c2bfaea3a757a495e35c99fa181d13d
refs/heads/master
2020-09-21T19:03:12.184020
2020-04-09T06:40:43
2020-04-09T06:40:43
224,892,635
2
0
null
null
null
null
UTF-8
Java
false
false
745
java
package easycommute.EaCeWithMetro.interfaces; import android.app.Activity; import androidx.fragment.app.Fragment; /** * Created by Ram Prasad on 10/28/2015. */ public interface FragmentListener { void setFragment(ActionEventListener fragment); void navigateToFragment(Fragment fragment, String tag); void navigateToFragment(Fragment fragment, String tag, boolean noHistory); void navigateToFragment(Fragment fragment, String tag, boolean noHistory, boolean clearStack); void showProgressBar(); void showProgressBarWithoutBackground(); void hideProgressBar(); void showNetworkDialog(); void hideSoftKeyboard(Activity activity); void setActionTitle(String title); void setProfileInfo(); }
ef0d3e5ea137e3ad7944e44ccf1ca2fc68a67113
8b365c3a41c8a6bd0812e1ce3da3ed10cea8bb7f
/SpringPOC/src/main/java/com/example/SpringPOC/repository/CustomerRepository.java
9b4d70d9330bc835e2ce3f56ba3c0bb0ad2b8516
[]
no_license
PatelPayal01/SpringPOC
4311494e0c7fbf659cbc63667529aad697cc76c8
6c33bdb5c05f9a74b4a60b3e42bd4a4ba525a367
refs/heads/master
2021-04-09T16:29:51.990152
2018-03-17T19:06:19
2018-03-17T19:06:19
125,659,015
0
0
null
null
null
null
UTF-8
Java
false
false
241
java
package com.example.SpringPOC.repository; import org.springframework.data.repository.CrudRepository; import com.example.SpringPOC.entity.Customer; public interface CustomerRepository extends CrudRepository<Customer, Integer>{ }
393c963e80fa265a911c3c7babdfc0b996e0b83f
cb05f24438119190366c9e8f050cdbdf17cb2769
/Mercado/src/modelo/complementares/UF.java
9b5f32e48b16f3c9338ba2a7709c269ef86f7c53
[]
no_license
rafaelbaiolim/iss-2015
88d4080c782f703f8b8bfbd02fad1f52970da606
33a5a6523df44a644a28d8f103e618b73ac9bd09
refs/heads/master
2021-01-10T04:49:51.949489
2016-02-15T00:34:36
2016-02-15T00:34:36
44,496,608
0
2
null
null
null
null
UTF-8
Java
false
false
2,177
java
package modelo.complementares; import java.io.Serializable; import java.util.Objects; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.TableGenerator; /** * <p>Classe de <b>Modelo</b> UF.</p> * <p>Classe responsavel por representar as UFs do Sistema.</p> * @author Hadyne * @version 1.0 * @since 07/11/2015 */ @Entity @Table (name = "uf") @TableGenerator (name = "uf_generator", table = "generator_id", pkColumnName = "id", valueColumnName = "valor", pkColumnValue = "uf", allocationSize = 1) public class UF implements Serializable { @Id @GeneratedValue(strategy = GenerationType.TABLE, generator = "uf_generator") @Column (name = "id") private Long id; @Column (name = "nome") private String nome; @Column (name = "sigla") private String sigla; public UF() { this.id = null; } public UF(String sNome, String sSigla) { this(); this.nome = sNome.toUpperCase().trim(); this.sigla = sSigla.toUpperCase().trim(); } public Long getId() { return this.id; } public void setId(Long lId) { this.id = lId; } public String getNome() { return this.nome; } public void setNome(String nome) { this.nome = nome.toUpperCase().trim(); } public String getSigla() { return this.sigla; } public void setSigla(String sSigla) { this.sigla = sSigla.toUpperCase().trim(); } @Override public int hashCode() { int hash = 0; hash += (id != null ? id.hashCode() : 0); return hash; } @Override public boolean equals(Object oObject) { if (!(oObject instanceof UF)) { return false; } UF oUF = (UF) oObject; return Objects.equals(this.id, oUF.getId()); } @Override public String toString() { return this.sigla; } }
a7252c3f1a913b73252af9b3804a9776b0ca6d4b
99cd4de6e0fda59ea367a850d6b547c735633c69
/tests/de/espend/idea/laravel/tests/LaravelLightCodeInsightFixtureTestCase.java
fbbdb2dfc3c7812f9e6bf178e42caf295edf4706
[ "MIT" ]
permissive
xversial/idea-php-laravel-plugin
2d29087cf690928aff3c5356a8772605640ab271
36d4c8b3056217bf5068fa465a68c0ec4f5fa3ee
refs/heads/master
2021-05-01T14:05:26.253831
2017-01-16T17:00:38
2017-01-16T17:00:38
79,611,287
0
0
MIT
2020-03-05T12:06:21
2017-01-21T00:04:57
Java
UTF-8
Java
false
false
26,039
java
package de.espend.idea.laravel.tests; import com.intellij.codeInsight.daemon.LineMarkerInfo; import com.intellij.codeInsight.daemon.LineMarkerProvider; import com.intellij.codeInsight.daemon.LineMarkerProviders; import com.intellij.codeInsight.daemon.RelatedItemLineMarkerInfo; import com.intellij.codeInsight.intention.IntentionAction; import com.intellij.codeInsight.intention.IntentionManager; import com.intellij.codeInsight.lookup.LookupElement; import com.intellij.codeInsight.lookup.LookupElementPresentation; import com.intellij.codeInsight.navigation.actions.GotoDeclarationHandler; import com.intellij.codeInspection.*; import com.intellij.navigation.GotoRelatedItem; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.fileTypes.LanguageFileType; import com.intellij.openapi.util.Pair; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.patterns.ElementPattern; import com.intellij.patterns.PlatformPatterns; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiRecursiveElementVisitor; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.psi.tree.IElementType; import com.intellij.psi.util.PsiTreeUtil; import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase; import com.intellij.util.Processor; import com.intellij.util.indexing.FileBasedIndexImpl; import com.intellij.util.indexing.ID; import com.jetbrains.php.lang.psi.elements.Function; import com.jetbrains.php.lang.psi.elements.Method; import com.jetbrains.php.lang.psi.elements.PhpReference; import de.espend.idea.laravel.LaravelSettings; import org.apache.commons.lang.StringUtils; import org.jetbrains.annotations.NotNull; import java.io.File; import java.util.*; /** * @author Daniel Espendiller <[email protected]> * * Copy of SymfonyLightCodeInsightFixtureTestCase */ public abstract class LaravelLightCodeInsightFixtureTestCase extends LightCodeInsightFixtureTestCase { @Override public void setUp() throws Exception { super.setUp(); LaravelSettings.getInstance(myFixture.getProject()).pluginEnabled = true; } public void assertCompletionContains(LanguageFileType languageFileType, String configureByText, String... lookupStrings) { myFixture.configureByText(languageFileType, configureByText); myFixture.completeBasic(); checkContainsCompletion(lookupStrings); } public void assertAtTextCompletionContains(String findByText, String... lookupStrings) { final PsiElement element = myFixture.findElementByText(findByText, PsiElement.class); assert element != null : "No element found by text: " + findByText; myFixture.getEditor().getCaretModel().moveToOffset(element.getTextOffset() + 1); myFixture.completeBasic(); checkContainsCompletion(lookupStrings); } public void assertCompletionNotContains(String text, String configureByText, String... lookupStrings) { myFixture.configureByText(text, configureByText); myFixture.completeBasic(); assertFalse(myFixture.getLookupElementStrings().containsAll(Arrays.asList(lookupStrings))); } public void assertCompletionNotContains(LanguageFileType languageFileType, String configureByText, String... lookupStrings) { myFixture.configureByText(languageFileType, configureByText); myFixture.completeBasic(); assertFalse(myFixture.getLookupElementStrings().containsAll(Arrays.asList(lookupStrings))); } public void assertCompletionContains(String filename, String configureByText, String... lookupStrings) { myFixture.configureByText(filename, configureByText); myFixture.completeBasic(); completionContainsAssert(lookupStrings); } private void completionContainsAssert(String[] lookupStrings) { List<String> lookupElements = myFixture.getLookupElementStrings(); if(lookupElements == null) { fail(String.format("failed that empty completion contains %s", Arrays.toString(lookupStrings))); } for (String s : Arrays.asList(lookupStrings)) { if(!lookupElements.contains(s)) { fail(String.format("failed that completion contains %s in %s", s, lookupElements.toString())); } } } public void assertNavigationContains(LanguageFileType languageFileType, String configureByText, String targetShortcut) { myFixture.configureByText(languageFileType, configureByText); PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset()); assertNavigationContains(psiElement, targetShortcut); } public void assertNavigationContains(PsiElement psiElement, String targetShortcut) { if(!targetShortcut.startsWith("\\")) { targetShortcut = "\\" + targetShortcut; } Set<String> classTargets = new HashSet<String>(); for (GotoDeclarationHandler gotoDeclarationHandler : Extensions.getExtensions(GotoDeclarationHandler.EP_NAME)) { PsiElement[] gotoDeclarationTargets = gotoDeclarationHandler.getGotoDeclarationTargets(psiElement, 0, myFixture.getEditor()); if(gotoDeclarationTargets != null && gotoDeclarationTargets.length > 0) { for (PsiElement gotoDeclarationTarget : gotoDeclarationTargets) { if(gotoDeclarationTarget instanceof Method) { String meName = ((Method) gotoDeclarationTarget).getName(); String clName = ((Method) gotoDeclarationTarget).getContainingClass().getPresentableFQN(); if(!clName.startsWith("\\")) { clName = "\\" + clName; } classTargets.add(clName + "::" + meName); } else if(gotoDeclarationTarget instanceof Function) { classTargets.add("\\" + ((Function) gotoDeclarationTarget).getName()); } } } } if(!classTargets.contains(targetShortcut)) { fail(String.format("failed that PsiElement (%s) navigate to %s on %s", psiElement.toString(), targetShortcut, classTargets.toString())); } } public void assertNavigationMatchWithParent(LanguageFileType languageFileType, String configureByText, IElementType iElementType) { assertNavigationMatch(languageFileType, configureByText, PlatformPatterns.psiElement().withParent(PlatformPatterns.psiElement(iElementType))); } public void assertNavigationMatch(String filename, String configureByText, ElementPattern<?> pattern) { myFixture.configureByText(filename, configureByText); assertNavigationMatch(pattern); } public void assertNavigationMatch(LanguageFileType languageFileType, String configureByText, ElementPattern<?> pattern) { myFixture.configureByText(languageFileType, configureByText); assertNavigationMatch(pattern); } public void assertNavigationMatch(LanguageFileType languageFileType, String configureByText) { myFixture.configureByText(languageFileType, configureByText); assertNavigationMatch(PlatformPatterns.psiElement()); } public void assertNavigationMatch(String filename, String configureByText) { myFixture.configureByText(filename, configureByText); assertNavigationMatch(PlatformPatterns.psiElement()); } public void assertNavigationIsEmpty(LanguageFileType languageFileType, String configureByText) { myFixture.configureByText(languageFileType, configureByText); assertNavigationIsEmpty(); } public void assertNavigationIsEmpty(String content, String configureByText) { myFixture.configureByText(content, configureByText); assertNavigationIsEmpty(); } private void assertNavigationIsEmpty() { PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset()); for (GotoDeclarationHandler gotoDeclarationHandler : Extensions.getExtensions(GotoDeclarationHandler.EP_NAME)) { PsiElement[] gotoDeclarationTargets = gotoDeclarationHandler.getGotoDeclarationTargets(psiElement, 0, myFixture.getEditor()); if(gotoDeclarationTargets != null && gotoDeclarationTargets.length > 0) { fail(String.format("failed that PsiElement (%s) navigate is empty; found target in '%s'", psiElement.toString(), gotoDeclarationHandler.getClass())); } } } private void assertNavigationMatch(ElementPattern<?> pattern) { PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset()); Set<String> targetStrings = new HashSet<String>(); for (GotoDeclarationHandler gotoDeclarationHandler : Extensions.getExtensions(GotoDeclarationHandler.EP_NAME)) { PsiElement[] gotoDeclarationTargets = gotoDeclarationHandler.getGotoDeclarationTargets(psiElement, 0, myFixture.getEditor()); if(gotoDeclarationTargets == null || gotoDeclarationTargets.length == 0) { continue; } for (PsiElement gotoDeclarationTarget : gotoDeclarationTargets) { targetStrings.add(gotoDeclarationTarget.toString()); if(pattern.accepts(gotoDeclarationTarget)) { return; } } } fail(String.format("failed that PsiElement (%s) navigate matches one of %s", psiElement.toString(), targetStrings.toString())); } public void assertNavigationContainsFile(LanguageFileType languageFileType, String configureByText, String targetShortcut) { myFixture.configureByText(languageFileType, configureByText); PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset()); Set<String> targets = new HashSet<String>(); for (GotoDeclarationHandler gotoDeclarationHandler : Extensions.getExtensions(GotoDeclarationHandler.EP_NAME)) { PsiElement[] gotoDeclarationTargets = gotoDeclarationHandler.getGotoDeclarationTargets(psiElement, 0, myFixture.getEditor()); if (gotoDeclarationTargets != null && gotoDeclarationTargets.length > 0) { for (PsiElement gotoDeclarationTarget : gotoDeclarationTargets) { if(gotoDeclarationTarget instanceof PsiFile) { targets.add(((PsiFile) gotoDeclarationTarget).getVirtualFile().getUrl()); } } } } // its possible to have memory fields, // so simple check for ending conditions // temp:///src/interchange.en.xlf for (String target : targets) { if(target.endsWith(targetShortcut)) { return; } } fail(String.format("failed that PsiElement (%s) navigate to file %s", psiElement.toString(), targetShortcut)); } public void assertCompletionLookupTailEquals(LanguageFileType languageFileType, String configureByText, String lookupString, String tailText) { assertCompletionLookup(languageFileType, configureByText, lookupString, new LookupElement.TailTextEqualsAssert(tailText)); } public void assertCompletionLookup(LanguageFileType languageFileType, String configureByText, String lookupString, LookupElement.Assert assertMatch) { myFixture.configureByText(languageFileType, configureByText); myFixture.completeBasic(); for (com.intellij.codeInsight.lookup.LookupElement lookupElement : myFixture.getLookupElements()) { if(!lookupElement.getLookupString().equals(lookupString)) { continue; } LookupElementPresentation presentation = new LookupElementPresentation(); lookupElement.renderElement(presentation); if(assertMatch.match(presentation)) { return; } fail(String.format("fail that on element '%s' with '%s' matches '%s'", lookupString, assertMatch.getClass(), presentation.toString())); } fail(String.format("failed to check '%s' because it's unknown", lookupString)); } public void assertPhpReferenceResolveTo(LanguageFileType languageFileType, String configureByText, ElementPattern<?> pattern) { myFixture.configureByText(languageFileType, configureByText); PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset()); psiElement = PsiTreeUtil.getParentOfType(psiElement, PhpReference.class); if (psiElement == null) { fail("Element is not PhpReference."); } assertTrue(pattern.accepts(((PhpReference) psiElement).resolve())); } public void assertPhpReferenceNotResolveTo(LanguageFileType languageFileType, String configureByText, ElementPattern<?> pattern) { myFixture.configureByText(languageFileType, configureByText); PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset()); psiElement = PsiTreeUtil.getParentOfType(psiElement, PhpReference.class); if (psiElement == null) { fail("Element is not PhpReference."); } assertFalse(pattern.accepts(((PhpReference) psiElement).resolve())); } public void assertPhpReferenceSignatureEquals(LanguageFileType languageFileType, String configureByText, String typeSignature) { myFixture.configureByText(languageFileType, configureByText); PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset()); psiElement = PsiTreeUtil.getParentOfType(psiElement, PhpReference.class); if (!(psiElement instanceof PhpReference)) { fail("Element is not PhpReference."); } assertEquals(typeSignature, ((PhpReference) psiElement).getSignature()); } public void assertCompletionResultEquals(String filename, String complete, String result) { myFixture.configureByText(filename, complete); myFixture.completeBasic(); myFixture.checkResult(result); } public void assertCompletionResultEquals(LanguageFileType languageFileType, String complete, String result) { myFixture.configureByText(languageFileType, complete); myFixture.completeBasic(); myFixture.checkResult(result); } public void assertCheckHighlighting(String filename, String result) { myFixture.configureByText(filename, result); myFixture.checkHighlighting(); } public void assertIndexContains(@NotNull ID<String, ?> id, @NotNull String... keys) { assertIndex(id, false, keys); } public void assertIndexNotContains(@NotNull ID<String, ?> id, @NotNull String... keys) { assertIndex(id, true, keys); } public void assertIndex(@NotNull ID<String, ?> id, boolean notCondition, @NotNull String... keys) { for (String key : keys) { final Collection<VirtualFile> virtualFiles = new ArrayList<VirtualFile>(); FileBasedIndexImpl.getInstance().getFilesWithKey(id, new HashSet<String>(Arrays.asList(key)), new Processor<VirtualFile>() { @Override public boolean process(VirtualFile virtualFile) { virtualFiles.add(virtualFile); return true; } }, GlobalSearchScope.allScope(getProject())); if(notCondition && virtualFiles.size() > 0) { fail(String.format("Fail that ID '%s' not contains '%s'", id.toString(), key)); } else if(!notCondition && virtualFiles.size() == 0) { fail(String.format("Fail that ID '%s' contains '%s'", id.toString(), key)); } } } public void assertIndexContainsKeyWithValue(@NotNull ID<String, String> id, @NotNull String key, @NotNull String value) { assertContainsElements(FileBasedIndexImpl.getInstance().getValues(id, key, GlobalSearchScope.allScope(getProject())), value); } public <T> void assertIndexContainsKeyWithValue(@NotNull ID<String, T> id, @NotNull String key, @NotNull IndexValue.Assert<T> tAssert) { List<T> values = FileBasedIndexImpl.getInstance().getValues(id, key, GlobalSearchScope.allScope(getProject())); for (T t : values) { if(tAssert.match(t)) { return; } } fail(String.format("Fail that Key '%s' matches on of '%s' values", key, values.size())); } public void assertLocalInspectionContains(String filename, String content, String contains) { Set<String> matches = new HashSet<String>(); Pair<List<ProblemDescriptor>, Integer> localInspectionsAtCaret = getLocalInspectionsAtCaret(filename, content); for (ProblemDescriptor result : localInspectionsAtCaret.getFirst()) { TextRange textRange = result.getPsiElement().getTextRange(); if (textRange.contains(localInspectionsAtCaret.getSecond()) && result.toString().equals(contains)) { return; } matches.add(result.toString()); } fail(String.format("Fail matches '%s' with one of %s", contains, matches)); } public void assertIntentionIsAvailable(LanguageFileType languageFileType, String configureByText, String intentionText) { myFixture.configureByText(languageFileType, configureByText); PsiElement psiElement = myFixture.getFile().findElementAt(myFixture.getCaretOffset()); for (IntentionAction intentionAction : IntentionManager.getInstance().getIntentionActions()) { if(intentionAction.isAvailable(getProject(), getEditor(), psiElement.getContainingFile()) && intentionAction.getText().equals(intentionText)) { return; } } fail(String.format("Fail intention action '%s' is available in element '%s'", intentionText, psiElement.getText())); } public void assertLocalInspectionContainsNotContains(String filename, String content, String contains) { Pair<List<ProblemDescriptor>, Integer> localInspectionsAtCaret = getLocalInspectionsAtCaret(filename, content); for (ProblemDescriptor result : localInspectionsAtCaret.getFirst()) { TextRange textRange = result.getPsiElement().getTextRange(); if (textRange.contains(localInspectionsAtCaret.getSecond())) { fail(String.format("Fail inspection not contains '%s'", contains)); } } } private Pair<List<ProblemDescriptor>, Integer> getLocalInspectionsAtCaret(String filename, String content) { PsiElement psiFile = myFixture.configureByText(filename, content); int caretOffset = myFixture.getCaretOffset(); if(caretOffset <= 0) { fail("Please provide <caret> tag"); } ProblemsHolder problemsHolder = new ProblemsHolder(InspectionManager.getInstance(getProject()), psiFile.getContainingFile(), false); for (LocalInspectionEP localInspectionEP : LocalInspectionEP.LOCAL_INSPECTION.getExtensions()) { Object object = localInspectionEP.getInstance(); if(!(object instanceof LocalInspectionTool)) { continue; } ((LocalInspectionTool) object).buildVisitor(problemsHolder, false); } return new Pair<List<ProblemDescriptor>, Integer>(problemsHolder.getResults(), caretOffset); } protected void assertLocalInspectionIsEmpty(String filename, String content) { Pair<List<ProblemDescriptor>, Integer> localInspectionsAtCaret = getLocalInspectionsAtCaret(filename, content); for (ProblemDescriptor result : localInspectionsAtCaret.getFirst()) { TextRange textRange = result.getPsiElement().getTextRange(); if (textRange.contains(localInspectionsAtCaret.getSecond())) { fail("Fail that matches is empty"); } } } protected void createDummyFiles(String... files) throws Exception { for (String file : files) { String path = myFixture.getProject().getBaseDir().getPath() + "/" + file; File f = new File(path); f.getParentFile().mkdirs(); f.createNewFile(); } } private void checkContainsCompletion(String[] lookupStrings) { completionContainsAssert(lookupStrings); } public void assertLineMarker(@NotNull PsiElement psiElement, @NotNull LineMarker.Assert assertMatch) { final List<PsiElement> elements = collectPsiElementsRecursive(psiElement); for (LineMarkerProvider lineMarkerProvider : LineMarkerProviders.INSTANCE.allForLanguage(psiElement.getLanguage())) { Collection<LineMarkerInfo> lineMarkerInfos = new ArrayList<LineMarkerInfo>(); lineMarkerProvider.collectSlowLineMarkers(elements, lineMarkerInfos); if(lineMarkerInfos.size() == 0) { continue; } for (LineMarkerInfo lineMarkerInfo : lineMarkerInfos) { if(assertMatch.match(lineMarkerInfo)) { return; } } } fail(String.format("Fail that '%s' matches on of '%s' PsiElements", assertMatch.getClass(), elements.size())); } public void assertLineMarkerIsEmpty(@NotNull PsiElement psiElement) { final List<PsiElement> elements = collectPsiElementsRecursive(psiElement); for (LineMarkerProvider lineMarkerProvider : LineMarkerProviders.INSTANCE.allForLanguage(psiElement.getLanguage())) { Collection<LineMarkerInfo> lineMarkerInfos = new ArrayList<LineMarkerInfo>(); lineMarkerProvider.collectSlowLineMarkers(elements, lineMarkerInfos); if(lineMarkerInfos.size() > 0) { fail(String.format("Fail that line marker is empty because it matches '%s'", lineMarkerProvider.getClass())); } } } @NotNull private List<PsiElement> collectPsiElementsRecursive(@NotNull PsiElement psiElement) { final List<PsiElement> elements = new ArrayList<PsiElement>(); elements.add(psiElement.getContainingFile()); psiElement.acceptChildren(new PsiRecursiveElementVisitor() { @Override public void visitElement(PsiElement element) { elements.add(element); super.visitElement(element); } }); return elements; } public static class IndexValue { public interface Assert<T> { boolean match(@NotNull T value); } } public static class LineMarker { public interface Assert { boolean match(@NotNull LineMarkerInfo markerInfo); } public static class ToolTipEqualsAssert implements Assert { @NotNull private final String toolTip; public ToolTipEqualsAssert(@NotNull String toolTip) { this.toolTip = toolTip; } @Override public boolean match(@NotNull LineMarkerInfo markerInfo) { return markerInfo.getLineMarkerTooltip() != null && markerInfo.getLineMarkerTooltip().equals(toolTip); } } public static class TargetAcceptsPattern implements Assert { @NotNull private final String toolTip; @NotNull private final ElementPattern<? extends PsiElement> pattern; public TargetAcceptsPattern(@NotNull String toolTip, @NotNull ElementPattern<? extends PsiElement> pattern) { this.toolTip = toolTip; this.pattern = pattern; } @Override public boolean match(@NotNull LineMarkerInfo markerInfo) { if(markerInfo.getLineMarkerTooltip() == null || !markerInfo.getLineMarkerTooltip().equals(toolTip)) { return false; } if(!(markerInfo instanceof RelatedItemLineMarkerInfo)) { return false; } for (Object o : ((RelatedItemLineMarkerInfo) markerInfo).createGotoRelatedItems()) { if(o instanceof GotoRelatedItem && this.pattern.accepts(((GotoRelatedItem) o).getElement())) { return true; } } return false; } } } public static class LookupElement { public interface Assert { boolean match(@NotNull LookupElementPresentation lookupElement); } public static class TailTextEqualsAssert implements Assert { @NotNull private final String contents; public TailTextEqualsAssert(@NotNull String contents) { this.contents = contents; } @Override public boolean match(@NotNull LookupElementPresentation lookupElement) { return this.contents.equals(lookupElement.getTailText()); } } public static class TypeTextEqualsAssert implements Assert { @NotNull private final String contents; public TypeTextEqualsAssert(@NotNull String contents) { this.contents = contents; } @Override public boolean match(@NotNull LookupElementPresentation lookupElement) { return this.contents.equals(lookupElement.getTypeText()); } } public static class TailTextIsBlankAssert implements Assert { @Override public boolean match(@NotNull LookupElementPresentation lookupElement) { return StringUtils.isBlank(lookupElement.getTailText()); } } } }
f4c8b7ad9f44bb04241c923fe4ab3d086662648e
8702b7d42890a01ce79f74a9fd3f225be5876763
/Q17/Q17.java
beeea7961e7ae649335ab0cb5919f60da12efa98
[]
no_license
sam-pm/practice
fa0bde5ba476a3d405913a9ebf1120f3f3ee2dd3
5ef8f4251ba5bd505d27c5a0a5ea2fb6cc8bf738
refs/heads/master
2020-07-14T03:35:29.441325
2019-10-02T19:05:11
2019-10-02T19:05:11
205,227,934
0
0
null
null
null
null
UTF-8
Java
false
false
315
java
import java.util.ArrayList; public class Q17{ public List<String> letterCombinations(String digits){ // Variables and data structures ArrayList<String> answer_list = new ArrayList<String>(); System.out.println(digits); for(int i = 0; i < digitis.length(); i++){ //stub } return null; } }
d9d091e07524d8e240f21197f2be723c1400afb0
eda0456bb9983a2ce9d324873909121d68f8a980
/src/com/dev/news/servlet/APIServlet.java
ea5c716dfac0f513c4b29dccb55a692ffe3b4a5a
[ "Apache-2.0" ]
permissive
thiru1906/news-app
a61585f5590550537dd9749c54a0dcb826b20fce
04501714c76e1a676b8a848c95e7dc1a1ecc6146
refs/heads/main
2023-03-12T20:48:31.360955
2021-03-02T10:54:05
2021-03-02T10:54:05
343,674,141
0
0
null
null
null
null
UTF-8
Java
false
false
2,621
java
//$Id$ package com.dev.news.servlet; import java.io.IOException; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.HashMap; import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.json.JSONObject; import com.dev.news.db.Db; import com.dev.news.handler.Handler; public class APIServlet extends HttpServlet{ static final Logger LOGGER = Logger.getLogger(APIServlet.class.toString()); private static ThreadLocal<Connection> connection = new ThreadLocal<>(); public static Map<Long, JSONObject> userCache = new HashMap<>(); public static ThreadLocal<Long> tokenId = new ThreadLocal<>(); private static Connection getConnection() { return connection.get(); } public static JSONObject getUserInfo() { return userCache.get(tokenId.get()); } public static void setTokenId(long token) { tokenId.set(token); } private static void createConnection() throws Exception { if(connection.get() == null) { connection.set(Db.getSource().getConnection()); } } public static PreparedStatement getStatement(String query) { try { createConnection(); return getConnection().prepareStatement(query); } catch (Exception e1) { LOGGER.log(Level.SEVERE, e1.getMessage(), e1); } return null; } public static void closeConnection() { if(connection.get() != null) { try { connection.get().close(); connection.remove(); } catch (SQLException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } } } /** * */ private static final long serialVersionUID = -3672604105231439511L; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { try { JSONObject obj = Handler.operationEntry(req, resp); resp.setContentType("json/application"); resp.getWriter().write(obj.toString()); } catch (Exception e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); } } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doGet(req, resp); } @Override protected void doPut(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doGet(req, resp); } @Override protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doGet(req, resp); } }
d36847810fd2a392f50f90be89311c1f4485e175
79bfcfcf1e9308019881eab56aec4af6b3468a5a
/Zadanie1/src/main/java/Zadanie1/Zadanie1/ProductMapper.java
2ad0bd0d09bb56defd60148936e960d5f743a86e
[]
no_license
velislav30Student/BigData_Projects
3caea4bc298e1125dae28b70637d8a4e1a00a7fa
e31255d19166613e73e506a353ff0254c2ec3eee
refs/heads/master
2023-08-27T00:12:30.730075
2021-10-29T17:17:27
2021-10-29T17:17:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,230
java
package Zadanie1.Zadanie1; import java.io.IOException; import java.util.ArrayList; import java.util.StringTokenizer; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapred.MapReduceBase; import org.apache.hadoop.mapred.Mapper; import org.apache.hadoop.mapred.OutputCollector; import org.apache.hadoop.mapred.Reporter; public class ProductMapper extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable>{ @Override public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException { //Skip Header Row - contains Column Names if(key.get() == 0) { return; } int ProductColumnIndex = 1; String row = value.toString(); StringTokenizer tokenizer = new StringTokenizer(row, ","); //Array is needed to get the token that corresponds to the needed column ArrayList<String> tokens = new ArrayList<String>(); while (tokenizer.hasMoreTokens()) { tokens.add(tokenizer.nextToken().replace(" ", "")); } Text outputKey = new Text(tokens.get(ProductColumnIndex)); output.collect(outputKey, new IntWritable(1)); } }
a6f263eedb721720b8bea0b6183d76445e729713
ecc9a3aa55c5100dd7d811837079afa528904522
/project/popcustomerservice/src/main/java/com/pop136/core/webservice/client/axis/RecvSmsExResponseRecvSmsExResult.java
cef6970a53c8ec4b7bd62469cc67ae8afd6b30e6
[]
no_license
vian127/complateCRM
eb01a30b4ca3b7e3e9ac0b69ed334b168c154908
fe0c0b754240188b1cddfa4a1b8adad6196d7f5a
refs/heads/master
2020-03-28T23:22:09.975327
2018-09-18T13:38:08
2018-09-18T13:38:08
149,288,199
0
0
null
null
null
null
UTF-8
Java
false
false
3,641
java
/** * RecvSmsExResponseRecvSmsExResult.java * * This file was auto-generated from WSDL * by the Apache Axis 1.4 Apr 22, 2006 (06:55:48 PDT) WSDL2Java emitter. */ package com.pop136.core.webservice.client.axis; public class RecvSmsExResponseRecvSmsExResult implements java.io.Serializable, org.apache.axis.encoding.AnyContentType, org.apache.axis.encoding.MixedContentType { private org.apache.axis.message.MessageElement [] _any; public RecvSmsExResponseRecvSmsExResult() { } public RecvSmsExResponseRecvSmsExResult( org.apache.axis.message.MessageElement [] _any) { this._any = _any; } /** * Gets the _any value for this RecvSmsExResponseRecvSmsExResult. * * @return _any */ public org.apache.axis.message.MessageElement [] get_any() { return _any; } /** * Sets the _any value for this RecvSmsExResponseRecvSmsExResult. * * @param _any */ public void set_any(org.apache.axis.message.MessageElement [] _any) { this._any = _any; } private Object __equalsCalc = null; public synchronized boolean equals(Object obj) { if (!(obj instanceof RecvSmsExResponseRecvSmsExResult)) return false; RecvSmsExResponseRecvSmsExResult other = (RecvSmsExResponseRecvSmsExResult) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = true && ((this._any==null && other.get_any()==null) || (this._any!=null && java.util.Arrays.equals(this._any, other.get_any()))); __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = 1; if (get_any() != null) { for (int i=0; i<java.lang.reflect.Array.getLength(get_any()); i++) { Object obj = java.lang.reflect.Array.get(get_any(), i); if (obj != null && !obj.getClass().isArray()) { _hashCode += obj.hashCode(); } } } __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(RecvSmsExResponseRecvSmsExResult.class, true); static { typeDesc.setXmlType(new javax.xml.namespace.QName("http://tempuri.org/", ">>RecvSmsExResponse>RecvSmsExResult")); } /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } /** * Get Custom Serializer */ public static org.apache.axis.encoding.Serializer getSerializer( String mechType, Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanSerializer( _javaType, _xmlType, typeDesc); } /** * Get Custom Deserializer */ public static org.apache.axis.encoding.Deserializer getDeserializer( String mechType, Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanDeserializer( _javaType, _xmlType, typeDesc); } }
[ "fengfeng" ]
fengfeng
b9c2c6ae12e804f829896d2a9572d28019e2a115
ed4e96e0db58fcd8a0719b1858ba4832b188b668
/src/servlet/HandleExportStudentScore.java
b8adbedb4988c1bc10be17266e8a7d7c61427246
[]
no_license
nkyyy01/onlineexam
ef62b20dfe2bd5297f39da61b4a781c8d7519c44
0f3e543e904a71bb94d139f4cb750e2196f25d4e
refs/heads/master
2023-07-05T23:16:12.451369
2020-09-01T04:39:28
2020-09-01T04:39:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,417
java
package servlet; import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.sql.*; import java.text.SimpleDateFormat; import java.util.Date; import java.util.LinkedList; import java.util.List; /** * @author super lollipop * @date 4/6/20 */ public class HandleExportStudentScore extends HttpServlet { @Override public void init(ServletConfig config) throws ServletException { super.init(config); try { Class.forName("com.mysql.jdbc.Driver"); } catch (Exception e){ e.printStackTrace(); } } @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { this.doPost(req,resp); } @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String TARGET_DIRECTORY="excelfile"; //上传文件的目录* String uploadPath = getServletContext().getRealPath("/") + TARGET_DIRECTORY; String exam_description_id = request.getParameter("exam_description_id"); String message = ""; //用作重定向提示参数 if (exam_description_id != null){ try {//连接数据库 String url = this.getServletContext().getInitParameter("url"); String user = this.getServletContext().getInitParameter("user"); String pwd = this.getServletContext().getInitParameter("password"); Connection connection = DriverManager.getConnection(url, user, pwd); PreparedStatement preparedStatement = connection.prepareStatement("SELECT users_information.id,users_information.`name`,exam_description,total_score,obtain_score\n" + " FROM users_information, exams_description,examrecord where users_information.id=examrecord.user_id\n" + " and exams_description.id=examrecord.exam_description_id and examrecord.exam_description_id=?\n" + " order by users_information.id;"); preparedStatement.setInt(1,Integer.parseInt(exam_description_id)); ResultSet resultSet = preparedStatement.executeQuery(); List<List<Object>> rowList = new LinkedList<>(); while (resultSet.next()){ List<Object> columnList = new LinkedList<>(); System.out.println(resultSet.getString(1)); columnList.add(resultSet.getString(1)); System.out.println(resultSet.getString(2)); columnList.add(resultSet.getString(2)); System.out.println(resultSet.getString(3)); columnList.add(resultSet.getString(3)); System.out.println(resultSet.getFloat(4)); columnList.add(resultSet.getFloat(4)); System.out.println(resultSet.getFloat(5)); columnList.add(resultSet.getFloat(5)); rowList.add(columnList); } //创建工作薄对象 HSSFWorkbook workbook=new HSSFWorkbook();//这里也可以设置sheet的Name //创建工作表对象 HSSFSheet sheet = workbook.createSheet(); workbook.setSheetName(0,"sheet1");//设置sheet的Name //创建工作表的行 HSSFRow headRow = sheet.createRow(0);//设置第一行,从零开始 headRow.createCell(0).setCellValue("考生号"); headRow.createCell(1).setCellValue("姓名"); headRow.createCell(2).setCellValue("试题描述"); headRow.createCell(3).setCellValue("总分"); headRow.createCell(4).setCellValue("得分"); for (int i = 0; i < rowList.size(); i++) { HSSFRow row = sheet.createRow(i + 1); System.out.println((String) rowList.get(i).get(0)); row.createCell(0).setCellValue((String) rowList.get(i).get(0)); row.createCell(1).setCellValue((String) rowList.get(i).get(1)); row.createCell(2).setCellValue((String) rowList.get(i).get(2)); row.createCell(3).setCellValue((Float) rowList.get(i).get(3)); row.createCell(4).setCellValue((Float) rowList.get(i).get(4)); } //文档输出 FileOutputStream out = new FileOutputStream(uploadPath + File.separator + exam_description_id + ".xls"); workbook.write(out); out.close(); System.out.println(uploadPath + File.separator + exam_description_id + ".xls"); response.sendRedirect("../excelfile/" + exam_description_id + ".xls"); }catch (SQLException e){ e.printStackTrace(); } }else { } } }
4ca441fd9fadac9c8b89d8df938e0156cb3eb520
f157ecb6b5f5dc59504babd1ba87f0e46a5c0667
/Week_02/G20200343030499/LeetCode_105_499.java
1b5cefefe5cce84f51690a2f3ac945501b984327
[]
no_license
algorithm006-class01/algorithm006-class01
891da256a54640cf1820db93380f4253f6aacecd
7ad9b948f8deecf35dced38a62913e462e699b1c
refs/heads/master
2020-12-27T14:43:13.449713
2020-04-20T06:56:33
2020-04-20T06:56:33
237,936,958
19
140
null
2020-04-20T06:56:34
2020-02-03T10:13:53
Java
UTF-8
Java
false
false
3,540
java
/* * @lc app=leetcode id=105 lang=java * * [105] Construct Binary Tree from Preorder and Inorder Traversal */ // @lc code=start /** * Definition for a binary tree node. public class TreeNode { int val; TreeNode * left; TreeNode right; TreeNode(int x) { val = x; } } */ class Solution_1 { public TreeNode buildTree(int[] preorder, int[] inorder) { // assume preorder and inorder won't be null if (preorder.length == 0) { return null; } int rootVal = preorder[0]; TreeNode rootNode = new TreeNode(rootVal); if (preorder.length == 1) { return rootNode; } int rootIndexInInorder = -1; for (int i = 0; i < inorder.length; i++) { if (rootVal == inorder[i]) { rootIndexInInorder = i; break; } } int leftSize = rootIndexInInorder; int rightSize = inorder.length - leftSize - 1; int[][] preorderPartitions = getPreorderPartitions(preorder, leftSize, rightSize); int[][] inorderPartitions = getInorderPartitions(inorder, leftSize, rightSize); rootNode.left = buildTree(preorderPartitions[0], inorderPartitions[0]); rootNode.right = buildTree(preorderPartitions[1], inorderPartitions[1]); return rootNode; } private int[][] getPreorderPartitions(int[] array, int leftSize, int rightSize) { // int[] root = new int[] { array[0] }; int[] left = new int[leftSize]; int[] right = new int[rightSize]; for (int i = 0; i < leftSize; i++) { left[i] = array[i + 1]; } for (int i = 0; i < rightSize; i++) { right[i] = array[i + leftSize + 1]; } return new int[][] { left, right }; } private int[][] getInorderPartitions(int[] array, int leftSize, int rightSize) { // int[] root = new int[1]; int[] left = new int[leftSize]; int[] right = new int[rightSize]; for (int i = 0; i < leftSize; i++) { left[i] = array[i]; } for (int i = 0; i < rightSize; i++) { right[i] = array[i + leftSize + 1]; } return new int[][] { left, right }; } } class Solution { public TreeNode buildTree(int[] preorder, int[] inorder) { return buildTree(preorder, inorder, 0, preorder.length, 0, inorder.length); } private TreeNode buildTree(int[] preorder, int[] inorder, int preorderLeftEnd, int preorderRightEnd, int inorderLeftEnd, int inorderRightEnd) { if (preorderRightEnd - preorderLeftEnd == 0) { return null; } TreeNode rootNode = new TreeNode(preorder[preorderLeftEnd]); if (preorderRightEnd - preorderLeftEnd == 1) { return rootNode; } // find index of the root in inorder int rootInInorder = -1; for (int i = inorderLeftEnd; i < inorderRightEnd; i++) { if (preorder[preorderLeftEnd] == inorder[i]) { rootInInorder = i; break; } } int leftNodeSize = rootInInorder - inorderLeftEnd; rootNode.left = buildTree(preorder, inorder, preorderLeftEnd + 1, preorderLeftEnd + leftNodeSize + 1, inorderLeftEnd, rootInInorder); rootNode.right = buildTree(preorder, inorder, preorderLeftEnd + leftNodeSize + 1, preorderRightEnd, rootInInorder + 1, inorderRightEnd); return rootNode; } } // @lc code=end
842d9a1878af68ccf5ffe90f270bc826063b9cdb
e0af9ba5cd7c1e9e43e7f3e5dc8d9f890cf6ec89
/Serena and Mugs/Main.java
a789e4831fcafe01f7b101f92430ab48815f8d2d
[]
no_license
neetuchandravadan08/Playground
fc373ef3875dc3b86552784f9ac1c19bde923601
b7e7794f6d64244daf88ac4abefcff25c5f9819e
refs/heads/master
2021-06-03T02:48:41.929550
2020-06-30T07:59:58
2020-06-30T07:59:58
254,332,723
0
0
null
null
null
null
UTF-8
Java
false
false
296
java
#include<iostream> using namespace std; int main() { int c,sum=0,n; cin>>n; cin>>c; int arr[n]; for(int i=0;i<n;i++) { cin>>arr[i]; } for(int i=0;i<n;i++) { sum=sum+arr[i]; } if(sum<=c) { cout<<"YES"; } else { cout<<"NO"; } return 0; }
97e6eb679c6dd18eb48c5f95acfe3e6fdee083d5
0a1f6c1e9d7d002e1f3f553debb2a7aa4ad3752c
/002TodoApp-Servlet-JSP-JDBC/src/main/java/com/balaji/todoapp/service/LoginServiceImpl.java
b5c0ea0e5e488d107b722a6b8d69e3335f78190f
[]
no_license
vijaykumar4u/TodoApps
428a3eccbfb05d6b7645f33a8a76b2936a0b7433
532dc187e49b7decae9999ffd65dc24d4bbe9fc0
refs/heads/main
2023-01-21T19:20:50.583564
2020-12-03T10:27:44
2020-12-03T10:27:44
318,151,695
0
0
null
null
null
null
UTF-8
Java
false
false
353
java
package com.balaji.todoapp.service; import com.balaji.todoapp.dao.LoginDAO; import com.balaji.todoapp.dao.LoginDAOImpl; public class LoginServiceImpl implements LoginService { private LoginDAO loginDAO = new LoginDAOImpl(); @Override public boolean isUserValid(String user, String password) { return loginDAO.isUserValid(user, password); } }
58a4b4e5496b13f12fb0909a27c4ca6ab4abd7ce
ed2fa0fc455cb4a56669b34639bb95b25c6b7f83
/wen-13/sys/src/main/java/nancy/Dao/studentDao.java
06545338e5b890f06ecafe97e9ec738845e98632
[]
no_license
w7436/wen-Java
5bcc2b09faa478196218e46ff64cd23ba64da441
6fc9f2a336c512a0d9be70c69950ad5610b3b152
refs/heads/master
2022-11-27T07:51:28.158473
2020-09-11T03:49:41
2020-09-11T03:49:41
210,778,808
0
0
null
2022-11-16T08:36:03
2019-09-25T07:08:33
JavaScript
UTF-8
Java
false
false
4,359
java
package nancy.Dao; import nancy.Util.DBUtil; import nancy.exception.SystemException; import nancy.model.student; import java.sql.*; import java.util.ArrayList; import java.util.List; /** * @ClassName studentDao * @Description TODO * @Author DELL * @Data 2020/7/1 12:55 * @Version 1.0 **/ public class studentDao { /** * 学生登录 * @return * @throws Exception */ public static boolean login(Connection con,int id,String password)throws Exception{ String sql="select * from student where Id=? and password=?"; PreparedStatement pstmt=con.prepareStatement(sql); pstmt.setInt(1,id); pstmt.setString(2,password); ResultSet rs=pstmt.executeQuery(); if(!rs.next()){ System.out.println("登录失败"); return false; }else{ System.out.println("登录成功"); return true; } } //学生信息查询 public static List<student> queryList(Connection c){ PreparedStatement p =null; ResultSet r = null; String sql ="select * from student "; List<student> list = new ArrayList<student>(); try { p = c.prepareStatement(sql); r = p.executeQuery(); while(r.next()){ student stu = new student(); stu.setId(r.getInt("Id")); stu.setName(r.getString("name")); stu.setSex(r.getString("sex")); stu.setBirthday(r.getDate("bithday")); stu.setPassword(r.getString("password")); stu.setDepart(r.getString("depart")); stu.setPhone(r.getString("phone")); stu.setEmail(r.getString("email")); list.add(stu); } return list; } catch (SQLException e) { throw new SystemException("查询出错"); } finally { DBUtil.close(c,p,r); } } //学生添加 public static int studentAdd(Connection con,student stu)throws Exception{ String sql="insert into student values(null,?,?,?,?,?,?,?)"; PreparedStatement pstmt=con.prepareStatement(sql); pstmt.setString(1, stu.getName()); pstmt.setString(2, stu.getSex()); pstmt.setDate(3, (Date) stu.getBirthday()); pstmt.setString(4,stu.getPassword()); pstmt.setString(5, stu.getDepart()); pstmt.setString(6, stu.getPhone()); pstmt.setString(7,stu.getEmail()); return pstmt.executeUpdate(); } //更改学生密码 public static boolean studentUpdate(Connection con,int id,String password)throws Exception{ String sql="update student set password=? where Id=?"; PreparedStatement pstmt=con.prepareStatement(sql); pstmt.setString(1, password); pstmt.setInt(2, id); int line = pstmt.executeUpdate(); return line > 0 ? true :false; } /** * 学生删除 * @param con * @param id * @return * @throws Exception */ public static int studentDelete(Connection con,int id)throws Exception{ String sql="delete from student where Id=?"; PreparedStatement pstmt=con.prepareStatement(sql); pstmt.setInt(1, id); return pstmt.executeUpdate(); } //根据姓名查询个人信息 public static student qustudent(Connection c,int id)throws Exception{ PreparedStatement p =null; ResultSet r = null; String sql ="select * from student where Id = ? "; student stu = new student(); try { p = c.prepareStatement(sql); p.setInt(1,id); r = p.executeQuery(); while(r.next()){ stu.setId(id); stu.setName(r.getString("name")); stu.setSex(r.getString("sex")); stu.setBirthday(r.getDate("bithday")); stu.setPassword(r.getString("password")); stu.setDepart(r.getString("depart")); stu.setPhone(r.getString("phone")); stu.setEmail(r.getString("email")); } return stu; } catch (SQLException e) { throw new SystemException("查询出错"); } finally { DBUtil.close(c,p,r); } } }
3cb098fc94d0384a9f620c86f18f0cb46ad9a93f
95e0f69ab7b3ff500ae737c9ba1b2dad42028b7d
/src/main/java/io/github/ourongbin/dev/codegen/util/TemplateUtil.java
b8fd098fbf94a0a931607103f109be3eb019e25c
[]
no_license
ourongbin/code-gen
17f003b786a3dd6f3abe76ea7b2573da519b52bf
4eb4e3c5444c6a63bac1e9e27c61b3626a74983b
refs/heads/master
2023-06-04T01:58:48.280772
2021-01-21T07:22:24
2021-01-21T07:22:24
366,366,929
0
0
null
null
null
null
UTF-8
Java
false
false
2,190
java
package io.github.ourongbin.dev.codegen.util; import freemarker.cache.ClassTemplateLoader; import freemarker.template.Configuration; import freemarker.template.Template; import freemarker.template.TemplateException; import freemarker.template.TemplateExceptionHandler; import lombok.extern.slf4j.Slf4j; import java.io.*; import java.util.Locale; import java.util.Map; @Slf4j public class TemplateUtil { private static final Configuration freemarkerConfig = new Configuration(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS); static { try { //2020-06-21 zhengkai 修复path问题导致jar无法运行而本地项目可以运行的bug freemarkerConfig.setClassForTemplateLoading(TemplateUtil.class, "/templates"); freemarkerConfig.setTemplateLoader(new ClassTemplateLoader(TemplateUtil.class, "/templates")); //freemarkerConfig.setDirectoryForTemplateLoading(new File(templatePath, "templates/code-generator")); freemarkerConfig.setNumberFormat("#"); freemarkerConfig.setClassicCompatible(true); freemarkerConfig.setDefaultEncoding("UTF-8"); freemarkerConfig.setLocale(Locale.CHINA); freemarkerConfig.setTemplateExceptionHandler(TemplateExceptionHandler.RETHROW_HANDLER); } catch (Exception e) { log.error(e.getMessage(), e); } } public static void processTemplate(String templateName, String outputName, Map<String, Object> params) throws IOException, TemplateException { Template template = freemarkerConfig.getTemplate(templateName); StringWriter stringWriter = new StringWriter(); template.process(params, stringWriter); String s = MyStringUtils.escapeString(stringWriter.toString()); File file = new File(outputName); if (!file.getParentFile().exists()) { if (!file.getParentFile().mkdirs()) { throw new CodeGenException("创建输出目录失败"); } } try (BufferedWriter bw = new BufferedWriter(new FileWriter(file))) { bw.write(s); } log.info("生成: {}", file.getName()); } }
38918ce63569e8b6543212655e71d26fcedafffc
8899186f794f2fed9da21cb093881e040b2e8cde
/Design Pattern/Observer/src/WeatherData.java
ec04ffa7cdc84312c64c8f4e41da904b7504b016
[]
no_license
great2soul/soul
9b98f443b73d921e0834ba8931ee655bcf07d646
ba32c733c67d2e0d94dbc1bc0a7a21e799d7e8c6
refs/heads/master
2020-07-05T08:54:11.065880
2014-12-04T15:17:33
2014-12-04T15:17:33
4,144,528
0
4
null
null
null
null
UTF-8
Java
false
false
985
java
import java.util.ArrayList; public class WeatherData implements Subject{ private ArrayList observers; private float temp; private float humidity; private float pressure; public WeatherData() { observers = new ArrayList(); } @Override public void registerObserver(Observer o) { // TODO Auto-generated method stub observers.add(o); } @Override public void removeObserver(Observer o) { // TODO Auto-generated method stub int i = observers.indexOf(o); if (i >= 0) { observers.remove(i); } } @Override public void notifyObserver() { // TODO Auto-generated method stub for (int i = 0; i < observers.size(); ++i) { Observer o = (Observer) observers.get(i); o.update(temp, humidity, pressure); } } public void measurementsChanged() { notifyObserver(); } public void setMeasurements(float temp, float humidity, float pressure) { this.temp = temp; this.humidity = humidity; this.pressure -= pressure; measurementsChanged(); } }
bd38c44d2d468de406735fa17b458a7da2f5c67d
915fe245375aad9838eb305abc740ad2d0d345cb
/src/com/matchimi/options/AvailabilityPreview.java
5514d84ef14c1261a5335821ae406b1e6edea2c6
[]
no_license
manishandroid/MatchIMIBit
0f12492c3a66da1a404304b82d283df34160957e
d9f9cef51492ca1215480b3c1386bc44c349c31f
refs/heads/master
2021-01-10T18:37:47.664169
2014-02-11T19:12:23
2014-02-11T19:12:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,663
java
package com.matchimi.options; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.GregorianCalendar; import java.util.Locale; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.os.Bundle; import android.os.Handler; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.TextView; import android.widget.Toast; import com.actionbarsherlock.app.ActionBar; import com.actionbarsherlock.app.SherlockActivity; import com.actionbarsherlock.app.SherlockFragmentActivity; import com.actionbarsherlock.view.MenuItem; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import com.google.android.gms.maps.CameraUpdateFactory; import com.google.android.gms.maps.GoogleMap; import com.google.android.gms.maps.SupportMapFragment; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.MarkerOptions; import com.matchimi.CommonUtilities; import com.matchimi.R; import com.matchimi.utils.ApplicationUtils; import com.matchimi.utils.JSONParser; import com.matchimi.utils.NetworkUtils; public class AvailabilityPreview extends SherlockFragmentActivity { private Context context; private ProgressDialog progress; private JSONParser jsonParser = null; private String jsonStr = null; private TextView buttonFreeze; private String avail_id; private Boolean is_frozen = false; public static final int RC_PREV_AVAILABILITY_EDIT = 40; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); SharedPreferences settings = getSharedPreferences(CommonUtilities.PREFS_NAME, Context.MODE_PRIVATE); if (settings.getInt(CommonUtilities.SETTING_THEME, CommonUtilities.THEME_LIGHT) == CommonUtilities.THEME_LIGHT) { setTheme(ApplicationUtils.getTheme(true)); } else { setTheme(ApplicationUtils.getTheme(false)); } setContentView(R.layout.availability_preview); context = this; ActionBar ab = getSupportActionBar(); ab.setDisplayHomeAsUpEnabled(true); Bundle b = getIntent().getExtras(); final String pt_id = b.getString("pt_id"); avail_id = b.getString("avail_id"); final String start = b.getString("start"); final String end = b.getString("end"); final String repeat = b.getString("repeat"); final String location = b.getString("location"); final String price = b.getString("price"); is_frozen = b.getBoolean("is_frozen"); Calendar calStart = generateCalendar(start); Calendar calEnd = generateCalendar(end); TextView textStart = (TextView) findViewById(R.id.textStart); textStart.setText(CommonUtilities.AVAILABILITY_DATE.format(calStart.getTime()) + ", " + CommonUtilities.AVAILABILITY_TIME.format(calStart.getTime()).toLowerCase( Locale.getDefault())); TextView textEnd = (TextView) findViewById(R.id.textEnd); textEnd.setText(CommonUtilities.AVAILABILITY_TIME.format(calEnd.getTime()).toLowerCase( Locale.getDefault())); String[] repeatString = context.getResources().getStringArray( R.array.repeat_value); TextView textRepeat = (TextView) findViewById(R.id.textRepeat); textRepeat.setText(repeat); final TextView buttonEdit = (TextView) findViewById(R.id.buttonEdit); buttonEdit.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { Intent i = new Intent(context, CreateAvailability.class); i.putExtra("pt_id", pt_id); i.putExtra("avail_id", avail_id); i.putExtra("start", start); i.putExtra("end", end); i.putExtra("repeat", repeat); i.putExtra("location", location); i.putExtra("price", price); i.putExtra("update", true); startActivityForResult(i, RC_PREV_AVAILABILITY_EDIT); } }); final TextView buttonDelete = (TextView) findViewById(R.id.buttonDelete); buttonDelete.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(R.string.menu_availability); builder.setMessage(R.string.delete_availability_question); builder.setPositiveButton(R.string.delete, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { doDeleteAvailability(avail_id); } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface arg0, int arg1) { } }); AlertDialog dialog = builder.create(); dialog.show(); } }); buttonFreeze = (TextView) findViewById(R.id.buttonFreeze); // If frozen, change into unfreeze if(is_frozen) { buttonFreeze.setText(getString(R.string.unfreeze_availability)); } buttonFreeze.setOnClickListener(freezeListener); // loadMap(location); } private OnClickListener freezeListener = new OnClickListener() { @Override public void onClick(View view) { // If status is_frozen true, then unfreze them if(is_frozen) { doUnfreezeAvailability(avail_id); } else { AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.setTitle(R.string.menu_availability); builder.setMessage(R.string.freeze_availability_question); builder.setPositiveButton(R.string.freeze_title, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int arg1) { doFreezeAvailability(avail_id); } }); builder.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int arg1) { // Nothing to do } }); AlertDialog dialog = builder.create(); dialog.show(); } } }; @Deprecated protected void loadMap(String location) { if (location != null && !location.equalsIgnoreCase("null") && location.length() > 1) { String latitude = location.substring(0, location.indexOf(",")); String longtitude = location.substring(location.indexOf(",") + 1); LatLng pos = new LatLng(Double.parseDouble(latitude), Double.parseDouble(longtitude)); GoogleMap map = ((SupportMapFragment) getSupportFragmentManager() .findFragmentById(R.id.map)).getMap(); map.addMarker(new MarkerOptions().position(pos).title(getString(R.string.app_name)) .snippet(getString(R.string.map_availability_area)) .icon(BitmapDescriptorFactory.fromResource(R.drawable.pin))); // Move the camera instantly to hamburg with a zoom of 15. map.moveCamera(CameraUpdateFactory.newLatLngZoom(pos, 12)); // Zoom in, animating the camera. map.animateCamera(CameraUpdateFactory.zoomTo(12), 2000, null); } } protected void doDeleteAvailability(final String avail_id) { final String url = CommonUtilities.SERVERURL + CommonUtilities.API_DELETE_AVAILABILITY_BY_AVAIL_ID + "?" + CommonUtilities.PARAM_AVAIL_ID + "=" + avail_id; RequestQueue queue = Volley.newRequestQueue(this); StringRequest dr = new StringRequest(Request.Method.DELETE, url, new Response.Listener<String>() { @Override public void onResponse(String response) { if (response.equalsIgnoreCase("0")) { Toast.makeText(context, getString(R.string.delete_availability_success), Toast.LENGTH_SHORT).show(); Intent i = new Intent(CommonUtilities.BROADCAST_SCHEDULE_RECEIVER); sendBroadcast(i); Intent result = new Intent(); setResult(RESULT_OK, result); finish(); } else if (response.equalsIgnoreCase("1")) { Toast.makeText( context, getString(R.string.delete_availability_failed), Toast.LENGTH_LONG).show(); Log.d(CommonUtilities.TAG, "Delete failed with result code " + response); } else { NetworkUtils.connectionHandler(context, response, ""); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Log.d(CommonUtilities.TAG, "Error " + error.toString()); // TODO Auto-generated method stub Toast.makeText( context, getString(R.string.something_wrong), Toast.LENGTH_LONG).show(); } } ); queue.add(dr); // // final Handler mHandlerFeed = new Handler(); // final Runnable mUpdateResultsFeed = new Runnable() { // public void run() { // if (jsonStr != null) { // if (jsonStr.trim().equalsIgnoreCase("0")) { // Toast.makeText(context, getString(R.string.delete_availability_success), // Toast.LENGTH_SHORT).show(); // Intent result = new Intent(); // setResult(RESULT_OK, result); // finish(); // } else { // Toast.makeText( // context, // getString(R.string.delete_availability_failed), // Toast.LENGTH_LONG).show(); // } // } else { // Toast.makeText( // context, // getString(R.string.something_wrong), // Toast.LENGTH_LONG).show(); // } // } // }; // // progress = ProgressDialog.show(context, getString(R.string.menu_availability), // getString(R.string.delete_availability_progress), true, false); // new Thread() { // public void run() { // jsonParser = new JSONParser(); // try { // String[] params = { "avail_id" }; // String[] values = { avail_id }; // jsonStr = jsonParser.getHttpResultUrlDelete(url, params, // values); // Log.e(TAG, "Deleting availability: " + url + " with avail_id " + avail_id + ". Result >>>\n" + jsonStr); // } catch (Exception e) { // jsonStr = null; // } // // if (progress != null && progress.isShowing()) { // progress.dismiss(); // mHandlerFeed.post(mUpdateResultsFeed); // } // } // }.start(); } /** * Freeze user availability * @param avail_id */ protected void doFreezeAvailability(final String avail_id) { final String url = CommonUtilities.SERVERURL + CommonUtilities.API_FREEZE_AVAILABILITY_BY_AVAIL_ID; final Handler mHandlerFeed = new Handler(); final Runnable mUpdateResultsFeed = new Runnable() { public void run() { if (jsonStr != null) { if (jsonStr.trim().equalsIgnoreCase("0")) { Toast.makeText(context, getString(R.string.freeze_availability_success), Toast.LENGTH_SHORT).show(); Intent i = new Intent(CommonUtilities.BROADCAST_SCHEDULE_RECEIVER); sendBroadcast(i); Intent result = new Intent(); setResult(RESULT_OK, result); finish(); } else if (jsonStr.trim().equalsIgnoreCase("1")) { Toast.makeText( context, getString(R.string.freeze_availability_failed), Toast.LENGTH_LONG).show(); } else { NetworkUtils.connectionHandler(context, jsonStr, ""); } } else { Toast.makeText( context, getString(R.string.something_wrong), Toast.LENGTH_LONG).show(); } } }; progress = ProgressDialog.show(context, getString(R.string.menu_availability), getString(R.string.freeze_availability_progress), true, false); new Thread() { public void run() { jsonParser = new JSONParser(); String[] params = { "avail_id" }; String[] values = { avail_id }; jsonStr = jsonParser.getHttpResultUrlPut(url, params, values); if (progress != null && progress.isShowing()) { progress.dismiss(); mHandlerFeed.post(mUpdateResultsFeed); } } }.start(); } /** * Unfreeze availability * @param avail_id */ protected void doUnfreezeAvailability(final String avail_id) { final String url = CommonUtilities.SERVERURL + CommonUtilities.API_UNFREEZE_AVAILABILITY_BY_AVAIL_ID; final Handler mHandlerFeed = new Handler(); final Runnable mUpdateResultsFeed = new Runnable() { public void run() { if (jsonStr != null) { if (jsonStr.trim().equalsIgnoreCase("0")) { Toast.makeText(context, getString(R.string.unfreeze_availability_success), Toast.LENGTH_SHORT).show(); Intent i = new Intent(CommonUtilities.BROADCAST_SCHEDULE_RECEIVER); sendBroadcast(i); Intent result = new Intent(); setResult(RESULT_OK, result); finish(); } else if (jsonStr.trim().equalsIgnoreCase("0")) { Toast.makeText( context, getString(R.string.unfreeze_availability_failed), Toast.LENGTH_LONG).show(); } else { NetworkUtils.connectionHandler(context, jsonStr, ""); } } else { Toast.makeText( context, getString(R.string.something_wrong), Toast.LENGTH_LONG).show(); } } }; progress = ProgressDialog.show(context, getString(R.string.menu_availability), getString(R.string.unfreeze_availability_progress), true, false); new Thread() { public void run() { jsonParser = new JSONParser(); String[] params = { "avail_id" }; String[] values = { avail_id }; jsonStr = jsonParser.getHttpResultUrlPut(url, params, values); if (progress != null && progress.isShowing()) { progress.dismiss(); mHandlerFeed.post(mUpdateResultsFeed); } } }.start(); } private Calendar generateCalendar(String str) { Calendar calRes = new GregorianCalendar(Integer.parseInt(str.substring( 0, 4)), Integer.parseInt(str.substring(5, 7)) - 1, Integer.parseInt(str.substring(8, 10)), Integer.parseInt(str .substring(11, 13)), Integer.parseInt(str.substring(14, 16)), Integer.parseInt(str.substring(17, 19))); return calRes; } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { Log.e(CommonUtilities.TAG, "Availability PREVEIEW Fragment"); super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { if (requestCode == RC_PREV_AVAILABILITY_EDIT) { Intent result = new Intent(); setResult(RESULT_OK, result); finish(); } } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: Intent result = new Intent(); setResult(RESULT_CANCELED, result); finish(); break; } return super.onOptionsItemSelected(item); } }
ccd2c225058fcfb13b97c89fbd0078d488308e4d
f6b601f2414541ac2f2ed200f939fdc6a1cc3c72
/pet-clinic-data/src/main/java/service/map/AbstractMapService.java
637f46fb08204e21a1d0b6a5ff9fd7591566fdf9
[]
no_license
william1099/spring-pet-clinic
21f8c6f4da65b54f131f2f261c05228aaa453ce1
5c1d01a4d580f5892bbb8eb7e31656356a4e7ea1
refs/heads/main
2023-02-04T03:43:07.730659
2020-12-22T06:52:34
2020-12-22T06:52:34
321,284,515
0
0
null
null
null
null
UTF-8
Java
false
false
615
java
package service.map; import java.util.HashMap; import java.util.HashSet; import java.util.Map; import java.util.Set; public abstract class AbstractMapService<T, ID> { protected Map<ID, T> map = new HashMap<>(); Set<T> findAll() { return new HashSet<>(map.values()); } T findById(ID id) { return map.get(id); } T save(ID id, T object) { map.put(id, object); return object; } void deleteById(ID id) { map.remove(id); } void delete(T object) { map.entrySet().removeIf(entry -> entry.getValue().equals(object)); } }
5e68688ad0da0e50c054de9828033f6a41ed08df
33a5fcf025d92929669d53cf2dc3f1635eeb59c6
/成都机动车/core/src/main/java/com/mapuni/core/utils/ToastUtils.java
f1b661e93e7ba64a5b5beff280d1d889036568a9
[]
no_license
dayunxiang/MyHistoryProjects
2cacbe26d522eeb3f858d69aa6b3c77f3c533f37
6e041f53a184e7c4380ce25f5c0274aa10f06c8e
refs/heads/master
2020-11-29T09:23:27.085614
2018-03-12T07:07:18
2018-03-12T07:07:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
694
java
package com.mapuni.core.utils; import android.content.Context; import android.widget.Toast; public class ToastUtils { private static Toast mToast; /** * 非阻塞试显示Toast,防止出现连续点击Toast时的显示问题 */ public static void showToast(Context context, CharSequence text, int duration) { if (mToast == null) { mToast = Toast.makeText(context, text, duration); } else { mToast.setText(text); mToast.setDuration(duration); } mToast.show(); } public static void showToast(Context context, CharSequence text) { showToast(context, text, Toast.LENGTH_SHORT); } }
4daa179166420061d8238049dc4c3f09038bc23c
6e08c5d4435482ddbd3c3b65dd9ee538248c8fb3
/src/fr/uga/miashs/album/control/PictureAnnotationController.java
f9757764a4b6fb18a414a03d74f7bcce7871181a
[]
no_license
agnef/projet-jee
f36038a9581b8fec86806472b55b5961b0dc8924
fd8901e6834a8d6857dba89ec0dc4c8e5468a6ba
refs/heads/master
2021-01-11T22:13:29.600194
2017-01-17T11:53:23
2017-01-17T11:53:23
78,936,729
0
0
null
null
null
null
ISO-8859-1
Java
false
false
4,325
java
package fr.uga.miashs.album.control; import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.enterprise.context.SessionScoped; import javax.faces.bean.ManagedBean; import javax.faces.bean.RequestScoped; import javax.inject.Inject; import javax.inject.Named; import fr.uga.miashs.album.model.Picture; import fr.uga.miashs.album.service.PictureAnnotationService; import fr.uga.miashs.album.service.PictureService; import fr.uga.miashs.album.service.ServiceException; @Named @SessionScoped public class PictureAnnotationController implements Serializable { // currentPicture, propriete, valeurPropriete : triplet rdf private String currentPicture; private String propriete; private String valeurPropriete; private String pictureUri; private String requete; @Inject private PictureAnnotationService pictureAnnotationService; //getters & setters public String getCurrentPicture(){ System.out.println("get current picture = current picture : " + currentPicture); return currentPicture; } public String getPictureUri() { return pictureUri; } public void setPictureUri(String pictureUri) { this.pictureUri = pictureUri; } public void setCurrentPicture(String picture){ this.currentPicture = picture; System.out.println("set current picture = current picture " + picture); } public String getRequete() { return requete; } public void setRequete(String requete) { this.requete = requete; } public String getPropriete() { return propriete; } public void setPropriete(String propriete) { this.propriete = propriete; System.out.println("set propriété : " + propriete); } public String getValeurPropriete() { return valeurPropriete; } public void setValeurPropriete(String valeurPropriete) { this.valeurPropriete = valeurPropriete; System.out.println("set valeur de la propriété : " + valeurPropriete); } // queries public List<String> getQueryPictureResult(){ System.out.println("requete : " + requete); List<String> pictName = new ArrayList<String>(); List<Picture> pictures = pictureAnnotationService.queries(requete); for(int i=0; i<pictures.size(); i++){ pictName.add(pictures.get(i).getFileName()); System.out.println(pictName.get(i)); } return pictName; } public void insertOntology(){ System.out.println("premiere" + valeurPropriete); if(propriete.equals("pictureDate")){ valeurPropriete = valeurPropriete + "T00:00:00"; } System.out.println("modif" + valeurPropriete); pictureAnnotationService.insertOntology(currentPicture, propriete, valeurPropriete); } public List<String> seeAnnotations(){ System.out.println("ANNOTATIONS : pictureannotationcontroller"); List<String> annotations = pictureAnnotationService.seeAnnotations(pictureUri); List<String> displayAnnotations = new ArrayList<String>(); for (int i=0; i<annotations.size(); i++){ if (annotations.get(i).equals("http://www.semanticweb.org/masterDCISS/projetAlbum#hasInside")) displayAnnotations.add("représente : "); else if (annotations.get(i).equals("http://www.semanticweb.org/masterDCISS/projetAlbum#inYear")) displayAnnotations.add("en l'année : "); else if(annotations.get(i).equals("http://www.semanticweb.org/masterDCISS/projetAlbum#isTakenBy")) displayAnnotations.add("prise par : "); else if(annotations.get(i).equals("http://www.semanticweb.org/masterDCISS/projetAlbum#isTakenIn")) displayAnnotations.add("prise à : "); else if(annotations.get(i).equals("http://www.semanticweb.org/masterDCISS/projetAlbum#during")) displayAnnotations.add("pendant : "); else if(annotations.get(i).equals("http://www.semanticweb.org/masterDCISS/projetAlbum#pictureDate")) displayAnnotations.add("prise le : "); else if (!annotations.get(i).equals("http://www.w3.org/1999/02/22-rdf-syntax-ns#type") && !annotations.get(i).equals("http://www.w3.org/2002/07/owl#Thing") && !annotations.get(i).equals("http://www.w3.org/2000/01/rdf-schema#Resource") ) displayAnnotations.add(annotations.get(i) + " "); } return displayAnnotations; } }
02dba73e8e38ad5cffd9e11fc25ea74561ac7437
c2be2bdbe8c22911af7ef1742e13600e6057e94c
/hibernate-mapping-onetoone/src/main/java/com/dev/hibernate/mapping/onetoone/main/SharedPrimaryKeyMain.java
10f16e01ffcd6ec30eec6c2eb1e99bac72aa849d
[]
no_license
devanandgv/spring
c67e138526c50b76c6c12049d3fbb321ca634c76
952a166bb685cb43f03006860166753a76533353
refs/heads/master
2020-03-08T22:22:06.012668
2018-08-03T12:52:34
2018-08-03T12:52:34
128,428,804
0
0
null
null
null
null
UTF-8
Java
false
false
1,067
java
package com.dev.hibernate.mapping.onetoone.main; import org.hibernate.Session; import org.hibernate.SessionFactory; import com.dev.hibernate.mapping.onetoone.model.Student; import com.dev.hibernate.mapping.onetoone.model.StudentDetails; public class SharedPrimaryKeyMain { public static void main(String[] args) { SessionFactory sessionFactory = HibernateUtil.sessionFactory; Session session = sessionFactory.openSession(); Student student = new Student(); student.setAge(14); student.setFatherName("Ganesan"); student.setGender("Male"); student.setMotherName("Vembu"); student.setName("Rohan"); StudentDetails studentDetails = new StudentDetails(); studentDetails.setClassNo(9); studentDetails.setMajorSubject("Science"); studentDetails.setRollNo(15); studentDetails.setTeacherName("DavidRaj"); student.setStudentDetails(studentDetails); studentDetails.setStudent(student); session.beginTransaction(); session.save(studentDetails); session.getTransaction().commit(); session.close(); HibernateUtil.shutdown(); } }
31c9bbcbb7cd3ceeb5c6998f246368e26aba2a71
84659009ccdba5406278c3518666292a7f4668b0
/videoservice/src/main/java/com/de/vo/SimpleCameraListVO.java
1ac1df7a59526bc94d354b5c67567fb8f8fdce98
[]
no_license
Pokman321/gs_bishe
a35a29fa06f93df89d5a2512e53e0133572fb8e7
7523b8dc2854400783a74a5c637378640343768e
refs/heads/master
2023-01-08T10:47:52.414488
2020-11-02T08:56:48
2020-11-02T08:56:48
296,902,777
0
0
null
null
null
null
UTF-8
Java
false
false
529
java
package com.de.vo; import java.io.Serializable; /** * @author gs * @date 2020/6/15 - 0:32 */ public class SimpleCameraListVO implements Serializable { private int cameraId; private String cameraName; public int getCameraId() { return cameraId; } public void setCameraId(int cameraId) { this.cameraId = cameraId; } public String getCameraName() { return cameraName; } public void setCameraName(String cameraName) { this.cameraName = cameraName; } }
250db4a51dcd6ce9023d26bc64c8696fc91fee15
9e676ac07819d46603a4755cd8247a75d9f6b102
/src/main/java/org/wicketTutorial/helloworld/model/Group.java
7db549c29545ec567d8f7e8606c75f394487ac1c
[]
no_license
CManig/WicketChoiceExample
4231ed9f13b57f7031a4346c97d87947af21f3bb
3c7063c876853e1582250f7a863c089e207006f4
refs/heads/master
2021-01-11T21:42:29.470607
2017-01-13T10:11:07
2017-01-13T10:11:07
78,837,586
1
0
null
null
null
null
UTF-8
Java
false
false
663
java
package org.wicketTutorial.helloworld.model; import java.io.Serializable; /** * Represents a group a user could have. * * @author cmanig */ public class Group implements Serializable{ /** serialVersionUID */ private static final long serialVersionUID = -1642771056814860900L; /** The id of the group. */ private Integer groupId; /** The name of the group */ private String groupname; public Integer getGroupId() { return groupId; } public void setGroupId(Integer groupId) { this.groupId = groupId; } public String getGroupname() { return groupname; } public void setGroupname(String groupname) { this.groupname = groupname; } }
bc8202c2dce29f50baa099286bba8c6eec23f17b
791ee607a1082653db45dabcb442884eaced94f1
/src/es/istr/unican/jmastanalysis/analysis/results/GlobalMissRatioList.java
020b7d5a63fc51e7e58f7ebc6078ede968115e82
[]
no_license
rivasjm/JMastAnalysis
d4e4ba1e0ab6a5c1b1808767fc0c2be77cd8d688
ad1f43fb22d29de9b732b78d70cbcc2d5ab9c368
refs/heads/master
2021-01-21T13:26:12.288139
2016-05-19T09:15:34
2016-05-19T09:15:34
45,423,346
0
0
null
null
null
null
UTF-8
Java
false
false
2,401
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2015.08.19 at 05:12:38 PM CEST // package es.istr.unican.jmastanalysis.analysis.results; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; import java.util.ArrayList; import java.util.List; /** * <p>Java class for Global_Miss_Ratio_List complex type. * <p> * <p>The following schema fragment specifies the expected content contained within this class. * <p> * <pre> * &lt;complexType name="Global_Miss_Ratio_List"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="Global_Miss_Ratio" type="{http://mast.unican.es/xmlmast/xmlmast_1_4/Mast_Result}Global_Miss_Ratio" maxOccurs="unbounded"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "Global_Miss_Ratio_List", propOrder = { "globalMissRatio" }) public class GlobalMissRatioList { @XmlElement(name = "Global_Miss_Ratio", required = true) protected List<GlobalMissRatio> globalMissRatio; /** * Gets the value of the globalMissRatio property. * <p> * <p> * This accessor method returns a reference to the live list, * not a snapshot. Therefore any modification you make to the * returned list will be present inside the JAXB object. * This is why there is not a <CODE>set</CODE> method for the globalMissRatio property. * <p> * <p> * For example, to add a new item, do as follows: * <pre> * getGlobalMissRatio().add(newItem); * </pre> * <p> * <p> * <p> * Objects of the following type(s) are allowed in the list * {@link GlobalMissRatio } */ public List<GlobalMissRatio> getGlobalMissRatio() { if (globalMissRatio == null) { globalMissRatio = new ArrayList<GlobalMissRatio>(); } return this.globalMissRatio; } }
47ce896932702522d6f4980f2f937df86d3fad5f
5fd25a97ca8ac0b5f4e92d5babe52add1d643703
/src/main/java/com/cloudinte/common/utils/MD5Utils.java
a7ffff5898083dce10b3db0a92a27bd56cbe6023
[]
no_license
zjj-clode/xingzhengguanli2
dc2e882956c37fd63cec9c6d5212a9f045362fe0
c9f93d1d30eeef077444cc1806844d9d8f003d4a
refs/heads/master
2022-12-23T05:12:28.631780
2019-12-31T07:34:10
2019-12-31T07:34:10
231,047,853
0
0
null
2022-12-16T09:57:23
2019-12-31T07:33:33
JavaScript
UTF-8
Java
false
false
2,171
java
package com.cloudinte.common.utils; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; public class MD5Utils { public static String getMd5(String pwd) { try { // 创建加密对象 MessageDigest digest = MessageDigest.getInstance("md5"); // 调用加密对象的方法,加密的动作已经完成 byte[] bs = digest.digest(pwd.getBytes()); // 接下来,我们要对加密后的结果,进行优化,按照mysql的优化思路走 // mysql的优化思路: // 第一步,将数据全部转换成正数: String hexString = ""; for (byte b : bs) { // 第一步,将数据全部转换成正数: // 解释:为什么采用b&255 /* * b:它本来是一个byte类型的数据(1个字节) 255:是一个int类型的数据(4个字节) * byte类型的数据与int类型的数据进行运算,会自动类型提升为int类型 eg: b: 1001 1100(原始数据) * 运算时: b: 0000 0000 0000 0000 0000 0000 1001 1100 255: 0000 * 0000 0000 0000 0000 0000 1111 1111 结果:0000 0000 0000 0000 * 0000 0000 1001 1100 此时的temp是一个int类型的整数 */ int temp = b & 255; // 第二步,将所有的数据转换成16进制的形式 // 注意:转换的时候注意if正数>=0&&<16,那么如果使用Integer.toHexString(),可能会造成缺少位数 // 因此,需要对temp进行判断 if (temp < 16 && temp >= 0) { // 手动补上一个“0” hexString = hexString + "0" + Integer.toHexString(temp); } else { hexString = hexString + Integer.toHexString(temp); } } return hexString; } catch (NoSuchAlgorithmException e) { // TODO Auto-generated catch block e.printStackTrace(); } return ""; } }
b02f4d47f119f225493c86623de84c2fedb40813
faa3742bc6f3e5ecb3873ab4592feb281546d72f
/src/main/java/com/myproject/pageobjects/Homepage.java
3ffb30f33ebf33a1cc4d8ccb509f05b11f6f77b9
[]
no_license
devimuni/practice3
d8def25e3b1c60b00b7f91674d7d8467033d71b6
85958e4799230f45db2bfdc6607dcfd9de886108
refs/heads/master
2022-12-26T12:12:26.647987
2020-10-13T06:24:34
2020-10-13T06:24:34
303,468,490
0
0
null
null
null
null
UTF-8
Java
false
false
836
java
package com.myproject.pageobjects; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import com.myproject.basepage.Basepage; public class Homepage extends Basepage{ @FindBy(id="greetings") private WebElement txtmsg; @FindBy(id="logout") private WebElement logoutbtn; @FindBy(xpath = "//p[contains(text(),'Feel free')]") private WebElement txtmsg2; public Homepage() { super(driver); PageFactory.initElements(driver, this); } public String getText() { String text = Basepage.getText(txtmsg); return text; } public Loginpage clicklogout() { Basepage.click(logoutbtn); return new Loginpage(); } public String checkText() { String text2= Basepage.getText(txtmsg2); return text2; } }
a01bd9ff18a73deb5d8a39767d2d43a33bc5701e
53189efbfed5423821a84f631da404d07a80e404
/storage/app/Al-QuranIndonesia_com.andi.alquran.id_source_from_JADX/com/google/android/gms/tagmanager/ar.java
fe90815fd1af35923678ff772ec901ab82204ab4
[ "MIT" ]
permissive
dwijpr/islam
0c9b77028d34862b6d06858c5b0d6ffec91b5014
6077291a619ac2f5b30a77e284c0a7361e7c8ad4
refs/heads/master
2021-01-19T17:16:49.818251
2017-03-13T23:00:08
2017-03-13T23:00:08
82,430,213
0
0
null
null
null
null
UTF-8
Java
false
false
1,004
java
package com.google.android.gms.tagmanager; import android.util.Log; public class ar implements C2214o { private int f7088a; public ar() { this.f7088a = 5; } public void m10207a(String str) { if (this.f7088a <= 6) { Log.e("GoogleTagManager", str); } } public void m10208a(String str, Throwable th) { if (this.f7088a <= 6) { Log.e("GoogleTagManager", str, th); } } public void m10209b(String str) { if (this.f7088a <= 5) { Log.w("GoogleTagManager", str); } } public void m10210b(String str, Throwable th) { if (this.f7088a <= 5) { Log.w("GoogleTagManager", str, th); } } public void m10211c(String str) { if (this.f7088a <= 4) { Log.i("GoogleTagManager", str); } } public void m10212d(String str) { if (this.f7088a <= 2) { Log.v("GoogleTagManager", str); } } }
501f1665e358251b2c681fa2eec8c9cfded133f9
c591472c1e6bca5c30d900c07e1604d1ed119c9d
/src/org/ninjadev/multivim/commandparser/NormalVisualCommandTable.java
04aeef862d3399355cddb5b953085562cb71d1b8
[]
no_license
lionleaf/multivim
e59b45436181d518f5d677b2b69d84ac5b49123b
4f962a8f25bfb2e956e00e866cbf5554f4b701e8
refs/heads/master
2021-01-15T18:45:21.503521
2013-01-17T10:46:03
2013-01-17T10:46:03
null
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
16,627
java
package org.ninjadev.multivim.commandparser; import java.util.EnumSet; import java.util.HashMap; import org.ninjadev.multivim.commandparser.normalvisualcommands.*; import org.ninjadev.multivim.commandparser.normalvisualcommands.Error; import org.ninjadev.multivim.commandparser.operators.Movement; import com.googlecode.lanterna.input.Key; import com.googlecode.lanterna.input.Key.Kind; public class NormalVisualCommandTable{ public static HashMap<Key, NormalVisualCommand> table; private static void entry(NormalVisualCommand normalVisualCommand){ table.put(normalVisualCommand.commandKey, normalVisualCommand); } public static NormalVisualCommand get(Key key){ NormalVisualCommand nvc = table.get(key); return nvc == null ? table.get(new Key('\0', false, false)) : nvc; } static{ table = new HashMap<Key, NormalVisualCommand>(); boolean F = false; boolean T = true; int FALSE = 0; int TRUE = 1; int BACKWARD = 3; int FORWARD = 4; int SEARCH_REV = 12; int BL_WHITE = 13; int BL_FIX = 14; /* | command | char | ctrl | alt | flags | args | */ entry(new Error (new Key( '\0' , F , F ), null, 0 )); entry(new AddSub (new Key( 'a' , T , F ), null, 0 )); entry(new Page (new Key( 'b' , T , F ), EnumSet.of(NormalVisualFlag.MayStopSelectionWithoutShiftModifier), BACKWARD)); entry(new Esc (new Key( 'c' , T , F ), null, TRUE )); entry(new HalfPage (new Key( 'd' , T , F ), null, 0 )); entry(new ScrollLine (new Key( 'e' , T , F ), null, TRUE )); entry(new Page (new Key( 'f' , T , F ), EnumSet.of(NormalVisualFlag.MayStopSelectionWithoutShiftModifier), FORWARD)); entry(new CtrlG (new Key( 'g' , T , F ), null, 0 )); entry(new CtrlH (new Key( 'h' , T , F ), null, 0 )); entry(new PCMark (new Key( 'i' , T , F ), null, 0 )); entry(new Down (new Key( Kind.Enter ), null, FALSE )); entry(new Error (new Key( 'k' , T , F ), null, 0 )); entry(new Clear (new Key( 'l' , T , F ), null, 0 )); entry(new Down (new Key( 'm' , T , F ), null, TRUE )); entry(new Down (new Key( 'n' , T , F ), EnumSet.of(NormalVisualFlag.MayStopSelectionWithoutShiftModifier), FALSE)); entry(new CtrlO (new Key( 'o' , T , F ), null, 0 )); entry(new Up (new Key( 'p' , T , F ), EnumSet.of(NormalVisualFlag.MayStopSelectionWithoutShiftModifier), FALSE)); entry(new Visual (new Key( 'q' , T , F ), null, FALSE )); entry(new Redo (new Key( 'r' , T , F ), null, 0 )); entry(new Ignore (new Key( 's' , T , F ), null, 0 )); entry(new TagPop (new Key( 't' , T , F ), EnumSet.of(NormalVisualFlag.NotAllowedInCommandLineWindow), 0)); entry(new HalfPage (new Key( 'u' , T , F ), null, 0 )); entry(new Visual (new Key( 'v' , T , F ), null, FALSE )); entry(new Visual (new Key( 'V' , F , F ), null, FALSE )); entry(new Visual (new Key( 'v' , F , F ), null, FALSE )); entry(new Window (new Key( 'w' , T , F ), null, 0 )); entry(new AddSub (new Key( 'x' , T , F ), null, 0 )); entry(new ScrollLine (new Key( 'y' , T , F ), null, FALSE )); entry(new Suspend (new Key( 'z' , T , F ), null, 0 )); entry(new Esc (new Key( Kind.Escape ), null, FALSE )); entry(new Normal (new Key( '\\', T , F ), EnumSet.of( NormalVisualFlag.MayNeedSecondChar, NormalVisualFlag.NeedSecondCharAlways ), 0)); entry(new Ident (new Key( ']' , T , F ), EnumSet.of(NormalVisualFlag.MayNeedSecondChar), 0)); entry(new Hat (new Key( '^' , T , F ), EnumSet.of(NormalVisualFlag.MayNeedSecondChar), 0)); entry(new Error (new Key( '_' , T , F ), null, 0 )); entry(new Right (new Key( ' ' , F , F ), null, 0 )); entry(new Operator (new Key( '!' , F , F ), null, 0 )); entry(new Regname (new Key( '"' , F , F ), EnumSet.of( NormalVisualFlag.MayNeedSecondChar, NormalVisualFlag.NeedSecondCharWhenNoOperatorPending, NormalVisualFlag.KeepRegisterName ), 0)); entry(new Ident (new Key( '#' , F , F ), null, 0 )); entry(new Dollar (new Key( '$' , F , F ), null, 0 )); entry(new Percent (new Key( '%' , F , F ), null, 0 )); entry(new Optrans (new Key( '&' , F , F ), null, 0 )); entry(new GoMark (new Key( '\'', F , F ), EnumSet.of( NormalVisualFlag.MayNeedSecondChar, NormalVisualFlag.NeedSecondCharAlways ), TRUE)); entry(new Brace (new Key( '(' , F , F ), null, BACKWARD )); entry(new Brace (new Key( ')' , F , F ), null, FORWARD )); entry(new Ident (new Key( '*' , F , F ), null, 0 )); entry(new Down (new Key( '+' , F , F ), null, TRUE )); entry(new CSearch (new Key( ',' , F , F ), null, TRUE )); entry(new Up (new Key( '-' , F , F ), null, TRUE )); entry(new Dot (new Key( '.' , F , F ), EnumSet.of(NormalVisualFlag.KeepRegisterName), 0)); entry(new Search (new Key( '/' , F , F ), null, FALSE )); entry(new BeginLine (new Key( '0' , F , F ), null, 0 )); entry(new Ignore (new Key( '1' , F , F ), null, 0 )); entry(new Ignore (new Key( '2' , F , F ), null, 0 )); entry(new Ignore (new Key( '3' , F , F ), null, 0 )); entry(new Ignore (new Key( '4' , F , F ), null, 0 )); entry(new Ignore (new Key( '5' , F , F ), null, 0 )); entry(new Ignore (new Key( '6' , F , F ), null, 0 )); entry(new Ignore (new Key( '7' , F , F ), null, 0 )); entry(new Ignore (new Key( '8' , F , F ), null, 0 )); entry(new Ignore (new Key( '9' , F , F ), null, 0 )); entry(new Colon (new Key( ':' , F , F ), null, 0 )); entry(new CSearch (new Key( ';' , F , F ), null, FALSE )); entry(new Operator (new Key( '<' , F , F ), EnumSet.of(NormalVisualFlag.RightLeftModifiesCommand), 0)); entry(new Operator (new Key( '=' , F , F ), null, 0 )); entry(new Operator (new Key( '>' , F , F ), EnumSet.of(NormalVisualFlag.RightLeftModifiesCommand), 0)); entry(new Search (new Key( '?' , F , F ), null, FALSE )); entry(new At (new Key( '@' , F , F ), EnumSet.of( NormalVisualFlag.MayNeedSecondChar, NormalVisualFlag.NeedSecondCharWhenNoOperatorPending ), FALSE)); entry(new Edit (new Key( 'A' , F , F ), null, 0 )); entry(new BackWord (new Key( 'B' , F , F ), null, 0 )); entry(new Abbrev (new Key( 'C' , F , F ), EnumSet.of(NormalVisualFlag.KeepRegisterName), 0)); entry(new Abbrev (new Key( 'D' , F , F ), EnumSet.of(NormalVisualFlag.KeepRegisterName), 0)); entry(new WordCommand (new Key( 'E' , F , F ), null, TRUE )); entry(new CSearch (new Key( 'F' , F , F ), EnumSet.of( NormalVisualFlag.MayNeedSecondChar, NormalVisualFlag.NeedSecondCharAlways, NormalVisualFlag.SecondCharNeedsLanguageAdjustment ), BACKWARD)); entry(new Goto (new Key( 'G' , F , F ), null, TRUE )); entry(new Scroll (new Key( 'H' , F , F ), null, 0 )); entry(new Edit (new Key( 'I' , F , F ), null, 0 )); entry(new Join (new Key( 'J' , F , F ), null, 0 )); entry(new Ident (new Key( 'K' , F , F ), null, 0 )); entry(new Scroll (new Key( 'L' , F , F ), null, 0 )); entry(new Scroll (new Key( 'M' , F , F ), null, 0 )); entry(new Next (new Key( 'N' , F , F ), null, SEARCH_REV )); entry(new Open (new Key( 'O' , F , F ), null, 0 )); entry(new Put (new Key( 'P' , F , F ), null, 0 )); entry(new ExMode (new Key( 'Q' , F , F ), EnumSet.of(NormalVisualFlag.MayNeedSecondChar), 0)); entry(new Replace (new Key( 'R' , F , F ), null, FALSE )); entry(new Subst (new Key( 'S' , F , F ), EnumSet.of(NormalVisualFlag.KeepRegisterName), 0)); entry(new CSearch (new Key( 'T' , F , F ), EnumSet.of( NormalVisualFlag.MayNeedSecondChar, NormalVisualFlag.NeedSecondCharAlways, NormalVisualFlag.SecondCharNeedsLanguageAdjustment ), BACKWARD)); entry(new Undo (new Key( 'U' , F , F ), null, 0 )); entry(new WordCommand (new Key( 'W' , F , F ), null, TRUE )); entry(new Abbrev (new Key( 'X' , F , F ), EnumSet.of(NormalVisualFlag.KeepRegisterName) , 0 )); entry(new Abbrev (new Key( 'Y' , F , F ), EnumSet.of(NormalVisualFlag.KeepRegisterName) , 0 )); entry(new Zet (new Key( 'Z' , F , F ), EnumSet.of( NormalVisualFlag.MayNeedSecondChar, NormalVisualFlag.NeedSecondCharWhenNoOperatorPending, NormalVisualFlag.NotAllowedInCommandLineWindow ), 0)); entry(new Brackets (new Key( '[' , F , F ), EnumSet.of( NormalVisualFlag.MayNeedSecondChar, NormalVisualFlag.NeedSecondCharAlways ), BACKWARD)); entry(new Error (new Key( '\\', F , F ), null, 0 )); entry(new Brackets (new Key( ']' , F , F ), EnumSet.of( NormalVisualFlag.MayNeedSecondChar, NormalVisualFlag.NeedSecondCharAlways ), FORWARD)); entry(new BeginLine (new Key( '^' , F , F ), null, BL_WHITE|BL_FIX)); entry(new LineOp (new Key( '_' , F , F ), null, 0 )); entry(new GoMark (new Key( '`' , F , F ), EnumSet.of( NormalVisualFlag.MayNeedSecondChar, NormalVisualFlag.NeedSecondCharAlways ), FALSE)); entry(new Edit (new Key( 'a' , F , F ), EnumSet.of(NormalVisualFlag.MayNeedSecondChar), 0)); entry(new WordCommand (new Key( 'b' , F , F ), null, 0 )); entry(new Operator (new Key( 'c' , F , F ), null, 0 )); entry(new Operator (new Key( 'd' , F , F ), null, 0 )); entry(new WordCommand (new Key( 'e' , F , F ), null, FALSE )); entry(new CSearch (new Key( 'f' , F , F ), EnumSet.of( NormalVisualFlag.MayNeedSecondChar, NormalVisualFlag.NeedSecondCharAlways, NormalVisualFlag.SecondCharNeedsLanguageAdjustment ), FORWARD)); entry(new GCommand (new Key( 'g' , F , F ), EnumSet.of( NormalVisualFlag.MayNeedSecondChar, NormalVisualFlag.NeedSecondCharAlways ), FALSE)); entry(new Left (new Key( 'h' , F , F ), EnumSet.of(NormalVisualFlag.RightLeftModifiesCommand) , 0 )); entry(new Edit (new Key( 'i' , F , F ), EnumSet.of(NormalVisualFlag.MayNeedSecondChar) , 0 )); entry(new Down (new Key( 'j' , F , F ), null, FALSE )); entry(new Up (new Key( 'k' , F , F ), null, FALSE )); entry(new Right (new Key( 'l' , F , F ), EnumSet.of(NormalVisualFlag.RightLeftModifiesCommand) , 0 )); entry(new Mark (new Key( 'm' , F , F ), EnumSet.of( NormalVisualFlag.MayNeedSecondChar, NormalVisualFlag.NeedSecondCharWhenNoOperatorPending ), 0)); entry(new Next (new Key( 'n' , F , F ), null, 0 )); entry(new Open (new Key( 'o' , F , F ), null, 0 )); entry(new Put (new Key( 'p' , F , F ), null, 0 )); entry(new Record (new Key( 'q' , F , F ), EnumSet.of(NormalVisualFlag.MayNeedSecondChar) , 0 )); entry(new Replace (new Key( 'r' , F , F ), EnumSet.of( NormalVisualFlag.MayNeedSecondChar, NormalVisualFlag.NeedSecondCharWhenNoOperatorPending, NormalVisualFlag.SecondCharNeedsLanguageAdjustment ), 0)); entry(new Subst (new Key( 's' , F , F ), EnumSet.of(NormalVisualFlag.KeepRegisterName) , 0 )); entry(new CSearch (new Key( 't' , F , F ), EnumSet.of( NormalVisualFlag.MayNeedSecondChar, NormalVisualFlag.NeedSecondCharAlways, NormalVisualFlag.SecondCharNeedsLanguageAdjustment ), FORWARD)); entry(new Undo (new Key( 'u' , F , F ), null, 0 )); entry(new WordCommand (new Key( 'w' , F , F ), null, FALSE )); entry(new Abbrev (new Key( 'x' , F , F ), EnumSet.of(NormalVisualFlag.KeepRegisterName) , 0 )); entry(new Operator (new Key( 'y' , F , F ), null, 0 )); entry(new Zet (new Key( 'z' , F , F ), EnumSet.of( NormalVisualFlag.MayNeedSecondChar, NormalVisualFlag.NeedSecondCharAlways ) , 0 )); entry(new FindPar (new Key( '{' , F , F ), null, BACKWARD )); entry(new Pipe (new Key( '|' , F , F ), null, 0 )); entry(new FindPar (new Key( '}' , F , F ), null, FORWARD )); entry(new Tilde (new Key( '~' , F , F ), null, 0 )); entry(new Ident (new Key( '£' , F , F ), null, 0 )); entry(new Ignore (new Key( Kind.Ignore ), EnumSet.of(NormalVisualFlag.KeepRegisterName) , 0 )); entry(new Nop (new Key( Kind.Nop ), null, 0 )); entry(new Edit (new Key( Kind.Insert ), null, 0 )); entry(new CtrlH (new Key( Kind.Backspace ), null, 0 )); entry(new Up (new Key( Kind.ArrowUp ), EnumSet.of( NormalVisualFlag.MayStartSelectionWithShiftModifier, NormalVisualFlag.MayStopSelectionWithoutShiftModifier ), FALSE)); entry(new Down (new Key( Kind.ArrowDown ), EnumSet.of( NormalVisualFlag.MayStartSelectionWithShiftModifier, NormalVisualFlag.MayStopSelectionWithoutShiftModifier ), FALSE)); entry(new Left (new Key( Kind.ArrowLeft ), EnumSet.of( NormalVisualFlag.MayStartSelectionWithShiftModifier, NormalVisualFlag.MayStopSelectionWithoutShiftModifier ), 0)); entry(new Right (new Key( Kind.ArrowRight ), EnumSet.of( NormalVisualFlag.MayStartSelectionWithShiftModifier, NormalVisualFlag.MayStopSelectionWithoutShiftModifier, NormalVisualFlag.RightLeftModifiesCommand ), 0)); entry(new Page (new Key( Kind.PageUp ), EnumSet.of( NormalVisualFlag.MayStartSelectionWithShiftModifier, NormalVisualFlag.MayStopSelectionWithoutShiftModifier ), BACKWARD )); entry(new Page (new Key( Kind.PageDown ), EnumSet.of( NormalVisualFlag.MayStartSelectionWithShiftModifier, NormalVisualFlag.MayStopSelectionWithoutShiftModifier ), FORWARD )); entry(new End (new Key( Kind.End ), EnumSet.of( NormalVisualFlag.MayStartSelectionWithShiftModifier, NormalVisualFlag.MayStopSelectionWithoutShiftModifier ), FALSE )); entry(new Home (new Key( Kind.Home ), EnumSet.of( NormalVisualFlag.MayStartSelectionWithShiftModifier, NormalVisualFlag.MayStopSelectionWithoutShiftModifier ), 0 )); entry(new Abbrev (new Key( Kind.Delete ), null, 0 )); entry(new Help (new Key( Kind.F1 ), EnumSet.of(NormalVisualFlag.NotAllowedInCommandLineWindow), 0)); } }
e7b9fe09ab2fc1a414ec5256f80ffb9be5ec1ece
6ed265d74a0161f10c2f34752483d6d7bf86376a
/src/main/java/net/originmobi/pdv/repository/AjusteProdutoRepository.java
c304c857936332a378b7cb00a752e650cbb0e558
[ "Apache-2.0" ]
permissive
joaotux/pdv
4ce3df47c12fb165a443c1cb2410aab5f2f9b9e4
8ed96d5d727adec0606a912a0b4a2c65bc0d54fd
refs/heads/master
2022-07-10T16:57:55.192279
2022-06-22T18:30:16
2022-06-22T18:30:16
137,320,615
44
38
Apache-2.0
2022-06-22T18:30:17
2018-06-14T07:12:49
Java
UTF-8
Java
false
false
1,485
java
package net.originmobi.pdv.repository; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import org.springframework.transaction.annotation.Transactional; import net.originmobi.pdv.model.AjusteProduto; public interface AjusteProdutoRepository extends JpaRepository<AjusteProduto, Long> { List<AjusteProduto> findByAjusteCodigoEquals(Long codAjuste); @Transactional @Modifying @Query(value = "insert into ajuste_produtos (ajuste_codigo, produto_codigo, estoque_atual, qtd_alteracao, qtd_nova) " + "values (:codajuste, :codprod, :estoque_atual, :qtd_alteracao, :qtd_nova)", nativeQuery = true) void insereProduto(@Param("codajuste") Long codajuste, @Param("codprod") Long codprod, @Param("estoque_atual") int estoque_aqual, @Param("qtd_alteracao") int qtd_alteracao, @Param("qtd_nova") int qtd_nova); @Query(value = "select count(*) from ajuste_produtos where ajuste_codigo = :codAjuste and produto_codigo = :codprod", nativeQuery = true) int buscaProdAjuste(@Param("codAjuste") Long codAjuste, @Param("codprod") Long codProd); @Transactional @Modifying @Query(value = "delete from ajuste_produtos where ajuste_codigo = :ajuste and codigo = :codigo", nativeQuery = true) void removeProduto(@Param("ajuste") Long codajuste, @Param("codigo") Long coditem); }
8f8b4105342a6324132db35e52be4264510de696
1cd6f9829ae7f5cddfd5cccdd706ebd30aa2f6ca
/src/main/java/com/huangxi/service/combine/impl/HeadLineShopCategoryCombineServiceImpl2.java
190ea373db04309c9bbb92a7e5eb88061df3d5b6
[]
no_license
zerotoone01/simple-framework
34f4fbb703d775b73c29eaf7e140eeb869a24a07
b84143aff2c054caed7b7d98343bc0c716ddd19e
refs/heads/master
2023-01-30T03:40:06.254535
2020-12-14T17:24:36
2020-12-14T17:24:36
281,105,949
0
0
null
null
null
null
UTF-8
Java
false
false
533
java
package com.huangxi.service.combine.impl; import com.huangxi.entity.dto.MainPageInfoDTO; import com.huangxi.entity.dto.Result; import com.huangxi.service.combine.HeadLineShopCategoryCombineService; import org.simpleframework.core.annotation.Service; /** * 测试多个接口实现,在获取bean实例时候的异常 */ @Service public class HeadLineShopCategoryCombineServiceImpl2 implements HeadLineShopCategoryCombineService { @Override public Result<MainPageInfoDTO> getMainPageInfo() { return null; } }
53e7d9337a6355fe9332baf32d6349c66cb49913
7af9a46b984e2657bea3b40c418ecdaaaf290b85
/app/src/main/java/com/udea/daniel/practicafinal/MainActivity.java
f7c80e9953a54881390d35dc7b8b8b89541e00c1
[]
no_license
danielgarcia92/PracticaFinal
6397501a67ce523dfd46c44f4b8aff9d54014958
370cb4c469fd77479c14d9f3a166616d7b922b65
refs/heads/master
2021-01-16T00:27:47.043847
2015-07-26T20:32:32
2015-07-26T20:32:32
39,740,914
0
0
null
null
null
null
UTF-8
Java
false
false
1,129
java
package com.udea.daniel.practicafinal; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; public class MainActivity extends ActionBarActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
fbb57188b63499bea3c3c9f49fc816b59db60346
d1a6d1e511df6db8d8dd0912526e3875c7e1797d
/genny_JavaWithoutLambdas/applicationModule/src/test/java/applicationModulepackageJava14/Foo958Test.java
1c7db78d167ac2238afe320267d305fe1ce65d80
[]
no_license
NikitaKozlov/generated-project-for-desugaring
0bc1443ab3ddc84cd289331c726761585766aea7
81506b3711004185070ca4bb9a93482b70011d36
refs/heads/master
2020-03-20T00:35:06.996525
2018-06-12T09:30:37
2018-06-12T09:30:37
137,049,317
0
0
null
null
null
null
UTF-8
Java
false
false
482
java
package applicationModulepackageJava14; import org.junit.Test; public class Foo958Test { @Test public void testFoo0() { new Foo958().foo0(); } @Test public void testFoo1() { new Foo958().foo1(); } @Test public void testFoo2() { new Foo958().foo2(); } @Test public void testFoo3() { new Foo958().foo3(); } @Test public void testFoo4() { new Foo958().foo4(); } @Test public void testFoo5() { new Foo958().foo5(); } }
0f42505a911bc5732f24ad052deb16062ddd3706
dd230495d8d29c3d1b463c7ab31d374d3c23b812
/app/src/main/java/com/volantgoat/bluetoothchat/helper/SQLHelper.java
12ee228c7cbb10e4ada2d64183affdda13c7524c
[]
no_license
LCoderFix/BluetoothChat
b799bcb30554d8a70ae0cb84dcb4522a9560899b
11bfbad9d9d50be102d6bd27b00c46e00ceed2ae
refs/heads/master
2022-11-06T08:55:17.235376
2020-06-16T07:51:11
2020-06-16T07:51:11
272,641,950
3
1
null
null
null
null
UTF-8
Java
false
false
1,146
java
package com.volantgoat.bluetoothchat.helper; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; /** * Create by dong * Data:2019/12/11 */ public class SQLHelper extends SQLiteOpenHelper { public static final String DB_NAME = "blue_tooth_chat_db"; public static final String TABLE_NAME = "chat_table"; public static final String COLUMN_ID = "id"; public static final String COLUMN_NAME = "device_name"; public static final String COLUMN_TAG = "tag"; public static final String COLUMN_CONTENT = "content"; private static final String CREATE_TABLE = "create table " + TABLE_NAME + "(" + COLUMN_ID + " varchar(40) , " + COLUMN_NAME + " varchar(20) ," + COLUMN_TAG + " int , " + COLUMN_CONTENT + " varchar(100)) "; public SQLHelper(Context context) { super(context, DB_NAME, null, 1); } @Override public void onCreate(SQLiteDatabase db) { //创建表 db.execSQL(CREATE_TABLE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { } }