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
755fa7aa949e88d39f1a88a23d85ddd4bc2c077f
e0e1262a42df1acf024038f6baa8e82809a35651
/src/main/java/examen/meli/service/Impl/LogServiceImpl.java
493df93c3b309921579244deb8487c56ee4bd1fb
[]
no_license
sroidzaid/meli
420849f31dc249d7f767ad1bccb01957dadeea2c
97819e7923431c1197d2d6d7a0ef03f16a4edac9
refs/heads/master
2022-12-14T00:19:31.706938
2020-08-28T16:11:55
2020-08-28T16:11:55
288,913,749
0
0
null
null
null
null
UTF-8
Java
false
false
2,715
java
package examen.meli.service.Impl; import examen.meli.dto.LogDTO; import examen.meli.dto.StatisticsDTO; import examen.meli.entity.LogEntity; import examen.meli.exception.ConexionErrorException; import examen.meli.exception.DataNotFoundException; import examen.meli.repository.LogRepository; import examen.meli.service.LogService; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; import java.util.List; import java.util.concurrent.CompletableFuture; import java.util.stream.Collectors; @Service public class LogServiceImpl implements LogService { @Autowired private LogRepository logRepository; @Autowired private ModelMapper modelMapper; @Async public CompletableFuture<StatisticsDTO> getLogMinMaxProm(){ try{ List<LogDTO> listMin = findMin().stream() .map(log -> modelMapper.map(log, LogDTO.class)) .collect(Collectors.toList()); List<LogDTO> listMax = findMax().stream() .map(log -> modelMapper.map(log, LogDTO.class)) .collect(Collectors.toList()); if(!listMin.isEmpty() && !listMax.isEmpty()){ StatisticsDTO statisticsDTO = new StatisticsDTO(); statisticsDTO.setList_min(listMin); statisticsDTO.setList_max(listMax); statisticsDTO.setDistance_prom(findProm()); return CompletableFuture.completedFuture(statisticsDTO); }else{ throw new DataNotFoundException(); } }catch (Exception e){ throw new ConexionErrorException(); } } public List<LogEntity> findAll() { try{ List<LogEntity> listLogs = logRepository.findAll(); return listLogs; }catch (Exception e){ throw new ConexionErrorException(); } } public List<LogEntity> findMin() { try{ List<LogEntity> listLogs = logRepository.findMin(); return listLogs; }catch (Exception e){ throw new ConexionErrorException(); } } public List<LogEntity> findMax() { try{ List<LogEntity> listLogs = logRepository.findMax(); return listLogs; }catch (Exception e){ throw new ConexionErrorException(); } } public Double findProm() { try{ Double prom = logRepository.findProm(); return prom; }catch (Exception e){ throw new ConexionErrorException(); } } }
6d768188f7120a808c59021748f6d18f02e138d1
8fd0724adbf57b3d8d516228da8d5f71da17a40e
/src/main/java/todo/project/WebConfig.java
10e623eed1abe7471ad97cd106b0555fcd716fe9
[]
no_license
coding-talented-academy/todo-project-backend
689b6accbb7660abf08d07b89a74657d56af8c72
61e6c924816536cfa859d4f23e177a5235074c9e
refs/heads/master
2023-08-24T15:46:50.893690
2021-11-01T05:22:31
2021-11-01T05:22:31
423,339,008
0
0
null
null
null
null
UTF-8
Java
false
false
463
java
package todo.project; import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @Configuration public class WebConfig implements WebMvcConfigurer { @Override public void addCorsMappings(CorsRegistry registry) { registry.addMapping("/**") .allowedOrigins("*") .allowedMethods("*"); } }
f720cd0614a6dc58ce9923a6bb500df56b6288bd
845a005d52ea976a75525ee37cc01292c6874e16
/app/src/androidTest/java/com/gabrielucelli/ApplicationTest.java
be086ba7e03348f86c8f9c2a9ee11f06d96b8be7
[]
no_license
gabrielucelli/fragment-stack-viewpager-example
1f84add1fb16b7a0624fbd09301a43b4b2087840
f1b4f719f65e94ffdd050cc23cf3e3ccadf829f1
refs/heads/master
2021-01-22T08:09:43.595144
2017-02-13T22:27:31
2017-02-13T22:27:31
81,877,797
0
0
null
null
null
null
UTF-8
Java
false
false
348
java
package com.gabrielucelli; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
0e5b0922ff98d5064f47a85de3d3fdd88f8e32d0
aa0bf45a48eaad216267475ef47bef9facf33b85
/New folder/app/src/main/java/com/app/whoot/util/FirebaseReportUtils.java
d845408c6d27f3672884cee80cea87198abf1f01
[]
no_license
pt198912/Whoot
3f1ce9d456b327b0d261411ab3a4d75b54c3dc60
e6ba0dc2c5e28043a501a9fe89aa9c8d81c96ede
refs/heads/master
2020-06-21T20:24:45.169405
2019-07-18T08:27:47
2019-07-18T08:27:47
197,537,094
0
0
null
null
null
null
UTF-8
Java
false
false
2,346
java
package com.app.whoot.util; import android.os.Bundle; import android.util.Log; import com.app.whoot.app.MyApplication; import com.app.whoot.manager.ConfigureInfoManager; import com.google.firebase.analytics.FirebaseAnalytics; /** * pt198912 */ public class FirebaseReportUtils { private static volatile FirebaseReportUtils instance; private static FirebaseAnalytics mFirebaseAnalytics; private String Form; private static final String TAG = "FirebaseReportUtils"; public static FirebaseReportUtils getInstance() { if (instance == null) { instance = new FirebaseReportUtils(); } return instance; } private FirebaseReportUtils() { mFirebaseAnalytics = FirebaseAnalytics.getInstance(MyApplication.getInstance()); } /** * 埋点 * * @param key * @param value */ private void report(String key, Bundle value) { if (value == null) { value = new Bundle(); } mFirebaseAnalytics.logEvent(key, value); } public void reportEventWithBaseData(String key, Bundle value) { if (value == null) { value = new Bundle(); } String Usid = (String) SPUtil.get(MyApplication.getInstance(), "you_usid", "0"); int type_login = (int) SPUtil.get(MyApplication.getInstance(), "type_login", 0); if (type_login==2){ Form="FB"; }else if (type_login==3){ Form="MAIL"; }else if (type_login==6){ Form="MOBILE"; }else{ Form=""; } value.putString("version",MyApplication.getInstance().getVersionName()); value.putString("platform","AND"); value.putString("userId",Usid); value.putString("registerFrom",Form); long duration=System.currentTimeMillis()-ConfigureInfoManager.getInstance().getLastMobileTime(); long currentTime=ConfigureInfoManager.getInstance().getLastServerTime()+duration; Log.d(TAG, "reportEventWithBaseData: getLastServerTime "+ConfigureInfoManager.getInstance().getLastServerTime()); value.putLong("createAt",currentTime); mFirebaseAnalytics.logEvent(key, value); } /** * 埋点 * * @param key */ public void report(String key) { report(key, null); } }
b4e45459c0301318220b59d10c5239a9026242f1
606ff68d595c815cf40b617ca78f7f901a2ba974
/w15/iterator_pattern/my_iterator/IIterable.java
cd042b15d3136bdfa4a5e0f1e5b7a4fc306ceb6c
[]
no_license
NTI-Kronhus/TE16Prog-PRRPRR02
dc73d9fbe9cd9c5ecf94e8ba8fd8ff1d7cb56813
ef00d1d3835e7818deb4747a87e5c2fca434be6b
refs/heads/master
2020-03-16T01:32:12.448157
2019-05-13T08:12:29
2019-05-13T08:12:29
132,442,409
0
0
null
null
null
null
UTF-8
Java
false
false
111
java
package iterator_pattern.my_iterator; public interface IIterable<E> { public IIterator<E> getIterator(); }
e00e02393b05ee213fff2291bedb60506330c1aa
3fd6cb451ac67aa73a037d758e5acb48f12f7add
/src/felix/pagesview/Main.java
b9caa7d9c21b6c9f6a27e7f6f42963d397ca1fc0
[]
no_license
ydsy/pagesview
acb6c040c414eeb571853bda2d44724fbd6faefa
545fc2378d39b91ee3d19f603a966876f45c1c4f
refs/heads/master
2021-06-25T10:20:46.349880
2017-09-09T20:46:05
2017-09-09T20:46:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
962
java
package felix.pagesview; import javafx.application.Application; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.layout.StackPane; import javafx.scene.paint.Color; import javafx.stage.Stage; /** * Created by Z< on 09/09/2017. */ public class Main extends Application { public static void main(String[] args) { launch(args); } @Override public void start(Stage primaryStage) throws Exception { Group group = new Group(); PagesView pagesView = new PagesView(group, 100, new GetPageImpl() { @Override public void page(int before, int after) { System.out.println("before = " + before + ", after = " + after); } }); pagesView.initView(); StackPane root = new StackPane(); root.getChildren().add(group); primaryStage.setScene(new Scene(root, 800, 100, Color.BLACK)); primaryStage.show(); } }
d090d2189edc9aeeb773f6788c99b8050e1930cc
720e6916a60d27c9c1ce456011bc0283ffe2c8eb
/app/src/main/java/com/example/hp8440p/myapplication/Course/Adapter/AdapterLichHoc.java
370f44a4522fee11832b7c6b2d8cb59c061f8264
[]
no_license
QuangRunin/Newfolder
7c89998928c15d7a74f43463b1441c9b3501b0a5
b7eea60b2b9d4dcc0cbc53f770bcc99405468094
refs/heads/master
2020-04-08T16:45:21.464835
2018-11-28T16:40:51
2018-11-28T16:40:51
159,533,420
0
0
null
null
null
null
UTF-8
Java
false
false
2,216
java
package com.example.hp8440p.myapplication.Course.Adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ListView; import android.widget.TextView; import com.example.hp8440p.myapplication.Course.Fragment_Manage.MonHocVaTKB_Fragment; import com.example.hp8440p.myapplication.Course.Oject.LichHoc; import com.example.hp8440p.myapplication.Course.Oject.MonHoc; import com.example.hp8440p.myapplication.R; import java.util.List; public class AdapterLichHoc extends BaseAdapter { MonHocVaTKB_Fragment mContext; List<LichHoc> list; ListView lv; public AdapterLichHoc(MonHocVaTKB_Fragment mContext, List<LichHoc> list, ListView lv) { this.mContext = mContext; this.list = list; this.lv = lv; } @Override public int getCount() { return list.size(); } @Override public Object getItem(int i) { return null; } @Override public long getItemId(int i) { return 0; } public class ViewHoder { TextView Ngay, Phong, Mon, Tgian; ListView lv; } @Override public View getView(int i, View view, ViewGroup viewGroup) { ViewHoder hoder; if (view == null) { hoder = new ViewHoder(); LayoutInflater inflater = (LayoutInflater) mContext.getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = inflater.inflate(R.layout.item_lichhoc, null); hoder.Ngay = view.findViewById(R.id.tvNgay); hoder.Phong = view.findViewById(R.id.tvPhong); hoder.Mon = view.findViewById(R.id.tvMon); hoder.Tgian = view.findViewById(R.id.tvThoiGian); hoder.lv = view.findViewById(R.id.lvLichHoc); view.setTag(hoder); } else hoder = (ViewHoder) view.getTag(); LichHoc lichHoc = (LichHoc) list.get(i); hoder.Ngay.setText(lichHoc.getNgay()); hoder.Phong.setText(lichHoc.getPhong()); hoder.Mon.setText(lichHoc.getMon()); hoder.Tgian.setText(lichHoc.getTgian()); return view; } }
6e2e838fdf8db0309d30372d7b7cdf742c9ffff5
53836a695fab4299febbcc6ffe084f944d95d0b9
/src/smartLemmings/qlearning/QLearning.java
4e0da71a49e0a71413a695e061c646e19a0dc524
[]
no_license
Oleur/SmartLemmings
05ceeda4ebd6bcfdd6379f771eb9a1ed92bded1a
0f82b90fc8fef6162f233ba4c99431655d3d7934
refs/heads/master
2021-01-10T15:55:49.400977
2013-03-05T10:26:47
2013-03-05T10:27:08
null
0
0
null
null
null
null
ISO-8859-1
Java
false
false
4,165
java
package smartLemmings.qlearning; /* * author Clément Desoche * adapted from QLearning by Stéfane Galland */ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Random; import java.util.TreeMap; import java.util.Map.Entry; import smartLemmings.graph.GraphArc; import smartLemmings.graph.GraphNode; import smartLemmings.qlearning.QAction; import smartLemmings.qlearning.QComparator; import smartLemmings.qlearning.QProblem; import smartLemmings.qlearning.QState; /* * */ public class QLearning<S extends QState, A extends QAction> { private final QProblem<S,A> problem; private final Map<S,Map<A,Float>> qValues = new TreeMap<S,Map<A,Float>>(new QComparator()); /* * CONSTRUCTOR */ public QLearning(QProblem<S, A> problem){ this.problem = problem; //System.out.println("pouet: "+problem.getAvailableStates().size()); for(S s : problem.getAvailableStates()) { Map<A,Float> m = new TreeMap<A, Float>(new QComparator()); this.qValues.put(s, m); for(A a : problem.getAvailableActionsFor(s)) { m.put(a, 0f); } } } /* * This constructor built the Map from the graph structre, wich can be loaded from the outside. */ public QLearning(QProblem<S, A> problem, ArrayList<GraphNode> nodes){ this.problem = problem; int i=0; int j; for(S s : problem.getAvailableStates()) { ArrayList<GraphArc> arcs = nodes.get(i).getActions(); Map<A,Float> m = new TreeMap<A, Float>(new QComparator()); this.qValues.put(s, m); j=0; for(A a : problem.getAvailableActionsFor(s)) { m.put(a, arcs.get(j).getCost()); ++j; } ++i; } } /* * This function update the learning map when encountering new state in the simulation */ public void updateMapWithNewState(S newState){ Map<A,Float> m = new TreeMap<A, Float>(new QComparator()); this.qValues.put(newState, m); for(A a : problem.getAvailableActionsFor(newState)) { m.put(a, 0f); } } /* * This action update the learning Map, from the lemming's previous state using the QLearning formula. * */ public void learn(S currentState, A actionTaken, QFeedback<S> result){ Random r=new Random(); float q=getQ(result.state, actionTaken); float maxQ= getQ(currentState, getBestAction(r, currentState)); putQ(result.state, actionTaken, (1-problem.getAlpha())*q+(problem.getAlpha()*(result.score+problem.getGamma()*maxQ))); } /* * This function replies the Lemming's future action. * The best one are a Random one. */ public A chooseAction(Random r, S state){ List<A> actions; A action; float cmp = r.nextFloat(); if(cmp < problem.getRho()){ actions = this.problem.getAvailableActionsFor(state); action = actions.get(r.nextInt(actions.size())); } else { action = getBestAction(r,state); } return action; } /* * This function replies the best action are random action among the best */ public A getBestAction(Random random, S state) { //System.out.println(state.toInt()); Map<A,Float> m = this.qValues.get(state); assert(m!=null); List<A> bestActions = new ArrayList<A>(); float bestScore = Float.NEGATIVE_INFINITY; for(Entry<A,Float> entry : m.entrySet()) { if (entry.getValue()>bestScore) { bestActions.clear(); bestActions.add(entry.getKey()); bestScore = entry.getValue(); } else if (entry.getValue()==bestScore) { bestActions.add(entry.getKey()); } } assert(!bestActions.isEmpty()); return bestActions.get(random.nextInt(bestActions.size())); } /* * GETTER/SETTER */ private float getQ(S state, A action) { Map<A,Float> m = this.qValues.get(state); assert(m!=null); Float q = m.get(action); if (q==null) return 0f; return q.floatValue(); } private void putQ(S state, A action, float q) { Map<A,Float> m = this.qValues.get(state); assert(m!=null); m.put(action, q); } public Map<S,Map<A,Float>> getQMap (){ return qValues; } public void addNewState(S state) { Map<A,Float> m = new TreeMap<A, Float>(new QComparator()); this.qValues.put(state, m); for(A a : problem.getAvailableActionsFor(state)) { m.put(a, 0f); } } }
018637ff794a7ceb4fd31dd1c802b0809174e39f
2f6001755b365937fd92789074da0be24f92b46b
/java8/java8-test/src/main/java/com/mgw/proxy/Person.java
26fa647380b0b32786353f665195bf94c5470627
[]
no_license
luwang951753/TestProject
5814ce2523389af607d31b1b651c46fcf157a58e
be9513532cc327b89f8017aeb42514d9f7b56b66
refs/heads/master
2022-11-10T04:20:55.389975
2020-03-29T14:32:15
2020-03-29T14:32:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
181
java
package com.mgw.proxy; public class Person implements Subject { @Override public void shopping() { System.out.println("付款,买到想要的商品"); } }
a7718a954938f1719b1997beea6949b994d3c95a
d2155dad873f519722753f14bc1297df73d5c599
/app/src/main/java/com/example/malami/przewodnikkulinarny/FirebaseHelper.java
c3a04b149b371de12c260a33c5ad20a3323bdec6
[]
no_license
AleksandraWl/PrzewodnikKulinarny2
91fe85aace17af1f43942457b65adbd46343c4ef
5b29ac0b4bd3477000c9cad1ab4e4f5a01499d6e
refs/heads/master
2020-05-16T13:12:19.880350
2019-04-23T17:56:45
2019-04-23T17:56:45
183,068,109
0
0
null
null
null
null
UTF-8
Java
false
false
3,558
java
package com.example.malami.przewodnikkulinarny; /** * Created by MalaMi on 20.09.2018. */ import com.google.firebase.database.ChildEventListener; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseException; import com.google.firebase.database.DatabaseReference; import java.util.ArrayList; public class FirebaseHelper { DatabaseReference db; Boolean saved=null; kategorie spacecraft = null; public FirebaseHelper(DatabaseReference db) { this.db = db; } /*//SAVE public Boolean save(kategorie spacecraft) { if(spacecraft==null) { saved=false; }else { try { db.child("Kategoria").push().setValue(spacecraft); saved=true; }catch (DatabaseException e) { e.printStackTrace(); saved=false; } } return saved; }*/ public ArrayList<String> ListaKategorie() { final ArrayList<String> lista=new ArrayList<>(); lista.clear(); lista.add("Kategoria"); db.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { fetchData(dataSnapshot,lista); } @Override public void onChildChanged(DataSnapshot dataSnapshot, String s) { fetchData(dataSnapshot,lista); } @Override public void onChildRemoved(DataSnapshot dataSnapshot) { } @Override public void onChildMoved(DataSnapshot dataSnapshot, String s) { } @Override public void onCancelled(DatabaseError databaseError) { } }); return lista; } public ArrayList<String> ListaAdministratorow() { final ArrayList<String> lista=new ArrayList<>(); lista.clear(); lista.add("Administratorzy"); db.addChildEventListener(new ChildEventListener() { @Override public void onChildAdded(DataSnapshot dataSnapshot, String s) { Administratorzy(dataSnapshot,lista); } @Override public void onChildChanged(DataSnapshot dataSnapshot, String s) { Administratorzy(dataSnapshot,lista); } @Override public void onChildRemoved(DataSnapshot dataSnapshot) { } @Override public void onChildMoved(DataSnapshot dataSnapshot, String s) { } @Override public void onCancelled(DatabaseError databaseError) { } }); return lista; } private void fetchData(DataSnapshot snapshot,ArrayList<String> lista) { lista.clear(); lista.add("Kategoria"); for (DataSnapshot ds:snapshot.getChildren()) { String kategoria=ds.getValue(kategorie.class).getKategoria(); lista.add(kategoria); } } private void Administratorzy(DataSnapshot snapshot,ArrayList<String> lista) { lista.clear(); lista.add("Administratorzy"); for (DataSnapshot ds:snapshot.getChildren()) { String administrator=ds.getValue(admin.class).getEmail(); lista.add(administrator); } } }
4b93482a8c68521cb707d43a42840d61d99a4c59
ceed08337257aeffee873a1acaa9897f0e9855c6
/src/main/java/task/dao/api/GenericDao.java
ab082a3cc1a1b2b46989c0922242cabc75003563
[]
no_license
RuslAys/nodes
20a46de8127696152c54cda5921cfa848cf443ec
f6b9a074e8aea8863913dfe5012d3702c0dd0c3c
refs/heads/master
2020-04-20T08:26:15.071785
2019-02-03T16:27:39
2019-02-03T16:27:39
168,738,901
0
0
null
null
null
null
UTF-8
Java
false
false
839
java
package task.dao.api; import java.util.List; /** * Interface for generic data access object * @param <E> entity * @param <K> entity`s key */ public interface GenericDao <E, K> { /** * Method for add entity to data base * @param entity Generic entity */ void add(E entity); /** * Method for update entity in data base * @param entity Generic entity */ void update(E entity); /** * Method for remove entity from data base * @param entity Generic entity */ void remove(E entity); /** * Method for search entity in data base * @param key Generic key * @return Generic entity */ E find(K key); /** * Method for search all generic entities in data base * @return List with generic entities */ List<E> findAll(); }
676a4612963b961130e678cada9fa1cc25fbfab8
1944787e49571d83f91b76f42b697d15a9106f7b
/cms-weixin/src/test/java/com/wangyang/Application.java
1e0c3db4ecd3ab93e6010943728ed7f749d966e0
[]
no_license
wangyang1749/cms-dev
dd0d492baad47a20e1459c79f78294b4100dc39b
f2d9e4dd36d35c8495c32c17fce9fdcf627af870
refs/heads/master
2021-09-21T11:30:01.505679
2021-08-14T03:17:51
2021-08-14T03:17:51
243,221,103
14
4
null
2020-06-07T23:58:25
2020-02-26T09:19:04
Java
UTF-8
Java
false
false
695
java
package com.wangyang; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.domain.EntityScan; import org.springframework.context.annotation.ComponentScan; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; //@ComponentScan(basePackages = {"com.wangyang"}) //@EnableJpaRepositories(basePackages = {"com.wangyang.data.repository"}) //@EntityScan(basePackages = {"com.wangyang.model.pojo.entity"}) @SpringBootApplication public class Application { public static void main(String[] args) { SpringApplication.run(Application.class,args); } }
7c96fa04027031e8a520153e07dc688527fb2ccc
6235a5a52cd2ccd514bb78b7ccd585b50d72e7d3
/SAPPHIRE-APP/app/src/main/java/com/live/sapphire/app/Adapters/ChildCategoriesAdapter.java
d0831d999aa4fcf1df4b7666346d1d88943abe12
[]
no_license
husnain-iqbal/SAPPHIRE-APP
f7423be4e4f58d8e08925a0e0fce19caa567c450
005e93d0b6022bb9462db4849f64c0d84898b8dc
refs/heads/master
2020-09-10T01:21:01.236872
2019-11-14T04:55:16
2019-11-14T04:55:16
221,614,453
0
0
null
null
null
null
UTF-8
Java
false
false
4,505
java
package com.live.sapphire.app.Adapters; import android.app.Activity; import android.content.Context; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.Button; import android.widget.ImageButton; import com.live.sapphire.app.AppConfigurations; import com.live.sapphire.app.Customized.ChildCategoryInfo; import com.live.sapphire.app.Customized.ImageDimensions; import com.live.sapphire.app.R; import com.live.sapphire.app.Utilities; import com.squareup.picasso.Picasso; import com.squareup.picasso.Target; import java.util.ArrayList; /** * Created by hp on 3/20/2017. */ public class ChildCategoriesAdapter extends BaseAdapter { private Activity mActivity; private Context mContext; private SendData mSendData; private LayoutInflater mLayoutInflater; private ArrayList<ChildCategoryInfo> mChildCategoryList; public ChildCategoriesAdapter(SendData subcategoryId, Activity activity, ArrayList<ChildCategoryInfo> childCategoryInfoList) { mActivity = activity; mContext = mActivity.getApplicationContext(); mSendData = subcategoryId; mChildCategoryList = childCategoryInfoList; mLayoutInflater = LayoutInflater.from(activity.getApplicationContext()); } @Override public int getCount() { return mChildCategoryList.size(); } @Override public Object getItem(int position) { return mChildCategoryList.get(position); } @Override public long getItemId(int position) { return position; } @Override public View getView(final int position, final View convertView, final ViewGroup parent) { View view = convertView; final ViewHolder holder; if (view == null) { view = mLayoutInflater.inflate(R.layout.listview_layout_customized, parent, false); holder = new ViewHolder(); holder.imageButton = (ImageButton) view.findViewById(R.id.listview_row_image); holder.button = (Button) view.findViewById(R.id.listview_row_customized); view.setTag(holder); } else { holder = (ViewHolder) view.getTag(); } holder.button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mSendData.sendData2NewScreen(mChildCategoryList.get(position)); } }); holder.imageButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { mSendData.sendData2NewScreen(mChildCategoryList.get(position)); } }); ChildCategoryInfo info = mChildCategoryList.get(position); holder.button.setText(info.getChildCategoryName()); String thumbnailUrl = info.getThumbnailUrl(); if (thumbnailUrl != null && !thumbnailUrl.equals("")) { thumbnailUrl = Utilities.validateThumbnailUrl(thumbnailUrl); Target target = new Target() { @Override public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { // holder.imageButton.setBackgroundColor(mContext.getResources().getColor(R.color.white)); holder.imageButton.setImageBitmap(bitmap); } @Override public void onBitmapFailed(Drawable errorDrawable) { holder.imageButton.setImageDrawable(errorDrawable); } @Override public void onPrepareLoad(Drawable placeHolderDrawable) { holder.imageButton.setImageDrawable(placeHolderDrawable); } }; ImageDimensions imageDimensions = AppConfigurations.getImageDimensions(mContext); Picasso.with(mContext) .load(thumbnailUrl) .resize(imageDimensions.getWidth(), imageDimensions.getHeight()) .into(target); } return view; } private static class ViewHolder { ImageButton imageButton; Button button; } public interface SendData { void sendData2NewScreen(ChildCategoryInfo info); } }
1fd91fa1ce079b14bf93baea7b1293da8d25e652
375114d3755e035e1dab69e34530c711878baf51
/LaiCode Algorithm Class/String_II/AllPermutationsII.java
e595dba2668334fdde766707980da3c922d1f659
[]
no_license
Guaniuzzt/Algorithms-Interview
b2d184f80f9accbb6904518f10ef636a0ff95549
846ad21266c3f9e567e0993d3bf601876c2498b9
refs/heads/master
2023-07-29T06:27:51.914017
2021-09-11T02:23:09
2021-09-11T02:23:09
298,424,969
0
0
null
null
null
null
UTF-8
Java
false
false
1,418
java
import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; public class AllPermutationsII { /* 和I不同的地方时输入可以有相同值 eg: abc vs aabbcc 需要排除相同情况 */ public static void main(String[] args) { String test = "abc"; System.out.println(method(test)); } public static List<String> method(String input){ List<String> list = new ArrayList<>(); if(input == null || input.length() == 0) return list; char[] array = input.toCharArray(); boolean[] flag = new boolean[array.length]; Set<String> set = new HashSet<>(); StringBuilder sb = new StringBuilder(); dfs(array, sb, set, list, flag, 0); return list; } public static void dfs(char[] array, StringBuilder sb,Set<String> set, List<String> list, boolean[] flag, int index){ if(index == array.length){ String temp = new String(sb); if(set.add(temp)) list.add(temp); return ; } for(int i=0; i<array.length; i++){ if(!flag[i] ){ sb.append(array[i]); flag[i] = true; dfs(array, sb, set, list, flag, index+1); sb.deleteCharAt(sb.length()-1); flag[i] = false; } } } }
eeaf0aa109294908223346d451f8a5fd2fc6e454
6f5bd814d24dd2c7dc122aba66a79e66f7d52789
/src/main/java/br/com/zup/nossocartao/proposta/associacarteiradigital/InformaCarteiraDigitalRequest.java
91ea15b66213ab02a343750a7d4104343807e50a
[]
permissive
edsonmoreirazup/bootcamp-02-template-proposta
83796c6944dc0954630543b385956cef2dc7a0d0
0b9fd726fe2435a584e25bece3e0867dc8b886bf
refs/heads/main
2023-02-02T14:30:51.221653
2020-12-18T20:18:50
2020-12-18T20:18:50
313,749,396
0
0
Apache-2.0
2020-11-17T21:38:12
2020-11-17T21:38:11
null
UTF-8
Java
false
false
833
java
package br.com.zup.nossocartao.proposta.associacarteiradigital; import com.fasterxml.jackson.annotation.JsonProperty; import javax.validation.constraints.Email; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; public class InformaCarteiraDigitalRequest { @NotBlank @Email private String email; @NotNull private ProvedorCarteiraDigital carteira; public InformaCarteiraDigitalRequest(@JsonProperty("email") @NotBlank @Email String email, @JsonProperty("carteira") @NotNull ProvedorCarteiraDigital carteira) { this.email = email; this.carteira = carteira; } public String getEmail() { return email; } public ProvedorCarteiraDigital getCarteira() { return carteira; } }
1239f4d784b0ec9453956698c25dcff2c298a219
9fa95cc28aeb3498ff269ab0c7416ae7e1a2e1cc
/src/main/java/br/com/unifacisa/academia/academia/dto/HorarioAluno.java
e6254f5b2cbc368c65b67880d2701d9d29ccdc75
[]
no_license
jamesmarcos2123/Academia
b9fbfcaf55d2d9834a31d52bb2968826a122b7c0
fd36c14eaf99882d74e706b47a97e2f4768a08f2
refs/heads/master
2020-09-16T05:50:33.470550
2019-11-24T01:08:03
2019-11-24T01:08:03
223,673,269
0
0
null
null
null
null
UTF-8
Java
false
false
661
java
package br.com.unifacisa.academia.academia.dto; import java.util.ArrayList; import java.util.List; import br.com.unifacisa.academia.academia.models.Exercicio; public class HorarioAluno { private String nome; private List<ExercicioDto> exercicios = new ArrayList<ExercicioDto>(); public HorarioAluno(String nome , List<Exercicio> exercicios) { this.nome = nome; for (Exercicio exercicio : exercicios) { this.exercicios.add(new ExercicioDto(exercicio.getNome(),exercicio.getHorarioInicio(),exercicio.getHorarioFinal())); } } public List<ExercicioDto> getExercicios() { return exercicios; } public String getNome() { return nome; } }
4feae6f4547ce3155d6bc3195534d1e7b0cd69e6
9ffff694af95fdf7dec07d71ef963e265c4361dc
/ASSIGNMENT 2/Enrollment.java
b0cd8af6dda03c3f11c6de1e048206d2dd42f7df
[]
no_license
idittalaviya/JAVA
95906c064a55cd110945dbbf43d65f418440934d
db7eef935e45c993f4561b5ceca31c0f287f2c6c
refs/heads/master
2020-06-20T19:56:53.454996
2019-09-05T02:42:25
2019-09-05T02:42:25
197,229,701
0
0
null
null
null
null
UTF-8
Java
false
false
579
java
class Enrollment{ public static void main(string args[]){ String enrollmentNo = '170470107057'; String enrollmentYear = enrollmentNo.subString(0,2); String collegeCode = enrollmentNo.subString(2,6); if(enrollmentYear <18 && enrollmentYear >15){ System.out.println("Enrollment Year is valid."); } else{ System.out.println("Enrollment No. is Invalid."); } collegeCode = Integer.parseInt 047; if(collegeCode = 47){ System.out.println("College code is vaild."); } else{ System.out.println("Enrollment No. is Invaild."); }
6c8d0de692a8f7d750cfeef630ad1a871650bd4d
e89c0ff8a744b49587379e8e5fc232723fc651d7
/src/main/java/az/bank/mcaccount/config/RestTemplateConfig.java
3cf94001857854f5a6ceaba5c823468e360e187e
[]
no_license
FeridQuluzade/ms-account
7e2e0f235000f120a49e0ac9610427c758bd04a3
d383367705ec0b99c992084019fa1ff524f5ebac
refs/heads/master
2023-07-13T15:17:57.615200
2021-08-19T12:32:31
2021-08-19T12:32:31
396,793,477
3
1
null
2021-08-19T12:32:31
2021-08-16T12:52:19
Java
UTF-8
Java
false
false
854
java
package az.bank.mcaccount.config; import az.bank.mcaccount.exception.client.RestTemplateResponseErrorHandler; import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.web.client.RestTemplate; @Configuration public class RestTemplateConfig { private final RestTemplateResponseErrorHandler restTemplateResponseErrorHandler; public RestTemplateConfig(RestTemplateResponseErrorHandler restTemplateResponseErrorHandler) { this.restTemplateResponseErrorHandler = restTemplateResponseErrorHandler; } @Bean public RestTemplate restTemplate() { return new RestTemplateBuilder() .errorHandler(restTemplateResponseErrorHandler) .build(); } }
6f638b33ff3d7c4752abd33998723d1b7dfe7cb3
bb5d9e946d7327becfef1f7a6908dc436e9f526a
/DrawListener.java
c61b8ceb6b2e907d15899e2f87b1c1f4396e1c79
[]
no_license
Tristan1mohai/draw
2b5f0d5aa068261eba349519633acd9ac2759545
7cc8e1b0cfd6e016b9e57082ff4cd2e1408d7702
refs/heads/master
2021-05-06T19:49:48.404560
2017-11-27T12:21:48
2017-11-27T12:21:48
112,191,581
0
0
null
null
null
null
GB18030
Java
false
false
1,512
java
package Draw; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Shape; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import java.awt.event.MouseMotionListener; import java.awt.geom.Ellipse2D; import java.awt.geom.Line2D; import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.util.ArrayList; import javax.swing.JButton; import javax.swing.JPanel; public class DrawListener implements ActionListener{ draw dw; int x1,y1,x2,y2; Shape current; public DrawListener(draw d) { dw=d; } @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub if(e.getActionCommand().equals("")) { JButton button=(JButton)e.getSource(); dw.color=button.getBackground(); System.out.println("color="+dw.color); }else if(e.getActionCommand().equals("线条+")){ if(dw.current!=null) { dw.addStroke(); } }else if(e.getActionCommand().equals("线条-")){ if(dw.current!=null) { dw.cutStroke(); } }else if(e.getActionCommand().equals("保存")){ } else { JButton button=(JButton)e.getSource(); dw.DrawStyle=button.getActionCommand(); System.out.println("shape="+dw.DrawStyle); } } }
8c131b01c1ed5e83c5a776af19c2cfcd9036deb0
a1b21c7b03723a969c939e6cfed6b304c46baac5
/src/main/java/com/matheus/aep/entity/DoacaoEntity.java
cdb3bbbd895a1c1bf38b3899566db0f21c470800
[]
no_license
MatheusBonnet/projeto-rasmoo
4aa69e557eb609d8ceaf17dabece4cc9097de3e3
4f1f8b51d75e7a376ff5106a38e2a65c198818f2
refs/heads/main
2023-07-26T12:34:20.454520
2021-09-03T02:44:32
2021-09-03T02:44:32
402,107,769
0
0
null
2021-09-03T02:44:33
2021-09-01T15:18:56
null
UTF-8
Java
false
false
2,618
java
package com.matheus.aep.entity; import java.io.Serializable; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude.Include; @Entity @Table(name = "tb_doacao") public class DoacaoEntity implements Serializable{ private static final long serialVersionUID = 1828294080635336238L; @JsonInclude(Include.NON_NULL) @javax.persistence.Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "id") private Long id; @JsonInclude(Include.NON_EMPTY) @Column(name = "descricao") private String descricao; @JsonInclude(Include.NON_EMPTY) @Column(name = "telefone") private Long telefone; @JsonInclude(Include.NON_EMPTY) @Column(name = "tipo_produto") private String produto; @JsonInclude(Include.NON_EMPTY) @Column(name = "endereco") private String endereco; @Column(name = "bairro") private String bairro; public DoacaoEntity() { } public DoacaoEntity(Long id, String descricao, Long telefone, String produto, String endereco, String bairro) { super(); this.id = id; this.descricao = descricao; this.telefone = telefone; this.produto = produto; this.endereco = endereco; this.bairro = bairro; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getDescricao() { return descricao; } public void setDescricao(String descricao) { this.descricao = descricao; } public Long getTelefone() { return telefone; } public void setTelefone(Long telefone) { this.telefone = telefone; } public String getProduto() { return produto; } public void setProduto(String produto) { this.produto = produto; } public String getEndereco() { return endereco; } public void setEndereco(String endereco) { this.endereco = endereco; } public String getBairro() { return bairro; } public void setBairro(String bairro) { this.bairro = bairro; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; DoacaoEntity other = (DoacaoEntity) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } }
e7d51836f36257e9e5ff1d6bc0cb2aec3ebefaa8
963713bc820f7166fa309ed00429340d5c42c86d
/ApplyingSwagger/src/main/java/com/ojas/employee/response/EmployeeResponse.java
e1914e8c1259172fe19f9b76351197ddb61a1835
[]
no_license
suprajapalagiri/BasicSpringSecurity
2cc1b88ab6f659d2459fe2db3f12591fbfb7f4cf
1d1f189ff01fbb53d60a4f3da3feb3549592eec2
refs/heads/master
2023-02-19T14:04:57.227460
2021-01-25T11:53:07
2021-01-25T11:53:07
332,638,684
0
0
null
null
null
null
UTF-8
Java
false
false
521
java
package com.ojas.employee.response; public class EmployeeResponse { private String message; private String statusCode; private Object data; public String getMessage() { return message; } public void setMessage(String message) { this.message = message; } public String getStatusCode() { return statusCode; } public void setStatusCode(String statusCode) { this.statusCode = statusCode; } public Object getData() { return data; } public void setData(Object data) { this.data = data; } }
01d2f14e0c2d2d09a3c8ea899babd87296ff236a
f0ace57ec4c9856c637f9d552858aa5797e4e1c7
/amazon-kinesis-connector-flink/src/main/java/software/amazon/kinesis/connectors/flink/model/KinesisStreamShardState.java
ebf51f81ccbb5005a4f11d4b54acc737d370a8b1
[ "Apache-2.0" ]
permissive
elphastori/amazon-kinesis-connector-flink
0ee94998f7c378fad630170001f3063f7d5a5d40
2b473c023a68d03b32166511d155ce47c64a1f48
refs/heads/master
2023-07-05T08:18:25.824869
2021-08-11T07:43:16
2021-08-11T07:43:16
394,054,456
0
0
Apache-2.0
2021-08-08T19:35:34
2021-08-08T19:35:33
null
UTF-8
Java
false
false
3,204
java
/* * This file has been modified from the original. * * 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 software.amazon.kinesis.connectors.flink.model; import org.apache.flink.annotation.Internal; import org.apache.flink.util.Preconditions; import com.amazonaws.services.kinesis.model.Shard; /** * A wrapper class that bundles a {@link StreamShardHandle} with its last processed sequence number. */ @Internal public class KinesisStreamShardState { /** A handle object that wraps the actual {@link Shard} instance and stream name. */ private StreamShardHandle streamShardHandle; /** The checkpointed state for each Kinesis stream shard. */ private StreamShardMetadata streamShardMetadata; private SequenceNumber lastProcessedSequenceNum; public KinesisStreamShardState( StreamShardMetadata streamShardMetadata, StreamShardHandle streamShardHandle, SequenceNumber lastProcessedSequenceNum) { this.streamShardMetadata = Preconditions.checkNotNull(streamShardMetadata); this.streamShardHandle = Preconditions.checkNotNull(streamShardHandle); this.lastProcessedSequenceNum = Preconditions.checkNotNull(lastProcessedSequenceNum); } public StreamShardMetadata getStreamShardMetadata() { return this.streamShardMetadata; } public StreamShardHandle getStreamShardHandle() { return this.streamShardHandle; } public SequenceNumber getLastProcessedSequenceNum() { return this.lastProcessedSequenceNum; } public void setLastProcessedSequenceNum(SequenceNumber update) { this.lastProcessedSequenceNum = update; } @Override public String toString() { return "KinesisStreamShardState{" + "streamShardMetadata='" + streamShardMetadata.toString() + "'" + ", streamShardHandle='" + streamShardHandle.toString() + "'" + ", lastProcessedSequenceNumber='" + lastProcessedSequenceNum.toString() + "'}"; } @Override public boolean equals(Object obj) { if (!(obj instanceof KinesisStreamShardState)) { return false; } if (obj == this) { return true; } KinesisStreamShardState other = (KinesisStreamShardState) obj; return streamShardMetadata.equals(other.getStreamShardMetadata()) && streamShardHandle.equals(other.getStreamShardHandle()) && lastProcessedSequenceNum.equals(other.getLastProcessedSequenceNum()); } @Override public int hashCode() { return 37 * (streamShardMetadata.hashCode() + streamShardHandle.hashCode() + lastProcessedSequenceNum.hashCode()); } }
f96c53dd4be6bbce14727a274efcdc6c24e2c0df
487f3d445f09fecb6f57ad59a89aaefe9c9f7981
/src/main/java/com/linkcm/core/web/EasyUiDataGrid.java
9711eacea5f3777ff9b525d50357e99344efa93b
[]
no_license
Junwenli/ocms
7e0e378a00f94cf1b6058848ae6b44f3e61053a3
6204f2c86e7322c03f39d0be5512a2dc527cb35f
refs/heads/master
2020-07-01T08:12:22.405574
2016-04-17T05:57:25
2016-04-17T05:57:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
577
java
package com.linkcm.core.web; import java.util.ArrayList; import java.util.List; /** * 由于JQUERY_EASYUI需要特殊的JSON * @author antking * */ public class EasyUiDataGrid { //返回的总数量 private long total = 0; //返回的列表 private List<Object> rows = new ArrayList<Object>(); public long getTotal() { return total; } public void setTotal(long total) { this.total = total; } public List<Object> getRows() { return rows; } public void setRows(List<Object> rows) { this.rows = rows; } }
2536df87293a705e6b03de4e567cd1dc0138a03d
4a3d46067f6577fba33079f334ea9009a8b616be
/codewars/src/testTriangle/sprawdzenie.java
685b0ad70369f947777996ec002027f7105b830e
[]
no_license
RobertBurek/com.codewars
84d0061f158fb72c74fec02d39f5fbb4339e30b6
937a066c2f803ec9b01eb401a24d8744f1da4c86
refs/heads/master
2020-05-02T16:49:25.442827
2019-03-31T14:38:38
2019-03-31T14:38:38
178,079,479
0
0
null
null
null
null
UTF-8
Java
false
false
2,779
java
package testTriangle; import java.util.*; /** * Created by Robert Burek */ public class sprawdzenie { public static boolean isTriangle(int a, int b, int c) { boolean triangle = false; if ((a > 0) && (b > 0) && (c > 0)) { if (a < Integer.MAX_VALUE) if (b < Integer.MAX_VALUE) if (c < Integer.MAX_VALUE) { if (a + b > c) triangle = true; if (a + c > b) triangle = true; if (c + b > a) triangle = true; } } return triangle; } public int countSheeps(Boolean[] arrayOfSheeps) { // TODO May the force be with you int licznik = 0; boolean[] array1 = {true, true, true, false, true, true, true, true , true, false, true, false, true, false, true, true , true, true, true, true , false, false, true, true }; for (int i = 0; i < array1.length; i++) { if (array1[i]) ++licznik; if (arrayOfSheeps[i] != null) { } } return licznik; } static double suma = 1.00; public static String seriesSum(int n) { // Happy Coding ^_^ float suma = 1.00f; int j=1; if (n > 0) { for (int i = 1; i < n ; i++) { suma += 1.00f/(j+=3); } } else suma = 0.00f; return String.valueOf(suma); } public static String even_or_odd(int number) { //Place code here return (number % 2 == 0)? "Even":"Odd"; } public static String printerError(String s) { String nowy = s.replaceAll("[a-m]", ""); int ile = 0; ile= nowy.length() - ile; System.out.println(ile+ " "+ nowy); return (String) String.format(ile + "/" + s.length()); } public static int ConvertBinaryArrayToInt(List<Integer> binary) { // Your Code int wynik = 0; for (int i = 0; i< binary.size(); ++i) { wynik += Math.pow(2, (binary.size() -1 - i)) * binary.get(i); System.out.println(i +" " + (binary.size()-1-i) +" " + wynik); } return wynik; } public static void main (String[] args){ // System.out.println(ConvertBinaryArrayToInt(new ArrayList<>(Arrays.asList(0,0,0,1)))); System.out.println(ConvertBinaryArrayToInt(new ArrayList<>(Arrays.asList(1,1,1,1)))); double a= 5.567877; String s="aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbmmmmmmmmmmmmmmmmmmmxyz"; System.out.println(printerError(s)); System.out.println(seriesSum(40)); System.out.println(seriesSum(0)); } }
3eea4d97180bd785164e9aa9f3fc0b67c489eccb
81ab6fe87ab43ab2d5515bd80d8eadfdcd325527
/app/src/main/java/com/yuly/elaundry/activity/PemesananActivity.java
4d5233b2b6ed4b6c713e8ea19e42426ca5883d46
[]
no_license
yuly94/e-laundry
6f6e48284e0ad419776028fd7de56ec954b708ce
6515fba116aad4feee2dda3e4987bdad15c2bc19
refs/heads/master
2021-01-17T05:50:22.044280
2016-07-14T04:15:26
2016-07-14T04:15:26
63,258,349
0
0
null
null
null
null
UTF-8
Java
false
false
15,131
java
package com.yuly.elaundry.activity; import android.app.ProgressDialog; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.AppCompatSpinner; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.TextView; import android.widget.Toast; import com.android.volley.AuthFailureError; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.VolleyLog; import com.android.volley.toolbox.JsonArrayRequest; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import com.yuly.elaundry.R; import com.yuly.elaundry.app.AppConfig; import com.yuly.elaundry.app.AppController; import com.yuly.elaundry.helper.Config; import com.yuly.elaundry.helper.SQLiteHandler; import com.yuly.elaundry.helper.SessionManager; import com.yuly.elaundry.helper.VolleyErrorHelper; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; public class PemesananActivity extends AppCompatActivity implements AppCompatSpinner.OnItemSelectedListener{ //Declaring an Spinner private AppCompatSpinner spinnerPaket; //Declaring an Spinner private AppCompatSpinner spinnerTempat; //An ArrayList for Spinner Items private ArrayList<String> paketList; //An ArrayList for Spinner Items private ArrayList<String> tempatList; //JSON Array private JSONArray resultPaket; //JSON Array private JSONArray resultTempat; //TextViews to display details private TextView textViewHarga; private TextView textViewKeterangan; //TextViews to display details private TextView textViewTempat; private TextView textViewAlamat; private SQLiteHandler db; private SessionManager session; private ProgressDialog pDialog; private String apiKey; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pesanan); //Initializing the ArrayList paketList = new ArrayList<String>(); //Initializing the ArrayList tempatList = new ArrayList<String>(); //Initializing Spinner spinnerPaket = (AppCompatSpinner) findViewById(R.id.spinner_paket); //Initializing Spinner spinnerTempat = (AppCompatSpinner) findViewById(R.id.spinner_tempat); //Adding an Item Selected Listener to our Spinner //As we have implemented the class Spinner.OnItemSelectedListener to this class iteself we are passing this to setOnItemSelectedListener spinnerPaket.setOnItemSelectedListener(this); //Initializing TextViews textViewHarga = (TextView) findViewById(R.id.view_harga_paket); textViewKeterangan = (TextView) findViewById(R.id.view_keterangan_paket); //Initializing TextViews textViewTempat = (TextView) findViewById(R.id.view_tempat); textViewAlamat = (TextView) findViewById(R.id.view_alamat); // SqLite database handler db = new SQLiteHandler(getApplicationContext()); // session manager session = new SessionManager(getApplicationContext()); // Fetching user details from SQLite HashMap<String, String> user = db.getUserDetails(); // Get apikey from DB apiKey = user.get("api"); // Show Progress dialog pDialog = new ProgressDialog(this); pDialog.setMessage("Loading..."); pDialog.setCancelable(false); //This method will fetch the data from the URL makePaketJsonArryReq(); makeTempatJsonArryReq(); } /** * Making json array request */ private void makePaketJsonArryReq() { showProgressDialog(); JsonArrayRequest req = new JsonArrayRequest(AppConfig.URL_PAKET, new Response.Listener<JSONArray>() { @Override public void onResponse(JSONArray response) { Log.d(AppController.TAG, "on Response " + response.toString()); // msgResponse.setText(response.toString()); hideProgressDialog(); //Storing the Array of JSON String to our JSON Array resultPaket = response; //Calling method getPaketList to get the paketList from the JSON Array getPaketList(resultPaket); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { String e = VolleyErrorHelper.getMessage(error, getApplicationContext()); VolleyLog.d(AppController.TAG, "Error: " + e); hideProgressDialog(); } }) { /** * Passing some request headers * */ @Override public Map<String, String> getHeaders() throws AuthFailureError { HashMap<String, String> headers = new HashMap<String, String>(); headers.put("Content-Type", "application/json"); headers.put("Authorization", apiKey); return headers; } }; // Adding request to request queue String tag_json_arry = "jarray_req"; AppController.getInstance().addToRequestQueue(req, tag_json_arry); // Cancelling request // ApplicationController.getInstance().getRequestQueue().cancelAll(tag_json_arry); } /** * Making json array request */ private void makeTempatJsonArryReq() { showProgressDialog(); JsonArrayRequest req = new JsonArrayRequest(AppConfig.URL_TEMPAT, new Response.Listener<JSONArray>() { @Override public void onResponse(JSONArray response) { Log.d(AppController.TAG, "on Response " + response.toString()); // msgResponse.setText(response.toString()); hideProgressDialog(); //Storing the Array of JSON String to our JSON Array resultTempat = response; //Calling method getPaketList to get the paketList from the JSON Array getTempatList(resultTempat); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { String e = VolleyErrorHelper.getMessage(error, getApplicationContext()); VolleyLog.d(AppController.TAG, "Error: " + e); // hideProgressDialog(); } }) { /** * Passing some request headers * */ @Override public Map<String, String> getHeaders() throws AuthFailureError { HashMap<String, String> headers = new HashMap<String, String>(); headers.put("Content-Type", "application/json"); headers.put("Authorization", apiKey); return headers; } }; // Adding request to request queue String tag_json_arry = "jarray_req"; AppController.getInstance().addToRequestQueue(req, tag_json_arry); // Cancelling request // ApplicationController.getInstance().getRequestQueue().cancelAll(tag_json_arry); } private void getPaketList(JSONArray j){ //Traversing through all the items in the json array for(int i=0;i<j.length();i++){ try { JSONObject jObj = j.getJSONObject(i); boolean error = jObj.getBoolean("error"); if (!error) { JSONObject paket = jObj.getJSONObject("paket"); String id = paket.getString("id"); String nama = paket.getString("nama"); String harga = paket.getString("harga"); String keterangan = paket.getString("keterangan"); String status = paket.getString("status"); Log.d(AppController.TAG, "id : " + id); Log.d(AppController.TAG, "nama : " + nama); Log.d(AppController.TAG, "harga : " + harga); Log.d(AppController.TAG, "keterangan : " + keterangan); Log.d(AppController.TAG, "status : " + status); paketList.add(nama); } else { // Error occurred in registration. Get the error // message String errorMsg = jObj.getString("message"); Toast.makeText(getApplicationContext(), errorMsg, Toast.LENGTH_LONG).show(); } } catch (JSONException e) { e.printStackTrace(); } } //Setting adapter to show the items in the spinnerPaket spinnerPaket.setAdapter(new ArrayAdapter<String>(PemesananActivity.this, android.R.layout.simple_spinner_dropdown_item, paketList)); } private void getTempatList(JSONArray j){ //Traversing through all the items in the json array for(int i=0;i<j.length();i++){ try { JSONObject jObj = j.getJSONObject(i); boolean error = jObj.getBoolean("error"); if (!error) { JSONObject tempat = jObj.getJSONObject("tempat"); String id = tempat.getString("id"); String nama = tempat.getString("nama"); String alamat = tempat.getString("alamat"); String kota = tempat.getString("kota"); String provinsi = tempat.getString("provinsi"); String latitude = tempat.getString("latitude"); String longitude = tempat.getString("longitude"); String created = tempat.getString("created"); String updated = tempat.getString("updated"); Log.d(AppController.TAG, "id : " + id); Log.d(AppController.TAG, "nama : " + nama); Log.d(AppController.TAG, "alamat : " + alamat); Log.d(AppController.TAG, "kota : " + kota); Log.d(AppController.TAG, "provinsi : " + provinsi); Log.d(AppController.TAG, "latitude : " + latitude); Log.d(AppController.TAG, "longitude : " + longitude); Log.d(AppController.TAG, "creates : " + created); Log.d(AppController.TAG, "updated : " + updated); tempatList.add(nama); } else { // Error occurred in registration. Get the error // message String errorMsg = jObj.getString("message"); Toast.makeText(getApplicationContext(), errorMsg, Toast.LENGTH_LONG).show(); } } catch (JSONException e) { e.printStackTrace(); } } //Setting adapter to show the items in the spinnerPaket spinnerTempat.setAdapter(new ArrayAdapter<String>(PemesananActivity.this, android.R.layout.simple_spinner_dropdown_item, tempatList)); } //Method to get student name of a particular position private String getHarga(int position){ String packet = null; try { //Getting object of given index JSONObject json = resultPaket.getJSONObject(position); JSONObject paket = json.getJSONObject("paket"); //Fetching name from that object packet = paket.getString("harga"); } catch (JSONException e) { e.printStackTrace(); } //Returning the name return packet; } //Doing the same with this method as we did with getHarga() private String getKeterangan(int position){ String keterangan=null; try { //Getting object of given index JSONObject json = resultPaket.getJSONObject(position); JSONObject paket = json.getJSONObject("paket"); //Fetching name from that object keterangan = paket.getString("keterangan"); } catch (JSONException e) { e.printStackTrace(); } return keterangan; } //Method to get student name of a particular position private String getTempat(int position){ String tempat = null; try { //Getting object of given index JSONObject json = resultTempat.getJSONObject(position); JSONObject place = json.getJSONObject("tempat"); //Fetching name from that object tempat = place.getString("nama"); } catch (JSONException e) { e.printStackTrace(); } //Returning the name return tempat; } //Doing the same with this method as we did with getHarga() private String getAlamat(int position){ String alamat=null; try { //Getting object of given index JSONObject json = resultTempat.getJSONObject(position); JSONObject place = json.getJSONObject("tempat"); //Fetching name from that object alamat = place.getString("alamat"); } catch (JSONException e) { e.printStackTrace(); } return alamat; } private void showProgressDialog() { if (!pDialog.isShowing()) pDialog.show(); } private void hideProgressDialog() { if (pDialog.isShowing()) pDialog.hide(); } //this method will execute when we pic an item from the spinnerPaket @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { //Setting the values to textviews for a selected item textViewHarga.setText(getHarga(position)); textViewKeterangan.setText(getKeterangan(position)); textViewTempat.setText(getTempat(position)); textViewAlamat.setText(getAlamat(position)); } //When no item is selected this method would execute @Override public void onNothingSelected(AdapterView<?> parent) { textViewHarga.setText(""); textViewKeterangan.setText(""); textViewTempat.setText(""); textViewAlamat.setText(""); } }
a68e0b1a5a51377fd5fbf3a6579c7215bc0c48e7
87561dd267d8598acb1c41aca2864ca72728b918
/src/com/example/project/ViewDonors.java
e22edc3a7b0bb5ee88dd9517c336dffe871e5e11
[]
no_license
tejamukka/BloodBank
b3fb81962edc588d5418745aa21fb62dc5914600
f5bcd5e3083786ca7e4fdd3ff938053e6517a836
refs/heads/master
2021-01-21T08:40:34.316293
2015-03-11T01:17:11
2015-03-11T01:17:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
492
java
package com.example.project; import android.os.Bundle; import com.example.project.fragments.ViewDonorsFragment; public class ViewDonors extends BaseActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view_donors); intializeNavigationDrwaer(savedInstanceState); getFragmentManager().beginTransaction().add(R.id.fragment, new ViewDonorsFragment()).commit(); } }
689794a3d68a7d6135468dcc9d9ac3b164d70c76
c698736c8118ecd6312af543bacb03e479ba99cc
/MGM/src/main/java/com/gam/mgm/service/IPointService.java
fdb948be816e5c23e9f69f6891fcf1f5427d464b
[]
no_license
seocong/MGM
5d0468f9142519e9ed79a9a8f11d4ce16acf15f5
053f7a84fd32971f42cdba39089dffdcabe45414
refs/heads/master
2022-12-21T01:58:41.933048
2020-02-21T08:03:38
2020-02-21T08:03:38
195,942,892
0
0
null
2022-12-16T10:37:01
2019-07-09T06:04:48
JavaScript
UTF-8
Java
false
false
334
java
package com.gam.mgm.service; import java.util.List; import java.util.Map; import com.gam.mgm.dto.PointDto; public interface IPointService { public boolean insertPoint(PointDto pointDto); public List<PointDto> selectPoint(Map<String,Object> map); public int pointCount(String id); public int addPoint(String id); }
[ "congman@DESKTOP-1I58NRL" ]
congman@DESKTOP-1I58NRL
da4e98cadce7a906ff8250f8f5f4bca0ab20e449
4e782f734c948472f99514cd1b82cb5606b98eea
/src/main/java/by/ermakovich/contacts/ContactsApplication.java
5e624e35adb20a150ae35cf6c1b2dc8e1f7347c9
[]
no_license
XokisX/JAVA_contacts
8676fbec5e5e582f8828129eac230b4640ee1cbc
0b30bdba2c78b2cb1f6b5a90cee4eb8700312967
refs/heads/main
2023-01-21T08:07:55.327104
2020-12-06T15:38:38
2020-12-06T15:38:38
302,128,134
0
0
null
null
null
null
UTF-8
Java
false
false
332
java
package by.ermakovich.contacts; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ContactsApplication { public static void main(String[] args) { SpringApplication.run(ContactsApplication.class, args); } }
e97f4b9c6c4c9d0d424fdc0b5b596e2cb9d12a61
da4079bd3ebdbc1764bbf5bcbe1f80b34aaad344
/xinbee-ams-webapp/src/main/java/cn/bgsys/webapp/context/CrossDomainFilter.java
3337e0fbaead74f3113585aa53ae9547aef017a3
[]
no_license
lwpk110/ams
5760da104f8a46f9c5ea268caeb197cffc8326ea
252685596ede98d09cedf1bc991d9e13a52598ba
refs/heads/master
2021-01-20T10:24:21.951506
2019-04-08T03:01:04
2019-04-08T03:01:04
90,352,529
0
0
null
null
null
null
UTF-8
Java
false
false
3,600
java
package cn.bgsys.webapp.context; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.base.Splitter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; import javax.servlet.*; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; /** * Created by jeashi on 2016/10/25. */ @WebFilter(filterName = "crossDomainFilter", urlPatterns = "/**") public class CrossDomainFilter implements Filter { private final Logger logger = LoggerFactory.getLogger(this.getClass()); private List<String> crossDomainPatterns; private final String initcrossDomainParameter = "/benchmarks/edit,/tasks,/channel/edit"; @Autowired private Environment env; @Override public void destroy() { } @Override public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { writeLogInfo(request, response); long startTime = System.currentTimeMillis(); request.setAttribute("startTime", startTime); String url = ((HttpServletRequest) request).getRequestURI(); if (this.matchCrossDomainPatterns(request.getServletContext().getContextPath(), url)) { logger.info("添加允许跨域!!!"); ((HttpServletResponse) response).setHeader("Access-Control-Allow-Origin", "*"); ((HttpServletResponse) response).setHeader("Access-Control-Allow-Methods", "POST"); ((HttpServletResponse) response).setHeader("Access-Control-Max-Age", "1000"); chain.doFilter(request, response); } else { chain.doFilter(request, response); } } @Override public void init(FilterConfig arg0) throws ServletException { this.crossDomainPatterns = Splitter.on(',').trimResults().omitEmptyStrings().splitToList(initcrossDomainParameter); } /** * @param contextpath * @param url * @return */ public boolean matchCrossDomainPatterns(String contextpath, String url) { boolean isExist = false; // if (this.crossDomainPatterns != null) { // for (String prefix : this.crossDomainPatterns) { // if (url.startsWith(contextpath + prefix)) { // logger.info(url + "通过"); // isExist = false; // break; // } // } // } return isExist; } private void writeLogInfo(ServletRequest request, ServletResponse response) { HttpServletRequest httpServletRequest = (HttpServletRequest) request; String requestUrl = httpServletRequest.getRequestURI(); String callMethod = httpServletRequest.getParameter("callMethod"); String callVersion = httpServletRequest.getParameter("callVersion"); String ip = ""; String hardwareCode = httpServletRequest.getParameter("hardwareCode"); String param = ""; try { // ip = NetUtils.getIpAddr(httpServletRequest); param = new ObjectMapper().writeValueAsString(httpServletRequest.getParameterMap()); } catch (Exception e) { e.printStackTrace(); } logger.info(">>>>>>>{}, callMethod: {}, callVersion: {}, ip: {}, hardwareCode: {} \n param: {}", requestUrl, callMethod, callVersion, ip, hardwareCode, param); } }
a6e5c312cbc2a88b9a02bac227b25765624606cb
02a2edfb27f9cc1b5c70c76648868815fb2897b4
/src/test/java/ru/ifmo/collections/LruCacheTest.java
9392cdd9f9c4f825692ae3e9e7323a3011a7e7be
[]
no_license
itmo-java-basics-2020/task-7-collections-framework-Kryukov-And
14a3a47846aed7a8773f2d085f4287bf8619b3a4
e81e12d4d2ffadff394f099f4d0475f20dd2b5d3
refs/heads/master
2022-12-27T01:49:58.872196
2020-05-17T17:49:37
2020-05-17T17:49:37
264,724,215
0
1
null
2020-10-13T22:03:52
2020-05-17T17:49:36
Java
UTF-8
Java
false
false
1,094
java
package ru.ifmo.collections; import org.junit.Test; import java.lang.reflect.Modifier; import java.util.Arrays; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.CoreMatchers.nullValue; import static org.hamcrest.MatcherAssert.assertThat; public class LruCacheTest { @Test public void testLruCache() { LruCache<Integer, Integer> cache = new LruCache<>(2); cache.put(1, 1); assertThat(cache.elements(), is(1)); cache.put(2, 2); assertThat(cache.get(1), is(1)); assertThat(cache.elements(), is(2)); cache.put(3, 3); assertThat(cache.elements(), is(2)); assertThat(cache.get(2), is(nullValue())); cache.put(4, 4); assertThat(cache.elements(), is(2)); assertThat(cache.get(1), is(nullValue())); assertThat(cache.get(3), is(3)); assertThat(cache.get(4), is(4)); assertThat(Arrays.stream(cache.getClass().getDeclaredMethods()) .filter(method -> Modifier.isPublic(method.getModifiers())) .count(), is(3L)); } }
0190d0acfdc338b366c448bf1ae2fbea07a46a8c
2b67727026b615f855775ae8e83e1c40fc424c61
/src/main/java/cn/com/yijuan/utility/DateTimeUtil.java
0bccaed0b1f13524e5c5d8ec41c6e1ff7ada0c44
[]
no_license
cheneylz/JAVA-Online-ExamSystem
a001c4d9310b03acc5c85909cc4a491e29fcf6a2
97109ee4b9fd074e914a3f1fdecdc40e88e8b35f
refs/heads/main
2023-03-11T01:56:35.311846
2021-03-03T15:37:49
2021-03-03T15:37:49
315,168,237
1
0
null
null
null
null
UTF-8
Java
false
false
3,441
java
package cn.com.yijuan.utility; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.Duration; import java.util.*; /** * @author CheneyL * 时间日期工具 */ public class DateTimeUtil { private static final Logger logger = LoggerFactory.getLogger(DateTimeUtil.class); public static final String STANDER_FORMAT = "yyyy-MM-dd HH:mm:ss"; public static final String STANDER_SHORT_FORMAT = "yyyy-MM-dd"; public static Date addDuration(Date date, Duration duration) { Calendar ca = Calendar.getInstance(); ca.setTime(date); ca.add(Calendar.SECOND, (int) duration.getSeconds()); return ca.getTime(); } public static String dateFormat(Date date) { if (null == date) { return ""; } DateFormat dateFormat = new SimpleDateFormat(STANDER_FORMAT); return dateFormat.format(date); } public static String dateShortFormat(Date date) { if (null == date) { return ""; } DateFormat dateFormat = new SimpleDateFormat(STANDER_SHORT_FORMAT); return dateFormat.format(date); } public static Date parse(String dateStr, String format) { try { return new SimpleDateFormat(format).parse(dateStr); } catch (ParseException e) { logger.error(e.getMessage(), e); } return null; } public static Date getMonthStartDay() { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 00:00:00"); Calendar cale = Calendar.getInstance(); cale.add(Calendar.MONTH, 0); cale.set(Calendar.DAY_OF_MONTH, 1); String dateStr = formatter.format(cale.getTime()); return parse(dateStr, "yyyy-MM-dd HH:mm:ss"); } public static Date getMonthEndDay() { SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd 23:59:59"); Calendar cale = Calendar.getInstance(); cale.add(Calendar.MONTH, 1); cale.set(Calendar.DAY_OF_MONTH, 0); String dateStr = formatter.format(cale.getTime()); return parse(dateStr, STANDER_FORMAT); } public static List<String> MothStartToNowFormat() { Date startTime = getMonthStartDay(); Calendar nowCalendar = Calendar.getInstance(); nowCalendar.setTime(new Date()); int mothDayCount = nowCalendar.get(Calendar.DAY_OF_MONTH); List<String> mothDays = new ArrayList<>(mothDayCount); Calendar startCalendar = new GregorianCalendar(); startCalendar.setTime(startTime); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); mothDays.add(formatter.format(startTime)); for (int i = 0; i < mothDayCount - 1; i++) { startCalendar.add(Calendar.DATE, 1); Date end_date = startCalendar.getTime(); mothDays.add(formatter.format(end_date)); } return mothDays; } public static List<String> MothDay() { Calendar endCalendar = Calendar.getInstance(); endCalendar.setTime(getMonthEndDay()); int endMothDay = endCalendar.get(Calendar.DAY_OF_MONTH); List<String> list = new ArrayList<>(endMothDay); for (int i = 1; i <= endMothDay; i++) { list.add(String.valueOf(i)); } return list; } }
2220c3144e6be137a8c3af9deb88cd7b9f8d8a5f
9f29eafc337cda93d7c8845c75a46b3dadc70d65
/SemiProject_3Team/SemiProject_3Team/src/com/poosil/util/paging.java
14937e86dcedc4ba9a28f70502c4c69c1f40ae71
[]
no_license
Journey-han/semiProject_3Team
a04f7e5cb431ba646e8a3ee0376bf9397857293b
444f1bdbf18aa8ce71565bb04676c377dca90764
refs/heads/main
2023-04-03T23:12:41.250958
2021-04-13T15:27:36
2021-04-13T15:27:36
null
0
0
null
null
null
null
UHC
Java
false
false
3,130
java
package com.poosil.util; public class paging { private int pageSize; private int firstPageNo; private int prevPageNo; private int startPageNo; private int pageNo; private int endPageNo; private int nextPageNo; private int finalPageNo; private int totalCount; public int getPageSize() { return pageSize; } public void setPageSize(int pageSize) { this.pageSize = pageSize; } public int getFirstPageNo() { return firstPageNo; } public void setFirstPageNo(int firstPageNo) { this.firstPageNo = firstPageNo; } public int getPrevPageNo() { return prevPageNo; } public void setPrevPageNo(int prevPageNo) { this.prevPageNo = prevPageNo; } public int getStartPageNo() { return startPageNo; } public void setStartPageNo(int startPageNo) { this.startPageNo = startPageNo; } public int getPageNo() { return pageNo; } public void setPageNo(int pageNo) { this.pageNo = pageNo; } public int getEndPageNo() { return endPageNo; } public void setEndPageNo(int endPageNo) { this.endPageNo = endPageNo; } public int getNextPageNo() { return nextPageNo; } public void setNextPageNo(int nextPageNo) { this.nextPageNo = nextPageNo; } public int getFinalPageNo() { return finalPageNo; } public void setFinalPageNo(int finalPageNo) { this.finalPageNo = finalPageNo; } public int getTotalCount() { return totalCount; } public void setTotalCount(int totalCount) { this.totalCount = totalCount; } public void makePaging() { if (this.totalCount == 0) // 게시글 전체 수가 없는 경우 return; if (this.pageNo == 0) // 기본 값 설정 this.setPageNo(1); if (this.pageSize == 0) // 기본 값 설정 this.setPageSize(10); // 마지막 페이지 int finalPage = (totalCount + (pageSize - 1)) / pageSize; if(this.pageNo > finalPage) this.setPageNo(finalPage); // 기본 값 설정 if (this.pageNo < 0 || this.pageNo > finalPage) this.pageNo = 1; // 현재 페이지 유효성 체크 //boolean isNowFirst = currentPageNo == 1 ? true : false; // 시작 페이지 (전체) //boolean isNowFinal = currentPageNo == finalPage ? true : false; int startPage = ((pageNo - 1) / 10) * 10 + 1; // 시작 페이지 (페이징 네비 기준) int endPage = startPage + 10 - 1; // 끝 페이지 (페이징 네비 기준) if (endPage > finalPage) { endPage = finalPage; } this.setFirstPageNo(1); // 첫번째 페이지 번호 // if (isNowFirst) // setPrevPageNo(1); // 이전 페이지 번호 // else // 이전 페이지 번호 // setPrevPageNo(((currentPageNo - 1) < 1 ? 1 : (currentPageNo - 1))); // this.setPrevPageNo(pageNo == 1 ? 1 : (pageNo - 1) < 1 ? 1 : (pageNo - 1) ); this.setStartPageNo(startPage); // 시작 페이지 (페이징 네비 기준) this.setEndPageNo(endPage); // 끝 페이지 (페이징 네비 기준) this.setNextPageNo(pageNo == finalPage ? finalPage : (pageNo + 1) > finalPage ? finalPage : (pageNo + 1)); this.setFinalPageNo(finalPage); // 마지막 페이지 번호 } }
b4f1d40b0e62515e8be0eb4b1274664bbf6b5518
102ee86a8e027b7cb68edd60f0f0774d412df87e
/app/src/main/java/com/example/android191026/MainActivity.java
a4f4ba9c9209dad168f2f0fe578eae6d3bd1e213
[]
no_license
MrZ2019/android1-191026
2664889218525582c2d0730ce59f47f36a1080e5
762d6ab535c931dea1631f57104cf2540def6acd
refs/heads/master
2020-08-28T07:25:17.872622
2019-10-26T01:40:22
2019-10-26T01:40:22
217,636,262
0
0
null
null
null
null
UTF-8
Java
false
false
338
java
package com.example.android191026; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
c8f1e32c515ebd842f7587a16a84737be405e0ec
58d9c0879864640c056570819bd4ba154e26d315
/AntiTower/src/main/java/me/opatut/bukkit/AntiTower/MainBlockListener.java
130ff0328d88f3d803b19956d9637f934e71dad4
[]
no_license
opatut/BukkitPlugins
1064fa28af2deca451b125252a3fd573fb421563
062428fbe39e03f7c7b138574be255087c008cc7
refs/heads/master
2016-09-03T02:57:40.820476
2011-04-06T18:58:06
2011-04-06T18:58:06
1,568,463
0
0
null
null
null
null
UTF-8
Java
false
false
402
java
package me.opatut.bukkit.AntiTower; import org.bukkit.event.block.BlockListener; import org.bukkit.event.block.BlockPlaceEvent; public class MainBlockListener extends BlockListener { public MainBlockListener(AntiTower plugin) { mPlugin = plugin; } public void onBlockPlace(BlockPlaceEvent event) { mPlugin.CheckForTower(event.getBlockPlaced(), event.getPlayer()); } AntiTower mPlugin; }
73621f1532c41c75b778e28ac0b7112ecc9d824b
d3ee1b4f128abfc663ec05a7555d4c0265433b6f
/app/src/main/java/tortel/fr/mypokedex/bean/PokemonTypesEnum.java
a773abbc68ea2eea231cfb49fd8de00ddbd4ba8c
[]
no_license
PaulTORTEL/My-Pokedex
b9a83dfdc2bd77600de8d0169ead3edebd5b2008
aad60c604b98b910196cafe01645a47fefbcb117
refs/heads/master
2020-04-21T10:46:54.045626
2019-02-07T00:19:05
2019-02-07T00:19:05
169,496,695
0
0
null
null
null
null
UTF-8
Java
false
false
293
java
package tortel.fr.mypokedex.bean; public enum PokemonTypesEnum { NORMAL, GRASS, FIRE, WATER, ELECTRIC, ICE, FIGHTING, POISON, GROUND, FLYING, PSYCHIC, BUG, ROCK, GHOST, DARK, DRAGON, STEEL, FAIRY }
1803f1c1410d9ed9b0cd2272e730366617675583
6ffd590dbf461bd5bc68c75ed8357c3bc85a2bea
/dl4j-eclipse/src/deeplearning4j_ui_parent/deeplearning4j_ui_model/src/main/java/org/deeplearning4j/ui/flow/data/FlowStaticPersistable.java
c95e25538703940cc53fd0a87b3e2cd6aa90b4a1
[]
no_license
nagyistge/dl4j_for_eclipse
e017fcfd545c879e18f91d36c15d46872fba390f
8fb1a2d813dd064d7b46e24e8b696c364d84c6b6
refs/heads/master
2021-06-14T16:11:23.572374
2017-02-13T07:15:41
2017-02-13T07:15:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,067
java
package deeplearning4j_ui_parent.deeplearning4j_ui_model.src.main.java.org.deeplearning4j.ui.flow.data; //package org.deeplearning4j.ui.flow.data; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.OutputStream; import java.nio.ByteBuffer; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.apache.commons.compress.utils.IOUtils; //import org.deeplearning4j.api.storage.Persistable; //import org.deeplearning4j.ui.flow.beans.ModelInfo; import deeplearning4j_core.src.main.java.org.deeplearning4j.api.storage.Persistable; import deeplearning4j_ui_parent.deeplearning4j_ui_model.src.main.java.org.deeplearning4j.ui.flow.beans.ModelInfo; /** * Created by Alex on 25/10/2016. */ @AllArgsConstructor @NoArgsConstructor @Data public class FlowStaticPersistable implements Persistable { private String sessionID; private String workerID; private long timestamp; private ModelInfo modelInfo; @Override public String getSessionID() { return sessionID; } @Override public String getTypeID() { return FlowUpdatePersistable.TYPE_ID; } @Override public String getWorkerID() { return workerID; } @Override public long getTimeStamp() { return timestamp; } @Override public int encodingLengthBytes() { return 0; } @Override public byte[] encode() { //Not the most efficient: but it's easy to implement... ByteArrayOutputStream baos = new ByteArrayOutputStream(); try(ObjectOutputStream oos = new ObjectOutputStream(baos)){ oos.writeObject(this); } catch (IOException e){ throw new RuntimeException(e); //Shouldn't normally happen } return baos.toByteArray(); } @Override public void encode(ByteBuffer buffer) { buffer.put(encode()); } @Override public void encode(OutputStream outputStream) throws IOException { outputStream.write(encode()); } @Override public void decode(byte[] decode) { try(ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(decode))){ FlowStaticPersistable p = (FlowStaticPersistable)ois.readObject(); this.sessionID = p.sessionID; this.workerID = p.workerID; this.timestamp = p.getTimeStamp(); this.modelInfo = p.modelInfo; }catch (IOException | ClassNotFoundException e){ throw new RuntimeException(e); //Shouldn't normally happen } } @Override public void decode(ByteBuffer buffer) { byte[] arr = new byte[buffer.remaining()]; buffer.get(arr); decode(arr); } @Override public void decode(InputStream inputStream) throws IOException { byte[] b = IOUtils.toByteArray(inputStream); decode(b); } }
5d30ab4ab85151a0ba517e4aa3c68bf539de9d11
aa1223173346ee6c1984441b58c1b74291208fc0
/JavaEx/src/chap11/pro/ex07/FindAndReplaceEx.java
c402f1cf23039e37645b70059726f6c375e197bf
[]
no_license
SmileJM/ThisIsJava
b481628dd46c57ad54a6c245d32fd20f5a19da17
37fee7570f6bc4962fe011999435eaa5883ce167
refs/heads/master
2021-04-06T02:14:24.332503
2018-04-20T09:23:38
2018-04-20T09:23:38
124,860,130
0
0
null
null
null
null
UHC
Java
false
false
498
java
package chap11.pro.ex07; public class FindAndReplaceEx { public static void main(String[] args) { String str = "모든 프로그램은 자바 언어로 개발될 수 있다."; int index = str.indexOf("자바"); if(index == -1) { System.out.println("자바 문자열이 포함되어 있지 않습니다."); } else { System.out.println("자바 문자열이 포함되어 있습니다."); str = str.replace("자바", "Java"); System.out.println("-> " + str); } } }
9c1485353f33d2f5d1f6a709605fb0bbae1fb004
b61a4ad2be6f711073472b7a3b2db94a301855e6
/src/main/java/com/soft1851/music/admin/util/JwtTokenUtil.java
3578679866991339e5f208910222b888bfd52370
[]
no_license
dyf-yifan/cloud-music-admin
5df42356a175d3886bdc5494efbf84a680b0ee38
0517ccd8b7f9aee74667f9eb7a4c836df029213c
refs/heads/master
2022-04-25T20:13:19.998014
2020-04-27T07:45:28
2020-04-27T07:45:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,204
java
package com.soft1851.music.admin.util; import com.alibaba.fastjson.JSONObject; import com.auth0.jwt.JWT; import com.auth0.jwt.JWTVerifier; import com.auth0.jwt.algorithms.Algorithm; import com.auth0.jwt.interfaces.DecodedJWT; import com.soft1851.music.admin.domain.entity.SysRole; import lombok.extern.slf4j.Slf4j; import java.io.UnsupportedEncodingException; import java.util.ArrayList; import java.util.Date; import java.util.List; /** * @ClassName JwtTokenUtil * @Description JWT加密解密工具类 * @Author mq_xu * @Date 2020/4/15 * @Version 1.0 */ @Slf4j public class JwtTokenUtil { /** * 加密 * * @param adminId * @param roles * @param expiresAt * @return String */ public static String getToken(final String adminId, final String roles, final String secrect, Date expiresAt) { String token = null; try { token = JWT.create() .withIssuer("auth0") .withClaim("adminId", adminId) .withClaim("roles", roles) .withExpiresAt(expiresAt) // 使用了HMAC256加密算法, secrect是用来加密数字签名的密钥 .sign(Algorithm.HMAC256(secrect)); } catch (UnsupportedEncodingException e) { log.error("不支持的编码格式"); } return token; } /** * 解密 * * @param token * @param secrect * @return DecodedJWT */ public static DecodedJWT deToken(final String token, final String secrect) { DecodedJWT jwt; JWTVerifier verifier = null; try { verifier = JWT.require(Algorithm.HMAC256(secrect)) .withIssuer("auth0") .build(); } catch (UnsupportedEncodingException e) { log.error("不支持的编码格式"); } assert verifier != null; jwt = verifier.verify(token); return jwt; } /** * 获取adminId * * @param token * @param secrect * @return String */ public static String getAdminId(final String token, final String secrect) { return deToken(token, secrect).getClaim("adminId").asString(); } /** * 获取roles * * @param token * @param secrect * @return String */ public static String getRoles(final String token, final String secrect) { return deToken(token, secrect).getClaim("roles").asString(); } /** * 验证是否过期 * * @param token * @return boolean */ public static boolean isExpiration(String token,final String secrect) { return deToken(token,secrect).getExpiresAt().before(new Date()); } public static void main(String[] args) { // String token = getToken("2000100193", "admin", new Date(System.currentTimeMillis() + 10L * 1000L)); // System.out.println(token); // while (true) { // boolean flag = isExpiration(token); // System.out.println(flag); // if (flag) { // System.out.println("token已失效"); // break; // } // try { // Thread.sleep(1000); // } catch (InterruptedException e) { // e.printStackTrace(); // } // } SysRole role1 = SysRole.builder().roleId(1).roleName("admin").description("管理员").build(); SysRole role2 = SysRole.builder().roleId(2).roleName("editor").description("小编").build(); List<SysRole> roles = new ArrayList<>(); roles.add(role1); roles.add(role2); String token = JwtTokenUtil.getToken("123456", JSONObject.toJSONString(roles), "mySecrect", new Date(System.currentTimeMillis() + 60L * 1000L)); System.out.println("JWT加密结果:"); System.out.println(token); System.out.println("******解密*********"); System.out.println("adminId—————————" + JwtTokenUtil.getAdminId(token,"mySecrect")); System.out.println("roles—————————" + JwtTokenUtil.getRoles(token,"mySecrect")); } }
8c0b37d5a876e040e654f86caf4efb6e63eaaea2
4da9097315831c8639a8491e881ec97fdf74c603
/src/StockIT-v2-release_source_from_JADX/sources/com/google/android/exoplayer2/p013ui/PlayerControlView.java
e5502dfdd1598c963e1756fc0cb7aa469e23165a
[ "Apache-2.0" ]
permissive
atul-vyshnav/2021_IBM_Code_Challenge_StockIT
5c3c11af285cf6f032b7c207e457f4c9a5b0c7e1
25c26a4cc59a3f3e575f617b59acc202ee6ee48a
refs/heads/main
2023-08-11T06:17:05.659651
2021-10-01T08:48:06
2021-10-01T08:48:06
410,595,708
1
1
null
null
null
null
UTF-8
Java
false
false
41,030
java
package com.google.android.exoplayer2.p013ui; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; import android.os.Looper; import android.os.SystemClock; import android.util.AttributeSet; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; import com.google.android.exoplayer2.C1379C; import com.google.android.exoplayer2.ControlDispatcher; import com.google.android.exoplayer2.DefaultControlDispatcher; import com.google.android.exoplayer2.ExoPlaybackException; import com.google.android.exoplayer2.ExoPlayerLibraryInfo; import com.google.android.exoplayer2.PlaybackParameters; import com.google.android.exoplayer2.PlaybackPreparer; import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.Timeline; import com.google.android.exoplayer2.p013ui.TimeBar; import com.google.android.exoplayer2.source.TrackGroupArray; import com.google.android.exoplayer2.trackselection.TrackSelectionArray; import com.google.android.exoplayer2.util.Assertions; import com.google.android.exoplayer2.util.RepeatModeUtil; import com.google.android.exoplayer2.util.Util; import java.util.Arrays; import java.util.Formatter; import java.util.Locale; /* renamed from: com.google.android.exoplayer2.ui.PlayerControlView */ public class PlayerControlView extends FrameLayout { public static final int DEFAULT_FAST_FORWARD_MS = 15000; public static final int DEFAULT_REPEAT_TOGGLE_MODES = 0; public static final int DEFAULT_REWIND_MS = 5000; public static final int DEFAULT_SHOW_TIMEOUT_MS = 5000; private static final long MAX_POSITION_FOR_SEEK_TO_PREVIOUS = 3000; public static final int MAX_WINDOWS_FOR_MULTI_WINDOW_TIME_BAR = 100; private long[] adGroupTimesMs; private final ComponentListener componentListener; /* access modifiers changed from: private */ public ControlDispatcher controlDispatcher; private final TextView durationView; private long[] extraAdGroupTimesMs; private boolean[] extraPlayedAdGroups; /* access modifiers changed from: private */ public final View fastForwardButton; private int fastForwardMs; /* access modifiers changed from: private */ public final StringBuilder formatBuilder; /* access modifiers changed from: private */ public final Formatter formatter; private final Runnable hideAction; private long hideAtMs; private boolean isAttachedToWindow; private boolean multiWindowTimeBar; /* access modifiers changed from: private */ public final View nextButton; /* access modifiers changed from: private */ public final View pauseButton; private final Timeline.Period period; /* access modifiers changed from: private */ public final View playButton; /* access modifiers changed from: private */ public PlaybackPreparer playbackPreparer; private boolean[] playedAdGroups; /* access modifiers changed from: private */ public Player player; /* access modifiers changed from: private */ public final TextView positionView; /* access modifiers changed from: private */ public final View previousButton; private final String repeatAllButtonContentDescription; private final Drawable repeatAllButtonDrawable; private final String repeatOffButtonContentDescription; private final Drawable repeatOffButtonDrawable; private final String repeatOneButtonContentDescription; private final Drawable repeatOneButtonDrawable; /* access modifiers changed from: private */ public final ImageView repeatToggleButton; /* access modifiers changed from: private */ public int repeatToggleModes; /* access modifiers changed from: private */ public final View rewindButton; private int rewindMs; /* access modifiers changed from: private */ public boolean scrubbing; private boolean showMultiWindowTimeBar; private boolean showShuffleButton; private int showTimeoutMs; /* access modifiers changed from: private */ public final View shuffleButton; private final TimeBar timeBar; private final Runnable updateProgressAction; private VisibilityListener visibilityListener; private final Timeline.Window window; /* renamed from: com.google.android.exoplayer2.ui.PlayerControlView$VisibilityListener */ public interface VisibilityListener { void onVisibilityChange(int i); } private static boolean isHandledMediaKey(int i) { return i == 90 || i == 89 || i == 85 || i == 126 || i == 127 || i == 87 || i == 88; } static { ExoPlayerLibraryInfo.registerModule("goog.exo.ui"); } public PlayerControlView(Context context) { this(context, (AttributeSet) null); } public PlayerControlView(Context context, AttributeSet attributeSet) { this(context, attributeSet, 0); } public PlayerControlView(Context context, AttributeSet attributeSet, int i) { this(context, attributeSet, i, attributeSet); } public PlayerControlView(Context context, AttributeSet attributeSet, int i, AttributeSet attributeSet2) { super(context, attributeSet, i); int i2 = C1490R.layout.exo_player_control_view; this.rewindMs = 5000; this.fastForwardMs = 15000; this.showTimeoutMs = 5000; this.repeatToggleModes = 0; this.hideAtMs = C1379C.TIME_UNSET; this.showShuffleButton = false; if (attributeSet2 != null) { TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet2, C1490R.styleable.PlayerControlView, 0, 0); try { this.rewindMs = obtainStyledAttributes.getInt(C1490R.styleable.PlayerControlView_rewind_increment, this.rewindMs); this.fastForwardMs = obtainStyledAttributes.getInt(C1490R.styleable.PlayerControlView_fastforward_increment, this.fastForwardMs); this.showTimeoutMs = obtainStyledAttributes.getInt(C1490R.styleable.PlayerControlView_show_timeout, this.showTimeoutMs); i2 = obtainStyledAttributes.getResourceId(C1490R.styleable.PlayerControlView_controller_layout_id, i2); this.repeatToggleModes = getRepeatToggleModes(obtainStyledAttributes, this.repeatToggleModes); this.showShuffleButton = obtainStyledAttributes.getBoolean(C1490R.styleable.PlayerControlView_show_shuffle_button, this.showShuffleButton); } finally { obtainStyledAttributes.recycle(); } } this.period = new Timeline.Period(); this.window = new Timeline.Window(); this.formatBuilder = new StringBuilder(); this.formatter = new Formatter(this.formatBuilder, Locale.getDefault()); this.adGroupTimesMs = new long[0]; this.playedAdGroups = new boolean[0]; this.extraAdGroupTimesMs = new long[0]; this.extraPlayedAdGroups = new boolean[0]; this.componentListener = new ComponentListener(); this.controlDispatcher = new DefaultControlDispatcher(); this.updateProgressAction = new Runnable() { public final void run() { PlayerControlView.this.updateProgress(); } }; this.hideAction = new Runnable() { public final void run() { PlayerControlView.this.hide(); } }; LayoutInflater.from(context).inflate(i2, this); setDescendantFocusability(262144); this.durationView = (TextView) findViewById(C1490R.C1493id.exo_duration); this.positionView = (TextView) findViewById(C1490R.C1493id.exo_position); TimeBar timeBar2 = (TimeBar) findViewById(C1490R.C1493id.exo_progress); this.timeBar = timeBar2; if (timeBar2 != null) { timeBar2.addListener(this.componentListener); } View findViewById = findViewById(C1490R.C1493id.exo_play); this.playButton = findViewById; if (findViewById != null) { findViewById.setOnClickListener(this.componentListener); } View findViewById2 = findViewById(C1490R.C1493id.exo_pause); this.pauseButton = findViewById2; if (findViewById2 != null) { findViewById2.setOnClickListener(this.componentListener); } View findViewById3 = findViewById(C1490R.C1493id.exo_prev); this.previousButton = findViewById3; if (findViewById3 != null) { findViewById3.setOnClickListener(this.componentListener); } View findViewById4 = findViewById(C1490R.C1493id.exo_next); this.nextButton = findViewById4; if (findViewById4 != null) { findViewById4.setOnClickListener(this.componentListener); } View findViewById5 = findViewById(C1490R.C1493id.exo_rew); this.rewindButton = findViewById5; if (findViewById5 != null) { findViewById5.setOnClickListener(this.componentListener); } View findViewById6 = findViewById(C1490R.C1493id.exo_ffwd); this.fastForwardButton = findViewById6; if (findViewById6 != null) { findViewById6.setOnClickListener(this.componentListener); } ImageView imageView = (ImageView) findViewById(C1490R.C1493id.exo_repeat_toggle); this.repeatToggleButton = imageView; if (imageView != null) { imageView.setOnClickListener(this.componentListener); } View findViewById7 = findViewById(C1490R.C1493id.exo_shuffle); this.shuffleButton = findViewById7; if (findViewById7 != null) { findViewById7.setOnClickListener(this.componentListener); } Resources resources = context.getResources(); this.repeatOffButtonDrawable = resources.getDrawable(C1490R.C1492drawable.exo_controls_repeat_off); this.repeatOneButtonDrawable = resources.getDrawable(C1490R.C1492drawable.exo_controls_repeat_one); this.repeatAllButtonDrawable = resources.getDrawable(C1490R.C1492drawable.exo_controls_repeat_all); this.repeatOffButtonContentDescription = resources.getString(C1490R.string.exo_controls_repeat_off_description); this.repeatOneButtonContentDescription = resources.getString(C1490R.string.exo_controls_repeat_one_description); this.repeatAllButtonContentDescription = resources.getString(C1490R.string.exo_controls_repeat_all_description); } private static int getRepeatToggleModes(TypedArray typedArray, int i) { return typedArray.getInt(C1490R.styleable.PlayerControlView_repeat_toggle_modes, i); } public Player getPlayer() { return this.player; } public void setPlayer(Player player2) { boolean z = true; Assertions.checkState(Looper.myLooper() == Looper.getMainLooper()); if (!(player2 == null || player2.getApplicationLooper() == Looper.getMainLooper())) { z = false; } Assertions.checkArgument(z); Player player3 = this.player; if (player3 != player2) { if (player3 != null) { player3.removeListener(this.componentListener); } this.player = player2; if (player2 != null) { player2.addListener(this.componentListener); } updateAll(); } } public void setShowMultiWindowTimeBar(boolean z) { this.showMultiWindowTimeBar = z; updateTimeBarMode(); } public void setExtraAdGroupMarkers(long[] jArr, boolean[] zArr) { boolean z = false; if (jArr == null) { this.extraAdGroupTimesMs = new long[0]; this.extraPlayedAdGroups = new boolean[0]; } else { if (jArr.length == zArr.length) { z = true; } Assertions.checkArgument(z); this.extraAdGroupTimesMs = jArr; this.extraPlayedAdGroups = zArr; } updateProgress(); } public void setVisibilityListener(VisibilityListener visibilityListener2) { this.visibilityListener = visibilityListener2; } public void setPlaybackPreparer(PlaybackPreparer playbackPreparer2) { this.playbackPreparer = playbackPreparer2; } public void setControlDispatcher(ControlDispatcher controlDispatcher2) { if (controlDispatcher2 == null) { controlDispatcher2 = new DefaultControlDispatcher(); } this.controlDispatcher = controlDispatcher2; } public void setRewindIncrementMs(int i) { this.rewindMs = i; updateNavigation(); } public void setFastForwardIncrementMs(int i) { this.fastForwardMs = i; updateNavigation(); } public int getShowTimeoutMs() { return this.showTimeoutMs; } public void setShowTimeoutMs(int i) { this.showTimeoutMs = i; if (isVisible()) { hideAfterTimeout(); } } public int getRepeatToggleModes() { return this.repeatToggleModes; } public void setRepeatToggleModes(int i) { this.repeatToggleModes = i; Player player2 = this.player; if (player2 != null) { int repeatMode = player2.getRepeatMode(); if (i == 0 && repeatMode != 0) { this.controlDispatcher.dispatchSetRepeatMode(this.player, 0); } else if (i == 1 && repeatMode == 2) { this.controlDispatcher.dispatchSetRepeatMode(this.player, 1); } else if (i == 2 && repeatMode == 1) { this.controlDispatcher.dispatchSetRepeatMode(this.player, 2); } } updateRepeatModeButton(); } public boolean getShowShuffleButton() { return this.showShuffleButton; } public void setShowShuffleButton(boolean z) { this.showShuffleButton = z; updateShuffleButton(); } public void show() { if (!isVisible()) { setVisibility(0); VisibilityListener visibilityListener2 = this.visibilityListener; if (visibilityListener2 != null) { visibilityListener2.onVisibilityChange(getVisibility()); } updateAll(); requestPlayPauseFocus(); } hideAfterTimeout(); } public void hide() { if (isVisible()) { setVisibility(8); VisibilityListener visibilityListener2 = this.visibilityListener; if (visibilityListener2 != null) { visibilityListener2.onVisibilityChange(getVisibility()); } removeCallbacks(this.updateProgressAction); removeCallbacks(this.hideAction); this.hideAtMs = C1379C.TIME_UNSET; } } public boolean isVisible() { return getVisibility() == 0; } private void hideAfterTimeout() { removeCallbacks(this.hideAction); if (this.showTimeoutMs > 0) { long uptimeMillis = SystemClock.uptimeMillis(); int i = this.showTimeoutMs; this.hideAtMs = uptimeMillis + ((long) i); if (this.isAttachedToWindow) { postDelayed(this.hideAction, (long) i); return; } return; } this.hideAtMs = C1379C.TIME_UNSET; } private void updateAll() { updatePlayPauseButton(); updateNavigation(); updateRepeatModeButton(); updateShuffleButton(); updateProgress(); } /* access modifiers changed from: private */ public void updatePlayPauseButton() { boolean z; if (isVisible() && this.isAttachedToWindow) { boolean isPlaying = isPlaying(); View view = this.playButton; int i = 8; boolean z2 = true; if (view != null) { z = (isPlaying && view.isFocused()) | false; this.playButton.setVisibility(isPlaying ? 8 : 0); } else { z = false; } View view2 = this.pauseButton; if (view2 != null) { if (isPlaying || !view2.isFocused()) { z2 = false; } z |= z2; View view3 = this.pauseButton; if (isPlaying) { i = 0; } view3.setVisibility(i); } if (z) { requestPlayPauseFocus(); } } } /* access modifiers changed from: private */ /* JADX WARNING: Removed duplicated region for block: B:43:0x008c */ /* JADX WARNING: Removed duplicated region for block: B:46:? A[RETURN, SYNTHETIC] */ /* Code decompiled incorrectly, please refer to instructions dump. */ public void updateNavigation() { /* r6 = this; boolean r0 = r6.isVisible() if (r0 == 0) goto L_0x008f boolean r0 = r6.isAttachedToWindow if (r0 != 0) goto L_0x000c goto L_0x008f L_0x000c: com.google.android.exoplayer2.Player r0 = r6.player if (r0 == 0) goto L_0x0015 com.google.android.exoplayer2.Timeline r0 = r0.getCurrentTimeline() goto L_0x0016 L_0x0015: r0 = 0 L_0x0016: r1 = 1 r2 = 0 if (r0 == 0) goto L_0x0022 boolean r3 = r0.isEmpty() if (r3 != 0) goto L_0x0022 r3 = 1 goto L_0x0023 L_0x0022: r3 = 0 L_0x0023: if (r3 == 0) goto L_0x0060 com.google.android.exoplayer2.Player r3 = r6.player boolean r3 = r3.isPlayingAd() if (r3 != 0) goto L_0x0060 com.google.android.exoplayer2.Player r3 = r6.player int r3 = r3.getCurrentWindowIndex() com.google.android.exoplayer2.Timeline$Window r4 = r6.window r0.getWindow(r3, r4) com.google.android.exoplayer2.Timeline$Window r0 = r6.window boolean r0 = r0.isSeekable if (r0 != 0) goto L_0x004f com.google.android.exoplayer2.Timeline$Window r3 = r6.window boolean r3 = r3.isDynamic if (r3 == 0) goto L_0x004f com.google.android.exoplayer2.Player r3 = r6.player boolean r3 = r3.hasPrevious() if (r3 == 0) goto L_0x004d goto L_0x004f L_0x004d: r3 = 0 goto L_0x0050 L_0x004f: r3 = 1 L_0x0050: com.google.android.exoplayer2.Timeline$Window r4 = r6.window boolean r4 = r4.isDynamic if (r4 != 0) goto L_0x005e com.google.android.exoplayer2.Player r4 = r6.player boolean r4 = r4.hasNext() if (r4 == 0) goto L_0x0062 L_0x005e: r4 = 1 goto L_0x0063 L_0x0060: r0 = 0 r3 = 0 L_0x0062: r4 = 0 L_0x0063: android.view.View r5 = r6.previousButton r6.setButtonEnabled(r3, r5) android.view.View r3 = r6.nextButton r6.setButtonEnabled(r4, r3) int r3 = r6.fastForwardMs if (r3 <= 0) goto L_0x0075 if (r0 == 0) goto L_0x0075 r3 = 1 goto L_0x0076 L_0x0075: r3 = 0 L_0x0076: android.view.View r4 = r6.fastForwardButton r6.setButtonEnabled(r3, r4) int r3 = r6.rewindMs if (r3 <= 0) goto L_0x0082 if (r0 == 0) goto L_0x0082 goto L_0x0083 L_0x0082: r1 = 0 L_0x0083: android.view.View r2 = r6.rewindButton r6.setButtonEnabled(r1, r2) com.google.android.exoplayer2.ui.TimeBar r1 = r6.timeBar if (r1 == 0) goto L_0x008f r1.setEnabled(r0) L_0x008f: return */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.exoplayer2.p013ui.PlayerControlView.updateNavigation():void"); } /* access modifiers changed from: private */ public void updateRepeatModeButton() { ImageView imageView; if (isVisible() && this.isAttachedToWindow && (imageView = this.repeatToggleButton) != null) { if (this.repeatToggleModes == 0) { imageView.setVisibility(8); } else if (this.player == null) { setButtonEnabled(false, imageView); } else { setButtonEnabled(true, imageView); int repeatMode = this.player.getRepeatMode(); if (repeatMode == 0) { this.repeatToggleButton.setImageDrawable(this.repeatOffButtonDrawable); this.repeatToggleButton.setContentDescription(this.repeatOffButtonContentDescription); } else if (repeatMode == 1) { this.repeatToggleButton.setImageDrawable(this.repeatOneButtonDrawable); this.repeatToggleButton.setContentDescription(this.repeatOneButtonContentDescription); } else if (repeatMode == 2) { this.repeatToggleButton.setImageDrawable(this.repeatAllButtonDrawable); this.repeatToggleButton.setContentDescription(this.repeatAllButtonContentDescription); } this.repeatToggleButton.setVisibility(0); } } } /* access modifiers changed from: private */ public void updateShuffleButton() { View view; if (isVisible() && this.isAttachedToWindow && (view = this.shuffleButton) != null) { if (!this.showShuffleButton) { view.setVisibility(8); return; } Player player2 = this.player; if (player2 == null) { setButtonEnabled(false, view); return; } view.setAlpha(player2.getShuffleModeEnabled() ? 1.0f : 0.3f); this.shuffleButton.setEnabled(true); this.shuffleButton.setVisibility(0); } } /* access modifiers changed from: private */ public void updateTimeBarMode() { Player player2 = this.player; if (player2 != null) { this.multiWindowTimeBar = this.showMultiWindowTimeBar && canShowMultiWindowTimeBar(player2.getCurrentTimeline(), this.window); } } /* access modifiers changed from: private */ public void updateProgress() { long j; long j2; long j3; int i; long j4; long j5; if (isVisible() && this.isAttachedToWindow) { Player player2 = this.player; boolean z = true; if (player2 != null) { Timeline currentTimeline = player2.getCurrentTimeline(); if (!currentTimeline.isEmpty()) { int currentWindowIndex = this.player.getCurrentWindowIndex(); int i2 = this.multiWindowTimeBar ? 0 : currentWindowIndex; int windowCount = this.multiWindowTimeBar ? currentTimeline.getWindowCount() - 1 : currentWindowIndex; long j6 = 0; j4 = 0; i = 0; while (true) { if (i2 > windowCount) { break; } if (i2 == currentWindowIndex) { j4 = C1379C.usToMs(j6); } currentTimeline.getWindow(i2, this.window); if (this.window.durationUs == C1379C.TIME_UNSET) { Assertions.checkState(this.multiWindowTimeBar ^ z); break; } for (int i3 = this.window.firstPeriodIndex; i3 <= this.window.lastPeriodIndex; i3++) { currentTimeline.getPeriod(i3, this.period); int adGroupCount = this.period.getAdGroupCount(); for (int i4 = 0; i4 < adGroupCount; i4++) { long adGroupTimeUs = this.period.getAdGroupTimeUs(i4); if (adGroupTimeUs == Long.MIN_VALUE) { if (this.period.durationUs == C1379C.TIME_UNSET) { } else { adGroupTimeUs = this.period.durationUs; } } long positionInWindowUs = adGroupTimeUs + this.period.getPositionInWindowUs(); if (positionInWindowUs >= 0 && positionInWindowUs <= this.window.durationUs) { long[] jArr = this.adGroupTimesMs; if (i == jArr.length) { int length = jArr.length == 0 ? 1 : jArr.length * 2; this.adGroupTimesMs = Arrays.copyOf(this.adGroupTimesMs, length); this.playedAdGroups = Arrays.copyOf(this.playedAdGroups, length); } this.adGroupTimesMs[i] = C1379C.usToMs(j6 + positionInWindowUs); this.playedAdGroups[i] = this.period.hasPlayedAdGroup(i4); i++; } } } j6 += this.window.durationUs; i2++; z = true; } j5 = j6; } else { j5 = 0; j4 = 0; i = 0; } j3 = C1379C.usToMs(j5); j2 = this.player.getContentPosition() + j4; j = this.player.getContentBufferedPosition() + j4; if (this.timeBar != null) { int length2 = this.extraAdGroupTimesMs.length; int i5 = i + length2; long[] jArr2 = this.adGroupTimesMs; if (i5 > jArr2.length) { this.adGroupTimesMs = Arrays.copyOf(jArr2, i5); this.playedAdGroups = Arrays.copyOf(this.playedAdGroups, i5); } System.arraycopy(this.extraAdGroupTimesMs, 0, this.adGroupTimesMs, i, length2); System.arraycopy(this.extraPlayedAdGroups, 0, this.playedAdGroups, i, length2); this.timeBar.setAdGroupTimesMs(this.adGroupTimesMs, this.playedAdGroups, i5); } } else { j3 = 0; j2 = 0; j = 0; } TextView textView = this.durationView; if (textView != null) { textView.setText(Util.getStringForTime(this.formatBuilder, this.formatter, j3)); } TextView textView2 = this.positionView; if (textView2 != null && !this.scrubbing) { textView2.setText(Util.getStringForTime(this.formatBuilder, this.formatter, j2)); } TimeBar timeBar2 = this.timeBar; if (timeBar2 != null) { timeBar2.setPosition(j2); this.timeBar.setBufferedPosition(j); this.timeBar.setDuration(j3); } removeCallbacks(this.updateProgressAction); Player player3 = this.player; int playbackState = player3 == null ? 1 : player3.getPlaybackState(); if (playbackState != 1 && playbackState != 4) { long j7 = 1000; if (this.player.getPlayWhenReady() && playbackState == 3) { float f = this.player.getPlaybackParameters().speed; if (f > 0.1f) { if (f <= 5.0f) { long max = (long) (1000 / Math.max(1, Math.round(1.0f / f))); long j8 = max - (j2 % max); if (j8 < max / 5) { j8 += max; } if (f != 1.0f) { j8 = (long) (((float) j8) / f); } j7 = j8; } else { j7 = 200; } } } postDelayed(this.updateProgressAction, j7); } } } private void requestPlayPauseFocus() { View view; View view2; boolean isPlaying = isPlaying(); if (!isPlaying && (view2 = this.playButton) != null) { view2.requestFocus(); } else if (isPlaying && (view = this.pauseButton) != null) { view.requestFocus(); } } private void setButtonEnabled(boolean z, View view) { if (view != null) { view.setEnabled(z); view.setAlpha(z ? 1.0f : 0.3f); view.setVisibility(0); } } /* access modifiers changed from: private */ public void previous() { Timeline currentTimeline = this.player.getCurrentTimeline(); if (!currentTimeline.isEmpty() && !this.player.isPlayingAd()) { currentTimeline.getWindow(this.player.getCurrentWindowIndex(), this.window); int previousWindowIndex = this.player.getPreviousWindowIndex(); if (previousWindowIndex == -1 || (this.player.getCurrentPosition() > MAX_POSITION_FOR_SEEK_TO_PREVIOUS && (!this.window.isDynamic || this.window.isSeekable))) { seekTo(0); } else { seekTo(previousWindowIndex, C1379C.TIME_UNSET); } } } /* access modifiers changed from: private */ public void next() { Timeline currentTimeline = this.player.getCurrentTimeline(); if (!currentTimeline.isEmpty() && !this.player.isPlayingAd()) { int currentWindowIndex = this.player.getCurrentWindowIndex(); int nextWindowIndex = this.player.getNextWindowIndex(); if (nextWindowIndex != -1) { seekTo(nextWindowIndex, C1379C.TIME_UNSET); } else if (currentTimeline.getWindow(currentWindowIndex, this.window).isDynamic) { seekTo(currentWindowIndex, C1379C.TIME_UNSET); } } } /* access modifiers changed from: private */ public void rewind() { if (this.rewindMs > 0) { seekTo(Math.max(this.player.getCurrentPosition() - ((long) this.rewindMs), 0)); } } /* access modifiers changed from: private */ public void fastForward() { if (this.fastForwardMs > 0) { long duration = this.player.getDuration(); long currentPosition = this.player.getCurrentPosition() + ((long) this.fastForwardMs); if (duration != C1379C.TIME_UNSET) { currentPosition = Math.min(currentPosition, duration); } seekTo(currentPosition); } } private void seekTo(long j) { seekTo(this.player.getCurrentWindowIndex(), j); } private void seekTo(int i, long j) { if (!this.controlDispatcher.dispatchSeekTo(this.player, i, j)) { updateProgress(); } } /* access modifiers changed from: private */ public void seekToTimeBarPosition(long j) { int i; Timeline currentTimeline = this.player.getCurrentTimeline(); if (this.multiWindowTimeBar && !currentTimeline.isEmpty()) { int windowCount = currentTimeline.getWindowCount(); i = 0; while (true) { long durationMs = currentTimeline.getWindow(i, this.window).getDurationMs(); if (j < durationMs) { break; } else if (i == windowCount - 1) { j = durationMs; break; } else { j -= durationMs; i++; } } } else { i = this.player.getCurrentWindowIndex(); } seekTo(i, j); } public void onAttachedToWindow() { super.onAttachedToWindow(); this.isAttachedToWindow = true; long j = this.hideAtMs; if (j != C1379C.TIME_UNSET) { long uptimeMillis = j - SystemClock.uptimeMillis(); if (uptimeMillis <= 0) { hide(); } else { postDelayed(this.hideAction, uptimeMillis); } } else if (isVisible()) { hideAfterTimeout(); } updateAll(); } public void onDetachedFromWindow() { super.onDetachedFromWindow(); this.isAttachedToWindow = false; removeCallbacks(this.updateProgressAction); removeCallbacks(this.hideAction); } public final boolean dispatchTouchEvent(MotionEvent motionEvent) { if (motionEvent.getAction() == 0) { removeCallbacks(this.hideAction); } else if (motionEvent.getAction() == 1) { hideAfterTimeout(); } return super.dispatchTouchEvent(motionEvent); } public boolean dispatchKeyEvent(KeyEvent keyEvent) { return dispatchMediaKeyEvent(keyEvent) || super.dispatchKeyEvent(keyEvent); } public boolean dispatchMediaKeyEvent(KeyEvent keyEvent) { int keyCode = keyEvent.getKeyCode(); if (this.player == null || !isHandledMediaKey(keyCode)) { return false; } if (keyEvent.getAction() == 0) { if (keyCode == 90) { fastForward(); } else if (keyCode == 89) { rewind(); } else if (keyEvent.getRepeatCount() == 0) { if (keyCode == 85) { ControlDispatcher controlDispatcher2 = this.controlDispatcher; Player player2 = this.player; controlDispatcher2.dispatchSetPlayWhenReady(player2, !player2.getPlayWhenReady()); } else if (keyCode == 87) { next(); } else if (keyCode == 88) { previous(); } else if (keyCode == 126) { this.controlDispatcher.dispatchSetPlayWhenReady(this.player, true); } else if (keyCode == 127) { this.controlDispatcher.dispatchSetPlayWhenReady(this.player, false); } } } return true; } private boolean isPlaying() { Player player2 = this.player; if (player2 == null || player2.getPlaybackState() == 4 || this.player.getPlaybackState() == 1 || !this.player.getPlayWhenReady()) { return false; } return true; } private static boolean canShowMultiWindowTimeBar(Timeline timeline, Timeline.Window window2) { if (timeline.getWindowCount() > 100) { return false; } int windowCount = timeline.getWindowCount(); for (int i = 0; i < windowCount; i++) { if (timeline.getWindow(i, window2).durationUs == C1379C.TIME_UNSET) { return false; } } return true; } /* renamed from: com.google.android.exoplayer2.ui.PlayerControlView$ComponentListener */ private final class ComponentListener implements Player.EventListener, TimeBar.OnScrubListener, View.OnClickListener { public /* synthetic */ void onLoadingChanged(boolean z) { Player.EventListener.CC.$default$onLoadingChanged(this, z); } public /* synthetic */ void onPlaybackParametersChanged(PlaybackParameters playbackParameters) { Player.EventListener.CC.$default$onPlaybackParametersChanged(this, playbackParameters); } public /* synthetic */ void onPlayerError(ExoPlaybackException exoPlaybackException) { Player.EventListener.CC.$default$onPlayerError(this, exoPlaybackException); } public /* synthetic */ void onSeekProcessed() { Player.EventListener.CC.$default$onSeekProcessed(this); } public /* synthetic */ void onTracksChanged(TrackGroupArray trackGroupArray, TrackSelectionArray trackSelectionArray) { Player.EventListener.CC.$default$onTracksChanged(this, trackGroupArray, trackSelectionArray); } private ComponentListener() { } public void onScrubStart(TimeBar timeBar, long j) { boolean unused = PlayerControlView.this.scrubbing = true; } public void onScrubMove(TimeBar timeBar, long j) { if (PlayerControlView.this.positionView != null) { PlayerControlView.this.positionView.setText(Util.getStringForTime(PlayerControlView.this.formatBuilder, PlayerControlView.this.formatter, j)); } } public void onScrubStop(TimeBar timeBar, long j, boolean z) { boolean unused = PlayerControlView.this.scrubbing = false; if (!z && PlayerControlView.this.player != null) { PlayerControlView.this.seekToTimeBarPosition(j); } } public void onPlayerStateChanged(boolean z, int i) { PlayerControlView.this.updatePlayPauseButton(); PlayerControlView.this.updateProgress(); } public void onRepeatModeChanged(int i) { PlayerControlView.this.updateRepeatModeButton(); PlayerControlView.this.updateNavigation(); } public void onShuffleModeEnabledChanged(boolean z) { PlayerControlView.this.updateShuffleButton(); PlayerControlView.this.updateNavigation(); } public void onPositionDiscontinuity(int i) { PlayerControlView.this.updateNavigation(); PlayerControlView.this.updateProgress(); } public void onTimelineChanged(Timeline timeline, Object obj, int i) { PlayerControlView.this.updateNavigation(); PlayerControlView.this.updateTimeBarMode(); PlayerControlView.this.updateProgress(); } public void onClick(View view) { if (PlayerControlView.this.player == null) { return; } if (PlayerControlView.this.nextButton == view) { PlayerControlView.this.next(); } else if (PlayerControlView.this.previousButton == view) { PlayerControlView.this.previous(); } else if (PlayerControlView.this.fastForwardButton == view) { PlayerControlView.this.fastForward(); } else if (PlayerControlView.this.rewindButton == view) { PlayerControlView.this.rewind(); } else if (PlayerControlView.this.playButton == view) { if (PlayerControlView.this.player.getPlaybackState() == 1) { if (PlayerControlView.this.playbackPreparer != null) { PlayerControlView.this.playbackPreparer.preparePlayback(); } } else if (PlayerControlView.this.player.getPlaybackState() == 4) { PlayerControlView.this.controlDispatcher.dispatchSeekTo(PlayerControlView.this.player, PlayerControlView.this.player.getCurrentWindowIndex(), C1379C.TIME_UNSET); } PlayerControlView.this.controlDispatcher.dispatchSetPlayWhenReady(PlayerControlView.this.player, true); } else if (PlayerControlView.this.pauseButton == view) { PlayerControlView.this.controlDispatcher.dispatchSetPlayWhenReady(PlayerControlView.this.player, false); } else if (PlayerControlView.this.repeatToggleButton == view) { PlayerControlView.this.controlDispatcher.dispatchSetRepeatMode(PlayerControlView.this.player, RepeatModeUtil.getNextRepeatMode(PlayerControlView.this.player.getRepeatMode(), PlayerControlView.this.repeatToggleModes)); } else if (PlayerControlView.this.shuffleButton == view) { PlayerControlView.this.controlDispatcher.dispatchSetShuffleModeEnabled(PlayerControlView.this.player, true ^ PlayerControlView.this.player.getShuffleModeEnabled()); } } } }
2d5ad4c713c31e1f77442671a2cef942b6b1078d
acb8d30ea41b0c9d3256b4fc91bba992ee864e4a
/src/main/java/com/zhibo8/warehouse/test/TestKafka.java
8e337c9e3d5a9673a1a4aa617f052aed0fca62b1
[]
no_license
chijunping/springbootKafkaHbase
3c5a2ef06787c8b83651427e5b8714d81e60ea25
d3c45a28f982818045f71a7d7e480d09d113b915
refs/heads/master
2020-03-20T12:16:05.209614
2018-06-28T08:17:25
2018-06-28T08:17:25
137,425,326
1
0
null
null
null
null
UTF-8
Java
false
false
1,872
java
package com.zhibo8.warehouse.test; import kafka.admin.AdminUtils; import kafka.admin.RackAwareMode; import kafka.server.ConfigType; import kafka.utils.ZkUtils; import org.apache.kafka.common.security.JaasUtils; import java.util.Iterator; import java.util.Map; import java.util.Properties; /** * @author rjsong */ public class TestKafka { public static void main(String[] args){ String zkHost = "120.55.59.107:2181,121.196.199.76:2181,121.196.218.2:2181/kafka-1.0.0"; //该地址由emr-kafka集群配置而来 ZkUtils zkUtils = ZkUtils.apply(zkHost,30000,30000, JaasUtils.isZkSecurityEnabled()); //创建一个单分区副本名为test2的topic AdminUtils.createTopic(zkUtils,"test2",1,1,new Properties(), RackAwareMode.Enforced$.MODULE$); System.out.println("创建成功"); //查询topic Properties props = AdminUtils.fetchEntityConfig(zkUtils, ConfigType.Topic(),"test2"); //查询topic-level的属性 Iterator iterator =props.entrySet().iterator(); while (iterator.hasNext()){ Map.Entry entry = (Map.Entry)iterator.next(); Object key = entry.getKey(); Object value = entry.getValue(); System.out.println(key+" = "+value); } System.out.println("success."); zkUtils.close(); //修改topic /* Properties props = AdminUtils.fetchEntityConfig(zkUtils, ConfigType.Topic(),"test2"); //增加topic级别属性 props.put("min.cleanable.dirty.ratio","0.3"); AdminUtils.changeTopicConfig(zkUtils,"test2",props); System.out.println("修改成功");*/ //删除topic // AdminUtils.deleteTopic(zkUtils,"test2"); // System.out.println("删除成功"); zkUtils.close(); } }
c22baef397eb0ceaa04921e7d164d7980c6b38ff
ac9097d92b0b7495c4bf23bf4c8e398c585b3d76
/cdm/cdm-core/src/main/java/com/bytheone/util/IpUtil.java
5bfe46eda5845d44a0fb04d3397f896370d13917
[ "Apache-2.0" ]
permissive
iFruite/first_pipeline
c5f844819640024ea85f8315a37d8346c1d39ac6
b8e028ac1602a50daad102ce12f20ca443f5f6d0
refs/heads/master
2022-10-25T09:15:13.786359
2019-10-23T08:52:45
2019-10-23T08:52:45
216,979,321
0
1
null
2022-10-12T20:44:42
2019-10-23T05:58:19
JavaScript
UTF-8
Java
false
false
885
java
package com.bytheone.util; import javax.servlet.http.HttpServletRequest; /** * @author ArtLinty * @date 2017/12/28. * @email [email protected] */ public class IpUtil { public static String getIp(HttpServletRequest request) { String ip = request.getHeader("x-forwarded-for"); if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("Proxy-Client-IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("WL-Proxy-Client-IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("X-Real-IP"); } if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getRemoteAddr(); } return ip; } }
9d825368e884a8baace556221bf5cebdc8467a29
3bcfe8e07777f168c0bcb5d401f5d2f9e3dbfccd
/Lesson 18/check-is-prime/src/Main.java
6aca67af01281812f8fdfdc9efa0c2eaf727266f
[]
no_license
dat-2205/Module_2
46b649382d5beab34bf18614eaa4924b90f12ae4
2bb5227ca058d391f06307092e958bcd8a1ae27d
refs/heads/master
2023-08-16T17:04:42.064131
2021-09-13T04:10:42
2021-09-13T04:10:42
392,550,974
0
0
null
null
null
null
UTF-8
Java
false
false
443
java
public class Main { public static void main(String[] args) { PrimeNumber1 p1 = new PrimeNumber1(); PrimeNumber2 p2 = new PrimeNumber2(); // p1.run(); // p2.run(); // Thread t1 = new Thread(p1); Thread t2 = new Thread(p2); t2.start(); try { t2.join(); } catch (InterruptedException e) { e.printStackTrace(); } t1.start(); } }
[ "=" ]
=
944a97ed6f7e348ed30f9248fccba6005926594c
34f8d4ba30242a7045c689768c3472b7af80909c
/JDK-15/src/jdk.localedata/sun/util/resources/cldr/ext/TimeZoneNames_en_ZA.java
6ce483ae6f21d31f4fd44aea13d35fe98d85a344
[ "Apache-2.0" ]
permissive
lovelycheng/JDK
5b4cc07546f0dbfad15c46d427cae06ef282ef79
19a6c71e52f3ecd74e4a66be5d0d552ce7175531
refs/heads/master
2023-04-08T11:36:22.073953
2022-09-04T01:53:09
2022-09-04T01:53:09
227,544,567
0
0
null
2019-12-12T07:18:30
2019-12-12T07:18:29
null
UTF-8
Java
false
false
6,518
java
/* * Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ /* * COPYRIGHT AND PERMISSION NOTICE * * Copyright (C) 1991-2016 Unicode, Inc. All rights reserved. * Distributed under the Terms of Use in * http://www.unicode.org/copyright.html. * * Permission is hereby granted, free of charge, to any person obtaining * a copy of the Unicode data files and any associated documentation * (the "Data Files") or Unicode software and any associated documentation * (the "Software") to deal in the Data Files or Software * without restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, and/or sell copies of * the Data Files or Software, and to permit persons to whom the Data Files * or Software are furnished to do so, provided that * (a) this copyright and permission notice appear with all copies * of the Data Files or Software, * (b) this copyright and permission notice appear in associated * documentation, and * (c) there is clear notice in each modified Data File or in the Software * as well as in the documentation associated with the Data File(s) or * Software that the data or software has been modified. * * THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF * ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT OF THIRD PARTY RIGHTS. * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS * NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL * DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THE DATA FILES OR SOFTWARE. * * Except as contained in this notice, the name of a copyright holder * shall not be used in advertising or otherwise to promote the sale, * use or other dealings in these Data Files or Software without prior * written authorization of the copyright holder. */ package sun.util.resources.cldr.ext; import sun.util.resources.TimeZoneNamesBundle; public class TimeZoneNames_en_ZA extends TimeZoneNamesBundle { @Override protected final Object[][] getContents() { final String[] EMPTY_ZONE = new String[] { "", "", "", "", "", "", }; final String[] Africa_Central = new String[] { "Central Africa Time", "CAT", "", "", "", "", }; final String[] Africa_Eastern = new String[] { "East Africa Time", "EAT", "", "", "", "", }; final String[] Africa_Western = new String[] { "West Africa Standard Time", "WAT", "West Africa Summer Time", "WAST", "West Africa Time", "WAT", }; final String[] Africa_Southern = new String[] { "South Africa Standard Time", "SAST", "", "", "", "", }; final Object[][] data = new Object[][] { { "UTC", EMPTY_ZONE }, { "CAT", Africa_Central }, { "EAT", Africa_Eastern }, { "Africa/Juba", Africa_Eastern }, { "Africa/Lagos", Africa_Western }, { "Africa/Asmera", Africa_Eastern }, { "Africa/Bangui", Africa_Western }, { "Africa/Douala", Africa_Western }, { "Africa/Harare", Africa_Central }, { "Africa/Kigali", Africa_Central }, { "Africa/Luanda", Africa_Western }, { "Africa/Lusaka", Africa_Central }, { "Africa/Malabo", Africa_Western }, { "Africa/Maputo", Africa_Central }, { "Africa/Maseru", Africa_Southern }, { "Africa/Niamey", Africa_Western }, { "Indian/Comoro", Africa_Eastern }, { "Africa/Kampala", Africa_Eastern }, { "Africa/Mbabane", Africa_Southern }, { "Africa/Nairobi", Africa_Eastern }, { "Indian/Mayotte", Africa_Eastern }, { "Africa/Blantyre", Africa_Central }, { "Africa/Djibouti", Africa_Eastern }, { "Africa/Gaborone", Africa_Central }, { "Africa/Khartoum", Africa_Central }, { "Africa/Kinshasa", Africa_Western }, { "Africa/Ndjamena", Africa_Western }, { "Africa/Windhoek", Africa_Central }, { "Africa/Bujumbura", Africa_Central }, { "Africa/Mogadishu", Africa_Eastern }, { "Africa/Libreville", Africa_Western }, { "Africa/Lubumbashi", Africa_Central }, { "Africa/Porto-Novo", Africa_Western }, { "Africa/Addis_Ababa", Africa_Eastern }, { "Africa/Brazzaville", Africa_Western }, { "Africa/Johannesburg", Africa_Southern }, { "Indian/Antananarivo", Africa_Eastern }, { "Africa/Dar_es_Salaam", Africa_Eastern }, }; return data; } }
0938b893411f3afa853ccca673ba5353f63ae9ab
befbb86adac58ed0912494c6af68b3e5ad80ef5c
/src/org/pentaho/platform/dataaccess/datasource/wizard/service/agile/TableInputTransformGenerator.java
77647fba5520e406814cd02a073adaecd5339b84
[]
no_license
yuryilyukevich/data-access
93bc9e79bd4fd95459f3296f46a7d22790bd6880
c7d1f69088dee0df3cd21761e6e460a8b394c63b
refs/heads/master
2021-01-14T13:17:10.960688
2014-08-29T18:38:30
2014-08-29T18:38:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,272
java
/*! * This program is free software; you can redistribute it and/or modify it under the * terms of the GNU Lesser General Public License, version 2.1 as published by the Free Software * Foundation. * * You should have received a copy of the GNU Lesser General Public License along with this * program; if not, you can obtain a copy at http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html * or from the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU Lesser General Public License for more details. * * Copyright (c) 2002-2013 Pentaho Corporation.. All rights reserved. */ package org.pentaho.platform.dataaccess.datasource.wizard.service.agile; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.pentaho.di.core.database.DatabaseMeta; import org.pentaho.di.trans.TransMeta; import org.pentaho.di.trans.step.StepErrorMeta; import org.pentaho.di.trans.step.StepMeta; import org.pentaho.di.trans.steps.tableinput.TableInputMeta; import org.pentaho.platform.dataaccess.datasource.wizard.sources.csv.FileTransformStats; public class TableInputTransformGenerator extends StagingTransformGenerator { private static final long serialVersionUID = -185098401772609035L; private static final String TABLE_INPUT = "tableinput"; //$NON-NLS-1$ private static final Log log = LogFactory.getLog(TableInputTransformGenerator.class); private DatabaseMeta sourceDatabaseMeta; private String sql; private int rowLimit = -1; public TableInputTransformGenerator( DatabaseMeta sourceDatabaseMeta, DatabaseMeta targetDatabaseMeta ) { super(targetDatabaseMeta); this.sourceDatabaseMeta = sourceDatabaseMeta; } @Override protected String[] getIndexedColumnNames() { return new String[0]; } @Override protected StepMeta[] getSteps( TransMeta transMeta ) { StepMeta steps[] = new StepMeta[1]; steps[0] = createInputStep(transMeta); return steps; } protected StepMeta createInputStep(TransMeta transMeta) { TableInputMeta inputMeta = new TableInputMeta(); inputMeta.setDatabaseMeta(sourceDatabaseMeta); inputMeta.setExecuteEachInputRow(false); inputMeta.setRowLimit(Integer.toString(rowLimit)); inputMeta.setSQL(sql); inputMeta.setVariableReplacementActive(false); inputMeta.setLazyConversionActive(false); // inputMeta.setTargetSteps(null); StepMeta inputStepMeta = new StepMeta(TABLE_INPUT, TABLE_INPUT, inputMeta); inputStepMeta.setStepErrorMeta(new StepErrorMeta(transMeta, inputStepMeta)); transMeta.addStep(inputStepMeta); final FileTransformStats stats = getTransformStats(); StepErrorMeta inputErrorMeta = new StepErrorMeta(transMeta, inputStepMeta) { public void addErrorRowData(Object[] row, int startIndex, long nrErrors, String errorDescriptions, String fieldNames, String errorCodes) { StringBuffer sb = new StringBuffer(); sb.append("Rejected Row: "); for (Object rowData : row) { sb.append(rowData); sb.append(", "); } sb.append("\r\n"); stats.getErrors().add(sb.toString() + errorDescriptions); super.addErrorRowData(row, startIndex, nrErrors, errorDescriptions, fieldNames, errorCodes); } }; StepMeta outputDummyStepMeta = addDummyStep(transMeta, "InputErrorDummy"); inputErrorMeta.setTargetStep(outputDummyStepMeta); inputErrorMeta.setEnabled(true); inputStepMeta.setStepErrorMeta(inputErrorMeta); return inputStepMeta; } @Override public Log getLogger() { return log; } public DatabaseMeta getSourceDatabaseMeta() { return sourceDatabaseMeta; } public void setSourceDatabaseMeta(DatabaseMeta databaseMeta) { this.sourceDatabaseMeta = databaseMeta; } public String getSql() { return sql; } public void setSql(String sql) { this.sql = sql; } public int getRowLimit() { return rowLimit; } public void setRowLimit(int rowLimit) { this.rowLimit = rowLimit; } }
54b3e8160f134338d0bc4f6b6e6547dbd13d6df8
ae13a98399a5ae9f1cc2d3595fd6e14d1da3581f
/cms2/src/main/java/com/bw/gaolei/StringUtil.java
d2eb0ba97df994e3406df0db1723ccdb5461d7d5
[]
no_license
666gaolei666/1704E
7b1a91e66d5a94856f6555645b7f94c7dfccffca
4b7e6aa125c0221ed34834484f906ecfba151ab3
refs/heads/master
2022-12-21T15:18:27.846420
2019-08-11T13:30:09
2019-08-11T13:30:09
201,197,811
0
0
null
2022-12-16T10:32:08
2019-08-08T06:58:39
CSS
UTF-8
Java
false
false
1,126
java
package com.bw.gaolei; /** * @作者 高蕾 * * 2019年8月9日 */ public class StringUtil { //方法1,判断源字符串是否为空,空引号(空白字符创 )也算没值 public boolean hasLength(String src){ if(!src.equals("")&&src != null){ return false; }else{ return true; } } //方法二:判断源字符串是否有值,空引号(空白字符串)和空格也算没值 public boolean hasText(String src){ if(!src.equals(" ")&&src != null && !src.equals("")){ return false; } return true; } //方法三:判断是否为手机号码 public boolean isMobile(String src){ String regex = "^1([38]\\d|5[0-35-9]|7[3678])\\d{8}$"; return src.matches(regex); } //方法四:判断是否是邮箱 public boolean isEmail(String src){ String regex = "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$"; return src.matches(regex); } //方法五:反转字符串,例如参数值是"abcdefg",则输出"gfedcba" public String reverse(String src){ return new StringBuffer(src).reverse().toString(); } }
cddbc8bf5fb3154bbb1a9e407ac351b5c95f3a5b
a49f62d31c6533a2d279cb4acee45a1c31c81d3a
/src/main/java/io/springtalk/domain/HelloMessage.java
3365ce80bc81b462ac3e8fe4cb77d810ec8ce451
[ "MIT" ]
permissive
knight7024/SpringTalk
fbc3f49e8e1c411a06284b51e539ce4e5c68d143
69eb4135202c5b5e8d6253b606ca3b8a011d8eb9
refs/heads/main
2023-06-16T17:13:34.854213
2021-07-11T06:36:21
2021-07-11T06:36:21
384,842,591
2
0
null
null
null
null
UTF-8
Java
false
false
341
java
package io.springtalk.domain; public class HelloMessage { private String name; public HelloMessage() { } public HelloMessage(String name) { this.name = name; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
f51f0a27619b89031b5c7d7c1d89c58eeb20fd66
028532cbba5e8759099414771ea6e630eb92d074
/ghsdk/src/main/java/com/gizmohub/sdk/logo/GLogoRecog.java
90e253892acebecb5c3c1024ff692b3174be954f
[]
no_license
koudle/GSDK
a857ebf4ef0d8311b6d58ca207b106b41fad765d
0ce45e6854f94e98fca5d494fc8a0cf2fcf1d575
refs/heads/master
2020-03-07T13:56:27.808752
2018-07-28T08:38:36
2018-07-28T08:38:36
127,514,426
0
0
null
null
null
null
UTF-8
Java
false
false
9,143
java
package com.gizmohub.sdk.logo; import android.content.Context; import android.graphics.Bitmap; import android.hardware.Camera; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.os.SystemClock; import android.text.TextUtils; import android.util.Base64; import android.util.Log; import com.alibaba.sdk.android.oss.ClientException; import com.alibaba.sdk.android.oss.OSS; import com.alibaba.sdk.android.oss.OSSClient; import com.alibaba.sdk.android.oss.ServiceException; import com.alibaba.sdk.android.oss.callback.OSSCompletedCallback; import com.alibaba.sdk.android.oss.common.auth.HmacSHA1Signature; import com.alibaba.sdk.android.oss.common.auth.OSSCustomSignerCredentialProvider; import com.alibaba.sdk.android.oss.internal.OSSAsyncTask; import com.alibaba.sdk.android.oss.model.PutObjectRequest; import com.alibaba.sdk.android.oss.model.PutObjectResult; import com.gizmohub.sdk.utils.DeviceUtils; import com.gizmohub.sdk.utils.FileUtils; import com.gizmohub.sdk.utils.ImageUtils; import org.json.JSONException; import org.json.JSONObject; import java.util.HashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import okhttp3.OkHttpClient; import okhttp3.Request; import okhttp3.Response; public class GLogoRecog { private static final int GET_RESULT_DELAY_TIME = 200; private static final int UPLOAD_PIC_INTERVAL = 1000; private ExecutorService executorService; private Context context; private Handler handler; private LogoResultListener logoResultListener; private long previewTime = 0; private OkHttpClient client ; private class InternalHandler extends Handler { private Context context; public InternalHandler(Context context) { super(Looper.getMainLooper()); this.context = context; } @SuppressWarnings({"unchecked", "RawUseOfParameterizedType"}) @Override public void handleMessage(Message msg) { switch (msg.what) { case 0: if(logoResultListener != null) { logoResultListener.onRecoging(); } break; case 1: if(msg.obj instanceof LogoResult) { LogoResult logoResult = (LogoResult) msg.obj; if(logoResult != null && logoResultListener!= null) { logoResultListener.onRecogSuceess(logoResult); } } break; } } } public GLogoRecog(Context context){ this.context = context; client = new OkHttpClient(); executorService = Executors.newFixedThreadPool(DeviceUtils.getNumberOfCPUCores()*2); handler = new InternalHandler(context); } public void recognize(final Bitmap bitmap) { if(shouldAbandon()) return; executorService.execute(new Runnable() { @Override public void run() { long startTime = SystemClock.uptimeMillis(); recognize(startTime,ImageUtils.savaBitmap(bitmap,context)); } }); } public void recognize(final byte[] data, final Camera camera){ if(shouldAbandon()) return; executorService.execute(new Runnable() { @Override public void run() { long startTime = SystemClock.uptimeMillis(); recognize(startTime,ImageUtils.savaBitmap(ImageUtils.byteToBitmap(data,camera),context)); } }); } public void setLogoResultListener(LogoResultListener listener) { this.logoResultListener = listener; } private boolean shouldAbandon(){ if(previewTime <= 0) { previewTime = SystemClock.uptimeMillis(); Log.d("recogn","shouldAbandon:false"); return false; }else { if(SystemClock.uptimeMillis() - previewTime >= UPLOAD_PIC_INTERVAL) { Log.d("recogn","shouldAbandon:false"); return false; }else { Log.d("recogn","shouldAbandon:true"); return true; } } } private void recognize(final long startTime,final String imageName) { if(TextUtils.isEmpty(imageName)) return; String objectKey = null; String sign = null; String AccessKeyId = null; final JSONObject callback; Request request = new Request.Builder() .url(String.format("http://logorec.gizmocloud.cn/%s/upload_policy?md5=%s.jpg", FileUtils.getImei(context),imageName)) .build(); try { Response response = client.newCall(request).execute(); JSONObject object = new JSONObject(response.body().string()); sign = object.getString("signature"); objectKey = object.getString("dir")+imageName+".jpg"; AccessKeyId = object.getString("accessid"); callback = new JSONObject(new String(Base64.decode(object.getString("callback"),Base64.DEFAULT))); } catch (Exception e) { e.printStackTrace(); return; } String endpoint = "http://oss-cn-shenzhen.aliyuncs.com"; OSSCustomSignerCredentialProvider credentialProvider = new OSSCustomSignerCredentialProvider() { @Override public String signContent(String content) { // 您需要在这里依照OSS规定的签名算法,实现加签一串字符内容,并把得到的签名传拼接上AccessKeyId后返回 // 一般实现是,将字符内容post到您的业务服务器,然后返回签名 // 如果因为某种原因加签失败,描述error信息后,返回nil // 以下是用本地算法进行的演示 HmacSHA1Signature signature = new HmacSHA1Signature(); return "OSS " + "LTAIQtfCFtRLRmn1" + ":" + signature.computeSignature("TMrwPDw3Ani1gHQMJxJpE1QXlyNR6j",content) ; // return "OSS " + AccessKeyId +":" + sign; } }; OSS oss = new OSSClient(context, endpoint, credentialProvider); PutObjectRequest put = new PutObjectRequest("gizmohub", objectKey, FileUtils.getPicPath(context,imageName)); put.setCallbackParam(new HashMap<String, String>() { { try { put("callbackUrl", callback.getString("callbackUrl")); put("callbackHost", callback.getString("callbackHost")); put("callbackBodyType", callback.getString("callbackBodyType")); put("callbackBody", callback.getString("callbackBody")); }catch (JSONException e){ e.printStackTrace(); } } }); OSSAsyncTask task = oss.asyncPutObject(put, new OSSCompletedCallback<PutObjectRequest, PutObjectResult>() { @Override public void onSuccess(PutObjectRequest request, PutObjectResult result) { Log.d("PutObject", "UploadSuccess"); // 只有设置了servercallback,这个值才有数据 String serverCallbackReturnJson = result.getServerCallbackReturnBody(); Log.d("recogn", serverCallbackReturnJson); FileUtils.deleteFile(context,imageName); asyncGetRecognResult(startTime); } @Override public void onFailure(PutObjectRequest request, ClientException clientExcepion, ServiceException serviceException) { // 异常处理 } }); } private void asyncGetRecognResult(long startTime){ Log.d("recogn","asyncGetRecognResult"); try { Thread.sleep(GET_RESULT_DELAY_TIME); } catch (InterruptedException e) { e.printStackTrace(); } Request request = new Request.Builder() .url(String.format("http://logorec.gizmocloud.cn/result/%s", FileUtils.getImei(context))) .build(); try { Response response = client.newCall(request).execute(); JSONObject object = new JSONObject(response.body().string()); if(object.has("rv")) { String name = object.getJSONObject("rv").getString("name"); String id = object.getJSONObject("rv").getString("id"); LogoResult logoResult = new LogoResult(name,id); logoResult.setCost(SystemClock.uptimeMillis() - startTime); Message message = Message.obtain(); message.what = 1; message.obj = logoResult; handler.sendMessage(message); }else { Message message = Message.obtain(); message.what = 0; handler.sendMessage(message); } } catch (Exception e) { e.printStackTrace(); } } }
8c539dd382ea4253bd9a614b6d12891c615085e0
5f63a60fd029b8a74d2b1b4bf6992f5e4c7b429b
/com/planet_ink/coffee_mud/Abilities/Common/MasterButchering.java
cf717379506207cab5999bfdbbb573118fd27d24
[ "Apache-2.0" ]
permissive
bozimmerman/CoffeeMud
5da8b5b98c25b70554ec9a2a8c0ef97f177dc041
647864922e07572b1f6c863de8f936982f553288
refs/heads/master
2023-09-04T09:17:12.656291
2023-09-02T00:30:19
2023-09-02T00:30:19
5,267,832
179
122
Apache-2.0
2023-04-30T11:09:14
2012-08-02T03:22:12
Java
UTF-8
Java
false
false
2,330
java
package com.planet_ink.coffee_mud.Abilities.Common; import com.planet_ink.coffee_mud.core.interfaces.*; import com.planet_ink.coffee_mud.core.*; import com.planet_ink.coffee_mud.core.collections.*; import com.planet_ink.coffee_mud.Abilities.interfaces.*; import com.planet_ink.coffee_mud.Areas.interfaces.*; import com.planet_ink.coffee_mud.Behaviors.interfaces.*; import com.planet_ink.coffee_mud.CharClasses.interfaces.*; import com.planet_ink.coffee_mud.Commands.interfaces.*; import com.planet_ink.coffee_mud.Common.interfaces.*; import com.planet_ink.coffee_mud.Exits.interfaces.*; import com.planet_ink.coffee_mud.Items.interfaces.*; import com.planet_ink.coffee_mud.Libraries.interfaces.*; import com.planet_ink.coffee_mud.Locales.interfaces.*; import com.planet_ink.coffee_mud.MOBS.interfaces.*; import com.planet_ink.coffee_mud.Races.interfaces.*; import java.util.*; /* Copyright 2013-2023 Bo Zimmerman 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. */ public class MasterButchering extends Butchering { @Override public String ID() { return "MasterButchering"; } private final static String localizedName = CMLib.lang().L("Master Butchering"); @Override public String name() { return localizedName; } private static final String[] triggerStrings = I(new String[] { "MBUTCHERING", "MASTERBUTCHERING", "MSKIN", "MASTERSKIN" }); @Override public String[] triggerStrings() { return triggerStrings; } @Override protected int getDuration(final MOB mob, final int weight) { int duration=(int)Math.round(((weight/(10+getXLEVELLevel(mob))))*2.5); duration = super.getDuration(duration, mob, 1, 7); if(duration>100) duration=100; return duration; } @Override protected int baseYield() { return 3; } }
df4707d5251f7933fe0afa0b39ccbc770f363336
bfd8b0762738a000c83e5aeaf3a08247f0d3b7a5
/src/forest_D8.java
7d74cad70a6c14607838f237e48ae633a4fea638
[]
no_license
isaacwhi/GroupAssignment
656157d9d4e2c6b69fd953df8b05b12e3cba9386
a5e11552562005379a509b777962ac3a055547fe
refs/heads/master
2021-05-14T03:40:13.465138
2018-01-08T03:23:41
2018-01-08T03:23:41
116,623,997
0
0
null
2018-01-08T03:23:42
2018-01-08T03:21:57
Java
UTF-8
Java
false
false
1,355
java
public class forest_D8 extends extraFunctions { int direction; boolean flicker; forest_D8() { backgroundImage = loadImage("forest_D8.png"); direction = 0; //< DONT CHANGE flicker = true; //< DONT CHANGE } @Override public boolean updateMapMovement(Collision collisionPoints, Character player) { direction = collisionPoints.edgeCheck(player); switch (direction) { case 0: //do nothing return true; case 1: player.setCurrentMapLocation(18); flicker = false; return true; case 2: player.setCurrentMapLocation(20); flicker = false; return true; case 3: // going right player.setCurrentMapLocation(27); flicker = false; return true; case 4: player.setCurrentMapLocation(12); flicker = false; return true; } return false; } //////////////////////////////////////////////////////////// /// /// Collision /// /////////////////////////////////////////////////////////// @Override public void setUpCollision(Collision collisionPoints) { } }
2f5533c619c0287d0f1626be7e9b4c04a82e17d8
f7a1f721227ad14b8264df1a681ea06327549c4a
/src/main/java/pers/lihuan/authweb/common/encrypt/exception/EndecryptException.java
6360cf8c8915194683bc15c21779f45cc45e45cf
[]
no_license
LiLiChai/easy-auth
208826f441d0ec3d1dc435975cc31975d149ecf6
a3f56be728d612976ab46c8ebdf11f67d3a5aa15
refs/heads/master
2020-03-18T04:12:43.532173
2018-11-05T14:36:28
2018-11-05T14:36:28
134,276,099
1
0
null
null
null
null
UTF-8
Java
false
false
1,301
java
package pers.lihuan.authweb.common.encrypt.exception; /** * Root exception for all Shiro runtime exceptions. This class is used as the root instead * of {@link java.lang.SecurityException} to remove the potential for conflicts; many other * frameworks and products (such as J2EE containers) perform special operations when * encountering {@link java.lang.SecurityException}. * * @since 0.1 */ public class EndecryptException extends RuntimeException { /** * Creates a new ShiroException. */ public EndecryptException() { super(); } /** * Constructs a new ShiroException. * * @param message the reason for the exception */ public EndecryptException(String message) { super(message); } /** * Constructs a new ShiroException. * * @param cause the underlying Throwable that caused this exception to be thrown. */ public EndecryptException(Throwable cause) { super(cause); } /** * Constructs a new ShiroException. * * @param message the reason for the exception * @param cause the underlying Throwable that caused this exception to be thrown. */ public EndecryptException(String message, Throwable cause) { super(message, cause); } }
053c2b91aa73f10df8c8e8c53308c47e59462085
0d580a2defb1d37ff8734cacc745571e9a9d6f78
/icrane-core/src/main/java/com/bfei/icrane/core/dao/ClientDao.java
d69aaa643ab219451fdff66d69696cbc84a7de9d
[]
no_license
moying0/zww-java
2f3ff9894a8cfc17779804f53b2af78e0392b501
55143779546c862c23014988a98d4a9e5648f3a5
refs/heads/master
2020-03-17T05:21:22.065956
2018-05-09T10:17:46
2018-05-09T10:17:46
133,312,991
0
0
null
2018-05-14T06:11:58
2018-05-14T06:11:58
null
UTF-8
Java
false
false
539
java
package com.bfei.icrane.core.dao; import com.bfei.icrane.core.models.Client; import java.util.List; public interface ClientDao { int deleteByPrimaryKey(Long id); int insert(Client record); Client selectByPrimaryKey(Long id); List<Client> selectAll(); int updateByPrimaryKey(Client record); //int query4count(QueryObject qo); //List<Client> query4list(QueryObject qo); void deleteByFromUserName(String fromUserName); void unConcerned(Client c); Client selectByOpenId(String openid); }
61f1017446ea2b285d97b86ba00826979f3e5f01
4f4d9b9b4a109b77db3f65184dbf096a509b934d
/src/main/java/com/jaken/psall/controller/MainController.java
de92beca4ea65d94ef274e1a2e42bde42be5586c
[]
no_license
JakenCooper/psall
aed4d08049ba276cd9f91a196163fd394b38ed9c
bc65563dc72acfa589ce34256fde9b00cb7cf3dc
refs/heads/master
2020-03-19T03:33:45.407298
2018-06-01T16:18:46
2018-06-01T16:18:46
135,739,139
0
0
null
null
null
null
UTF-8
Java
false
false
265
java
package com.jaken.psall.controller; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class MainController { @RequestMapping("/main") public String main(){ return "main"; } }
354e963df401f7b156b7720d1ddae3a6cdcff6e0
37d903d0286dc2dc04d55a41a87ed69eb7f3c495
/Voxtab/app/src/main/java/com/voxtab/ariatech/voxtab/TermsActivity.java
8f2c7f9b5e806f11a6d54d231161158afea4dbd7
[]
no_license
chavanramesh/Voxtab
a556a0ef72c909764d4d281de885b7d5919cbd35
4a52ee36abe75e278b170ebd2399043c829241d8
refs/heads/master
2016-09-14T11:18:35.001477
2016-05-06T11:41:07
2016-05-06T11:41:07
58,206,172
0
0
null
null
null
null
UTF-8
Java
false
false
9,190
java
package com.voxtab.ariatech.voxtab; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.LayoutInflater; import android.view.MenuItem; import android.view.View; import android.webkit.WebView; import android.widget.TextView; import android.widget.Toast; import com.ariatech.lib_project.CommonUtil; import com.voxtab.ariatech.voxtab.bean.Pages; import com.voxtab.ariatech.voxtab.bean.Users; import com.voxtab.ariatech.voxtab.customimages.CircularSmartImageView; import com.voxtab.ariatech.voxtab.database.DatabaseHandlerNew; import com.voxtab.ariatech.voxtab.globaldata.GlobalData; import com.voxtab.ariatech.voxtab.globaldata.LogoutWebServiceCall; import com.voxtab.ariatech.voxtab.utils.ScalingUtilities; /** * Created by AriaTech on 4/12/2016. */ public class TermsActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { private Context context; private Toolbar toolbar; private WebView webView; Pages pages = new Pages(); private boolean isLoggedIn; private TextView txt_header_login; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); GlobalData.activities.add(TermsActivity.this); setContentView(R.layout.activity_terms); context = this; toolbar= GlobalData.initToolBarMenu(this, true, true); setSupportActionBar(toolbar); getSupportActionBar().setDisplayShowTitleEnabled(false); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle( this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); navigationView.setItemIconTintList(null); View headerView = LayoutInflater.from(this).inflate(R.layout.nav_header_main, null); // navigationView.addHeaderView(headerView); GlobalData.setLoginAndLogout(context, navigationView, getIntent()); // txt_header_login = (TextView) headerView.findViewById(R.id.txt_header_login); // // isLoggedIn = GlobalData.isLoggedIn(context); // TextView txt_header_login = (TextView) headerView.findViewById(R.id.txt_header_login); // TextView txt_email = (TextView) headerView.findViewById(R.id.txt_email); // CircularSmartImageView img_user_photo = (CircularSmartImageView) headerView.findViewById(R.id.img_user_photo); // // if (isLoggedIn) { // navigationView.inflateMenu(R.menu.activity_main_drawer); // Users memberId = GlobalData.getMemberId(context); // String photo = CommonUtil.getFormatURL(GlobalData.IMAGE_URL + memberId.getPhoto()); // // txt_header_login.setText(memberId.getMembership_id()); // txt_email.setText(memberId.getEmail()); // img_user_photo.setImageUrl(photo, GlobalData.IMG_HEIGHT_M1, GlobalData.IMG_WIDTH_M1, ScalingUtilities.ScalingLogic.CROP); // // // } else { // navigationView.inflateMenu(R.menu.activity_menu_drawer_login); // } // img_user_photo.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // if (!isLoggedIn) { // Intent intent = new Intent(context, LoginActivity.class); // intent.putExtra("Name", context.getClass().getName()); // startActivity(intent); // } // } // }); // // txt_header_login.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // if (!isLoggedIn) { // Intent intent = new Intent(context, LoginActivity.class); // intent.putExtra("Name", context.getClass().getName()); // startActivity(intent); // } // } // }); init(); } public void init() { webView = (WebView) findViewById(R.id.wv_terms); webView.getSettings().setJavaScriptEnabled(true); // webView.loadUrl("http://www.voxtab.com/tandc.htm"); DatabaseHandlerNew db = new DatabaseHandlerNew(context); try { db.open(); pages = db.getPages(2); if (pages.getPage_content().length() > 0) { webView.loadData(pages.getPage_content(), "text/html", "UTF-8"); } } catch (Exception e) { GlobalData.printError(e); } finally { db.close(); } } @Override public boolean onOptionsItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { int id = item.getItemId(); if (id == R.id.nav_notifications) { if (isLoggedIn) { Intent intent = new Intent(TermsActivity.this, NotificationsActivity.class); startActivity(intent); } else { Intent intent = new Intent(TermsActivity.this, LoginActivity.class); intent.putExtra("Name", "com.voxtab.ariatech.voxtab.NotificationsActivity"); startActivity(intent); } } else if (id == R.id.nav_recordings) { Intent intent = new Intent(TermsActivity.this, MyRecordingsActivity.class); startActivity(intent); } else if (id == R.id.nav_order_history) { if (isLoggedIn) { Intent intent = new Intent(TermsActivity.this, OrderHistoryActivity.class); startActivity(intent); } else { // Toast.makeText(context, "Please login now", Toast.LENGTH_SHORT).show(); Intent intent = new Intent(TermsActivity.this, LoginActivity.class); intent.putExtra("Name", "com.voxtab.ariatech.voxtab.OrderHistoryActivity"); startActivity(intent); } } else if (id == R.id.nav_settings) { if (isLoggedIn) { Intent intent = new Intent(TermsActivity.this, SettingsActivity.class); startActivity(intent); } else { Intent intent = new Intent(TermsActivity.this, LoginActivity.class); intent.putExtra("Name", "com.voxtab.ariatech.voxtab.SettingsActivity"); startActivity(intent); } } else if (id == R.id.nav_home) { Intent intent = new Intent(TermsActivity.this, HomeActivity.class); startActivity(intent); } else if (id == R.id.nav_help) { } // else if (id == R.id.nav_confidentiality) { // Intent intent = new Intent(TermsActivity.this, ConfidentialityActivity.class); // startActivity(intent); // // // } else if (id == R.id.nav_terms_condition) { // // Intent intent = new Intent(TermsActivity.this, TermsActivity.class); // startActivity(intent); // // } else if (id == R.id.nav_about_us) { Intent intent = new Intent(TermsActivity.this, AboutusActivity.class); startActivity(intent); } /*else if (id == R.id.nav_logout) { try { if (!GlobalData.isNetworkAvailable(context)) { Toast.makeText(context, getResources().getString(R.string.ERR_CONNECTION), Toast.LENGTH_LONG).show(); } else { new LogoutWebServiceCall(context,getIntent()).execute(); Intent intent = new Intent(TermsActivity.this, HomeActivity.class); startActivity(intent); } } catch (Exception e) { GlobalData.printError(e); } } */else if (id == R.id.nav_feedback) { if (isLoggedIn) { Intent intent = new Intent(TermsActivity.this, FeedbackActivity.class); startActivity(intent); } else { Intent intent = new Intent(TermsActivity.this, LoginActivity.class); intent.putExtra("Name", "com.voxtab.ariatech.voxtab.FeedbackActivity"); startActivity(intent); } } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } }
13b297806ad23e7da85a56711cda81e880e123bf
5b18c2aa61fd21f819520f1b614425fd6bc73c71
/src/main/java/com/sinosoft/claim/dto/domain/CallCenterSendStatusDto.java
5bba97f438bbc36a7142173743b790dbea66a072
[]
no_license
Akira-09/claim
471cc215fa77212099ca385e7628f3d69f83d6d8
6dd8a4d4eedb47098c09c2bf3f82502aa62220ad
refs/heads/master
2022-01-07T13:08:27.760474
2019-03-24T23:50:09
2019-03-24T23:50:09
null
0
0
null
null
null
null
GB18030
Java
false
false
594
java
package com.sinosoft.claim.dto.domain; import java.io.Serializable; import com.sinosoft.sysframework.common.datatype.DateTime; import com.sinosoft.sysframework.common.util.*; /** * 这是CallCenterSendStatus的数据传输对象类<br> * 创建于 JToolpad(1.5.1) Vendor:[email protected] */ public class CallCenterSendStatusDto extends CallCenterSendStatusDtoBase implements Serializable{ private static final long serialVersionUID = 1L; /** * 默认构造方法,构造一个默认的CallCenterSendStatusDto对象 */ public CallCenterSendStatusDto(){ } }
dc5fb53d48dded692584852be2a5ac2eb391f3ca
38c5387d62d91af6a4a300d3b2e0e1073ee885c4
/src/ByteDance/ReverseList.java
7041a555632e609de0dbb2644f4fe0bf590bd88e
[]
no_license
chuckz1321/LeetCode
83469d4240acdd5b33dea8f8e0dfb1748142192c
5a27d171c83481af13c72649f9a48485a293c6c8
refs/heads/master
2021-07-13T21:09:05.827885
2020-05-25T12:55:04
2020-05-25T12:55:04
145,327,754
0
0
null
null
null
null
UTF-8
Java
false
false
360
java
package ByteDance; /** * 功能描述 * * @author z00533892 * @since 2020-02-24 */ public class ReverseList { public ListNode reverseList(ListNode head) { if (head == null || head.next == null) return head; ListNode tmp = reverseList(head.next); head.next.next = head; head.next = null; return tmp; } }
577541dae12d6dc83ba2b8a1f0efb7c768ccfbd1
6e19c5fec77853db0b9d59d329f4b2e5ec5ef9ca
/so-60993091/src/main/java/test/UserService.java
4b2a5a26b095f9151df220ee2ad562edfc99d9fd
[ "Unlicense" ]
permissive
harawata/mybatis-issues
d870da5917c0e9408e78291a9bfb153a476431a9
f99971874951bf2ea8fc96798cd01dbea7b5e650
refs/heads/master
2023-08-10T01:55:41.046761
2023-07-30T12:15:41
2023-07-30T12:18:53
43,908,446
10
37
Unlicense
2023-09-14T21:13:54
2015-10-08T18:25:18
Java
UTF-8
Java
false
false
1,640
java
package test; import java.util.ArrayList; import java.util.List; import org.apache.ibatis.executor.BatchResult; import org.apache.ibatis.session.SqlSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import mapper.UserMapper; @Service public class UserService { @Autowired @Qualifier("batchSqlSession") private SqlSession sqlSession; @Transactional public List<BatchResult> updateUsers(List<User> users) { List<BatchResult> results = new ArrayList<>(); final int batchSize = 100; UserMapper userMapper = sqlSession.getMapper(UserMapper.class); final int size = users.size(); for (int i = 0; i < size;) { userMapper.update(users.get(i)); i++; if (i % batchSize == 0 || i == size) { results.addAll(sqlSession.flushStatements()); sqlSession.clearCache(); } } return results; } @Transactional public List<BatchResult> insertUsers(List<User> users) { List<BatchResult> results = new ArrayList<>(); final int batchSize = 100; UserMapper userMapper = sqlSession.getMapper(UserMapper.class); userMapper.createTempTable(); final int size = users.size(); for (int i = 0; i < size;) { userMapper.insertTemp(users.get(i)); i++; if (i % batchSize == 0 || i == size) { results.addAll(sqlSession.flushStatements()); sqlSession.clearCache(); } } userMapper.updateUsers(); return results; } }
15177478e923a5c9709a606b6ffc74dda6a13059
14a9cfea324672bcb4e7e44f997e6c014efe9670
/Key Board Back Up/AwesomeKeyboard-master/core/src/main/java/com/hoanganhtuan95ptit/awesomekeyboard/core/Keyboard.java
102cf848375bd83fee743060103fbe2b0c1963a0
[ "Apache-2.0" ]
permissive
Nazmul56/TestingProjects
a3cae3ae533147267ad41355dd2d5a3d3bb3390a
aaaf571ba2749061ad51c739f1f8d332741113d7
refs/heads/master
2022-05-02T10:02:34.947804
2022-03-24T16:53:32
2022-03-24T16:53:32
101,139,315
4
1
null
null
null
null
UTF-8
Java
false
false
199
java
package com.hoanganhtuan95ptit.awesomekeyboard.core; /** * Created by HOANG ANH TUAN on 7/5/2017. */ public interface Keyboard { void hideAllKeyboard(); void showKeyboard(int type); }
785fef1acc4d60cca03c2977f8b47e0547a49d29
f9940f3c1ea482b5112d7bb03d12565402524192
/src/Problem/Solution415.java
dc7b9879657a6471a0641186d5e87d8038d5446d
[]
no_license
Timelim/leetcode
4719326ad031770cb07c4d7d3b68cf25f57e5bd6
ab6b840e97b2a05322f1a1b26baf6d62f6362ef7
refs/heads/master
2023-06-05T04:03:26.267929
2021-06-22T03:38:12
2021-06-22T03:38:12
293,511,253
0
0
null
null
null
null
UTF-8
Java
false
false
1,299
java
package Problem; import java.util.LinkedList; import java.util.Queue; import java.util.Stack; public class Solution415 { public String addStrings(String num1, String num2) { int cin = 0; String res = ""; int i, j; for (i = num1.length() - 1, j = num2.length() - 1; i >= 0 && j >= 0; i--, j--) { int tmp = num1.charAt(i) - '0' + num2.charAt(j) - '0'; char ch = (char) ((tmp + cin) % 10 + '0'); res += ch; cin = (tmp + cin) / 10; } while (i >= 0) { int tmp = num1.charAt(i) - '0'; char ch = (char) ((tmp + cin) % 10 + '0'); res += ch; cin = (tmp + cin) / 10; i--; } while (j >= 0) { int tmp = num2.charAt(j) - '0'; char ch = (char) ((tmp + cin) % 10 + '0'); res += ch; cin = (tmp + cin) / 10; j--; } if (cin == 1) { res += '1'; } String re = ""; for (i = res.length() - 1; i >= 0; i--) { re += res.charAt(i); } return re; } public static void main(String[] args) { Solution415 s = new Solution415(); System.out.println(s.addStrings("123", "4568")); } }
[ "Timelim" ]
Timelim
3458556d4a416a44046a2139140aca9f7fa6cedb
3de2be3bc4cebac626774790efd4105f7516704a
/MyRepo/src/MyTest.java
4a798e4b4fb78ff2006668c4bc41ad08199ee0c8
[]
no_license
codinggu/test
afa919f947f533e83ddb2b7dcca316c9143e6bec
58a70c287b793564d1fcb36c1cdcb878cef70763
refs/heads/master
2023-07-11T10:08:45.223756
2021-08-18T09:52:06
2021-08-18T09:52:06
397,521,416
0
0
null
null
null
null
UHC
Java
false
false
129
java
public class MyTest { public static void main(String[] args) { System.out.println("테스트중입니다"); } }
b11179d620f64bf7d08b2b6661f7c6c9878e19ea
7d466b2a73721b5cb7dc9992a6527d4c96047781
/test/8002-cse-ContinueIntLong-001/src/Main.java
5e7a9a4bf1218c6a8ba28bb9bb1823f7b9ca05d3
[ "Apache-2.0", "NCSA" ]
permissive
projectceladon/vendor_intel_art-extension
ce09807c5e11e459cde151be1aa42a3d6958752e
4f505f9b7ff1b93add4d97de1d8096816b333b4b
refs/heads/master
2023-01-22T08:52:43.463644
2023-01-10T07:27:40
2023-01-10T07:27:40
137,192,912
3
20
NOASSERTION
2020-06-05T09:57:16
2018-06-13T09:23:37
C++
UTF-8
Java
false
false
5,223
java
/** * * L: Break operator doesn't break one basic block limitation for int, * for some reasons (most probably not a bug), there are two basic blocks for long type, * 1 sinking expected for int, 0 for long. * M: no limitations on basic blocks number, 1 constant calculation sinking expected for * each method * **/ public class Main { final int iterations = 1100; public int testLoopAddInt() { int testVar = 10000; int additionalVar = 10; outer: for (int i = 0; i < iterations; i++) { additionalVar += i; for (int k = 0; k < iterations; k++) { additionalVar += k; testVar += 5; continue outer; } } return testVar + additionalVar; } public int testLoopSubInt() { int testVar = 10000; int additionalVar = 10; outer: for (int i = 0; i < iterations; i++) { additionalVar += i; for (int k = 0; k < iterations; k++) { additionalVar += k; testVar -= 5; continue outer; } } return testVar + additionalVar; } public long testLoopSubLong() { long testVar = 10000; long additionalVar = 10; outer: for (long i = 0; i < iterations; i++) { additionalVar += i; for (long k = 0; k < iterations; k++) { additionalVar += k; testVar -= 5; continue outer; } } return testVar + additionalVar; } public int testLoopMulInt(int n) { int testVar = 1; int additionalVar = 10; outer: for (int i = 0; i < 3; i++) { additionalVar += i + n*2; for (int k = 0; k < 5; k++) { additionalVar += k + n + k%3 - i%2 + n%4 - i%5 + (k+2)/7 - (i - 5)/3 + k*3 - k/2; testVar *= 6; continue outer; } } return testVar + additionalVar; } public long testLoopMulLong(long n) { long testVar = 1; long additionalVar = 10; outer: for (long i = 0; i < 5; i++) { additionalVar += i + n; for (long k = 0; k < 5; k++) { additionalVar += k + n + k%3 - i%2 + n%4 - i%5 + (k+2)/7 - (i - 5)/3 + k*3 - k/2; testVar *= 6L; continue outer; } } return testVar + additionalVar; } public int testLoopDivInt() { int testVar = 10000; int additionalVar = 10; outer: for (int i = 0; i < iterations; i++) { additionalVar += i; for (int k = 0; k < iterations; k++) { additionalVar += k; testVar /= 5; continue outer; } } return testVar + additionalVar; } public long testLoopDivLong() { long testVar = 10000; long additionalVar = 10; outer: for (long i = 0; i < iterations; i++) { additionalVar += i; for (long k = 0; k < iterations; k++) { additionalVar += k; testVar /= 5; continue outer; } } return testVar + additionalVar; } public int testLoopRemInt() { int testVar = 10000; int additionalVar = 10; outer: for (int i = 0; i < iterations; i++) { additionalVar += i; for (int k = 0; k < iterations; k++) { additionalVar += k; testVar %= 5; continue outer; } } return testVar + additionalVar; } public long testLoopRemLong() { long testVar = 10000; long additionalVar = 10; outer: for (long i = 0; i < iterations; i++) { additionalVar += i; for (long k = 0; k < iterations; k++) { additionalVar += k; testVar %= 5; continue outer; } } return testVar + additionalVar; } public long testLoopAddLong() { long testVar = 10000; long additionalVar = 10; outer: for (long i = 0; i < iterations; i++) { additionalVar += i; for (long k = 0; k < iterations; k++) { additionalVar += k; testVar += 5; continue outer; } } return testVar + additionalVar; } public static void main(String[] args) { System.out.println(new Main().testLoopAddInt()); System.out.println(new Main().testLoopAddLong()); System.out.println(new Main().testLoopRemLong()); System.out.println(new Main().testLoopRemInt()); System.out.println(new Main().testLoopDivLong()); System.out.println(new Main().testLoopDivInt()); System.out.println(new Main().testLoopMulLong(10)); System.out.println(new Main().testLoopMulInt(10)); System.out.println(new Main().testLoopSubLong()); System.out.println(new Main().testLoopSubInt()); } }
f265d7bbc6f7ff21f5aaf038882127a63afbe357
a371822aa5927db05fbfb1b06fd42adca900918a
/app/src/main/java/com/pallaw/tmassignment/UI/Gallary/GalleryContract.java
60cf5569b32d02ea9c0976f4f86ccb7e1c28bc5e
[]
no_license
pallaw/TMAssignment
8b1078fee0ece6ea250100e2a73ce0b5f0189197
3dc0e7476b36726a74780dc4f3ac2eab05177c66
refs/heads/master
2020-06-04T17:39:34.777124
2019-06-19T01:32:25
2019-06-19T01:32:25
192,127,692
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package com.pallaw.tmassignment.UI.Gallary; import com.pallaw.tmassignment.Data.Models.TMResponse; /** * This specifies the contract between the view and the presenter. */ public interface GalleryContract { interface View { void showData(TMResponse tmResponse); void showError(Throwable e); } interface Presenter { void onDownloadData(); } }
4eb43295617a29b1ef95a2b2d41d7b7022f172b6
2b75ee740b60d21f0941ef2a2ac8789667ae0e09
/src/com/main/balance/expense/NewExpenseController.java
69d4ef321f45d9011b54bdf1808b8a0a9d65d4fb
[]
no_license
IlahaS/Balance_Manager
3df60e12e72770b487b6a4ace69894fa0b4e71d2
638d265c84d8f49d7e385669ba2a70dd287c4eaa
refs/heads/master
2023-07-04T03:00:16.531313
2021-08-07T13:23:14
2021-08-07T13:23:14
393,692,289
0
0
null
null
null
null
UTF-8
Java
false
false
3,160
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.main.balance.expense; import com.main.balance.db.DB; import com.main.balance.main.MainController; import com.main.balance.util.UserInfo; import java.net.URL; import java.time.LocalDate; import java.util.ResourceBundle; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.control.DatePicker; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.stage.Stage; /** * FXML Controller class * * @author TURK */ public class NewExpenseController implements Initializable { @FXML private Label expenseCategoryLabel; @FXML private TextField expenseNameTF; @FXML private DatePicker expenseDateDP; @FXML private TextField expenseAmountTF; @FXML private Label warningsLabel; @FXML private Button confirmButton; DB db = DB.getInstance(); private MainController mainController; private Stage thisStage; public Stage getThisStage() { return thisStage; } public void setThisStage(Stage thisStage) { this.thisStage = thisStage; } public MainController getMainController() { return mainController; } public void setMainController(MainController mainController) { this.mainController = mainController; } @Override public void initialize(URL url, ResourceBundle rb) { } @FXML private void confirmButtonPressed(ActionEvent event) { String expenseName = expenseNameTF.getText().trim(); String expenseAmount = expenseAmountTF.getText().trim(); LocalDate expenseDate = expenseDateDP.getValue(); String category = expenseCategoryLabel.getText(); if (expenseName.equals("")) { msg("Notification: Fill the fields"); } else { if (expenseAmount.equals("")) { msg("Notification: Fill the fields"); } else { if (expenseDate == null) { msg("Notification: Select a date"); } else { db.iud("insert into expense (username,amount,register,category,note) values ('" + UserInfo.username + "','" + expenseAmount + "','" + expenseDate.toString() + "','" + category + "','" + expenseName + "') "); db.iud("update balance set balance = balance - " + expenseAmount + " where username = '" + UserInfo.username + "'"); mainController.loadBalance(); msg("Notification: Succesfully registered"); thisStage.close(); } } } } public void msg(String message) { warningsLabel.setText(message); } public void setExpenseCategoryLabelText(String s) { expenseCategoryLabel.setText(s); } }
48ffe0424ae13083364403a42c1518ad58f56ee6
73a3df1fe13f90ec21706190577d0ccec91d0220
/app/src/main/java/com/sbkj/shunbaowallet/mvp_lvxingxing/framework/mvp/BaseMvpActivity.java
a35646dec7fe80a026f6effffce0b203eb2e4211
[ "Apache-2.0" ]
permissive
yanglilizhang/Mvp-lvxingxing
3ea8474c528373f5b06dd3ee4c97d7c853d10452
f5b8b12e73ba0f1b23c4dc59ff64cc4f1c91d43c
refs/heads/master
2020-04-05T21:07:50.637766
2018-02-13T05:19:49
2018-02-13T05:19:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,963
java
package com.sbkj.shunbaowallet.mvp_lvxingxing.framework.mvp; import android.content.Intent; import android.os.Bundle; import android.support.annotation.CallSuper; import android.support.annotation.Nullable; import android.support.v7.app.AppCompatActivity; import com.orhanobut.logger.AndroidLogAdapter; import com.orhanobut.logger.Logger; import com.sbkj.shunbaowallet.mvp_lvxingxing.ActivityManager; import com.sbkj.shunbaowallet.mvp_lvxingxing.BuildConfig; import com.sbkj.shunbaowallet.mvp_lvxingxing.framework.factory.IPresenterMvpFactory; import com.sbkj.shunbaowallet.mvp_lvxingxing.framework.factory.PresenterMvpFactoryImpl; import com.sbkj.shunbaowallet.mvp_lvxingxing.framework.proxy.BaseMvpProxy; import com.sbkj.shunbaowallet.mvp_lvxingxing.framework.proxy.IBaseMvpPresenterProxy; import com.sbkj.shunbaowallet.mvp_lvxingxing.network.ActivityLifeCycleEvent; import com.umeng.analytics.MobclickAgent; import butterknife.ButterKnife; import io.reactivex.subjects.PublishSubject; /** * Created by lvxingxing on 2017/12/12. * * @author lvxingxing */ public abstract class BaseMvpActivity<V extends IBaseMvpView, M extends IBaseMvpModel, P extends BaseMvpPresenter<V, M>> extends AppCompatActivity implements IBaseMvpPresenterProxy<V, M, P> { private static final String TAG = "BaseMvpActivity"; private static final String PRESENTER_SAVE_KEY = "personalKey"; /** * 创建被代理对象,传入默认Presenter的工厂 */ private BaseMvpProxy<V, M, P> mProxy; public final PublishSubject<ActivityLifeCycleEvent> lifecycleSubject = PublishSubject.create(); /** * 万一用户要重写onCreate ,也必须继承父类的才行 */ @CallSuper @Override protected void onCreate(@Nullable Bundle savedInstanceState) { lifecycleSubject.onNext(ActivityLifeCycleEvent.CREATE); super.onCreate(savedInstanceState); setContentView(layoutResId()); mProxy = new BaseMvpProxy<>(PresenterMvpFactoryImpl.<V, M, P>createFactory(getClass())); mProxy.onCreate((V) this); if (savedInstanceState != null) { mProxy.onRestoreInstanceState(savedInstanceState.getBundle(PRESENTER_SAVE_KEY)); } //打印log Logger.addLogAdapter(new AndroidLogAdapter() { @Override public boolean isLoggable(int priority, String tag) { return BuildConfig.IS_SHOW_LOG; } }); //初始化butterkniff ButterKnife.bind(this); //管理所有activity ActivityManager.getAppManager().addActivity(this); //执行activity中的一些操作 viewAction(savedInstanceState); } /** * 返回布局id * * @return 返回值 */ protected abstract int layoutResId(); /** * view层的操作 * * @param saveBundle 存储的bundle */ protected abstract void viewAction(Bundle saveBundle); @CallSuper @Override protected void onResume() { super.onResume(); mProxy.onResume(); MobclickAgent.onPageStart(this.getClass().getName());//统计页面 MobclickAgent.onResume(this);//统计时长 } @CallSuper @Override protected void onPause() { lifecycleSubject.onNext(ActivityLifeCycleEvent.PAUSE); super.onPause(); MobclickAgent.onPageEnd(this.getClass().getName()); MobclickAgent.onPause(this); } @Override protected void onStop() { lifecycleSubject.onNext(ActivityLifeCycleEvent.STOP); super.onStop(); } @CallSuper @Override protected void onDestroy() { super.onDestroy(); lifecycleSubject.onNext(ActivityLifeCycleEvent.DESTROY); mProxy.onDestroy(); } @CallSuper @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putBundle(PRESENTER_SAVE_KEY, mProxy.onSaveInstanceState()); } @CallSuper @Override public void setPresenterFactory(IPresenterMvpFactory<V, M, P> presenterFactory) { mProxy.setPresenterFactory(presenterFactory); } @CallSuper @Override public IPresenterMvpFactory<V, M, P> getPresenterFactory() { return mProxy.getPresenterFactory(); } @CallSuper @Override public P getMvpPresenter() { return mProxy.getMvpPresenter(); } /** * @param clz 要跳转的activity * 不可以被重写 */ @CallSuper public final void goToActivity(Class<?> clz) { startActivity(new Intent(BaseMvpActivity.this, clz)); } /** * @param clazz 要跳转的activity * @param bundle 携带的参数 */ @CallSuper public void goToActivity(Class<?> clazz, Bundle bundle) { Intent t = new Intent(BaseMvpActivity.this, clazz.getClass()); t.putExtras(bundle); startActivity(t); } }
85e34d05e335b06177401a553aceae8489854634
59715e3a2885c95751147e46a38f65c5ae027df4
/web/src/main/scala/com/razie/pubstage/comms/HtmlContents.java
e9a51964b61999bef4db558e103dfdabb3bbfacf
[ "CC-BY-3.0", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
razie/razbase
b2e878d92c717406d002e8bf0a4275d80e83aa23
1e5e54ef36be0c1da04ab59db4f910f17aedebb8
refs/heads/master
2021-01-18T21:52:55.040695
2017-05-19T15:09:47
2017-05-19T15:09:47
544,899
2
2
null
null
null
null
UTF-8
Java
false
false
1,726
java
/** * Razvan's public code. * Copyright 2008 based on Apache license (share alike) see LICENSE.txt for details. */ package com.razie.pubstage.comms; import java.net.URL; /** * will filter out html header/footers, if present, and get you the contens only. * * @author razvanc99 */ public class HtmlContents extends StrCommStream { /** creates a comm channel with the remote URL */ public HtmlContents(URL url, IStrFilter... f) { super(url, f); } /** creates a comm channel with the remote URL */ public HtmlContents(String url, IStrFilter... f) { super(url, f); } /** strip header/footer */ @Override protected String readStreamImpl() { String otherList = super.readStreamImpl(); otherList = justBody(otherList); return otherList; } /** strip header/footer */ @Override protected String readStreamLineImpl() { String otherList = super.readStreamLineImpl(); otherList = justBody(otherList); return otherList; } /** * try to get just the body of an html document - useful for simple results wrapped in html, * like default lightsoa responses * * @param document the html document * @return cut out all known headers and tags, try to get just the body contents */ public static String justBody(String document) { // TODO 3-2 optimize this...one single sed cmd String s = document.replaceAll("<html>", "").replaceAll("</html>", "").replaceAll("<body[^>]*>", "") .replaceAll("</body>", ""); s = s.replaceFirst("<head>.*</head>", ""); return s; } }
[ "razvanc@razubuntu.(none)" ]
razvanc@razubuntu.(none)
833899f28b669893893dead2edc411b6b038c1ab
3bdf5c1ab19619fbcbb0d7644409aacfedac1916
/src/Listener/BlockListener.java
5e559a581cfc074ed50e33793eccf7d33be6f4a4
[]
no_license
regorand/ereborPlugin
a5bf7cb70f66e8641462e656d1e9faf5470e0af2
4210053507212f8026331372137105d8c5c0b3c8
refs/heads/master
2020-12-26T03:55:25.834961
2016-10-12T12:15:11
2016-10-12T12:15:11
68,613,723
0
0
null
null
null
null
UTF-8
Java
false
false
292
java
package Listener; import org.bukkit.Bukkit; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; import resources.Utilities; public class BlockListener implements Listener { }
0df0f3997ddc92ab5525795a95e2097d453f2eb6
5d1b0ee6356619fa819258f5a8c0e4800e24fe6c
/library-common/src/main/java/com/example/library_common/router/RouterFragmentPath.java
712a00251fcc7c80697aa09136d26920e760ca39
[]
no_license
DowneySU/AI_MVVM
4a3de1fb6747c3554c123f0a9f33ab9cfac04ac1
ce72bcde9f90000dd7f1765f276fab7a876f933f
refs/heads/master
2022-12-12T18:30:24.866418
2020-09-06T10:50:26
2020-09-06T10:50:26
293,255,384
0
0
null
null
null
null
UTF-8
Java
false
false
1,153
java
package com.example.library_common.router; /** * 应用模块: 组件化路由 * <p> * 类描述: 用于组件化开发中,ARouter Fragment路径统一注册, 注册的路径请写好注释、标注业务功能 * <p> * * Created by Downey on 2020/8/27 * Describe: */ public class RouterFragmentPath { /** 首页组件 */ public static class Home { private static final String HOME = "/home"; /** 首页 */ public static final String PAGER_HOME = HOME + "/Home"; } /** 社区组件 */ public static class Community { private static final String COMMUNITY = "/community"; /** 社区页 */ public static final String PAGER_COMMUNITY = COMMUNITY + "/Community"; } /** 更多组件 */ public static class More { private static final String MORE = "/more"; /** 更多页面 */ public static final String PAGER_MORE = MORE + "/More"; } public static class User { private static final String USER = "/user"; /** 个人中心 */ public static final String PAGER_USER = USER + "/User"; } }
33ddc31b5fe9d2ab2d35a134922a1167649b047c
a1a250b8d7b5bd3ddd1125434b7b9726bbcd3f99
/src/modele/metamodele/AssoSimple.java
1dec860ef82df1fd2e2966545e2332911544b2ff
[]
no_license
Benoit29200/GenerationCode
c3bb2368ce9e3c4a4d881f71325a8074b692a44e
bcd61a38bc254656b896288826e1d9f84c0343b6
refs/heads/master
2020-04-06T15:02:56.391554
2019-03-05T20:49:30
2019-03-05T20:49:30
157,564,075
0
0
null
null
null
null
UTF-8
Java
false
false
1,170
java
package modele.metamodele; import generateur.java.GenerateurMetaJava; public class AssoSimple extends Association { private String value; public AssoSimple(String nom, String type, String value, Entite parent) { this.nom = nom; this.type = type; this.value = value; this.parent = parent; } public AssoSimple() { } public String getValue() { return value; } public void setValue(String value) { this.value = value; } @Override public void visitForDeclaration(GenerateurMetaJava g){ g.generateDeclarationAttribut(this); } @Override public void visitForGetterSetter(GenerateurMetaJava g){ g.generateGetterSetterAttribut(this); } @Override public void visitForParamConstructor(GenerateurMetaJava g){ g.generateParamAttributForConstructor(this); } @Override public String toString() { return "AssoSimple{" + "value='" + value + '\'' + ", nom='" + nom + '\'' + ", type='" + type + '\'' + ", parent=" + parent + '}'; } }
049501946b7a12cc04d2100fe1ed724c012a4909
b91c3cae00cd14c5bed4325208cba07a4393d930
/java/multithreadingDemo/src/main/java/com/revature/pc/semaphores/Consumer.java
01f02eeb66ab2b6530443ca1fa4c9f13fec6f1a9
[ "MIT" ]
permissive
210119-java-enterprise/demos
79c4161a1a51b069d6bc197b859e73928e7bf07a
6ddc72ce74f466df2b910ed88c967175d135c148
refs/heads/main
2023-03-26T17:59:30.855358
2021-03-24T19:06:57
2021-03-24T19:06:57
328,815,375
2
0
MIT
2021-03-19T21:00:51
2021-01-11T23:13:51
Java
UTF-8
Java
false
false
1,068
java
package com.revature.pc.semaphores; import java.util.concurrent.Semaphore; public class Consumer { private CustomBuffer buf; private final Semaphore sem; public Consumer(CustomBuffer buf, Semaphore sem) { this.buf = buf; this.sem = sem; } public void consume() { try { sem.acquire(); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } while (buf.isEmpty()) { System.out.println("Buffer is full, pausing producer thread."); sem.release(); try { Thread.sleep(10); sem.acquire(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } buf.getBufferArray()[buf.getCount() - 1] = 0; buf.decrementCount(); System.out.println("Consumed new value. Notifying semaphore"); sem.release(); } }
9931bc822e8f866fe1ebe7b06faded520e22a3eb
e4730297d0762f6246a606ce7e0831ba3c26b398
/BigDinosaur-Core/src/com/base/bigdinosaur/batch/BusinessDataLoad.java
739e92d0bfef3d169f0c91f66b4934a7df4cc659
[]
no_license
Bijaye/BigDinosaur
a280c86a877861eb3cc5d2534e70aef63bca2d3f
a86e9dc7a0d9415eadf8bf1875ca3146241ae17f
refs/heads/master
2021-01-12T08:17:24.340060
2015-10-12T06:54:34
2015-10-12T06:54:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
278
java
package com.base.bigdinosaur.batch; import com.thoughtworks.xstream.annotations.XStreamAlias; @XStreamAlias("BusinessDataLoad") public class BusinessDataLoad implements BusinessData{ private Object data; @Override public Object Load() { return null; } }
[ "abishkar@abishkar-PC" ]
abishkar@abishkar-PC
608f0810dcc7218df29fe77d44697d075cd2ab25
ac4453dc85c42b397999bb33497ccdace15c04c1
/library/src/main/java/com/android/library/core/retrofit/result/ResultObserver.java
093026485bf475e9aefb5f4de0ef9ec2f34464d0
[]
no_license
yuanyukun/Rely
bc0e849e43e5d4994100a2c747e1c41e35b21427
a6c9870521b98b0bcf7c7e99ca79940fce25d30c
refs/heads/master
2021-05-07T04:51:39.431150
2017-09-05T07:55:13
2017-09-05T07:55:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,909
java
package com.android.library.core.retrofit.result; import com.android.library.Constants; import com.android.library.core.eventbus.MsgEvent; import org.greenrobot.eventbus.EventBus; import java.net.ConnectException; import java.net.SocketTimeoutException; import java.net.UnknownHostException; import io.reactivex.Observer; import io.reactivex.disposables.Disposable; /** * Created by dugang on 2017/4/12. 网络请求结果处理 */ @SuppressWarnings("unused") public abstract class ResultObserver<T> implements Observer<Result<T>> { @Override public void onSubscribe(Disposable d) { } @Override public void onNext(Result<T> result) { if (result != null) { if (result.getCode() == Constants.NET_CODE_SUCCESS) { handlerResult(result.getResult()); } else { handlerError(result.getCode(), result.getMsg()); } } else { handlerError(Constants.NET_CODE_ERROR, Constants.EMPTY_RESPONSE_EXCEPTION); } } @Override public void onError(Throwable e) { if (e instanceof SocketTimeoutException) { handlerError(Constants.NET_CODE_SOCKET_TIMEOUT, Constants.SOCKET_TIMEOUT_EXCEPTION); } else if (e instanceof ConnectException) { handlerError(Constants.NET_CODE_CONNECT, Constants.CONNECT_EXCEPTION); } else if (e instanceof UnknownHostException) { handlerError(Constants.NET_CODE_UNKNOWN_HOST, Constants.UNKNOWN_HOST_EXCEPTION); } else { handlerError(Constants.NET_CODE_ERROR, e.getMessage()); } } @Override public void onComplete() { } /** * 返回正常数据 */ public abstract void handlerResult(T t); /** * 返回业务错误 */ public void handlerError(int code, String msg) { EventBus.getDefault().post(new MsgEvent(code, msg)); } }
d149584ba146db33a42e93abf1bc33aa48c3034e
3bdbb3b76d85b2d336478cbb00d6a05e86517f72
/cruxstudy/src/main/java/net/newstring/crux/study/spider/TBProductList.java
2355bc43acf8ccb5a250c7a218a4debc51263f20
[ "Apache-2.0" ]
permissive
aaron218/Crux
6df2ab9c930a96a94c9f48d5252bd09b5454ccc9
3991a7a2b4f719ce2750c5319562017b40370edd
refs/heads/master
2022-09-16T12:04:15.370821
2019-05-24T09:16:17
2019-05-24T09:16:17
44,307,916
1
1
Apache-2.0
2022-09-01T23:07:17
2015-10-15T09:36:40
Java
UTF-8
Java
false
false
3,317
java
package net.newstring.crux.study.spider; import org.jsoup.Jsoup; import org.jsoup.nodes.Document; import org.jsoup.nodes.Element; import org.jsoup.select.Elements; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * TBProductList * * @author lic * @date 2018/3/6 */ public class TBProductList implements ProductList { static PriceCheckUtil pcu = PriceCheckUtil.getInstance(); private String tbUrl; private String productName; public TBProductList(String tbUrl, String productName) { this.tbUrl = tbUrl; this.productName = productName; } @Override public List<ProductInfo> getProductList() { List<ProductInfo> tbProductList = new ArrayList<ProductInfo>(); ProductInfo productInfo = null; String url = ""; int page = 0; for (int i = 0; i < 10; i++) { try { System.out.println("TB Product 第[" + (i + 1) + "]页"); if (i == 0) { url = tbUrl; } else { page += 44; url = Constants.TBURL + pcu.getUrlCode(productName) + Constants.TBPAGE + page; } System.out.println(url); Document doc = Jsoup.parse(pcu.getXmlByHtmlunit(url)); Elements itemlist = doc.select("div[class=m-itemlist]"); Iterator<Element> it = itemlist.iterator(); while (it.hasNext()) { Element item = it.next(); Elements items = item.select("div[data-category=auctions]"); System.out.println(items.size()); Iterator<Element> one = items.iterator(); while (one.hasNext()) { Element e = one.next(); Elements price = e.select("div[class=price g_price g_price-highlight]>strong"); String productPrice = price.text(); Elements title = e.select("div[class=row row-2 title]>a"); String productName = title.text(); String href = e.select("div[class=row row-2 title]>a").get(0).attr("href"); productInfo = new ProductInfo(); productInfo.setProductUrl(href); productInfo.setProductName(productName); productInfo.setProductPrice(productPrice); tbProductList.add(productInfo); } } } catch (Exception e) { System.out.println("Get TB product has error"); System.out.println(e.getMessage()); } } return tbProductList; } public static void main(String[] args) { try { String productName = "DELL"; String tbUrl = Constants.TBURL + pcu.getUrlCode(productName); List<ProductInfo> list = new TBProductList(tbUrl, productName).getProductList(); for (ProductInfo pi : list) { System.out.println("[" + pi.getProductName() + "] [" + pi.getProductPrice() + "] :"+pi.getProductUrl()); } } catch (Exception e) { e.printStackTrace(); } } }
aee47468bb0c5a1ba9cd4fae704fb6f1ace0fddb
4ac8502ce08de429b08a7432c6f0fda7db352e60
/android/cleanspace/src/com/clean/space/apshare/ShareEntryActivity.java
006f20fcc2c2f881058c3f75333e1954eaba0823
[]
no_license
sxj84877171/clearspace
d4498fb1eee6e95a5f30c8a27c2d4e2fc0340460
01ac9ff1b8278ad40720c186dbea83a34c131a4e
refs/heads/master
2021-01-10T03:12:58.488213
2016-01-29T08:04:43
2016-01-29T08:04:43
50,648,043
0
0
null
null
null
null
UTF-8
Java
false
false
156
java
package com.clean.space.apshare; import cn.sharesdk.alipay.share.AlipayHandlerActivity; public class ShareEntryActivity extends AlipayHandlerActivity{ }
6efbf70397fc73826d538b586b95cfe885c78ede
d659f8e18704b81f6b576dee9c93f5000942e2ac
/main/java/com/cbmwebdevelopment/output/ItemList.java
b08e202bd97800b0c29ec46cfffbf2a205dd59bd
[]
no_license
cmeehan1991/Auctioneer-Desktop
ea3e0605d83d6ce02a11950c9856eeb4675a7fb1
53b3b961be3af034af0b919df8ecdc5da352d171
refs/heads/master
2020-03-27T11:44:02.084043
2018-08-28T20:44:05
2018-08-28T20:44:05
146,504,766
0
0
null
null
null
null
UTF-8
Java
false
false
7,548
java
package com.cbmwebdevelopment.output; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.text.ParseException; import java.util.ArrayList; import java.util.Properties; import javax.activation.DataHandler; import javax.activation.DataSource; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; import javax.mail.util.ByteArrayDataSource; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.ss.usermodel.Workbook; import com.cbmwebdevelopment.alerts.Alerts; import com.cbmwebdevelopment.items.Item; import javafx.scene.control.Alert; import javafx.stage.FileChooser; import javafx.stage.Stage; /* * 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. */ /** * * @author cmeehan */ public class ItemList { Row row; Item item; private final String auctionId; private final String USER_HOME = System.getProperty("user.home"); private int rowNum = 1; public ItemList(String auctionId) { this.auctionId = auctionId; } private void createExcel(FileOutputStream fileOut, ByteArrayOutputStream output) throws IOException { Workbook wb = new HSSFWorkbook(); Sheet sheet = wb.createSheet("Winning Bids"); row = sheet.createRow(0); // Create the header row row.createCell(0).setCellValue("Item ID"); row.createCell(1).setCellValue("Item Name"); row.createCell(2).setCellValue("Item Description"); row.createCell(3).setCellValue("Auction Type"); row.createCell(4).setCellValue("Item Status"); row.createCell(5).setCellValue("Item Category"); item = new Item(); System.out.println(this.auctionId); item.itemInformation(this.auctionId).forEach((key, value) -> { System.out.println(item); row = sheet.createRow(rowNum); row.createCell(0).setCellValue(key); row.createCell(1).setCellValue(value.get(0)); row.createCell(2).setCellValue(value.get(1)); row.createCell(3).setCellValue(value.get(2)); row.createCell(4).setCellValue(value.get(3)); row.createCell(5).setCellValue(value.get(4)); rowNum++; }); if (fileOut == null) { wb.write(output); output.close(); } if (output == null) { wb.write(fileOut); wb.close(); fileOut.close(); } } /** * Creates and email client to email the invoice in PDF format to either one * or multiple recipients. Recipients must be separated by a semicolon (;) * * @param id * @param recipient * @throws IOException * @throws FileNotFoundException * @throws ParseException */ public void emailList(String recipient) throws IOException, FileNotFoundException, ParseException { // Set up the email String smtpHost = "mail.cbmwebdevelopment.com"; int smtpPort = 25; String sender = "[email protected]"; String messageContent = "This message was automatically generated by Auctioneer for The Pregnancy Center of Hilton Head. Please do not respond to this email.\n\n"; String subject = "Auction Item List."; // Need to add the date here // Mailer properties Properties properties = new Properties(); properties.put("mail.smtp.host", smtpHost); properties.put("mail.smtp.port", smtpPort); Session session = Session.getDefaultInstance(properties, null); ByteArrayOutputStream outputStream = null; try { // Construct the text body part MimeBodyPart textBodyPart = new MimeBodyPart(); textBodyPart.setText(messageContent); // now write the PDF content to the output stream outputStream = new ByteArrayOutputStream(); createExcel(null, outputStream); byte[] bytes = outputStream.toByteArray(); // Construct the pdf body part DataSource dataSource = new ByteArrayDataSource(bytes, "application/excel"); MimeBodyPart pdfBodyPart = new MimeBodyPart(); pdfBodyPart.setDataHandler(new DataHandler(dataSource)); pdfBodyPart.setFileName("Auction Items.xls"); // Construct the mime multi part MimeMultipart mimeMultiPart = new MimeMultipart(); mimeMultiPart.addBodyPart(textBodyPart); mimeMultiPart.addBodyPart(pdfBodyPart); // create the sender/recipient addresses InternetAddress iaSender = new InternetAddress(sender); // Construct the mime message MimeMessage mimeMessage = new MimeMessage(session); // Check if there is only one recipient or handle multiple if (recipient.contains(";")) { String[] recipients = recipient.trim().split(";"); for (String to : recipients) { mimeMessage.addRecipient(Message.RecipientType.TO, new InternetAddress(to.trim())); } } else { mimeMessage.setRecipient(Message.RecipientType.TO, new InternetAddress(recipient)); } mimeMessage.setSender(iaSender); mimeMessage.setFrom(iaSender); mimeMessage.setSubject(subject); mimeMessage.setContent(mimeMultiPart); Transport.send(mimeMessage); Alert alert = new Alert(Alert.AlertType.CONFIRMATION); alert.setTitle("Message Sent"); alert.setHeaderText("Message Successfully Sent"); alert.showAndWait(); } catch (MessagingException ex) { System.err.println(ex.getMessage()); ArrayList<String> list = new ArrayList<>(); list.add(ex.getMessage()); Alert alert = new Alerts().errorAlert("Email Failure", "Email failed to send", "Cause:", list); alert.showAndWait(); } finally { // clean off if (null != outputStream) { try { outputStream.close(); outputStream = null; } catch (IOException ex) { System.out.println(ex.getMessage()); } } } } /** * Exports the winning bids to an excel file on the user's machine. * */ public void exportWinningBidsToExcel() { // Instantiate the workbook FileChooser fileChooser = new FileChooser(); fileChooser.setTitle("Export Table To"); fileChooser.setInitialDirectory(new File(USER_HOME + "/Documents")); fileChooser.setInitialFileName("Auction Items.xls"); try { FileOutputStream fileOut = new FileOutputStream(fileChooser.showSaveDialog(new Stage()).toString()); createExcel(fileOut, null); } catch (IOException ex) { System.err.println(ex.getMessage()); } } }
db217989b39875e3461091b5361f43341d58755a
595ebd471cf0be82242c453905223c8349ad24b0
/app/src/main/java/com/example/adekurniawan/androideatit/ViewHolder/FoodViewHolder.java
1f97388d00963d91ca2a19802e92adde342d1b23
[]
no_license
adekrnwn/Android-Eat-It
273cfbd1ae2145860e1c68e9f3954abdf4022205
ce0384376c158703a88ca5e592bb16c3a2a97847
refs/heads/master
2020-03-18T11:24:32.286216
2018-05-25T18:00:13
2018-05-25T18:00:13
134,669,367
0
1
null
2018-05-25T18:00:14
2018-05-24T06:12:09
Java
UTF-8
Java
false
false
1,026
java
package com.example.adekurniawan.androideatit.ViewHolder; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.example.adekurniawan.androideatit.Interface.ItemClickListener; import com.example.adekurniawan.androideatit.R; public class FoodViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { public TextView food_name; public ImageView food_image; private ItemClickListener itemClickListener; public void setItemClickListener(ItemClickListener itemClickListener) { this.itemClickListener = itemClickListener; } public FoodViewHolder(View itemView) { super(itemView); food_name = itemView.findViewById(R.id.food_name); food_image = itemView.findViewById(R.id.food_image); itemView.setOnClickListener(this); } @Override public void onClick(View v) { itemClickListener.onClick(v,getAdapterPosition(),false); } }
2f996b6df35bab730d9cb59a315979c24570861f
f69c6a8c4f7ecb69d16230e38a0c7bb827676284
/jiview-boot/jiview-boot-moduler-system/src/main/java/com/smaller/jiview/moduler/system/service/impl/LoginServiceImpl.java
b7b8d0682bbe81b7653e7220a687569059d4f660
[]
no_license
peach99999/jiview_platform
46835089787e8ab44d58a031279967080ea68951
650e5637052d24a3c10aa56caaf5036c02d4a0ee
refs/heads/master
2022-07-01T15:30:19.902585
2019-06-25T01:24:46
2019-06-25T01:24:46
184,008,531
1
0
null
2022-06-29T17:27:59
2019-04-29T05:57:03
HTML
UTF-8
Java
false
false
3,388
java
package com.smaller.jiview.moduler.system.service.impl; import com.smaller.jiview.moduler.system.manager.SysUserManager; import com.smaller.jiview.moduler.system.platform.system.mapper.SysUserMapper; import com.smaller.jiview.moduler.system.platform.system.model.SysUser; import com.smaller.jiview.moduler.system.pojo.param.LoginParam; import com.smaller.jiview.moduler.system.pojo.param.ResetPwdParam; import com.smaller.jiview.moduler.system.service.LoginService; import com.smaller.jiview.core.config.security.JwtHelper; import com.smaller.jiview.core.exception.BizException; import com.smaller.jiview.core.message.AdminMessage; import com.smaller.jiview.core.pojo.bo.ResultBO; import com.smaller.jiview.core.pojo.dto.JwtDTO; import com.smaller.jiview.core.pojo.dto.UserForReturnDTO; import com.smaller.jiview.core.util.SecurityUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.ObjectUtils; import tk.mybatis.mapper.entity.Example; import javax.servlet.http.HttpServletRequest; /** * @author xigf 2019/05/23 */ @Service public class LoginServiceImpl implements LoginService { @Autowired private JwtHelper jwtHelper; @Autowired private SysUserManager sysUserManager; @Autowired private SysUserMapper sysUserMapper; @Override public ResultBO<UserForReturnDTO> login(LoginParam loginParam, HttpServletRequest request) { ResultBO<UserForReturnDTO> bo = new ResultBO<>(); String userLogin = loginParam.getAccount(); String userPwd = loginParam.getUserPwd(); SysUser sysUser = sysUserManager.getForAdminLogin(userLogin, userPwd); Long userId = sysUser.getId(); UserForReturnDTO userForReturnDTO = new UserForReturnDTO(); JwtDTO jwtDTO = new JwtDTO(); // 存入token的用户信息项目,在此手动设置 jwtDTO.setLoginPkid(userId); jwtDTO.setUserLogin(userLogin); // 需要返回的用户信息项目,在此手动设置 userForReturnDTO.setUserId(userId); userForReturnDTO.setDeptId(sysUser.getDeptId()); userForReturnDTO.setAccount(userLogin); userForReturnDTO.setUserName(sysUser.getUserName()); userForReturnDTO.setAuthorization(jwtHelper.createAndSaveToken(jwtDTO)); bo.setRow(userForReturnDTO); return bo; } /** * 设置密码 * * @param resetPwdParam * @return */ @Override public ResultBO resetPwd(ResetPwdParam resetPwdParam) { ResultBO bo = new ResultBO(); SysUser sysUser = sysUserManager.getByUserLogin(resetPwdParam.getAccount()); if (ObjectUtils.isEmpty(sysUser)){ throw new BizException(AdminMessage.NO_SUCH_USER); } SysUser sysUserForUpdate = new SysUser(); sysUserForUpdate.setAccount(resetPwdParam.getAccount()); sysUserForUpdate.setPassword(resetPwdParam.getPassword()); String encodePwd = SecurityUtil.encodePwd(sysUserForUpdate.getPassword()); sysUserForUpdate.setPassword(encodePwd); Example example = new Example(SysUser.class); example.createCriteria().andEqualTo("account", sysUserForUpdate.getAccount()); bo.setOpResult(sysUserMapper.updateByExampleSelective(sysUserForUpdate, example)); return bo; } }
0e6626d3bb6c673307e6922118cddbb8ac4d7ae7
df58b5961c80264828580c3c5b6aa56d5c70a907
/src/main/java/com/jspxcms/core/domain/VideoTwoComment.java
3f5173273e04b71ab39118e507510fc247d04f2f
[]
no_license
yanziyang2016/jspxcms_6.5.2_ep
32272599213cfb0a46b72427599929f929c4e6bf
3a883127bb194e70bdf42701ca13288b32250526
refs/heads/master
2021-07-21T14:01:44.904061
2017-10-31T06:25:03
2017-10-31T06:25:03
107,365,230
0
0
null
null
null
null
UTF-8
Java
false
false
696
java
package com.jspxcms.core.domain; import javax.persistence.DiscriminatorValue; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Transient; import com.jspxcms.common.web.Anchor; /** * InfoComment * * @author liufang * */ public class VideoTwoComment extends Comment { private static final long serialVersionUID = 1L; @Override public Anchor getAnchor() { return info; } private CommentTemp info; public CommentTemp getInfo() { return info; } public void setInfo(CommentTemp info) { this.info = info; } }
d092660813d81e6eaa221e8d834aa6aa7466f2be
3ac676dc6b9cdf295f1b2ea41dba684ef5a30add
/kit-transactionserver-services/src/org/dajo/chronometer/Chronometer7.java
5b546c6ade148666a08a8e6e8bd3a5b8d39f3265
[]
no_license
joseflavio/kit-transactionserver
0aeed01de5f2dcf72dbbd4cb97c4e5d3437260a3
1f84f76e1365f1c47fbcaed7270500e1d4daf4c4
refs/heads/master
2021-05-16T02:17:57.200701
2012-10-03T20:14:32
2012-10-03T20:14:32
3,230,115
1
0
null
null
null
null
UTF-8
Java
false
false
815
java
package org.dajo.chronometer; public class Chronometer7 extends Chronometer { public Chronometer7(final String taskName) { super(taskName); } public Chronometer7(final Object taskClass, final String subTaskName) { super(taskClass, subTaskName); } public ChronometerResource getAsResource() { ChronometerResource resource = new ChronometerResource(this); super.start(); return resource; } static public final class ChronometerResource implements AutoCloseable { private final Chronometer7 chronometer; public ChronometerResource(final Chronometer7 chronometer) { this.chronometer = chronometer; } @Override public void close() { chronometer.close(); } } }// class
[ "joseflavio at gmail dot com" ]
joseflavio at gmail dot com
68c035169153e3aa4c6ec351b40478c67cb9f242
dd321aa3659f1f60077b0e252689b7cb0d8e6255
/src/mvc/model/Tarefa.java
7c2c13fcdc929b7026f95f759163d996dd0932f6
[]
no_license
jpgianfaldoni/PrimeiroSpringMVC
975031f6e2b4b6f41af6490486eeec42592f6fb7
62ac24e44cf0062c716b6a5380beabb93ea2227d
refs/heads/master
2022-12-20T04:18:53.121561
2020-10-01T12:11:29
2020-10-01T12:11:29
300,258,895
0
0
null
null
null
null
UTF-8
Java
false
false
322
java
package mvc.model; import java.util.Calendar; public class Tarefa { private Long id; private String descricao; public Long getId() {return id;} public void setId(Long id) {this.id = id;} public String getDescricao() {return descricao;} public void setDescricao(String descricao) {this.descricao = descricao;} }
53747c2a8e02dc0ccf8ef1306da236353137743b
6c7cada82c93ee492dfa1aae164a14a29453164e
/hedera-mirror-web3/src/main/java/com/hedera/services/store/models/TokenModificationResult.java
d573a17594a670f6021514b4d646dedbfe72e455
[ "Apache-2.0" ]
permissive
hashgraph/hedera-mirror-node
4a3db9f2deec7d6a51f4920393363a3924663f37
c7ef5dee6cf68287ec87cf8fc4abf18c3b2cfc47
refs/heads/main
2023-08-16T14:26:58.289242
2023-08-15T21:20:34
2023-08-15T21:20:34
197,364,349
128
125
Apache-2.0
2023-09-14T19:35:22
2019-07-17T10:04:38
Java
UTF-8
Java
false
false
949
java
/* * Copyright (C) 2023 Hedera Hashgraph, LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * 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.hedera.services.store.models; /** * Newly introduced record to allow multiple return types from {@link Token} modification operations} * * Once we start consuming more libraries from hedera-services, we may delete this record. */ public record TokenModificationResult(Token token, TokenRelationship tokenRelationship) {}
10a7a3afb5771eae72eabe5987b118ebcf2bd0b9
c992a95469ccefdbb21f37f35c106f4f0b9c23ff
/config/src/main/java/org/hyperledger/besu/config/GoQuorumOptions.java
5e80649b157971e4867ef70378a4e70144845965
[ "Apache-2.0", "LicenseRef-scancode-free-unknown" ]
permissive
matkt/besu
2db4f474ad726d8492fbd21de1ce59815edd74aa
cba7b86eca755619c1cfad37a32f376d1c1d2290
refs/heads/develop
2023-08-31T23:13:26.891388
2022-04-14T15:20:25
2022-04-14T15:20:25
219,831,062
1
0
Apache-2.0
2022-03-15T09:36:21
2019-11-05T19:12:52
Java
UTF-8
Java
false
false
1,940
java
/* * Copyright ConsenSys AG. * * 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. * * SPDX-License-Identifier: Apache-2.0 */ package org.hyperledger.besu.config; /** * Flag to determine whether we are processing in GoQuorum mode. Note that this mode is incompatible * with MainNet. */ public class GoQuorumOptions { private static final boolean GOQUORUM_COMPATIBILITY_MODE_DEFAULT_VALUE = false; private static Boolean goQuorumCompatibilityMode; public static void setGoQuorumCompatibilityMode(final boolean goQuorumCompatibilityMode) { if (GoQuorumOptions.goQuorumCompatibilityMode == null) { GoQuorumOptions.goQuorumCompatibilityMode = goQuorumCompatibilityMode; } else { throw new IllegalStateException( "goQuorumCompatibilityMode can not be changed after having been assigned"); } } public static boolean getGoQuorumCompatibilityMode() { if (goQuorumCompatibilityMode == null) { // If the quorum mode has never been set, we default it // here. This allows running individual unit tests that // query the quorum mode without having to include a // setGoQuorumCompatibilityMode call in their setup // procedure. For production use, this case is not // triggered as we set the quorum mode very early during // startup. goQuorumCompatibilityMode = GOQUORUM_COMPATIBILITY_MODE_DEFAULT_VALUE; } return goQuorumCompatibilityMode; } }
406580cd2aaf0e0eb28d4dfe62944fffbcc424dd
2154c19792ff1d89edc1d63f494d9c26655329cf
/FormValidator/src/main/java/com/primarie/service/validators/individualPerson/IndividualPersonCitizenshipValidator.java
636a199013eda59991ac372569b169d5d86374a4
[]
no_license
robertradu/Form-Application
347b778e580931c638df660b7df453b9dfa94b6f
b166671892c97257b670a87e10a39c9844270335
refs/heads/master
2020-04-05T12:00:06.433750
2018-12-10T14:04:56
2018-12-10T14:04:56
156,854,179
0
0
null
2018-12-10T14:04:57
2018-11-09T11:39:01
Java
UTF-8
Java
false
false
516
java
package com.primarie.service.validators.individualPerson; import com.primarie.service.FormValidationException; public class IndividualPersonCitizenshipValidator { private String citizenship; public IndividualPersonCitizenshipValidator(String citizenship) { this.citizenship = citizenship; } public void validate() throws FormValidationException { if (citizenship == null) { throw new FormValidationException("Error ! You must add a citizenship"); } } }
2f8c97f13c1ccf6e629c55b7a9f8d5bfb5662983
45e5b8e4d43925525e60fe3bc93dc43a04962c4a
/nodding/libs/GlassVoice/com/google/common/util/concurrent/AbstractExecutionThreadService.java
73e2881290f240000403b3de501d68b93d39d9ff
[ "BSD-3-Clause" ]
permissive
ramonwirsch/glass_snippets
1818ba22b4c11cdb8a91714e00921028751dd405
2495edec63efc051e3a10bf5ed8089811200e9ad
refs/heads/master
2020-04-08T09:37:22.980415
2014-06-24T12:07:53
2014-06-24T12:07:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,955
java
package com.google.common.util.concurrent; import com.google.common.annotations.Beta; import java.util.concurrent.Executor; import java.util.logging.Logger; @Beta public abstract class AbstractExecutionThreadService implements Service { private static final Logger logger = Logger.getLogger(AbstractExecutionThreadService.class.getName()); private final Service delegate = new AbstractService() { protected final void doStart() { AbstractExecutionThreadService.this.executor().execute(new Runnable() { // ERROR // public void run() { // Byte code: // 0: aload_0 // 1: getfield 17 com/google/common/util/concurrent/AbstractExecutionThreadService$1$1:this$1 Lcom/google/common/util/concurrent/AbstractExecutionThreadService$1; // 4: getfield 28 com/google/common/util/concurrent/AbstractExecutionThreadService$1:this$0 Lcom/google/common/util/concurrent/AbstractExecutionThreadService; // 7: invokevirtual 33 com/google/common/util/concurrent/AbstractExecutionThreadService:startUp ()V // 10: aload_0 // 11: getfield 17 com/google/common/util/concurrent/AbstractExecutionThreadService$1$1:this$1 Lcom/google/common/util/concurrent/AbstractExecutionThreadService$1; // 14: invokevirtual 36 com/google/common/util/concurrent/AbstractExecutionThreadService$1:notifyStarted ()V // 17: aload_0 // 18: getfield 17 com/google/common/util/concurrent/AbstractExecutionThreadService$1$1:this$1 Lcom/google/common/util/concurrent/AbstractExecutionThreadService$1; // 21: invokevirtual 40 com/google/common/util/concurrent/AbstractExecutionThreadService$1:isRunning ()Z // 24: istore_2 // 25: iload_2 // 26: ifeq +13 -> 39 // 29: aload_0 // 30: getfield 17 com/google/common/util/concurrent/AbstractExecutionThreadService$1$1:this$1 Lcom/google/common/util/concurrent/AbstractExecutionThreadService$1; // 33: getfield 28 com/google/common/util/concurrent/AbstractExecutionThreadService$1:this$0 Lcom/google/common/util/concurrent/AbstractExecutionThreadService; // 36: invokevirtual 42 com/google/common/util/concurrent/AbstractExecutionThreadService:run ()V // 39: aload_0 // 40: getfield 17 com/google/common/util/concurrent/AbstractExecutionThreadService$1$1:this$1 Lcom/google/common/util/concurrent/AbstractExecutionThreadService$1; // 43: getfield 28 com/google/common/util/concurrent/AbstractExecutionThreadService$1:this$0 Lcom/google/common/util/concurrent/AbstractExecutionThreadService; // 46: invokevirtual 45 com/google/common/util/concurrent/AbstractExecutionThreadService:shutDown ()V // 49: aload_0 // 50: getfield 17 com/google/common/util/concurrent/AbstractExecutionThreadService$1$1:this$1 Lcom/google/common/util/concurrent/AbstractExecutionThreadService$1; // 53: invokevirtual 48 com/google/common/util/concurrent/AbstractExecutionThreadService$1:notifyStopped ()V // 56: return // 57: astore_3 // 58: aload_0 // 59: getfield 17 com/google/common/util/concurrent/AbstractExecutionThreadService$1$1:this$1 Lcom/google/common/util/concurrent/AbstractExecutionThreadService$1; // 62: getfield 28 com/google/common/util/concurrent/AbstractExecutionThreadService$1:this$0 Lcom/google/common/util/concurrent/AbstractExecutionThreadService; // 65: invokevirtual 45 com/google/common/util/concurrent/AbstractExecutionThreadService:shutDown ()V // 68: aload_3 // 69: athrow // 70: astore_1 // 71: aload_0 // 72: getfield 17 com/google/common/util/concurrent/AbstractExecutionThreadService$1$1:this$1 Lcom/google/common/util/concurrent/AbstractExecutionThreadService$1; // 75: aload_1 // 76: invokevirtual 52 com/google/common/util/concurrent/AbstractExecutionThreadService$1:notifyFailed (Ljava/lang/Throwable;)V // 79: aload_1 // 80: invokestatic 58 com/google/common/base/Throwables:propagate (Ljava/lang/Throwable;)Ljava/lang/RuntimeException; // 83: athrow // 84: astore 4 // 86: invokestatic 62 com/google/common/util/concurrent/AbstractExecutionThreadService:access$000 ()Ljava/util/logging/Logger; // 89: getstatic 68 java/util/logging/Level:WARNING Ljava/util/logging/Level; // 92: ldc 70 // 94: aload 4 // 96: invokevirtual 76 java/util/logging/Logger:log (Ljava/util/logging/Level;Ljava/lang/String;Ljava/lang/Throwable;)V // 99: goto -31 -> 68 // // Exception table: // from to target type // 29 39 57 java/lang/Throwable // 0 25 70 java/lang/Throwable // 39 56 70 java/lang/Throwable // 58 68 70 java/lang/Throwable // 68 70 70 java/lang/Throwable // 86 99 70 java/lang/Throwable // 58 68 84 java/lang/Exception } }); } protected void doStop() { AbstractExecutionThreadService.this.triggerShutdown(); } }; public final void addListener(Service.Listener paramListener, Executor paramExecutor) { this.delegate.addListener(paramListener, paramExecutor); } protected Executor executor() { return new Executor() { public void execute(Runnable paramAnonymousRunnable) { MoreExecutors.newThread(AbstractExecutionThreadService.this.serviceName(), paramAnonymousRunnable).start(); } }; } public final Throwable failureCause() { return this.delegate.failureCause(); } public final boolean isRunning() { return this.delegate.isRunning(); } protected abstract void run() throws Exception; protected String serviceName() { return getClass().getSimpleName(); } protected void shutDown() throws Exception { } public final ListenableFuture<Service.State> start() { return this.delegate.start(); } public final Service.State startAndWait() { return this.delegate.startAndWait(); } protected void startUp() throws Exception { } public final Service.State state() { return this.delegate.state(); } public final ListenableFuture<Service.State> stop() { return this.delegate.stop(); } public final Service.State stopAndWait() { return this.delegate.stopAndWait(); } public String toString() { return serviceName() + " [" + state() + "]"; } protected void triggerShutdown() { } } /* Location: /home/phil/workspace/glass_hello_world/libs/GlassVoice-dex2jar.jar * Qualified Name: com.google.common.util.concurrent.AbstractExecutionThreadService * JD-Core Version: 0.6.2 */
84af69f264ac0cfefba786fb78b83d1ff579b08d
3f88f5f0eebd606d9d9d21cc23b3279be2495434
/app/src/main/java/ir/sircoder/sirchat/service/Singleton.java
e649a512728b507cc3f7805de97975d2fd5775a8
[]
no_license
sr-hosseyni/Chat-Android
373edc8a3897b47f4bfd8ba43640fe94f7a0fd4c
d848475392ab173ae1a667f52ada410ceb1b6080
refs/heads/master
2020-07-06T11:27:10.776634
2019-08-18T12:50:38
2019-08-18T12:50:38
203,002,290
0
0
null
null
null
null
UTF-8
Java
false
false
1,269
java
package ir.sircoder.sirchat.service; public class Singleton { private static final Singleton ourInstance = new Singleton(); private ServerInformation serverInformation; public static Singleton getInstance() { return ourInstance; } private Singleton() { } public void setServerInformation(ServerInformation serverInformation) { this.serverInformation = serverInformation; } public ServerInformation getServerInformation() { return serverInformation; } public static class ServerInformation { String username; String password; SirChatService.Server server; public ServerInformation(SirChatService.Server server, String username, String password) { this.server = server; this.username = username; this.password = password; } public String getUsername() { return username; } public String getPassword() { return password; } public SirChatService.Server getServer() { return server; } public String getHttpApiBaseURI() { return String.format("http://%s:%d/", server.address, server.httpPort); } } }
e7937fca844a93211c0891a1ac0cbd65da48ddbe
b9bfed9539ccfcbccb5158ffafbcc560268427f3
/ch7/7.1.1/src/main/java/springbook/user/dao/UserDaoJdbc.java
3d0f30397519a852d69675789c262bb7b047ce66
[]
no_license
sh92/SpringStudy-Tobi
f42694f8f2b48494d1d857a31a1066e7755d2350
016a4c4c84b6dcc41346fd8c91a75ff28eec93ba
refs/heads/master
2020-03-21T11:46:35.690938
2018-07-16T14:12:34
2018-07-16T14:12:34
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,022
java
package springbook.user.dao; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import java.util.Map; import javax.sql.DataSource; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.RowMapper; import springbook.user.domain.Level; import springbook.user.domain.User; public class UserDaoJdbc implements UserDao { private JdbcTemplate jdbcTemplate; public void setDataSource(DataSource dataSource) { this.jdbcTemplate = new JdbcTemplate(dataSource); } private Map<String, String> sqlMap; public void setSqlMap(Map<String, String> sqlMap) { this.sqlMap = sqlMap; } private RowMapper<User> userMapper = new RowMapper<User>() { public User mapRow(ResultSet rs, int rowNum) throws SQLException { User user = new User(); user.setId(rs.getString("id")); user.setName(rs.getString("name")); user.setPassword(rs.getString("password")); user.setEmail(rs.getString("email")); user.setLevel(Level.valueOf(rs.getInt("level"))); user.setLogin(rs.getInt("login")); user.setRecommend(rs.getInt("recommend")); return user; } }; public void add(User user) { this.jdbcTemplate.update(this.sqlMap.get("add"), user.getId(), user.getName(), user.getPassword(), user.getEmail(), user.getLevel().intValue(), user.getLogin(), user.getRecommend()); } public User get(String id) { return this.jdbcTemplate.queryForObject(this.sqlMap.get("get"), new Object[] { id }, this.userMapper); } public void deleteAll() { this.jdbcTemplate.update(this.sqlMap.get("deleteAll")); } public int getCount() { return this.jdbcTemplate.queryForInt(this.sqlMap.get("getCount")); } public List<User> getAll() { return this.jdbcTemplate.query(this.sqlMap.get("getAll"), this.userMapper); } public void update(User user) { this.jdbcTemplate.update(this.sqlMap.get("update"), user.getName(), user.getPassword(), user.getEmail(), user.getLevel().intValue(), user.getLogin(), user.getRecommend(), user.getId()); } }
51da80cae71efae63587b983da57e61455f1bcac
c0e9d4fc97ec1220345f5a0eefb77f01327a57b2
/testapp/src/main/java/com/ben/testapp/web/rest/errors/LoginAlreadyUsedException.java
6165cdbe326d979d0e7594f93020723a132ec1d7
[]
no_license
be369/Micro-Project
ce2420b98f85ffb8b3d4c36f8100bed4383c34b4
fd75bd4e26145e029127052b86c7e0ef2e1d5e04
refs/heads/master
2020-04-17T02:46:09.086017
2019-01-23T01:48:35
2019-01-23T01:48:35
166,141,591
2
0
null
null
null
null
UTF-8
Java
false
false
335
java
package com.ben.testapp.web.rest.errors; public class LoginAlreadyUsedException extends BadRequestAlertException { private static final long serialVersionUID = 1L; public LoginAlreadyUsedException() { super(ErrorConstants.LOGIN_ALREADY_USED_TYPE, "Login name already used!", "userManagement", "userexists"); } }
93236377e81bc7c253333600e356a3d467e78bfd
d31e09bee181e23a1fa74d34c508a0c2c44c231d
/src/SingleNumberII.java
3c9be87f0ecd9bfd3709afaf45b19b8e56c4acdc
[]
no_license
lmycd/LeetcodeJava
2cf10eab545e86069c4b922d2dd635c60b1e026a
332542db9abe00c2a963099ea084f3a9cbb39642
refs/heads/master
2020-12-02T18:11:04.495710
2017-07-12T00:40:33
2017-07-12T00:40:33
96,490,028
0
0
null
null
null
null
UTF-8
Java
false
false
495
java
/** * Created by liunian on 2017/5/3. */ public class SingleNumberII { public int singleNumber(int[] nums) { int[] base = new int[32]; int res=0; for (int i=0;i<32;i++){ for (int j=0;j<nums.length;j++){ base[i] += (nums[j]>>i)&1;// 右移i位代表此时到了第几位,位从0开始,然后判断是否为1,是1就累加,这边用与1判断 } res |=(base[i]%3)<<i; } return res; } }
2a33f1571184686c89521a3c1ad0efacf93785b3
7abb4fe3a0c4620bcb8730b9e77f6fc408103a2b
/src/com/example/lidyaaprillasiregar_163303030271/SendMessage.java
c0c93622e912a2472d0d90b19c55f60745e058fb
[]
no_license
lidyaaprillasiregar/TUGAS02
8cbd1dcbc9ecbc2d72b512ed8f4a3fc42adba3dd
beb86150258be1120dc44882028a02cf78501b01
refs/heads/master
2020-09-21T01:34:44.109338
2019-11-28T00:16:49
2019-11-28T00:16:49
224,641,945
0
0
null
null
null
null
UTF-8
Java
false
false
7,076
java
package com.example.lidyaaprillasiregar_163303030271; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.AdapterView.OnItemSelectedListener; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.EditText; import android.widget.Spinner; import android.widget.Toast; public class SendMessage extends Activity implements OnItemSelectedListener { private String TAG = SendMessage.class.getSimpleName(); private ProgressDialog pDialog; private static String contactsUrl = "http://apilearning.totopeto.com/contacts"; private static String messagesUrl = "http://apilearning.totopeto.com/messages"; private ArrayList<HashMap<String, String>> contactList; Button bkirim; EditText pesan; Spinner spinner; private String from_id, to_id, from_name; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.send_message); Intent intent = getIntent(); from_id = intent.getStringExtra("contact_id"); from_name = intent.getStringExtra("contact_name"); setTitle("Kirim Pesan"); bkirim = (Button) findViewById(R.id.btkirim); pesan = (EditText) findViewById(R.id.etpesan); spinner = (Spinner) findViewById(R.id.list_item_contact); spinner.setOnItemSelectedListener(this); bkirim.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub new postMessage().execute(); SendMessage.this.finish(); } }); } @Override public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) { HashMap<String, String> hm = contactList.get(pos); to_id = hm.get("id"); } public void onNothingSelected(AdapterView<?> parent) { } private class postMessage extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { super.onPreExecute(); // Showing progress dialog pDialog = new ProgressDialog(SendMessage.this); pDialog.setMessage("Please wait..."); pDialog.setCancelable(false); pDialog.show(); } @Override protected Void doInBackground(Void... arg0) { String post_params = null; JSONObject params = new JSONObject(); try { params.put("from_id", from_id); params.put("to_id", to_id); params.put("content", pesan.getText().toString()); post_params = params.toString(); } catch (JSONException e) { e.printStackTrace(); } HttpHandler data = new HttpHandler(); String jsonStr = data.makePostRequest(messagesUrl, post_params); Log.e(TAG, "Response from url: " + jsonStr); return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); // Dismiss the progress dialog if (pDialog.isShowing()) pDialog.dismiss(); } } private class GetContacts extends AsyncTask<Void, Void, Void> { @Override protected void onPreExecute() { super.onPreExecute(); // Showing progress dialog pDialog = new ProgressDialog(SendMessage.this); pDialog.setMessage("Please wait..."); pDialog.setCancelable(false); pDialog.show(); } @Override protected Void doInBackground(Void... arg0) { HttpHandler sh = new HttpHandler(); String jsonStr = sh.makeServiceCall(contactsUrl); Log.e(TAG, "Response from url: " + jsonStr); if (jsonStr != null) { try { JSONObject jsonObj = new JSONObject(jsonStr); JSONArray contacts = jsonObj.getJSONArray("contacts"); for (int i = 0; i < contacts.length(); i++) { JSONObject c = contacts.getJSONObject(i); String id = c.getString("id"); String name = c.getString("name"); HashMap<String, String> contact = new HashMap<String, String>(); contact.put("id", id); contact.put("name", name); contactList.add(contact); } } catch (final JSONException e) { Log.e(TAG, "Json parsing error: " + e.getMessage()); runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getApplicationContext(), "Json parsing error: " + e.getMessage(), Toast.LENGTH_LONG) .show(); } }); } } else { Log.e(TAG, "Couldn't get json from server."); runOnUiThread(new Runnable() { @Override public void run() { Toast.makeText(getApplicationContext(), "Couldn't get json from server. Check LogCat for possible errors!", Toast.LENGTH_LONG) .show(); } }); } return null; } @Override protected void onPostExecute(Void result) { super.onPostExecute(result); // Dismiss the progress dialog if (pDialog.isShowing()) pDialog.dismiss(); List<String> arrayList = new ArrayList<String>(); for(int i=0; i < contactList.size(); i++) { HashMap<String, String> hm = contactList.get(i); arrayList.add(hm.get("name")); } ArrayAdapter<String> adapter = new ArrayAdapter<String>(SendMessage.this, android.R.layout.simple_spinner_item, arrayList); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); spinner.setAdapter(adapter); } } @Override public void onResume() { super.onResume(); contactList = new ArrayList<HashMap<String, String>>(); new GetContacts().execute(); } }
008fc366462ff4a41d33994d3bb11e39856272ed
1ab537779189e0823d3d77d7eb58109581148917
/src/service/SettingsController.java
898273451d8f19010ba5347fb66115a6a46fee7d
[ "Apache-2.0" ]
permissive
januszewskijanuszek/GameTheGame
cf0a2bc426af69043ad4e7b374a57374ee44c1a3
72abf6015c97407ec98486f39c3d1bbb686946b4
refs/heads/main
2023-05-27T10:02:17.545982
2021-06-13T04:39:46
2021-06-13T04:39:46
373,333,513
0
0
null
null
null
null
UTF-8
Java
false
false
2,758
java
package service; import enums.Usable; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.fxml.Initializable; import javafx.scene.Node; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.control.CheckBox; import javafx.scene.control.Label; import javafx.scene.image.ImageView; import javafx.scene.input.MouseEvent; import javafx.scene.layout.AnchorPane; import javafx.stage.Stage; import service.animation.OptionAnimation; import service.helper.WindowChanger; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; import java.net.URL; import java.util.*; public class SettingsController implements Initializable { @FXML private Label mainTitle; @FXML private ImageView exit; @FXML private Label setting; @FXML private CheckBox checkBoxFullscreen; @FXML private AnchorPane settingsWindow; OptionAnimation optionAnimation = new OptionAnimation(); public void fullscreen(ActionEvent event){ WindowChanger.fullscreen(checkBoxFullscreen.isSelected(), settingsWindow); } public void hoverExit(){ optionAnimation.smoothScaleImage(exit, Usable.EXIT_DOOR_RED.getTexture(), Usable.EXIT_DOOR.getTexture()); setting.setText("EXIT"); } public void hoverFullscreen(){ setting.setText("Set fullscreen"); } public void clickExit(MouseEvent event) throws IOException { System.out.println("Switching to main Menu"); // Switch between window String css1 = Objects.requireNonNull(this.getClass().getResource("../style/style1.css")).toExternalForm(); // Setting css file Parent rootMain = FXMLLoader.load(Objects.requireNonNull(getClass().getResource("../scenes/MainMenu.fxml"))); Stage stageMain = (Stage) ((Node) event.getSource()).getScene().getWindow(); Scene sceneMain = new Scene(rootMain); sceneMain.getStylesheets().add(css1); stageMain.setScene(sceneMain); stageMain.show(); } @Override public void initialize(URL url, ResourceBundle resourceBundle) { File settingFile = new File("src/saves/settings.txt"); try { List<Integer> settingsList = new ArrayList<>(); Scanner scanner = new Scanner(settingFile); while(scanner.hasNextLine()){ settingsList.add(Integer.parseInt(scanner.nextLine())); } System.out.println("Fullscreen: " + settingsList.get(0)); } catch (FileNotFoundException e) { System.out.println("Save file not found!"); } System.out.println("Controller: SettingsController"); setting.setText(""); } }
891739516d31b1f6b28d9d6fd40a4afd50c1876e
52856d4c14cb08978dcc33fe7829959a1be7bc60
/clients/fci/org.panlab.software.office.model/src/main/java/FederationOffice/users/impl/UsersFactoryImpl.java
d00335edc16b636f4b64c29ec0280f8a60733ccf
[]
no_license
tubav/teagle_java
924dee0f23973feaca04fdf01338ba6e46ab96db
60aa39c807d53a63195791571af60a20255966a3
refs/heads/master
2021-01-20T02:16:41.468640
2013-03-19T09:53:47
2013-03-19T09:53:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,010
java
/** * <copyright> * </copyright> * * $Id$ */ package FederationOffice.users.impl; import FederationOffice.users.*; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EPackage; import org.eclipse.emf.ecore.impl.EFactoryImpl; import org.eclipse.emf.ecore.plugin.EcorePlugin; import FederationOffice.users.Account; import FederationOffice.users.Admin; import FederationOffice.users.OfficeCustomer; import FederationOffice.users.OfficePersonel; import FederationOffice.users.ResourcesProvider; import FederationOffice.users.TestbedDesigner; import FederationOffice.users.UsersFactory; import FederationOffice.users.UsersPackage; /** * <!-- begin-user-doc --> * An implementation of the model <b>Factory</b>. * <!-- end-user-doc --> * @generated */ public class UsersFactoryImpl extends EFactoryImpl implements UsersFactory { /** * Creates the default factory implementation. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public static UsersFactory init() { try { UsersFactory theUsersFactory = (UsersFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.panlab.org/FederationOffice/model/users"); if (theUsersFactory != null) { return theUsersFactory; } } catch (Exception exception) { EcorePlugin.INSTANCE.log(exception); } return new UsersFactoryImpl(); } /** * Creates an instance of the factory. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public UsersFactoryImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject create(EClass eClass) { switch (eClass.getClassifierID()) { case UsersPackage.ACCOUNT: return createAccount(); case UsersPackage.RESOURCES_PROVIDER: return createResourcesProvider(); case UsersPackage.TESTBED_DESIGNER: return createTestbedDesigner(); case UsersPackage.ADMIN: return createAdmin(); case UsersPackage.OFFICE_CUSTOMER: return createOfficeCustomer(); case UsersPackage.OFFICE_PERSONEL: return createOfficePersonel(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); } } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Account createAccount() { AccountImpl account = new AccountImpl(); return account; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public ResourcesProvider createResourcesProvider() { ResourcesProviderImpl resourcesProvider = new ResourcesProviderImpl(); return resourcesProvider; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public TestbedDesigner createTestbedDesigner() { TestbedDesignerImpl testbedDesigner = new TestbedDesignerImpl(); return testbedDesigner; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public Admin createAdmin() { AdminImpl admin = new AdminImpl(); return admin; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public OfficeCustomer createOfficeCustomer() { OfficeCustomerImpl officeCustomer = new OfficeCustomerImpl(); return officeCustomer; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public OfficePersonel createOfficePersonel() { OfficePersonelImpl officePersonel = new OfficePersonelImpl(); return officePersonel; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public UsersPackage getUsersPackage() { return (UsersPackage)getEPackage(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @deprecated * @generated */ @Deprecated public static UsersPackage getPackage() { return UsersPackage.eINSTANCE; } } //UsersFactoryImpl
078ccacb314e78b578da42f845747b39d4e48a2a
68581b16871c465f5bcbd6a1bfef84835c2349e5
/src/main/java/com/cosun/dao/impl/ShopDaoImpl.java
9488d62a3299483d4bfe5e82aeb0d3762d101608
[]
no_license
seanorth/lottery
92b7dde1674d23b281e8e20c9d4ca6b7595d3775
e7d25929005f712a67c9d46852621e494efbeab5
refs/heads/master
2021-01-19T08:17:07.603758
2017-05-14T01:32:04
2017-05-14T01:32:04
87,616,117
0
0
null
null
null
null
UTF-8
Java
false
false
241
java
package com.cosun.dao.impl; import org.springframework.stereotype.Repository; import com.cosun.dao.ShopDao; import com.cosun.entities.Shop; @Repository public class ShopDaoImpl extends GenericDAOImpl<Shop, Integer> implements ShopDao { }
7137ecf02d238d70478e4bb0f947766300297192
330b1260836a03ac12499b7af509c6d74b4f376a
/src/ArrayStorage.java
8fa9f1100adefed7deb0616526ef4c2437a2907a
[]
no_license
gagarina6794/basejava-check
1910a90afa9472a85d2c2c1febae4b2f54a4987d
468cf50de6f824554ebcbfd0300f25508ce706d1
refs/heads/master
2020-06-10T21:56:52.160935
2019-06-25T19:22:42
2019-06-25T19:22:42
193,763,543
0
0
null
null
null
null
UTF-8
Java
false
false
1,811
java
//import java.lang.reflect.Array; import java.util.Arrays; /** * Array based storage for Resumes */ public class ArrayStorage { private Resume[] storage = new Resume[10000]; private int elements = 0; /** * Обнуление массива */ void clear() { //Arrays.fill(storage,null); Arrays.fill(storage, 0, elements, null); elements = 0; } /** * Метод для сохранения резюме * * @param r - элемент для сохранения */ void save(Resume r) { for (int i = 0; i < elements; i++) { if (storage[i].uuid.equals(r.uuid)) { System.out.println("Элемент уже существует"); return; } } storage[elements] = r; elements++; } /** * @param uuid - метка резюме * @return резюме по его uuid */ Resume get(String uuid) { for (int i = 0; i < elements; i++) { if (storage[i].uuid.equals(uuid)) { return storage[i]; } } return null; } /** * Удаляет элемент из массива по его uuid * * @param uuid - метка резюме */ void delete(String uuid) { for (int i = 0; i < elements; i++) { if (storage[i].uuid.equals(uuid)) { storage[i] = storage[elements - 1]; storage[elements - 1] = null; elements--; } } } /** * @return array, contains only Resumes in storage (without null) */ Resume[] getAll() { return Arrays.copyOf(storage, elements); } int size() { return elements; } }
[ "hryzantema6794" ]
hryzantema6794
f9f79e24c2e69794568426a0b236fdefeca637f9
e19d1943f635004e0ac7639c4cda216faa71a3bd
/src/main/java/com/fuzzoland/BungeePortals/Tasks/SaveTask.java
e7c16819195f1fce993483113ef7296d66f58f56
[]
no_license
vemacs/BungeePortals
f48c2310f1203e1aaa08c48e7c99790de2ade68f
c35778b5bf280fe4bbbfc9afae99488e5d1e478f
refs/heads/master
2021-01-22T16:25:47.858938
2013-11-29T00:42:08
2013-11-29T00:42:08
14,789,713
0
2
null
2016-03-01T03:42:14
2013-11-29T00:36:05
Java
UTF-8
Java
false
false
447
java
package com.fuzzoland.BungeePortals.Tasks; import com.fuzzoland.BungeePortals.BungeePortals; import org.bukkit.scheduler.BukkitRunnable; public class SaveTask extends BukkitRunnable { private BungeePortals plugin; public SaveTask(BungeePortals plugin) { this.plugin = plugin; } public void run() { if (plugin.configFile.getBoolean("SaveTask.Enabled")) { plugin.savePortalsData(); } } }
9c3f386c34a774f88c814411c683233eefffd550
3ccc7862dc48a454f1b6130796442b68de24f9b7
/Main/main/Main.java
db963e98069a7197dbbc8193c4f84ed39e0fcc5d
[]
no_license
MJUCodeBox/Nibble-Computer
0ec4ef6bf69b9dbdfd22f26aa5b22ce69daf3d28
3ce10012775a60c94727769fc102d03fb8e2e7e9
refs/heads/master
2020-11-25T05:10:12.759467
2019-12-17T02:22:29
2019-12-17T02:22:29
228,513,818
0
0
null
null
null
null
UTF-8
Java
false
false
265
java
package main; import view.MainFrame; public class Main { public static void main(String[] args) { System.out.println("Penguin"); MainFrame mazFrame = new MainFrame(false); // MainFrame (boolean debug); mazFrame.init(); mazFrame.start(); } }
6d608b4883916563728bb3df38a583b062cff846
c43a81ae562c2f58096e8a6016d4e5e7b5f90e29
/src/main/java/org/javamoney/moneta/format/DefaultMonetaryAmountFormatSymbols.java
5f67e9d08dfa172f318985b9b93735ebf7872825
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
jmcabandara/jsr354-ri
ef2f7569d9f99e93acc89a931bbdd7bca6658ca8
5e931fdafc34a8fdbaf1a6848ff42c41eff1e716
refs/heads/master
2021-01-11T02:23:33.358509
2016-10-07T20:05:14
2016-10-07T20:05:14
70,969,885
1
0
null
2016-10-15T06:04:23
2016-10-15T06:04:23
null
UTF-8
Java
false
false
4,191
java
/** * Copyright (c) 2012, 2015, Credit Suisse (Anatole Tresch), Werner Keil and others by the @author tag. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. */ package org.javamoney.moneta.format; import java.io.IOException; import java.math.BigDecimal; import java.text.DecimalFormat; import java.util.Objects; import java.util.Optional; import javax.money.MonetaryAmount; import javax.money.format.AmountFormatContext; import javax.money.format.AmountFormatContextBuilder; import javax.money.format.MonetaryParseException; import org.javamoney.moneta.spi.MonetaryAmountProducer; /** * The default implementation that uses the {@link DecimalFormat} as formatter. * @author Otavio Santana */ class DefaultMonetaryAmountFormatSymbols implements MonetaryAmountFormatSymbols { static final String STYLE = "MonetaryAmountFormatSymbols"; private static final AmountFormatContext CONTEXT = AmountFormatContextBuilder.of(STYLE).build(); private final MonetaryAmountSymbols symbols; private final DecimalFormat decimalFormat; private final MonetaryAmountProducer producer; private final MonetaryAmountNumericInformation numericInformation; DefaultMonetaryAmountFormatSymbols(MonetaryAmountSymbols symbols, MonetaryAmountProducer producer) { this.symbols = symbols; this.producer = producer; this.decimalFormat = (DecimalFormat) DecimalFormat.getCurrencyInstance(); decimalFormat.setDecimalFormatSymbols(symbols.getFormatSymbol()); numericInformation = new MonetaryAmountNumericInformation(decimalFormat); } DefaultMonetaryAmountFormatSymbols(String pattern, MonetaryAmountSymbols symbols, MonetaryAmountProducer producer) { this.symbols = symbols; this.producer = producer; this.decimalFormat = new DecimalFormat(pattern, symbols.getFormatSymbol()); numericInformation = new MonetaryAmountNumericInformation(decimalFormat); } @Override public AmountFormatContext getContext() { return CONTEXT; } @Override public void print(Appendable appendable, MonetaryAmount amount) throws IOException { Objects.requireNonNull(appendable); appendable.append(queryFrom(amount)); } @Override public MonetaryAmount parse(CharSequence text) throws MonetaryParseException { Objects.requireNonNull(text); try { Number number = decimalFormat.parse(text.toString()); return producer.create(symbols.getCurrency(), number); }catch (Exception exception) { throw new MonetaryParseException(exception.getMessage(), text, 0); } } @Override public String queryFrom(MonetaryAmount amount) { return Optional .ofNullable(amount) .map(m -> decimalFormat.format(amount.getNumber().numberValue( BigDecimal.class))).orElse("null"); } @Override public MonetaryAmountSymbols getAmountSymbols() { return symbols; } @Override public MonetaryAmountNumericInformation getNumericInformation() { return numericInformation; } @Override public int hashCode() { return Objects.hash(symbols, numericInformation); } @Override public boolean equals(Object obj) { if(obj == this) { return true; } if (DefaultMonetaryAmountFormatSymbols.class.isInstance(obj)) { DefaultMonetaryAmountFormatSymbols other = DefaultMonetaryAmountFormatSymbols.class.cast(obj); return Objects.equals(other.symbols, symbols) && Objects.equals(other.numericInformation, numericInformation); } return false; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(DefaultMonetaryAmountFormatSymbols.class.getName()).append('{') .append(" numericInformation: ").append(numericInformation).append(',') .append(" symbols: ").append(symbols).append('}'); return sb.toString(); } }
a04655bdb81a0449eb20a2924e4a0a842b810d4d
894cf16eb283930425664410eecd048d8be62e61
/src/cursojava/exercicios_4/Exercicio_13.java
96cbe8e8f142da28b134d19e9e3110c12172956a
[]
no_license
brunocleanercodebrasil/curso-java-basico
5d1af9c851c79708521b2276514c986061f96429
27bbb934c57ec51bc9305205913576c493c25b3a
refs/heads/master
2021-01-10T12:55:27.443657
2016-04-27T02:30:49
2016-04-27T02:30:49
53,377,333
0
0
null
null
null
null
ISO-8859-1
Java
false
false
633
java
package cursojava.exercicios_4; import java.util.Scanner; public class Exercicio_13 { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int[] numeros = new int[10]; int soma = 0; for (int i=0; i<numeros.length; i++){ System.out.println("Digite o " + (i+1) + "º número"); numeros[i] = scan.nextInt(); if (numeros[i] % 5 == 0){ soma += numeros[i]; } } System.out.print("Número digitados: "); for(int i=0; i<numeros.length; i++){ System.out.print(numeros[i] + " "); } System.out.print("\nSoma dos números multiplos de cinco: " + soma); } }
a1e29eca5b545115d442802a7168c7c36ef34134
6573f97fbe6461f2481091d3a321e69cfaba9fd7
/tourShare-Product-Service/src/test/java/com/xmyy/product/service/impl/PtSeriesServiceImplTest.java
db4df0b47d055e12ddafb1723be6306716576d95
[]
no_license
LeeJeam/tourShare
1ce65e9602decf04e52d0bd89fe2ac754bcdce56
2c8380d3e4284ef35837ff44beecfb547007cb0d
refs/heads/master
2022-12-16T15:28:23.904487
2019-07-07T03:55:42
2019-07-07T03:55:42
195,601,846
1
1
null
2022-12-15T23:42:14
2019-07-07T02:33:28
Java
UTF-8
Java
false
false
3,026
java
package com.xmyy.product.service.impl; import com.xmyy.common.junit.BaseJUnitTest; import com.xmyy.product.dto.AttrValueDto; import com.xmyy.product.dto.SeriesAttrDto; import com.xmyy.product.dto.SeriesColorDto; import com.xmyy.product.dto.SeriesPriceDto; import com.xmyy.product.service.PtSeriesService; import com.xmyy.product.vo.ManageSeriesParam; import com.xmyy.product.vo.SeriesAddParam; import org.junit.Assert; import org.junit.Test; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; /** * Created by Simon on 2018/7/17. */ public class PtSeriesServiceImplTest extends BaseJUnitTest { @Resource private PtSeriesService ptSeriesService; @Test public void add() { SeriesAddParam params = new SeriesAddParam(); params.setCategoryId(55L); params.setCategoryId2(56L); params.setBrandId(17L); params.setName("测试商品"); params.setAlias("测试商品别名"); SeriesAttrDto attrDto = new SeriesAttrDto(); attrDto.setId(3L); attrDto.setName("属性名称"); AttrValueDto valueDto = new AttrValueDto(); valueDto.setId(4L); valueDto.setName("属性值名称"); List<AttrValueDto> attrValueDtos = new ArrayList<>(); List<SeriesAttrDto> seriesAttrDtos = new ArrayList<>(); attrValueDtos.add(valueDto); seriesAttrDtos.add(attrDto); params.setAttrItem(seriesAttrDtos); SeriesColorDto colorDto = new SeriesColorDto(); colorDto.setName("红色"); colorDto.setImage("http://test.jpg"); List<SeriesColorDto> seriesColorDtos = new ArrayList<>(); seriesColorDtos.add(colorDto); params.setColorItem(seriesColorDtos); SeriesPriceDto priceDto = new SeriesPriceDto(); priceDto.setRegion("美国"); SeriesPriceDto pd = new SeriesPriceDto(); SeriesPriceDto.Shop shop = pd.new Shop(); shop.setShop("纽约免税店"); shop.setPrice(new BigDecimal(110)); List<SeriesPriceDto.Shop> shops = new ArrayList<>(); shops.add(shop); priceDto.setShops(shops); List<SeriesPriceDto> priceDtos = new ArrayList<>(); priceDtos.add(priceDto); params.setPriceItem(priceDtos); Object add = ptSeriesService.add(params); Assert.assertEquals(1,add); } @Test public void getList() { Long categoryId=55L; Long categoryId2=56L; Long brandId=17L; Object list = ptSeriesService.getList(categoryId, categoryId2, brandId); System.out.println(list); } @Test public void queryManagerPtSeriesList() { ManageSeriesParam param=new ManageSeriesParam(); Object object= ptSeriesService.queryManagerPtSeriesList(param); Assert.assertNotNull(object); } @Test public void statistic() { Object statistic = ptSeriesService.statistic(); System.out.println(statistic); } }
ab1bbbef316069ecbdb9985836f99d71883974e1
a40158fb68b46ba47951cd59d4d92bfc108ead3c
/app/src/main/java/com/example/ibra/sharedpreferences/Activityb.java
566e145167ca05b2b56064aa2b8bd4c7713d40c6
[]
no_license
ibrahim3zema/SharedPreferences
b6efd936b082d940bc0e4484c41d871200728715
75cf727a473a07b0d536a496fc68004c412b9b1d
refs/heads/master
2021-01-10T10:15:42.260273
2016-03-15T14:30:20
2016-03-15T14:30:20
53,950,934
0
0
null
null
null
null
UTF-8
Java
false
false
1,401
java
package com.example.ibra.sharedpreferences; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.TextView; import android.widget.Toast; public class Activityb extends AppCompatActivity { TextView username , password; String DEFAULT="N/A"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_b); username= (TextView) findViewById(R.id.username); password=(TextView)findViewById(R.id.password); } public void previous(View view) { Intent i = new Intent(this,MainActivity.class); startActivity(i); } public void load(View view) { SharedPreferences preferences =getSharedPreferences("MyData", Context.MODE_PRIVATE); String name=preferences.getString("name", DEFAULT); String pass=preferences.getString("password",DEFAULT); if(name.equals(DEFAULT)||pass.equals(DEFAULT)){ Toast.makeText(this,"error Data",Toast.LENGTH_LONG).show(); } else { username.setText(name); password.setText(pass); Toast.makeText(this,"Loaded Data",Toast.LENGTH_LONG).show(); } } }
a58febcaf5f7969b8a40a4a5f34140b2c5b6538a
bc09075c01175abb95f2e3bb34c75eff35839dc5
/mobile/src/main/java/com/styx/steer/Client/DrawPathSvg/SvgHelper.java
69735195b87a31ac82de692fe1c10ddf701a870c
[]
no_license
risalkn/Steer
43881e3e168b338c9351dea192c2cda7ca04fbd4
1f63f1452f30d98d81d26139aa6dfb96d04c4893
refs/heads/master
2021-06-01T18:12:38.420680
2016-08-12T03:22:29
2016-08-12T03:22:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,082
java
package com.styx.steer.Client.DrawPathSvg; import android.content.Context; import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Path; import android.graphics.PathMeasure; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Region; import android.util.Log; import com.caverock.androidsvg.PreserveAspectRatio; import com.caverock.androidsvg.SVG; import com.caverock.androidsvg.SVGParseException; import java.util.ArrayList; import java.util.List; public class SvgHelper { private static final String LOG_TAG = "SVG"; private final List<SvgPath> mPaths = new ArrayList<SvgPath>(); private final Paint mSourcePaint; private SVG mSvg; public SvgHelper(Paint sourcePaint) { mSourcePaint = sourcePaint; } public void load(Context context, int svgResource) { if (mSvg != null) return; try { mSvg = SVG.getFromResource(context, svgResource); mSvg.setDocumentPreserveAspectRatio(PreserveAspectRatio.UNSCALED); } catch (SVGParseException e) { Log.e(LOG_TAG, "Could not load specified SVG resource", e); } } public List<SvgPath> getPathsForViewport(final int width, final int height) { mPaths.clear(); Canvas canvas = new Canvas() { private final Matrix mMatrix = new Matrix(); @Override public int getWidth() { return width; } @Override public int getHeight() { return height; } @Override public void drawPath(Path path, Paint paint) { Path dst = new Path(); //noinspection deprecation getMatrix(mMatrix); path.transform(mMatrix, dst); mPaths.add(new SvgPath(dst, new Paint(mSourcePaint))); } }; RectF viewBox = mSvg.getDocumentViewBox(); float scale = Math.min(width / viewBox.width(), height / viewBox.height()); canvas.translate( (width - viewBox.width() * scale) / 2.0f, (height - viewBox.height() * scale) / 2.0f); canvas.scale(scale, scale); mSvg.renderToCanvas(canvas); return mPaths; } public static class SvgPath { private static final Region sRegion = new Region(); private static final Region sMaxClip = new Region( Integer.MIN_VALUE, Integer.MIN_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE); public final Path path; public final Paint paint; public final float length; public final Rect bounds; public SvgPath(Path path, Paint paint) { this.path = path; this.paint = paint; PathMeasure measure = new PathMeasure(path, false); this.length = measure.getLength(); sRegion.setPath(path, sMaxClip); bounds = sRegion.getBounds(); } } }
31a2bcb7a71db988daab7df18e6721a62da24f19
84ad8058dfc22d003b56ac0448385d928faca87f
/testodd1.java
f63188978e3ea2694ddcc175cf368a8485d40c1b
[]
no_license
Sanjaykumar74/JavaCodes
f1dec353038c5d29a649e1084678c0277ff31008
4630bece58320eafd3d8e693c34cc2024eea85a9
refs/heads/main
2023-09-04T05:51:22.368715
2021-09-26T14:47:27
2021-09-26T14:47:27
410,558,966
2
0
null
null
null
null
UTF-8
Java
false
false
558
java
import java.util.Scanner; public class Testodd1 { public static void main(String args[]) { int num, i; Scanner sc = new Scanner(System.in); for (i = 1; i <= 10; i++) { System.out.println("Enter the number:"); num = sc.nextInt(); if (num % 2 == 0) { System.out.println("This number is even:"); } else { System.out.println("This number is odd:"); } } } }
7e34182c97c81d7ef39b4801f7ae732873f95a34
fbe16ae31be7ba322903adaa3f37a061510d6efe
/jsweb-octubre-8/app-service/src/main/java/ar/com/educacionit/abm/NuevoProductoMain.java
a7bbb598c936999411a567ec7b75ca4286587199
[]
no_license
Hernan1008/Octubre
cba47424669ffe314f381ae81c2f7199c881edb3
86ca4ccc7452ce3aeacafba2d6e0570edb7ec00b
refs/heads/master
2023-03-05T00:30:16.001758
2021-02-12T00:25:49
2021-02-12T00:25:49
338,188,502
0
0
null
null
null
null
UTF-8
Java
false
false
805
java
package ar.com.educacionit.abm; import ar.com.educacionit.domain.Producto; import ar.com.educacionit.service.ProductoService; import ar.com.educacionit.service.exceptions.ServiceException; public class NuevoProductoMain { public static void main(String[] args) { String codigo = "001"; String titulo = "Termo"; Float precio = 1500f; Long tipoProducto = 1l;//celulares Producto productoAGrabar = new Producto(codigo, titulo, precio, tipoProducto); ProductoService productoService = new ProductoService(); try { Producto productoGrabado = productoService.nuevoProducto(productoAGrabar); System.out.println("Producto Grabado: " + productoGrabado.getCodigo()); } catch (ServiceException e) { e.printStackTrace(); } System.out.println("Fin del programa"); } }