blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
332
content_id
stringlengths
40
40
detected_licenses
listlengths
0
50
license_type
stringclasses
2 values
repo_name
stringlengths
7
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
557 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
77.7k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
82 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
7
5.41M
extension
stringclasses
11 values
content
stringlengths
7
5.41M
authors
listlengths
1
1
author
stringlengths
0
161
260c95954ef3e7e76c46b1ba99795016f1514ba3
e4c74772d3854002344e18fcbc2c97199c4404fa
/Project/gliter_project/src/main/java/com/gliter/app/service/LoginService.java
ca0185345d3dbf207c97d87773cf6ab27290b505
[]
no_license
NawshadSayyed/gliterDemo
0664a59ba8da2ca0bfca5c6a5ab0ee68ca44bf93
42321d129a0caa025cf98ebb6e9c4fe4350ea64f
refs/heads/master
2022-12-27T14:04:54.675707
2020-06-16T08:27:09
2020-06-16T08:27:09
199,308,008
0
0
null
2022-12-16T00:58:00
2019-07-28T15:58:35
JavaScript
UTF-8
Java
false
false
155
java
package com.gliter.app.service; import com.gliter.app.model.loginmodel; public interface LoginService { public boolean getLoginService(loginmodel lm); }
[ "sayyed.ali91@rediffmail.com" ]
sayyed.ali91@rediffmail.com
2abaae71d42091225d1bf3c99330b69aa333ebac
26988c39ed4613ae991b6f02c64d6fc624fc1e31
/app/src/main/java/com/h2byte/h2icons/ui/fragments/IconFragment.java
f38388a320d7754745265c93f0b5661c437ab76f
[ "MIT" ]
permissive
overcache/H2Icons
dd01d1b7db55e53262cee5dd1f8a5221a94bb6fa
3b2cb70f619c3eac9d6deaf917fabb5e7717d429
refs/heads/master
2021-06-01T18:05:38.285197
2015-11-02T08:36:35
2015-11-02T08:36:35
45,379,988
0
1
null
null
null
null
UTF-8
Java
false
false
1,938
java
package com.h2byte.h2icons.ui.fragments; import android.graphics.Point; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.Display; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.h2byte.h2icons.R; import com.h2byte.h2icons.adapters.IconsAdapter; import com.h2byte.h2icons.others.SpacesItemDecoration; /** * Created by architjn on 28/07/15. */ public class IconFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.icon_fragment, container, false); Display display = getActivity().getWindowManager().getDefaultDisplay(); Point size = new Point(); display.getSize(size); int numOfRows = (int) (size.x / getResources().getDimension(R.dimen.size_of_grid_item)); RecyclerView gridview = (RecyclerView) view.findViewById(R.id.icons_rv); GridLayoutManager layoutManager = new GridLayoutManager(view.getContext(), numOfRows); layoutManager.setOrientation(LinearLayoutManager.VERTICAL); layoutManager.scrollToPosition(0); gridview.setLayoutManager(layoutManager); gridview.setHasFixedSize(true); gridview.addItemDecoration(new SpacesItemDecoration(10, 5)); gridview.setAdapter(new IconsAdapter(view.getContext(), getArguments().getInt("iconsArrayId", 0))); return view; } // public int dpToPx(Context context, int dp) { // DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics(); // int px = Math.round(dp * (displayMetrics.xdpi / DisplayMetrics.DENSITY_DEFAULT)); // return px; // } }
[ "luzuoqing@gmail.com" ]
luzuoqing@gmail.com
4351781b4d5009f13b464dbb0858c3a26f3fd792
583a860d5054d610f7dd1df256d5e12eb8608c6c
/Centro Acopio/src/main/java/com/pe/centroacopio/dao/impl/ProductApplicationDaoImpl.java
2323a6407489be478637487f1ca26b7a382898ba
[]
no_license
jose-teclalabs/Centro-Acopio
d1453ec8dbe1645bcac5ee8a04eb6be293020413
d4b5889b4e902fe6ad4682ad7cedde42c945c681
refs/heads/master
2020-04-05T23:48:24.483633
2015-08-10T00:00:41
2015-08-10T00:00:41
40,454,486
0
0
null
null
null
null
UTF-8
Java
false
false
4,717
java
package com.pe.centroacopio.dao.impl; import java.io.Serializable; import java.util.List; import org.hibernate.SQLQuery; import org.hibernate.SessionFactory; import org.hibernate.transform.Transformers; import org.hibernate.type.StandardBasicTypes; import org.springframework.transaction.annotation.Transactional; import com.pe.centroacopio.dao.ProductApplicationDao; import com.pe.centroacopio.model.ProductDTO; import com.pe.centroacopio.model.ProductApplicationDTO; import com.pe.centroacopio.pojo.Application; import com.pe.centroacopio.pojo.Product; import com.pe.centroacopio.pojo.ProductApplication; import com.pe.centroacopio.pojo.ApplicationProduct; public class ProductApplicationDaoImpl implements ProductApplicationDao,Serializable { private static final long serialVersionUID = 1L; private SessionFactory sessionFactory; public SessionFactory getSessionFactory() { return sessionFactory; } public void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } @Transactional @Override public List getAllProductApllications(ProductDTO pro) { String sql = "SELECT distinct * FROM product_application WHERE prod_id = :id and prap_status = 1 order by prap_id "; SQLQuery query = getSessionFactory().getCurrentSession().createSQLQuery(sql); query.setParameter("id", pro.getProdId()); query.addEntity(ProductApplicationDTO.class); List results = query.list(); return results; } @Override public ProductApplication buscarPorIdProductApplication(ProductApplicationDTO productApplication) { try{ System.out.println("ESTOY EN EL DAO " + productApplication.toString()); String sql = "SELECT prap_id as prapId FROM product_application WHERE prap_id = :id "; SQLQuery query =getSessionFactory().getCurrentSession().createSQLQuery(sql); query.setParameter("id", productApplication.getPrapId()); query.addScalar("prapId",StandardBasicTypes.INTEGER); query.setResultTransformer(Transformers.aliasToBean(ProductApplication.class)); return (ProductApplication) query.uniqueResult(); }catch (Exception e){ System.out.println("EROR EN EL DAO " + e); return null; } } @Override public void addProductApplication(ProductApplicationDTO productApplication) { System.out.println("ESTOY EN EL DAO " + productApplication.toString()); getSessionFactory().getCurrentSession().save(productApplication); } @Override public void eliminarProductoApplication(ProductApplicationDTO productApplication) { try{ System.out.println("ESTOY EN EL DAO " + productApplication.toString()); String sql = "UPDATE product_application SET prap_status = 0 WHERE prap_id = :id"; SQLQuery query = getSessionFactory().getCurrentSession().createSQLQuery(sql); query.setInteger("id", productApplication.getPrapId()); query.executeUpdate(); System.out.println("EL DAO DEVUELVE " + productApplication.toString()); }catch(Exception e ){ System.out.println(e); } } @Transactional @Override public List getAllTipsAndApplications() { StringBuilder sql = new StringBuilder(); sql.append("SELECT DISTINCT pro.prod_description as producto, ap.appl_description as aplicacion, ti.tip_description as tip "); sql.append("FROM product_application prap,application ap, tip ti, product pro , product_tip poti "); sql.append("WHERE prap.prod_id = 3 and poti.prod_id =3 AND prap.prod_id = pro.prod_id and poti.prod_id = pro.prod_id "); SQLQuery query = getSessionFactory().getCurrentSession().createSQLQuery(sql.toString()); query.addScalar("producto",StandardBasicTypes.STRING); query.addScalar("beneficios",StandardBasicTypes.STRING); query.addScalar("aplicacion",StandardBasicTypes.STRING); query.addScalar("tip",StandardBasicTypes.STRING); query.setResultTransformer(Transformers.aliasToBean(ApplicationProduct.class)); return (List) query.list(); } @Override public void addProductoAndTip(ProductApplicationDTO productApplication) { try{ System.out.println("ESTOY EN EL DAO " + productApplication.toString()); String sql = "INSERT INTO product_application (prod_id, tip_id,prap_status,prap_status) VALUES (:prodId,:tipId,:prapStatus,:prapDate) "; SQLQuery query = getSessionFactory().getCurrentSession().createSQLQuery(sql); query.setParameter("prodId", productApplication.getProduct().getProdId()); query.setParameter("tipId", productApplication.getTip().getTipId()); query.setParameter("prapStatus", productApplication.getStatus()); query.setParameter("prapDate", productApplication.getPrapDate()); query.executeUpdate(); System.out.println("EL DAO DEVUELVE " + productApplication.toString()); }catch(Exception e ){ System.out.println(e); } } }
[ "j.pulidomurgagithub@gmail.com" ]
j.pulidomurgagithub@gmail.com
8d1abb19717efad0514d37f58535d2008dade7a5
39fc45f1cfbc65fc6d1f8b8a3fb01f2f922b47a0
/src/main/java/bet_at_university/startupData/MatchData.java
ad614f7c73484c819abaa353ae98f44c8c0bf64f
[]
no_license
kostek888888/bet-at-university
5186555024578bcb8efd0b8db9b46a5562b3bdca
92cdf73d305052909645d269a31aa7b4cfd7133b
refs/heads/master
2021-03-30T18:07:21.996321
2018-06-19T09:08:59
2018-06-19T09:08:59
123,486,457
1
0
null
null
null
null
UTF-8
Java
false
false
3,099
java
package bet_at_university.startupData; import bet_at_university.database.model.Match; import bet_at_university.database.model.Team; import bet_at_university.database.repository.MatchRepository; import bet_at_university.database.repository.TeamRepository; import org.json.JSONArray; import org.json.JSONObject; import org.springframework.scheduling.annotation.Scheduled; import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.Instant; import java.util.ArrayList; import java.util.Date; import java.util.Random; import java.util.Scanner; public class MatchData { private ArrayList<Team> teamArrayList = new ArrayList<>(); private URL url; private Scanner scanner; private String json; public void addMatch( MatchRepository matchRepository, TeamRepository teamRepository) throws IOException { Match match = new Match(); teamArrayList = (ArrayList<Team>) teamRepository.findAll(); url = new URL("http://api.football-data.org/v1/competitions/467/fixtures"); scanner = new Scanner(url.openStream()); json = scanner.nextLine(); JSONObject jsonObject = new JSONObject(json); JSONArray jsonArray = jsonObject.getJSONArray("fixtures"); for(int i =0; i<48; i++){ JSONObject jsonMatch = jsonArray.getJSONObject(i); JSONObject jsonMatchResult = jsonArray.getJSONObject(i).getJSONObject("result"); match.setId(i+1); match.setMatchDateAndTime(jsonMatch.getString("date").substring(0, 10)+" "+jsonMatch.getString("date").substring(11, 16)); if(jsonMatch.getString("homeTeamName").equals(null) || jsonMatch.getString("awayTeamName").equals(null)){ match.setHomeTeamId(null); match.setAwayTeamId(null); } else { for(int j=0; j<32; j++){ if(teamArrayList.get(j).getName().equals(jsonMatch.getString("homeTeamName"))){ match.setHomeTeamId(teamArrayList.get(j)); break; } } for(int k=0; k<32; k++){ if(teamArrayList.get(k).getName().equals(jsonMatch.getString("awayTeamName"))){ match.setAwayTeamId(teamArrayList.get(k)); break; } } } if(jsonMatchResult.get("goalsHomeTeam").toString().equals("null") || jsonMatchResult.get("goalsAwayTeam").toString().equals("null")){ match.setHomeTeamScore(-1); match.setAwayTeamScore(-1); } else { match.setHomeTeamScore(Integer.parseInt(jsonMatchResult.get("goalsHomeTeam").toString())); match.setAwayTeamScore(Integer.parseInt(jsonMatchResult.get("goalsAwayTeam").toString())); } matchRepository.save(match); } } }
[ "pawel14157@gmail.com" ]
pawel14157@gmail.com
48d7cc1e577c325872fffad18485ac7cb667f54d
3da833a866ad25af05bbd154caee63e1b2febe55
/src/Main.java
649f5b7fac7c8b066e830fe476c84ee5b4e69f7b
[]
no_license
Mikeacino/OraclProduction
6e0eec115f03904f74661e8a850512eb865a1da6
d88067206a4c6563dc0b403a84885af491d5e5a1
refs/heads/master
2020-03-30T07:24:51.560214
2018-12-10T02:02:35
2018-12-10T02:02:35
150,937,917
0
0
null
null
null
null
UTF-8
Java
false
false
1,484
java
import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { public static void main(String[] args) { // Write one line of code to create an ArrayList of products ArrayList<Product> productsArray;// = new ArrayList(); // Write one line of code to call testCollection and assign the result to the ArrayList productsArray = testCollection(); // Write one line of code to sort the ArrayList Collections.sort(productsArray); // Call the print method on the ArrayList System.out.print(productsArray); } // Step 15 // Complete the header for the testCollection method here public static ArrayList testCollection() { AudioPlayer a1 = new AudioPlayer("iPod Mini", "MP3"); AudioPlayer a2 = new AudioPlayer("Walkman", "WAV "); MoviePlayer m1 = new MoviePlayer("DBPOWER MK101", new Screen(" 720x480", 40, 22), MonitorType.LCD); MoviePlayer m2 = new MoviePlayer("Pyle PDV156BK", new Screen("1366x768", 40, 22), MonitorType.LED); // Write one line of code here to create the collection ArrayList products = new ArrayList(); products.add(a1); products.add(a2); products.add(m1); products.add(m2); return products; } // Step 16 // Create print method here public static void print(ArrayList<Product> productArray2) { for (int i = 1; i < productArray2.size(); i++) { System.out.println(productArray2.get(i).getClass()); } } }
[ "32168280+Mikeacino@users.noreply.github.com" ]
32168280+Mikeacino@users.noreply.github.com
1ca7733e0b45f7a7f8cb2bfd3546d82400b3ee4a
80cc291f2f473eb3d91f4be8bf4daa5eaf80dd4c
/src/Coin_Change.java
438781c9f57177f558d5ed5ca6e6a38208dac4e5
[]
no_license
Udevgn/JAVAprojects
d7537acabf03a86f6b8a09e269e4f08eb39500d6
6261e6541d9e96c8d65014c19995361b81325b07
refs/heads/master
2021-01-22T03:54:48.986128
2018-11-22T13:58:02
2018-11-22T13:58:02
81,477,728
0
0
null
null
null
null
UTF-8
Java
false
false
703
java
import java.util.*; import java.lang.*; import java.io.*; class GFG { public static void main (String[] args) { Scanner in = new Scanner(System.in); int T = in.nextInt(); for(int t=0;t<T;t++){ int N = in.nextInt(); int coin_val[] = new int[N]; for(int i=0;i<N;i++) coin_val[i] = in.nextInt(); int M = in.nextInt(); int Dp[] = new int[M+1]; Arrays.sort(coin_val); Dp[0]= 1; for(int i=0;i<=M;i++) { if(i%coin_val[0]==0) Dp[i]=1; } for(int i=1;i<N;i++){ for(int j=1;j<=M;j++){ if(j>=coin_val[i]) Dp[j] += Dp[j-coin_val[i]]; } } System.out.println(Dp[M]); } } }
[ "utkarshdevgan@yahoo.com" ]
utkarshdevgan@yahoo.com
358bf73e0f26e24e57c5054a5b4c80a3894b0d4a
352904da408439ed6ec7b30d85ab6c10aaf68600
/src/java/org/ariose/model/SubsRequestLog6.java
42abdf43e94c8415d0d25a44266573e52b28ff48
[]
no_license
rahullfo/TEAM
bf08a5899c0e089e55f92556b10c2b1103da898a
9a1e63905e688573b6ac9f566c1839ba542bbdd3
refs/heads/master
2016-09-05T11:06:31.874928
2013-07-15T12:42:59
2013-07-15T12:42:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
158
java
package org.ariose.model; /* * @author manup:28Apr09 */ public class SubsRequestLog6 extends SubsRequestLog{ public SubsRequestLog6() { super(); } }
[ "rahul.tripathi@ariosesoftware.com" ]
rahul.tripathi@ariosesoftware.com
9a59556663754c51ef496254eb7cc74e70748e73
ffd71a81f9611131576e239d95a2381dd401ed16
/glm/src/org/cougaar/glm/ldm/asset/ClassVIIIMedical.java
74764f0a634b33a5d02bd99932b31b56c853fa7a
[]
no_license
djw1149/cougaar-glm
8deb767a74054dc3f65cc4b9389cb09730f25d85
58fe71eb3ed9369425d49a89b50d18f206cbd740
refs/heads/master
2020-02-26T14:50:56.634638
2012-06-12T19:09:28
2012-06-12T19:09:28
40,079,668
0
1
null
null
null
null
UTF-8
Java
false
false
5,638
java
/* * <copyright> * * Copyright 1997-2012 Raytheon BBN Technologies * under partial sponsorship of the Defense Advanced Research Projects * Agency (DARPA). * * You can redistribute this software and/or modify it under the * terms of the Cougaar Open Source License as published on the * Cougaar Open Source Website (www.cougaar.org). * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * </copyright> */ /* @generated Wed Jun 06 08:28:40 EDT 2012 from alpassets.def - DO NOT HAND EDIT */ package org.cougaar.glm.ldm.asset; import org.cougaar.planning.ldm.asset.*; import java.io.ObjectOutputStream; import java.io.ObjectInputStream; import java.io.IOException; import java.util.Vector; import java.beans.PropertyDescriptor; import java.beans.IndexedPropertyDescriptor; import java.beans.IntrospectionException; public class ClassVIIIMedical extends PhysicalAsset { public ClassVIIIMedical() { myPackagePG = null; } public ClassVIIIMedical(ClassVIIIMedical prototype) { super(prototype); myPackagePG=null; } /** For infrastructure only - use org.cougaar.core.domain.Factory.copyInstance instead. **/ public Object clone() throws CloneNotSupportedException { ClassVIIIMedical _thing = (ClassVIIIMedical) super.clone(); if (myPackagePG!=null) _thing.setPackagePG(myPackagePG.lock()); return _thing; } /** create an instance of the right class for copy operations **/ public Asset instanceForCopy() { return new ClassVIIIMedical(); } /** create an instance of this prototype **/ public Asset createInstance() { return new ClassVIIIMedical(this); } protected void fillAllPropertyGroups(Vector v) { super.fillAllPropertyGroups(v); { Object _tmp = getPackagePG(); if (_tmp != null && !(_tmp instanceof Null_PG)) { v.addElement(_tmp); } } } private transient PackagePG myPackagePG; public PackagePG getPackagePG() { PackagePG _tmp = (myPackagePG != null) ? myPackagePG : (PackagePG)resolvePG(PackagePG.class); return (_tmp == PackagePG.nullPG)?null:_tmp; } public void setPackagePG(PropertyGroup arg_PackagePG) { if (!(arg_PackagePG instanceof PackagePG)) throw new IllegalArgumentException("setPackagePG requires a PackagePG argument."); myPackagePG = (PackagePG) arg_PackagePG; } // generic search methods public PropertyGroup getLocalPG(Class c, long t) { if (PackagePG.class.equals(c)) { return (myPackagePG==PackagePG.nullPG)?null:myPackagePG; } return super.getLocalPG(c,t); } public PropertyGroupSchedule getLocalPGSchedule(Class c) { return super.getLocalPGSchedule(c); } public void setLocalPG(Class c, PropertyGroup pg) { if (PackagePG.class.equals(c)) { myPackagePG=(PackagePG)pg; } else super.setLocalPG(c,pg); } public void setLocalPGSchedule(PropertyGroupSchedule pgSchedule) { super.setLocalPGSchedule(pgSchedule); } public PropertyGroup removeLocalPG(Class c) { PropertyGroup removed = null; if (PackagePG.class.equals(c)) { removed=myPackagePG; myPackagePG=null; } else { removed=super.removeLocalPG(c); } return removed; } public PropertyGroup removeLocalPG(PropertyGroup pg) { Class pgc = pg.getPrimaryClass(); if (PackagePG.class.equals(pgc)) { PropertyGroup removed=myPackagePG; myPackagePG=null; return removed; } else {} return super.removeLocalPG(pg); } public PropertyGroupSchedule removeLocalPGSchedule(Class c) { { return super.removeLocalPGSchedule(c); } } public PropertyGroup generateDefaultPG(Class c) { if (PackagePG.class.equals(c)) { return (myPackagePG= new PackagePGImpl()); } else return super.generateDefaultPG(c); } // dumb serialization methods private void writeObject(ObjectOutputStream out) throws IOException { out.defaultWriteObject(); if (myPackagePG instanceof Null_PG || myPackagePG instanceof Future_PG) { out.writeObject(null); } else { out.writeObject(myPackagePG); } } private void readObject(ObjectInputStream in) throws ClassNotFoundException, IOException { in.defaultReadObject(); myPackagePG=(PackagePG)in.readObject(); } // beaninfo support private static PropertyDescriptor properties[]; static { try { properties = new PropertyDescriptor[1]; properties[0] = new PropertyDescriptor("PackagePG", ClassVIIIMedical.class, "getPackagePG", null); } catch (IntrospectionException ie) {} } public PropertyDescriptor[] getPropertyDescriptors() { PropertyDescriptor[] pds = super.getPropertyDescriptors(); PropertyDescriptor[] ps = new PropertyDescriptor[pds.length+1]; System.arraycopy(pds, 0, ps, 0, pds.length); System.arraycopy(properties, 0, ps, pds.length, 1); return ps; } }
[ "djw@bbn.com" ]
djw@bbn.com
aaa81b57745e72b8a58ec97ccf1cafc019d85433
12094b275f0b1eb8b3d8ba8e8c4bab59d8755303
/src/java/awt/event/ActionPerformed.java
08e989a6cbd86aaa76c9cd3f60f982ebfabe823c
[]
no_license
JosephBonilla18/Tutorial-De-JAVA
c2e744a3fbc03744964aa8d368f11dc68e2d1425
067fe290ac5d32ca9bfb8cdf8e6c290b299c1258
refs/heads/master
2023-08-20T13:56:53.888724
2021-10-14T22:23:11
2021-10-14T22:23:11
417,298,192
0
0
null
null
null
null
UTF-8
Java
false
false
280
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 java.awt.event; /** * * @author Usuario X */ public class ActionPerformed { }
[ "joseph.bonilla200418@gmail.com" ]
joseph.bonilla200418@gmail.com
2ae9479135e899a3dd76c532d09825f3f4f5cd60
7ced4b8259a5d171413847e3e072226c7a5ee3d2
/Workspace/G4G Practice/Recursion/IsArraySorted.java
d94e083a5f18afbc6d3e1f71588295fadc7e932b
[]
no_license
tanishq9/Data-Structures-and-Algorithms
8d4df6c8a964066988bcf5af68f21387a132cd4d
f6f5dec38d5e2d207fb29ad4716a83553924077a
refs/heads/master
2022-12-13T03:57:39.447650
2020-09-05T13:16:55
2020-09-05T13:16:55
119,425,479
1
1
null
null
null
null
UTF-8
Java
false
false
500
java
package RecursionClassics; public class IsArraySorted { public static void main(String[] args) { // TODO Auto-generated method stub int[] arr = { 1, 1, 2, 3, 4, 6 }; System.out.println(isSorted(arr, 0)); } private static boolean isSorted(int[] arr, int currentIndex) { // Base Case : if (currentIndex == arr.length - 1) { return true; } if (arr[currentIndex] <= arr[currentIndex + 1] && isSorted(arr, currentIndex + 1)) { return true; } else { return false; } } }
[ "tanishqsaluja18@gmail.com" ]
tanishqsaluja18@gmail.com
359d16efe7d53732411872a93807ca52d8e10bbf
ac9b86d913e91a4bbf3d3b650b9f23ca230cf24d
/Ventana_Registro.java
89c53a850206a8dc0ab3b7a5ead23b2870120548
[]
no_license
Sebas16171/pventa
7878f46b3f3b23e1edda26e66154483a47346ef7
d4f0aaac1877c999d289ee2f4be79c0eda1a40d7
refs/heads/master
2022-04-21T07:19:26.666848
2020-04-24T15:25:25
2020-04-24T15:25:25
245,290,169
0
0
null
null
null
null
UTF-8
Java
false
false
4,572
java
import javax.swing.*; import java.awt.event.*; class Ventana_Registro extends JFrame implements ActionListener{ private JFrame mainFrame; private JTextField txtNombre; private JTextField txtRFC; private JTextField txtCorreo; private JTextField txtTelefono; private JRadioButton rdCliente; private JRadioButton rdProveedor; public Ventana_Registro(){ Iniciar_Ventana(); mainFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { Nucleo.Gen_Window(); } }); } private void Iniciar_Ventana(){ mainFrame = new JFrame(); JLabel lblNombre = new JLabel("Nombre"); txtNombre = new JTextField(); lblNombre.setBounds(25, 25, 100, 30); txtNombre.setBounds(50, 50, 250, 30); JLabel lblRFC = new JLabel("RFC"); txtRFC = new JTextField(); lblRFC.setBounds(25, 100, 100, 30); txtRFC.setBounds(50, 125, 250, 30); JLabel lblCorreo = new JLabel("Correo"); txtCorreo = new JTextField(); lblCorreo.setBounds(25, 175, 100, 30); txtCorreo.setBounds(50, 200, 250, 30); JLabel lblTelefono = new JLabel("Telefono"); txtTelefono = new JTextField(); lblTelefono.setBounds(25, 250, 100, 30); txtTelefono.setBounds(50, 275, 250, 30); rdCliente = new JRadioButton("Cliente", true); rdCliente.setBounds(400, 50, 100, 30); rdProveedor = new JRadioButton("Proveedor", false); rdProveedor.setBounds(400, 75, 100, 30); ButtonGroup grupo1 = new ButtonGroup(); grupo1.add(rdCliente); grupo1.add(rdProveedor); JButton btnCancelar = new JButton("Cancelar"); JButton btnListo = new JButton("Listo"); btnListo.setBounds(375, 200, 150, 45); btnCancelar.setBounds(375, 250, 150, 45); btnCancelar.addActionListener(this); btnListo.addActionListener(this); mainFrame.setLayout(null); mainFrame.add(lblNombre); mainFrame.add(txtNombre); mainFrame.add(lblRFC); mainFrame.add(txtRFC); mainFrame.add(lblCorreo); mainFrame.add(txtCorreo); mainFrame.add(lblTelefono); mainFrame.add(txtTelefono); mainFrame.add(rdCliente); mainFrame.add(rdProveedor); mainFrame.add(btnListo); mainFrame.add(btnCancelar); mainFrame.setSize(600, 400); mainFrame.setTitle("Registrar"); mainFrame.setVisible(true); } @Override public void actionPerformed(ActionEvent e) { if (e.getActionCommand() == "Listo"){ String nombre = txtNombre.getText(); String rfc = txtRFC.getText(); String correo = txtCorreo.getText(); String telefono = txtTelefono.getText(); if (txtNombre.getText().isEmpty() || txtRFC.getText().isEmpty() || txtCorreo.getText().isEmpty() || txtTelefono.getText().isEmpty() ){ JOptionPane.showMessageDialog(null, "No se puede dejar ningun campo vacio.", "Error", JOptionPane.ERROR_MESSAGE); } else if (rdProveedor.isSelected() == true){ try { // ID Nombre RFC Telefono Correo Activo Proveedor temp_proveedor = new Proveedor(0, nombre, rfc, telefono, correo, true); temp_proveedor.Guarda_SQL(); Nucleo.lst_Proveedores.add(temp_proveedor); JOptionPane.showMessageDialog(null, nombre + " fue registrado exitosamente."); } catch (Exception err) { JOptionPane.showMessageDialog(null, "Error en el registro."); } }else if (rdCliente.isSelected() == true){ try { Cliente temp_cliente = new Cliente(0, nombre, rfc, telefono, correo, true); temp_cliente.Guarda_SQL(); Nucleo.lst_Clientes.add(temp_cliente); JOptionPane.showMessageDialog(null, nombre + " fue registrado exitosamente."); } catch (Exception err) { JOptionPane.showMessageDialog(null, "Error en el registro."); } } } else if (e.getActionCommand() == "Cancelar"){ mainFrame.dispose(); Nucleo.Gen_Window(); } } }
[ "secervera@hotmail.com" ]
secervera@hotmail.com
c08569685040bd9d90902d109ddde6b12af6e687
04de9af07d37e5d46a8ff9655afde85913cf8634
/src/main/java/com/project/agency/domain/Country.java
d086207789521396e191553ff17c4bd755fdd853
[]
no_license
MengaPierpaolo/agency
a31dc9cfdea3c80c2e83fce9536a477ae7d73f9e
1521f7a429fd64632f3d4951c74d2fdd6cf13007
refs/heads/master
2021-01-20T06:17:42.517628
2014-10-02T20:08:13
2014-10-02T20:08:13
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,119
java
package com.project.agency.domain; import java.io.Serializable; import java.util.Set; import javax.persistence.CascadeType; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.OneToMany; import javax.persistence.Table; import org.hibernate.annotations.Type; @Entity @Table(name = "countries") public class Country implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Type(type = "integer") private int id; @Type(type = "string") private String name; //Relationships @OneToMany(mappedBy = "country", cascade = CascadeType.ALL) private Set<City> cities; public Country() { } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public Set<City> getCities() { return cities; } public void setCities(Set<City> cities) { this.cities = cities; } }
[ "mrojas.leyva@gmail.com" ]
mrojas.leyva@gmail.com
b26db3bc92737a09713b402dfccf78220da8f9aa
f06cf1ccddaac0a1e5f7d952149c712251ca8fa5
/src/main/java/biz/juvitec/biosislite/pruebaAnio.java
cf17a0334c9ad7af5f1ad49d60a464e0a156e7a0
[]
no_license
xal0do0x/mineduBiosis
f269ee39573fe992a4b79bf9229acf0c78950fb0
e8be050d66eedb245961de7409a0e96be5b41748
refs/heads/master
2021-01-18T21:23:05.078354
2016-04-17T23:51:55
2016-04-17T23:51:55
37,963,300
0
0
null
null
null
null
UTF-8
Java
false
false
1,555
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 biz.juvitec.biosislite; import com.personal.utiles.FormularioUtil; import controladores.DepartamentoControlador; import controladores.EmpleadoControlador; import controladores.MarcacionControlador; import entidades.Departamento; import entidades.Empleado; import java.io.File; import java.io.IOException; import java.util.Calendar; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; /** * * @author RyuujiMD */ public class pruebaAnio { public static void main(String[] args) { String url = FormularioUtil.chooserFichero(null, "holi"); File file = new File(url); if(file.exists()){ System.out.println("CHEVERE"); }else{ try { file.createNewFile(); } catch (IOException ex) { Logger.getLogger(pruebaAnio.class.getName()).log(Level.SEVERE, null, ex); } System.out.println("NO TAN CHEVERE"); } System.exit(0); } public static String conCeros(int dni) { if (dni <= 9) { return "0000000" + dni; } else if (dni <= 99) { return "000000" + dni; } else if (dni <= 999) { return "00000" + dni; } else { return "0000" + dni; } } }
[ "OGEPER02@MED00335N025.minedu.local" ]
OGEPER02@MED00335N025.minedu.local
b23bd6f6fb745e7610f91c4e4a423ff146efdd6f
e11016242eb0236f9721a995423dda10839c1583
/Server/server/src/main/java/com/test/test/services/UtilisateurService.java
ac6107e6b159e07b30d6bce075f9a39142bfc07e
[]
no_license
TESTAZ-wq/main
021c61ec3f2c8721c410de4ddf506218ed051dc0
2f983f947661b05e21658dba9603dc513d827bb9
refs/heads/main
2023-04-17T20:13:31.469990
2021-05-04T13:45:01
2021-05-04T13:45:01
364,270,232
0
0
null
null
null
null
UTF-8
Java
false
false
1,146
java
package com.test.test.services; import com.test.test.model.Utilisateur; import com.test.test.repository.UtilisateurRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class UtilisateurService { private final UtilisateurRepository utilisateurRepository; @Autowired public UtilisateurService(UtilisateurRepository utilisateurRepository){ this.utilisateurRepository = utilisateurRepository; } public Utilisateur addVoiture(Utilisateur utilisateur){ return this.utilisateurRepository.save(utilisateur); } public List<Utilisateur> findAll(){ return this.utilisateurRepository.findAll(); } public Utilisateur login(String nomUtilisateur,String mdpUtilisateur) { return this.utilisateurRepository.findUtilisateurByNomUtilisateurAndMdpUtilisateur(nomUtilisateur,mdpUtilisateur); } public Utilisateur saveUser(String nomUtilisateur,String mdpUtilisateur) { return this.utilisateurRepository.save(new Utilisateur(nomUtilisateur,mdpUtilisateur)); } }
[ "uhjfafsdg@gmail.com" ]
uhjfafsdg@gmail.com
d2720f845320c1af25c87cfd7078fbd883f44ea0
91b0025f923801690d5afb22acb346079da5c1f3
/src/main/java/com/ynyes/lyz/service/TdMessageTypeService.java
7ab0a8c630919e50115c28eb8360fab7ee13e29d
[]
no_license
CrazyApeDX/leyizhuang2.0-manager
2b1401ad68d2858c2448109d00309e08d7a19b3c
d39303f603ed9d84fb3a238cf2bed44b3540174f
refs/heads/master
2021-03-16T03:29:47.775347
2018-03-30T06:06:25
2018-03-30T06:06:25
91,523,403
3
3
null
null
null
null
UTF-8
Java
false
false
1,216
java
package com.ynyes.lyz.service; import java.util.List; import javax.transaction.Transactional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort.Direction; import org.springframework.stereotype.Service; import com.ynyes.lyz.entity.TdMessageType; import com.ynyes.lyz.repository.TdMessageTypeRepo; @Service @Transactional public class TdMessageTypeService { @Autowired private TdMessageTypeRepo repository; public TdMessageType save(TdMessageType e) { if (null == e) { return null; } return repository.save(e); }; public void delete(Long id){ if(null != id){ repository.delete(id); } } public TdMessageType findOne(Long id){ if(null == id){ return null; } return repository.findOne(id); } public List<TdMessageType> findAll(){ Sort sort = new Sort(Direction.ASC,"sortId"); //zhangji 2016-1-3 15:14:30 return (List<TdMessageType>) repository.findAll(sort); } /** * 查找所有能够使用的消息类型 * @author dengxiao */ public List<TdMessageType> findByIsEnableTrueOrderBySortIdAsc(){ return repository.findByIsEnableTrueOrderBySortIdAsc(); } }
[ "417467928@qq.com" ]
417467928@qq.com
517ef97d31aa03bfb6b6a2fbb627887ff2b7c9f0
13a1c4d315bbf8da067b0856b8d79449ee9621c4
/app/src/main/java/wiki/scene/shop/ui/mine/model/CashModel.java
8dfaad9e5a78f797627d26311a33f479d99f8bb9
[]
no_license
narakai/SHOP
13bf86ac0d46b21e9685f19a89de187037a5ecdc
50bc415928093dfd8cef0eccfc0bbe1e85821a87
refs/heads/master
2021-08-30T18:47:23.281897
2017-12-19T01:46:42
2017-12-19T01:46:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,931
java
package wiki.scene.shop.ui.mine.model; import com.lzy.okgo.OkGo; import com.lzy.okgo.model.HttpParams; import com.lzy.okgo.model.Response; import java.util.List; import wiki.scene.shop.entity.BankInfo; import wiki.scene.shop.http.api.ApiUtil; import wiki.scene.shop.http.base.LzyResponse; import wiki.scene.shop.http.callback.JsonCallback; import wiki.scene.shop.http.listener.HttpResultListener; /** * 提现 * Created by scene on 2017/11/14. */ public class CashModel { public void getBankList(final HttpResultListener<List<BankInfo>> listener) { OkGo.<LzyResponse<List<BankInfo>>>get(ApiUtil.API_PRE + ApiUtil.BANK_LIST) .tag(ApiUtil.BANK_LIST_TAG) .execute(new JsonCallback<LzyResponse<List<BankInfo>>>() { @Override public void onSuccess(Response<LzyResponse<List<BankInfo>>> response) { listener.onSuccess(response.body().data); } @Override public void onError(Response<LzyResponse<List<BankInfo>>> response) { try { listener.onFail(response.getException().getMessage() != null ? response.getException().getMessage() : response.message()); } catch (Exception e) { e.printStackTrace(); listener.onFail("银行卡信息获取失败"); } } @Override public void onFinish() { super.onFinish(); listener.onFinish(); } }); } public void applyCash(HttpParams params, final HttpResultListener<String> listener) { OkGo.<LzyResponse<String>>post(ApiUtil.API_PRE + ApiUtil.APPPY_CASH) .tag(ApiUtil.APPLY_CASH_TAG) .params(params) .execute(new JsonCallback<LzyResponse<String>>() { @Override public void onSuccess(Response<LzyResponse<String>> response) { listener.onSuccess(""); } @Override public void onError(Response<LzyResponse<String>> response) { try { listener.onFail(response.getException().getMessage() != null ? response.getException().getMessage() : response.message()); } catch (Exception e) { e.printStackTrace(); listener.onFail("银行卡信息获取失败"); } } @Override public void onFinish() { super.onFinish(); listener.onFinish(); } }); } }
[ "renjunjia1" ]
renjunjia1
5703a3a572811e96f2e6045cc143998fcbfd141d
974b4e825535e6b8ef3182eba5efc817f7963ca0
/src/UI/UserScreen.java
6b6ea55c6afa80b22ea6ae9ad0cd66fd07943538
[]
no_license
ely5/CarDealership
edfa693669699e64a3fb515853085f0f3bcf050f
af54aba1e5885b3ed5b92b73ea9c02f9f2d725af
refs/heads/main
2023-03-21T15:35:32.554197
2021-03-12T03:46:14
2021-03-12T03:46:14
346,923,046
0
0
null
null
null
null
UTF-8
Java
false
false
3,341
java
package UI; import java.util.Optional; import java.util.Scanner; import db.UserDao; import model.Car; import model.Membership; import model.User; import service.CarService; import service.OfferService; import service.PaymentService; import service.UserService; public class UserScreen { UserDao ud; UserService us = new UserService(ud); protected void Execution(Scanner s) { while (true) { System.out.print("\r\nDo you have an account? (y/n) "); String str = s.nextLine().replaceAll("\\s", ""); if (str.equalsIgnoreCase("y")) { userLogin(s); } if (str.equalsIgnoreCase("n")) { createAccount(s); } } } private void userLogin(Scanner s) { while (true) { System.out.print("Please enter your username: "); String username = s.nextLine().replaceAll("\\s", ""); System.out.print("Please enter your password: "); String password = s.nextLine().replaceAll("\\s", ""); if (us.doesUsernameExist(username)){ if ((UserService.getMap().get(username).getPassword()).equals(password)) { System.out.println("Successfully logged in!"); if (UserService.getMap().get(username).getMembership().equals(Membership.CUSTOMER)) { customerScreen(s); } else { Membership m = obtainMemberShip(s); UserService.getMap().get(username).setMembership(m); Execution(s); } } } System.out.println("Invalid credentials."); break; } } private void createAccount(Scanner s) { boolean temp = true; while (temp) { System.out.print("Please create a username: "); String username = s.nextLine().replaceAll("\\s", ""); if (us.doesUsernameExist(username)) { System.out.print("Username already taken."); continue; } else { System.out.print("Please create a password: "); String password = s.nextLine().replaceAll("\\s", ""); User u = new User(username, password); System.out.println("Account created!"); UserService.getMap().put(username, u); u.setMembership(Membership.USER); temp = false; } } System.out.println(UserService.getMap()); userLogin(s); } private static Membership obtainMemberShip(Scanner s) { while (true) { System.out.print("Would you like to become a customer? (y/n) "); String str = s.nextLine().replaceAll("\\s", ""); if (str.equalsIgnoreCase("y")) { return Membership.CUSTOMER; } if (str.equalsIgnoreCase("n")) { return Membership.USER; } } } private void customerScreen(Scanner s) { System.out.println(UserService.getMap()); while(true) { System.out.println("Welcome. What operation would you like to perform?\r\n" + "'v' = view cars\r\n" + "'o' = make an offer\r\n" + "'p' = payment history\r\n" + "'e' = exit\r\n"); switch (s.nextLine().replaceAll("\\s", "")) { case "v": System.out.print(CarService.getMap()); break; case "o": System.out.print("Enter the ID number of the car you would like to make an offer for: "); Integer carID = (Integer)s.nextInt(); Car choice = CarService.getMap().get(carID); break; case "p": System.out.print("payments"); break; case "e": Execution(s); } } } }
[ "noreply@github.com" ]
noreply@github.com
a2c6eec18544f4721dd63520ce8d525ec86d58d4
982862f28b3e6c9e3b6af37eaf20d87ccf50fcd6
/android/MatualHarm/app/src/main/java/com/newind/core/WorldCoordinate.java
e0f48c683371c760fac0361b39f20b15929c0cb4
[]
no_license
nw18/tools
b1a1eb8c7efd76dcabb16d4a11fa883247e0cf77
cb7284fb1f4c31242d6bd91eebd98a8f7096d350
refs/heads/master
2023-07-06T19:47:59.923233
2023-06-30T13:40:27
2023-06-30T13:40:27
52,254,892
0
0
null
null
null
null
UTF-8
Java
false
false
2,268
java
package com.newind.core; import android.graphics.PointF; import android.graphics.RectF; /** * Created by newind on 17-4-10. */ public class WorldCoordinate { private RectF rectReal = new RectF(); private RectF rectVirtual = new RectF(); private float xScaleV2R; private float yScaleV2R; private void initScale(){ if (rectReal.width() != 0 && rectReal.height() != 0 && rectVirtual.width() != 0 && rectVirtual.height() != 0){ xScaleV2R = rectReal.width() / rectVirtual.width() ; yScaleV2R = rectReal.height() / rectVirtual.height(); } } public WorldCoordinate(){ } public WorldCoordinate(RectF rectReal,RectF rectVirtual){ this.rectReal.set(rectReal); this.rectVirtual.set(rectVirtual); initScale(); } public void setRectReal(RectF rectReal) { this.rectReal.set(rectReal); initScale(); } public void setRectVirtual(RectF rectVirtual) { this.rectVirtual.set(rectVirtual); initScale(); } public float r2v_x(float x){ x -= rectReal.left; return rectVirtual.left + x / xScaleV2R; } public float r2v_y(float y){ y -= rectReal.bottom; return rectVirtual.bottom + y / yScaleV2R; } public float v2r_x(float x){ x -= rectVirtual.left; return rectReal.left + x * xScaleV2R; } public float v2r_y(float y){ y -= rectVirtual.bottom; return rectReal.bottom + y * yScaleV2R; } public float dis_v2r_x(float x){ return x * Math.abs(xScaleV2R); } public float dis_v2r_y(float y){ return y * Math.abs(yScaleV2R); } //for action at a object. public void real2virtual(PointF from,PointF to){ to.x = r2v_x(from.x); to.y = r2v_y(from.y); } //for paint a object public void virtual2real(PointF from,PointF to){ to.x = v2r_x(from.x ); to.y = v2r_y(from.y); } //for paint a object public void virtual2real(RectF from,RectF to){ to.left = v2r_x(from.left); to.right = v2r_x(from.right); to.top = v2r_y(from.top); to.bottom = v2r_y(from.bottom); } }
[ "xf@163.com" ]
xf@163.com
cdffb11406d58f293a14effc82de0a1a34eba2b3
5970ef925e686710338d7dc5a1d254aa828ea090
/PostcodeLocationRequestReceiver/src/test/java/uk/co/keithsjohnson/postcode/location/request/receiver/PostcodeLocationRequestReceiverApplicationTest.java
210680c82f338633b3a6d4f9e86282b6054788c3
[]
no_license
keithsjohnson/PostcodeLocation
6945b6efd66eaf038d78f5465bd9b0d9c077d5ea
a3367b735abbcf99687b86da9e6d5aacf0730da5
refs/heads/master
2016-09-06T13:01:04.859368
2015-09-28T21:49:21
2015-09-28T21:49:21
40,763,290
0
0
null
null
null
null
UTF-8
Java
false
false
533
java
package uk.co.keithsjohnson.postcode.location.request.receiver; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.SpringApplicationConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @SpringApplicationConfiguration(classes = PostcodeLocationRequestReceiverApplication.class) @Ignore public class PostcodeLocationRequestReceiverApplicationTest { @Test public void contextLoads() { } }
[ "keithsjohnson@yahoo.com" ]
keithsjohnson@yahoo.com
26b6812b02eff1c799172967c567060e7d9b4b59
559ce409c6a7713fd22031ea3acb0ff19fb1e349
/src/main/java/it/windtre/tremobilitycms/ui/components/AppNavigation.java
fc877119610daec7848a400004d42d0df82be4ac
[]
no_license
algos-soft/tremobilitycms
91006ded118f00cec9f19c544e1e561fac7c4db5
1bc179270e276aa325cfb9e93cc452b4c51f6ec1
refs/heads/master
2020-04-12T20:20:51.334811
2018-12-19T15:07:58
2018-12-19T15:07:58
162,733,679
0
0
null
null
null
null
UTF-8
Java
false
false
2,253
java
package it.windtre.tremobilitycms.ui.components; import com.vaadin.flow.component.Tag; import com.vaadin.flow.component.UI; import com.vaadin.flow.component.dependency.HtmlImport; import com.vaadin.flow.component.html.Span; import com.vaadin.flow.component.icon.IronIcon; import com.vaadin.flow.component.polymertemplate.Id; import com.vaadin.flow.component.polymertemplate.PolymerTemplate; import com.vaadin.flow.component.tabs.Tab; import com.vaadin.flow.component.tabs.Tabs; import com.vaadin.flow.router.AfterNavigationEvent; import com.vaadin.flow.router.AfterNavigationObserver; import com.vaadin.flow.templatemodel.TemplateModel; import it.windtre.tremobilitycms.ui.entities.PageInfo; import java.util.ArrayList; import java.util.List; @Tag("app-navigation") @HtmlImport("src/components/app-navigation.html") public class AppNavigation extends PolymerTemplate<TemplateModel> implements AfterNavigationObserver { @Id("tabs") private Tabs tabs; private List<String> hrefs = new ArrayList<>(); private String logoutHref; private String defaultHref; private String currentHref; public void init(List<PageInfo> pages, String defaultHref, String logoutHref) { this.logoutHref = logoutHref; this.defaultHref = defaultHref; for (PageInfo page : pages) { //Tab tab = new Tab(new IronIcon(page.getCollection(), page.getIcon()), new Span(page.getTitle())); //tab.getElement().setAttribute("theme", "icon-on-top"); hrefs.add(page.getLink()); //tabs.add(tab); } tabs.addSelectedChangeListener(e -> navigate()); } private void navigate() { int idx = tabs.getSelectedIndex(); if (idx >= 0 && idx < hrefs.size()) { String href = hrefs.get(idx); if (href.equals(logoutHref)) { // The logout button is a 'normal' URL, not Flow-managed but // handled by Spring Security. UI.getCurrent().getPage().executeJavaScript("location.assign('logout')"); } else if (!href.equals(currentHref)) { UI.getCurrent().navigate(href); } } } @Override public void afterNavigation(AfterNavigationEvent event) { String href = event.getLocation().getFirstSegment().isEmpty() ? defaultHref : event.getLocation().getFirstSegment(); currentHref = href; tabs.setSelectedIndex(hrefs.indexOf(href)); } }
[ "daniele.marabese@altran.com" ]
daniele.marabese@altran.com
09a37b1e4b594b5477ee216c073ba787e1157ca1
18ddaf5abfe9e81eb917a851e25f5d53ae4744d9
/jdbc2016/src/main/java/com/test/Test.java
af09c2dfc052178deed9ff7ea27a9e18100962d9
[]
no_license
rahushkl/Jdbcpractice
a16503ca8c138d6f3cbc2e9fba3a7f4e0975af95
28988d5eb7697ac14487b39558b4418837841a4d
refs/heads/master
2021-01-21T01:43:59.299221
2016-06-22T10:07:24
2016-06-22T10:07:40
61,470,736
0
0
null
null
null
null
UTF-8
Java
false
false
130
java
package com.test; public class Test { public static void main(String[] args) { System.out.println("hello"); } }
[ "rahushkl@gmail.com" ]
rahushkl@gmail.com
8093be9589bf53678bb56458f606db08536f2e3a
2896cdecb5cd6cbf78f2bd8da085f88b902b80c4
/src/main/java/br/gov/sc/pc/pco/infra/SpringFoxConfig.java
971a2799bc4a744fac5734b39af4a1b20f01d292
[]
no_license
egrohs/pco
f41f39b10d77219c7efa9902dab1583ab5ad019b
40e987b68f3251f19bee1f3247f8746928fbd83f
refs/heads/master
2022-12-11T06:56:47.903323
2020-09-09T17:38:11
2020-09-09T17:38:11
294,185,018
0
0
null
null
null
null
UTF-8
Java
false
false
679
java
package br.gov.sc.pc.pco.infra; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; import springfox.documentation.swagger2.annotations.EnableSwagger2; @Configuration @EnableSwagger2 public class SpringFoxConfig { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()).build(); } }
[ "emanuel.grohs@serpro.gov.br" ]
emanuel.grohs@serpro.gov.br
09c8affb147fa3b3b44dec48e00ac93c49754099
0b3bc68b89fd4d123152862fd19df5db988dcf0b
/app/src/test/java/com/example/huangtao_gz/taoswiperrefreshlayout/ExampleUnitTest.java
b31244f064aaf0897585f78cc9acf096521dfa2e
[]
no_license
windwise/TaoLayout
a40d569075fd6468c46a3b6ae5c38fbb2f411c0c
81f7fa9a5ce3fc0d3590bc49318f9a9b59d07443
refs/heads/master
2021-01-20T04:22:32.198136
2017-04-29T04:00:40
2017-04-29T04:00:40
89,683,083
0
0
null
null
null
null
UTF-8
Java
false
false
424
java
package com.example.huangtao_gz.taoswiperrefreshlayout; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
[ "52367723@qq.com" ]
52367723@qq.com
4687704ef5c830954f43a65544e328572cab08a2
f2e5f0c74cca281000e5b0a47044a84b49d5cb87
/Comp401/Comp 401 Workspace/lecture12/src/lec12/ex5/Service.java
b6d53632460e4fa661c11746d347ee92c1d0da03
[]
no_license
AaronZhangGitHub/Archive
7ad351831c7d1d197471213a2b483696ee38f426
e803443d5333f7f8f99e99e257735d5440ca8df7
refs/heads/master
2021-01-16T19:06:45.637250
2017-08-12T20:49:55
2017-08-12T20:49:55
100,136,627
0
0
null
null
null
null
UTF-8
Java
false
false
676
java
package lec12.ex5; public abstract class Service { abstract public void doService(); static boolean online; static public void goOnline() { online = true; } static public void goOffline() { online = false; } static public Service getService() { if (online) { return new OnlineService(); } else { return new OfflineService(); } } } class OnlineService extends Service { protected OnlineService() { } public void doService() { System.out.println("Doing service on-line"); } } class OfflineService extends Service { protected OfflineService () { } public void doService() { System.out.println("Doing service off-line"); } }
[ "aaronz@live.unc.edu" ]
aaronz@live.unc.edu
5b33393d139b1dbf17c4fed0f42ee8699fbbb347
dfdd855d07d502da4c2b9648b0c6a9acb84f6a41
/MasterPriceList/ViewController/src/oracle/foddemo/masterpricelist/backing/AdvSearchBacking.java
d42afcd64a740bb1d63ac6413cf8a1bba94b6a37
[]
no_license
shamonoff/Test
9427acd863cb3c5553043da7b6cf91f2212c858d
f44719e5303826e3cdace0baddf70115ad6a9242
refs/heads/master
2020-12-02T07:59:06.112418
2017-07-10T09:04:32
2017-07-10T09:04:32
96,756,917
0
0
null
null
null
null
UTF-8
Java
false
false
2,385
java
package oracle.foddemo.masterpricelist.backing; import java.util.Map; import javax.faces.context.FacesContext; import oracle.adf.model.BindingContext; import oracle.adf.model.binding.DCBindingContainer; import oracle.adf.model.servlet.HttpBindingContext; import oracle.binding.AttributeBinding; import oracle.binding.BindingContainer; import oracle.binding.OperationBinding; public class AdvSearchBacking { private BindingContainer bindings; public AdvSearchBacking() { } public String searchAction() { String categoryId = null; BindingContainer searchBindings=getBindings(); //Get the values select in the WebUI AttributeBinding searchTermBinding = (AttributeBinding)searchBindings.getControlBinding("searchTerm"); String searchTerm = (String)searchTermBinding.getInputValue(); AttributeBinding categoryIdBinding = (AttributeBinding)searchBindings.getControlBinding("categoryId"); if(categoryIdBinding.getInputValue()!= null) categoryId= categoryIdBinding.getInputValue().toString(); AttributeBinding includeDiscontinuedBinding = (AttributeBinding)searchBindings.getControlBinding("includeDiscontinued"); Boolean includeDiscontinued = (Boolean)includeDiscontinuedBinding.getInputValue(); //Execute the Advanced Search operation using the ExcelEditPriceListPageDef BindingContext bctx = HttpBindingContext.getContext(null); DCBindingContainer excelBindings = bctx.findBindingContainer("ExcelPriceListPageDef"); OperationBinding operationBinding = excelBindings.getOperationBinding("executeAdvancedProductQuery"); Map opArgs = operationBinding.getParamsMap(); opArgs.put("searchTerm", searchTerm); opArgs.put("categoryId", categoryId); opArgs.put("includeDiscontinued", includeDiscontinued); operationBinding.execute(); return null; } public BindingContainer getBindings() { if (bindings == null) { FacesContext fctx = FacesContext.getCurrentInstance(); bindings =(BindingContainer)fctx.getApplication().evaluateExpressionGet(fctx, "#{bindings}", BindingContainer.class); } return bindings; } }
[ "shamonov.sergey@otr.ru" ]
shamonov.sergey@otr.ru
66d7e1369b16715fdebadffa0b7c5a6211751ef6
1cf04c396c673a43e20c6a7733c34ad742963d0c
/src/p7_FuncionesTest/ZDT2.java
eecbf4ce8d8e2a1ba6793918fbb1d0f6bed7befc
[]
no_license
dieguinhoss83/Metaheuristicas-P7
117b184c342aa94f8ec9359f2fab1cf71499affd
a658025fd7b5da0fd39daf09319941ed43b6f7e7
refs/heads/master
2021-01-20T07:05:19.223104
2016-11-10T14:27:19
2016-11-10T14:27:19
72,537,697
0
0
null
null
null
null
UTF-8
Java
false
false
3,959
java
// ZDT2.java // // Author: // Antonio J. Nebro <antonio@lcc.uma.es> // Juan J. Durillo <durillo@lcc.uma.es> // // Copyright (c) 2011 Antonio J. Nebro, Juan J. Durillo // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. package p7_FuncionesTest; import jmetal.core.Problem; import jmetal.core.Solution; import jmetal.encodings.solutionType.ArrayRealSolutionType; import jmetal.encodings.solutionType.BinaryRealSolutionType; import jmetal.encodings.solutionType.RealSolutionType; import jmetal.util.JMException; import jmetal.util.wrapper.XReal; /** * Class representing problem ZDT2 */ public class ZDT2 extends Problem{ /** * Constructor. * Creates a default instance of problem ZDT2 (30 decision variables) * @param solutionType The solution type must "Real", "BinaryReal, and "ArrayReal". */ public ZDT2(String solutionType) throws ClassNotFoundException { this(solutionType, 30); // 30 variables by default } // ZDT2 /** * Constructor. * Creates a new ZDT2 problem instance. * @param numberOfVariables Number of variables * @param solutionType The solution type must "Real" or "BinaryReal". */ public ZDT2(String solutionType, Integer numberOfVariables) { numberOfVariables_ = numberOfVariables; numberOfObjectives_ = 2; numberOfConstraints_= 0; problemName_ = "ZDT2"; upperLimit_ = new double[numberOfVariables_]; lowerLimit_ = new double[numberOfVariables_]; for (int var = 0; var < numberOfVariables_; var++){ lowerLimit_[var] = 0.0; upperLimit_[var] = 1.0; } //for if (solutionType.compareTo("BinaryReal") == 0) solutionType_ = new BinaryRealSolutionType(this) ; else if (solutionType.compareTo("Real") == 0) solutionType_ = new RealSolutionType(this) ; else if (solutionType.compareTo("ArrayReal") == 0) solutionType_ = new ArrayRealSolutionType(this) ; else { System.out.println("Error: solution type " + solutionType + " invalid") ; System.exit(-1) ; } } //ZDT2 /** * Evaluates a solution * @param solution The solution to evaluate * @throws JMException */ public void evaluate(Solution solution) throws JMException { XReal x = new XReal(solution) ; double [] fx = new double[numberOfObjectives_] ; fx[0] = x.getValue(0) ; double g = this.evalG(x) ; double h = this.evalH(fx[0],g) ; fx[1] = h * g ; solution.setObjective(0,fx[0]); solution.setObjective(1,fx[1]); } //evaluate /** * Returns the value of the ZDT2 function G. * @param x Solution * @throws JMException */ private double evalG(XReal x) throws JMException { double g = 0.0; for (int i = 1; i < x.getNumberOfDecisionVariables();i++) g += x.getValue(i); double constant = (9.0 / (numberOfVariables_-1)); g = constant * g; g = g + 1.0; return g; } //evalG /** * Returns the value of the ZDT2 function H. * @param f First argument of the function H. * @param g Second argument of the function H. */ public double evalH(double f, double g) { double h = 0.0; h = 1.0 - java.lang.Math.pow(f/g,2.0); return h; } // evalH } //ZDT2
[ "diego.martin.sanz@alumnos.upm.es" ]
diego.martin.sanz@alumnos.upm.es
1b1ba09baad85a0ade7a77a1a504012edd7349e1
36b05bce8191da176265712d3a8b400393c7585e
/modules/admin-gui/src/org/ejbca/ui/web/admin/services/servicetypes/CustomActionType.java
2c196018fe8ed2bc3b6971fae1d1f8bcd51c6aa1
[]
no_license
ReverseEngineeringCUILahore/Ejbca
12e610e8522b1a60e2c15b5d944f9722b4dff25e
43f3c8a86ad5a9d97c7e64a85fab49bfc13d8edb
refs/heads/master
2021-02-12T20:07:50.101290
2020-03-03T14:01:29
2020-03-03T14:01:29
244,625,653
0
0
null
null
null
null
UTF-8
Java
false
false
3,474
java
/************************************************************************* * * * EJBCA Community: The OpenSource Certificate Authority * * * * This software is free software; you can redistribute it and/or * * modify it under the terms of the GNU Lesser General Public * * License as published by the Free Software Foundation; either * * version 2.1 of the License, or any later version. * * * * See terms of license at gnu.org. * * * *************************************************************************/ package org.ejbca.ui.web.admin.services.servicetypes; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; import java.util.Properties; import org.ejbca.core.model.services.IAction; import org.ejbca.ui.web.admin.CustomLoader; /** * Class used to populate the fields in the customaction.xhtml subview page. * * * @version $Id: CustomActionType.java 30665 2018-11-28 13:07:34Z aminkh $ */ public class CustomActionType extends ActionType { private static final long serialVersionUID = -1897582972418437359L; public static final String NAME = "CUSTOMACTION"; public CustomActionType() { super(ServiceTypeUtil.CUSTOMACTION_SUB_PAGE, NAME, true); } private String autoClassPath; private String manualClassPath; private String propertyText; /** * @return the propertyText */ public String getPropertyText() { return propertyText; } /** * @param propertyText the propertyText to set */ public void setPropertyText(String propertyText) { this.propertyText = propertyText; } /** * Sets the class path, and detects if it is an auto-detected class * or a manually specified class. */ public void setClassPath(String classPath) { if (CustomLoader.isDisplayedInList(classPath, IAction.class)) { autoClassPath = classPath; manualClassPath = ""; } else { autoClassPath = ""; manualClassPath = classPath; } } @Override public String getClassPath() { return autoClassPath != null && !autoClassPath.isEmpty() ? autoClassPath : manualClassPath; } public void setAutoClassPath(String classPath) { autoClassPath = classPath; } public String getAutoClassPath() { return autoClassPath; } public void setManualClassPath(String classPath) { manualClassPath = classPath; } public String getManualClassPath() { return manualClassPath; } @Override public Properties getProperties(ArrayList<String> errorMessages) throws IOException{ Properties retval = new Properties(); retval.load(new ByteArrayInputStream(getPropertyText().getBytes())); return retval; } @Override public void setProperties(Properties properties) throws IOException{ ByteArrayOutputStream baos = new ByteArrayOutputStream(); properties.store(baos, null); setPropertyText(new String(baos.toByteArray())); } @Override public boolean isCustom() { return true; } }
[ "adnanmoghal@gmail.com" ]
adnanmoghal@gmail.com
4a93f71c7939d88d28984873803f0f42bc9ca655
c6f83665b0977271c0cd1f480ad0917b6c750fd8
/app/src/main/java/com/example/day02_homework2/ApiServer.java
c65b88a9d9df56d86d7c8c32841fc1e3fe0816e7
[]
no_license
qx2259100367/ZuoYe
c710c5c94590231c5493cb6e16bf8a1d548cf6d4
e4bdb806f944dae7258d9b3ddb04b5399c4e9d54
refs/heads/master
2020-07-30T07:30:15.025096
2019-09-22T11:39:18
2019-09-22T11:39:18
210,135,564
0
0
null
null
null
null
UTF-8
Java
false
false
254
java
package com.example.day02_homework2; import io.reactivex.Observable; import retrofit2.http.GET; public interface ApiServer { String ProUrl="http://static.owspace.com/"; @GET("?c=api&a=getList&page_id=0") Observable<UserBean> getDatas(); }
[ "2259100367@qq.com" ]
2259100367@qq.com
c78bd6009a13ca0310e1b0a15d10d80557c17430
899c5da601f1ab2c4df5f403cefb92687a5d43c3
/src/main/java/bean/Employee.java
d459fc7428efca26a86752b251e6eb2d4cd96e48
[]
no_license
miserycat/study
520b2f4e6e709992a82afdc4889e11959cf283ba
c1cd66cd8dd2fcbe5fbb33594435de80501ece5f
refs/heads/master
2022-12-25T12:54:42.301232
2020-10-25T03:45:01
2020-10-25T03:45:01
129,375,934
2
1
null
2022-12-16T04:34:31
2018-04-13T08:54:57
Java
UTF-8
Java
false
false
1,808
java
package bean; /** * Created by shengchao wu on 2/27/2018. */ public class Employee { public Employee() {} public Employee(int age) { this.age = age; } private String name; private int age; private double salary; private Status status; public Employee(Integer age, String name) { this.age = age; this.name = name; } public Employee(String name, int age, double salary) { this.name = name; this.age = age; this.salary = salary; } public Employee(String name, int age, double salary, Status status) { this.name = name; this.age = age; this.salary = salary; this.status = status; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public double getSalary() { return salary; } public void setSalary(double salary) { this.salary = salary; } public Status getStatus() { return status; } public void setStatus(Status status) { this.status = status; } @Override public String toString() { return "Employee{" + "name='" + name + '\'' + ", age=" + age + ", salary=" + salary + ", status=" + status + '}'; } @Override public boolean equals(Object obj) { if (obj == null) { return false; } if (!(obj instanceof Employee)) { return false; } Employee emp = (Employee) obj; return this.getName().equals(emp.getName()); } }
[ "shengchao.wu@lombardrisk.com" ]
shengchao.wu@lombardrisk.com
0e3544ce2f4e57f63a255fdad4048e2849ac02b7
9a840a9896ae48bd9136c066bb87ab956570eaed
/Ball.java
c8b1a4556dc91965724255af39dc8a1d434d1816
[]
no_license
htw-imi-info1/bluekoans
715d25a81e7221b1a4317034aa8d0a4a50f33da6
67449d41dbf25c613aa5964970581ce8285b3af2
refs/heads/master
2021-01-10T20:19:31.553813
2012-12-20T10:23:28
2012-12-20T10:23:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
69
java
class Ball{ public static int gravity = 3; public int xpos; }
[ "drblinken@gmail.com" ]
drblinken@gmail.com
c342ce4b89130be1acdd52b15194ffa1ccc4650d
5cf26a42b05a68bad221f50d0737ce8a596700ba
/app/src/main/java/br/com/hudsonpereira/pontoteltest/ui/adapters/UsersAdapter.java
c2e9d1da1c3a297ae2dbe4a6804968d8c3a667d0
[]
no_license
hudsonpereira/pontotel-android-tests
2a9fe85e41ac71f96e605eb7cc20d7d3a19d5d77
ec20628d3f114b29b0c32cbe35d8f4937e7a55a6
refs/heads/master
2021-05-04T20:38:31.733267
2018-02-01T12:14:40
2018-02-01T12:14:40
119,831,520
0
0
null
null
null
null
UTF-8
Java
false
false
1,684
java
package br.com.hudsonpereira.pontoteltest.ui.adapters; import android.content.Context; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; import java.util.List; import br.com.hudsonpereira.pontoteltest.R; import br.com.hudsonpereira.pontoteltest.api.model.User; /** * Created by hudson on 31/01/18. */ public class UsersAdapter extends ArrayAdapter<User>{ public UsersAdapter(@NonNull Context context, int resource, @NonNull List<User> objects) { super(context, resource, objects); } @NonNull @Override public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) { // Get the data item for this position User user = getItem(position); // Check if an existing view is being reused, otherwise inflate the view if (convertView == null) { convertView = LayoutInflater.from(getContext()).inflate(R.layout.list_item, parent, false); } // Lookup view for data population TextView tvId = convertView.findViewById(R.id.id); TextView tvName = convertView.findViewById(R.id.name); TextView tvPwd = convertView.findViewById(R.id.pwd); // Populate the data into the template view using the data object tvId.setText("ID: " + user.getId()); tvName.setText("Name: " + user.getName()); tvPwd.setText("Pwd: " + user.getPwd()); // Return the completed view to render on screen return convertView; } }
[ "hudson.byte@gmail.com" ]
hudson.byte@gmail.com
5d40f1a7946b822e79ebb6b08184222ee4b07eef
1f2b379f8ad00eda22cbf6a22ac7efa9c8cbcb6f
/surface播放视频/CopyAPP/app/src/main/java/share/WXShareMultiImageHelper.java
a1801809ae6b46e1be93e6bb917c90e14498dda8
[]
no_license
lsw8569013/NDKDemo
b1b8b7f5656957514e18dfa4a33e6fbaf1620217
ea51b9c5f0277f7ca219fa5daad4e7fca082610c
refs/heads/master
2020-03-25T04:54:31.853504
2019-08-19T14:36:10
2019-08-19T14:36:10
143,419,603
0
0
null
null
null
null
UTF-8
Java
false
false
17,700
java
package share; import android.Manifest; import android.accessibilityservice.AccessibilityServiceInfo; import android.app.Activity; import android.app.AlertDialog; import android.app.Application; import android.app.ProgressDialog; import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.graphics.Bitmap; import android.media.MediaScannerConnection; import android.net.Uri; import android.os.Environment; import android.provider.MediaStore; import android.provider.Settings; //import android.support.v4.content.ContextCompat; import android.text.TextUtils; import android.view.accessibility.AccessibilityManager; import android.widget.Toast; import androidx.core.content.ContextCompat; import com.ly.copyapp.R; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; import share.utils.ClipboardUtil; import share.utils.FileUtil; /** * Created by StoneHui on 2018/12/12. * <p> * 微信多图分享辅助类。 */ public class WXShareMultiImageHelper { private static final String WX_PACKAGE_NAME = "com.tencent.mm"; private static final String LAUNCHER_UI = "com.tencent.mm.ui.LauncherUI"; private static final String SHARE_IMG_UI = "com.tencent.mm.ui.tools.ShareImgUI"; private static final String SHARE_TO_TIMELINE_UI = "com.tencent.mm.ui.tools.ShareToTimeLineUI"; /** * 是否安装了微信。 */ public static boolean isWXInstalled(Context context) { List<PackageInfo> packageInfoList = context.getPackageManager().getInstalledPackages(0); for (PackageInfo info : packageInfoList) { if (info.packageName.equalsIgnoreCase(WX_PACKAGE_NAME)) { return true; } } return false; } /** * 获取微信的版本号。 */ public static int getWXVersionCode(Context context) { List<PackageInfo> packageInfoList = context.getPackageManager().getInstalledPackages(0); for (PackageInfo info : packageInfoList) { if (info.packageName.equalsIgnoreCase(WX_PACKAGE_NAME)) { return info.versionCode; } } return 0; } /** * 是否有存储权限。 */ public static boolean hasStoragePermission(Context context) { return ContextCompat.checkSelfPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED; } // 检查是否可以分享。 private static boolean checkShareEnable(Context context) { if (!hasStoragePermission(context)) { Toast.makeText(context, "没有存储权限,无法分享", Toast.LENGTH_SHORT).show(); return false; } if (!isWXInstalled(context)) { Toast.makeText(context, "未安装微信", Toast.LENGTH_SHORT).show(); return false; } return true; } // 打开分享给好友界面 private static void openShareImgUI(Context context, String text, ArrayList<Uri> uriList) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND_MULTIPLE); intent.setComponent(new ComponentName(WX_PACKAGE_NAME, SHARE_IMG_UI)); intent.setType("image/*"); intent.putExtra("Kdescription", text); intent.putStringArrayListExtra(Intent.EXTRA_TEXT, new ArrayList<String>()); intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uriList); context.startActivity(intent); } // 打开分享到朋友圈界面 private static void openShareToTimeLineUI(Context context, String text, Uri uri) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_SEND); intent.setComponent(new ComponentName(WX_PACKAGE_NAME, SHARE_TO_TIMELINE_UI)); intent.setType("image/*"); intent.putExtra("Kdescription", text); intent.putExtra(Intent.EXTRA_STREAM, uri); context.startActivity(intent); } /** * 分享到好友会话。 * * @param activity [Context] * @param imageList 图片列表。 */ public static void shareToSession(Activity activity, List<Bitmap> imageList) { shareToSession(activity, imageList, ""); } /** * 分享到好友会话。 * * @param activity [Context] * @param imageList 图片列表。 * @param text 分享文本。 */ public static void shareToSession(final Activity activity, final List<Bitmap> imageList, final String text) { activity.runOnUiThread(new Runnable() { @Override public void run() { ShareInfo.setAuto(false); if (checkShareEnable(activity)) { if (!TextUtils.isEmpty(text)) { ClipboardUtil.setPrimaryClip(activity, "", text); Toast.makeText(activity, "文字已复制到剪切板", Toast.LENGTH_LONG).show(); } clearTmpFile(activity); String dir = getTmpFileDir(activity); ArrayList<Uri> uriList = new ArrayList<>(); for (Bitmap bitmap : imageList) { uriList.add(Uri.fromFile(new File(saveBitmap(dir, bitmap)))); } openShareImgUI(activity, text, uriList); } } }); } /** * 分享到朋友圈。 * * @param activity [Context] * @param imageList 图片列表。 */ public static void shareToTimeline(Activity activity, List<Bitmap> imageList) { shareToTimeline(activity, imageList, "", true); } /** * 分享到朋友圈。 * * @param activity [Context] * @param imageList 图片列表。 * @param text 分享文本。 */ public static void shareToTimeline(Activity activity, List<Bitmap> imageList, String text) { shareToTimeline(activity, imageList, text, true); } /** * 分享到朋友圈。 * * @param activity [Context] * @param imageList 图片列表。 * @param isAuto 是否由 SDK 自动粘贴文字、选择选图。 */ public static void shareToTimeline(Activity activity, List<Bitmap> imageList, boolean isAuto) { shareToTimeline(activity, imageList, "", isAuto); } /** * 分享到朋友圈。 * * @param activity [Context] * @param imageList 图片列表。 * @param text 分享文本。 * @param isAuto 是否由 SDK 自动粘贴文字、选择选图。 */ public static void shareToTimeline(final Activity activity, final List<Bitmap> imageList, final String text, final boolean isAuto) { activity.runOnUiThread(new Runnable() { @Override public void run() { if (!isAuto) { internalShareToTimeline(activity, text, imageList, false); } else if (WXShareMultiImageHelper.isServiceEnabled(activity)) { internalShareToTimeline(activity, text, imageList, true); } else { new AlertDialog.Builder(activity) .setCancelable(false) .setTitle(activity.getString(R.string.wx_share_dialog_title)) .setMessage(activity.getString(R.string.wx_share_dialog_message)) .setPositiveButton(activity.getString(R.string.wx_share_dialog_positive_button_text), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); WXShareMultiImageHelper.openService(activity, new OnOpenServiceListener() { @Override public void onResult(Boolean isOpening) { internalShareToTimeline(activity, text, imageList, isOpening); } }); } }) .setNegativeButton(activity.getString(R.string.wx_share_dialog_negative_button_text), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); internalShareToTimeline(activity, text, imageList, false); } }) .show(); } } }); } /** * 分享到微信朋友圈。 * * @param activity [Context] * @param text 分享文本。 * @param imageList 图片列表。 * @param isAuto false 表示由用户手动粘贴文字、选择选图,不会执行无障碍操作; * true 表示使用无障碍操作,若用户未打开无障碍服务,将和 false 等同。 */ private static void internalShareToTimeline(final Activity activity, final String text, final List<Bitmap> imageList, final Boolean isAuto) { activity.runOnUiThread(new Runnable() { @Override public void run() { if (!checkShareEnable(activity)) { return; } final ProgressDialog dialog = new ProgressDialog(activity); dialog.setMessage("请稍候..."); dialog.show(); new Thread(new Runnable() { @Override public void run() { clearTmpFile(activity); // 保存图片 String dir = getTmpFileDir(activity); final String[] paths = new String[imageList.size()]; final String[] mimeTypes = new String[imageList.size()]; Collections.reverse(imageList); for (int i = 0; i < imageList.size(); i++) { paths[i] = saveBitmap(dir, imageList.get(i)); mimeTypes[i] = "image/*"; } // 扫描图片 MediaScannerConnection.scanFile( activity, paths, mimeTypes, new MediaScannerConnection.OnScanCompletedListener() { List<Uri> uriList = new ArrayList<>(); @Override public void onScanCompleted(String path, Uri uri) { uriList.add(uri); if (uriList.size() < paths.length) { return; } // 扫描结束执行分享。 activity.runOnUiThread(new Runnable() { @Override public void run() { if (!isAuto) { shareToTimelineUIManual(activity, text); } else { Collections.reverse(uriList); shareToTimelineUIAuto(activity, text, uriList); } dialog.cancel(); } }); } }); } }).start(); } }); } // 分享到微信朋友圈(自动模式)。 private static void shareToTimelineUIAuto(Context context, String text, List<Uri> uriList) { if (!TextUtils.isEmpty(text)) { ClipboardUtil.setPrimaryClip(context, "", text); } ShareInfo.setAuto(true); ShareInfo.setText(text); ShareInfo.setImageCount(1, uriList.size() - 1); openShareToTimeLineUI(context, text, uriList.get(0)); } // 分享到微信朋友圈(手动模式)。 private static void shareToTimelineUIManual(Context context, String text) { if (!TextUtils.isEmpty(text)) { ClipboardUtil.setPrimaryClip(context, "", text); Toast.makeText(context, "请手动选择图片,长按粘贴内容!", Toast.LENGTH_LONG).show(); } else { Toast.makeText(context, "请手动选择图片!", Toast.LENGTH_LONG).show(); } ShareInfo.setAuto(false); // 打开微信 Intent intent = new Intent(Intent.ACTION_MAIN); intent.setAction(Intent.ACTION_MAIN); intent.setComponent(new ComponentName(WX_PACKAGE_NAME, LAUNCHER_UI)); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); } // 文件临时保存目录。 private static String getTmpFileDir(Context context) { File parent = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS); String child = String.format("%s%sshareTmp", context.getPackageName(), File.separator); File file = new File(parent, child); if (!file.exists()) { file.mkdirs(); } return file.getAbsolutePath(); } /** * 清理临时文件。可在分享完成后调用该函数。 */ public static void clearTmpFile(Context context) { File fileDir = new File(getTmpFileDir(context)); // 通知相册删除图片。 for (File file : fileDir.listFiles()) { context.getContentResolver().delete( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, MediaStore.Images.Media.DATA + "=?", new String[]{file.getAbsolutePath()}); } // 删除图片文件。 FileUtil.clearDir(fileDir); } // 保存图片并返回 Uri 。 private static String saveBitmap(String dir, Bitmap bitmap) { String path = String.format("%s%s%s.jpg", dir, File.separator, System.currentTimeMillis()); try { bitmap.compress(Bitmap.CompressFormat.JPEG, 100, new FileOutputStream(path)); } catch (FileNotFoundException e) { e.printStackTrace(); } return path; } /** * 检查服务是否开启。 */ public static boolean isServiceEnabled(Context context) { AccessibilityManager manager = (AccessibilityManager) context.getSystemService(Context.ACCESSIBILITY_SERVICE); if (manager == null) { return false; } List<AccessibilityServiceInfo> infoList = manager.getEnabledAccessibilityServiceList(AccessibilityServiceInfo.FEEDBACK_ALL_MASK); for (AccessibilityServiceInfo info : infoList) { if (info.getId().equals(String.format("%s/%s", context.getPackageName(), WXShareMultiImageService.class.getName()))) { return true; } } return false; } /** * 打开服务。 * * @param listener 打开服务结果监听。 */ public static void openService(final Context context, final OnOpenServiceListener listener) { if (WXShareMultiImageHelper.isServiceEnabled(context)) { listener.onResult(true); return; } ((Application) context.getApplicationContext()).registerActivityLifecycleCallbacks( new ActivityLifecycleCallbacksAdapter() { @Override public void onActivityResumed(Activity activity) { if (context.getClass().equals(activity.getClass())) { ((Application) context.getApplicationContext()).unregisterActivityLifecycleCallbacks(this); listener.onResult(WXShareMultiImageHelper.isServiceEnabled(context)); } } }); //打开系统无障碍设置界面 context.startActivity(new Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS)); } /** * 打开服务的回调。 */ interface OnOpenServiceListener { /** * 打开服务的回调。 * * @param isOpening 服务是否开启。 */ void onResult(Boolean isOpening); } public static void intentToWXUI(Context ctx){ Intent intent = new Intent(Intent.ACTION_MAIN); intent.setAction(Intent.ACTION_MAIN); intent.setComponent(new ComponentName(WX_PACKAGE_NAME, LAUNCHER_UI)); intent.addCategory(Intent.CATEGORY_LAUNCHER); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); ctx.startActivity(intent); } }
[ "lsw8569013@qq.com" ]
lsw8569013@qq.com
f7de2eb663f0078931c0b622ed760eeb93ad826c
da46d764d7e690ba936114e322f718082fdef0df
/src/com/hugo/dome/Point.java
c733836b02b24ac4f4b973205cdb8c704907bea6
[]
no_license
hporta/androidpact
46235cac1f277e0b00c7d6f9856482044e970f3e
980eaa3f84016acfc447830c3c4eca5eeee94c2b
refs/heads/master
2021-01-10T22:03:30.984090
2015-03-06T15:59:40
2015-03-06T15:59:40
30,892,664
0
0
null
null
null
null
UTF-8
Java
false
false
1,316
java
package com.hugo.dome; import java.util.ArrayList; public class Point { private int x; private int y; //z=1 si Inliner, z=0 si Outliner private int z; //private double rayon; //private double angle; //Coordonn�es cart�siennes public Point(int x, int y, int z) { this.x=x; //x=(int) (rayon*Math.cos(angle)); this.y=y; //y=(int) (rayon*Math.sin(angle)); this.z=z; } /*//Coordonn�es public Point(double rayon, double angle, int z){ this.setRayon(rayon); rayon=Math.sqrt(x*x+y*y); this.setAngle(angle); angle=Math.atan(y/x); this.z=z; }*/ //Getters et Setters public int getX() { return x; } public void setX(int x) { this.x = x; } public int getY() { return y; } public void setY(int y) { this.y = y; } public int getInliner() { return z; } public void setInliner(int z) { this.z = z; } /*public double getRayon() { return rayon; } public void setRayon(double rayon) { this.rayon = rayon; } public double getAngle() { return angle; } public void setAngle(double angle) { this.angle = angle; }*/ //Calculer le nombre d'Inliner public int nombreInliners(ArrayList<Point> listePoints) { int nombreInliners=0; for(int i=0;i<listePoints.size();i++){ nombreInliners=nombreInliners+listePoints.get(i).getInliner(); } //System.out.println(nombreInliners); return nombreInliners; } }
[ "h.porta@orange.fr" ]
h.porta@orange.fr
93826ace4920eaffa5eb22b701d761395d988993
79b1394171ca5eb8358db089a2b1e3447ea57168
/src/Assembler/Test.java
387d1d09c164c977364632e84eb646f038bb96e1
[]
no_license
anasiri/Mips-Simulator
f5518f6e4fc67f437aa285fad9cab71b07ac6c6d
62d5a83debc2d2462c785bc72130cce50ff77ff1
refs/heads/master
2021-10-28T03:47:43.455805
2019-04-21T19:38:13
2019-04-21T19:38:13
182,536,037
1
0
null
null
null
null
UTF-8
Java
false
false
691
java
package Assembler; public class Test { public static void main(String[] args) { String ans = Convertor.conver("add $t0 $t0 $t0"); String CorentAns = "00000001000010000100000000100000"; if (CorentAns.equals(ans)) { System.out.println("add work"); } ans = Convertor.conver("addi $t0 $t0 1"); CorentAns = "00100001000010000000000000000001"; if (CorentAns.equals(ans)) { System.out.println("addi work"); } ans = Convertor.conver(" j 4"); CorentAns = "00001000000000000000000000000100"; if (CorentAns.equals(ans)) { System.out.println("j work"); } } }
[ "pubix98@gmail.com" ]
pubix98@gmail.com
74f13d7cfe0fed12addf9ae218d68b71e745ff9e
4516c53f36d3cd31b621cf8db1bc22d504651c3c
/GraphicEditorRA245A - Copy/src/workspace/view/painters/CirclePainter.java
7f8e0aedebbb969f7653c592aead406874df3a8c
[]
no_license
daniloMogin/graphicEditor
871b136edbc7b73dda76dede3e2ca3091afdd43e
e0d31ca6da9dfbfcab07168a9c7e0aa2f96e709a
refs/heads/master
2021-01-01T19:20:05.891595
2015-01-20T11:36:52
2015-01-20T11:36:52
32,864,879
0
0
null
null
null
null
UTF-8
Java
false
false
507
java
package workspace.view.painters; import java.awt.geom.Ellipse2D; import models.elements.CircleElement; import models.elements.DiagramElement; public class CirclePainter extends DevicePainter { /** * */ private static final long serialVersionUID = 3073026532763893686L; public CirclePainter(DiagramElement device) { super(device); CircleElement circleEl = (CircleElement) device; shape = new Ellipse2D.Double(0, 0, circleEl.getSize().getWidth(), circleEl.getSize().getHeight()); } }
[ "danilo.mogin@gmail.com" ]
danilo.mogin@gmail.com
ae3b44eaff50eda595f3ce48c39edeea9d64f764
0f1f7332b8b06d3c9f61870eb2caed00aa529aaa
/ebean/branches/old-trunk/src/com/avaje/ebean/server/query/CQueryPredicates.java
2b27e50c17066e5932710d88d2bf6db9da531be4
[]
no_license
rbygrave/sourceforge-ebean
7e52e3ef439ed64eaf5ce48e0311e2625f7ee5ed
694274581a188be664614135baa3e4697d52d6fb
refs/heads/master
2020-06-19T10:29:37.011676
2019-12-17T22:09:29
2019-12-17T22:09:29
196,677,514
1
0
null
2019-12-17T22:07:13
2019-07-13T04:21:16
Java
UTF-8
Java
false
false
12,775
java
package com.avaje.ebean.server.query; import java.sql.PreparedStatement; import java.sql.SQLException; import java.util.ArrayList; import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; import com.avaje.ebean.internal.BindParams; import com.avaje.ebean.internal.SpiExpressionList; import com.avaje.ebean.internal.SpiQuery; import com.avaje.ebean.internal.BindParams.OrderedList; import com.avaje.ebean.server.core.OrmQueryRequest; import com.avaje.ebean.server.deploy.BeanDescriptor; import com.avaje.ebean.server.deploy.BeanPropertyAssocMany; import com.avaje.ebean.server.deploy.DeployPropertyParser; import com.avaje.ebean.server.persist.Binder; import com.avaje.ebean.server.util.BindParamsParser; import com.avaje.ebean.util.DefaultExpressionRequest; /** * Compile Query Predicates. * <p> * This includes the where and having expressions which can be made up of * Strings with named parameters or Expression objects. * </p> * <p> * This builds the appropriate bits of where and having clauses and binds the * named parameters and expression values into the prepared statement. * </p> */ public class CQueryPredicates { static final Logger logger = Logger.getLogger(CQueryPredicates.class.getName()); final Binder binder; final OrmQueryRequest<?> request; final SpiQuery<?> query; final Object idValue; /** * Flag set if this is a SqlSelect type query. */ boolean rawSql; /** * Named bind parameters. */ BindParams bindParams; /** * Named bind parameters for the having clause. */ OrderedList havingNamedParams; /** * Bind values from the where expressions. */ ArrayList<Object> whereExprBindValues; /** * SQL generated from the where expressions. */ String whereExprSql; /** * SQL generated from where with named parameters. */ String whereRawSql; /** * Bind values for having expression. */ ArrayList<Object> havingExprBindValues; /** * SQL generated from the having expression. */ String havingExprSql; /** * SQL generated from having with named parameters. */ String havingRawSql; String dbHaving; /** * logicalWhere with property names converted to db columns. */ String dbWhere; /** * The order by clause. */ String logicalOrderBy; String dbOrderBy; /** * Includes from where and order by clauses. */ Set<String> predicateIncludes; DeployPropertyParser deployParser; public CQueryPredicates(Binder binder, OrmQueryRequest<?> request, DeployPropertyParser deployParser) { this.binder = binder; this.request = request; this.query = request.getQuery(); this.deployParser = deployParser; bindParams = query.getBindParams(); idValue = query.getId(); } public String bind(PreparedStatement pstmt) throws SQLException { StringBuilder bindLog = new StringBuilder(); int index = 0; if (idValue != null) { // this is a find by id type query... index = request.getBeanDescriptor().bindId(pstmt, index, idValue); bindLog.append(idValue); } if (bindParams != null) { // bind named and positioned parameters... binder.bind(bindParams, index, pstmt, bindLog); } if (bindParams != null) { index = index + bindParams.size(); } if (whereExprBindValues != null) { for (int i = 0; i < whereExprBindValues.size(); i++) { Object bindValue = whereExprBindValues.get(i); binder.bindObject(++index, bindValue, pstmt); if (i > 0 || idValue != null) { bindLog.append(", "); } bindLog.append(bindValue); } } if (havingNamedParams != null) { // bind named parameters in having... bindLog.append(" havingNamed "); binder.bind(havingNamedParams.list(), index, pstmt, bindLog); index = index + havingNamedParams.size(); } if (havingExprBindValues != null) { // bind having expression... bindLog.append(" having "); for (int i = 0; i < havingExprBindValues.size(); i++) { Object bindValue = havingExprBindValues.get(i); binder.bindObject(++index, bindValue, pstmt); if (i > 0) { bindLog.append(", "); } bindLog.append(bindValue); } } return bindLog.toString(); } private void buildBindHavingRawSql(boolean buildSql) { if (buildSql || bindParams != null) { // having clause with named parameters... havingRawSql = query.getAdditionalHaving(); if (havingRawSql != null && bindParams != null) { // convert and order named parameters if required havingNamedParams = BindParamsParser.parseNamedParams(bindParams, havingRawSql); havingRawSql = havingNamedParams.getPreparedSql(); } } else { // we can skip... } } /** * Convert named parameters into an OrderedList. */ private void buildBindWhereRawSql(boolean buildSql) { if (buildSql || bindParams != null) { whereRawSql = buildWhereRawSql(); if (bindParams != null) { // convert and order named parameters if required whereRawSql = BindParamsParser.parse(bindParams, whereRawSql); } } else { // we can skip this... } } private String buildWhereRawSql() { // this is the where part of a OQL query which // may contain bind parameters... String whereRaw = query.getWhere(); if (whereRaw == null) { whereRaw = ""; } // add any additional stuff to the where clause String additionalWhere = query.getAdditionalWhere(); if (additionalWhere != null) { whereRaw += additionalWhere; } return whereRaw; } /** * This combines the sql from named/positioned parameters and expressions. */ public void prepare(boolean buildSql, boolean parseRaw) { buildBindWhereRawSql(buildSql); buildBindHavingRawSql(buildSql); SpiExpressionList<?> whereExp = query.getWhereExpressions(); DefaultExpressionRequest whereExpReq = new DefaultExpressionRequest(request); if (whereExp != null) { whereExprBindValues = whereExp.buildBindValues(whereExpReq); if (buildSql) { whereExprSql = whereExp.buildSql(whereExpReq); } } // having expression SpiExpressionList<?> havingExpr = query.getHavingExpressions(); DefaultExpressionRequest havingExpReq = new DefaultExpressionRequest(request); if (havingExpr != null) { havingExprBindValues = havingExpr.buildBindValues(havingExpReq); if (buildSql) { havingExprSql = havingExpr.buildSql(havingExpReq); } } if (buildSql) { parsePropertiesToDbColumns(parseRaw); } } /** * Parse/Convert property names to database columns in the where and order * by clauses etc. */ private void parsePropertiesToDbColumns(boolean parseRaw) { // property name to column name parser... if (deployParser == null){ deployParser = request.getBeanDescriptor().createDeployPropertyParser(); } dbWhere = deriveWhere(parseRaw); dbHaving = deriveHaving(parseRaw); // order by is dependent on the manyProperty (if there is one) logicalOrderBy = deriveOrderByWithMany(request.getManyProperty()); if (logicalOrderBy != null) { dbOrderBy = deployParser.parse(logicalOrderBy); } predicateIncludes = deployParser.getIncludes(); } /** * Replace the table alias place holders. */ public void parseTableAlias(SqlTreeAlias alias){ if (dbWhere != null){ dbWhere = alias.parse(dbWhere); } if (dbHaving != null){ dbHaving = alias.parse(dbHaving); } if (dbOrderBy != null){ dbOrderBy = alias.parse(dbOrderBy); } } // /** // * Used in logging to the transaction log. // */ // public String getDbWhere() { // return dbWhere; // } private String parse(boolean parseRaw, String raw, String expr){ if (expr == null || expr.trim().length() == 0) { return parseRaw ? deployParser.parse(raw) : raw; } else{ if (parseRaw){ return deployParser.parse(raw)+" and "+deployParser.parse(expr); } else { return raw +" and "+deployParser.parse(expr); } } } private String deriveWhere(boolean parseRaw) { if (whereRawSql == null || whereRawSql.trim().length() == 0) { return deployParser.parse(whereExprSql); } else { return parse(parseRaw, whereRawSql, whereExprSql); } } private String deriveHaving(boolean parseRaw) { if (havingRawSql == null || havingRawSql.trim().length() == 0) { return deployParser.parse(havingExprSql); } else { return parse(parseRaw, havingRawSql, havingExprSql); } } /** * There is a many property so we need to make sure the ordering is * appropriate. */ private String deriveOrderByWithMany(BeanPropertyAssocMany<?> manyProp) { if (manyProp == null) { return query.getOrderBy(); } String orderBy = query.getOrderBy(); BeanDescriptor<?> desc = request.getBeanDescriptor(); String orderById = desc.getDefaultOrderBy(); if (orderBy == null) { orderBy = orderById; } // check for default ordering on the many property... String manyOrderBy = manyProp.getFetchOrderBy(); if (manyOrderBy != null) { // FIXME: Bug: assuming only one column in manyOrderBy // Need to prefix many.getName() to all the column names // in the order by but not the ASC DESC keywords orderBy = orderBy + " , " + manyProp.getName() + "." + manyOrderBy; } if (request.isFindById()) { // only one master bean so should be fine... return orderBy; } if (orderBy.startsWith(orderById)){ return orderBy; } // more than one top level row may be returned so // we need to make sure their is an order by on the // top level first (to ensure master/detail construction). int manyPos = orderBy.indexOf(manyProp.getName()); int idPos = orderBy.indexOf(" "+orderById); if (manyPos == -1){ // no ordering of the many... so fine. return orderBy; } if (idPos > -1 && idPos < manyPos){ // its all ok, id property appears before a many property } else { if (idPos > manyPos) { // there was an error with the order by... String msg = "A Query on [" + desc + "] includes a join to a 'many' association [" + manyProp.getName(); msg += "] with an incorrect orderBy [" + orderBy + "]. The id property ["+orderById+"]"; msg += " must come before the many property ["+manyProp.getName()+"] in the orderBy."; msg += " Ebean has automatically modified the orderBy clause to do this."; logger.log(Level.WARNING, msg); } // the id needs to come before the manyPropName orderBy = orderBy.substring(0,manyPos)+orderById+", "+orderBy.substring(manyPos); } return orderBy; } /** * Return the bind values for the where expression. */ public ArrayList<Object> getWhereExprBindValues() { return whereExprBindValues; } /** * Return the db column version of the combined where clause. */ public String getDbHaving() { return dbHaving; } /** * Return the db column version of the combined where clause. */ public String getDbWhere() { return dbWhere; } /** * Return the db column version of the order by clause. */ public String getDbOrderBy() { return dbOrderBy; } /** * Return the includes required for the where and order by clause. */ public Set<String> getPredicateIncludes() { return predicateIncludes; } // /** // * Returns true if a ROW_NUMBER column is used. e.g. using firstRow with // * Oracle. // */ // public boolean isRowNumberIncluded() { // return rowNumberIncluded; // } // /** // * Set when the sql also includes a ROW_NUMBER column. // */ // public void setRowNumberIncluded(boolean isRowNumberIncluded) { // this.rowNumberIncluded = isRowNumberIncluded; // } /** * The where sql with named bind parameters converted to ?. */ public String getWhereRawSql() { return whereRawSql; } /** * The where sql from the expression objects. */ public String getWhereExpressionSql() { return whereExprSql; } /** * The having sql with named bind parameters converted to ?. */ public String getHavingRawSql() { return havingRawSql; } /** * The having sql from the expression objects. */ public String getHavingExpressionSql() { return havingExprSql; } public String getLogWhereSql() { if (rawSql) { return ""; } else { String logPred = getDbWhere(); if (logPred == null) { return ""; } else if (logPred.length() > 400) { logPred = logPred.substring(0, 400) + " ..."; } return logPred; } } }
[ "208973+rbygrave@users.noreply.github.com" ]
208973+rbygrave@users.noreply.github.com
b82d7c0998fa73d7847c114ca77c3ea38276d76b
1e8f6c70ccc10ff2b3c062d26ffcc42803d05f96
/killingDragons3/src/test/java/one/xingyi/killingDragons3/Dragon3Test.java
14836173b100ed9affeb420f141056f50c98da7b
[]
no_license
phil-rice/JavaDragons
ac39bd2a0dcb18efa4a0f75475d933149ddfae1e
1a9db0e89d8dd364ee0b9cd8fa49a7ab5e24c6e2
refs/heads/master
2022-01-30T15:40:32.029738
2021-02-03T06:37:34
2021-02-03T06:37:49
165,116,542
0
0
null
2022-01-04T16:48:58
2019-01-10T19:13:39
Java
UTF-8
Java
false
false
2,444
java
package one.xingyi.killingDragons3; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; public class Dragon3Test { Dragon3 fresh = Dragon3.freshDragon; Dragon3 hitpoints900 = new Dragon3(900, true); Dragon3 hitpoints100 = new Dragon3(100, true); Dragon3 dead = new Dragon3(0, false); void checkDoDamage(Dragon3 expected, Dragon3 original, int hitpoints, String msg) { assertEquals(new DragonDamageResult(expected, msg), Dragon3.resolveAttackWithNonFunctionals.apply(new Attack(hitpoints, original))); } @Test public void testCreatedFreshDragonWith1000HitPoints() { assertEquals(1000, Dragon3.freshDragon.hitpoints); } @Test public void testCreatedFreshDragonAlive() { assertEquals(true, fresh.alive); } @Test public void testDamageDragonWithoutKilling() { checkDoDamage(hitpoints900, fresh, 100, DragonMessages.damaged); checkDoDamage(hitpoints100, fresh, 900, DragonMessages.damaged); } @Test public void testJustKillingDragon_ZeroHitpointsIsDeath() { checkDoDamage(dead, fresh, 1000, DragonMessages.weKilledADragon); checkDoDamage(dead, hitpoints900, 900, DragonMessages.weKilledADragon); checkDoDamage(dead, hitpoints100, 100, DragonMessages.weKilledADragon); } @Test public void testOverKillingDragon() { checkDoDamage(dead, fresh, 10000, DragonMessages.weKilledADragon); checkDoDamage(dead, fresh, 1001, DragonMessages.weKilledADragon); checkDoDamage(dead, hitpoints900, 901, DragonMessages.weKilledADragon); checkDoDamage(dead, hitpoints100, 101, DragonMessages.weKilledADragon); } @Test public void testCannotHurtADeadDragon() { checkDoDamage(dead, dead, 1, DragonMessages.alreadyDead); checkDoDamage(dead, dead, 1000, DragonMessages.alreadyDead); } @Test public void testCannotHealDragonByusingNegativeHitpoints() { checkDoDamage(hitpoints900, hitpoints900, -1, DragonMessages.cannotDoNegativeDamage); checkDoDamage(hitpoints900, hitpoints900, -100, DragonMessages.cannotDoNegativeDamage); checkDoDamage(fresh, fresh, -100, DragonMessages.cannotDoNegativeDamage); checkDoDamage(dead, dead, -1, "[Cannot do negative damage, alreadyDead]"); checkDoDamage(dead, dead, -100, "[Cannot do negative damage, alreadyDead]"); } }
[ "phil.rice@validoc.org" ]
phil.rice@validoc.org
20530e6367a4fa480012891749634b53553f93c3
e9cb71ed79070ea040c0793962d12a9af5026485
/src/main/java/com/axilog/medical/domain/package-info.java
8b5db752797e3f86f2cc0ce73682687a6e81cee6
[]
no_license
fregragui/medicalTemplate
a4a4b71a53d7651a19eec573c09b97f5aa748d8f
586ae8a10bead87e538fba451050b037cab7bf9e
refs/heads/main
2023-01-30T02:56:27.194681
2020-12-11T18:07:06
2020-12-11T18:07:06
320,648,362
0
0
null
null
null
null
UTF-8
Java
false
false
66
java
/** * JPA domain objects. */ package com.axilog.medical.domain;
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
ff74751b6ddfeb849492d3ecd9d85b3d05ebec96
dbd8afed0d46f760b461996291096d7f5ed29b80
/src/main/java/br/com/digithobraisl/avalieme/AvalieMeResponse.java
87f0f6bb8915e9d6aa3881d46791fc6619713c77
[]
no_license
vsaueia/avalieme
0072bef347aa1f20ed88957399724770efa96023
4360887072a6fe52ba49984954f7bb499c639153
refs/heads/master
2021-01-12T08:39:41.454034
2016-12-16T21:43:41
2016-12-16T21:43:41
76,650,450
0
0
null
null
null
null
UTF-8
Java
false
false
1,327
java
package br.com.digithobraisl.avalieme; import java.util.List; public class AvalieMeResponse { private String formulario; private List<Avaliacao> avaliacoes; private List<String> pontosFortes; private List<String> pontosDeMelhorias; public AvalieMeResponse(String formulario, List<Avaliacao> avaliacoes, List<String> pontosFortes, List<String> pontosDeMelhorias) { this.formulario = formulario; this.avaliacoes = avaliacoes; this.pontosFortes = pontosFortes; this.pontosDeMelhorias = pontosDeMelhorias; } public String getFormulario() { return formulario; } public void setFormulario(String formulario) { this.formulario = formulario; } public List<Avaliacao> getAvaliacoes() { return avaliacoes; } public void setAvaliacoes(List<Avaliacao> avaliacoes) { this.avaliacoes = avaliacoes; } public List<String> getPontosFortes() { return pontosFortes; } public void setPontosFortes(List<String> pontosFortes) { this.pontosFortes = pontosFortes; } public List<String> getPontosDeMelhorias() { return pontosDeMelhorias; } public void setPontosDeMelhorias(List<String> pontosDeMelhorias) { this.pontosDeMelhorias = pontosDeMelhorias; } }
[ "vsaueia@gmail.com" ]
vsaueia@gmail.com
08c392e9a158ae0a14e9150f0716071186073986
a243eaef8f51dd4c5c4eef1057b0d9048d349a28
/rest/src/test/java/com/nncompany/rest/RestApplicationTests.java
8e8cc145e5a3bbf55e597ac85a168604d5dbc4ac
[]
no_license
Mark005/occupational-safety-and-health-app
2b8900354ca5ec017640863b0cbf5fae01dd98cd
383d5dbad0b737f4b5fece289a43459a72c62ebb
refs/heads/master
2023-08-29T02:53:02.032365
2021-10-25T09:35:19
2021-10-25T09:35:19
411,720,000
0
0
null
2021-10-14T15:16:09
2021-09-29T15:03:21
Java
UTF-8
Java
false
false
217
java
package com.nncompany.rest; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class RestApplicationTests { @Test void contextLoads() { } }
[ "mark.manirko@fors.ru" ]
mark.manirko@fors.ru
24c34cc92b4d95b3b7823c51f808a763a42b33cf
a2d87f7a9088776d8f6dc0db695d0beca1493b6e
/yongqing-bigdata-tools/yongqing-presto-hbase/src/main/java/com/yongqing/presto/hbase/HbaseTableManager.java
9f8e73ecd145a946fc35753e8617dcae4363065f
[ "Apache-2.0" ]
permissive
251538232/bigdata_tools
bbcfe3c52490104370132b2748abdb34aa72b3cb
f329082f0353533bc0e60c51d290bf94f77261c5
refs/heads/master
2022-12-23T15:54:37.486052
2020-09-24T08:49:48
2020-09-24T08:49:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,520
java
package com.yongqing.presto.hbase; import com.facebook.presto.spi.PrestoException; import io.airlift.log.Logger; import org.apache.hadoop.hbase.HColumnDescriptor; import org.apache.hadoop.hbase.HTableDescriptor; import org.apache.hadoop.hbase.NamespaceDescriptor; import org.apache.hadoop.hbase.TableExistsException; import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableNotFoundException; import org.apache.hadoop.hbase.client.Admin; import org.apache.hadoop.hbase.client.Connection; import javax.inject.Inject; import java.io.IOException; import java.util.Arrays; import java.util.Set; import java.util.stream.Collectors; import static com.facebook.presto.spi.StandardErrorCode.NOT_SUPPORTED; import static java.util.Objects.requireNonNull; /** * This class is a light wrapper for Hbase's Connector object. * It will perform the given operation, or throw an exception if an Hbase- or ZooKeeper-based error occurs. */ public class HbaseTableManager { private static final Logger LOG = Logger.get(HbaseTableManager.class); private static final String DEFAULT = "default"; private final Connection connection; @Inject public HbaseTableManager(Connection connection) { this.connection = requireNonNull(connection, "connection is null"); } /** * Ensures the given Hbase namespace exist, creating it if necessary * * @param schema Presto schema (Hbase namespace) */ public void ensureNamespace(String schema) { try { // If the table schema is not "default" and the namespace does not exist, create it try (Admin admin = connection.getAdmin()) { Set<String> namespaces = Arrays.stream(admin.listNamespaceDescriptors()) .map(x -> x.getName()).collect(Collectors.toSet()); namespaces.forEach(schemaTemp->{ LOG.info("schema:"+schemaTemp); }); if (!schema.equals(DEFAULT) && !namespaces.contains(schema)) { LOG.info("start to createNamespace :"+schema); admin.createNamespace(NamespaceDescriptor.create(schema).build()); } } } catch (IOException e) { throw new PrestoException(HbaseErrorCode.UNEXPECTED_HBASE_ERROR, "Failed to check for existence or create Hbase namespace", e); } } public boolean exists(String table) { try (Admin admin = connection.getAdmin()) { return admin.tableExists(TableName.valueOf(table)); } catch (IOException e) { throw new PrestoException(HbaseErrorCode.UNEXPECTED_HBASE_ERROR, "Failed to check for existence Hbase table", e); } } public void createHbaseTable(String table, Set<HColumnDescriptor> familys) { try (Admin admin = connection.getAdmin()) { HTableDescriptor hbaseTable = new HTableDescriptor(TableName.valueOf(table)); for (HColumnDescriptor family : familys) { hbaseTable.addFamily(family); } admin.createTable(hbaseTable); } catch (TableExistsException e) { throw new PrestoException(HbaseErrorCode.HBASE_TABLE_EXISTS, "Hbase table already exists", e); } catch (IOException e) { throw new PrestoException(HbaseErrorCode.UNEXPECTED_HBASE_ERROR, "Failed to create Hbase table", e); } } public void deleteHbaseTable(String tableName) { try (Admin admin = connection.getAdmin()) { TableName htableName = TableName.valueOf(tableName); admin.disableTable(htableName); if (admin.isTableDisabled(htableName)) { admin.deleteTable(htableName); } else { throw new PrestoException(HbaseErrorCode.UNEXPECTED_HBASE_ERROR, "Failed to delete Hbase table, TableDisabled is false"); } } catch (TableNotFoundException e) { throw new PrestoException(HbaseErrorCode.HBASE_TABLE_DNE, "Failed to delete Hbase table, does not exist", e); } catch (IOException e) { throw new PrestoException(HbaseErrorCode.UNEXPECTED_HBASE_ERROR, "Failed to delete Hbase table", e); } } public void renameHbaseTable(String oldName, String newName) { throw new PrestoException(NOT_SUPPORTED, "hbase catalog NOT_SUPPORTED rename table name"); } }
[ "yongqing_zh@163.com" ]
yongqing_zh@163.com
e36bc3426e1de2c35f8cd25d8cc57e63b4812501
de429a9af05a126cf7e41427070dc4b397841dd5
/cec.core/src/cn/mopon/cec/core/entity/TicketOrderStat.java
34bd6d40ebc14e96cfd45e7863e7ecacbe8fded6
[]
no_license
thb143/cec
bed61ffcda6259ad58794a1b3abb2ea95128b031
f0a7fc688acbf3e8c0797344512af175a568cbc0
refs/heads/master
2021-01-20T13:12:09.979982
2017-05-06T13:38:25
2017-05-06T13:38:25
90,463,610
0
1
null
null
null
null
UTF-8
Java
false
false
9,987
java
package cn.mopon.cec.core.entity; import java.util.Date; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import org.hibernate.annotations.Type; import org.hibernate.search.annotations.Analyze; import org.hibernate.search.annotations.Field; import org.hibernate.search.annotations.FieldBridge; import org.hibernate.search.annotations.Indexed; import org.hibernate.search.annotations.IndexedEmbedded; import cn.mopon.cec.core.enums.Provider; import cn.mopon.cec.core.enums.ShowType; import cn.mopon.cec.core.enums.TicketOrderKind; import cn.mopon.cec.core.enums.TicketOrderType; import coo.base.util.DateUtils; import coo.core.hibernate.search.DateBridge; import coo.core.hibernate.search.IEnumValueBridge; import coo.core.model.UuidEntity; /** * 选座票订单统计类。 */ @Entity @Table(name = "CEC_TicketOrderStat") @Indexed(index = "TicketOrderStat") public class TicketOrderStat extends UuidEntity { /** 关联影院 */ @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "cinemaId") @IndexedEmbedded(includePaths = { "id", "name" }) private Cinema cinema; /** 关联影厅 */ @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "hallId") @IndexedEmbedded(includePaths = "id") private Hall hall; /** 关联渠道 */ @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "channelId") @IndexedEmbedded(includePaths = { "id", "name" }) private Channel channel; /** 关联影片 */ @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "filmId") @IndexedEmbedded(includePaths = "id") private Film film; /** 关联特殊定价策略 */ @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "specialPolicyId") @IndexedEmbedded(includePaths = "id") private SpecialPolicy specialPolicy; /** 接入商类型 */ @Type(type = "IEnum") @Field(analyze = Analyze.NO, bridge = @FieldBridge(impl = IEnumValueBridge.class)) private Provider provider = Provider.NG; /** 订单号 */ @Field(analyze = Analyze.NO) private String code; /** 影院订单号 */ @Field(analyze = Analyze.NO) private String cinemaOrderCode; /** 渠道订单号 */ private String channelOrderCode; /** 订单类型 */ @Type(type = "IEnum") @Field(analyze = Analyze.NO, bridge = @FieldBridge(impl = IEnumValueBridge.class)) private TicketOrderType type = TicketOrderType.NORMAL; /** 订单类别 */ @Type(type = "IEnum") @Field(analyze = Analyze.NO, bridge = @FieldBridge(impl = IEnumValueBridge.class)) private TicketOrderKind kind = TicketOrderKind.NORMAL; /** 放映类型 */ @Type(type = "IEnum") @Field(analyze = Analyze.NO, bridge = @FieldBridge(impl = IEnumValueBridge.class)) private ShowType showType = ShowType.NORMAL2D; /** 手机号码 */ private String mobile; /** 确认时间 */ @Temporal(TemporalType.TIMESTAMP) @Field(analyze = Analyze.NO, bridge = @FieldBridge(impl = DateBridge.class)) private Date confirmTime; /** 选座票数量 */ private Integer ticketCount = 0; /** 订单金额 */ private Double amount = 0D; /** 影院结算金额 */ private Double cinemaAmount = 0D; /** 渠道结算金额 */ private Double channelAmount = 0D; /** 票房金额 */ private Double submitAmount = 0D; /** 接入费 */ private Double connectFee = 0D; /** 服务费 */ private Double serviceFee = 0D; /** 渠道费 */ private Double channelFee = 0D; /** 手续费 */ private Double circuitFee = 0D; /** 补贴费 */ private Double subsidyFee = 0D; /** 退票时间 */ @Temporal(TemporalType.TIMESTAMP) @Field(analyze = Analyze.NO, bridge = @FieldBridge(impl = DateBridge.class)) private Date revokeTime; /** 统计日期 */ @Temporal(TemporalType.DATE) @Field(analyze = Analyze.NO, bridge = @FieldBridge(impl = DateBridge.class)) protected Date statDate; /** * 构造方法。 */ public TicketOrderStat() { } /** * 构造方法。 * * @param order * 订单 * @param kind * 订单类别 * @param date * 统计日期 */ public TicketOrderStat(TicketOrder order, TicketOrderKind kind, Date date) { setCinema(order.getCinema()); setHall(order.getHall()); setChannel(order.getChannel()); setFilm(order.getFilm()); if (order.getSpecialChannel() != null) { setSpecialPolicy(order.getSpecialChannel().getRule().getPolicy()); } setProvider(order.getProvider()); setCode(order.getCode()); setCinemaOrderCode(order.getCinemaOrderCode()); setChannelOrderCode(order.getChannelOrderCode()); setType(order.getType()); setKind(kind); setShowType(order.getShowType()); setMobile(order.getMobile()); setConfirmTime(order.getConfirmTime()); setStatDate(date); if (kind == TicketOrderKind.REVOKE) { setRevoke(order); } else { setNormal(order); } } /** * 正常设置。 * * @param order * 订单 */ private void setNormal(TicketOrder order) { setChannelAmount(order.getChannelAmount()); setCinemaAmount(order.getCinemaAmount()); setTicketCount(order.getTicketCount()); setAmount(order.getAmount()); setServiceFee(order.getServiceFee()); setChannelFee(order.getChannelFee()); setCircuitFee(order.getCircuitFee()); setSubsidyFee(order.getSubsidyFee()); setSubmitAmount(order.getSubmitAmount()); setConnectFee(order.getConnectFee()); } /** * 退票设置。 * * @param order * 订单 */ private void setRevoke(TicketOrder order) { setRevokeTime(order.getRevokeTime()); setChannelAmount(-order.getChannelAmount()); setCinemaAmount(-order.getCinemaAmount()); setTicketCount(-order.getTicketCount()); setAmount(-order.getAmount()); setServiceFee(-order.getServiceFee()); setChannelFee(-order.getChannelFee()); setCircuitFee(-order.getCircuitFee()); setSubsidyFee(-order.getSubsidyFee()); setSubmitAmount(-order.getSubmitAmount()); setConnectFee(-order.getConnectFee()); } public Cinema getCinema() { return cinema; } public void setCinema(Cinema cinema) { this.cinema = cinema; } public Channel getChannel() { return channel; } public void setChannel(Channel channel) { this.channel = channel; } public SpecialPolicy getSpecialPolicy() { return specialPolicy; } public void setSpecialPolicy(SpecialPolicy specialPolicy) { this.specialPolicy = specialPolicy; } public ShowType getShowType() { return showType; } public void setShowType(ShowType showType) { this.showType = showType; } public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } public Date getConfirmTime() { return confirmTime; } public void setConfirmTime(Date confirmTime) { this.confirmTime = confirmTime; } public Double getServiceFee() { return serviceFee; } public void setServiceFee(Double serviceFee) { this.serviceFee = serviceFee; } public Double getChannelFee() { return channelFee; } public void setChannelFee(Double channelFee) { this.channelFee = channelFee; } public Double getCircuitFee() { return circuitFee; } public void setCircuitFee(Double circuitFee) { this.circuitFee = circuitFee; } /** * 获取string 格式的 出票时间。 * * @return 时间。 */ public String getConfirmTimeStr() { return DateUtils.format(confirmTime, DateUtils.SECOND); } /** * 获取string 格式的 退票时间。 * * @return 时间。 */ public String getRevokeTimeStr() { if (revokeTime != null) { return DateUtils.format(revokeTime, DateUtils.SECOND); } return null; } public Hall getHall() { return hall; } public void setHall(Hall hall) { this.hall = hall; } public Film getFilm() { return film; } public void setFilm(Film film) { this.film = film; } public Provider getProvider() { return provider; } public void setProvider(Provider provider) { this.provider = provider; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getCinemaOrderCode() { return cinemaOrderCode; } public void setCinemaOrderCode(String cinemaOrderCode) { this.cinemaOrderCode = cinemaOrderCode; } public String getChannelOrderCode() { return channelOrderCode; } public void setChannelOrderCode(String channelOrderCode) { this.channelOrderCode = channelOrderCode; } public TicketOrderType getType() { return type; } public void setType(TicketOrderType type) { this.type = type; } public TicketOrderKind getKind() { return kind; } public void setKind(TicketOrderKind kind) { this.kind = kind; } public Integer getTicketCount() { return ticketCount; } public void setTicketCount(Integer ticketCount) { this.ticketCount = ticketCount; } public Double getAmount() { return amount; } public void setAmount(Double amount) { this.amount = amount; } public Double getCinemaAmount() { return cinemaAmount; } public void setCinemaAmount(Double cinemaAmount) { this.cinemaAmount = cinemaAmount; } public Double getChannelAmount() { return channelAmount; } public void setChannelAmount(Double channelAmount) { this.channelAmount = channelAmount; } public Double getSubmitAmount() { return submitAmount; } public void setSubmitAmount(Double submitAmount) { this.submitAmount = submitAmount; } public Double getConnectFee() { return connectFee; } public void setConnectFee(Double connectFee) { this.connectFee = connectFee; } public Double getSubsidyFee() { return subsidyFee; } public void setSubsidyFee(Double subsidyFee) { this.subsidyFee = subsidyFee; } public Date getRevokeTime() { return revokeTime; } public void setRevokeTime(Date revokeTime) { this.revokeTime = revokeTime; } public Date getStatDate() { return statDate; } public void setStatDate(Date statDate) { this.statDate = statDate; } }
[ "thb143@gmail.com" ]
thb143@gmail.com
d25d1f66b79be42dea371eb925c3a6878b347583
ee3885476bba04281b24e3ef207bef2325583ace
/server/Visualizer/application.windows64/source/Visualizer.java
ebd797011de087d36bf3851cf94d62f2bc8ea742
[ "MIT" ]
permissive
tsob/JarSwarm
39ac41229ff804181a2444f89d69b4a2fa07a7ab
5e6a3819e7211a5e63375ca9a654ce129c3604ab
refs/heads/master
2021-01-10T19:26:17.837219
2012-12-24T07:01:39
2012-12-24T07:01:39
7,217,998
1
0
null
null
null
null
UTF-8
Java
false
false
8,930
java
import processing.core.*; import processing.data.*; import processing.opengl.*; import oscP5.*; import netP5.*; import ddf.minim.*; import org.tritonus.share.midi.*; import org.tritonus.sampled.file.*; import javazoom.jl.player.advanced.*; import org.tritonus.share.*; import ddf.minim.*; import ddf.minim.analysis.*; import netP5.*; import org.tritonus.share.sampled.*; import javazoom.jl.converter.*; import javazoom.spi.mpeg.sampled.file.tag.*; import org.tritonus.share.sampled.file.*; import javazoom.spi.mpeg.sampled.convert.*; import ddf.minim.javasound.*; import oscP5.*; import javazoom.spi.*; import org.tritonus.share.sampled.mixer.*; import javazoom.jl.decoder.*; import processing.xml.*; import processing.core.*; import org.tritonus.share.sampled.convert.*; import ddf.minim.spi.*; import ddf.minim.effects.*; import javazoom.spi.mpeg.sampled.file.*; import ddf.minim.signals.*; import javazoom.jl.player.*; import java.applet.*; import java.awt.Dimension; import java.awt.Frame; import java.awt.event.MouseEvent; import java.awt.event.KeyEvent; import java.awt.event.FocusEvent; import java.awt.Image; import java.io.*; import java.net.*; import java.text.*; import java.util.*; import java.util.zip.*; import java.util.regex.*; public class Visualizer extends PApplet { // // Visualizer // Ilias Karim // Music 250A, CCRMA, Stanford University // //import processing.core.PGraphics3D; //import processing.core.*; //import processing.opengl.*; int oscPort = 57121; // numbers of boids and attractors are hard-coded in GridRenderer :( //float[][] boids = new float[16][2]; // doubly hard-coded in GridRenderer //float[][] attractors = new float[9][2]; OscP5 oscP5;// = new OscP5(this, oscPort); Minim minim = new Minim(this); AudioSource source; GridRenderer gridRenderer; int select; public void setup() { oscP5 = new OscP5(this, oscPort); size(1024, 708); //minim = new Minim(this); source = minim.getLineIn(); gridRenderer = new GridRenderer(source); source.addListener(gridRenderer); } public void draw() { gridRenderer.draw(); } public void oscEvent(OscMessage msg) { String pattern = msg.addrPattern(); // // parse visualization control messages from PD // if (pattern.equals("/radius")) { int val = msg.get(0).intValue(); gridRenderer.r = val; } else if (pattern.equals("/rgb")) { float rVal = msg.get(0).intValue() / 128.f; float gVal = msg.get(1).intValue() / 128.f; float bVal = msg.get(2).intValue() / 128.f; gridRenderer.setRGB(rVal, gVal, bVal); } else if (pattern.equals("/intensity")) { gridRenderer.alpha = msg.get(0).floatValue(); } else if (pattern.equals("/mode")) { gridRenderer.setMode(msg.get(0).intValue()); } // // parse ... control messages from Python // else if (pattern.equals("/boid")) { int i = PApplet.parseInt(msg.get(0).intValue()); print("\n" + i + "\n"); gridRenderer.boids[i][0] = msg.get(1).floatValue(); gridRenderer.boids[i][1] = msg.get(2).floatValue(); //gridRenderer.boids = boids; } /* else if (pattern.equals("/attractor")) { attractors[msg.get(0).intValue()][0] = msg.get(1).floatValue(); attractors[msg.get(0).intValue()][1] = msg.get(1).floatValue(); }*/ // debug //print(msg); } public void stop() { source.close(); minim.stop(); super.stop(); } /// abstract class for audio visualization abstract class AudioRenderer implements AudioListener { float[] left; float[] right; public synchronized void samples(float[] samp) { left = samp; } public synchronized void samples(float[] sampL, float[] sampR) { left = sampL; right = sampR; } public abstract void setup(); public abstract void draw(); } // abstract class for FFT visualization abstract class FourierRenderer extends AudioRenderer { FFT fft; float maxFFT; float[] leftFFT; float[] rightFFT; FourierRenderer(AudioSource source) { float gain = .1f; fft = new FFT(source.bufferSize(), source.sampleRate()); maxFFT = source.sampleRate() / source.bufferSize() * gain; fft.window(FFT.HAMMING); } public void calc(int bands) { if(left != null) { leftFFT = new float[bands]; fft.linAverages(bands); fft.forward(left); for(int i = 0; i < bands; i++) leftFFT[i] = fft.getAvg(i); } } } class GridRenderer extends FourierRenderer { int SquareMode = 1; int DiamondMode = 0; float[][] boids = new float[19][2]; // radius int r = 20; // "squeeze" float squeeze = .5f; // color scale float colorScale = 40; float val[]; float factor = 1; float factorAlpha = 0; GridRenderer(AudioSource source) { super(source); //val = new float[ceil(sqrt(2) * r)]; } public void setup() { colorMode(RGB, colorScale, colorScale, colorScale); //setRGB(1, 1, 1); } int mode; public void setMode(int myMode) { mode = myMode; print("setMode: " + mode + "\n"); } // color float rgb[] = { 1, 1, 1 }; float _rgb[] = { 0, 0, 0 }; public void setRGB(float r, float g, float b) { rgb[0] = r; rgb[1] = g; rgb[2] = b; print("set RGB: (" + r + ", " + g + ", " + b + ")\n"); } float diamondTileAlpha = 0; float alpha = 1; float _alpha = 1; public void draw() { if (left != null) { val = new float[ceil(sqrt(2) * r)]; super.calc(val.length); // interpolate values for (int i=0; i<val.length; i++) { val[i] = lerp(val[i], pow(leftFFT[i], squeeze), .1f); } background(0); float tileWidth = width / (2*r + 1); float tileHeight = height / (2*r + 1); if (mode == 0) { if (factor < 2) { factor += .04f; } else { factor = 2; } if (diamondTileAlpha < 1) { diamondTileAlpha += .02f; } } else { if (diamondTileAlpha > 0) { diamondTileAlpha -= .02f; } else if (factor > 1) { factor -= .04f; } else { factor = 1; } } _rgb[0] = lerp(_rgb[0], rgb[0], .01f); _rgb[1] = lerp(_rgb[1], rgb[1], .01f); _rgb[2] = lerp(_rgb[2], rgb[2], .01f); _alpha = lerp(_alpha, alpha, .1f); for (int x = -r; x < r + 2; x++) { for (int z = -r; z < r + 2; z++) { int index = (int)dist(x, z, 0, 0); if (index >= val.length) index = val.length - 1; float c = 256 * val[index]; fill(c * _rgb[0] * _alpha, c * _rgb[1] * _alpha, c * _rgb[2] * _alpha); float x0 = width / 2 + (tileWidth * (x - .5f)); float x1 = x0 + tileWidth; float y0 = height / 2 + (tileHeight * (z - .5f)); float y1 = y0 + tileHeight; x0 -= tileWidth / 2; x1 -= tileWidth / 2; y0 -= tileHeight / 2; y1 -= tileHeight / 2; float avg; avg = (dist(x, z, 0, 0) + dist(x, z + 1, 0, 0) + dist(x + 1, z, 0, 0) + dist(x + 1, z + 1, 0, 0)) / 4; if (avg >= val.length) avg = val.length - 1; c = 256 * val[(int)avg] * diamondTileAlpha; float bonus = 1; /* if (random(0, 100) > 99) bonus = random(1, 2); */ fill(c * _rgb[0] * _alpha * bonus, c * _rgb[1] * _alpha * bonus, c * _rgb[2] * _alpha * bonus); //fill(1, 1, 1, 0); for (int i = 0; i < 19; i++) { if ((int)((boids[i][0] -.5f) * r * 2) == x && (int)((boids[i][1] - .5f) * r * 2) == z) { //print ((boids[i][0] * width) + " " + (boids[i][1] * height) + "\n"); fill(256, 256, 256, 256); //print("EUREKA"); } } quad(x0 + tileWidth / factor, y0, x0, y1 - tileHeight / factor, x1 - tileWidth / factor, y1, x1, y0 + tileHeight / factor); if (factor == 2) // diamond quad(x0 + tileWidth / factor + tileWidth / factor, y0 + tileHeight / factor, x0 + tileWidth / factor, y1 - tileHeight / factor + tileHeight / factor, x1 - tileWidth / factor + tileWidth / factor, y1 + tileHeight / factor, x1 + tileWidth / factor, y0 + tileHeight / factor + tileHeight / factor); } } } } } static public void main(String[] passedArgs) { String[] appletArgs = new String[] { "--full-screen", "--bgcolor=#666666", "--hide-stop", "Visualizer" }; if (passedArgs != null) { PApplet.main(concat(appletArgs, passedArgs)); } else { PApplet.main(appletArgs); } } }
[ "timothy.scott.obrien@gmail.com" ]
timothy.scott.obrien@gmail.com
892aff18918d6ba6f6aa5add1790f2acab805f64
63082d4952dc9500b4bd245c8fac908c482ab5b4
/yuanlangpay/core_noinsms_shuicg_yuanlangpay/src/com/core_sur/bean/AppendPointMessage.java
d91f70e6d1b2ec8514e005d094f673338c2a241b
[]
no_license
xiangtone/sdk-client
bc0ad35879cadced8f6c0c7891a7a0d2eea184b5
99dd3732ef3bbfe8083ed158f54274d4de7b71f0
refs/heads/master
2021-03-30T18:11:03.849042
2016-12-26T09:33:47
2016-12-26T09:33:47
47,962,164
0
0
null
null
null
null
UTF-8
Java
false
false
504
java
package com.core_sur.bean; import com.core_sur.tools.MessageObjcet; public class AppendPointMessage extends MessageObjcet { public AppendPointMessage(String adName,String adKey,String appKey,String channelKey,String AdVersion,String point,String imsi) { hs.put("AdName", adName); hs.put("Appkey",appKey); hs.put("AdKey",adKey); hs.put("ChannelKey",channelKey); hs.put("AdVersion",AdVersion); hs.put("Type",2); hs.put("GetPoint",point); hs.put("ImisUserId",imsi); hs.put("isEnCode", true); } }
[ "13631562586@163.com" ]
13631562586@163.com
df54ec4f732a7cd8377957dfd8e150563d5ca9d1
c26a852cb05c5a09c3a618d698cd9deb3046a495
/9. Palindrome Number.java
074080721c9f189f8b03cb98d4492d6d889748e8
[]
no_license
saturnqr9631/Leetcode
d603e410f1109c918c138a1427bd2feff73143bc
87f4bcdaed51564887a7d78c34ac84e4559166a8
refs/heads/master
2021-07-09T20:30:19.576070
2020-08-20T23:24:52
2020-08-20T23:24:52
186,859,441
0
0
null
null
null
null
UTF-8
Java
false
false
498
java
/**Runtime: 8 ms, faster than 75.85% of Java online submissions for Palindrome Number. Memory Usage: 35 MB, less than 75.99% of Java online submissions for Palindrome Number. */ class Solution { public boolean isPalindrome(int x) { String str = Integer.toString(x); for(int i =0; i< str.length() ;i++) { if(str.charAt(i) != str.charAt(str.length()-i-1)) { return false; } } return true; } }
[ "saturnqr9631@outlook.com" ]
saturnqr9631@outlook.com
a0423d9e554c021bf08de091bf14a8775bc03b67
93153e615bf3088eca761f2a8244aa323f69d213
/hehenian-mobile/src/main/java/com/hehenian/mobile/modules/account/service/impl/UserServiceImpl.java
1bd02e258b122fbf9eeaa48071322d8611a94333
[]
no_license
shaimeizi/dk
518d7b3c21af3ec3a5ebc8bfad8aa6eae002048c
42bed19000495352e37344af9c71bf3f7e0b663f
refs/heads/master
2021-01-18T16:55:30.027826
2015-07-24T05:09:14
2015-07-24T05:09:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,686
java
/** * @Project: hehenian-mobile * @Package com.dao * @Title: UserService.java * @Description: TODO * * @author: chenzhpmf * @date 2015-3-23 上午11:38:47 * @Copyright: HEHENIAN Co.,Ltd. All rights reserved. * @version V1.0 */ package com.hehenian.mobile.modules.account.service.impl; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.hehenian.biz.common.account.dataobject.AccountUserDo; import com.hehenian.biz.common.base.result.IResult; import com.hehenian.mobile.modules.account.dao.UserDao; import com.hehenian.mobile.modules.account.service.UserService; @Service public class UserServiceImpl implements UserService{ @Autowired private UserDao userDao; @Override public AccountUserDo loginWithPwd(String username, String password) { AccountUserDo accountUserDo = userDao.findUserByUserNamePwd(username, password); return login(accountUserDo); } private AccountUserDo login(AccountUserDo accountUserDo){ if (accountUserDo != null){ // PhoneVerifyDo phoneVerify = phoneVerifyComponent.findPhoneVerify(accountUserDo.getId()); // if (phoneVerify!=null){ // accountUserDo.setPhoneHasVerify(true); // }else { // accountUserDo.setPhoneHasVerify(false); // } // //记录用户登录日志 // operationLogComponent.addOperationLog("t_user",accountUserDo.getUsername(),2,"",0.0,"用户登录",1); } return accountUserDo; } @Override public IResult registerUser(AccountUserDo accountUserDo) { // TODO Auto-generated method stub return null; } }
[ "zhangyunhmf@harry.hyn.com" ]
zhangyunhmf@harry.hyn.com
ef68aa10e7e66e517b7c4b8c9a60aee17908671d
2e4ed1d1b68741619c197549ca6a952e71b6a53a
/extimageview/src/main/java/com/wwdablu/soumya/extimageview/trapez/DisplayBitmapCropper.java
6d51a6454743f2052b0bb11ebad34ccd5f1402c6
[ "MIT" ]
permissive
luckyluke1994/ExtImageView
df28b0c53174e2a8491b99517cdd940bd2b82c52
53d3916733696304ecab085600f251018374ef84
refs/heads/master
2023-03-17T20:17:59.632189
2019-07-20T21:32:18
2019-07-20T21:32:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,165
java
package com.wwdablu.soumya.extimageview.trapez; import android.graphics.Bitmap; import android.graphics.Matrix; import android.graphics.Path; import android.graphics.Point; import android.graphics.PointF; import android.support.annotation.NonNull; import com.wwdablu.soumya.extimageview.Result; import java.util.ArrayList; import java.util.List; class DisplayBitmapCropper implements Runnable { private Bitmap mDisplayBitmap; private List<Point> mAnchorPoints; private PointF mImageCoor; private Result<Bitmap> mResult; DisplayBitmapCropper(@NonNull Bitmap displayBitmap, @NonNull List<Point> anchorPoints, @NonNull Result<Bitmap> result, @NonNull PointF imageCoor) { this.mDisplayBitmap = displayBitmap; this.mAnchorPoints = new ArrayList<>(anchorPoints.size()); for(Point p : anchorPoints) { this.mAnchorPoints.add(new Point(p)); } this.mResult = result; this.mImageCoor = imageCoor; } @Override public void run() { try { pathCorrection(); Bitmap croppedAndCorrected = trapezoidToRectangleTransform(); mResult.onComplete(croppedAndCorrected); } catch (Exception ex) { mResult.onError(ex); } } private Bitmap trapezoidToRectangleTransform() { float[] src = new float[8]; Point point = mAnchorPoints.get(0); src[0] = point.x; src[1] = point.y; point = mAnchorPoints.get(1); src[2] = point.x; src[3] = point.y; point = mAnchorPoints.get(3); src[4] = point.x; src[5] = point.y; point = mAnchorPoints.get(2); src[6] = point.x; src[7] = point.y; // set up a dest polygon which is just a rectangle float[] dst = new float[8]; dst[0] = 0; dst[1] = 0; dst[2] = mDisplayBitmap.getWidth(); dst[3] = 0; dst[4] = mDisplayBitmap.getWidth(); dst[5] = mDisplayBitmap.getHeight(); dst[6] = 0; dst[7] = mDisplayBitmap.getHeight(); // create a matrix for transformation. Matrix matrix = new Matrix(); // set the matrix to map the source values to the dest values. boolean mapped = matrix.setPolyToPoly (src, 0, dst, 0, 4); float[] mappedTL = new float[] { 0, 0 }; matrix.mapPoints(mappedTL); int maptlx = Math.round(mappedTL[0]); int maptly = Math.round(mappedTL[1]); float[] mappedTR = new float[] { mDisplayBitmap.getWidth(), 0 }; matrix.mapPoints(mappedTR); int maptry = Math.round(mappedTR[1]); float[] mappedLL = new float[] { 0, mDisplayBitmap.getHeight() }; matrix.mapPoints(mappedLL); int mapllx = Math.round(mappedLL[0]); int shiftX = Math.max(-maptlx, -mapllx); int shiftY = Math.max(-maptry, -maptly); Bitmap croppedAndCorrected = null; if (mapped) { Bitmap imageOut = Bitmap.createBitmap(mDisplayBitmap, 0, 0, mDisplayBitmap.getWidth(), mDisplayBitmap.getHeight(), matrix, true); croppedAndCorrected = Bitmap.createBitmap(imageOut, shiftX, shiftY, mDisplayBitmap.getWidth(), mDisplayBitmap.getHeight(), null, true); imageOut.recycle(); } return croppedAndCorrected; } private void pathCorrection() { Path path = new Path(); Point point = mAnchorPoints.get(0); point.x -= mImageCoor.x; point.y -= mImageCoor.y; path.moveTo(point.x, point.y); path.lineTo(point.x, point.y); point = mAnchorPoints.get(1); point.x -= mImageCoor.x; point.y -= mImageCoor.y; path.lineTo(point.x, point.y); point = mAnchorPoints.get(3); point.x -= mImageCoor.x; point.y -= mImageCoor.y; path.lineTo(point.x, point.y); point = mAnchorPoints.get(2); point.x -= mImageCoor.x; point.y -= mImageCoor.y; path.lineTo(point.x, point.y); path.close(); } }
[ "dev.soumyamob@gmail.com" ]
dev.soumyamob@gmail.com
0b834c512b999c9a89c0258ec67fd5d21d68e2f5
aee18432c4ee8665af1ccfca68390f2908659076
/Covid19Analyzer/src/analyzer/project/models/Covid19GraphViewModel.java
92a9fdc0b96b6c435cdb213657118858d28dc38e
[]
no_license
TheDialgaTeam-School-Projects/ICT2107
56fbcda63b878aeb10a21d218f58028b9651e86a
8148806f4e26121127129eb0048aac95f31aa8fd
refs/heads/master
2022-04-23T09:15:03.604800
2020-04-02T06:13:34
2020-04-02T06:13:34
248,577,234
0
0
null
null
null
null
UTF-8
Java
false
false
1,559
java
// Jerry Wong package analyzer.project.models; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class Covid19GraphViewModel { private final Covid19Repository covid19Repository; public Covid19GraphViewModel() throws IOException { covid19Repository = new Covid19Repository(Covid19Database.getInstance()); } public List<String> getCovid19Countries() { final List<String> countries = new ArrayList<>(); for (Covid19Case covid19Case : covid19Repository.getCovid19CasesByCountry()) { countries.add(covid19Case.getCountry()); } return countries; } public Covid19Case getCovid19CaseByCountry(String country) { for (Covid19Case covid19Case : covid19Repository.getCovid19CasesByCountry()) { if (covid19Case.getCountry().contentEquals(country)) return covid19Case; } return null; } public List<Covid19Case> getCovid19CasesByCountryRecoveredPercentage() { final List<Covid19Case> covid19Cases = new ArrayList<>(covid19Repository.getCovid19CasesByCountry()); covid19Cases.sort((o1, o2) -> { double[] o1Percentage = o1.getRecoveredPercentage(); double[] o2Percentage = o2.getRecoveredPercentage(); double high1 = o1Percentage[o1Percentage.length - 1]; double high2 = o2Percentage[o1Percentage.length - 1]; if (high1 == high2) return 0; return high1 > high2 ? -1 : 1; }); return covid19Cases; } }
[ "jianming1993@gmail.com" ]
jianming1993@gmail.com
1e3ffe6af9318b5b60cfdbdf1a7741ecce6dc8fc
5102c9adea2fe15605e296fb8bffa8570021c7a4
/src/main/java/com/github/fge/jsonschema/library/KeywordBuilder.java
37c507a2c729a448076cbe9ba897c4f7c09a4796
[]
no_license
mattbishop/json-schema-validator
9c7767f54d004ade034ae8f8ce53d29b974a1711
ee0d8a268abf023dd77810a807cc9d0e7fdbb147
refs/heads/master
2020-12-25T05:25:44.349375
2013-05-02T20:31:22
2013-05-02T20:31:22
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,342
java
/* * Copyright (c) 2013, Francis Galiegue <fgaliegue@gmail.com> * * This program is free software: you can redistribute it and/or modify * it under the terms of the Lesser GNU General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * Lesser GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.github.fge.jsonschema.library; import com.fasterxml.jackson.databind.JsonNode; import com.github.fge.jackson.NodeType; import com.github.fge.jsonschema.exceptions.unchecked.ValidationConfigurationError; import com.github.fge.jsonschema.keyword.digest.Digester; import com.github.fge.jsonschema.keyword.digest.helpers.IdentityDigester; import com.github.fge.jsonschema.keyword.digest.helpers.SimpleDigester; import com.github.fge.jsonschema.keyword.validator.KeywordValidator; import com.github.fge.jsonschema.report.ProcessingMessage; import com.github.fge.jsonschema.syntax.checkers.SyntaxChecker; import com.github.fge.jsonschema.util.Thawed; import java.lang.reflect.Constructor; import static com.github.fge.jsonschema.messages.ValidationConfigurationMessages.*; /** * A keyword builder -- the thawed version of a {@link Keyword} * * <p>Note that you may only supply a {@link SyntaxChecker} for a keyword, but * if you supply a validator class, the digester <b>must</b> also be present. * </p> */ public final class KeywordBuilder implements Thawed<Keyword> { final String name; SyntaxChecker syntaxChecker; Digester digester; Constructor<? extends KeywordValidator> constructor; /** * Create a new, empty keyword builder * * @param name the name of this keyword * @throws ValidationConfigurationError name is null * @see Keyword#newBuilder(String) */ KeywordBuilder(final String name) { if (name == null) throw new ValidationConfigurationError(new ProcessingMessage() .message(NULL_NAME)); this.name = name; } /** * Create a thawed version of a frozen keyword * * @param keyword the keyword * @see Keyword#thaw() */ KeywordBuilder(final Keyword keyword) { name = keyword.name; syntaxChecker = keyword.syntaxChecker; digester = keyword.digester; constructor = keyword.constructor; } /** * Add a syntax checker to this builder * * @param syntaxChecker the syntax checker * @return this * @throws ValidationConfigurationError syntax checker is null */ public KeywordBuilder withSyntaxChecker(final SyntaxChecker syntaxChecker) { if (syntaxChecker == null) throw new ValidationConfigurationError(new ProcessingMessage() .message(NULL_SYNTAX_CHECKER)); this.syntaxChecker = syntaxChecker; return this; } /** * Add a digester to this builder * * @param digester the digester * @return this * @throws ValidationConfigurationError digester is null */ public KeywordBuilder withDigester(final Digester digester) { if (digester == null) throw new ValidationConfigurationError(new ProcessingMessage() .message(NULL_DIGESTER)); this.digester = digester; return this; } /** * Set this keyword's digester to be an {@link IdentityDigester} * * @param first the first instance type supported by this keyword * @param other other instance types supported by this keyword * @return this * @throws ValidationConfigurationError one or more type(s) are null */ public KeywordBuilder withIdentityDigester(final NodeType first, final NodeType... other) { digester = new IdentityDigester(name, checkType(first), checkTypes(other)); return this; } /** * Set this keyword's digester to be a {@link SimpleDigester} * * @param first the first instance type supported by this keyword * @param other other instance types supported by this keyword * @return this * @throws ValidationConfigurationError one or more type(s) are null */ public KeywordBuilder withSimpleDigester(final NodeType first, final NodeType... other) { digester = new SimpleDigester(name, checkType(first), checkTypes(other)); return this; } /** * Set the validator class for this keyword * * @param c the class * @return this * @throws ValidationConfigurationError failed to find an appropriate * constructor */ public KeywordBuilder withValidatorClass( final Class<? extends KeywordValidator> c) { constructor = getConstructor(c); return this; } /** * Build a frozen version of this builder * * @return a {@link Keyword} * @see Keyword#Keyword(KeywordBuilder) */ @Override public Keyword freeze() { return new Keyword(this); } private static Constructor<? extends KeywordValidator> getConstructor( final Class<? extends KeywordValidator> c) { try { return c.getConstructor(JsonNode.class); } catch (NoSuchMethodException ignored) { throw new ValidationConfigurationError(new ProcessingMessage() .message(NO_APPROPRIATE_CONSTRUCTOR)); } } private static NodeType checkType(final NodeType type) { if (type == null) throw new ValidationConfigurationError(new ProcessingMessage() .message(NULL_TYPE)); return type; } private static NodeType[] checkTypes(final NodeType... types) { for (final NodeType type: types) if (type == null) throw new ValidationConfigurationError(new ProcessingMessage() .message(NULL_TYPE)); return types; } }
[ "fgaliegue@gmail.com" ]
fgaliegue@gmail.com
26983f5e32103a555c88502e4b9009b9079a7dfa
f4cf77a8ec7a8b015018e38181d57bd7e1d76957
/TestJava-ServerGUI/src/ApplicationController.java
812ebd2ee46feeaf4402a597b240938e74e8dad7
[]
no_license
OZoneSQT/Server-Agent
11fbeda6087942ef4a94ba97e8a69d9c33d08596
e401247dae41685c63ef7777ed2819119aa943a1
refs/heads/master
2021-01-05T05:04:29.782348
2017-09-19T00:29:33
2017-09-19T00:29:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
980
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. */ import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.scene.paint.Color; import javafx.stage.Stage; import javafx.stage.StageStyle; /** * * @author cmcarthur */ public class ApplicationController extends Application { @Override public void start(Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("MainWindow.fxml")); stage.initStyle(StageStyle.TRANSPARENT); Scene scene = new Scene(root); scene.setFill(Color.TRANSPARENT); stage.setScene(scene); stage.show(); } /** * @param args the command line arguments */ public static void main(String[] args) { launch(args); } }
[ "prince.chrismc@gmail.com" ]
prince.chrismc@gmail.com
85a814647d563e07fa6bd2f513ea7206d4499fd0
177f79b7a443d3b74e01e8a7dd85bcb805fc418c
/app/src/main/java/com/example/toni/sharedpreferencesaya/Agenda.java
da43889d0107a47438e8b25c73b650cc8d047748
[]
no_license
pezmosca/SharedPreferencesAya
f65f5d8b9a0f834c73d3078341dee3593e551331
8b10a9ed57a9c988483bf0d356a162a0f2280b24
refs/heads/master
2021-01-10T05:27:53.109020
2016-02-01T20:28:10
2016-02-01T20:28:10
50,868,641
0
0
null
null
null
null
UTF-8
Java
false
false
1,125
java
package com.example.toni.sharedpreferencesaya; import android.content.Context; import android.content.SharedPreferences; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; public class Agenda extends AppCompatActivity { private EditText et1, et2; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_agenda); et1 = (EditText) findViewById(R.id.etnombre); et2 = (EditText) findViewById(R.id.etdatos); } public void grabar(View v) { SharedPreferences preferencias=getSharedPreferences("agenda", Context.MODE_PRIVATE); SharedPreferences.Editor editor=preferencias.edit(); editor.putString(et1.getText().toString(), et2.getText().toString()); editor.commit(); } public void recuperar(View v) { SharedPreferences preferencias=getSharedPreferences("agenda", Context.MODE_PRIVATE); et2.setText(preferencias.getString(et1.getText().toString(),"")); } }
[ "toniarellano96@gmail.com" ]
toniarellano96@gmail.com
4b8934cdfad998a15bdcc330e69bfd3ee54350a6
62d0a46d7a1113e44ce79f79ea4a63930a024404
/Cources/EpamLessons/src/com/epam/alexandr_steblyuk/java/lesson_3/utils/out_data_generators/TableGenerator.java
9ccdbde002ffae12f3f0313940e17a57bd26a7db
[]
no_license
Alexander-Steblyuk/JavaLabs
a154db0fc3106043d157bd4574d6effa45c507da
cf32131f9f1d3658b2c130d87dde984b9d0989e0
refs/heads/master
2021-08-28T03:40:28.616960
2021-08-11T13:05:42
2021-08-11T13:05:42
207,837,919
0
0
null
null
null
null
UTF-8
Java
false
false
5,105
java
package com.epam.alexandr_steblyuk.java.lesson_3.utils.out_data_generators; import com.epam.alexandr_steblyuk.java.lesson_3.text.Sentence; import com.epam.alexandr_steblyuk.java.lesson_3.text.Word; import com.epam.alexandr_steblyuk.java.lesson_3.utils.parsers.TextParser; import java.util.*; import java.util.stream.Collectors; public class TableGenerator { public String genTable(int maxSentenceLength, int paddingSize, String fileContent) { HashMap<String, Integer> sm = new HashMap(); List<Sentence> sentenceList = TextParser.parseFileToSentences(fileContent); Set s; for (Sentence sentence: sentenceList) { sm.put(sentence.getContent(), Sentence.compCountOfWords(sentence.getContent())); } s = sm.entrySet().stream() .sorted(Map.Entry.comparingByValue()) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (e1, e2) -> e1, LinkedHashMap::new)) .entrySet(); String title1 = " № ", title2 = "Sentences", title3 = " Word`s Count "; StringBuilder tableBuilder = new StringBuilder(); int headLength = maxSentenceLength + 2*paddingSize + title1.length() + title3.length() + 1; tableBuilder.append("\n"); tableBuilder.append(genTabHead(maxSentenceLength + 2*paddingSize, headLength, title1, title2, title3)); tableBuilder.append(genTabBody(maxSentenceLength, s, paddingSize, headLength, title1.length(), title3.length())); return tableBuilder.toString(); } static String genTabHead(int sentenceLength, int headLength, String... titles) { StringBuilder tabHead = new StringBuilder(); tabHead.append("|"); String title1 = titles[0], title2 = titles[1], title3 = titles[2]; for(int i = 0; i <= headLength; i++) { tabHead.append("="); } tabHead.append("|\n"); tabHead.append("|" + title1 + "|"); for(int j = 0; j <= sentenceLength; j++) { if(j == (sentenceLength -title2.length())/2) { tabHead.append(title2); j+=title2.length(); } else tabHead.append(" "); } tabHead.append("|" + title3 + "|\n"); tabHead.append(genRowSeparator('+', '=', headLength, title1.length(), title3.length())); return tabHead.toString(); } static String genTabBody(int sentenceLength, Set s, int padding, int headLength, int... titleLengths) { StringBuilder tabBodyBuilder = new StringBuilder(); Iterator i = s.iterator(); int counter = 0; while (i.hasNext()) { Map.Entry m = (Map.Entry)i.next(); int value = (Integer)m.getValue(); StringBuilder sentenceBuilder = new StringBuilder(); List<Word> wordList = Sentence.getListOfWords(m.getKey().toString()); int length = 0; for(Word s1: wordList) { length +=s1.getContent().length(); if(length <= sentenceLength) { sentenceBuilder.append(s1.getContent()); sentenceBuilder.append(" "); length = sentenceBuilder.length(); } else break; } counter++; String key = sentenceBuilder.toString(); tabBodyBuilder.append("|" + counter); for(int k = 0; k < titleLengths[0] - String.valueOf(counter).length(); k++) { tabBodyBuilder.append(" "); } tabBodyBuilder.append("|"); for (int j = 0; j <= sentenceLength + 2*padding; j++) { if(j == (sentenceLength - key.length())/2 + padding) { tabBodyBuilder.append(key); j+=key.length(); } else tabBodyBuilder.append(" "); } tabBodyBuilder.append("|"); for(int k = 0; k < titleLengths[1] - String.valueOf(value).length(); k++) { tabBodyBuilder.append(" "); } tabBodyBuilder.append(value + "|\n"); if(i.hasNext()) tabBodyBuilder.append(genRowSeparator('+', '-', headLength, titleLengths[0], titleLengths[1])); else tabBodyBuilder.append(genRowSeparator('=', '=', headLength, titleLengths[0], titleLengths[1])); } return tabBodyBuilder.append("\n").toString(); } static String genRowSeparator(char colSepChar, char rowSepChar, int headLength, int... titleLengths) { StringBuilder sepBuilder = new StringBuilder(); sepBuilder.append("|"); for(int i = 0; i <= headLength; i++) { if ((i == titleLengths[0] || i == headLength - titleLengths[1])) { sepBuilder.append(colSepChar); } else { sepBuilder.append(rowSepChar); } } sepBuilder.append("|\n"); return sepBuilder.toString(); } }
[ "А.Стеблюк@rptp.dom" ]
А.Стеблюк@rptp.dom
c80d8d6ff871c1f61d972dfdcfd64c13ff9fbbf2
e755b86308c1ddd2a98a235be6349f0dc47ed6b5
/web-server/sharecommon/src/main/java/com/xuanwu/msggate/common/sbi/entity/DestBindCarrierChannel.java
a438b5c40006b949a23b43ae13e33b60a226f07c
[]
no_license
druidJane/Druid3.0.3
37466528b9d0356c0ccb4a933a047e522af431f4
595d831ed8c81d142d4c7a82de3f953859ddc8fc
refs/heads/master
2021-05-08T07:33:21.202595
2017-11-09T10:36:50
2017-11-09T10:36:51
106,767,170
0
1
null
null
null
null
UTF-8
Java
false
false
4,945
java
package com.xuanwu.msggate.common.sbi.entity; import com.xuanwu.msggate.common.sbi.entity.MsgContent.MsgType; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock; /** * * @author <a href="hw86xll@163.com">Wei.Huang</a> * @Date 2012-06-08 * @Version 1.0.0 */ public class DestBindCarrierChannel extends AbstractDestBind { private Integer srcChannelId; private Map<Integer, BindSpecNumResult> whiteResultMap; private Map<Integer, BindSpecNumResult> regionResultMap; private Map<Integer, List<BindSpecNumResult>> changeResultsMap; private final ReadWriteLock lock = new ReentrantReadWriteLock(); public Integer getSrcChannelId() { return srcChannelId; } public void setSrcChannelId(Integer srcChannelId) { this.srcChannelId = srcChannelId; } public BindSpecNumResult getWhiteResult(MsgSingle msg) { if(whiteResultMap == null) return null; lock.readLock().lock(); try { Integer key = tran2Key(msg.getType(), msg.getCarrier()); BindSpecNumResult result = whiteResultMap.get(key); if (result != null) return result; if (msg.getType() == MsgType.LONGSMS) { key = tran2Key(MsgType.SMS, msg.getCarrier()); result = whiteResultMap.get(key); if (result != null) { msg.setType(MsgType.SMS); return result; } } return result; } finally { lock.readLock().unlock(); } } public BindSpecNumResult getRegionResult(Integer regionID, MsgSingle msg) { if(regionResultMap == null) return null; lock.readLock().lock(); try { Integer key = tran2Key(regionID, msg.getType(), msg.getCarrier()); BindSpecNumResult result = regionResultMap.get(key); if (result != null) return result; if (msg.getType() == MsgType.LONGSMS) { key = tran2Key(regionID, MsgType.SMS, msg.getCarrier()); result = regionResultMap.get(key); if (result != null) { msg.setType(MsgType.SMS); return result; } } return result; } finally { lock.readLock().unlock(); } } public List<BindSpecNumResult> getChangeResults(MsgSingleBox msg) { if(changeResultsMap == null) return Collections.emptyList(); lock.readLock().lock(); try { Integer key = tran2Key(msg.getMsgType(), msg.getCarrier()); List<BindSpecNumResult> targets = changeResultsMap.get(key); if (targets != null && !targets.isEmpty()) { msg.setBypass(targets.get(0).isBypass()); return targets; } if (msg.getMsgType() == MsgType.LONGSMS) { key = tran2Key(MsgType.SMS, msg.getCarrier()); targets = changeResultsMap.get(key); if (changeResultsMap != null && !targets.isEmpty()) { msg.setBypass(targets.get(0).isBypass()); msg.setMsgType(MsgType.SMS); return targets; } } return Collections.emptyList(); } finally { lock.readLock().unlock(); } } public void initMap() { lock.writeLock().lock(); try { if (whiteDestResult != null && !whiteDestResult.isEmpty()) { Map<Integer, BindSpecNumResult> tempMap = new ConcurrentHashMap<Integer, BindSpecNumResult>(); List<BindSpecNumResult> duplitResults = duplitBasicResult(whiteDestResult .getResults()); for (BindSpecNumResult result : duplitResults) { Integer key = tran2Key(result.getMsgType(), result .getCarrier()); tempMap.put(key, result); } setWhiteRedirect(true); whiteResultMap = tempMap; whiteDestResult.getResults().clear(); } if (regionDestResult != null && !regionDestResult.isEmpty()) { Map<Integer, BindSpecNumResult> tempMap = new ConcurrentHashMap<Integer, BindSpecNumResult>(); List<BindSpecNumResult> duplitResults = duplitBasicResult(regionDestResult .getResults()); for (BindSpecNumResult result : duplitResults) { result.setRegionID(result.getRegionID()); Integer key = tran2Key(result.getRegionID(), result .getMsgType(), result.getCarrier()); tempMap.put(key, result); } setRegionRedirect(true); regionResultMap = tempMap; regionDestResult.getResults().clear(); } if (changeDestResult != null && !changeDestResult.isEmpty()) { Map<Integer, List<BindSpecNumResult>> tempMap = new ConcurrentHashMap<Integer, List<BindSpecNumResult>>(); List<BindSpecNumResult> duplitResults = duplitBasicResultByDestBind(changeDestResult); for (BindSpecNumResult result : duplitResults) { Integer key = tran2Key(result.getMsgType(), result .getCarrier()); List<BindSpecNumResult> temp = tempMap.get(key); if (temp == null) { temp = new ArrayList<BindSpecNumResult>(); tempMap.put(key, temp); } temp.add(result); } setChangeRedirect(true); changeResultsMap = tempMap; changeDestResult.clear(); } } finally { lock.writeLock().unlock(); } } }
[ "413429011@qq.com" ]
413429011@qq.com
3b90ac1a160a047e3bf69c6ae2c19c29f853811f
ff2f7d6cba8b9caf72107c0769a26260b99ba6b8
/src/main/java/com/libqa/web/domain/WikiLike.java
a14c85c760e32d1191a8a79c86658dc9ac8307a1
[ "MIT" ]
permissive
howlingproject/libqa
2b1e04cad9bd7e01cc1f53922a48a113f03a78ed
4688caf7368c4a9607189dcaffc30cec74073107
refs/heads/master
2021-06-10T12:26:53.832250
2021-05-31T12:50:20
2021-05-31T12:50:20
30,136,400
24
9
null
2017-01-18T10:43:29
2015-02-01T04:38:50
JavaScript
UTF-8
Java
false
false
563
java
package com.libqa.web.domain; import lombok.Data; import javax.persistence.*; /** * Created by songanji on 2015. 10. 11.. */ @Entity @Data @Table(uniqueConstraints = { @UniqueConstraint(columnNames = {"userId","wikiId"}), @UniqueConstraint(columnNames = {"userId","replyId"}) }) public class WikiLike { @Id @Column(nullable = false) @GeneratedValue(strategy = GenerationType.AUTO) private Integer likeId; @Column(nullable = false) private Integer userId; private Integer wikiId; private Integer replyId; }
[ "songanji@gmail.com" ]
songanji@gmail.com
e6e123cd61fd352d4433ada3638a9b43f0a4b3f5
f7cf8bc9759da6cccf4ec5948ec742cbc0de2c49
/LeetCode_Algorithms/src/dynamicprogramming/DecodeWays.java
dcc53fee595703638e22c7091842a873c27d6eb9
[]
no_license
jiayibing1987/LeetCode_Algorithms
14ca1df9100200fb6da8ebfbc6a730f815edaf2f
9340715644b1fde503c292f098edcd339c356194
refs/heads/master
2022-09-02T14:53:40.996191
2022-08-18T04:23:04
2022-08-18T04:23:04
197,550,904
0
0
null
null
null
null
UTF-8
Java
false
false
822
java
package dynamicprogramming; public class DecodeWays { public int numDecodings(String s) { if(s == null || s.isEmpty()) return 0; int n = s.length(); int dp[] = new int[n+1]; // dp[0] = 1; dp[0] = s.charAt(0)!='0'? 1 : 0; for(int i=1; i<n; i++){ int first = Integer.valueOf( i>=n ? s.substring(i) : s.substring(i, i+1)); int second = Integer.valueOf(s.substring(i-1, i>=n ? i : i+1)); if(first >= 1 && first <= 9) dp[i] += dp[i-1]; if(second >= 10 && second <= 26) dp[i] += i==1? 1 : dp[i-2]; } return dp[n-1]; } public static void main(String[] args) { DecodeWays d = new DecodeWays(); System.out.println(d.numDecodings("12")); } }
[ "jiayibing1987@gmail.com" ]
jiayibing1987@gmail.com
bab7d708c6082721a22ead03df8d9e840dacb5aa
ecd94ffb5b395ef13858b8c9d6b3472eb47976f9
/daw1-vespertino/src/octubre/Martes22.java
46196c279443b2f6528056cd86e08f2ebfec4dea
[]
no_license
jbardelrio/Entornos
f63da6c703bfaf20924c8a6e86d7283c2797a7b4
e99aca25207c8dd7b320c3016497488fd4798679
refs/heads/master
2021-01-01T17:57:17.931315
2014-05-08T19:16:02
2014-05-08T19:16:02
null
0
0
null
null
null
null
ISO-8859-1
Java
false
false
1,016
java
package octubre; public class Martes22 { public static void main(String[] args) { //Los tipos de datos que puedo manejar: Datos primitivos. //Tipos aritméticos: Son los que permiten guardar valores de tipo numérico: /* int, long, double * int y long son de tipo ENTERO, la diferencia es que long puede almacenar más bits * el double permite números decimales * Tipos caracter o cadenas: char, string * char es para asignar un caracter. Los valores se ponen entre comilla simple, ejemplo '1' * string es para una cadena. Los valores se ponen entre comillas dobles, ejemplo "esto es una cadena" * Tipos de valores lógicos o booleanos: boolean. Los valores son dos: true y false. */ int n = 2; long l = 2222222; double d = 2222222222222222222222.0343453454351; char car = '2'; //el char admite un solo caracter String s = "difdi233234324 , hola esto es una cadena"; boolean b = true; b = 3 < 2; System.out.println(b); } }
[ "jbardelrio@gmail.com" ]
jbardelrio@gmail.com
d057f5899a6e49349e7d3e38f99803d6859277ab
ed3cb95dcc590e98d09117ea0b4768df18e8f99e
/project_1_3/src/b/c/c/c/Calc_1_3_12220.java
46f4f05a592edfacc5cc20a29aa9e5dda8636dd1
[]
no_license
chalstrick/bigRepo1
ac7fd5785d475b3c38f1328e370ba9a85a751cff
dad1852eef66fcec200df10083959c674fdcc55d
refs/heads/master
2016-08-11T17:59:16.079541
2015-12-18T14:26:49
2015-12-18T14:26:49
48,244,030
0
0
null
null
null
null
UTF-8
Java
false
false
134
java
package b.c.c.c; public class Calc_1_3_12220 { /** @return the sum of a and b */ public int add(int a, int b) { return a+b; } }
[ "christian.halstrick@sap.com" ]
christian.halstrick@sap.com
7c611347e643e03bca60b005c727d4808d423ac1
43c04884efd2094e98db046dbb31d2c2e4f7210a
/src/JUnit/src/Classes/Calculo.java
56ff0b2655f942c8db95dc57e9f1009de96acaf7
[]
no_license
thisRafaelBarreto/Junit
079a1475fa004ecd20f80e40429b37c366f8c1cf
a80ce755c7322012e8d8523253859ca9b6d67fb8
refs/heads/master
2020-05-25T18:37:41.472596
2019-05-22T00:34:14
2019-05-22T00:34:14
187,933,162
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package Classes; public class Calculo { public float soma(float valor1, float valor2) { return (valor1 + valor2); } public float subtracao(float valor1, float valor2) { return (valor1 - valor2); } public float divisao(float valor1, float valor2) { return (valor1/valor2); } }
[ "alu201624919@F7-LAB201-1361.uniritter.local" ]
alu201624919@F7-LAB201-1361.uniritter.local
1ff025ef74fe3d52681a8378259086ab17d1b501
f740879cfe41fb50b12d71500bb0fb30a320c6af
/src/main/java/proxy/staticproxy/Person.java
3702d72394c59b2839d9f7fb8492890c04994f1d
[]
no_license
1290414968/jim-pattern
856192893c7f322e680095c08a7b61c2dbc4ba84
3d11f3851399da7fafdedc605a66adb87ab3c299
refs/heads/master
2021-04-05T23:53:27.962187
2018-03-25T12:29:06
2018-03-25T12:29:06
124,737,173
0
0
null
null
null
null
UTF-8
Java
false
false
75
java
package proxy.staticproxy; public interface Person { void getJob(); }
[ "1290414968@qq.com" ]
1290414968@qq.com
4498bed4ef963027820ddad6b1b43b6ae0afca69
55ebdc98f90bba37dd34f5020e9b2f55ab4f747b
/src/main/java/com/sybase365/mobiliser/web/consumer/pages/portal/transaction/RequestMoneyConfirmPage.java
c495c56b874166b7d55bd6eee75b6a37920d3bbf
[]
no_license
chandusekhar/btpn_portal
aa482eef5a760a4a3a79dd044258014c145183f1
809b857bfe01cbcf2b966e85ebb8fc3bde02680e
refs/heads/master
2020-09-27T08:29:09.299858
2014-12-07T10:44:58
2014-12-07T10:45:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,582
java
package com.sybase365.mobiliser.web.consumer.pages.portal.transaction; import org.apache.wicket.authorization.strategies.role.annotations.AuthorizeInstantiation; import org.apache.wicket.markup.html.WebMarkupContainer; import org.apache.wicket.markup.html.basic.Label; import org.apache.wicket.markup.html.form.Button; import org.apache.wicket.markup.html.form.Form; import org.apache.wicket.markup.html.panel.FeedbackPanel; import org.apache.wicket.model.CompoundPropertyModel; import com.sybase365.mobiliser.money.contract.v5_0.transaction.DemandForPayment; import com.sybase365.mobiliser.money.contract.v5_0.transaction.DemandForPaymentResponse; import com.sybase365.mobiliser.web.beans.TransactionBean; import com.sybase365.mobiliser.web.util.Constants; @AuthorizeInstantiation(Constants.PRIV_REQUEST_MONEY) public class RequestMoneyConfirmPage extends BaseTransactionsPage { private static final long serialVersionUID = 1L; private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory .getLogger(RequestMoneyConfirmPage.class); private String creditAmount; private String feeAmount; private String debitAmonut; private String payer; private String txnText; private boolean isRealTimeTxn; private Long invoiceId; private TransactionBean tab; public RequestMoneyConfirmPage(final TransactionBean tab, boolean isRealTimeTxn) { super(); this.tab = tab; this.isRealTimeTxn = isRealTimeTxn; initPageComponents(); } @SuppressWarnings("unchecked") protected void initPageComponents() { Form<?> form = new Form("requestMoneyConfirmForm", new CompoundPropertyModel<RequestMoneyConfirmPage>(this)); // adding the submit buttons form.add(new Button("back") { private static final long serialVersionUID = 1L; @Override public void onSubmit() { handleBack(); }; }.setDefaultFormProcessing(false)); form.add(new Button("continue") { private static final long serialVersionUID = 1L; @Override public void onSubmit() { next(); }; }); // initialise all the labels WebMarkupContainer labels = new WebMarkupContainer("dataContainer", new CompoundPropertyModel<RequestMoneyConfirmPage>(this)); setCreditAmount(convertAmountToStringWithCurrency(tab.getCreditAmount())); setFeeAmount(convertAmountToStringWithCurrency(tab.getFeeAmount())); setDebitAmonut(convertAmountToStringWithCurrency(tab.getDebitAmount())); setPayer(tab.getPayer().getIdentifier().getValue()); setTxnText(tab.getText()); labels.add(new Label("creditAmount")); WebMarkupContainer debitDiv = new WebMarkupContainer( "debitFeeContainer"); debitDiv.add(new Label("debitAmonut")); debitDiv.add(new Label("feeAmount")); if (!isRealTimeTxn()) { debitDiv.setVisible(Boolean.FALSE); } labels.add(debitDiv); labels.add(new Label("payer")); labels.add(new Label("txnText")); form.add(labels); form.add(new FeedbackPanel("errorMessages")); add(form); } @Override protected Class getActiveMenu() { return RequestMoneyPage.class; } private void handleBack() { LOG.debug("#RequestMoneyConfirmPage.handleBack()"); setResponsePage(RequestMoneyPage.class); } private void next() { LOG.debug("#RequestMoneyConfirmPage.next)"); try { if (isRealTimeTxn()) { if (handleTransaction(tab)) setResponsePage(new RequestMoneyFinish(tab, isRealTimeTxn())); else { if (tab.getStatusCode() == Constants.TXN_STATUS_PENDING_APPROVAL) { setResponsePage(new RequestMoneyFinish(tab, isRealTimeTxn())); } } } else { if (demandForPayment(tab)) setResponsePage(new RequestMoneyFinish(tab, isRealTimeTxn())); } } catch (Exception e) { LOG.error("# An error occurred during preauthorization continue", e); error(getLocalizer().getString("preauthorization.continue.error", this)); } } private boolean demandForPayment(TransactionBean tab) { DemandForPaymentResponse response; DemandForPayment request; try { request = getNewMobiliserRequest(DemandForPayment.class); request.setAmount(tab.getAmount()); request.setPayee(tab.getPayee()); request.setPayer(tab.getPayer()); request.setText(getTxnText()); response = wsDemandForPaymentClient.demandForPayment(request); invoiceId = response.getInvoiceId(); tab.setTxnId(invoiceId); if (!evaluateMobiliserResponse(response)) { return Boolean.FALSE; } return Boolean.TRUE; } catch (Exception e) { return Boolean.FALSE; } } public String getCreditAmount() { return creditAmount; } public void setCreditAmount(String creditAmount) { this.creditAmount = creditAmount; } public String getFeeAmount() { return feeAmount; } public void setFeeAmount(String feeAmount) { this.feeAmount = feeAmount; } public String getDebitAmonut() { return debitAmonut; } public void setDebitAmonut(String debitAmonut) { this.debitAmonut = debitAmonut; } public String getPayer() { return payer; } public void setPayer(String payer) { this.payer = payer; } public String getTxnText() { return txnText; } public void setTxnText(String txnText) { this.txnText = txnText; } public boolean isRealTimeTxn() { return isRealTimeTxn; } public void setRealTimeTxn(boolean isRealTimeTxn) { this.isRealTimeTxn = isRealTimeTxn; } public Long getInvoiceId() { return invoiceId; } public void setInvoiceId(Long invoiceId) { this.invoiceId = invoiceId; } }
[ "antrouzz@gmail.com" ]
antrouzz@gmail.com
c0d9d28310715b8b7d9de097e410ad927579d72e
982354a9df750b8845d1a40ea95e07060b07e992
/spring_security/src/main/java/com/spring/security/LoginFailureHandler.java
6d7de2102fda13b2f0417a5b7ce13070fde99ca1
[]
no_license
Jung-Young-In/javaedu
1c5fbef7d1ed2f13449e6900e2dc735562804827
7cf6aaa8f84d41b8d70ec02030ae497ab87d0a6f
refs/heads/main
2023-07-13T01:08:59.383264
2021-08-19T02:23:06
2021-08-19T02:23:06
397,784,350
0
0
null
null
null
null
UTF-8
Java
false
false
1,103
java
package com.spring.security; import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.SimpleUrlAuthenticationFailureHandler; public class LoginFailureHandler extends SimpleUrlAuthenticationFailureHandler{ @Override public void onAuthenticationFailure(HttpServletRequest request, HttpServletResponse response, AuthenticationException exception) throws IOException, ServletException { response.setContentType("text/html;charset=utf-8"); PrintWriter out = response.getWriter(); out.println("<script>"); out.println("alert('아이디 혹은 패스워드가 일치하지 않습니다.');"); out.println("history.go(-1)"); out.println("</script>"); //여기서는 success와 다르게 내 방식대로 해보는 걸로 하기 때문에 super 하지 않음 // super.onAuthenticationFailure(request, response, exception); } }
[ "yinidev@gamil.com" ]
yinidev@gamil.com
12b2c7a37b30f979ea11e680b7a9e03bd6b957d9
67cfb268efa154418925a5216ae1a4fffd6bd857
/src/com/konka/eplay/modules/movie/MovieInfoActivity.java
702310888565b2abb80571715fc0170a5466acb1
[]
no_license
lahnini/eplay
8f0f5333f3e12fae19a3a9b2729d3707c0580616
f2fe9225c58338cf2524c82b0613a5507b54e1ed
refs/heads/master
2021-01-17T16:10:46.660287
2015-07-14T09:26:12
2015-07-14T09:26:12
39,049,769
1
0
null
2015-07-14T02:47:20
2015-07-14T02:47:20
null
UTF-8
Java
false
false
9,378
java
package com.konka.eplay.modules.movie; import iapp.eric.utils.base.Trace; import java.io.File; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import android.app.Activity; import android.app.Dialog; import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.content.Intent; import android.graphics.Bitmap; import android.media.MediaMetadataRetriever; import android.media.MediaPlayer; import android.media.MediaPlayer.OnVideoSizeChangedListener; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.view.Window; import android.widget.Button; import android.widget.ImageView; import android.widget.RelativeLayout.LayoutParams; import android.widget.TextView; import com.konka.eplay.Constant; import com.konka.eplay.R; import com.konka.eplay.Utils; import com.konka.eplay.modules.CommonFileInfo; import com.konka.eplay.modules.movie.ThumbnailLoader.ThumbnailLoaderListener; import com.konka.eplay.modules.photo.QuickToast; /** * 视频详情页 * * @author situ hui * */ public class MovieInfoActivity extends Activity { private View mNullLayout;// 辅助弹窗去焦 private View mBack; private TextView mMovieName; private TextView mMovieSize; private TextView mMovieResolution; private TextView mMovieDuration; private TextView mMovieDate; private TextView mMoviePath; private ImageView mMovieImg; private ImageView mBackground; private Button mBtnOpen; private Button mBtnDelete; private int mIndex; private ArrayList<String> mPaths; private String mPath; private CommonFileInfo mMovieFileInfo; private ThumbnailLoader mThumbnailLoader; private MediaMetadataRetriever mRetriever; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_movie_info); init(); getSourceFromIntent(); setInfo(); } @Override protected void onStart() { mBtnOpen.requestFocus(); super.onStart(); } // 初始化activity private void init() { mNullLayout = findViewById(R.id.null_layout); mBack = findViewById(R.id.back); mMovieName = (TextView) findViewById(R.id.movie_info_name); mMovieSize = (TextView) findViewById(R.id.movie_info_size); mMovieResolution = (TextView) findViewById(R.id.movie_info_resolution); mMovieDuration = (TextView) findViewById(R.id.movie_info_duration); mMovieDate = (TextView) findViewById(R.id.movie_info_date); mMoviePath = (TextView) findViewById(R.id.movie_info_path); mMovieImg = (ImageView) findViewById(R.id.movie_info_img); mBackground = (ImageView) findViewById(R.id.movie_info_background_img); mBtnOpen = (Button) findViewById(R.id.movie_info_open); mBtnDelete = (Button) findViewById(R.id.movie_info_delete); mBtnOpen.setOnClickListener(mOnClickListener); mBtnDelete.setOnClickListener(mOnClickListener); mBack.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { finish(); } }); } // 从intent获取数据 private void getSourceFromIntent() { Intent intent = getIntent(); mIndex = intent.getIntExtra(Constant.PLAY_INDEX, 0); mPaths = intent.getStringArrayListExtra(Constant.PLAY_PATHS); if (mPaths == null) { finish(); return; } } // 显示详情页上面信息 private void setInfo() { if (mIndex >= mPaths.size()) { finish(); return; } mPath = mPaths.get(mIndex); File file = new File(mPath); if (!file.exists()) { Trace.Debug("file dosen't exist:" + mPath); finish(); return; } mMovieFileInfo = new CommonFileInfo(file); if (mMovieFileInfo == null) { finish(); return; } mRetriever = new MediaMetadataRetriever(); try { mRetriever.setDataSource(mPath); } catch (IllegalArgumentException e) { Trace.Info("movie info activity mediametadataretriever runtime exception,video path=" + mPath); mRetriever = null; } setImage(); setName(); setSize(); setDuration(); setDate(); setPath(); setResolution(); if (mRetriever != null) { mRetriever.release(); } } private void setName() { String name = mMovieFileInfo.getName(); mMovieName.setText(name); } // 显示大小 private void setSize() { long size = mMovieFileInfo.getSize(); String sizeString = Tools.formatSize(size); mMovieSize.setText("" + sizeString); } // 显示分辩率 private void setResolution() { if (mPath == null) { return; } // if (mRetriever != null) { // // 获取视频原宽高 // String width = // mRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_WIDTH); // String height = // mRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_VIDEO_HEIGHT); // if (width == null || height == null) { // return; // } // int videoW = Integer.parseInt(width); // int videoH = Integer.parseInt(height); // mMovieResolution.setText(videoW + "*" + videoH); // } // else { // mMovieResolution.setText(this.getString(R.string.unknown)); // } final MediaPlayer mediaPlayer = new MediaPlayer(); mediaPlayer.setOnVideoSizeChangedListener(new OnVideoSizeChangedListener() { @Override public void onVideoSizeChanged(MediaPlayer mp, int width, int height) { int videoW = mediaPlayer.getVideoWidth(); int videoH = mediaPlayer.getVideoHeight(); mMovieResolution.setText(videoW + "*" + videoH); } }); try { mediaPlayer.setDataSource(mPath); mediaPlayer.prepareAsync(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } // 显示时长 private void setDuration() { if (mPath == null) { return; } if (mRetriever != null) { String duration = mRetriever.extractMetadata(MediaMetadataRetriever.METADATA_KEY_DURATION); if (duration == null) { return; } int timeInmillisec = Integer.parseInt(duration); String time = Tools.formatMsec(timeInmillisec); mMovieDuration.setText(time); } else { mMovieDuration.setText(this.getString(R.string.unknown)); } } // 显示日期 private void setDate() { Date date = mMovieFileInfo.getCreatedTime(); SimpleDateFormat formater = new SimpleDateFormat("yyyy.MM.dd"); String dateString = formater.format(date); mMovieDate.setText(dateString); } // 显示路径 private void setPath() { String path = mMovieFileInfo.getParentPath(); mMoviePath.setText(Utils.getWrapperPath(path)); } // 设置图片 private void setImage() { if (mPath == null) { return; } mThumbnailLoader = new ThumbnailLoader(this); mThumbnailLoader.loadThumbnail(mPath, new ThumbnailLoaderListener() { @Override public void onThumbnailLoadStart() { // TODO Auto-generated method stub } @Override public void onThumbnailLoadEnd(Bitmap result) { mMovieImg.setImageBitmap(result); mBackground.setImageBitmap(result); } }); } // 显示删除对话框 private void showDeleteDialog() { // 去焦 mNullLayout.setFocusable(true); mNullLayout.requestFocus(); final Dialog dialog = new Dialog(this, R.style.delete_dialog); LayoutInflater inflater = LayoutInflater.from(this); View view = inflater.inflate(R.layout.delete_dialog, null); dialog.setContentView(view); TextView message = (TextView) view.findViewById(R.id.info_message); message.setText(getResources().getString(R.string.movie_delete_hint)); view.findViewById(R.id.cancelButton).requestFocus(); Window window = dialog.getWindow(); window.setLayout(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); view.findViewById(R.id.decideButton).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); // 删除操作 Trace.Debug("####showDeleteDialog delete confirm"); File file = new File(mPath); if (file != null && file.exists()) { if (file.delete()) { // 此处在外层还要进行刷新一下显示 QuickToast.showToast(MovieInfoActivity.this, getResources().getString(R.string.movie_delete_success)); Intent intent = new Intent(); intent.putExtra("delete_index", mIndex); setResult(RESULT_OK, intent); } } // 退出详情页Activity MovieInfoActivity.this.finish(); } }); view.findViewById(R.id.cancelButton).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { dialog.dismiss(); mNullLayout.setFocusable(false); mBtnDelete.requestFocus(); } }); dialog.setOnCancelListener(new OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { mNullLayout.setFocusable(false); mBtnDelete.requestFocus(); } }); dialog.show(); } private OnClickListener mOnClickListener = new OnClickListener() { @Override public void onClick(View v) { switch (v.getId()) { case R.id.movie_info_open: Trace.Debug("movie open"); Intent intent = new Intent(); intent.setAction(Constant.PLAY_VIDEO_ACTION); intent.putExtra(Constant.PLAY_INDEX, mIndex); intent.putStringArrayListExtra(Constant.PLAY_PATHS, mPaths); startActivity(intent); finish(); break; case R.id.movie_info_delete: Trace.Debug("movie delete"); showDeleteDialog(); break; default: break; } } }; }
[ "2669052007@qq.com" ]
2669052007@qq.com
8ca381a481e9a7ade75e3f847821acbec280e1a8
9e63ee764f871ee01cb5bbc81306b61f00952b94
/src/main/java/com/pisight/everest/repository/CarrierContactDetailsRepository.java
2f83529b203585ae300c7bb716255609a6a93b69
[]
no_license
kumar-shubham/spring1
adf12bce970c444493632de7bf0de5100b9a8c86
860c8e513490ff982ee58bfd3c04912016013aff
refs/heads/master
2021-07-16T16:19:27.897948
2017-10-24T16:45:50
2017-10-24T16:45:50
108,155,469
0
0
null
null
null
null
UTF-8
Java
false
false
764
java
package com.pisight.everest.repository; import java.util.List; import java.util.UUID; import javax.transaction.Transactional; import org.springframework.data.repository.CrudRepository; import org.springframework.data.rest.core.annotation.RepositoryRestResource; import org.springframework.stereotype.Repository; import com.pisight.everest.entities.CarrierAddressDetails; import com.pisight.everest.entities.CarrierContactDetails; @Repository @RepositoryRestResource(exported = false) public interface CarrierContactDetailsRepository extends CrudRepository<CarrierContactDetails, UUID> { List<CarrierContactDetails> findAll(); CarrierContactDetails findByProcessId(String id); @Transactional List<CarrierContactDetails> deleteByProcessId(String id); }
[ "kb4shubham@gmail.com" ]
kb4shubham@gmail.com
96df209f58989b9412d8f673cb371a52ba7d0483
ca96302dcf423fc3947edf13c1026165d9a4fa3d
/wls-remote-12.1/src/test/java/org/jboss/arquillian/container/wls/remote_12_1/SimpleBean.java
d4a8fd67ecc50bc2e165dc922bc8788271a81356
[]
no_license
arjantijms/arquillian-container-wls
1434d0eefeb8adc1718ec0f7a857f71e3f7ecd2a
39c4ac0c994647320e00f1faebdfeb14cd9ee4be
refs/heads/master
2021-01-15T11:58:15.624641
2015-04-27T22:22:17
2015-04-27T22:22:17
21,043,992
0
0
null
null
null
null
UTF-8
Java
false
false
889
java
/* * JBoss, Home of Professional Open Source * Copyright 2010, Red Hat Middleware LLC, and individual contributors * by the @authors tag. See the copyright.txt in the distribution for a * full listing of individual contributors. * * 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.jboss.arquillian.container.wls.remote_12_1; public class SimpleBean { }
[ "Vineet.Reynolds@gmail.com" ]
Vineet.Reynolds@gmail.com
6cd5dda6f8651a4624d63686fd5a43030cfde471
be38e260926858552e2e420e3c529016ca4136b1
/Tutorial 33 multiple exceptions/src/App.java
33c26880e79a755ca44850a4062de2b509abd670
[]
no_license
MBugajski/udemy-cop-java-tutorials
9533e4f8da46ea5d7f4b0dec5e989037b9e92ffb
1e4ffa7511818180cc7912fae8b744f3768aae8d
refs/heads/master
2021-05-04T18:24:15.614941
2018-02-18T10:40:36
2018-02-18T10:40:36
120,125,545
0
0
null
null
null
null
UTF-8
Java
false
false
995
java
import java.io.FileNotFoundException; import java.io.IOException; import java.text.ParseException; public class App { public static void main(String[] args) { Test test = new Test(); try { test.run(); } catch (IOException e) { System.out.println("IO error"); } catch (ParseException e) { System.out.println("Couldn't parse"); } try { test.run(); } catch (IOException | ParseException e) { e.printStackTrace(); } try { test.run(); //you can use polymorphism to catch all exceptions using just "Exception" as a parent class to all exceptions } catch (Exception e) { e.printStackTrace(); } try { test.input(); //you need to handle exceptions starting from most child-like to the most parent-like. otherwise the parent exception block would catch them all } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } } }
[ "michalbugajski@outlook.com" ]
michalbugajski@outlook.com
c0f80b6700eab86c057710988d52d7d2b4e58d5f
3128688c84fb1a2d5e270b3524b44579fc25dcf3
/asdasdasdasd/src/shiningDarkness/Calculos.java
90b96b3355d25690b506ffa519d8c76952a2661b
[]
no_license
PRETO-BRANCO/Teste_Automatizado
1c41194b78e32270fa6129b37f90ffb5d7fb652f
0d15e49142a3e4af4c2151143cf4f32165fbf482
refs/heads/master
2020-12-22T17:29:08.882024
2020-01-29T00:54:32
2020-01-29T00:54:32
236,873,972
0
0
null
null
null
null
ISO-8859-1
Java
false
false
11,247
java
package shiningDarkness; import java.util.List; import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.Select; import org.openqa.selenium.support.ui.WebDriverWait; public class Calculos { private WebDriver driver; private WebDriverWait wdw; private Signal horizon; private MedCalor medC; private Medicao med; private String ed; private String unidade; public Calculos(WebDriver driver, WebDriverWait wdw, Signal horizon, long starttime, String ed,String unidade) { this.driver = driver; this.wdw = wdw; this.horizon = horizon; this.ed = ed; this.unidade = unidade; medC = new MedCalor(driver, wdw, horizon, starttime, ed, unidade); medC.criar(); medC.criar(); medC.criar(); med = new Medicao(driver, wdw, horizon, starttime, ed, unidade); med.criar(); med.criar(); med.criar(); } public void calculoCalor() { driver.get("https://"+ ed +".apollusehs.com.br/apollus/views/hoe/menu/menuhigiene.html"); this.horizon.waitLoad2(); driver.findElement(By.linkText("Cadastrar Cálculos Estatísticos")).click(); wdw.until(ExpectedConditions.visibilityOf(driver.findElement(By.id("ac-area1-filtro-2")))); this.wdw.until(ExpectedConditions.invisibilityOf(driver.findElement(By.xpath("//div [@class='bg-modal-fake fade in']")))); driver.findElement(By.id("ac-area1-filtro-2")).clear(); driver.findElement(By.id("ac-area1-filtro-2")).sendKeys(unidade); driver.findElement(By.xpath("//li [contains(@class,'ui-menu-item') and contains(text(),'"+ unidade +"')]")).click(); this.horizon.waitLoad2(); driver.findElement(By.id("ac-area2-filtro-2")).clear(); driver.findElement(By.id("ac-area2-filtro-2")).sendKeys("AreaTeste"); driver.findElement(By.xpath("//li [contains(@class,'ui-menu-item') and contains(text(),'AreaTeste')]")).click(); this.horizon.waitLoad2(); driver.findElement(By.id("ac-ghe-filtro-2")).sendKeys("GHETeste"); driver.findElement(By.xpath("//li [contains(@class,'ui-menu-item') and contains(text(),'GHETeste')]")).click(); this.wdw.until(ExpectedConditions.invisibilityOf(driver.findElement(By.xpath("//div [contains(@class,'bg-modal-fake fade in')]")))); driver.findElement(By.id("ac-risco-filtro-2")).sendKeys("calor"); driver.findElement(By.xpath("//li [contains(@class,'ui-menu-item') and contains(text(),'Calor')]")).click(); this.horizon.waitLoad2(); this.wdw.until(ExpectedConditions.invisibilityOf(driver.findElement(By.xpath("//div [contains(@class,'bg-modal-fake fade in')]")))); driver.findElement(By.xpath("//button [@ng-click='buscarMedicoes()']")).click(); this.wdw.until(ExpectedConditions.invisibilityOf(driver.findElement(By.xpath("//div [contains(@class,'bg-modal-fake fade in')]")))); driver.findElement(By.id("bt-calcular")).click(); this.wdw.until(ExpectedConditions.visibilityOf(driver.findElement(By.id("bt-gravar")))); List<WebElement> lista = driver.findElements(By.xpath("//input [contains(@type,'radio') and not(contains(@disabled,'disabled'))]")); lista.get(ThreadLocalRandom.current().nextInt(lista.size())).click(); driver.findElement(By.id("i-data-inicial")).sendKeys("01022019"); driver.findElement(By.id("i-data-final")).sendKeys("28022019"); driver.findElement(By.id("bt-gravar")).click(); this.wdw.until(ExpectedConditions.invisibilityOf(driver.findElement(By.xpath("//div [contains(@class,'bg-modal-fake fade in')]")))); driver.findElement(By.id("bt-voltar")).click(); } public void excluirCalor() { driver.get("https://"+ ed +".apollusehs.com.br/apollus/views/hoe/menu/menuhigiene.html"); this.horizon.waitLoad2(); driver.findElement(By.linkText("Pesquisar Cálculos Estatísticos")).click(); wdw.until(ExpectedConditions.visibilityOf(driver.findElement(By.id("ac-area1-filtro-1")))); this.horizon.sleep(350); this.horizon.waitLoad2(); driver.findElement(By.id("ac-area1-filtro-1")).clear(); driver.findElement(By.id("ac-area1-filtro-1")).sendKeys(unidade); driver.findElement(By.xpath("//li [contains(@class,'ui-menu-item') and contains(text(),'"+ unidade +"')]")).click(); this.horizon.waitLoad2(); driver.findElement(By.id("ac-area2-filtro-1")).clear(); driver.findElement(By.id("ac-area2-filtro-1")).sendKeys("AreaTeste"); driver.findElement(By.xpath("//li [contains(@class,'ui-menu-item') and contains(text(),'AreaTeste')]")).click(); this.horizon.waitLoad2(); driver.findElement(By.id("ac-ghe-filtro-1")).sendKeys("GHETeste"); driver.findElement(By.xpath("//li [contains(@class,'ui-menu-item') and contains(text(),'GHETeste')]")).click(); this.wdw.until(ExpectedConditions.invisibilityOf(driver.findElement(By.xpath("//div [contains(@class,'bg-modal-fake fade in')]")))); driver.findElement(By.id("ac-risco-filtro-1")).sendKeys("calor"); driver.findElement(By.xpath("//li [contains(@class,'ui-menu-item') and contains(text(),'Calor')]")).click(); driver.findElement(By.xpath("//button [@ng-click='buscarCalculos()']")).click(); this.horizon.waitLoad2(); driver.findElement(By.xpath("//td [contains(text(),'Calor')]")).click(); wdw.until(ExpectedConditions.visibilityOf(driver.findElement(By.cssSelector("button[class=\"btn btn-sm btn-default pull-right lb-excluir\"]")))); driver.findElement(By.xpath("//button [@class='btn btn-sm btn-default pull-right lb-excluir']")).click(); wdw.until(ExpectedConditions.visibilityOf(driver.findElement(By.cssSelector("button[class=\"btn btn-sm btn-principal btn-sim margin-left\"]")))); driver.findElement(By.cssSelector("button[class=\"btn btn-sm btn-principal btn-sim margin-left\"]")).click(); this.horizon.waitLoad2(); medC.excluir(); this.horizon.waitLoad(); medC.excluir(); this.horizon.waitLoad(); medC.excluir(); this.horizon.waitLoad(); } public void calcularMedida() { driver.get("https://"+ ed +".apollusehs.com.br/apollus/views/hoe/menu/menuhigiene.html"); this.horizon.waitLoad2(); driver.findElement(By.linkText("Cadastrar Cálculos Estatísticos")).click(); wdw.until(ExpectedConditions.visibilityOf(driver.findElement(By.id("ac-area1-filtro-2")))); driver.manage().timeouts().implicitlyWait(0, TimeUnit.SECONDS); try{ this.wdw.until(ExpectedConditions.invisibilityOf(driver.findElement(By.xpath("//div [@class='bg-modal-fake fade in']")))); } catch(Exception e){ } driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); driver.findElement(By.id("ac-area1-filtro-2")).clear(); driver.findElement(By.id("ac-area1-filtro-2")).sendKeys(unidade); driver.findElement(By.xpath("//li [contains(@class,'ui-menu-item') and contains(text(),'"+ unidade +"')]")).click(); this.horizon.waitLoad2(); driver.findElement(By.id("ac-area2-filtro-2")).clear(); driver.findElement(By.id("ac-area2-filtro-2")).sendKeys("AreaTeste"); driver.findElement(By.xpath("//li [contains(@class,'ui-menu-item') and contains(text(),'AreaTeste')]")).click(); this.horizon.waitLoad2(); driver.findElement(By.id("ac-ghe-filtro-2")).sendKeys("GHETeste"); driver.findElement(By.xpath("//li [contains(@class,'ui-menu-item') and contains(text(),'GHETeste')]")).click(); this.wdw.until(ExpectedConditions.invisibilityOf(driver.findElement(By.xpath("//div [contains(@class,'bg-modal-fake fade in')]")))); driver.findElement(By.id("ac-risco-filtro-2")).sendKeys("Tetraquis (hidroxemetil) fosfônio (sais)"); driver.findElement(By.xpath("//li [contains(@class,'ui-menu-item') and contains(text(),'Tetraquis (hidroxemetil) fosfônio (sais)')]")).click(); this.horizon.waitLoad2(); this.wdw.until(ExpectedConditions.invisibilityOf(driver.findElement(By.xpath("//div [contains(@class,'bg-modal-fake fade in')]")))); Select slek = new Select(driver.findElement(By.id("cb-tipo-filtro-2"))); slek.selectByIndex(1); driver.findElement(By.xpath("//button [@ng-click='buscarMedicoes()']")).click(); this.wdw.until(ExpectedConditions.invisibilityOf(driver.findElement(By.xpath("//div [contains(@class,'bg-modal-fake fade in')]")))); driver.findElement(By.id("bt-calcular")).click(); this.wdw.until(ExpectedConditions.visibilityOf(driver.findElement(By.id("bt-gravar")))); List<WebElement> lista = driver.findElements(By.xpath("//input [contains(@type,'radio') and not(contains(@disabled,'disabled'))]")); lista.get(ThreadLocalRandom.current().nextInt(lista.size())).click(); driver.findElement(By.id("i-data-inicial")).sendKeys("01022019"); driver.findElement(By.id("i-data-final")).sendKeys("28022019"); driver.findElement(By.id("bt-gravar")).click(); } public void excluirMedida() { driver.get("https://"+ ed +".apollusehs.com.br/apollus/views/hoe/menu/menuhigiene.html"); this.horizon.waitLoad2(); driver.findElement(By.linkText("Pesquisar Cálculos Estatísticos")).click(); wdw.until(ExpectedConditions.visibilityOf(driver.findElement(By.id("ac-area1-filtro-1")))); this.horizon.sleep(350); this.horizon.waitLoad2(); driver.findElement(By.id("ac-area1-filtro-1")).clear(); driver.findElement(By.id("ac-area1-filtro-1")).sendKeys(unidade); driver.findElement(By.xpath("//li [contains(@class,'ui-menu-item') and contains(text(),'"+ unidade +"')]")).click(); this.horizon.waitLoad2(); driver.findElement(By.id("ac-area2-filtro-1")).clear(); driver.findElement(By.id("ac-area2-filtro-1")).sendKeys("AreaTeste"); driver.findElement(By.xpath("//li [contains(@class,'ui-menu-item') and contains(text(),'AreaTeste')]")).click(); this.horizon.waitLoad2(); driver.findElement(By.id("ac-ghe-filtro-1")).sendKeys("GHETeste"); driver.findElement(By.xpath("//li [contains(@class,'ui-menu-item') and contains(text(),'GHETeste')]")).click(); this.wdw.until(ExpectedConditions.invisibilityOf(driver.findElement(By.xpath("//div [contains(@class,'bg-modal-fake fade in')]")))); driver.findElement(By.id("ac-risco-filtro-1")).sendKeys("Tetraquis (hidroxemetil) fosfônio (sais)"); driver.findElement(By.xpath("//li [contains(@class,'ui-menu-item') and contains(text(),'Tetraquis (hidroxemetil) fosfônio (sais)')]")).click(); this.horizon.waitLoad2(); driver.findElement(By.xpath("//button [@ng-click='buscarCalculos()']")).click(); this.horizon.waitLoad2(); driver.findElement(By.xpath("//td [contains(text(),'Tetraquis (hidroxemetil) fosfônio (sais)')]")).click(); wdw.until(ExpectedConditions.visibilityOf(driver.findElement(By.cssSelector("button[class=\"btn btn-sm btn-default pull-right lb-excluir\"]")))); driver.findElement(By.xpath("//button [@class='btn btn-sm btn-default pull-right lb-excluir']")).click(); wdw.until(ExpectedConditions.visibilityOf(driver.findElement(By.cssSelector("button[class=\"btn btn-sm btn-principal btn-sim margin-left\"]")))); driver.findElement(By.cssSelector("button[class=\"btn btn-sm btn-principal btn-sim margin-left\"]")).click(); this.horizon.waitLoad2(); med.excluir(); this.horizon.waitLoad(); med.excluir(); this.horizon.waitLoad(); med.excluir(); this.horizon.waitLoad(); } }
[ "preto.gustavo@outlook.com" ]
preto.gustavo@outlook.com
3792f878485d8aeb3c60fdb680bb34e3b9fb322c
a8e4049a30b4e2cf15543b22b81a23747d783b6e
/app/src/main/java/study/android/multitouch/MyDraw.java
3a6b0165e5c26e75b5724def07377eba829d4b94
[]
no_license
vvsirius/Gestures
b0d860930345a3a7ca191f1a1c9730e17aa217a3
288e2643ac3f9265825ad7df9bee7a17ed719e16
refs/heads/master
2021-05-05T19:28:12.007781
2018-01-17T04:15:46
2018-01-17T04:15:46
117,782,869
0
0
null
null
null
null
UTF-8
Java
false
false
4,636
java
package study.android.multitouch; import java.util.ArrayList; import android.content.Context; import android.graphics.Canvas; import android.view.GestureDetector; import android.view.GestureDetector.OnGestureListener; import android.view.MotionEvent; import android.view.ScaleGestureDetector; import android.view.ScaleGestureDetector.OnScaleGestureListener; import android.view.View; import android.view.View.OnTouchListener; public class MyDraw extends View implements OnTouchListener, OnGestureListener, OnScaleGestureListener { GestureDetector gestDetector; ScaleGestureDetector scaleDetector; public MyDraw(Context context) { super(context); setOnTouchListener(this); gestDetector = new GestureDetector(context, this); scaleDetector = new ScaleGestureDetector(context, this); } ArrayList<Drawable> objects = new ArrayList<Drawable>(); public void draw(Canvas canvas) { for (Drawable obj : objects) { obj.draw(canvas); } } @Override public boolean onTouch(View v, MotionEvent event) { // пропускаем событие через детекторы gestDetector.onTouchEvent(event); scaleDetector.onTouchEvent(event); // какой индекс пальца в массиве касаний int index = event.getActionIndex(); // какой id у пальца int id = event.getPointerId(index); // ищем объект, соответствующий пальцу в массиве int i = 0; Finger finger = null; for (; i < objects.size(); i++) { if (!(objects.get(i) instanceof Finger)) continue; finger = (Finger) objects.get(i); if (finger.id == id) break; } // Если не нашли (палец добавился на экран) создаем новый объект-палец if (i == objects.size()) { finger = new Finger(); finger.id = id; objects.add(finger); } // Если отпустили, удаляем объект-палец if (event.getActionMasked() == MotionEvent.ACTION_POINTER_UP || event.getActionMasked() == MotionEvent.ACTION_UP) { objects.remove(i); } // обновляем информацию о касаниях for (i = 0; i < objects.size(); i++) { if (!(objects.get(i) instanceof Finger)) continue; finger = (Finger) objects.get(i); // для каждого объекта ищем ему соответствующий палец int n = event.findPointerIndex(finger.id); if (n != -1) { // и обновляем finger.x = event.getX(n); finger.y = event.getY(n); } } // обновляем рисунок this.invalidate(); return true; } Picture pic; /** Закладывает найденный объект или null в переменную pic */ @Override public boolean onDown(MotionEvent e) { // снимаем выбор pic = null; for (int i = 0; i < objects.size(); i++) { if (!(objects.get(i) instanceof Picture)) continue; Picture p = (Picture) objects.get(i); // если расстояние от точки касания до центра квадратика // меньше половины его стороны if (Math.abs(e.getX() - p.x) < p.size / 2 && Math.abs(e.getY() - p.y) < p.size / 2) { // запоминаем выбор pic = p; } } return false; } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { // TODO Auto-generated method stub if (pic != null && (Math.abs(velocityX) > 5000 || Math.abs(velocityY) > 5000)) { objects.remove(pic); pic = null; } return false; } @Override public void onLongPress(MotionEvent e) { objects.add(new Picture(e.getX(), e.getY())); invalidate(); } @Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { if (pic != null) { pic.x -= distanceX; pic.y -= distanceY; } return true; } @Override public void onShowPress(MotionEvent e) { // TODO Auto-generated method stub } @Override public boolean onSingleTapUp(MotionEvent e) { // TODO Auto-generated method stub return false; } @Override public boolean onScale(ScaleGestureDetector detector) { float scale = detector.getCurrentSpan() - detector.getPreviousSpan(); if (pic != null) { pic.size += scale; invalidate(); } return true; } @Override public boolean onScaleBegin(ScaleGestureDetector detector) { // TRUE!!! return true; } @Override public void onScaleEnd(ScaleGestureDetector detector) { // TODO Auto-generated method stub } void findPic(MotionEvent e) { } }
[ "oivt@ya.ru" ]
oivt@ya.ru
00fc53a324280808935589265e16cc1d0a22caed
ca6e341657f5bf941268425337bd16a7e9a54164
/FinalProject/src/main/java/com/kh/dc/mypage/model/dao/MypageDaoImpl.java
197f25c651b7f3acaaac3c69dd44f2977441c04c
[]
no_license
FINAL-PRO/FINAL-PRO
903dd1a76ab20d0d35d77133eb02787ab48d6997
3ac88ee0503408499bfa4120cf786b87b3f43ca9
refs/heads/master
2020-04-08T07:05:06.117290
2019-01-20T12:17:43
2019-01-20T12:17:43
159,126,007
0
0
null
2019-01-20T12:05:33
2018-11-26T07:09:55
Java
UTF-8
Java
false
false
1,183
java
package com.kh.dc.mypage.model.dao; import java.util.List; import java.util.Map; import org.apache.ibatis.session.RowBounds; import org.mybatis.spring.SqlSessionTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Repository; @Repository public class MypageDaoImpl implements MypageDao{ @Autowired SqlSessionTemplate sqlSession; @Override public List<Map<String, String>> selectCommentList(int cPage, int numPerPage, int mNo) { RowBounds rowBounds = new RowBounds((cPage-1)*numPerPage, numPerPage); return sqlSession.selectList("member_mapper.selectMyCommentList", mNo, rowBounds); } @Override public int selectTotalMyComment(int mNo) { return sqlSession.selectOne("member_mapper.selectTotalMyComment", mNo); } @Override public List<Map<String, String>> selectBoardList(int cPage, int numPerPage, int mNo) { RowBounds rowBounds = new RowBounds((cPage-1)*numPerPage, numPerPage); return sqlSession.selectList("member_mapper.selectMyBoardList", mNo, rowBounds); } @Override public int selectTotalMyBoard(int mNo) { return sqlSession.selectOne("member_mapper.selectTotalMyBoard", mNo); } }
[ "kimsorwa@naver.com" ]
kimsorwa@naver.com
11ecad717654bd589c24c98fdc6573bf08fc9c72
21fb74c584c6f9bc8659e873c13346440930940f
/specification/data/Day.java
69a533fa5a5ef1c36a59a35c12ceaac840a5cab9
[]
no_license
copperwall/SchedulerTool
b23643a10eecd9a71864af04370d848bc4b1d2d5
e97b4c49221b6476a235819462a310d4d7373aa4
refs/heads/master
2021-01-16T18:18:32.957312
2014-03-21T07:51:05
2014-03-21T07:51:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
826
java
package data; import java.util.Collection; import java.lang.Boolean; /** * A day holds 24 booleans of which an instructor is available * to hold a class for that hour. Set and get the availability. */ public abstract class Day { public Collection<Boolean> halfHourAvailability; /** * Sets the availability to the new given availability. */ /*@ requires availableHalfHours != null; ensures halfHourAvailability.equals(availableHalfHours); @*/ public abstract void setAvailability(Collection<Boolean> availableHalfHours); /** * Returns this day's availability */ /*@ requires halfHourAvailability != null; ensures \result != null && \result.equals(halfHourAvailability); @*/ public abstract Collection<Boolean> getAvailability(); }
[ "copperwa@calpoly.edu" ]
copperwa@calpoly.edu
215db2910470c1248bbea4a8c48adcfb7703c9c0
dc5a65a6ad41a5bd6caa95f27f65b5ab483b0ab2
/src/main/java/com/acl/platform/service/impl/IPatformRefundInfoServiceImpl.java
cff9b5045d62b7c5863f220a5c988b2feae5fcf3
[]
no_license
longxionga/mingruida
06b88b1bbf44853ffabade6923855c4b4c112bc5
b776dae9f5292b848e18a3a3fe68b095bc3adebe
refs/heads/master
2022-07-21T00:41:48.509285
2019-07-29T01:57:11
2019-07-29T01:57:11
199,159,948
0
0
null
2022-06-25T07:29:57
2019-07-27T12:07:06
JavaScript
UTF-8
Java
false
false
6,441
java
package com.acl.platform.service.impl; import java.math.BigDecimal; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import com.acl.platform.dao.*; import com.acl.utils.util.UUIDGenerator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.mongodb.core.MongoTemplate; import org.springframework.data.redis.core.StringRedisTemplate; import org.springframework.stereotype.Service; import com.acl.platform.service.IPlatformRefundInfoService; import com.acl.utils.paginator.domain.PageBounds; import com.acl.utils.paginator.domain.PageList; import com.acl.utils.util.StringUtils; import com.anchol.common.component.distributedlock.DistributedLock; import org.springframework.transaction.annotation.Transactional; /** *className:IPatformRefundServiceImpl *author:wangli *createDate:2017年4月5日 下午4:47:25 *vsersion:3.0 *department:安创乐科技 *description:处理微信提现失败后的退款操作 */ @Service @Transactional public class IPatformRefundInfoServiceImpl implements IPlatformRefundInfoService { @Autowired private IPlatformRefundInfoDao platformRefundInfoDao; @Autowired private StringRedisTemplate redisTemplate; @Autowired protected MongoTemplate mongoTemplate; @Autowired private DistributedLock distributedLock; @Autowired private IPlatformWithDrawalsApplyDao platformWithDrawalsApplyDao; @Override public PageList<?> queryRefundInfo(HashMap<String, Object> paramsMap, PageBounds pageBounds) { return platformRefundInfoDao.queryRefundInfo(paramsMap, pageBounds); } @Override public String checkJinYunTongPayOrder(String orderNo, String txType) { Date date=new Date(); //查询订单详情 查询状态 以及商户号 HashMap<String, Object> map=new HashMap<>(); map.put("id", orderNo); Map<String, Object> mapOrder=platformWithDrawalsApplyDao.queryOrderWithdrawalsMoney(map); String reString=""; String tranFlow = StringUtils.convertString(mapOrder.get("out_trade_id")); try { String xml=""; String mac=""; String respMsg=""; String respCode=""; String tranRespCode=""; String tranState =""; String tranRespDesc=""; String tranFlowid=""; switch (txType){ case "jytpay": /*xml = JytBaseTran.getTC2002Xml(tranFlow); mac = JytBaseTran.signMsg(xml); respMsg = JytBaseTran.sendAndReceiveMsg(xml,mac); respCode = JytBaseTran.getMsgRespHead(respMsg, "resp_code"); tranRespCode = JytBaseTran.getMsgRespBody(respMsg, "tran_resp_code"); tranState = JytBaseTran.getMsgRespBody(respMsg, "tran_state"); tranRespDesc = JytBaseTran.getMsgRespBody(respMsg, "tran_resp_desc"); tranFlowid = JytBaseTran.getMsgRespHead(respMsg, "tran_flowid");*/ break; } System.out.println("上送报文"+xml); //加签,用商户端私钥进行加签 System.out.println(respMsg); System.out.println("响应报文"+respMsg); System.out.println("返回码"+respCode); HashMap<String, Object> record=new HashMap<>(); if("S0000000".equals(respCode)) { //查询成功 if("S0000000".equals(tranRespCode)) { if("00".equals(tranState)) { reString="0"; System.out.println("处理中:" + tranRespDesc); } else if("01".equals(tranState)) { reString="1"; //修改订单状态为4 map.put("status", "4"); map.put("update_time",date); platformWithDrawalsApplyDao.updateTxOrder(map); System.out.println("代付成功: " + tranRespDesc); } else { reString="2"; System.out.println(tranRespDesc); } } else if ("E0000000".equals(tranRespCode)) { if("15".equals(tranState)) { reString="0"; System.out.println("待运营审核:" + tranRespDesc); } else if("06".equals(tranState)) { reString="0"; System.out.println("运营审核通过待处理: " + tranRespDesc); } else { reString="2"; System.out.println(tranRespDesc); } } else if (!"E0000000".equals(tranRespCode) && tranRespCode.startsWith("E") && "03".equals(tranState)){ System.out.println("代付失败: " + tranRespDesc); reString="3"; //执行退款操作,并将rs表中订单状态改为:4 人工审核退款 //修改订单状态为4 //状态(1,待审核,2,审核通过,提现中,3.拒绝提现申请,4.审核通过,提现成功,5.提现失败,6.作废) map.put("status", "5"); map.put("update_time",date); map.put("refund_time",date); platformWithDrawalsApplyDao.updateTxOrder(map); record.put("user_id",mapOrder.get("user_id")); //查询用户当前余额 List<Map<String,Object>> list=platformWithDrawalsApplyDao.queryUserCapital(record); BigDecimal balance=new BigDecimal(list.get(0).get("amount").toString()).add(new BigDecimal(StringUtils.convertString(mapOrder.get("money")))); //更新t_user_capital 表中余额信息 record.put("balance",balance); record.put("update_time",date); platformWithDrawalsApplyDao.updateCaptical(record); //增加用户余额 写入退款流水 record.put("id", UUIDGenerator.generate()); record.put("amount",StringUtils.convertString(mapOrder.get("money"))); record.put("operate","subtract"); record.put("purpose","103"); record.put("correlation",orderNo); record.put("description","提现审核失败"); record.put("create_time",date); record.put("update_time",""); platformWithDrawalsApplyDao.insertCapticalBilling(record); // 更新redis的用户余额 /* String lockUserWallet = distributedLock.getLock("wallet", StringUtils.convertString(mapOrder.get("user_id"))); try { String key = "wallet_" + StringUtils.convertString(mapOrder.get("user_id")); BigDecimal userWallet=new BigDecimal(redisTemplate.opsForValue().get(key)); BigDecimal newWallet=userWallet.add(new BigDecimal(mapOrder.get("money").toString())); redisTemplate.opsForValue().set(key, String.valueOf(newWallet)); } finally { distributedLock.releaseLock("wallet", StringUtils.convertString(list.get(0).get("user_id")), lockUserWallet); }*/ } } else if("E0000000".equals(respCode)){ reString="4"; System.out.println("原代付交易异常,请联系渠道!"); } } catch (Exception e) { e.printStackTrace(); } //发送请求并接收响应报文 return reString; } }
[ "605142472@qq.com" ]
605142472@qq.com
da7a5b31d8a8d7b53560cc2368e176dd9733c39d
4c89c07a01bae0331c9c97b1a7b7efd52149caed
/test/Algospot/QuadTreeTest.java
f301cf5e329ff772508c219c872c62e53a4f6275
[]
no_license
lette1394/CodingInterview
59eacec28ff7136b2ecdfc33b11d196c1c0c7805
558ee58dc831bae38bde95262b2b4122bb54450f
refs/heads/master
2021-09-26T03:19:47.952859
2018-10-27T08:54:15
2018-10-27T08:54:15
115,793,573
0
0
null
null
null
null
UTF-8
Java
false
false
900
java
package Algospot; import org.junit.Test; import java.util.*; import java.io.*; import static org.junit.Assert.assertEquals; public class QuadTreeTest { private final ByteArrayOutputStream out = new ByteArrayOutputStream(); private void simulate(String input) { System.setIn(new ByteArrayInputStream(input.getBytes())); System.setOut(new PrintStream(out)); } @Test public void main() throws Exception { String input = "4\n" + "w\n" + "xbwwb\n" + "xbwxwbbwb\n" + "xxwwwbxwxwbbbwwxxxwwbbbwwwwbb\n"; String expected = "w\n" + "xwbbw\n" + "xxbwwbbbw\n" + "xxwbxwwxbbwwbwbxwbwwxwwwxbbwb\n"; simulate(input); QuadTree.main(null); assertEquals(expected, out.toString()); } }
[ "lette1394+github@gmail.com" ]
lette1394+github@gmail.com
7bc1bd8aa38e804226062bccdd5c4a3826bee89b
90f17cd659cc96c8fff1d5cfd893cbbe18b1240f
/src/main/java/com/facebook/react/bridge/NoSuchKeyException.java
ef039d688d3698fe6be7d74b8347990a40e5b2a6
[]
no_license
redpicasso/fluffy-octo-robot
c9b98d2e8745805edc8ddb92e8afc1788ceadd08
b2b62d7344da65af7e35068f40d6aae0cd0835a6
refs/heads/master
2022-11-15T14:43:37.515136
2020-07-01T22:19:16
2020-07-01T22:19:16
276,492,708
0
0
null
null
null
null
UTF-8
Java
false
false
260
java
package com.facebook.react.bridge; import com.facebook.proguard.annotations.DoNotStrip; @DoNotStrip public class NoSuchKeyException extends RuntimeException { @DoNotStrip public NoSuchKeyException(String str) { super(str); } }
[ "aaron@goodreturn.org" ]
aaron@goodreturn.org
acac21e78456e7bfa13a7721827421b4a4d81cc2
22e506ee8e3620ee039e50de447def1e1b9a8fb3
/java_src/com/xiaomi/push/service/receivers/PingReceiver.java
1c9ce0d0594748d64c531433d34a070cccd50c36
[]
no_license
Qiangong2/GraffitiAllianceSource
477152471c02aa2382814719021ce22d762b1d87
5a32de16987709c4e38594823cbfdf1bd37119c5
refs/heads/master
2023-07-04T23:09:23.004755
2021-08-11T18:10:17
2021-08-11T18:10:17
395,075,728
0
0
null
null
null
null
UTF-8
Java
false
false
1,509
java
package com.xiaomi.push.service.receivers; import android.app.AlarmManager; import android.app.PendingIntent; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.text.TextUtils; import com.xiaomi.channel.commonutils.logger.AbstractC1855b; import com.xiaomi.push.service.AbstractC1993y; import com.xiaomi.push.service.XMPushService; import com.xiaomi.push.service.timers.C1984a; public class PingReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { new C1984a(context).mo10426a(false); AbstractC1855b.m6722c(intent.getPackage() + " is the package name"); if (!AbstractC1993y.f5166o.equals(intent.getAction())) { AbstractC1855b.m6718a("cancel the old ping timer"); ((AlarmManager) context.getSystemService("alarm")).cancel(PendingIntent.getBroadcast(context, 0, new Intent(context, PingReceiver.class), 0)); } else if (TextUtils.equals(context.getPackageName(), intent.getPackage())) { AbstractC1855b.m6722c("Ping XMChannelService on timer"); try { Intent intent2 = new Intent(context, XMPushService.class); intent2.putExtra("time_stamp", System.currentTimeMillis()); intent2.setAction("com.xiaomi.push.timer"); context.startService(intent2); } catch (Exception e) { AbstractC1855b.m6720a(e); } } } }
[ "sassafrass@fasizzle.com" ]
sassafrass@fasizzle.com
b8b5adec915e0a44859d47ac028e460172f12b8b
ab4d7df6705eaa4d3364d037b695221a25a1acde
/src/hackerrank/TimeConversion.java
9349b5ee1188951adec7e2498ec092dc910ee841
[]
no_license
sergeybezzub/SandBox
e4ab48de4790545b1c4d128ec4ce4ff0a9a974d8
33ca7b2ea81b4d298e2ecbea4c9e870cc054d1b0
refs/heads/master
2021-01-10T04:57:33.820511
2016-03-16T17:36:31
2016-03-16T17:36:31
54,051,344
0
0
null
2023-09-12T16:47:29
2016-03-16T17:08:34
Java
UTF-8
Java
false
false
1,111
java
package hackerrank; import java.util.Scanner; public class TimeConversion { private static final String _12_NOON = "12 NOON"; private static final String EMPTY_REPLACEMENT = ""; private static final String AM = "AM"; private static final String PM = "PM"; public static void main(String[] args) { Scanner in = new Scanner(System.in); String time = in.nextLine(); in.close(); time = time.toUpperCase(); if( time.endsWith(PM) ) { time = time.replace(PM, EMPTY_REPLACEMENT); String[] parts = time.split(":"); int hours = Integer.valueOf(parts[0]); if(hours != 12) { hours+=12; } System.out.println(EMPTY_REPLACEMENT+hours+":"+parts[1]+":"+parts[2]); } else if( time.endsWith(AM) ) { time = time.replace(AM, EMPTY_REPLACEMENT); String[] parts = time.split(":"); int hours = Integer.valueOf(parts[0]); if(hours == 12) { parts[0]="00"; } System.out.println(parts[0]+":"+parts[1]+":"+parts[2]); } else if(time.equals(_12_NOON)) { System.out.println("12:00:00"); } else { System.out.println(time); } } }
[ "sergeybezzub@yahoo.com" ]
sergeybezzub@yahoo.com
c58d37b768be8b85d3ecf978919ed391a252d042
cbf1b94fba9bff703bda4a5f579e8bd2f670be2b
/src/test/java/cn/cjp/demo/SynObjectDemo.java
2ea1476343113c98707d996ede6e3bbebc3bea8a
[]
no_license
JPCui/cjp-spider
1703d791ca10d7596247aeb35a59ae317bc9297a
1a0cb20cdf229dde0950d3f9100465dd9136a418
refs/heads/master
2022-12-23T22:02:30.630975
2017-01-20T03:01:41
2017-01-20T03:01:41
26,733,472
2
1
null
null
null
null
UTF-8
Java
false
false
703
java
package cn.cjp.demo; import org.apache.log4j.Logger; public class SynObjectDemo { /** * Logger for this class */ private static final Logger logger = Logger.getLogger(SynObjectDemo.class); public int num = 0; public static void main(String[] args) { final SynObjectDemo demo = new SynObjectDemo(); new Thread(new Runnable() { public void run() { synchronized (demo) { try { logger.info(demo.num); Thread.sleep(5000); logger.info(demo.num); } catch (InterruptedException e) { } } } }).start(); logger.info("---------"); synchronized (demo) { demo.num = 99; } logger.info(demo.num); } }
[ "624498030@qq.com" ]
624498030@qq.com
4f50246e93398d23ebd3ae3b59203b5f86174b55
2294d667dcdadf90349a99ea3ad9b710f9767aa7
/eclipse-workspace/Java10_Object/src/com/test/chap01_encapsulation/Score.java
593c524a69bd7f0a8beaedbbf51572841271fa12
[]
no_license
lafayetteey/WorkSpace_Java
a3a8ef4e6d9b29502350de2ec76f558f729530f1
ec2e0df912190495cd2013c6750eee59ef91b9c2
refs/heads/master
2022-11-29T05:26:15.233522
2020-08-05T03:32:13
2020-08-05T03:32:13
258,063,309
0
0
null
null
null
null
UHC
Java
false
false
1,307
java
package com.test.chap01_encapsulation; public class Score { //field private String name; private int kor =90; private int eng = 84; private int mat = 97; public Score() { } //총합을 구하여 출력하는 메소드 public void sum() { System.out.println("총합: " + (kor+eng+mat)); } //평균을 구하여 출력하는 메소드 public void avg1() { System.out.println("평균: " + (kor + eng + mat) /3.0); } //제일높은 점수를 받은 과목을 찾는 메소드 public void maxPoint() { if(kor>eng && kor >mat) { System.out.println("국어가 제일 높은 점수"); } else if(eng>kor && eng > mat) { System.out.println("영어가 제일 높은 점수"); } else { System.out.println("수학이 제일 높은 점수"); } } //제일 낮은 점수를 받은 과목을 찾는 메소드 public void minPoint() { if(kor<eng && kor < mat) { System.out.println("국어가 제일 낮은 점수"); } else if(eng < kor && eng < mat) { System.out.println("영어가 제일 낮은 점수"); } else { System.out.println("수학이 제일 낮은 점수"); } } //필드값을 확인할수있는 information() 메소드 public void information() { System.out.println("name " + name + " kor " + kor + " eng " + eng + " mat " + mat); } }
[ "ksjason162@gmail.com" ]
ksjason162@gmail.com
7d9afe7ed8f030b29a306c1569fa4a33da0e6d95
618d877ff4e57f03fde767996480602ab1c5f668
/app/src/main/java/cuanlee/pcstore_application/services/Impl/RAMServiceImpl.java
cc16e255d6c1ded8768c7b155cbe58a0fe9375cb
[]
no_license
OptimusLee/pcStoreApp
201236e5e9227c1273b23fa55fc1a7f58c4f4b33
25fa6f31fe8df8e4ce9d1f4f137029cd7cfacb46
refs/heads/master
2020-09-16T20:19:32.929892
2016-09-01T17:16:46
2016-09-01T17:16:46
67,104,990
0
0
null
null
null
null
UTF-8
Java
false
false
945
java
package cuanlee.pcstore_application.services.Impl; import java.util.List; import cuanlee.pcstore_application.model.RAM; import cuanlee.pcstore_application.repository.RestAPI; import cuanlee.pcstore_application.repository.rest.RestRAMAPI; import cuanlee.pcstore_application.services.RAMService; /** * Created by CuanL on 30/08/2016. */ public class RAMServiceImpl implements RAMService { final RestAPI<RAM,Long> rest = new RestRAMAPI(); @Override public RAM findById(Long aLong) { return rest.get(aLong); } @Override public String save(RAM entity) { return rest.post(entity); } @Override public String update(RAM entity) { return rest.put(entity); } @Override public String delete(RAM entity) { return rest.delete(entity); } @Override public List<RAM> findAll() { return rest.getAll(); } }
[ "cuan.secret.lee@gmail.com" ]
cuan.secret.lee@gmail.com
61a67d2ef4d3993656c51e14eb56499b445b90af
8e51498977b4e2374a50ebc7a8eb6062c7b164db
/databinding/src/androidTest/java/com/htk/databinding/ExampleInstrumentedTest.java
0a629840e332049e5c79f88a832fd8ab2c8129de
[]
no_license
AxeChen/JetPackDemo
d0ff34d4bcaab351bdd0a8a5d73a78953f803f91
5676fe89ce4f85d4140f50f1b07c207395c2763b
refs/heads/main
2021-07-15T16:19:46.678493
2021-04-30T07:41:27
2021-04-30T07:41:27
245,586,625
0
0
null
null
null
null
UTF-8
Java
false
false
752
java
package com.htk.databinding; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.htk.databinding", appContext.getPackageName()); } }
[ "1137366723@qq.com" ]
1137366723@qq.com
80e9060ddc2c0e785464a137c0ce279d7126f434
907f98fb1cfe2422e4de7664f128c106b79c484a
/sources/kinesis/src/main/java/com/informatica/surf/sources/kinesis/RecordProcessor.java
f00c49e52b1b2e94ababed5110ee88dd50163573
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
maduhu/Surf
2cb6bddc3a8e3f8f11e9be72542bd40e7386d97b
f53bdef74fa9f7ae596b4dd2690201d3cad8a799
refs/heads/master
2020-12-24T19:51:21.763996
2014-04-10T06:58:10
2014-04-10T06:58:10
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,689
java
/* * Copyright 2014 Informatica Corp. * * 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.informatica.surf.sources.kinesis; import com.amazonaws.services.kinesis.clientlibrary.exceptions.InvalidStateException; import com.amazonaws.services.kinesis.clientlibrary.exceptions.KinesisClientLibDependencyException; import com.amazonaws.services.kinesis.clientlibrary.exceptions.ShutdownException; import com.amazonaws.services.kinesis.clientlibrary.exceptions.ThrottlingException; import com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessor; import com.amazonaws.services.kinesis.clientlibrary.interfaces.IRecordProcessorCheckpointer; import com.amazonaws.services.kinesis.clientlibrary.types.ShutdownReason; import com.amazonaws.services.kinesis.model.Record; import com.lmax.disruptor.RingBuffer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; /** * * @author Informatica Corp */ class RecordProcessor implements IRecordProcessor { private static final Logger _logger = LoggerFactory.getLogger(RecordProcessor.class); private final RingBuffer<KinesisEvent> _buffer; public RecordProcessor(RingBuffer buf) { _buffer = buf; } @Override public void initialize(String string) { _logger.info("RecordProcessor initialized"); } @Override public void processRecords(List<Record> list, IRecordProcessorCheckpointer irpc) { _logger.info("Processing {} records", list.size()); for(Record r: list){ String data = new String(r.getData().array()); long seq = _buffer.next(); KinesisEvent evt = _buffer.get(seq); evt.setData(data); _buffer.publish(seq); } try{ irpc.checkpoint(); } catch(InvalidStateException | KinesisClientLibDependencyException | ShutdownException | ThrottlingException ex){ _logger.warn("Exception while checkpointing", ex); } } @Override public void shutdown(IRecordProcessorCheckpointer irpc, ShutdownReason sr) { _logger.info("Shutting down record processor"); } }
[ "jerry.raj@gmail.com" ]
jerry.raj@gmail.com
3a85e1715de14c3f22be08ffec65ed7f26fb31de
42c87630a0fa1ed047a7119da3a4bf1daaa7e91a
/ecc/build/src/com/siteview/ecc/monitorbrower/GroupSelectTree.java
222c1389cefd84831bd1eaf836a9d733d8f096ad
[]
no_license
tangyingty/ecc88
225d7f393dfb6ebd274b496a986a0132da8186f0
87ad6a1d74acd84968cc76c86dc339803f3048a1
refs/heads/master
2021-01-01T06:54:18.340478
2013-12-03T06:10:31
2013-12-03T06:10:31
14,197,256
0
1
null
null
null
null
GB18030
Java
false
false
14,634
java
package com.siteview.ecc.monitorbrower; import java.util.ArrayList; import java.util.List; import org.zkoss.util.resource.Labels; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.Session; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.Messagebox; import org.zkoss.zul.Tree; import org.zkoss.zul.Treechildren; import org.zkoss.zul.Treeitem; import com.siteview.base.data.VirtualView; import com.siteview.base.tree.INode; import com.siteview.ecc.alert.control.CheckableTreeitem; import com.siteview.ecc.alert.util.BaseTools; import com.siteview.ecc.treeview.EccTreeItem; import com.siteview.ecc.treeview.EccTreeModel; import com.siteview.ecc.treeview.EccWebAppInit; import com.siteview.ecc.treeview.controls.BaseTreeitem; public class GroupSelectTree extends Tree { private static final long serialVersionUID = -6802096244149353160L; private boolean checkable = true; private EccTreeModel treemodel = null; public EccTreeModel getTreemodel() { return treemodel; } private String viewName = null; /** * 取得视图名称 * * @return 视图名称 */ public String getViewName() { return viewName; } /** * 设置视图名称 * * @param viewName * 视图名称 */ public void setViewName(String viewName) { this.viewName = viewName; initTree(); } private String type = null; /** * 设置显示的检测器类型 * * @param monitorType * 检测器类型 */ public void setMonitorType(String monitorType) { this.type = monitorType; initTree(); } /** * 取得设置的检测器类型 * * @return 检测器类型 */ public String getMonitorType() { return type; } /** * 是否有复选框 * * @return true/false */ public boolean isCheckable() { return checkable; } /** * 设置是否有复选框 * * @param checkable * 是否有复选框 */ public void setCheckable(boolean checkable) { this.checkable = checkable; } // id列表 private List<String> selectedIds = new ArrayList<String>(); /** * 组件创建事件 初始化信息 */ public void onCreate() throws Exception { try { // 将已经选择的ids,给添加到id列表中去 String target = (String) this.getDesktop().getExecution() .getAttribute("all_selected_ids"); if (target == null) { target = (String) this.getVariable("all_selected_ids", true); } if (target != null) { String[] idsArray = target.split(","); for (String idstr : idsArray) { if (idstr == null) continue; if ("".equals(idstr)) continue; selectedIds.add(idstr); } } // 初始化树 initTree(); } catch (Exception e) { Messagebox.show(e.getMessage(), Labels.getLabel("Error"), Messagebox.OK, Messagebox.ERROR); } } /** * Treeitem给展开的时候的执行代码 */ class TreeitemOpenListener implements org.zkoss.zk.ui.event.EventListener { private BaseTreeitem treeitem = null; private EccTreeItem node = null; private GroupSelectTree tree; public TreeitemOpenListener(BaseTreeitem treeitem, GroupSelectTree tree) throws Exception { this.treeitem = treeitem; this.tree = tree; Object obj = treeitem.getValue(); // 不带有节点信息 if (obj instanceof EccTreeItem) { node = (EccTreeItem) obj; } else { throw new Exception("该节点不包含预定的合法的数据:" + obj != null ? obj .getClass().getName() : "NULL"); } } @Override public void onEvent(Event event) throws Exception { try { if (node == null) return; // 过滤不需要处理的节点 Treechildren mytreechildren = treeitem.getTreechildren(); // 无子节点或者是处于收缩状态的节点 if (mytreechildren == null || mytreechildren.getChildren().size() > 0 || treeitem.isOpen() == false) return; // 是监测器节点的情况 List<EccTreeItem> sons = node.getChildRen(); // 查找其儿子 if (sons != null && sons.size() > 0) { for (EccTreeItem son : sons) { if (son == null) continue; // 如果是监视器 -- 页节点 if (INode.GROUP.equals(son.getType())) { if (existChildren(son) && hasGroup(son)) { // 如果存在儿子 BaseTreeitem tii = getTreeitem(son); tii.setParent(mytreechildren); Treechildren newtreechildren = new Treechildren(); tii.appendChild(newtreechildren);// 给以可以展开的属性 tii .addEventListener(Events.ON_OPEN, new TreeitemOpenListener(tii, this.tree));// 添加展开事件 } else { BaseTreeitem tii = getTreeitem(son); tii.setParent(mytreechildren); } } else {// 不是Group,但是存在子节点 continue; } } } } catch (Exception e) { e.printStackTrace(); Messagebox.show(e.getMessage(), Labels.getLabel("Error"), Messagebox.OK, Messagebox.ERROR); } } } public boolean hasGroup(EccTreeItem node) { boolean flag = false; List<EccTreeItem> sons = node.getChildRen(); for (EccTreeItem son : sons) { if (son.getType().equals(INode.GROUP)) { flag = true; break; } } return flag; } /** * 当Treeitem给选择上的时候,执行 */ private class TreeitemCheckListener implements org.zkoss.zk.ui.event.EventListener { private BaseTreeitem treeitem = null; private EccTreeItem localnode = null; public TreeitemCheckListener(BaseTreeitem treeitem) throws Exception { this.treeitem = treeitem; Object obj = treeitem.getValue(); // 不带有节点信息 if (obj instanceof EccTreeItem) { localnode = (EccTreeItem) obj; } else { throw new Exception("该节点不包含预定的合法的数据:" + obj != null ? obj .getClass().getName() : "NULL"); } } @Override public void onEvent(Event event) throws Exception { try { if (this.treeitem.isChecked()) { selectChildren(treeitem); } else { disselectChildren(treeitem); } } catch (Exception e) { e.printStackTrace(); Messagebox.show(e.getMessage(), Labels.getLabel("Error"), Messagebox.OK, Messagebox.ERROR); } } /** * 增加检测器节点id到清单中 */ private void addGroupsToList(String name) { if (selectedIds.contains(name)) return; selectedIds.add(name); } /** * 从清单中,清除节点node.id */ private void removeGroupsFromList(String name) { selectedIds.remove(name); } /** * 刷新节点的选择 -- 子节点们 */ private void selectChildren(BaseTreeitem treeitem) throws Exception { INode node = ((EccTreeItem)treeitem.getValue()).getValue(); if(node.getType().equals(INode.GROUP)) addGroupsToList(node.getName()); if (treeitem.getTreechildren() == null) return; for (Object item : treeitem.getTreechildren().getItems()) { if (item instanceof BaseTreeitem) { ((BaseTreeitem) item).setChecked(true); selectChildren((BaseTreeitem) item); } } } // public void allLookdownChildren(BaseTreeitem treeitem) throws Exception { // BaseTreeitem itm = treeitem.getParentItem(); // if (itm == null) // return; // addGroupsToList(((EccTreeItem) treeitem.getValue()).getTitle()); // itm.setChecked(true); // allLookdownChildren(itm); // } // // public void allLookdownParent(BaseTreeitem treeitem) throws Exception { // BaseTreeitem itm = treeitem.getParentItem(); // if (itm == null) // return; // this.removeGroupsFromList(((EccTreeItem) treeitem.getValue()) // .getTitle()); // itm.setChecked(false); // allLookdownChildren(itm); // } /** * 刷新节点的选择 -- 父节点们 */ private void disselectChildren(BaseTreeitem treeitem) throws Exception { INode node = ((EccTreeItem)treeitem.getValue()).getValue(); if(node.getType().equals(INode.GROUP)) removeGroupsFromList(node.getName()); if (treeitem.getTreechildren() == null) return; for (Object item : treeitem.getTreechildren().getItems()) { if (item instanceof BaseTreeitem) { ((BaseTreeitem) item).setChecked(false); disselectChildren((BaseTreeitem) item); } } } } /** * 初始化树上的数据 * */ public void initTree() { Session session = Executions.getCurrent().getDesktop().getSession(); Object selectedViewNameObject = session.getAttribute("selectedViewName"); if(selectedViewNameObject!=null){ String selectedViewName =(String)selectedViewNameObject; if(selectedViewName != null && !selectedViewName.isEmpty()){ this.viewName = selectedViewName; } } this.initTree(this.getViewName()); } private void initTree(String virtualName) { // 取得view this.treemodel = EccTreeModel.getInstanceForAlertByViewName( getDesktop().getSession(), virtualName); this.treemodel.setDisplayMonitor(true); // 清除树里的节点 clearTree(); Treechildren treechildren = this.getTreechildren(); treechildren.setParent(this); EccTreeItem root = this.treemodel.getRoot(); if (root == null) return; // 缺省视图的时候,取第一个根 if (VirtualView.DefaultView.equals(virtualName) || virtualName == null) { for (EccTreeItem item : root.getChildRen()) { root = item; break; } } // 显示第一层节点 for (EccTreeItem item : root.getChildRen()) { try { BaseTreeitem ti = getTreeitem(item); ti.setParent(treechildren); if (existChildren(item)) { // 存在子节点,则添加可展开属性和展开事件 Treechildren mytreechildren = new Treechildren(); ti.appendChild(mytreechildren); ti.addEventListener(Events.ON_OPEN, new TreeitemOpenListener(ti, this)); ti.addEventListener(Events.ON_CHECK, new TreeitemCheckListener(ti)); } } catch (Exception e) { e.printStackTrace(); } } // 展开节点,如果是缺省视图,展开第一层 if (VirtualView.DefaultView.equals(virtualName) || virtualName == null) { this.open(2); } } private void open(int level) { Treechildren treechildren = this.getTreechildren(); for (int mylevel = 0; mylevel < level; mylevel++) { for (Object object : treechildren.getItems()) { if (object instanceof Treeitem) { Treeitem item = (Treeitem) object; item.setOpen(true); Events.sendEvent(item, new Event(Events.ON_OPEN, item)); treechildren = item.getTreechildren(); if (treechildren == null || treechildren.getChildren().size() == 0) { continue; } break; } } } } /** * 清除树里的节点 */ private void clearTree() { this.clear(); if (this.getTreechildren() == null) { new Treechildren().setParent(this); } } /** * 节点node是否存在儿子 * * @param node * 节点 * @return 是、否 */ private boolean existChildren(EccTreeItem node) { List<String> ids = getAllMonitors(treemodel, node); if (ids == null || ids.size() == 0) return false; return true; /* * if (node.getChildRen()!=null && node.getChildRen().size() > 0){ * return true; } return false; */ } private List<String> getAllMonitors(EccTreeModel treemodel, EccTreeItem node) { List<String> retlist = BaseTools.getAllMonitors(this.getMonitorType(), treemodel, node); return retlist; } /** * 通过node,取得初始化了属性的Treeitem * * @throws Exception */ private BaseTreeitem getTreeitem(EccTreeItem node) throws Exception { BaseTreeitem tii = this.isCheckable() ? new CheckableTreeitem() : new BaseTreeitem(); this.setTreeitem(tii, node); tii.addEventListener(Events.ON_CHECK, new TreeitemCheckListener(tii)); return tii; } /** * 设置treeitem的初始化属性 * * @param tii * :需要初始化属性的treeitem * @param node * : 其node值 */ private void setTreeitem(BaseTreeitem tii, EccTreeItem node) { tii.setLabel(node.toString()); // tii.setId(node.getId()); tii.setImage(getImage(node)); tii.setOpen(false); tii.setChecked(this.existNode(node)); tii.setValue(node); } // /** // * 清单中是否存在该id // * @param id // * @return 是、否 // */ // public boolean existIdById(String id){ // if (id == null) return false; // for (String idstr : this.selectedIds){ // if (this.isChildId(id,idstr)) return true; // if (id.equals(idstr)) return true; // } // return false; // } private boolean existNode(EccTreeItem node) { if (node == null) return false; if (node.getId() == null) return false; for (String idstr : this.selectedIds) { if (this.isChildId(node, idstr)) return true; if (node.getId().equals(idstr)) return true; } return false; } /** * 判断是否是parentid的子孙 * * @param parentid * :父id * @param id * : 子孙id * @return 是、否 */ private boolean isChildId(String parentid, String id) { if (parentid == null) return false; if (id == null) return false; EccTreeItem node = treemodel.findNode(parentid); return isChildId(node, id); // if (parentid.startsWith("i")) return true; // return (id.startsWith(parentid + ".")); } private boolean isChildId(EccTreeItem parentnode, String id) { if (parentnode == null) return false; if (id == null) return false; for (EccTreeItem son : parentnode.getChildRen()) { if (id.equals(son.getId())) return true; if (isChildId(son, id)) return true; } return false; // if (parentid.startsWith("i")) return true; // return (id.startsWith(parentid + ".")); } /** * 取得node的表示用图像的链接 * * @param node * @return 图像的链接 */ private String getImage(EccTreeItem node) { if (node.getType().equals(INode.GROUP) || node.getType().equals(INode.ENTITY) || node.getType().equals(INode.MONITOR)) return EccWebAppInit.getInstance().getImage(node.getType(), node.getStatus()); else return EccWebAppInit.getInstance().getImage(node.getType()); } /** * 取得设置的全部id值 * * @return List<String> */ public List<String> getSelectedIds() { return selectedIds; } /** * 取得设置的全部id值 * * @return String 形如"id1,id2,id3,"的字符串 */ public String getAllSelectedIds() { StringBuffer sb = new StringBuffer(); for (String obj : getSelectedIds()) { if (sb.length() > 0) sb.append(";"); sb.append(obj); } if (sb.length() == 0) { return null; } sb.append(";"); return sb.toString(); } }
[ "ying.tang@dragonflow.com" ]
ying.tang@dragonflow.com
89c14a4d782a8c321b62dd2bf48892cebb6f3edd
2c6a56df5f397db4dd490bc5e2f08326a1d04598
/app/src/main/java/com/example/inviter/invtandroid/adapters/EventsAdapter.java
4bf47887541963d6fe5533af2db43a8df494ce09
[]
no_license
Ravikant02/Android
1eecc1b6fca8500a8ccf3243884c897925d9c259
6a4e8aa4d8fb7ed1e1c0e6a92d706fb39dd6d381
refs/heads/master
2020-06-11T19:49:36.822836
2016-12-16T12:43:42
2016-12-16T12:43:42
75,625,887
0
0
null
null
null
null
UTF-8
Java
false
false
5,891
java
package com.example.inviter.invtandroid.adapters; import android.content.Context; import android.content.Intent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.TextView; import com.example.inviter.invtandroid.R; import com.example.inviter.invtandroid.api.response.eventslibrary.UserEvent; import com.example.inviter.invtandroid.core.InviterCore; import java.util.List; /** * Created by Ravikant on 12/12/16. */ public class EventsAdapter extends BaseAdapter { private Context context; private LayoutInflater inflater; private List<UserEvent> events; public EventsAdapter (Context context, List<UserEvent> events){ inflater=(LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); this.context = context; this.events = events; } @Override public int getCount() { return this.events.size(); } @Override public Object getItem(int i) { return this.events.get(i); } @Override public long getItemId(int i) { return 0; } @Override public View getView(int i, View view, ViewGroup viewGroup) { ViewHolder viewHolder ; if(view == null) { viewHolder = new ViewHolder(); view = inflater.inflate(R.layout.event_details_layout, null, false); viewHolder.txtEventTitle = (TextView)view.findViewById(R.id.txtEventTitle); viewHolder.txtEventFullDate = (TextView)view.findViewById(R.id.txtFullDate); viewHolder.txtEventDate = (TextView)view.findViewById(R.id.txtDate); viewHolder.txtEventVenue = (TextView)view.findViewById(R.id.txtVenue); viewHolder.txtRsvpYes = (TextView)view.findViewById(R.id.txtRsvpYes); viewHolder.txtRsvpNo = (TextView)view.findViewById(R.id.txtRsvpNo); viewHolder.txtRsvpMaybe = (TextView)view.findViewById(R.id.txtRsvpMayBe); viewHolder.txtVidoDuration = (TextView)view.findViewById(R.id.txtVideoDuration); viewHolder.imgPlay = (ImageView) view.findViewById(R.id.imgPlay); viewHolder.imgShare = (ImageView) view.findViewById(R.id.imgShare); viewHolder.imgVideoThumb = (ImageView) view.findViewById(R.id.imgTop); viewHolder.progressBarRsvpYes = (ProgressBar) view.findViewById(R.id.circularProgressRsvpYes); viewHolder.progressBarRsvpNo = (ProgressBar) view.findViewById(R.id.circularProgressRsvpNo); viewHolder.progressBarRsvpMayBe = (ProgressBar) view.findViewById(R.id.circularProgressRsvpMayBe); viewHolder.relativeLayoutEventDetails = (RelativeLayout) view.findViewById(R.id.relativeLayoutEventDetails); view.setTag(viewHolder); } else { viewHolder = (ViewHolder)view.getTag(); } final UserEvent event = events.get(i); if (event==null) return null; if (event.getEventInfo().getEventType().equalsIgnoreCase("0")) viewHolder.relativeLayoutEventDetails.setVisibility(View.GONE); viewHolder.txtEventTitle.setText(event.getEventInfo().getEventTitle()); viewHolder.txtEventVenue.setText(event.getEventInfo().getEventVenue()); viewHolder.txtEventDate.setText(InviterCore.getShortDate(event.getEventInfo().getEventStartDate())); viewHolder.txtRsvpYes.setText(event.getRsvpCount().getYes()+""); viewHolder.txtRsvpNo.setText(event.getRsvpCount().getNo()+""); viewHolder.txtRsvpMaybe.setText(event.getRsvpCount().getMayBe()+""); viewHolder.txtVidoDuration.setText(event.getEventInfo().getEventVideoLength()); // viewHolder.txtEventFullDate.setText(event.getEventInfo().getEventStartDate()+","+event.getEventInfo().getEventStartTime()); viewHolder.txtEventFullDate.setText(event.getEventInfo().getEventStartDate()+", "+ InviterCore.getTimeWithString(event.getEventInfo().getEventStartTime())); int rsvpYesGuests = (event.getRsvpCount().getYes() * 100) / event.getRsvpCount().getTotalGuests(); int rsvpNoGuests = (event.getRsvpCount().getNo() * 100) / event.getRsvpCount().getTotalGuests(); int rsvpMaybeGuests = (event.getRsvpCount().getMayBe() * 100) / event.getRsvpCount().getTotalGuests(); viewHolder.progressBarRsvpYes.setProgress(rsvpYesGuests); viewHolder.progressBarRsvpNo.setProgress(rsvpNoGuests); viewHolder.progressBarRsvpMayBe.setProgress(rsvpMaybeGuests); viewHolder.imgShare.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { Intent sendIntent = new Intent(); sendIntent.setAction(Intent.ACTION_SEND); sendIntent.putExtra(Intent.EXTRA_TEXT, event.getEventInfo().getShareURL()); sendIntent.setType("text/plain"); context.startActivity(sendIntent); } }); // viewHolder.title.setTag(categories.get(position).getType()); return view; } private static class ViewHolder{ private TextView txtEventTitle; private TextView txtEventFullDate; private TextView txtEventDate; private TextView txtEventVenue; private TextView txtRsvpYes; private TextView txtRsvpNo; private TextView txtRsvpMaybe; private TextView txtVidoDuration; private ImageView imgPlay; private ImageView imgShare; private ImageView imgVideoThumb; private ProgressBar progressBarRsvpYes; private ProgressBar progressBarRsvpNo; private ProgressBar progressBarRsvpMayBe; private RelativeLayout relativeLayoutEventDetails; } }
[ "ravikant.software@gmail.com" ]
ravikant.software@gmail.com
13ab036e6230e4d2c5902965af0650489adfc923
258a27152846dda1a95605784bf475a43562b00b
/app/src/main/java/rewards/rewardsapp/presenters/Presenter.java
36fcd2866f0baa8ac40eb8352b492e6a16addd4c
[]
no_license
hixio-mh/RewardsApp
2525c7ba5e7836e44893a6ee0cd4f86493141994
4754577848ad420afc93a8eab54aa0184cb7dfed
refs/heads/master
2022-01-10T11:54:51.909352
2019-01-07T15:25:46
2019-01-07T15:25:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,636
java
package rewards.rewardsapp.presenters; import java.util.List; import rewards.rewardsapp.models.RedeemInformation; import rewards.rewardsapp.models.RestModel; import rewards.rewardsapp.models.ScratchModel; import rewards.rewardsapp.models.SlotReel; import rewards.rewardsapp.models.SlotsModel; import rewards.rewardsapp.models.UserInformation; import rewards.rewardsapp.models.ImageInfo; /** * Created by Andrew Miller on 9/28/2017. */ public class Presenter { private RestModel restModel; private SlotsModel slotsModel; private ScratchModel scratchModel; private ScratchModel bonusScratchModel; private RedeemInformation redeemModel; public Presenter(){ restModel = new RestModel(); } // // This section covers methods related to RestModel // public String restPost(String task, String data) { return restModel.restPost(task, data); } public String restPut(String task, String data) { return restModel.restPut(task, data); } public String restDelete(String task, String toDelete) { return restModel.restDelete(task, toDelete);} public String restGet(String task, String toGet) { return restModel.restGet(task, toGet); } // //This method is used to send earned points to the server; // public String sendPoints(int points, int tokens, int tokensSpent, String id){ return restPut("putPointsInfo", new UserInformation(points, tokens, 0,tokensSpent, id).jsonStringify());} // // This section covers the methods related to RedeemInformation // // public void setRedeemModel(int cost, String type, String title, String id){redeemModel = new RedeemInformation(cost, type, id);} // // public String redeemPoints(){return redeemModel.redeem();} // // This section covers methods related to ScratchModel // public void setScratchModel(String modelName, ImageInfo[] imageBank){ if(modelName.equals("scratchModel")) scratchModel = new ScratchModel(imageBank); if(modelName.equals("tokenModel")) bonusScratchModel = new ScratchModel(imageBank); } public int scratchNumGen(String modelName){ if(modelName.equals("scratchModel")) return scratchModel.numGen(); if(modelName.equals("tokenModel")) return bonusScratchModel.numGen(); return 0; } public List<ImageInfo> getFrequencies(String modelName){ if(modelName.equals("scratchModel")) return scratchModel.getWinners(); if(modelName.equals("tokenModel")) return bonusScratchModel.getWinners(); return null; } public boolean checkAllRevealed(boolean[] revealed){return scratchModel.checkAllRevealed(revealed);} // // This section covers methods related to SlotsModel // public void setSlotsModel(ImageInfo[] imageBank, SlotReel.ReelListener[] reelListeners){ slotsModel = new SlotsModel(imageBank, reelListeners);} public List<ImageInfo> checkSlotsWin(){ return slotsModel.checkWin();} public void spinReels(){slotsModel.spinReels();} public void setFrameDuration(long frameDuration) {slotsModel.setFrameDuration(frameDuration);} public void setSpinTime(long spinTime){slotsModel.setSpinTime(spinTime);} public long getSpinTime(){return slotsModel.getSpinTime();} public void setLowerBound(long lowerBound) {slotsModel.setLowerBound(lowerBound);} public void setUpperBound(long upperBound) {slotsModel.setUpperBound(upperBound);} // // This section covers REST calls for verifying users // public String verifySignIn(String jsonToken) { return restPost("verifySignIn", jsonToken); } }
[ "mill6841@d.umn.edu" ]
mill6841@d.umn.edu
86a95895fb5bdb62598fed19f0cea4f2bbe6c2bf
e67fd34b387c2fd1ff7a714bfb178f54eb91c07c
/DADS_0613/src/com/cloud/mina/component/filter/Component.java
aa256cecfd500184c91d34946c4b3b6ee84e3ac2
[]
no_license
wangXiGits/DADS_0613
36fb6a864dbee0b7dd2b3db59f84eec0eaf32eb8
75475a23c17b29505ba3469d1522576e81300387
refs/heads/master
2021-09-04T09:22:23.566632
2018-01-17T17:26:01
2018-01-17T17:26:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
492
java
package com.cloud.mina.component.filter; import org.apache.mina.core.buffer.IoBuffer; import com.cloud.mina.milink.sportpackage.PackageData; /** * 解码器组件 * * @author Administrator * */ public interface Component { public void add(Component t); public void remove(Component t); /** * * @param buffer * @return */ public PackageData getDataFromBuffer(IoBuffer buffer); public PackageData generateRealPackageData(IoBuffer buffer); }
[ "zhuanshenbsj@163.com" ]
zhuanshenbsj@163.com
9ce2b21283b7d275cd175e0b251231ba3fdc3f3a
ba358ed30bfa8d18bf111af5d4bd190e10a02bcf
/Upload Application/upload-service/src/main/java/com/sunno/uploadservice/ImageURL.java
eea3fec679b1537581abb4e823159362aa89f477
[ "MIT" ]
permissive
ApoorvaGuptaInnobits/Sunno-backend
788ecf0a5af2547b4d55083d4bd822ad4933f898
ea9ef490d4bc4921a7115268f6d1e21611344126
refs/heads/master
2023-03-17T00:06:49.126446
2020-08-11T16:38:08
2020-08-11T16:38:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,657
java
package com.sunno.uploadservice; import com.github.openjson.JSONArray; import com.github.openjson.JSONException; import com.github.openjson.JSONObject; import lombok.SneakyThrows; import org.springframework.beans.factory.annotation.Value; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.util.HashMap; public class ImageURL { HashMap<String, String> cache = new HashMap<>(); private final String dummyImage = "https://i.imgur.com/nszu54A.jpg"; @Value("${sunno.upload.googleapibase}") String base; @SneakyThrows public String getURL(String query_) { if(cache.get(query_)!=null){ System.out.println("From cache"); return cache.get(query_); } String query="&q="; query+=query_; query=query.replace(" ","%20"); query=query.replace(";","%20"); query=query.replace(".","%20"); query=query.replace("(","%20"); query=query.replace(")","%20"); String url_s=base+query; System.out.println(url_s); URL url = new URL(url_s); HttpURLConnection con = null; try { con = (HttpURLConnection) url.openConnection(); con.setRequestMethod("GET"); con.setConnectTimeout(5000); con.setReadTimeout(5000); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer content = new StringBuffer(); while ((inputLine = in.readLine()) != null) { content.append(inputLine); } in.close(); con.disconnect(); JSONObject jsonObject = new JSONObject(content.toString()); int i=0; while(true){ JSONArray array; try { array = jsonObject.getJSONArray("items"); }catch (JSONException e){ return dummyImage; } JSONObject object = array.getJSONObject(i); object = object.getJSONObject("pagemap"); try{ array= object.getJSONArray("cse_image"); }catch (JSONException e){ i+=1; continue; } array= object.getJSONArray("cse_image"); object = array.getJSONObject(0); System.out.println(object.getString("src")); this.cache.put(query_,object.getString("src")); return object.getString("src"); } } catch (IOException e) { //e.printStackTrace(); } return this.dummyImage; } }
[ "safeerkhan2978@gmail.com" ]
safeerkhan2978@gmail.com
7b12bcd6f852c8dd524c62929f9b85d766a4bfc9
dcaec52508a198fa60d62cb2ca9f7966d00d7364
/eclipse-3.8.1/eclipse/environments/ee.foundation/src/java/util/GregorianCalendar.java
83bb205899436a63b3bb785211f5a3ebd3a28ad6
[ "Apache-2.0" ]
permissive
CyberLynxTelecom/tutorial_upload_github
b116e4cccd4057b62e6658eefb2447926fba3b53
a1e4c7ff8c1a25540fad4944dd8196d91473b6a2
refs/heads/master
2020-03-30T08:26:27.395012
2018-10-01T02:03:03
2018-10-01T02:03:03
151,015,211
0
0
null
null
null
null
UTF-8
Java
false
false
1,835
java
/* * $Revision: 6107 $ * * (C) Copyright 2001 Sun Microsystems, Inc. * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved. * * 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 java.util; public class GregorianCalendar extends java.util.Calendar { public GregorianCalendar() { } public GregorianCalendar(int var0, int var1, int var2) { } public GregorianCalendar(int var0, int var1, int var2, int var3, int var4) { } public GregorianCalendar(int var0, int var1, int var2, int var3, int var4, int var5) { } public GregorianCalendar(java.util.Locale var0) { } public GregorianCalendar(java.util.TimeZone var0) { } public GregorianCalendar(java.util.TimeZone var0, java.util.Locale var1) { } public void add(int var0, int var1) { } protected void computeFields() { } protected void computeTime() { } public int getGreatestMinimum(int var0) { return 0; } public final java.util.Date getGregorianChange() { return null; } public int getLeastMaximum(int var0) { return 0; } public int getMaximum(int var0) { return 0; } public int getMinimum(int var0) { return 0; } public boolean isLeapYear(int var0) { return false; } public void roll(int var0, boolean var1) { } public void setGregorianChange(java.util.Date var0) { } public final static int AD = 1; public final static int BC = 0; }
[ "root@debian.debian" ]
root@debian.debian
07806968d6159355b723a8f3dd50214487aee96f
f4a910a1626b7d09756c4024758bc9b726845e8b
/src/ReportToolFrame.java
3ad56a5cb9d46aba3be0cf33800722bee053a865
[]
no_license
xiboliya/reporttool
60d4a011d1dded8669c5bce9b966f7595a9a4319
7cdb585426fe40c58006efb2f71e38ed2281841c
refs/heads/master
2020-04-23T08:45:00.572461
2014-09-09T04:29:10
2014-09-09T04:29:10
null
0
0
null
null
null
null
GB18030
Java
false
false
22,500
java
/** * Copyright (C) 2014 冰原 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.xiboliya.reporttool; import javax.swing.AbstractButton; import javax.swing.JButton; import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JToolBar; import javax.swing.KeyStroke; import javax.swing.ListSelectionModel; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.io.IOException; import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.LinkedList; import java.util.Vector; /** * 表格数据查询汇总工具 * * @author 冰原 * */ public class ReportToolFrame extends JFrame implements ActionListener { private static final long serialVersionUID = 1L; // 序列化运行时使用的一个版本号,以与当前可序列化类相关联 private JToolBar tlbMain = new JToolBar(); // 显示常用按钮的工具栏组件 private JTable tabMain = null; // 显示数据的表格组件 private JScrollPane spnMain = null; private JMenuBar menuBar = new JMenuBar(); private JMenu menuOperation = new JMenu("操作(P)"); private JMenuItem itemNew = new JMenuItem("添加(N)", 'N'); private JMenuItem itemView = new JMenuItem("查看(V)", 'V'); private JMenuItem itemSearch = new JMenuItem("搜索(S)...", 'S'); private JMenuItem itemDelete = new JMenuItem("删除(D)", 'D'); private JMenuItem itemImport = new JMenuItem("导入(I)...", 'I'); private JMenuItem itemExport = new JMenuItem("导出(X)...", 'X'); private JMenuItem itemRefresh = new JMenuItem("刷新(R)", 'R'); private JMenuItem itemListAll = new JMenuItem("浏览全部(L)", 'L'); private JMenu menuHelp = new JMenu("帮助(H)"); private JMenuItem itemAbout = new JMenuItem("关于(A)", 'A'); private JPopupMenu popMenuTabbed = new JPopupMenu(); private JMenuItem itemPopCloseCurrent = new JMenuItem("关闭当前(C)", 'C'); private JMenuItem itemPopCloseOthers = new JMenuItem("关闭其它(O)", 'O'); private JMenuItem itemPopSave = new JMenuItem("保存(S)", 'S'); private JMenuItem itemPopSaveAs = new JMenuItem("另存为(A)...", 'A'); private JMenuItem itemPopReName = new JMenuItem("重命名(N)...", 'N'); private JMenuItem itemPopDelFile = new JMenuItem("删除文件(D)", 'D'); private JMenuItem itemPopReOpen = new JMenuItem("重新载入(R)", 'R'); private LinkedList<AbstractButton> toolButtonList = new LinkedList<AbstractButton>(); // 存放工具栏中所有按钮的链表 private BaseDefaultTableModel baseDefaultTableModel = null; private String[] arrViewItem = new String[Util.TABLE_COLUMN]; // 用于存放当前表格中选择项数据的数组 private String sql = "select * from " + Util.TABLE_NAME; private Vector<Vector> cells = new Vector<Vector>(); private Vector<String> cellsTitle = new Vector<String>(); private Vector<String[]> cellsImport = new Vector<String[]>(); private Vector<String> cellsSql = new Vector<String>(); private Connection connection = null; // 与数据库的连接对象 private Statement statement = null; // 用于执行静态SQL语句并返回它所生成结果的对象 private ResultSet resultSet = null; // 数据库结果集对象 private AboutDialog aboutDialog = null; // 关于对话框 private EditItemDialog editItemDialog = null; // 添加表格数据对话框 private SearchItemDialog searchItemDialog = null; // 搜索表格数据对话框 private SaveFileChooser saveFileChooser = null; // "保存"文件选择器 private OpenFileChooser openFileChooser = null; // "导入"文件选择器 /** * 构造方法 用于初始化界面和设置 */ public ReportToolFrame() { this.setTitle(Util.SOFTWARE); this.setSize(700, 600); this.setMinimumSize(new Dimension(600, 500)); // 设置主界面的最小尺寸 this.setLocationRelativeTo(null); // 使窗口居中显示 this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); // 设置默认关闭操作为空,以便添加窗口监听事件 this.init(); this.setIcon(); this.setVisible(true); } /** * 设置自定义的窗口图标 */ private void setIcon() { try { this.setIconImage(Util.SW_ICON.getImage()); } catch (Exception x) { x.printStackTrace(); } } /** * 初始化界面和添加监听器 */ private void init() { this.addToolBar(); this.addMenuItem(); this.addPopMenu(); this.addTable(); this.setMenuMnemonic(); this.addListeners(); } /** * 主面板上添加工具栏视图 */ private void addToolBar() { this.getContentPane().add(this.tlbMain, BorderLayout.NORTH); for (int i = 0; i < Util.TOOL_ICONS.length; i++) { AbstractButton btnTool = new JButton(Util.TOOL_ICONS[i]); btnTool.setText(Util.TOOL_TEXTS[i]); btnTool.setFocusable(false); btnTool.addActionListener(this); this.tlbMain.add(btnTool); this.tlbMain.addSeparator(); this.toolButtonList.add(btnTool); } } /** * 主面板上添加菜单栏 */ private void addMenuItem() { this.setJMenuBar(this.menuBar); this.menuBar.add(this.menuOperation); this.menuOperation.add(this.itemNew); this.menuOperation.add(this.itemView); this.menuOperation.add(this.itemSearch); this.menuOperation.add(this.itemDelete); this.menuOperation.add(this.itemRefresh); this.menuOperation.add(this.itemListAll); this.menuOperation.addSeparator(); this.menuOperation.add(this.itemImport); this.menuOperation.add(this.itemExport); this.menuBar.add(this.menuHelp); this.menuHelp.add(this.itemAbout); } /** * 初始化快捷菜单 */ private void addPopMenu() { this.popMenuTabbed.add(this.itemPopCloseCurrent); this.popMenuTabbed.add(this.itemPopCloseOthers); this.popMenuTabbed.addSeparator(); this.popMenuTabbed.add(this.itemPopSave); this.popMenuTabbed.add(this.itemPopSaveAs); this.popMenuTabbed.add(this.itemPopReName); this.popMenuTabbed.add(this.itemPopDelFile); this.popMenuTabbed.add(this.itemPopReOpen); this.popMenuTabbed.addSeparator(); Dimension popSize = this.popMenuTabbed.getPreferredSize(); popSize.width += popSize.width / 5; // 为了美观,适当加宽菜单的显示 this.popMenuTabbed.setPopupSize(popSize); } /** * 主面板上添加表格视图 */ private void addTable() { for (String title : Util.TABLE_TITLE_TEXTS) { this.cellsTitle.add(title); } this.baseDefaultTableModel = new BaseDefaultTableModel(this.cells, this.cellsTitle); this.tabMain = new JTable(this.baseDefaultTableModel); this.spnMain = new JScrollPane(this.tabMain); this.tabMain.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); this.getContentPane().add(this.spnMain, BorderLayout.CENTER); } /** * 获取数据表中特定条件下的数据项 * * @param sql * 给定的SQL语句 */ private void getCells(String sql) { this.cells.clear(); Vector<String> cellsLine = null; try { this.connection = Util.getConnection(); this.statement = this.connection.createStatement(); this.resultSet = this.statement.executeQuery(sql); while (this.resultSet.next()) { cellsLine = new Vector<String>(); cellsLine.add(String.valueOf(this.resultSet.getInt(1))); cellsLine.add(this.resultSet.getString(2)); cellsLine.add(this.resultSet.getString(3)); cellsLine.add(this.resultSet.getString(6)); cellsLine.add(this.resultSet.getString(11)); cellsLine.add(this.resultSet.getString(13)); this.cells.add(cellsLine); } } catch (SQLException x) { x.printStackTrace(); } finally { try { this.resultSet.close(); this.statement.close(); this.connection.close(); } catch (SQLException x) { // x.printStackTrace(); } } } /** * 为各菜单项设置助记符和快捷键 */ private void setMenuMnemonic() { this.menuOperation.setMnemonic('P'); this.menuHelp.setMnemonic('H'); this.itemNew.setAccelerator(KeyStroke.getKeyStroke('N', InputEvent.CTRL_DOWN_MASK)); // 快捷键:Ctrl+N this.itemView.setAccelerator(KeyStroke.getKeyStroke('O', InputEvent.CTRL_DOWN_MASK)); // 快捷键:Ctrl+O this.itemSearch.setAccelerator(KeyStroke.getKeyStroke('F', InputEvent.CTRL_DOWN_MASK)); // 快捷键:Ctrl+F this.itemImport.setAccelerator(KeyStroke.getKeyStroke('I', InputEvent.CTRL_DOWN_MASK)); // 快捷键:Ctrl+I this.itemExport.setAccelerator(KeyStroke.getKeyStroke('E', InputEvent.CTRL_DOWN_MASK)); // 快捷键:Ctrl+E this.itemListAll.setAccelerator(KeyStroke.getKeyStroke('L', InputEvent.CTRL_DOWN_MASK)); // 快捷键:Ctrl+L this.itemDelete.setAccelerator(KeyStroke .getKeyStroke(KeyEvent.VK_DELETE, 0)); // 快捷键:Delete this.itemRefresh.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F5, 0)); // 快捷键:F5 this.itemAbout.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, 0)); // 快捷键:F1 } /** * 添加各组件的事件监听器 */ private void addListeners() { this.itemNew.addActionListener(this); this.itemView.addActionListener(this); this.itemSearch.addActionListener(this); this.itemDelete.addActionListener(this); this.itemImport.addActionListener(this); this.itemExport.addActionListener(this); this.itemRefresh.addActionListener(this); this.itemListAll.addActionListener(this); this.itemAbout.addActionListener(this); // 为窗口添加事件监听器 this.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { exit(); } }); } /** * "退出"的处理方法 */ private void exit() { boolean toExit = true; if (toExit) { System.exit(0); } } /** * 获取当前表格中所选数据项的ID */ private int getCurrentItemId() { int id = -1; int currentRow = this.tabMain.getSelectedRow(); if (currentRow < 0) { return id; } String strId = this.tabMain.getValueAt(currentRow, 0).toString(); try { id = Integer.parseInt(strId); } catch (NumberFormatException x) { x.printStackTrace(); } return id; } private void viewCurrentItem() { int id = this.getCurrentItemId(); if (id < 0) { JOptionPane.showMessageDialog(this, "请选择一条数据!", "查看失败!", JOptionPane.ERROR_MESSAGE); return; } try { this.connection = Util.getConnection(); this.statement = this.connection.createStatement(); this.resultSet = this.statement.executeQuery("select * from " + Util.TABLE_NAME + " where id=" + id); int n = 1; if (this.resultSet.next()) { this.arrViewItem[0] = String.valueOf(id); for (; n < Util.TABLE_COLUMN; n++) { this.arrViewItem[n] = this.resultSet.getString(n + 1); } } this.openEditItemDialog(id, this.arrViewItem); } catch (SQLException x) { x.printStackTrace(); } finally { try { this.resultSet.close(); this.statement.close(); this.connection.close(); } catch (SQLException x) { // x.printStackTrace(); } } } /** * "关于"的处理方法 */ private void showAbout() { if (this.aboutDialog == null) { final String strBaiduSpace = "http://hi.baidu.com/xiboliya"; final String strEmail = "chenzhengfeng@163.com"; String[] arrStrLabel = new String[] { "软件名称:" + Util.SOFTWARE, "软件版本:" + Util.VERSION, "软件作者:冰原", "<html>百度空间:<a href='" + strBaiduSpace + "'>" + strBaiduSpace + "</a></html>", "<html>作者邮箱:<font color=red>" + strEmail + "</font></html>", "软件版权:遵循GNU GPL第三版开源许可协议的相关条款" }; this.aboutDialog = new AboutDialog(this, true, arrStrLabel, Util.SW_ICON); this.aboutDialog.addLinkByIndex(3, strBaiduSpace); this.aboutDialog.pack(); // 自动调整窗口大小,以适应各组件 } this.aboutDialog.setVisible(true); } /** * "添加"的处理方法 */ private void openEditItemDialog(int id, String[] arrViewItem) { if (this.editItemDialog == null) { this.editItemDialog = new EditItemDialog(this, false, id, arrViewItem); // 第2个参数必须为false,否则无法更新已有的数据项 } else { this.editItemDialog.setCurrentId(id); this.editItemDialog.setViewItems(arrViewItem); this.editItemDialog.setVisible(true); } } /** * "搜索"的处理方法 */ private void openSearchItemDialog() { if (this.searchItemDialog == null) { this.searchItemDialog = new SearchItemDialog(this, true); } else { this.searchItemDialog.setVisible(true); } } /** * “刷新”的处理方法 */ public void refresh() { this.getCells(this.sql); this.tabMain.updateUI(); } /** * 设置当前的SQL语句 * * @param sql * 给定的SQL语句 */ public void setSql(String sql) { this.sql = sql; } /** * “删除”的处理方法 */ private void delete() { int id = this.getCurrentItemId(); if (id < 0) { JOptionPane.showMessageDialog(this, "请选择一条数据!", "删除失败!", JOptionPane.ERROR_MESSAGE); return; } int result = JOptionPane.showConfirmDialog(this, "将要删除序号为:" + id + " 的数据,是否继续?", Util.SOFTWARE, JOptionPane.YES_NO_CANCEL_OPTION); if (result != JOptionPane.YES_OPTION) { return; } try { this.connection = Util.getConnection(); this.statement = this.connection.createStatement(); this.statement.execute("delete from " + Util.TABLE_NAME + " where id=" + id); JOptionPane.showMessageDialog(this, "成功删除数据!", "删除成功!", JOptionPane.INFORMATION_MESSAGE); } catch (SQLException x) { JOptionPane.showMessageDialog(this, "发生未知错误,删除失败!", "删除失败!", JOptionPane.ERROR_MESSAGE); x.printStackTrace(); } finally { try { this.statement.close(); this.connection.close(); } catch (SQLException x) { // x.printStackTrace(); } } this.getCells(this.sql); this.tabMain.updateUI(); } /** * “浏览全部”的处理方法 */ private void listAll() { this.getCells("select * from " + Util.TABLE_NAME); this.tabMain.updateUI(); } /** * “导出”的处理方法 */ private void exportItems() { Vector<Vector> cellsItems = new Vector<Vector>(); Vector<String> cellsItem = null; int n = 2; try { this.connection = Util.getConnection(); this.statement = this.connection.createStatement(); this.resultSet = this.statement.executeQuery(this.sql); while (this.resultSet.next()) { cellsItem = new Vector<String>(); cellsItem.add(String.valueOf(this.resultSet.getInt(1))); for (n = 2; n <= Util.TABLE_COLUMN; n++) { cellsItem.add(this.resultSet.getString(n)); } cellsItems.add(cellsItem); } } catch (SQLException x) { x.printStackTrace(); } catch (Exception x) { x.printStackTrace(); } finally { try { this.resultSet.close(); this.statement.close(); this.connection.close(); } catch (SQLException x) { // x.printStackTrace(); return; } } if (this.saveFileChooser == null) { this.saveFileChooser = new SaveFileChooser(); } this.saveFileChooser.setDialogTitle("导出多项"); this.saveFileChooser.setSelectedFile(null); if (JFileChooser.APPROVE_OPTION != this.saveFileChooser .showSaveDialog(this)) { return; } File file = this.saveFileChooser.getSelectedFile(); Util.exportToXLS(this, cellsItems, file); } /** * “导入”的处理方法 */ private void importItems() { if (this.openFileChooser == null) { this.openFileChooser = new OpenFileChooser(); } this.openFileChooser.setSelectedFile(null); if (JFileChooser.APPROVE_OPTION != this.openFileChooser .showOpenDialog(this)) { return; } File file = this.openFileChooser.getSelectedFile(); if (file == null || !file.exists()) { return; } InputStreamReader inputStreamReader = null; BufferedReader reader = null; String strBase = ""; try { inputStreamReader = new InputStreamReader(new FileInputStream(file), "GB18030"); reader = new BufferedReader(inputStreamReader); String line = reader.readLine(); this.cellsImport.clear(); this.cellsImport.add(line.split("\t", -1)); while (line != null) { line = reader.readLine(); this.cellsImport.add(line.split("\t", -1)); } } catch (Exception x) { x.printStackTrace(); } finally { try { inputStreamReader.close(); } catch (IOException x) { x.printStackTrace(); } } if (this.cellsImport == null) { JOptionPane.showMessageDialog(this, "文件:" + file + " 导入失败!", Util.SOFTWARE, JOptionPane.ERROR_MESSAGE); return; } this.cellsSql.clear(); for (String[] arrItem : this.cellsImport) { try { Integer.parseInt(arrItem[0]); } catch (NumberFormatException x) { continue; } String value = ""; for (int i = 1; i < arrItem.length; i++) { value += ",'" + arrItem[i] + "'"; } System.out.println("length:"+arrItem.length); value = value.substring(1); this.cellsSql.add("insert into " + Util.TABLE_NAME + " (factoryName,foundDate,interviewDate,factoryAddress,factoryProperty,factoryEmail,businessEntity,businessEntityPhone,businessEntityHandset,linkman,linkmanPhone,linkmanHandset,insideRatio,outsideRatio,tradeType,staffQuantity,buyOrLease,mainBusinessSphere,registeredCapital,country,yearNum,yearSalesVolume,yearTaxationOfProfit,yearForeignExchangeEarning,factorySynopsis,factoryProblemOrNeeds,otherItems,interviewPersonnel,expositionNeeds) values ("+value+")"); } int n = 0; try { this.connection = Util.getConnection(); this.statement = this.connection.createStatement(); for (String strSql : this.cellsSql) { this.statement.executeUpdate(strSql); n++; } JOptionPane.showMessageDialog(this, "成功导入" + n + "行数据!", "导入成功!", JOptionPane.INFORMATION_MESSAGE); } catch (SQLException x) { x.printStackTrace(); JOptionPane.showMessageDialog(this, "导入发生未知错误!已成功导入" + n + "行数据!", "部分导入成功!", JOptionPane.INFORMATION_MESSAGE); } finally { try { this.resultSet.close(); this.statement.close(); this.connection.close(); } catch (SQLException x) { // x.printStackTrace(); } } this.refresh(); } /** * 为各菜单项添加事件的处理方法 */ public void actionPerformed(ActionEvent e) { if (this.itemAbout.equals(e.getSource())) { this.showAbout(); } else if (this.itemImport.equals(e.getSource()) || this.toolButtonList.get(0).equals(e.getSource())) { this.importItems(); } else if (this.itemNew.equals(e.getSource()) || this.toolButtonList.get(1).equals(e.getSource())) { this.openEditItemDialog(-1, null); } else if (this.itemView.equals(e.getSource()) || this.toolButtonList.get(2).equals(e.getSource())) { this.viewCurrentItem(); } else if (this.itemSearch.equals(e.getSource()) || this.toolButtonList.get(3).equals(e.getSource())) { this.openSearchItemDialog(); } else if (this.itemDelete.equals(e.getSource()) || this.toolButtonList.get(4).equals(e.getSource())) { this.delete(); } else if (this.itemExport.equals(e.getSource()) || this.toolButtonList.get(5).equals(e.getSource())) { this.exportItems(); } else if (this.itemRefresh.equals(e.getSource()) || this.toolButtonList.get(6).equals(e.getSource())) { this.refresh(); } else if (this.itemListAll.equals(e.getSource()) || this.toolButtonList.get(7).equals(e.getSource())) { this.listAll(); } } }
[ "chenzhengfeng@163.com" ]
chenzhengfeng@163.com
d40fe5a9cae6862b2fad0c3d13bdbbdbad19f9d3
64322bd5f1416d50a1e9e14a87acde2ce746dd08
/src/com/android/launcher3/LauncherAnimUtils.java
9b3ff91c6c3e796636f10eca041cb86725d752b2
[ "Apache-2.0" ]
permissive
woshiwzy/mylauncher3
aef83ddc278fedd8edf6ee9a1165efee866dc0b3
8b9a0b230e12534b820a86643c36bef6246193a8
refs/heads/master
2021-06-21T01:52:06.165156
2017-08-02T07:02:48
2017-08-02T07:02:48
99,083,290
0
0
null
null
null
null
UTF-8
Java
false
false
5,147
java
/* * Copyright (C) 2012 The Android Open Source Project * * 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.android.launcher3; import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; import android.animation.ValueAnimator; import android.view.View; import android.view.ViewAnimationUtils; import android.view.ViewTreeObserver; import java.util.HashSet; import java.util.WeakHashMap; public class LauncherAnimUtils { static WeakHashMap<Animator, Object> sAnimators = new WeakHashMap<Animator, Object>(); static Animator.AnimatorListener sEndAnimListener = new Animator.AnimatorListener() { public void onAnimationStart(Animator animation) { sAnimators.put(animation, null); } public void onAnimationRepeat(Animator animation) { } public void onAnimationEnd(Animator animation) { sAnimators.remove(animation); } public void onAnimationCancel(Animator animation) { sAnimators.remove(animation); } }; public static void cancelOnDestroyActivity(Animator a) { a.addListener(sEndAnimListener); } // Helper method. Assumes a draw is pending, and that if the animation's duration is 0 // it should be cancelled public static void startAnimationAfterNextDraw(final Animator animator, final View view) { view.getViewTreeObserver().addOnDrawListener(new ViewTreeObserver.OnDrawListener() { private boolean mStarted = false; public void onDraw() { if (mStarted) return; mStarted = true; // Use this as a signal that the animation was cancelled if (animator.getDuration() == 0) { return; } animator.start(); final ViewTreeObserver.OnDrawListener listener = this; view.post(new Runnable() { public void run() { view.getViewTreeObserver().removeOnDrawListener(listener); } }); } }); } public static void onDestroyActivity() { HashSet<Animator> animators = new HashSet<Animator>(sAnimators.keySet()); for (Animator a : animators) { if (a.isRunning()) { a.cancel(); } sAnimators.remove(a); } } public static AnimatorSet createAnimatorSet() { AnimatorSet anim = new AnimatorSet(); cancelOnDestroyActivity(anim); return anim; } public static ValueAnimator ofFloat(View target, float... values) { ValueAnimator anim = new ValueAnimator(); anim.setFloatValues(values); cancelOnDestroyActivity(anim); return anim; } public static ObjectAnimator ofFloat(View target, String propertyName, float... values) { ObjectAnimator anim = new ObjectAnimator(); anim.setTarget(target); anim.setPropertyName(propertyName); anim.setFloatValues(values); cancelOnDestroyActivity(anim); new FirstFrameAnimatorHelper(anim, target); return anim; } public static ObjectAnimator ofPropertyValuesHolder(View target, PropertyValuesHolder... values) { ObjectAnimator anim = new ObjectAnimator(); anim.setTarget(target); anim.setValues(values); cancelOnDestroyActivity(anim); new FirstFrameAnimatorHelper(anim, target); return anim; } public static ObjectAnimator ofPropertyValuesHolder(Object target, View view, PropertyValuesHolder... values) { ObjectAnimator anim = new ObjectAnimator(); anim.setTarget(target); anim.setValues(values); cancelOnDestroyActivity(anim); new FirstFrameAnimatorHelper(anim, view); return anim; } public static Animator createCircularReveal(View view, int centerX, int centerY, float startRadius, float endRadius) { Animator anim = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, startRadius, endRadius); if (anim instanceof ValueAnimator) { new FirstFrameAnimatorHelper((ValueAnimator) anim, view); } return anim; } }
[ "wzyfly@sina.com" ]
wzyfly@sina.com
731b02fa6a288133eb1162cf06174568737be639
8b42d731a9e28dc3fc8fd0f974b71dfe6187be09
/app/src/main/java/top/spencer/crabscore/base/BaseModel.java
b1dbe568e5bacb10c62616fc2c3368bfa97d017d
[]
no_license
spencercjh/CrabScoreMVP
d05e28337c0f0896cbf7e34e61f986d2c723c435
d4d123d5a466be62aa7a12cb7bd624dba187c46a
refs/heads/master
2020-04-02T09:36:29.553263
2019-04-05T18:30:05
2019-04-05T18:30:05
154,300,798
0
0
null
null
null
null
UTF-8
Java
false
false
14,686
java
package top.spencer.crabscore.base; import android.support.annotation.NonNull; import android.util.Log; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import okhttp3.*; import top.spencer.crabscore.common.CommonConstant; import java.io.IOException; import java.util.Map; import static android.content.ContentValues.TAG; /** * @author spencercjh */ @SuppressWarnings("Duplicates") public abstract class BaseModel { /** * 数据请求参数 */ protected String[] mvpParams; /** * 设置数据请求参数 * * @param args 参数数组 */ public BaseModel params(String... args) { mvpParams = args; return this; } /** * 具体的数据请求由子类实现 * * @param myCallBack myCallBack */ public abstract void execute(MyCallback<JSONObject> myCallBack); /** * OkHttp3 异步Get请求 * * @param url URL (需要在外面处理好) * @param myCallBack myCallBack * @param jwt Header里的JWT串 */ protected void requestGetAPI(String url, final MyCallback<JSONObject> myCallBack, String jwt) { Log.i(TAG, url); Log.i(TAG, jwt); OkHttpClient okHttpClient = new OkHttpClient(); Request request = new Request.Builder() .url(url) .get() .addHeader("jwt", jwt) .build(); okHttpClient.newCall(request).enqueue(new okhttp3.Callback() { @Override public void onFailure(@NonNull Call call, @NonNull IOException e) { Log.d(TAG, "onFailure: " + e.getMessage()); myCallBack.onError(); myCallBack.onComplete(); } @Override public void onResponse(@NonNull Call call, @NonNull Response response) { JSONObject responseJsonResult; Integer code; try { assert response.body() != null; String responseBody = response.body().string(); Log.d(TAG, responseBody); responseJsonResult = JSON.parseObject(responseBody); code = responseJsonResult.getInteger(CommonConstant.CODE); } catch (IOException | NullPointerException e) { e.printStackTrace(); myCallBack.onError(); myCallBack.onComplete(); return; } if (code == null) { myCallBack.onError(); myCallBack.onComplete(); return; } if (code.equals(CommonConstant.SUCCESS)) { myCallBack.onSuccess(responseJsonResult); } else { myCallBack.onFailure(responseJsonResult); } myCallBack.onComplete(); } }); } /** * OkHttp3 Post异步方式提交表单 * * @param url URL * @param postParams body中的参数 * @param myCallBack myCallBack * @param jwt Header里的JWT串 */ protected void requestPostAPI(String url, Map<String, Object> postParams, final MyCallback<JSONObject> myCallBack, String jwt) { Log.i(TAG, url); Log.i(TAG, jwt); OkHttpClient okHttpClient = new OkHttpClient(); FormBody.Builder formBody = new FormBody.Builder(); for (Map.Entry<String, Object> param : postParams.entrySet()) { formBody.add(param.getKey(), param.getValue().toString()); } RequestBody requestBody = formBody.build(); Request request = new Request.Builder() .url(url) .post(requestBody) .addHeader("jwt", jwt) .build(); okHttpClient.newCall(request).enqueue(new okhttp3.Callback() { @Override public void onFailure(@NonNull Call call, @NonNull IOException e) { Log.d(TAG, "onFailure: " + e.getMessage()); myCallBack.onError(); myCallBack.onComplete(); } @Override public void onResponse(@NonNull Call call, @NonNull Response response) { JSONObject responseJsonResult; Integer code; try { assert response.body() != null; String responseBody = response.body().string(); Log.d(TAG, responseBody); responseJsonResult = JSON.parseObject(responseBody); code = responseJsonResult.getInteger(CommonConstant.CODE); } catch (IOException | NullPointerException e) { e.printStackTrace(); myCallBack.onError(); myCallBack.onComplete(); return; } if (code == null) { myCallBack.onError(); myCallBack.onComplete(); return; } if (code.equals(CommonConstant.SUCCESS)) { myCallBack.onSuccess(responseJsonResult); } else { myCallBack.onFailure(responseJsonResult); } myCallBack.onComplete(); } }); } /** * OkHttp3 Post异步方式提交JSON * * @param url URL * @param json body中的JSON * @param myCallBack myCallBack * @param jwt Header里的JWT串 */ protected void requestPostJSONAPI(String url, String json, final MyCallback<JSONObject> myCallBack, String jwt) { Log.i(TAG, url); Log.i(TAG, jwt); OkHttpClient okHttpClient = new OkHttpClient(); RequestBody requestBody = FormBody.create(MediaType.parse("application/json"), json); Request request = new Request.Builder() .url(url) .post(requestBody) .addHeader("jwt", jwt) .build(); okHttpClient.newCall(request).enqueue(new okhttp3.Callback() { @Override public void onFailure(@NonNull Call call, @NonNull IOException e) { Log.d(TAG, "onFailure: " + e.getMessage()); myCallBack.onError(); myCallBack.onComplete(); } @Override public void onResponse(@NonNull Call call, @NonNull Response response) { JSONObject responseJsonResult; Integer code; try { assert response.body() != null; String responseBody = response.body().string(); Log.d(TAG, responseBody); responseJsonResult = JSON.parseObject(responseBody); code = responseJsonResult.getInteger(CommonConstant.CODE); } catch (IOException | NullPointerException e) { e.printStackTrace(); myCallBack.onError(); myCallBack.onComplete(); return; } if (code == null) { myCallBack.onError(); myCallBack.onComplete(); return; } if (code.equals(CommonConstant.SUCCESS)) { myCallBack.onSuccess(responseJsonResult); } else { myCallBack.onFailure(responseJsonResult); } myCallBack.onComplete(); } }); } /** * OkHttp3 PUT异步请求 * * @param url URL * @param putParams body中的参数 * @param myCallBack myCallBack * @param jwt Header里的JWT串 */ protected void requestPutAPI(String url, Map<String, Object> putParams, final MyCallback<JSONObject> myCallBack, String jwt) { Log.i(TAG, url); Log.i(TAG, jwt); OkHttpClient okHttpClient = new OkHttpClient(); FormBody.Builder formBody = new FormBody.Builder(); for (Map.Entry<String, Object> param : putParams.entrySet()) { formBody.add(param.getKey(), param.getValue().toString()); } RequestBody requestBody = formBody.build(); Request request = new Request.Builder() .url(url) .put(requestBody) .addHeader("jwt", jwt) .build(); okHttpClient.newCall(request).enqueue(new okhttp3.Callback() { @Override public void onFailure(@NonNull Call call, @NonNull IOException e) { Log.d(TAG, "onFailure: " + e.getMessage()); myCallBack.onError(); myCallBack.onComplete(); } @Override public void onResponse(@NonNull Call call, @NonNull Response response) { JSONObject responseJsonResult; Integer code; try { assert response.body() != null; String responseBody = response.body().string(); Log.d(TAG, responseBody); responseJsonResult = JSON.parseObject(responseBody); code = responseJsonResult.getInteger(CommonConstant.CODE); } catch (IOException | NullPointerException e) { e.printStackTrace(); myCallBack.onError(); myCallBack.onComplete(); return; } if (code == null) { myCallBack.onError(); myCallBack.onComplete(); return; } if (code.equals(CommonConstant.SUCCESS)) { myCallBack.onSuccess(responseJsonResult); } else { myCallBack.onFailure(responseJsonResult); } myCallBack.onComplete(); } }); } /** * OkHttp3 PUT异步请求 * * @param url URL * @param json body中的JSON * @param myCallBack myCallBack * @param jwt Header里的JWT串 */ protected void requestPutJSONAPI(String url, String json, final MyCallback<JSONObject> myCallBack, String jwt) { Log.i(TAG, url); Log.i(TAG, jwt); OkHttpClient okHttpClient = new OkHttpClient(); RequestBody requestBody = FormBody.create(MediaType.parse("application/json"), json); Request request = new Request.Builder() .url(url) .put(requestBody) .addHeader("jwt", jwt) .build(); okHttpClient.newCall(request).enqueue(new okhttp3.Callback() { @Override public void onFailure(@NonNull Call call, @NonNull IOException e) { Log.d(TAG, "onFailure: " + e.getMessage()); myCallBack.onError(); myCallBack.onComplete(); } @Override public void onResponse(@NonNull Call call, @NonNull Response response) { JSONObject responseJsonResult; Integer code; try { assert response.body() != null; String responseBody = response.body().string(); Log.d(TAG, responseBody); responseJsonResult = JSON.parseObject(responseBody); code = responseJsonResult.getInteger(CommonConstant.CODE); } catch (IOException | NullPointerException e) { e.printStackTrace(); myCallBack.onError(); myCallBack.onComplete(); return; } if (code == null) { myCallBack.onError(); myCallBack.onComplete(); return; } if (code.equals(CommonConstant.SUCCESS)) { myCallBack.onSuccess(responseJsonResult); } else { myCallBack.onFailure(responseJsonResult); } myCallBack.onComplete(); } }); } /** * OkHttp3 Delete异步请求 * * @param url URL (需要在外面处理好) * @param myCallBack myCallBack * @param jwt Header里的JWT串 */ protected void requestDeleteAPI(String url, final MyCallback<JSONObject> myCallBack, String jwt) { Log.i(TAG, url); Log.i(TAG, jwt); OkHttpClient okHttpClient = new OkHttpClient(); Request request = new Request.Builder() .url(url) .delete() .addHeader("jwt", jwt) .build(); okHttpClient.newCall(request).enqueue(new okhttp3.Callback() { @Override public void onFailure(@NonNull Call call, @NonNull IOException e) { Log.d(TAG, "onFailure: " + e.getMessage()); myCallBack.onError(); myCallBack.onComplete(); } @Override public void onResponse(@NonNull Call call, @NonNull Response response) { JSONObject responseJsonResult; Integer code; try { assert response.body() != null; String responseBody = response.body().string(); Log.d(TAG, responseBody); responseJsonResult = JSON.parseObject(responseBody); code = responseJsonResult.getInteger(CommonConstant.CODE); } catch (IOException | NullPointerException e) { e.printStackTrace(); myCallBack.onError(); myCallBack.onComplete(); return; } if (code == null) { myCallBack.onError(); myCallBack.onComplete(); return; } if (code.equals(CommonConstant.SUCCESS)) { myCallBack.onSuccess(responseJsonResult); } else { myCallBack.onFailure(responseJsonResult); } myCallBack.onComplete(); } }); } }
[ "shouspencercjh@foxmail.com" ]
shouspencercjh@foxmail.com
d683b0bbbd22bb64f7cff214d0305e0078b2a19b
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/4/4_c5161a42ebef7138452cecd618d852852782adf7/EquipmentType/4_c5161a42ebef7138452cecd618d852852782adf7_EquipmentType_t.java
7e74940f9fd3750caf4a88706500245a50581836
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
10,051
java
/** * Copyright (C) 2002-2007 The FreeCol Team * * This file is part of FreeCol. * * FreeCol is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * FreeCol is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with FreeCol. If not, see <http://www.gnu.org/licenses/>. */ package net.sf.freecol.common.model; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.xml.stream.XMLStreamConstants; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamReader; import net.sf.freecol.common.Specification; import net.sf.freecol.common.model.Unit.Role; public class EquipmentType extends FreeColGameObjectType implements Features { /** * Contains the abilities and modifiers of this type. */ private FeatureContainer featureContainer = new FeatureContainer(); /** * The maximum number of equipment items that can be combined. */ private int maximumCount = 1; /** * Describe combatLossPriority here. */ private int combatLossPriority; /** * Describe role here. */ private Role role; /** * A list of AbstractGoods required to build this Type. */ private List<AbstractGoods> goodsRequired = new ArrayList<AbstractGoods>(); /** * Stores the abilities required of a unit to be equipped. */ private HashMap<String, Boolean> requiredUnitAbilities = new HashMap<String, Boolean>(); /** * Stores the abilities required of the location where the unit is * to be equipped. */ private HashMap<String, Boolean> requiredLocationAbilities = new HashMap<String, Boolean>(); /** * A List containing the IDs of equipment types compatible with this one. */ private List<String> compatibleEquipment = new ArrayList<String>(); public EquipmentType() {} public EquipmentType(int index) { setIndex(index); } /** * Get the <code>MaximumCount</code> value. * * @return an <code>int</code> value */ public final int getMaximumCount() { return maximumCount; } /** * Set the <code>MaximumCount</code> value. * * @param newMaximumCount The new MaximumCount value. */ public final void setMaximumCount(final int newMaximumCount) { this.maximumCount = newMaximumCount; } /** * Get the <code>Role</code> value. * * @return a <code>Role</code> value */ public final Role getRole() { return role; } /** * Set the <code>Role</code> value. * * @param newRole The new Role value. */ public final void setRole(final Role newRole) { this.role = newRole; } /** * Get the <code>CombatLossPriority</code> value. * * @return an <code>int</code> value */ public final int getCombatLossPriority() { return combatLossPriority; } /** * Returns true if this EquipmentType can be captured in combat. * * @return a <code>boolean</code> value */ public boolean canBeCaptured() { return (combatLossPriority > 0); } /** * Set the <code>CombatLossPriority</code> value. * * @param newCombatLossPriority The new CombatLossPriority value. */ public final void setCombatLossPriority(final int newCombatLossPriority) { this.combatLossPriority = newCombatLossPriority; } /** * Get the <code>Ability</code> value. * * @param id a <code>String</code> value * @return a <code>Ability</code> value */ public final Ability getAbility(String id) { return featureContainer.getAbility(id); } /** * Returns true if the Object has the ability identified by * <code>id</code>. * * @param id a <code>String</code> value * @return a <code>boolean</code> value */ public boolean hasAbility(String id) { return featureContainer.hasAbility(id); } /** * Returns the Modifier identified by <code>id</code>. * * @param id a <code>String</code> value * @return a <code>Modifier</code> value */ public Modifier getModifier(String id) { return featureContainer.getModifier(id); } /** * Add the given Feature to the Features Map. If the Feature given * can not be combined with a Feature with the same ID already * present, the old Feature will be replaced. * * @param feature a <code>Feature</code> value */ public void addFeature(Feature feature) { featureContainer.addFeature(feature); } /** * Get the <code>GoodsRequired</code> value. * * @return a <code>List<AbstractGoods></code> value */ public final List<AbstractGoods> getGoodsRequired() { return goodsRequired; } /** * Set the <code>GoodsRequired</code> value. * * @param newGoodsRequired The new GoodsRequired value. */ public final void setGoodsRequired(final List<AbstractGoods> newGoodsRequired) { this.goodsRequired = newGoodsRequired; } /** * Returns the abilities required by this Type. * * @return the abilities required by this Type. */ public Map<String, Boolean> getUnitAbilitiesRequired() { return requiredUnitAbilities; } /** * Returns the abilities required by this Type. * * @return the abilities required by this Type. */ public Map<String, Boolean> getLocationAbilitiesRequired() { return requiredLocationAbilities; } /** * Returns true if this type of equipment is compatible with the * given type of equipment. * * @param otherType an <code>EquipmentType</code> value * @return a <code>boolean</code> value */ public boolean isCompatibleWith(EquipmentType otherType) { if (this.getId().equals(otherType.getId())) { // model.equipment.tools for example return true; } return compatibleEquipment.contains(otherType.getId()) && otherType.compatibleEquipment.contains(getId()); } protected void readFromXMLImpl(XMLStreamReader in) throws XMLStreamException { throw new UnsupportedOperationException("Call 'readFromXML' instead."); } public void readFromXML(XMLStreamReader in, Specification specification) throws XMLStreamException { setId(in.getAttributeValue(null, "id")); maximumCount = getAttribute(in, "maximum-count", 1); combatLossPriority = getAttribute(in, "combat-loss-priority", 0); String roleString = getAttribute(in, "role", "default"); role = Enum.valueOf(Role.class, roleString.toUpperCase()); while (in.nextTag() != XMLStreamConstants.END_ELEMENT) { String nodeName = in.getLocalName(); if (Ability.getXMLElementTagName().equals(nodeName)) { String abilityId = in.getAttributeValue(null, "id"); boolean value = getAttribute(in, "value", true); addFeature(new Ability(abilityId, value)); in.nextTag(); // close this element } else if ("required-ability".equals(nodeName)) { String abilityId = in.getAttributeValue(null, "id"); boolean value = getAttribute(in, "value", true); getUnitAbilitiesRequired().put(abilityId, value); in.nextTag(); // close this element } else if ("required-location-ability".equals(nodeName)) { String abilityId = in.getAttributeValue(null, "id"); boolean value = getAttribute(in, "value", true); getLocationAbilitiesRequired().put(abilityId, value); in.nextTag(); // close this element } else if ("required-goods".equals(nodeName)) { GoodsType type = specification.getGoodsType(in.getAttributeValue(null, "id")); int amount = getAttribute(in, "value", 0); AbstractGoods requiredGoods = new AbstractGoods(type, amount); if (getGoodsRequired() == null) { setGoodsRequired(new ArrayList<AbstractGoods>()); } getGoodsRequired().add(requiredGoods); in.nextTag(); // close this element } else if ("compatible-equipment".equals(nodeName)) { String equipmentId = in.getAttributeValue(null, "id"); compatibleEquipment.add(equipmentId); in.nextTag(); // close this element } else if (Modifier.getXMLElementTagName().equals(nodeName)) { Modifier modifier = new Modifier(in); // Modifier close the element if (modifier.getSource() == null) { modifier.setSource(this.getId()); } addFeature(modifier); } else { logger.finest("Parsing of " + nodeName + " is not implemented yet"); while (in.nextTag() != XMLStreamConstants.END_ELEMENT || !in.getLocalName().equals(nodeName)) { in.nextTag(); } } } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
a5eca47f220c0935d439d88dd7c02f7f6a6d4358
38f5ab3182261af6dfb679a53ca12dcf1fad1606
/src/com/java/examples/collection/ArrayListCopyAndAddAll.java
f7af64f2b4f5883408b5e386085f64e25797077c
[]
no_license
babwitforums/CoreJavaExamples
b422875890301351158bb84bdf6e44ea132a882b
ffc4f09fe9bb24382428bfe4691a8229ba6035ab
refs/heads/master
2016-08-11T22:56:30.351560
2015-12-15T12:35:01
2015-12-15T12:35:01
47,599,210
0
0
null
null
null
null
UTF-8
Java
false
false
559
java
package com.java.examples.collection; import java.util.ArrayList; import java.util.List; public class ArrayListCopyAndAddAll { public static void main(String[] args) { List list1 = new ArrayList(); list1.add("A"); list1.add("B"); list1.add("C"); List list2 = new ArrayList(); list2.add("a"); list2.add("b"); list2.add("c"); list1.addAll(list2); list2.add(1, "333"); for (Object object : list2) { System.out.println(object); } System.out.println("---"); for (Object object : list1) { System.out.println(object); } } }
[ "babu.gali@valuelabs.com" ]
babu.gali@valuelabs.com
1f03a1cbdfd8b4abdfe9a425af5021bab28dd6ba
7f20b1bddf9f48108a43a9922433b141fac66a6d
/csplugins/trunk/ucsd/kono/PICRClient2/src/org/cytoscape/ws/client/picr/ui/PICRDialog.java
52601265454c389613358b67c1d7e9882309765e
[]
no_license
ahdahddl/cytoscape
bf783d44cddda313a5b3563ea746b07f38173022
a3df8f63dba4ec49942027c91ecac6efa920c195
refs/heads/master
2020-06-26T16:48:19.791722
2013-08-28T04:08:31
2013-08-28T04:08:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,998
java
/* Copyright (c) 2006, 2007, The Cytoscape Consortium (www.cytoscape.org) The Cytoscape Consortium is: - Institute for Systems Biology - University of California San Diego - Memorial Sloan-Kettering Cancer Center - Institut Pasteur - Agilent Technologies This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and documentation provided hereunder is on an "as is" basis, and the Institute for Systems Biology and the Whitehead Institute have no obligations to provide maintenance, support, updates, enhancements or modifications. In no event shall the Institute for Systems Biology and the Whitehead Institute be liable to any party for direct, indirect, special, incidental or consequential damages, including lost profits, arising out of the use of this software and its documentation, even if the Institute for Systems Biology and the Whitehead Institute have been advised of the possibility of such damage. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ package org.cytoscape.ws.client.picr.ui; import cytoscape.Cytoscape; import cytoscape.data.webservice.WebServiceClientManager; import cytoscape.data.webservice.ui.WebServiceClientGUI; import cytoscape.layout.Tunable; import cytoscape.task.Task; import cytoscape.task.TaskMonitor; import cytoscape.task.ui.JTaskConfig; import cytoscape.task.util.TaskManager; import org.cytoscape.ws.client.picr.PICRClient; import java.awt.Dimension; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.util.List; import javax.swing.JDialog; import javax.swing.JPanel; import javax.swing.JTabbedPane; /** * */ public class PICRDialog extends JDialog implements PropertyChangeListener { private static PICRDialog mainDialog = null; /** * DOCUMENT ME! */ public static void showUI() { if (mainDialog == null) { // Create Task final SetupUITask task = new SetupUITask(); // Configure JTask Dialog Pop-Up Box final JTaskConfig jTaskConfig = new JTaskConfig(); jTaskConfig.setOwner(Cytoscape.getDesktop()); jTaskConfig.displayCloseButton(false); jTaskConfig.displayCancelButton(false); jTaskConfig.displayStatus(true); jTaskConfig.setAutoDispose(true); // Execute Task in New Thread; pop open JTask Dialog Box. TaskManager.executeTask(task, jTaskConfig); } else { mainDialog.setVisible(true); } } private PICRDialog() throws Exception { super(Cytoscape.getDesktop(), false); setTitle("PICR ID Mapper"); // Create a tabbed pane JTabbedPane tabs = new JTabbedPane(); List<Tunable> tunables = WebServiceClientManager.getClient("picr").getProps().getTunables(); JPanel tPanel = new JPanel(); for (Tunable t : tunables) { tPanel.add(t.getPanel()); } JPanel panel = ((WebServiceClientGUI<JPanel>) PICRClient.getClient()).getGUI(); panel.addPropertyChangeListener(this); tabs.addTab("Query", panel); //tabs.addTab("Options", tPanel); tabs.setPreferredSize(new Dimension(450, 500)); add(tabs); pack(); } static class SetupUITask implements Task { private TaskMonitor taskMonitor; public SetupUITask() { } /** * DOCUMENT ME! * * @return DOCUMENT ME! */ public String getTitle() { // TODO Auto-generated method stub return "Accessing PICR Web Service..."; } /** * DOCUMENT ME! */ public void halt() { // TODO Auto-generated method stub } /** * DOCUMENT ME! */ public void run() { taskMonitor.setStatus("Initializing PICR Web Service Client.\n\nIt may take a while.\nPlease wait..."); taskMonitor.setPercentCompleted(-1); try { mainDialog = new PICRDialog(); } catch (Exception e) { taskMonitor.setException(e, "Failed to initialize the PICR dialog."); } mainDialog.setLocationRelativeTo(Cytoscape.getDesktop()); mainDialog.setVisible(true); taskMonitor.setPercentCompleted(100); } /** * DOCUMENT ME! * * @param arg0 DOCUMENT ME! * * @throws IllegalThreadStateException DOCUMENT ME! */ public void setTaskMonitor(TaskMonitor taskMonitor) throws IllegalThreadStateException { this.taskMonitor = taskMonitor; } public void cancel() { // TODO Auto-generated method stub } } /** * DOCUMENT ME! * * @param evt DOCUMENT ME! */ public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals("CLOSE")) { dispose(); } } }
[ "kono@0ecc0d97-ab19-0410-9704-bfe1a75892f5" ]
kono@0ecc0d97-ab19-0410-9704-bfe1a75892f5
39bb88c6f88f97ec0d5077021ef9a34c9700b576
0f905a536fafe0f87ffe863626ed29e7ac8d8979
/redis-application/src/main/java/com/learning/redisapplication/controllers/RedisSortedSetJsonController.java
e3db0f59f5c60dc72054a3ceb94bec4e18e171a0
[]
no_license
kbhatt23/spring-redis
84750e5d32153dfe226b7ed36ec08bf77339e4b0
5e5491c19f4e3c1509e5383b049d72abbaa93584
refs/heads/main
2023-08-25T12:26:48.566684
2021-10-24T08:30:19
2021-10-24T08:30:19
301,333,304
0
0
null
null
null
null
UTF-8
Java
false
false
1,756
java
package com.learning.redisapplication.controllers; import java.util.Set; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.learning.redisapplication.bean.Programmer; import com.learning.redisapplication.service.RedisSortedSetUtilityService; //for demo using json object programmer @RestController @RequestMapping("/programmers-zset") public class RedisSortedSetJsonController { @Autowired private RedisSortedSetUtilityService service; private static final String KEY = "programmersZSet"; @PostMapping("/{priority}") public Programmer insertProgrammer(@RequestBody Programmer programmer, @PathVariable String priority) { service.insertJSONObject(KEY, programmer, Double.parseDouble(priority)); return programmer; } //because set is sorted we can do range @GetMapping("/start/{start}/end/{end}") public Set<Object> recieveProgrammer(@PathVariable String start , @PathVariable String end) { return (Set<Object>)service.recieveRangeObjects(KEY, Integer.parseInt(start), Integer.parseInt(end)); } @GetMapping public Set<Object> recieveAllProgrammer() { return (Set<Object>)service.recieveAll(KEY); } //return and remove one random item from set @DeleteMapping public Programmer retrieveAndRemove() { return (Programmer)service.recieveAndRemoveListObject(KEY); } }
[ "kanishklikesprogramming@gmail.com" ]
kanishklikesprogramming@gmail.com
64b99de48dc402b402b6804c93e47ddb9396200f
6482753b5eb6357e7fe70e3057195e91682db323
/it/unimi/dsi/fastutil/doubles/AbstractDoubleIterator.java
a3ac085b26df402ddd717e3f68af20ad9b748a91
[]
no_license
TheShermanTanker/Server-1.16.3
45cf9996afa4cd4d8963f8fd0588ae4ee9dca93c
48cc08cb94c3094ebddb6ccfb4ea25538492bebf
refs/heads/master
2022-12-19T02:20:01.786819
2020-09-18T21:29:40
2020-09-18T21:29:40
296,730,962
0
1
null
null
null
null
UTF-8
Java
false
false
174
java
package it.unimi.dsi.fastutil.doubles; @Deprecated public abstract class AbstractDoubleIterator implements DoubleIterator { protected AbstractDoubleIterator() { } }
[ "tanksherman27@gmail.com" ]
tanksherman27@gmail.com
fb6a70731de600fcf3dc7b79da5b133a71a00c22
fdefe0db4fd2dd82e889cf692b451069131c9193
/ChatServer.java
0727209cf3ed184cba7a7a722e31546f49c532c3
[]
no_license
anOcelot/SecureMessenger
d22b504ac4a8a9697b1e3d291efd09dc9a90f976
895efb21d2f2bfd542fede238a7be086473ec206
refs/heads/master
2021-08-23T13:46:39.855890
2017-11-20T23:57:05
2017-11-20T23:57:05
110,997,584
0
0
null
null
null
null
UTF-8
Java
false
false
5,986
java
package Java; import com.sun.security.ntlm.Server; import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; import java.nio.ByteBuffer; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; import java.util.*; /** * Created by pieterholleman on 11/14/17. */ public class ChatServer { //use "synchronized" keyword //some java collections (i.e hashmap) act strange //ConcurrentHashMap private ArrayList<SocketChannel> clients; private Map clientMap; private Map screenNameMap; private ServerSocketChannel ServerChannel; Selector selector; public ChatServer(int port) throws IOException { clientMap = Collections.synchronizedMap(new HashMap<SocketChannel, String>()); screenNameMap = Collections.synchronizedMap(new HashMap<String, SocketChannel>()); selector = Selector.open(); ServerChannel = ServerSocketChannel.open(); ServerChannel.configureBlocking(false); ServerChannel.bind(new InetSocketAddress(port)); clients = new ArrayList<SocketChannel>(); ServerChannel.register(selector, SelectionKey.OP_ACCEPT); } public void listenForConnections() { System.out.println("Listening for clients"); int i = 0; while(true){ try { int num = selector.select(); if (num == 0) continue; Set keys = selector.selectedKeys(); Iterator it = keys.iterator(); while (it.hasNext()){ SelectionKey key = (SelectionKey)it.next(); if ((key.readyOps() & SelectionKey.OP_ACCEPT) == (SelectionKey.OP_ACCEPT)){ SocketChannel clientSocket = ServerChannel.accept(); clientSocket.configureBlocking(false); //clientSocket.register(selector, SelectionKey.OP_WRITE); clientSocket.register(selector, SelectionKey.OP_READ); clients.add(clientSocket); clientMap.put(clientSocket, "test"); screenNameMap.put("test", clientSocket); System.out.println("Client connected"); } if ((key.readyOps() & SelectionKey.OP_READ) == (SelectionKey.OP_READ)){ SocketChannel sc = (SocketChannel)key.channel(); recieve(sc); String response = "hi - from non-blocking server"; byte[] bs = response.getBytes(); ByteBuffer buffer = ByteBuffer.wrap(bs); // for (SocketChannel sock : clients){ // // sock.write(buffer); // System.out.println("sent"); // // } } if (key.isWritable()){ // SocketChannel sc = (SocketChannel) key.channel(); // String response = "hi - from non-blocking server"; // byte[] bs = response.getBytes(); // ByteBuffer buffer = ByteBuffer.wrap(bs); // sc.write(buffer); // System.out.println("sent"); } } //clients.add(clientSocket); ++i; //clientMap.put(clientSocket, i); keys.clear(); } catch (IOException e){ e.printStackTrace(); } } } private void broadcast(String message) { ByteBuffer broBuf = ByteBuffer.wrap(message.getBytes()); for(SelectionKey key : selector.keys()){ if(key.isValid() && key.channel() instanceof SocketChannel){ SocketChannel sch=(SocketChannel) key.channel(); try { sch.write(broBuf); } catch (IOException e) { System.out.println("BroBuf error"); } broBuf.rewind(); } } } public void recieve(SocketChannel s){ ByteBuffer inBuffer = ByteBuffer.allocate(1024); try { s.read(inBuffer); String message = new String(inBuffer.array()).trim(); // if (clientMap.get(s) == null){ // clientMap.put(s, message); // screenNameMap.put(message, s); // } System.out.println(message); if (message.startsWith("%")){ s.close(); } // if (message.startsWith("%")) { // String user = message.substring(1); // System.out.println("New User: " + user); // this.addUser(user, s); // // } broadcast(message); } catch (IOException e){ System.out.println("Recieve error"); } } private void startChatSession(SocketChannel clientSocket){ System.out.println("Chat session started"); while (clientSocket.isConnected()){ ByteBuffer buffer = ByteBuffer.allocate(4096); try { clientSocket.read(buffer); String message = new String(buffer.array()).trim(); System.out.print("Recieved message: "); System.out.println(message); if (message.startsWith("%")){ } } catch (IOException E){ System.out.println("SocketChannel read error"); } } } private class ChatServerThread extends Thread{ SocketChannel sc; ChatServerThread(SocketChannel channel){ sc = channel; } public void run() { startChatSession(sc); } } }
[ "pholleman16@gmail.com" ]
pholleman16@gmail.com
bb946bc71af621f99ce94f73ce380ffff9c63af7
c7c714709a0b780d95d3d8a63fbfe66f50aae942
/Assignment2/Patterny9.java
9abc7213755b73752ce07ebf6e140ba342011998
[]
no_license
mayurpawar0809/Edac_may2021
5f952fc1a90a4f1915e78c8ec4ec2dc0287dcf2c
70846cbf5b49329ede3447dc3ec1ef8f31e720f7
refs/heads/main
2023-05-08T12:51:29.349777
2021-05-31T10:08:30
2021-05-31T10:08:30
365,246,189
0
0
null
null
null
null
UTF-8
Java
false
false
483
java
import java.util.*; class Patterny9 { public static void main(String args[]) { for(int i=1;i<5;i++)//row { for(int j=5;j>=i;j--)//column sp { System.out.print(" " ); } { for(int j=1;j<=i;j++)//column str { System.out.print("*" ); } System.out.println(); } } { for(int i=1;i<=5;i++)//row { for(int j=1;j<=i;j++)//column sp { System.out.print(" " ); } { for(int j=5;j>=i;j--)//column str { System.out.print("*" ); } System.out.println(); } } } } }
[ "noreply@github.com" ]
noreply@github.com
2fec21b767b603ed4d4a88130a9a36e084a58f59
6e04aef3d1f93f5e9aff1800c57beaf6de199de3
/YiworldServer/NettyRouteApi/src/main/java/com/yiworld/route/api/vo/response/SendMsgResVO.java
e2c7c42c4fa0c295596151a1f7f34e67a2178bb8
[]
no_license
ilwyiworld/JavaProject
c73ea6d90faa93226a873b107910c72ccb8a04aa
3194a4e09617cd423df89e9942c6b35a8417f6b4
refs/heads/master
2022-12-25T04:39:22.381874
2020-08-20T09:27:36
2020-08-20T09:27:36
176,459,779
1
0
null
2022-12-16T07:47:41
2019-03-19T08:15:11
JavaScript
UTF-8
Java
false
false
125
java
package com.yiworld.route.api.vo.response; import lombok.Data; @Data public class SendMsgResVO { private String msg; }
[ "yiliang@pensees.ai" ]
yiliang@pensees.ai
387ca5529b4fa716d0c6afc19dfe2bd804d7e5b9
90ac2180f0ffd8eae3b115f9a81b340399a4b081
/src/main/java/br/univille/iglycemic/DemoApplication.java
f50be3342257f7b82503bda18f20bf541e5d82d6
[]
no_license
lucasfernandescosta/iGlycemic
887f9d9ec2741bd1d1146f950bac357cb004cf2d
49b29849dceda918e00676726a440f8485fd2643
refs/heads/master
2023-01-27T15:25:49.513864
2020-12-01T22:42:55
2020-12-01T22:42:55
275,040,974
0
1
null
2020-07-14T01:29:18
2020-06-26T00:19:50
Java
UTF-8
Java
false
false
311
java
package br.univille.iglycemic; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } }
[ "christopher.miranda@univillebr.onmicrosoft.com" ]
christopher.miranda@univillebr.onmicrosoft.com
6a1719ac5234c92594fa788591ec1a849a77ae14
a6b0dea7e0546f9f65486065754e49b54ca64838
/src/main/java/com/nasoft/brewer/service/exception/CpfCnpjClienteJaCadastradoException.java
fd01dc31fe6a4d2166e7fd3ce79a7ab0146a1d04
[]
no_license
ANDRERIBEIRO1980/brewer
bbe4ec0c988ada70b6b6cfb0fcd10f38071530ff
cd45a6212187d45ccdc930906f8b92d256dcaf77
refs/heads/master
2021-05-12T10:12:37.037224
2018-01-27T01:28:08
2018-01-27T01:28:08
117,348,899
0
2
null
null
null
null
UTF-8
Java
false
false
262
java
package com.nasoft.brewer.service.exception; public class CpfCnpjClienteJaCadastradoException extends RuntimeException { private static final long serialVersionUID = 1L; public CpfCnpjClienteJaCadastradoException(String message) { super(message); } }
[ "asribeiro1980@gmail.com" ]
asribeiro1980@gmail.com
39397d199e4c030d7041a6261f9ebc040749bf80
8d210db735191c5a14cf2db57b0b02877daf8784
/src/ch11/NonCollectionSequence.java
af46cfd5897104affef566ebb8c76c38189c34da
[]
no_license
1326670425/TIJ
0cc127642ca13b26729fae267512d9df3f03f53f
a8f58dde62d2fd8955d130f81feed5de3d7833b1
refs/heads/master
2020-04-13T23:23:49.016618
2019-08-08T09:57:42
2019-08-08T09:57:42
163,505,084
0
0
null
null
null
null
GB18030
Java
false
false
972
java
/** * @Title NonCollectionSequence.java * @Package ch11 * @Description TODO * @author 吴扬颉 * @date 2019年1月9日 * @version 1.0 */ package ch11; import java.util.*; import ch14.pets.*; class PetSequence{ protected Pet[] pets = Pets.createArray(8); } /** * @ClassName NonCollectionSequence * @Description TODO * @author 吴扬颉 * @date 2019年1月9日 * */ public class NonCollectionSequence extends PetSequence{ public Iterator<Pet> iterator(){ return new Iterator<Pet>(){ private int index = 0; public boolean hasNext(){ return index < pets.length; } public Pet next(){ return pets[index++]; } //remove()为可选操作,这里简单抛出异常 public void remove(){ throw new UnsupportedOperationException(); } }; } public static void main(String[] args) { NonCollectionSequence nc = new NonCollectionSequence(); InterfaceVsIterator.display(nc.iterator()); } }
[ "1326670425@qq.com" ]
1326670425@qq.com
c1358a4d8c0b75be2cf7621d96789d44c806d8f8
57e8247a8974f1eec0516ac7e17d3d62c0cafc76
/Apatar/plugins/connectors/keyvaluestore/src/com/apatar/keyvaluestore/gui/KVSModeDescriptor.java
7e5485bb3a41657752c0a228e81e6a41e3d96511
[]
no_license
vagvaz/Leads-QueryProcessor
6c3132313ead06323a9573fc4409faaa3798291a
920d65ec55d44fbf2fde278fe17172e8eb88d002
refs/heads/master
2020-05-07T21:47:03.854677
2014-10-05T17:13:44
2014-10-05T17:13:44
24,820,445
0
1
null
null
null
null
UTF-8
Java
false
false
2,658
java
package com.apatar.keyvaluestore.gui; import java.io.File; import javax.swing.JOptionPane; import com.apatar.keyvaluestore.KeyValueStoreNode; import com.apatar.ui.ApatarUiMain; import com.apatar.ui.wizard.Wizard; import com.apatar.ui.wizard.WizardPanelDescriptor; public class KVSModeDescriptor extends WizardPanelDescriptor { public static final String IDENTIFIER = "KVSMODE_PANEL"; KVSModePanel panel = new KVSModePanel(); Object backDescriptor; Object nextDescriptor; KeyValueStoreNode node; public KVSModeDescriptor(KeyValueStoreNode node, Object backDescriptor, Object nextDescriptor) { super(); setPanelDescriptorIdentifier(IDENTIFIER); setPanelComponent(panel); this.backDescriptor = backDescriptor; this.nextDescriptor = nextDescriptor; this.node = node; } public Object getNextPanelDescriptor() { return nextDescriptor; } public Object getBackPanelDescriptor() { return backDescriptor; } public void aboutToDisplayPanel() { getWizard().setTitleComment(""); getWizard().setAdditionalComment(""); } public void displayingPanel() { } public int aboutToHidePanel(String actionCommand) { if (actionCommand.equals(Wizard.NEXT_BUTTON_ACTION_COMMAND)) { node.setMapperPath(panel.getMapperPath().getText()); node.setReducerPath(panel.getReducerPath().getText()); node.setCombinerPath(panel.getCombinerPath().getText()); node.setXmlPath(panel.getXmlPath().getText()); node.setOutputFolder(panel.getOutputFolder().getText()); File mapperFile = new File(node.getMapperPath()); File reducerFile = new File(node.getReducerPath()); File combinerFile = new File(node.getCombinerPath()); File xmlFile = new File(node.getXmlPath()); File outputDirectory = new File(node.getOutputFolder()); if (!mapperFile.exists()){ JOptionPane.showMessageDialog(ApatarUiMain.MAIN_FRAME, "Mapper file does not exist."); return LEAVE_CURRENT_PANEL; } else if(!reducerFile.exists()){ JOptionPane.showMessageDialog(ApatarUiMain.MAIN_FRAME, "Reducer file does not exist."); return LEAVE_CURRENT_PANEL; } else if(!combinerFile.exists()){ JOptionPane.showMessageDialog(ApatarUiMain.MAIN_FRAME, "Combiner file does not exist."); return LEAVE_CURRENT_PANEL; } else if(!xmlFile.exists()){ JOptionPane.showMessageDialog(ApatarUiMain.MAIN_FRAME, "XML file does not exist."); return LEAVE_CURRENT_PANEL; } else if(!outputDirectory.isDirectory()){ JOptionPane.showMessageDialog(ApatarUiMain.MAIN_FRAME, "Output directory given is not a directory."); return LEAVE_CURRENT_PANEL; } } return CHANGE_PANEL; } }
[ "vagvaz@gmail.com" ]
vagvaz@gmail.com