blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
a571e6262b7ada4f9879caa771a5e68f78e9d55a
fe8d64940babaf9636e17cebb3d4576a113f7915
/src/main/java/com/sankin/diamond/DTO/SmallTeamDTO.java
d8e590331da5cbd918c074e52c4ec5d0895a2779
[]
no_license
SanKinW/diamond_back
e0f575e6a48639a6209193ab169cd5b059e8ad18
c1793456b6e9bcbd44a5414df78d3edc787cf7fd
refs/heads/master
2022-12-04T03:32:32.364756
2020-08-20T02:44:11
2020-08-20T02:44:11
286,428,185
2
0
null
null
null
null
UTF-8
Java
false
false
204
java
package com.sankin.diamond.DTO; import lombok.Data; @Data public class SmallTeamDTO { private Integer id; private String teamName; private Integer creator; private String creatorName; }
[ "18373275@buaa.edu.cn" ]
18373275@buaa.edu.cn
91227f4eb75f02544d6c0159b85d49bffbfafb22
6d0e928b5ccdccf4f8741cfc7c103fa82b7ee49e
/src/classeseobjetos/encapsulamento/ContaCorrenteMain.java
48d177609294bd0e50b725d7c75739b1fc5cdd22
[]
no_license
thiagomurillo/POO-Unifacisa
9785f6a8c45907bb348440978a2982b18af77739
74976735862437887d7849717e5c580e453a8e27
refs/heads/master
2022-10-06T06:29:11.021721
2020-06-06T00:35:18
2020-06-06T00:35:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
404
java
package classeseobjetos.encapsulamento; public class ContaCorrenteMain { public static void main(String[] args) { // ContaCorrente c1 = new ContaCorrente(500, 200, 12345, "Eduardo"); // ContaCorrente c2 = new ContaCorrente(50, 200, 123, "Joao"); // ContaCorrente c3 = new ContaCorrente(5000, 200, 123456, "Ana"); // // c2.transferir(250, c2); // System.out.println(c2.getSaldo()); } }
[ "eduardolfalcao@gmail.com" ]
eduardolfalcao@gmail.com
c70738adc81924d4ac6dbd08ee7314d1f3ea93a1
d6f31c99b7026f0da0f4816380de33f8813fc061
/src/main/java/com/hebeu/keyan/dao/customMapper/EPaperMapperCustom.java
094136aa5e04263c4345cde626c8905bc95c39d6
[]
no_license
pursuedream0820/keyan
436cf45b813ea24a996b0dd13ff49e7669a6c574
86ef831192c76e9a4baf0d728fe3b1f8a0d1b75c
refs/heads/master
2021-06-23T13:54:27.509494
2017-08-24T12:33:12
2017-08-24T12:33:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,327
java
package com.hebeu.keyan.dao.customMapper; import com.hebeu.keyan.po.customPO.EIncludeCustom; import com.hebeu.keyan.po.customPO.EPaperCustom; import com.hebeu.keyan.vo.PersonListVO; import org.springframework.stereotype.Repository; import java.util.List; /** * 作者:冯嘉龙 * 时间:2017-08-22 8:59 * 描述:论文 Mapper拓展接口,主要是实现自定义查询 */ @Repository public interface EPaperMapperCustom { /** * 根据 工号 查询 论文 列表 * * @param workNum 工号 * @return 返回指定 工号 的 论文 集合 */ public List<EPaperCustom> selectPaperResultByWorkNum(String workNum); /** * 根据 论文编号 查询 论文 * @param paperId 论文编号 * @return 返回指定 论文编号 的论文信息 */ public EPaperCustom selectPaperResultInfoByPaperId(String paperId); /** * 查询指定 论文 的人员列表 * @param paperId 论文 * @return 返回指定 论文 的 人员列表集合 */ public List<PersonListVO> selectPersonListByPaperId(String paperId); /** * 查询指定 论文 的人员列表 * @param paperId 论文 * @return 返回指定 论文 的 人员列表集合 */ public List<EIncludeCustom> selectIncludeListByPaperId(String paperId); }
[ "672582330@qq.com" ]
672582330@qq.com
268b61286d21271aeb7fae3f7ac32dcd727f157c
8cf1cfbf77877b24891ac0e26e3efcfc8614146d
/src/main/java/com/cxy/utils/date/TimeUtils.java
305e967d14ca9c018b8ed0932340fc43fdd4e799
[]
no_license
wonderfulo/template_project_mybatis_plus
a06c82c3961e6b837ba52cfd18a309eefb13c2eb
5e9f79b5f19a6d23f2de9aa6087b80626a33c84a
refs/heads/main
2023-07-15T16:52:25.667521
2021-09-01T02:43:10
2021-09-01T02:43:10
316,173,712
1
1
null
null
null
null
UTF-8
Java
false
false
5,029
java
package com.cxy.utils.date; import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.*; import java.time.format.DateTimeFormatter; import java.time.temporal.ChronoUnit; import java.util.Date; /** * @Description 日期时间操作通用类 * @Date 2020/5/19 11:38 * @Author chen kang hua * @Version 1.0 **/ public class TimeUtils { public static final String DEFAULT_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss"; public static final String YMD_TIME_PATTERN = "yyyy-MM-dd"; public static void main(String[] args) { LocalDateTime now = LocalDateTime.now(); String ofDay = getStartOfDay(now); LocalDateTime appointTime = getAppointTime(-1L, ChronoUnit.DAYS); String dateTime = formatLocalDateTime(now, DEFAULT_TIME_PATTERN); // System.out.println(now); // System.out.println(ofDay); System.out.println(formatLocalDateTime(appointTime, DEFAULT_TIME_PATTERN)); // System.out.println(dateTime); int compareTo = new Date().compareTo(getDateStartOfDay(LocalDateTime.now())); System.out.println(compareTo); } // 获得某天最小时间 2020-05-19 00:00:00 public static String getStartOfDay(LocalDateTime localDateTime) { LocalDateTime startTime = localDateTime.with(LocalTime.MIN); return formatLocalDateTime(startTime, DEFAULT_TIME_PATTERN); } // 获得某天最大时间 2020-05-19 23:59:59 public static String getEndOfDay(LocalDateTime localDateTime) { LocalDateTime endOfDay = localDateTime.with(LocalTime.MAX); return formatLocalDateTime(endOfDay, DEFAULT_TIME_PATTERN); } // 获得某天最小时间 2020-05-19 00:00:00 public static Date getDateStartOfDay(LocalDateTime localDateTime) { LocalDateTime startTime = localDateTime.with(LocalTime.MIN); return asDate(startTime); } // 获得某天最大时间 2020-05-19 23:59:59 public static Date getDateEndOfDay(LocalDateTime localDateTime) { LocalDateTime endOfDay = localDateTime.with(LocalTime.MAX); return asDate(endOfDay); } /** * 获取指定时间 * * @param amountToAdd 时间跨度 * @param chronoUnit 跨度时间单位 * @return */ public static LocalDateTime getAppointTime(Long amountToAdd, ChronoUnit chronoUnit) { return LocalDateTime.now() .plus(amountToAdd, chronoUnit); } /** * 格式化时间 * * @param localDateTime * @param pattern * @return */ public static String formatLocalDateTime(LocalDateTime localDateTime, String pattern) { DateTimeFormatter timeFormatter = DateTimeFormatter.ofPattern(pattern); return timeFormatter.format(localDateTime); } /** * 格式化时间 * * @param date * @param pattern * @return */ public static String formatDateTime(Date date, String pattern) { return formatLocalDateTime(asLocalDateTime(date), pattern); } /** * localDate 转 Date * * @param localDate * @return */ public static Date asDate(LocalDate localDate) { return Date.from(localDate.atStartOfDay().atZone(ZoneId.systemDefault()).toInstant()); } /** * LocalDateTime 转 Date * * @param localDateTime * @return */ public static Date asDate(LocalDateTime localDateTime) { return Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); } /** * Date 转 LocalDate * * @param date * @return */ public static LocalDate asLocalDate(Date date) { return Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDate(); } /** * Date 转 LocalDateTime * * @param date * @return */ public static LocalDateTime asLocalDateTime(Date date) { return Instant.ofEpochMilli(date.getTime()).atZone(ZoneId.systemDefault()).toLocalDateTime(); } /** * String 转 Date * * @param dateTime 需要转换的字符时间 * @return * @throws ParseException */ public static Date formatDate(String dateTime, String pattern) { SimpleDateFormat format = new SimpleDateFormat(pattern); try { return format.parse(dateTime); } catch (ParseException e) { e.printStackTrace(); throw new RuntimeException("时间格式化错误 错误参数:" + dateTime); } } /** * String 转 Date * * @param dateTime 需要转换的字符时间 * @return * @throws ParseException */ public static Date asDate(String dateTime) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); try { return format.parse(dateTime); } catch (ParseException e) { e.printStackTrace(); throw new RuntimeException("时间格式化错误 错误参数:" + dateTime); } } }
[ "chenxiangyu@chaojidaogou.com" ]
chenxiangyu@chaojidaogou.com
4261edea44d85b84e0609ee3fa43084ec4a65f9e
42e9f81a9a5d2f5fbb8228074a81589ac32d40e4
/hotel-service/src/main/java/com/kugmax/learn/hotel/hotelservice/HotelServiceApplication.java
8565bcba10b33aeddb3af28d8be36832e438cab3
[]
no_license
kugmax/hotel-reservation
ea7dd8fae87810343e07fcf6a5c29b4900392062
f6191a42461bf2ca980857f01d84aa6c39f4187b
refs/heads/master
2021-01-07T04:18:32.353400
2020-02-25T12:20:34
2020-02-25T12:20:34
241,576,474
0
0
null
null
null
null
UTF-8
Java
false
false
424
java
package com.kugmax.learn.hotel.hotelservice; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.web.servlet.config.annotation.EnableWebMvc; @EnableWebMvc @SpringBootApplication public class HotelServiceApplication { public static void main(String[] args) { SpringApplication.run(HotelServiceApplication.class, args); } }
[ "maximkugatov@gmail.com" ]
maximkugatov@gmail.com
51632b3066c88d94b5458fe13cf02788599083ea
208ba847cec642cdf7b77cff26bdc4f30a97e795
/fg/fd/src/main/java/org.wp.fd/widgets/WPAlertDialogFragment.java
784254ae7484c64198c5b60b320837b353bc4887
[]
no_license
kageiit/perf-android-large
ec7c291de9cde2f813ed6573f706a8593be7ac88
2cbd6e74837a14ae87c1c4d1d62ac3c35df9e6f8
refs/heads/master
2021-01-12T14:00:19.468063
2016-09-27T13:10:42
2016-09-27T13:10:42
69,685,305
0
0
null
2016-09-30T16:59:49
2016-09-30T16:59:48
null
UTF-8
Java
false
false
5,790
java
package org.wp.fd.widgets; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.text.TextUtils; import org.wp.fd.R; import org.wp.fd.WordPress; import org.wp.fd.util.StringUtils; public class WPAlertDialogFragment extends DialogFragment implements DialogInterface.OnClickListener { private static enum WPAlertDialogType {ALERT, // simple ok dialog with error message CONFIRM, // dialog with yes/no and callback when positive button clicked URL_INFO} // info dialog that shows url when positive button clicked private static final String ARG_TITLE = "title"; private static final String ARG_MESSAGE = "message"; private static final String ARG_TYPE = "type"; private static final String ARG_INFO_TITLE = "info-title"; private static final String ARG_INFO_URL = "info-url"; public interface OnDialogConfirmListener { public void onDialogConfirm(); } public static WPAlertDialogFragment newAlertDialog(String message) { String title = WordPress.getContext().getString(R.string.error_generic); return newAlertDialog(title, message); } public static WPAlertDialogFragment newAlertDialog(String title, String message) { return newInstance(title, message, WPAlertDialogType.ALERT, null, null); } public static WPAlertDialogFragment newConfirmDialog(String title, String message) { return newInstance(title, message, WPAlertDialogType.CONFIRM, null, null); } public static WPAlertDialogFragment newUrlInfoDialog(String title, String message, String infoTitle, String infoUrl) { return newInstance(title, message, WPAlertDialogType.URL_INFO, infoTitle, infoUrl); } private static WPAlertDialogFragment newInstance(String title, String message, WPAlertDialogType alertType, String infoTitle, String infoUrl) { WPAlertDialogFragment dialog = new WPAlertDialogFragment(); Bundle bundle = new Bundle(); bundle.putString(ARG_TITLE, StringUtils.notNullStr(title)); bundle.putString(ARG_MESSAGE, StringUtils.notNullStr(message)); bundle.putSerializable(ARG_TYPE, (alertType != null ? alertType : WPAlertDialogType.ALERT)); if (alertType == WPAlertDialogType.URL_INFO) { bundle.putString(ARG_INFO_TITLE, StringUtils.notNullStr(infoTitle)); bundle.putString(ARG_INFO_URL, StringUtils.notNullStr(infoUrl)); } dialog.setArguments(bundle); return dialog; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setCancelable(true); int style = DialogFragment.STYLE_NORMAL, theme = 0; setStyle(style, theme); } @Override public Dialog onCreateDialog(Bundle savedInstanceState) { Bundle bundle = getArguments(); final String title = StringUtils.notNullStr(bundle.getString(ARG_TITLE)); final String message = StringUtils.notNullStr(bundle.getString(ARG_MESSAGE)); final WPAlertDialogType dialogType; if (bundle.containsKey(ARG_TYPE) && bundle.getSerializable(ARG_TYPE) instanceof WPAlertDialogType) { dialogType = (WPAlertDialogType) bundle.getSerializable(ARG_TYPE); } else { dialogType = WPAlertDialogType.ALERT; } AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); builder.setTitle(title); builder.setMessage(message); switch (dialogType) { case ALERT: builder.setIcon(android.R.drawable.ic_dialog_alert); builder.setNeutralButton(R.string.ok, this); break; case CONFIRM: builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (getActivity() instanceof OnDialogConfirmListener) { OnDialogConfirmListener act = (OnDialogConfirmListener) getActivity(); act.onDialogConfirm(); } } }); builder.setNegativeButton(R.string.no, this); break; case URL_INFO: final String infoTitle = StringUtils.notNullStr(bundle.getString(ARG_INFO_TITLE)); final String infoURL = StringUtils.notNullStr(bundle.getString(ARG_INFO_URL)); builder.setPositiveButton(infoTitle, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { if (!TextUtils.isEmpty(infoURL)) startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(infoURL))); } }); break; } return builder.create(); } @Override public void onClick(DialogInterface dialog, int which) { } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
9023c885584d156a2879047bcb101e12e5de6a7f
86f33b4fbc579e4f7747f0e314fda322ff81f97c
/java/src/main/java/com/leetcode/mst1707/Solution.java
52515851db5ff16ebc7919e6d1bd54d15b740914
[]
no_license
TangGuoHua/leetcode
3251ee97a4f238d36f2350ea977d3709c829f2e6
e209dac2763e2dddf5e15bde70618f1490589dc0
refs/heads/main
2023-06-03T01:05:28.101727
2021-06-08T13:19:50
2021-06-08T13:20:07
318,691,442
0
0
null
null
null
null
UTF-8
Java
false
false
3,374
java
package com.leetcode.mst1707; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; class Solution { public String[] trulyMostPopular(String[] names, String[] synonyms) { // this map store name of baby -> the number of babies with this name; Map<String,Integer> nameCountMap = new HashMap<>(names.length); for(String name : names){ nameCountMap.put(name.substring(0,name.indexOf("(")), Integer.parseInt(name.substring(name.indexOf("(")+1, name.length() -1))); } for(String str : synonyms){ String name1 = str.substring(1, str.indexOf(",")); if(!nameCountMap.containsKey(name1)){ nameCountMap.put(name1, 0); } String name2 = str.substring(str.indexOf(",")+1, str.length() -1); if(!nameCountMap.containsKey(name2)){ nameCountMap.put(name2,0); } } System.out.println(nameCountMap); // give each name an id; List<Map.Entry<String, Integer>> nameList = new ArrayList<>(nameCountMap.entrySet()); Map<String, Integer> name2id = new HashMap<>(); for(int i = 0; i < nameList.size(); i++){ name2id.put(nameList.get(i).getKey(), i); } System.out.println(name2id); // give an id to each name UF uf = new UF(nameList.size()); // for each name, get the id and union them for(String str : synonyms){ String name1 = str.substring(1, str.indexOf(",")); String name2 = str.substring(str.indexOf(",")+1, str.length() -1); System.out.println("try to union "+name1 + " and "+name2); uf.union(name2id.get(name1), name2id.get(name2)); } Map<Integer, List<Integer>> parentChildrenMap = new HashMap<>(); for(int i = 0; i < nameList.size(); i++){ int parent = uf.findParent(i); if(!parentChildrenMap.containsKey(parent)){ parentChildrenMap.put(parent, new ArrayList<>()); } parentChildrenMap.get(parent).add(i); } System.out.println(parentChildrenMap); String[] result = new String[parentChildrenMap.size()]; int index = 0; for(Map.Entry<Integer, List<Integer>> entry : parentChildrenMap.entrySet()){ List<String> children = new ArrayList<>(); for(Integer childId : entry.getValue()){ children.add(nameList.get(childId).getKey()); } Collections.sort(children); int total = 0; for(String childName : children){ total += nameCountMap.get(childName); } result[index++] = getName(children,nameCountMap)+"("+total+")"; } return result; } private String getName(List<String> children, Map<String, Integer> map){ for(int i = 0; i < children.size();i++){ if(map.get(children.get(i))> 0){ return children.get(i); } } return ""; } } class UF{ int n = 0; int[] parent = null; public UF(int n){ this.n = n; parent = new int[n]; for(int i = 0; i < parent.length; i++){ parent[i] = i; } } public int findParent(int x){ while(x != parent[x]){ x = parent[x]; } return x; } public boolean isInSameSet(int x, int y){ int px = findParent(x); int py = findParent(y); return px == py; } public void union(int x, int y){ int px = findParent(x); int py = findParent(y); if(px!=py){ parent[py]=px; } } }
[ "guohua.tang@sap.com" ]
guohua.tang@sap.com
ab69f828f2281520211e73040f244546c0db60b9
6f4a853b55b22371d8a2c480dfac46a716ed041f
/G6SA_Autotest/src/androidTest/java/com/itti/g6sa_autotest/Do.java
65f6142fe9fd6332ac3ef59bf8cea8126482889d
[]
no_license
DongchengWei/G6SA_Autotest
3026264413d3dd89767824beed362ea988464c43
593993100e19be549bce081f8aaab3ea6649c756
refs/heads/master
2020-03-27T19:10:15.906496
2018-09-06T03:57:55
2018-09-06T03:57:55
146,871,741
0
0
null
null
null
null
UTF-8
Java
false
false
967
java
package com.itti.g6sa_autotest; import android.app.Instrumentation; import android.content.Context; import android.os.Bundle; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import android.support.test.uiautomator.UiDevice; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(AndroidJUnit4.class) public class Do { public static final String TAG = "Tonsen_Tag"; private static Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation(); public static UiDevice mUiDevice = UiDevice.getInstance(instrumentation); public static Context appContext = InstrumentationRegistry.getTargetContext(); public static Bundle bundle = InstrumentationRegistry.getArguments();//获取参数 /** * 不起作用了2018-08-13 * */ @Test public void _0001_longPressPowerButton() throws Exception { UiAutoLibs.longPressKeyCode(26, 5000); } }
[ "Dongcheng.Wei@desay-svautomotive.com" ]
Dongcheng.Wei@desay-svautomotive.com
82c1fff5b84902bf75b623ebee122f6b5986a93a
18f59c5325b32199b9da56ca9db2c23623be67f2
/examples/group-rest-controller/rest-controller-extendable-model/src/main/java/io/rxmicro/examples/rest/controller/extendable/model/response/body_only/child_model_without_fields/grand/GrandParent.java
736fabf06f921f0b74fe7ea33162c46781e9e463
[ "Classpath-exception-2.0", "SSPL-1.0", "PostgreSQL", "GPL-2.0-only", "Apache-2.0", "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
rxmicro/rxmicro-usage
87f6cc0fb38995b850eb2366c81ae57f3276fa65
57fad6d2f168dddda68c4ce38214de024c475f42
refs/heads/master
2022-12-23T17:56:41.534691
2022-12-14T17:53:12
2022-12-14T18:28:47
248,581,825
0
0
Apache-2.0
2022-12-13T11:39:41
2020-03-19T18:56:25
Java
UTF-8
Java
false
false
852
java
/* * Copyright (c) 2020. http://rxmicro.io * * 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 io.rxmicro.examples.rest.controller.extendable.model.response.body_only.child_model_without_fields.grand; import io.rxmicro.model.BaseModel; public class GrandParent extends BaseModel { String grandParameter = "grandParameter"; }
[ "rxmicro.io@gmail.com" ]
rxmicro.io@gmail.com
2deb5d3d56a8f9707ff3887a0723e00554ad990a
6ff5a4543e94e7daeebde6a03b2cca9aa6f24fff
/src/Day01_night/MyBallPanel.java
44974872894d6346cfc2abb2cf40d8bfd9c24024
[]
no_license
fuwu1225/AHNU
103bbf43b42eef80dda4fce766fadc4d3be3da5d
d498b0756a3f69c2d9280b4c81d342311e4c0bd0
refs/heads/master
2020-05-16T01:35:34.584891
2019-05-03T15:29:33
2019-05-03T15:29:33
182,606,311
0
0
null
null
null
null
UTF-8
Java
false
false
4,710
java
package Day01_night; import java.awt.*; import javax.swing.JPanel; /** * 小弹球画布类 * 1.继承 JPanel * 2.实现Runnable * 3.重写 paint方法 * 4.实现run方法 * 5.run====>线程三部曲 * 业务执行、线程睡眠、重绘方法 */ public class MyBallPanel extends JPanel implements Runnable { /** * */ private static final long serialVersionUID = 1L; /** * 第一部分:变量声明区域 **/ int x = 30; int y = 30; int f = 0; int r, gg, b; int score = 0; //数组 int[] xx = new int[5]; int[] yy = new int[5]; int[] ff = new int[5]; Color[] colors = new Color[5]; int speed = 5; /** * 第二部分:构造方法区域 */ public MyBallPanel() { for (int i = 0; i < 5; i++) { xx[i] = (int) (Math.random() * 700); yy[i] = (int) (Math.random() * 500); ff[i] = (int) (Math.random() * 4); colors[i] = updateColor(); } } /** * 第三部分:画笔方法区域 */ @Override public void paint(Graphics g) { super.paint(g); for (int i = 0; i < 5; i++) { g.setColor(colors[i]); g.fillOval(xx[i], yy[i], 33, 33); //r = (int) (Math.random() * 255); // gg = (int) (Math.random() * 255); // b = (int) (Math.random() * 255); //colors[i]=new Color(r,gg,b); g.drawString("分数:" + score, 100, 100); } } /** * 第四部分:业务处理区域 */ @Override public void run() { while (true) { // 1.业务执行 for (int i = 0; i < 5; i++) { if (ff[i] == 0) { xx[i]++; yy[i]++; } if (ff[i] == 1) { xx[i]++; yy[i]--; } if (ff[i] == 2) { xx[i]--; yy[i]--; } if (ff[i] == 3) { xx[i]--; yy[i]++; } if (xx[i] >= 800 && ff[i] == 0) { colors[i] = updateColor(); //colors[i] = new Color(r, gg, b); ff[i] = 3; score += 50; } if (xx[i] >= 800 && ff[i] == 1) { score += 50; colors[i] = updateColor(); //colors[i] = new Color(r, gg, b); ff[i] = 2; score += 50; } if (xx[i] <= 0 && ff[i] == 3) { colors[i] = updateColor(); //colors[i] = new Color(r, gg, b); ff[i] = 0; score += 50; } if (xx[i] <= 0 && ff[i] == 2) { colors[i] = updateColor(); //colors[i] = new Color(r, gg, b); ff[i] = 1; score += 50; } if (yy[i] >= 600 && ff[i] == 0) { colors[i] = updateColor(); //colors[i] = new Color(r, gg, b); ff[i] = 1; score += 50; } if (yy[i] >= 600 && ff[i] == 3) { colors[i] = updateColor(); //colors[i] = new Color(r, gg, b); ff[i] = 2; score += 50; } if (yy[i] <= 0 && ff[i] == 2) { colors[i] = updateColor(); //colors[i] = new Color(r, gg, b); ff[i] = 3; score += 50; } if (yy[i] <= 0 && ff[i] == 1) { colors[i] = updateColor(); ff[i] = 0; score += 50; } } //判断速度 if (score > 500 && score <= 1000) speed = 3; else if (score > 1000 && score < 2000) speed = 2; else speed = 1; // 2.线程睡眠 try { Thread.sleep(speed); } catch (InterruptedException e) { e.printStackTrace(); } // 3.重绘方法 repaint(); } } /*修改颜色*/ public Color updateColor() { int R = (int) (Math.random() * 255); int G = (int) (Math.random() * 255); int B = (int) (Math.random() * 255); return new Color(R, G, B); } }
[ "fuwu1210@gmail.com" ]
fuwu1210@gmail.com
5911d40bcdacdf0baa1d3244450785c79b9ef512
30f3d58b484fe4c66a0ae27fbecef007cdda641c
/RegistrationUsingJsp/src/com/bridgelabz/registration/RegistrationForUser.java
195798e50dc032df33aafa008e018bc5c06ff741
[]
no_license
princeryadav/AllProject
ca7bb6c3764580fbb619dc759294aacfaf597ad5
b08804e8078cf90e8a627de5f4e6aff4ff188a93
refs/heads/master
2021-01-20T13:10:23.458697
2017-05-06T09:52:02
2017-05-06T09:52:02
90,452,807
0
0
null
null
null
null
UTF-8
Java
false
false
1,876
java
package com.bridgelabz.registration; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.bridgelabz.dbConnection.ConnectJdbc; @WebServlet("/RegistrationForUser") public class RegistrationForUser extends HttpServlet { private static final long serialVersionUID = 1L; protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out=response.getWriter(); ConnectJdbc connectJdbc=new ConnectJdbc(); Connection connection=(Connection)connectJdbc.getConnect(); String query="Insert into RegistrationForUser(username,email,password,phone_no)values(?,?,?,?)"; String uname=request.getParameter("username"); String email=request.getParameter("email"); String password=request.getParameter("password"); String phone_no=request.getParameter("phone_no"); try { PreparedStatement pStatement=connection.prepareStatement(query); pStatement.setString(1, uname); pStatement.setString(2, email); pStatement.setString(3, password); pStatement.setString(4, phone_no); int rs=pStatement.executeUpdate(); System.out.println(rs); if(rs==1){ request.getRequestDispatcher("loginForUser.jsp").include(request, response); out.println("register succesfull"); }else{ request.getRequestDispatcher("registrationForUser.jsp"); out.println("dublicates email"); } } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } }
[ "prince.yadavp098@gmail.com" ]
prince.yadavp098@gmail.com
0955684e8ec3181838976929aaa3be4388fe728e
5982706f57be2ee71089b72d815a0b5b498d1322
/src/main/java/Data/RoleDb.java
45686ccebef264b1e23eeec1d4a089d7a7fe619d
[]
no_license
MoranChery/FootballSystem
78bd5597037b4bbdbd507d3f24d4caa185560299
ed6a5be9252e7abf1029cffd1155992d4dcd5aff
refs/heads/master
2022-06-26T22:52:59.240893
2020-05-30T23:04:32
2020-05-30T23:04:32
251,663,027
3
0
null
2022-06-21T03:28:13
2020-03-31T16:26:00
Java
UTF-8
Java
false
false
851
java
package Data; import Model.Enums.RoleType; import Model.Role; import Model.UsersTypes.TeamOwner; import java.sql.SQLException; import java.util.List; public interface RoleDb extends Db { void insertRole(String emailAddress, String teamName, RoleType roleType) throws SQLException; void createRoleInSystem(String emailAddress, RoleType roleType) throws SQLException; List<Role> getRoles(String emailAddress) throws Exception; void removeRoleFromTeam(String EmailAddressToRemove, String teamName, RoleType roleType) throws Exception; void removeRoleFromSystem(String emailAddressToRemove) throws Exception; void removeRole(String emailAddressToRemove, RoleType roleType) throws Exception; Role getRole(String emailAddress) throws Exception; void updateTeam(String teamName, String email) throws SQLException; }
[ "noyharar@post.bgu.ac.il" ]
noyharar@post.bgu.ac.il
3f449f05b9ae1da988ce7b977ec61fac760215a6
271c2ddac645e5488eaf11bf0db7ac69a901a085
/learning-datastructures/src/ds/queue/Queue.java
6d5b1461b5680f4300b7cf906a5661a9aa608280
[ "MIT" ]
permissive
MichaelSlainte/DataStructure
eec4f473e3a07f8ec4468bfa735931a000de5bd0
51270a7aa7d5b24cfa17b963ac8ed17f0f1ef129
refs/heads/master
2020-03-17T12:18:09.012955
2018-05-15T23:04:19
2018-05-15T23:04:19
133,582,425
0
0
null
null
null
null
UTF-8
Java
false
false
1,928
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 ds.queue; /** * * @author engmi */ public class Queue { private int maxSize; // initializes the set number of slots private long[] queArray; // slots to main the data private int front; // this will be the index position for the element in the front private int rear; // going to be the index position for the element at the back of the line private int nItems; // counter to maintain the number of items in our queue public Queue(int size) { this.maxSize = size; this.queArray = new long[size]; front = 0; // index position of the first slot of the array rear = -1; // there is no item in the array yet to be considered as the last item. nItems = 0;// we don't have elements in the array yet } public void insert(long j) { if (rear == maxSize - 1) { // the method is a called "CIRCULAR QUEUE" rear = -1; } rear++; queArray[rear] = j; nItems++; } public long remove() { //remove item from the front of the queue long temp = queArray[front]; front++; if (front == maxSize) { front = 0; // we can set front back to the oth index so that we can utilize the entire array again } nItems--; return temp; } public long peakFront() { return queArray[front]; } public boolean isEmpty() { return (nItems == 0); } public boolean isFull() { return (nItems == maxSize); } public void view() { System.out.print("[ "); for (int i = 0; i < queArray.length; i++) { System.out.print(queArray[i] + " "); } System.out.print("]"); } }
[ "eng.michaelmarques@outlook.com" ]
eng.michaelmarques@outlook.com
15f8f7c7311fbe5c656bc96059fd239e5d043f1b
b66bff974b820c9dc66651da3f1912edcf44cbc1
/mall-mbg/src/main/java/com/mall/mbg/entity/UmsIntegrationConsumeSetting.java
141bb3b050908133d39ccb541e5572050e4abf5d
[]
no_license
kitonGao/mall-springclound
e8c16176bb0e542210b1445548d618a46d12895d
98b4682ce03fa21f677c06412a82d119156fe20f
refs/heads/master
2022-07-12T18:30:54.400621
2020-04-20T01:51:50
2020-04-20T01:51:50
251,230,894
0
0
null
2022-06-21T03:05:51
2020-03-30T07:21:27
Java
UTF-8
Java
false
false
2,201
java
package com.mall.mbg.entity; import io.swagger.annotations.ApiModelProperty; import java.io.Serializable; public class UmsIntegrationConsumeSetting implements Serializable { private Long id; @ApiModelProperty(value = "每一元需要抵扣的积分数量") private Integer deductionPerAmount; @ApiModelProperty(value = "每笔订单最高抵用百分比") private Integer maxPercentPerOrder; @ApiModelProperty(value = "每次使用积分最小单位100") private Integer useUnit; @ApiModelProperty(value = "是否可以和优惠券同用;0->不可以;1->可以") private Integer couponStatus; private static final long serialVersionUID = 1L; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Integer getDeductionPerAmount() { return deductionPerAmount; } public void setDeductionPerAmount(Integer deductionPerAmount) { this.deductionPerAmount = deductionPerAmount; } public Integer getMaxPercentPerOrder() { return maxPercentPerOrder; } public void setMaxPercentPerOrder(Integer maxPercentPerOrder) { this.maxPercentPerOrder = maxPercentPerOrder; } public Integer getUseUnit() { return useUnit; } public void setUseUnit(Integer useUnit) { this.useUnit = useUnit; } public Integer getCouponStatus() { return couponStatus; } public void setCouponStatus(Integer couponStatus) { this.couponStatus = couponStatus; } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append(getClass().getSimpleName()); sb.append(" ["); sb.append("Hash = ").append(hashCode()); sb.append(", id=").append(id); sb.append(", deductionPerAmount=").append(deductionPerAmount); sb.append(", maxPercentPerOrder=").append(maxPercentPerOrder); sb.append(", useUnit=").append(useUnit); sb.append(", couponStatus=").append(couponStatus); sb.append(", serialVersionUID=").append(serialVersionUID); sb.append("]"); return sb.toString(); } }
[ "15822985265@163.com" ]
15822985265@163.com
35aa4de2e6209db35068358b58161cb86f145f92
9d1f13d61f71ad4cfc03f3351ddcebafd890035e
/patientview/src/main/java/com/worthsoln/patientview/user/UserDeleteAction.java
32a4e15aff3314d0ccaf279d7bbc777103bce727
[]
no_license
robworth/myibdportal
0f8016311d083e733c2084a37fb80c3b36c7f9ea
f3d17f8daa3363e3a5b079c749df8707e5a7cdce
refs/heads/master
2020-06-08T13:25:21.527961
2013-01-31T17:51:51
2013-01-31T17:51:51
6,350,937
0
1
null
2012-12-21T09:36:01
2012-10-23T11:08:58
Java
UTF-8
Java
false
false
3,272
java
package com.worthsoln.patientview.user; import com.worthsoln.database.action.DatabaseAction; import com.worthsoln.patientview.model.User; import com.worthsoln.patientview.logging.AddLog; import com.worthsoln.patientview.logon.PatientLogon; import com.worthsoln.patientview.model.UserMapping; import com.worthsoln.patientview.model.Unit; import com.worthsoln.patientview.unit.UnitUtils; import com.worthsoln.utils.LegacySpringUtils; import org.apache.commons.beanutils.BeanUtils; import org.apache.struts.action.ActionForm; import org.apache.struts.action.ActionForward; import org.apache.struts.action.ActionMapping; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.util.List; public class UserDeleteAction extends DatabaseAction { public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { String username = BeanUtils.getProperty(form, "username"); String unitcode = BeanUtils.getProperty(form, "unitcode"); String nhsno = BeanUtils.getProperty(form, "nhsno"); List<UserMapping> userMappings = LegacySpringUtils.getUserManager().getUserMappingsExcludeUnitcode(username, UnitUtils.PATIENT_ENTERS_UNITCODE); PatientLogon patient = new PatientLogon(); Unit unit = UnitUtils.retrieveUnit(unitcode); if (userMappings.size() != 0) { patient.setUsername(username); patient.setNhsno(nhsno); User user = LegacySpringUtils.getUserManager().get(username); patient.setName(user.getName()); } if (userMappings.size() <= 1) { deleteUserMapping(username, unitcode); deleteUserMapping(username + "-GP", unitcode); deleteUserMapping(username, UnitUtils.PATIENT_ENTERS_UNITCODE); deleteUser(username); deleteUser(username + "-GP"); } else { deleteUserMapping(username, unitcode); deleteUserMapping(username + "-GP", unitcode); } // TODO check whether remove patient should only remove user or remove data too //if ("patient".equals(patient.getRole())) { // UserUtils.removePatientFromSystem(patient.getUsername(), patient.getUnitcode()); //} AddLog.addLog(LegacySpringUtils.getSecurityUserManager().getLoggedInUsername(), AddLog.PATIENT_DELETE, username, nhsno, unitcode, ""); String mappingToFind = "success"; request.setAttribute("units", LegacySpringUtils.getUnitManager().getAll(false)); request.setAttribute("patient", patient); request.setAttribute("unit", unit); return mapping.findForward(mappingToFind); } private void deleteUserMapping(String username, String unitcode) { LegacySpringUtils.getUserManager().deleteUserMappings(username, unitcode); } private void deleteUser(String username) { LegacySpringUtils.getUserManager().delete(username); } public String getIdentifier() { return null; } public String getDatabaseName() { return "patientview"; } }
[ "paul@solidstategroup.com" ]
paul@solidstategroup.com
23e94a29082015a1d40a91149e015f651aeb5cf6
456bc1d5ba9ddd9f2ca57f3614300d5decbc244b
/src/goncharov/task3/IFunction.java
efae64739a91c60e2031f77ec33c18926503147e
[]
no_license
tsragravorogh/KG2020_G21_Task3
18c35abae93e5402d423d10befdb6e7cd6140dfd
958f68aa9b11a285167d00873fd682ccef456e5e
refs/heads/master
2023-01-29T11:19:27.679367
2020-12-02T19:29:16
2020-12-02T19:29:16
308,751,246
0
0
null
null
null
null
UTF-8
Java
false
false
606
java
package goncharov.task3; import java.util.ArrayList; import java.util.List; public interface IFunction { /*Кроме x может потребоваться передача и других параметров, от которых зависит построение функции. Надо подумать и принять обоснованное решение о том, какие ещё параметры передавать на данном этапе*/ ArrayList<ArrayList<Double>> getRange(double xLeft, double xRight); double getValue(double x); int getVar(); }
[ "71145107+tsragravorogh@users.noreply.github.com" ]
71145107+tsragravorogh@users.noreply.github.com
71c5bf5f64c9a883f09327820ec99a473ef6675a
34ff872e5f9bc89255c0109aa3e60e8c9fbdb869
/dataCleaner/src/main/java/org/datacleaner/example/EmbeddedSample.java
f46289aa6f792dc621ae5d69331f62bad03b944d
[]
no_license
kylinsoong/data
abfcc5633c8341b478a06f5df0e3c5f2f95c1378
9b39e4872f10506b3c9ed97b3169295cb154bd83
refs/heads/master
2021-01-17T07:02:17.717856
2016-04-04T10:49:23
2016-04-04T10:49:23
11,713,447
0
5
null
null
null
null
UTF-8
Java
false
false
417
java
package org.datacleaner.example; import org.datacleaner.bootstrap.Bootstrap; import org.datacleaner.bootstrap.BootstrapOptions; import org.datacleaner.bootstrap.DefaultBootstrapOptions; public class EmbeddedSample { public static void main(String[] args) { BootstrapOptions bootstrapOptions = new DefaultBootstrapOptions(args); Bootstrap bootstrap = new Bootstrap(bootstrapOptions); bootstrap.run(); } }
[ "kylinsoong.1214@gmail.com" ]
kylinsoong.1214@gmail.com
ea8fc5090baa9dfbbe6d41fdcd443580db5acc75
2fe8f521b12387ebc88ff2aa672f0feb71c4ebe7
/src/test/java/com/mdb/demo/DemoApplicationTests.java
89ee930271f414fea48d8ccb58f644bc7e7a2934
[]
no_license
samubhai/spring-simple-aggregation
3f729cd3070510d6b47d5cc3d6bdb40dc79767a6
e8448fe33d058ee2b13d2770a201cab800d8538e
refs/heads/master
2020-11-25T09:35:45.149060
2019-12-17T10:34:06
2019-12-17T10:34:06
null
0
0
null
null
null
null
UTF-8
Java
false
false
202
java
package com.mdb.demo; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class DemoApplicationTests { @Test void contextLoads() { } }
[ "karan.srivastava@Karans-MacBook-Pro.local" ]
karan.srivastava@Karans-MacBook-Pro.local
88b10bf387c278c2acf759978b0d29a1de38c014
1261ac4599f468e74c0fad550ef0ca0f5b74992b
/maven-airline-webapp/src/main/java/com/airline/service/AirplaneServiceBean.java
55d919e88ea993fc71a15a42ef313c3a26f7a1b4
[]
no_license
kawgh1/multi-module-maven-airlines
59177eda155c9264be1fc283935a9da3ffb75166
5e27fc20e6fc68a47ddaf3d44259d6cdb0fbc3e2
refs/heads/master
2022-12-12T21:55:40.354711
2020-09-01T00:37:52
2020-09-01T00:37:52
291,852,314
0
0
null
null
null
null
UTF-8
Java
false
false
980
java
package com.airline.service; import java.util.List; import javax.ejb.LocalBean; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.TypedQuery; import com.airline.models.Airplane; /** * Session Bean implementation class AirplaneServiceBean */ @Stateless // @LocalBean replaces the need for this Bean to implement a local INTERFACE @LocalBean public class AirplaneServiceBean { /** * Default constructor. */ public AirplaneServiceBean() { // TODO Auto-generated constructor stub } @PersistenceContext(unitName = "airline") EntityManager em; public List<Airplane> getAirplanes() { // this query grabs everything from the Flight table reference and returns each row as a Flight object TypedQuery<Airplane> query = em.createQuery("SELECT a FROM Airplane a", Airplane.class); List<Airplane> results = query.getResultList(); return results; } }
[ "thrwwy216@tutanota.com" ]
thrwwy216@tutanota.com
bfaffa4229b5ab8b32f7edd799fa08220987e12b
b733c258761e7d91a7ef0e15ca0e01427618dc33
/cards/src/main/java/org/rnd/jmagic/cards/AvenFisher.java
efc7060eff878b4fe8689743266c2345e11107e0
[]
no_license
jmagicdev/jmagic
d43aa3d2288f46a5fa950152486235614c6783e6
40e573f8e6d1cf42603fd05928f42e7080ce0f0d
refs/heads/master
2021-01-20T06:57:51.007411
2014-10-22T03:03:34
2014-10-22T03:03:34
9,589,102
2
0
null
null
null
null
UTF-8
Java
false
false
862
java
package org.rnd.jmagic.cards; import static org.rnd.jmagic.Convenience.*; import org.rnd.jmagic.engine.*; import org.rnd.jmagic.engine.generators.*; @Name("Aven Fisher") @Types({Type.CREATURE}) @SubTypes({SubType.SOLDIER, SubType.BIRD}) @ManaCost("3U") @ColorIdentity({Color.BLUE}) public final class AvenFisher extends Card { public static final class DeadFish extends EventTriggeredAbility { public DeadFish(GameState state) { super(state, "When Aven Fisher dies, you may draw a card."); this.addPattern(whenThisDies()); this.addEffect(youMay(drawCards(You.instance(), 1, "Draw a card"), "You may draw a card.")); } } public AvenFisher(GameState state) { super(state); this.setPower(2); this.setToughness(2); this.addAbility(new org.rnd.jmagic.abilities.keywords.Flying(state)); this.addAbility(new DeadFish(state)); } }
[ "robyter@gmail" ]
robyter@gmail
0dd930761295a75fd29424f2e586bada4fafb27b
6ad79e90644fb2a697c6b8c17bbe9cff1846015c
/teacher_model/src/main/java/hanlonglin/com/teacher_model/teaApp/TeaApplication.java
1b359eb5042c5efdf9095aa5882e54f724be3f3f
[]
no_license
hanlonglinandroidstudys/ClassAssitant
9734104ee7a79d650510bd31552b49cf6fbb5f8a
0f32d6b345e9bd15c417efaca951408fc49119e2
refs/heads/master
2020-04-28T14:29:02.065034
2019-03-08T00:15:41
2019-03-08T00:15:41
175,340,260
0
1
null
null
null
null
UTF-8
Java
false
false
963
java
package hanlonglin.com.teacher_model.teaApp; import android.app.Application; import android.util.Log; import org.litepal.LitePalApplication; import org.litepal.crud.DataSupport; import java.util.List; import hanlonglin.com.common.AppData.CommonApplication; import hanlonglin.com.common.AppData.TeaData; import hanlonglin.com.common.database.model.Teacher; import hanlonglin.com.common.database.util.DBTool; import hanlonglin.com.common.database.util.PerferenceUtil; public class TeaApplication extends CommonApplication { @Override public void onCreate() { super.onCreate(); Log.e("TAG", "加载Teacher Application..."); if (PerferenceUtil.checkIsFirst(this)) DBTool.getInstance().mockData(); //模拟数据 int tid = 1; List<Teacher> teaList = DataSupport.where("tid=?", tid + "").find(Teacher.class); if (teaList.size() > 0) TeaData.loginer = teaList.get(0); } }
[ "1501295534@qq.com" ]
1501295534@qq.com
488dc90364ac698a02e2143edac61f4708be7390
9446033b0a3d3d366f74b0bd6cc922e7bcf3649c
/core/src/main/java/cn/gomro/mid/core/oss/samples/UploadSample.java
c80ff7b066e5b0bb8edb997cb194fb230b548dc5
[]
no_license
wffff/test1
6ba9cabfd9d28e9278d2be1c70e115f53b623476
07af0365846e6e38d7edbfdb7512b45faa9e92b9
refs/heads/master
2021-01-20T15:03:44.924283
2017-05-09T07:08:03
2017-05-09T07:08:03
90,711,377
0
0
null
null
null
null
UTF-8
Java
false
false
2,780
java
package cn.gomro.mid.core.oss.samples; import java.io.IOException; import com.aliyun.oss.ClientException; import com.aliyun.oss.OSSClient; import com.aliyun.oss.OSSException; import com.aliyun.oss.model.CompleteMultipartUploadResult; import com.aliyun.oss.model.UploadFileRequest; import com.aliyun.oss.model.UploadFileResult; /** * 断点续传上传用法示例 * */ public class UploadSample { private static String endpoint = "<endpoint, http://oss-cn-hangzhou.aliyuncs.com>"; private static String accessKeyId = "<accessKeyId>"; private static String accessKeySecret = "<accessKeySecret>"; private static String bucketName = "<bucketName>"; private static String key = "<downloadKey>"; private static String uploadFile = "<uploadFile>"; public static void main(String[] args) throws IOException { OSSClient ossClient = new OSSClient(endpoint, accessKeyId, accessKeySecret); try { UploadFileRequest uploadFileRequest = new UploadFileRequest(bucketName, key); // 待上传的本地文件 uploadFileRequest.setUploadFile(uploadFile); // 设置并发下载数,默认1 uploadFileRequest.setTaskNum(5); // 设置分片大小,默认100KB uploadFileRequest.setPartSize(1024 * 1024 * 1); // 开启断点续传,默认关闭 uploadFileRequest.setEnableCheckpoint(true); UploadFileResult uploadResult = ossClient.uploadFile(uploadFileRequest); CompleteMultipartUploadResult multipartUploadResult = uploadResult.getMultipartUploadResult(); System.out.println(multipartUploadResult.getETag()); } catch (OSSException oe) { System.out.println("Caught an OSSException, which means your request made it to OSS, " + "but was rejected with an error response for some reason."); System.out.println("Error Message: " + oe.getErrorCode()); System.out.println("Error Code: " + oe.getErrorCode()); System.out.println("Request ID: " + oe.getRequestId()); System.out.println("Host ID: " + oe.getHostId()); } catch (ClientException ce) { System.out.println("Caught an ClientException, which means the client encountered " + "a serious internal problem while trying to communicate with OSS, " + "such as not being able to access the network."); System.out.println("Error Message: " + ce.getMessage()); } catch (Throwable e) { e.printStackTrace(); } finally { ossClient.shutdown(); } } }
[ "562222030@qq.com" ]
562222030@qq.com
6f84ad488ead041da66ccd0687cb987dafb12cae
df3e77af62057492082edf437db16704fa3f1379
/app/src/main/java/com/example/cf/coolweather/fragment/ChooseFragment.java
260eb0bf005508f507fd3b6b3bd5687a4f061b5e
[ "Apache-2.0" ]
permissive
AndroidBoySC/coolweather
ed6f20e751a13cc8cdaebbfac21472acdfdb73b5
0bf67979dcae34b1eb48254925305f0862083e07
refs/heads/master
2020-12-02T19:43:10.914578
2017-07-12T08:27:50
2017-07-12T08:27:50
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,881
java
package com.example.cf.coolweather.fragment; import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.example.cf.coolweather.MainActivity; import com.example.cf.coolweather.R; import com.example.cf.coolweather.activity.WeatherActivity; import com.example.cf.coolweather.db.City; import com.example.cf.coolweather.db.County; import com.example.cf.coolweather.db.Province; import com.example.cf.coolweather.util.HttpUtil; import com.example.cf.coolweather.util.Utility; import org.litepal.crud.DataSupport; import java.io.IOException; import java.util.ArrayList; import java.util.List; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Response; /** * A simple {@link Fragment} subclass. */ public class ChooseFragment extends Fragment { public static final int LEVEL_PROVINCE = 0; public static final int LEVEL_CITY = 1; public static final int LEVEL_COUNTY = 2; private ProgressDialog mProgressDialog; private TextView titleText; private Button backButton; private ListView mListView; private ArrayAdapter<String> mArrayAdapter; private List<String> dataList = new ArrayList<>(); /** * 省列表 */ private List<Province> mProvinceList; /** * 市列表 */ private List<City> mCityList; /** * 县(区)列表 */ private List<County> mCountyList; /** * 选中的省份 */ private Province selectedProvince; /** * 选中的城市 */ private City selectedCity; /** * 当前选中的级别 */ private int currentLevel; public ChooseFragment() { // Required empty public constructor } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.choose_area,container,false); titleText = (TextView) view.findViewById(R.id.title_text); backButton = (Button) view.findViewById(R.id.back_button); mListView = (ListView) view.findViewById(R.id.list_view); mArrayAdapter = new ArrayAdapter<String>(getContext(),android.R.layout.simple_list_item_1,dataList); mListView.setAdapter(mArrayAdapter); return view; } @Override public void onActivityCreated(@Nullable Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long id) { if(currentLevel == LEVEL_PROVINCE){ selectedProvince = mProvinceList.get(position); queryCities(); }else if(currentLevel == LEVEL_CITY){ selectedCity = mCityList.get(position); queryCounties(); }else if (currentLevel == LEVEL_COUNTY){ String weatherId = mCountyList.get(position).getWeatherId(); if(getActivity() instanceof MainActivity){ Intent intent = new Intent(getActivity(), WeatherActivity.class); intent.putExtra("weather_id",weatherId); startActivity(intent); getActivity().finish(); }else if (getActivity() instanceof WeatherActivity){ WeatherActivity activity = (WeatherActivity) getActivity(); activity.mDrawerLayout.closeDrawers(); activity.mSwipeRefreshLayout.setRefreshing(true); activity.requestWeather(weatherId); } } } }); backButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if(currentLevel == LEVEL_COUNTY){ queryCities(); }else if(currentLevel == LEVEL_CITY){ queryProvinces(); } } }); queryProvinces(); } /** * 查询全国所有的省,优先从数据库查询,如果没有查询到再去服务器上查询 */ private void queryProvinces() { titleText.setText("中国"); backButton.setVisibility(View.GONE); mProvinceList = DataSupport.findAll(Province.class); if(mProvinceList.size() > 0){ dataList.clear(); for (Province province : mProvinceList){ dataList.add(province.getProvinceName()); } mArrayAdapter.notifyDataSetChanged(); mListView.setSelection(0); currentLevel = LEVEL_PROVINCE; }else { String address = "http://guolin.tech/api/china"; queryFromServer(address,"province"); } } /** * 根据传入的地址,从服务器上查询省市县数据 */ private void queryFromServer(String address, final String type) { showProgressDialog(); HttpUtil.sendOkHttpRequest(address, new Callback() { @Override public void onFailure(Call call, IOException e) { //通过runOnUiThread()方法回到主线程处理逻辑 getActivity().runOnUiThread(new Runnable() { @Override public void run() { closeProgressDialog(); Toast.makeText(getContext(),"加载失败",Toast.LENGTH_SHORT).show(); } }); } @Override public void onResponse(Call call, Response response) throws IOException { String responseText = response.body().string(); boolean result = false; if("province".equals(type)){ result = Utility.handleProvinceResponse(responseText); }else if("city".equals(type)){ result = Utility.handleCityResponse(responseText,selectedProvince.getId()); }else if ("county".equals(type)){ result = Utility.handleCountyResponse(responseText,selectedCity.getId()); } if(result){ getActivity().runOnUiThread(new Runnable() { @Override public void run() { closeProgressDialog(); if("province".equals(type)){ queryProvinces(); }else if ("city".equals(type)){ queryCities(); }else if ("county".equals(type)){ queryCounties(); } } }); } } }); } /** * 关闭进度对话框 */ private void closeProgressDialog() { if(mProgressDialog != null){ mProgressDialog.dismiss(); } } /** * 显示进度对话框 */ private void showProgressDialog() { if(mProgressDialog == null){ mProgressDialog = new ProgressDialog(getActivity()); mProgressDialog.setMessage("正在加载..."); mProgressDialog.setCanceledOnTouchOutside(false); } mProgressDialog.show(); } /** * 查询选中市内所有的县区,优先从数据库中查询,没有查到再去服务器上查询 */ private void queryCounties() { titleText.setText(selectedCity.getCityName()); backButton.setVisibility(View.VISIBLE); mCountyList = DataSupport.where("cityid = ?",String.valueOf(selectedCity.getId())).find(County.class); if(mCountyList.size() > 0){ dataList.clear(); for (County county : mCountyList){ dataList.add(county.getCountyName()); } mArrayAdapter.notifyDataSetChanged(); mListView.setSelection(0); currentLevel = LEVEL_COUNTY; }else { int provinceCode = selectedProvince.getProvinceCode(); int cityCode = selectedCity.getCityCode(); String address = "http://guolin.tech/api/china/"+provinceCode+"/"+cityCode; queryFromServer(address,"county"); } } /** * 查询选中省内所有的市,优先从数据库中查询,没有查到再去服务器上查询 */ private void queryCities() { titleText.setText(selectedProvince.getProvinceName()); backButton.setVisibility(View.VISIBLE); mCityList = DataSupport.where("provinceid = ?",String.valueOf(selectedProvince.getId())).find(City.class); if(mCityList.size() > 0){ dataList.clear(); for (City city : mCityList){ dataList.add(city.getCityName()); } mArrayAdapter.notifyDataSetChanged(); mListView.setSelection(0); currentLevel = LEVEL_CITY; }else { int provinceCode = selectedProvince.getProvinceCode(); String address = "http://guolin.tech/api/china/"+provinceCode; queryFromServer(address,"city"); } } }
[ "1620674599@qq.com" ]
1620674599@qq.com
029ee5b0f46415edfbde59755ecf9b6469107d36
21901b9fb89a024a72b622d5c4914e1dc115b030
/library/src/main/java/eu/darken/mvpbakery/base/package-info.java
a7b9e6480da3af4b2f048eae56c62e3cf9cccfa6
[ "MIT" ]
permissive
chrisnkisha/mvp-bakery
75d104be63e031e66ab2b4d1ddef08565304dc81
e2444da945e8fe7cd872deb997dba85edbeef205
refs/heads/master
2020-04-13T18:33:12.624154
2018-11-30T13:52:54
2018-11-30T13:52:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
81
java
@javax.annotation.ParametersAreNonnullByDefault package eu.darken.mvpbakery.base;
[ "darken@darken.eu" ]
darken@darken.eu
82c80e5e5832fe19e66d83e11da36e173325fb39
4cbcff88e1125679bd3d2a11b0e4e5b3250f5be8
/library/src/main/java/com/qiniu/android/storage/UploadData.java
d11473499cc1dd26ecd35d3434541acc015af462
[ "MIT" ]
permissive
qiniu/android-sdk
f157c8095a84fb344e54775e0b94ca55917b4bda
63e06c2b10d21ee243ab5653d173929f6316fe31
refs/heads/master
2023-08-18T15:44:43.148368
2023-08-07T07:01:32
2023-08-07T07:01:32
5,308,654
643
248
MIT
2023-08-07T07:01:34
2012-08-06T01:34:03
Java
UTF-8
Java
false
false
3,310
java
package com.qiniu.android.storage; import org.json.JSONObject; class UploadData { final long offset; final int size; final int index; String md5; String etag; private State state; private long uploadSize = 0; byte[] data; UploadData(long offset, int size, int index) { this.offset = offset; this.size = size; this.index = index; this.state = State.NeedToCheck; this.uploadSize = 0; } static UploadData dataFromJson(JSONObject jsonObject) throws Exception { if (jsonObject == null) { return null; } long offset = jsonObject.getLong("offset"); int size = jsonObject.getInt("size"); int index = jsonObject.getInt("index"); String etag = jsonObject.optString("etag"); State state = State.state(jsonObject.getInt("state")); String md5 = jsonObject.optString("md5"); UploadData uploadData = new UploadData(offset, size, index); uploadData.etag = etag; uploadData.md5 = md5; uploadData.state = state; uploadData.uploadSize = 0; return uploadData; } // 需要上传,但需要检测块信息是否有效 boolean needToUpload() { switch (state) { case NeedToCheck: case WaitToUpload: return true; default: return false; } } // 是否已经上传 boolean isUploaded() { return state == State.Complete; } State getState() { return state; } void updateState(State state) { switch (state) { case NeedToCheck: case WaitToUpload: case Uploading: uploadSize = 0; etag = null; break; case Complete: data = null; } this.state = state; } void setUploadSize(long uploadSize) { this.uploadSize = uploadSize; } long uploadSize() { return state == State.Complete ? size : uploadSize; } void clearUploadState() { etag = null; md5 = null; state = State.NeedToCheck; } void checkStateAndUpdate() { if ((state == State.WaitToUpload || state == State.Uploading) && data == null) { state = State.NeedToCheck; } } JSONObject toJsonObject() throws Exception { JSONObject jsonObject = new JSONObject(); jsonObject.putOpt("offset", offset); jsonObject.putOpt("size", size); jsonObject.putOpt("index", index); jsonObject.putOpt("etag", etag); jsonObject.putOpt("md5", md5); jsonObject.putOpt("state", state.intValue()); return jsonObject; } enum State { NeedToCheck, // 需要检测数据 WaitToUpload, // 等待上传 Uploading, // 正在上传 Complete; // 上传结束 private int intValue() { return this.ordinal(); } private static State state(int value) { State[] states = State.values(); if (value < 0 || value >= states.length) { return NeedToCheck; } else { return states[value]; } } } }
[ "yangsen@qiniu.com" ]
yangsen@qiniu.com
9455f502e19355b5da64d8357beea3bdf225ab15
cdb5cf444be923787b7837ca3acde454e2298402
/tx-components/tx-component-starter-task/src/main/java/com/tx/component/task/dao/TaskDetailDao.java
a8e8e1b95a7d0981fc53a323898bdf6c422d2610
[]
no_license
liyong2008/tx-parent
89b25c3dd8028f539d9409e3954521db8d35610a
7b7fcb530ea725175488796b397348c18a509a59
refs/heads/master
2020-04-22T10:00:20.136080
2019-02-01T04:20:25
2019-02-01T04:20:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,394
java
/* * 描 述: <描述> * 修 改 人: Administrator * 修改时间: 2017年11月2日 * <修改描述:> */ package com.tx.component.task.dao; import java.util.List; import java.util.Map; import com.tx.component.task.model.TaskDetail; import com.tx.core.mybatis.model.Order; import com.tx.core.paged.model.PagedList; /** * 任务详情持久层<br/> * <功能详细描述> * * @author Administrator * @version [版本号, 2017年11月2日] * @see [相关类/方法] * @since [产品/模块版本] */ public interface TaskDetailDao { /** * 查询TaskDetail实体 * auto generate * <功能详细描述> * @param condition * @return [参数说明] * * @return TaskDetail [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ //auto generate public TaskDetail find(TaskDetail condition); /** * 根据条件查询TaskDetail列表 * auto generate * <功能详细描述> * @param params * @return [参数说明] * * @return List<TaskDetail> [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ //auto generate public List<TaskDetail> queryList(Map<String, Object> params); /** * 根据指定查询条件以及排序列查询TaskDetail列表 * auto generate * <功能详细描述> * @param params * @param orderList * @return [参数说明] * * @return List<TaskDetail> [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ //auto generate public List<TaskDetail> queryList(Map<String, Object> params, List<Order> orderList); /** * 根据条件查询TaskDetail列表总数 * auto generated * <功能详细描述> * @param params * @return [参数说明] * * @return int [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ public int count(Map<String, Object> params); /** * 分页查询TaskDetail列表 * auto generate * <功能详细描述> * @param params * @param pageIndex * @param pageSize * @return [参数说明] * * @return PagedList<TaskDetail> [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ //auto generate public PagedList<TaskDetail> queryPagedList(Map<String, Object> params, int pageIndex, int pageSize); /** * 分页查询TaskDetail列表,传入排序字段 * auto generate * <功能详细描述> * @param params * @param pageIndex * @param pageSize * @param orderList * @return [参数说明] * * @return PagedList<TaskDetail> [返回类型说明] * @exception throws [异常类型] [异常说明] * @see [类、类#方法、类#成员] */ //auto generate public PagedList<TaskDetail> queryPagedList(Map<String, Object> params, int pageIndex, int pageSize, List<Order> orderList); }
[ "Administrator@PengQingyang" ]
Administrator@PengQingyang
3d322b7e0dc57963e77121f7d1c8cb26a091c8eb
2cbde8ecbd4bf1ea3baf9f5026cb2be25e76ce10
/flowChartDebugger.model/src-gen/flowChartDebugger/Decision.java
fe57711cd5a675012cfaab566def58c4b430518b
[]
no_license
musahmad/flowChartDebugger
648ad758b5fb6c0cd4bdb4d7fe4fc1ade81914f1
6c83ab963abdec9851c0542ef365aaefe7256932
refs/heads/master
2022-04-24T05:07:58.100130
2020-04-24T16:26:39
2020-04-24T16:26:39
258,558,771
0
0
null
null
null
null
UTF-8
Java
false
false
2,134
java
/** */ package flowChartDebugger; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Decision</b></em>'. * <!-- end-user-doc --> * * <p> * The following features are supported: * </p> * <ul> * <li>{@link flowChartDebugger.Decision#getIfTrue <em>If True</em>}</li> * <li>{@link flowChartDebugger.Decision#getIfFalse <em>If False</em>}</li> * </ul> * * @see flowChartDebugger.FlowChartDebuggerPackage#getDecision() * @model * @generated */ public interface Decision extends Step { /** * Returns the value of the '<em><b>If True</b></em>' reference. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>If True</em>' reference isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>If True</em>' reference. * @see #setIfTrue(Step) * @see flowChartDebugger.FlowChartDebuggerPackage#getDecision_IfTrue() * @model derived="true" * @generated */ Step getIfTrue(); /** * Sets the value of the '{@link flowChartDebugger.Decision#getIfTrue <em>If True</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>If True</em>' reference. * @see #getIfTrue() * @generated */ void setIfTrue(Step value); /** * Returns the value of the '<em><b>If False</b></em>' reference. * <!-- begin-user-doc --> * <p> * If the meaning of the '<em>If False</em>' reference isn't clear, * there really should be more of a description here... * </p> * <!-- end-user-doc --> * @return the value of the '<em>If False</em>' reference. * @see #setIfFalse(Step) * @see flowChartDebugger.FlowChartDebuggerPackage#getDecision_IfFalse() * @model derived="true" * @generated */ Step getIfFalse(); /** * Sets the value of the '{@link flowChartDebugger.Decision#getIfFalse <em>If False</em>}' reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @param value the new value of the '<em>If False</em>' reference. * @see #getIfFalse() * @generated */ void setIfFalse(Step value); } // Decision
[ "musahmad@hotmail.co.uk" ]
musahmad@hotmail.co.uk
6e54acec76379a9a997cda08738bee594f376940
4473046026ff215c6c9fbb6ecd1cad9b1f95a67e
/JavaAdvanced/JavaOOPAdvanced/DependencyInversionAndInterfaceSegregationPrinciples/BoatRacingSimulator/models/engines/SterndriveEngine.java
a6e5f5beb909611f07440ea3941ca57f8acaff93
[]
no_license
miroslavangelov/Java-Development
e105248d82dd0772902eeeefbeb2389919fec262
61fcc2fb8a5ae9f38647f85eb63f809e7d8df350
refs/heads/master
2022-12-12T04:27:27.932969
2019-12-08T12:38:36
2019-12-08T12:38:36
138,468,780
0
0
null
2022-11-24T08:50:00
2018-06-24T09:18:55
Java
UTF-8
Java
false
false
481
java
package JavaOOPAdvanced.DependencyInversionAndInterfaceSegregationPrinciples.BoatRacingSimulator.models.engines;; public class SterndriveEngine extends BaseEngine { private static final int MULTIPLIER = 7; public SterndriveEngine(String model, int horsepower, int displacement) { super(model, horsepower, displacement); } @Override public int calculateOutput() { return (super.getHorsepower() * MULTIPLIER) + super.getDisplacement(); } }
[ "miroslav@devision.com" ]
miroslav@devision.com
e5f1abec337345ad836cb82066ac99dd24d3b5ff
57a52845a280a908f7e0b44db69fc112d8530174
/src/main/java/com/joyner/hack/jvm/chapter8_stack_frame/DynamicDispatch.java
1b1437462df7adcfcebce184a9230e84ec4ff9b1
[]
no_license
Joyner-Lu/hack_on_jvm
97e6c29cdcdce6dfe7e57536e2a0a288eea30722
6ed7edd13aca08ccb122ca704c0c03fd08395c47
refs/heads/master
2020-04-16T22:24:43.654533
2019-05-10T10:04:39
2019-05-10T10:04:39
165,966,409
0
0
null
null
null
null
UTF-8
Java
false
false
758
java
package com.joyner.hack.jvm.chapter8_stack_frame; /** * 方法动态分派演示 * @author zzm */ public class DynamicDispatch { static abstract class Human { protected abstract void sayHello(); } static class Man extends Human { @Override protected void sayHello() { System.out.println("man say hello"); } } static class Woman extends Human { @Override protected void sayHello() { System.out.println("woman say hello"); } } public static void main(String[] args) { Human man = new Man(); Human woman = new Woman(); man.sayHello(); woman.sayHello(); man = new Woman(); man.sayHello(); } }
[ "623582960@qq.com" ]
623582960@qq.com
5c236d97d26748bfdf22cd03672702d79774284f
381e7e42961c61e4bd8ab09f70252ed0a4f8dbb5
/HackerRankCodeSprint/CountYourProgressionsACHighlyOptimized.java
417caa9a77b1c46d584951a35d0f26fc7c7905e1
[]
no_license
mindis/Algorithms-2
ca4ab02b7e9ea09ead4cacbed93ca48b1bf3308b
cb1c97f65e83df6632312ffb1eb3df448c5e1c76
refs/heads/master
2021-01-11T23:10:54.802372
2016-12-27T23:31:01
2016-12-27T23:31:01
78,555,238
1
0
null
2017-01-10T17:07:25
2017-01-10T17:07:25
null
UTF-8
Java
false
false
1,694
java
import java.io.*; import java.util.*; public class Solution { public static void main(String[] args) { /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */ /* [] 2 4 2 2, 4 2, 2 4, 2*/ /* * 2 [0][diff] 4 [1][diff] 6 [2][diff] 8 [3] [diff] 2 */ int mod = 1000000009; Scanner scan = new Scanner(System.in); int n = scan.nextInt(); // (prev, diff) -> count // (cur) -> only single element #count int[][] pd = new int[101][199]; int[] s = new int[101]; int[] list = new int[n]; int count = 1; for(int i = 0; i < n; i++){ list[i] = scan.nextInt(); } for(int i = 0; i < n; i++){ int cur = list[i]; for(int diff = -99; diff<= 99;diff++){ int pre = cur - diff; if(pre < 1 || pre > 100) continue; int diffT = diff+ 99; //update (pre->cur) diff, //update s ->cur int addon = pd[pre][diffT]+ s[pre]; if(addon>=mod) addon = addon - mod; pd[cur][diffT] = pd[cur][diffT] + addon; if(pd[cur][diffT]>=mod) pd[cur][diffT] = pd[cur][diffT]- mod; count = count + addon; if(count>=mod) count = count - mod; } s[cur]++; if(s[cur]>=mod) s[cur] = s[cur]- mod; count++; if(count>=mod) count = count- mod; } System.out.println(count); } }
[ "superchaoran@gmail.com" ]
superchaoran@gmail.com
a5c854040bac253bdc4b684ffa87687f19c1e009
1538b884d1ef706cddf5c275cdecd2a0b4e4e9f7
/worek/_embended-projects/dso/Logic140-master/Logic140Client/src/logic140/DDS140.java
ff87a3fcd4d21542d15de0c30fe1c051609ec483
[]
no_license
kannisko/avr_projects
0dad7ccee612da35dbb8569c8a13642114ee1509
73481bef96784b7426c410fcde54607f252b6889
refs/heads/master
2020-04-20T15:23:19.419593
2019-03-27T20:38:13
2019-03-27T20:38:13
168,927,626
0
0
null
null
null
null
UTF-8
Java
false
false
15,022
java
/* * Copyright (c) 2015, Andrey Petushkov * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * 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 HOLDER 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. */ package logic140; import java.io.IOException; import java.nio.ByteBuffer; import java.util.LinkedList; import java.util.List; import libUsb.UsbDevice; import libUsb.UsbDeviceFactory; /** * * @author Andrey Petushkov */ class DDS140 implements Runnable { private static final int BUFFER_SIZE = 0x20000; private static final int MAX_MEMORY = 10*1024*1024; // TODO base on configured heap maximum static int SAMPLES_PER_BUFFER = BUFFER_SIZE / 2; private final UsbDevice usb; private final Thread dataThread; private final Object lock = new Object(); private volatile State state; private IOException dataLoopException; private final List<Packet> freePool = new LinkedList<>(); private final List<Packet> busyPool = new LinkedList<>(); private Frequency curFrequency = Frequency.F_10M; private boolean isLogicAnalyzerMode; private Voltage ch1Voltage; private Voltage ch2Voltage; private enum State { INIT, GO, RUNNING, STOPPED, INTERRUPTED, FINISHED; } class Packet { private final ByteBuffer buf; private int trailingGapLength; Packet(ByteBuffer buf) { this.buf = buf; } ByteBuffer getBuffer() { return buf; } int getTrailingGapLength() { return trailingGapLength; } } enum Frequency { F_39k(0x1b, 39_000, "39k"), F_625k(0x18, 625_000, "625k"), F_10M(0x1c, 10_000_000, "10M"), F_80M(0x11, 80_000_000, "80M"), F_100M(0x10, 100_000_000, "100M"); private final byte val; private final int freq; private final String text; Frequency(int val, int freq, String text) { this.val = (byte)val; this.freq = freq; this.text = text; } public int getFrequency() { return freq; } private byte getCode() { return val; } public String getText() { return text; } } enum Voltage { //22,08 50mV //22,04 100mV //22,00 200mV //22,06 500mV //22,02 1V //22,02 2V //22,02 5V // //CH2 Voltage setting: //23,20 50mV //23,10 100mV //23,00 200mV //23,12 500mV //23,02 1V //23,02 2V //23,02 5V V_50m(0x08, 0x20, 50, "50mV"), V_100m(0x04, 0x10, 100, "100mV"), V_200m(0x00, 0x00, 200, "200mV"), V_500m(0x02, 0x12, 500, "500mV"), V_1(0x02, 0x02, 1000, "1V"), V_2(0x02, 0x02, 2000, "2V"), V_5(0x02, 0x02, 5000, "5V"); private final int ch1val; private final int ch2val; private final String name; private final int ref; Voltage(int ch1val, int ch2val, int ref, String name) { this.ch1val = ch1val; this.ch2val = ch2val; this.name = name; this.ref = ref; } public String getName() { return name; } } public DDS140() { usb = UsbDeviceFactory.createInstance(0xDC5D4E19_D8E4_4BE9L, 0x9D_CD_71_A0_5D_36_FA_CDL); dataThread = new Thread(this, "LogicAnalyzer"); dataThread.setPriority(7); } public void init() throws IOException { usb.open(); usb.controlRequest((byte) 0x76, (byte) 0xe8); // timers usb.controlRequest((byte) 0x77, (byte) 0x9b); // timers usb.controlRequest((byte) 0x78, (byte) 0xe8); // timers usb.controlRequest((byte) 0x79, (byte) 0x9b); // timers usb.controlRequest((byte) 0x63, (byte) 0x04); // usb.controlRequest((byte) 0x75, (byte) 0x00); // timers if (usb.controlRequest((byte) 0x34, (byte) 0x00) != (byte) 0x34) // throw new IOException("DD140 init failed"); if (usb.controlRequest((byte) 0x34, (byte) 0x00) != (byte) 0x34) // throw new IOException("DD140 init failed"); if (usb.controlRequest((byte) 0x7a, (byte) 0xfb) != (byte) 0x7a) // timers throw new IOException("DD140 init failed"); if (usb.controlRequest((byte) 0x7b, (byte) 0x8c) != (byte) 0x7b) // timers throw new IOException("DD140 init failed"); if (usb.controlRequest((byte) 0x7c, (byte) 0xff) != (byte) 0x7c) // timers throw new IOException("DD140 init failed"); if (usb.controlRequest((byte) 0x7d, (byte) 0xc4) != (byte) 0x7d) // timers throw new IOException("DD140 init failed"); if (usb.controlRequest((byte) 0x24, (byte) 0x10) != (byte) 0x24) // throw new IOException("DD140 init failed"); if (usb.controlRequest((byte) 0x94, (byte) 0x1c) != (byte) 0x94) // 10mhz throw new IOException("DD140 init failed"); if (usb.controlRequest((byte) 0x22, (byte) 0x00) != (byte) 0x00) // voltage ch1 throw new IOException("DD140 init failed"); if (usb.controlRequest((byte) 0x24, (byte) 0x18) != (byte) 0x24) // throw new IOException("DD140 init failed"); if (usb.controlRequest((byte) 0x23, (byte) 0x00) != (byte) 0x00) // voltage ch2 throw new IOException("DD140 init failed"); if (usb.controlRequest((byte) 0x24, (byte) 0x18) != (byte) 0x24) // throw new IOException("DD140 init failed"); if (usb.controlRequest((byte) 0x94, (byte) 0x1c) != (byte) 0x94) // 10mhz throw new IOException("DD140 init failed"); if (usb.controlRequest((byte) 0x24, (byte) 0x18) != (byte) 0x24) // enable ch1 & ch2 throw new IOException("DD140 init failed"); if (usb.controlRequest((byte) 0xe7, (byte) 0x00) != (byte) 0xe7) // throw new IOException("DD140 init failed"); state = State.INIT; dataThread.start(); } void setIsLogicAnalyzer(boolean isLogicAnalyzerMode) { this.isLogicAnalyzerMode = isLogicAnalyzerMode; } public void go() throws IOException { if (!(state == State.INIT || state == State.STOPPED)) return; if (state == State.INTERRUPTED) throw new IOException("Internal error: data thread was interrupted"); synchronized (lock) { state = State.GO; dataLoopException = null; lock.notifyAll(); while (state == State.GO) { try { lock.wait(); } catch (InterruptedException ex) { break; } } } } public void stop() { if (state != State.RUNNING) return; synchronized (lock) { state = State.STOPPED; lock.notifyAll(); freePool.addAll(busyPool); busyPool.clear(); } } public Packet getData() throws IOException { if (dataLoopException != null) throw dataLoopException; synchronized (lock) { while (state == State.RUNNING && busyPool.isEmpty()) try { lock.wait(); } catch (InterruptedException ex) { return null; } } if (dataLoopException != null) throw dataLoopException; return busyPool.isEmpty() ? null : busyPool.remove(0); } public void releaseDataBuffer(Packet packet) { freePool.add(packet); } void finish() { try { stop(); state = State.FINISHED; synchronized (lock) { lock.notifyAll(); } Thread.sleep(100); usb.close(); dataThread.join(); } catch (InterruptedException ignore) { } } void setFrequency(Frequency frequency) throws IOException { if (usb.controlRequest((byte) 0x94, (byte) frequency.getCode()) != (byte) 0x94) throw new IOException("DD140 set frequency failed"); curFrequency = frequency; } void setVoltage(Voltage ch1, Voltage ch2) throws IOException { ch1Voltage = ch1; ch2Voltage = ch2; if (usb.controlRequest((byte) 0x22, (byte) ch1Voltage.ch1val) != (byte) ch1Voltage.ch1val) throw new IOException("DDS140 set ch1 voltage failed"); if (usb.controlRequest((byte) 0x23, (byte) ch2Voltage.ch2val) != (byte) ch2Voltage.ch2val) throw new IOException("DDS140 set ch2 voltage failed"); } @Override public void run() { try { while (state != State.FINISHED) { try { synchronized (lock) { lock.wait(); } if (state == State.GO) { state = State.RUNNING; synchronized (lock) { lock.notifyAll(); } if (usb.controlRequest((byte) 0x34, isLogicAnalyzerMode ? (byte) 0x01 : (byte) 0x00) != (byte) 0x34) // throw new IOException("DD140 go failed"); if (usb.controlRequest((byte) 0x35, (byte) 0x00) != (byte) 0x35) // throw new IOException("DD140 go failed"); final long startTime = System.nanoTime(); long dataStartTime = 0; long dataReadyTime; long dataInTime; if (usb.controlRequest((byte) 0x33, (byte) 0x00) != (byte) 0x33) // throw new IOException("DD140 go failed"); boolean firstPacket = true; while (true) { waitFifoFull(); if (state != State.RUNNING) break; dataReadyTime = System.nanoTime(); Packet packet = getFreePacket(); usb.fillBuffer(packet.getBuffer()); dataInTime = System.nanoTime(); boolean isRunning = state == State.RUNNING; if (isRunning) { if (usb.controlRequest((byte) 0x33, (byte) 0x00) != (byte) 0x33) // throw new IOException("DD140 go failed"); } if (!isRunning) { releaseDataBuffer(packet); break; } if (firstPacket) { firstPacket = false; releaseDataBuffer(packet); } else { Main.addEvent(new Event(dataReadyTime-startTime, "data ready")); Main.addEvent(new Event(dataInTime-startTime, String.format("%d%% in/%d%% lost", (int)(65536e11/(dataInTime-dataStartTime))/curFrequency.getFrequency(), (int)((dataInTime-dataReadyTime)*100./(dataInTime-dataStartTime))))); packet.trailingGapLength = (int)((dataInTime-dataReadyTime)/1e9*curFrequency.getFrequency()); synchronized (lock) { busyPool.add(packet); lock.notifyAll(); } } dataStartTime = dataInTime; } } } catch (IOException ex) { dataLoopException = ex; } synchronized (lock) { if (state == State.RUNNING) state = State.STOPPED; } if (dataLoopException == null) { synchronized (lock) { lock.notifyAll(); } } else { stop(); } } // while } // try catch (InterruptedException ex) { state = State.INTERRUPTED; } } private void waitFifoFull() throws IOException { while (state == State.RUNNING && usb.controlRequest((byte)0x50, (byte)0x0) != 0x21) { try { Thread.sleep(1); } catch (InterruptedException ex) { throw new IOException("interrupted", ex); } } } private Packet getFreePacket() throws IOException { if (freePool.size() > 0) return freePool.remove(0); if (busyPool.size() * SAMPLES_PER_BUFFER > MAX_MEMORY) throw new IOException("Not enough memory: possible UI threading issue or machine is too slow"); return new Packet(ByteBuffer.allocateDirect(BUFFER_SIZE)); } }
[ "kannisko@gmail.com" ]
kannisko@gmail.com
1990911dd11386d3f67aab54e04940b58142561b
ee0a4d37cb07994d219dc3e0df34e44aa9994899
/plugins/com.isb.datamodeler.model.edit/src/com/isb/datamodeler/provider/IItemPropertyDescriptorProvider.java
bab02f156b720f090ed2376c1c9040055655fd64
[]
no_license
bks-foss/DataModeler
736b375a50102afe58730cd0ebe58dfcdbf7da58
e4593ab33de357972a46cb32745fb98b7e70b996
refs/heads/master
2021-01-10T20:35:16.556242
2013-06-19T21:00:00
2013-06-19T21:00:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
702
java
package com.isb.datamodeler.provider; import org.eclipse.emf.common.notify.AdapterFactory; import org.eclipse.emf.common.util.ResourceLocator; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.edit.provider.ItemPropertyDescriptor; public interface IItemPropertyDescriptorProvider { public ItemPropertyDescriptor createItemPropertyDescriptor(AdapterFactory adapterFactory, ResourceLocator resourceLocator, String displayName, String description, EStructuralFeature feature, boolean isSettable, boolean multiLine, boolean sortChoices, Object staticImage, String category, String [] filterFlags); }
[ "rvinasav@isban.es" ]
rvinasav@isban.es
cff58ef6e8758e71e10c5da61da20495d4f9610e
398d3182a532a7ab428ef8b0a5321143695aaf32
/src/test/java/base/BaseClass.java
44028011fc42cdb301a087dc251215c8082b4968
[]
no_license
amanbrar0912/E2EzeroBankingProjectFinal
01a5c164854a26d489cc6290336e672332855527
49360b61b6babbde6f5468ee87dcea424ccf5e50
refs/heads/master
2022-12-17T17:58:56.987206
2020-09-26T14:11:34
2020-09-26T14:11:34
295,010,491
1
1
null
null
null
null
UTF-8
Java
false
false
2,407
java
package base; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; import java.util.concurrent.TimeUnit; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; import com.relevantcodes.extentreports.ExtentReports; import com.relevantcodes.extentreports.ExtentTest; import pageClasses.AccountSummaryPage; public class BaseClass { public static WebDriver driver; public ExtentReports report = ExtentManager.getInstance(); public static ExtentTest test; public Logger log = LogManager.getLogger(BaseClass.class.getName()); Properties prop; AccountSummaryPage asp; @BeforeTest public WebDriver initializeDriver() throws IOException { // log = LogManager.getLogger(this.getClass().getName()); // log.info("I am creating the message."); log.debug("this is debug message"); // log.error("I am error message."); log.fatal("I am the fatal message"); prop = new Properties(); FileInputStream fis = new FileInputStream(".\\src\\test\\resources\\properties\\config.properties"); prop.load(fis); String browser = prop.getProperty("browser"); if (browser.equalsIgnoreCase("chrome")) { System.setProperty("webdriver.chrome.driver", "C:\\Drivers\\chromedriver.exe"); driver = new ChromeDriver(); } else if (browser.equalsIgnoreCase("firefox")) { // firefox code } else if (browser.equalsIgnoreCase("IE")) { // IE Code } driver.manage().window().maximize(); driver.get(prop.getProperty("testsiteURL")); driver.manage().timeouts().implicitlyWait(2, TimeUnit.SECONDS); // report.startTest(test); return driver; } @AfterTest public void tearDown() { if (driver != null) { driver.quit(); } // report.endTest(test); // report.flush(); } /* * public void getScreenShotPath(String testCaseName, WebDriver driver) throws * IOException { String dateName = new * SimpleDateFormat("yyyyMMddhhmmss").format(new Date()); TakesScreenshot ts = * (TakesScreenshot)driver; File source = ts.getScreenshotAs(OutputType.FILE); * String destinationFile = System.getProperty("user.dir")+ * "\\src\\test\\resources\\reports\\"+testCaseName+dateName+".png"; * FileUtils.copyFile(source, new File(destinationFile)); } */ }
[ "amanbrar.mca@gmail.com" ]
amanbrar.mca@gmail.com
f0324a22f9e855d92c36f526730efa82ec005c66
bcb9cc3f498b3803429d712c448f5ffa771eb306
/app/src/main/java/cn/itsite/suiliao/common/Constants.java
df5ee7c4f29bde44ac88a030c95ad0a529a8b5f5
[]
no_license
leguang/SuiLiao
6200589e146514b0f6478338fb2afdf228cfa5ff
8338c1fe795e2f1e2c8e07a202d881ee8c971768
refs/heads/master
2021-09-03T00:46:52.971044
2018-01-04T09:52:26
2018-01-04T09:52:26
115,178,614
0
0
null
null
null
null
UTF-8
Java
false
false
466
java
package cn.itsite.suiliao.common; import cn.itsite.abase.common.BaseConstants; /** * Author:leguang on 2016/10/9 0009 15:49 * Email:langmanleguang@qq.com */ public class Constants extends BaseConstants { private final String TAG = this.getClass().getSimpleName(); /** * 不允许new */ private Constants() { throw new Error("Do not need instantiate!"); } public static final String KEY_POSITION = "key_position"; }
[ "langmanleguang@qq.com" ]
langmanleguang@qq.com
4eb76bc40d651d762fc32dad674548b12d9bc4b3
dd80dd6fdad8284ecdf5ae5319903c33df04271c
/app/src/androidTest/kotlin/com/amin/sample/utils/Utils.java
bfeaa054e491893dc278170dc07af9f5c582ee24
[]
no_license
jokomanza/Base-MVVM-Dagger
9d9b229707373073ab651c24a43fec180b635a2b
7838f8504b76e19cb8363735647fc83b6d1abb55
refs/heads/master
2022-11-16T15:34:16.783711
2020-07-06T10:26:18
2020-07-06T10:26:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,277
java
package com.amin.sample.utils; import android.view.View; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import androidx.test.espresso.matcher.BoundedMatcher; import org.hamcrest.Description; import org.hamcrest.Matcher; import static androidx.test.espresso.core.internal.deps.dagger.internal.Preconditions.checkNotNull; public class Utils { public static Matcher<View> atPosition(final int position, @NonNull final Matcher<View> itemMatcher) { checkNotNull(itemMatcher); return new BoundedMatcher<View, RecyclerView>(RecyclerView.class) { @Override public void describeTo(Description description) { description.appendText("has item at position " + position + ": "); itemMatcher.describeTo(description); } @Override protected boolean matchesSafely(final RecyclerView view) { RecyclerView.ViewHolder viewHolder = view.findViewHolderForAdapterPosition(position); if (viewHolder == null) { // has no item on such position return false; } return itemMatcher.matches(viewHolder.itemView); } }; } }
[ "aminkeshavarzian@gmail.com" ]
aminkeshavarzian@gmail.com
20fd915560830665983ca2374d1fdea656df0b5b
61f5da1ddfd72086778f64f3b2a1cf78f963ea88
/sources/net/usenet_client/tests/package-info.java
5483f351247198465801b3973f1266f7de80cd55
[]
no_license
GeneSchroer/usenet-client
51e62ebc98e478a4f5e5eb21dddd7a68c1a87d66
7b8a1a40a5f636b8f7dd0e744a4a7415387b9db6
refs/heads/master
2023-01-07T05:46:03.250131
2016-12-14T04:52:00
2016-12-14T04:52:00
310,102,818
0
0
null
null
null
null
UTF-8
Java
false
false
277
java
/** * Provides unit testing of the project for purposes of quality assurance * and functionality. * @author Gene Schroer * @author Maryia Maskaliova * @author Rimack Zelnick * @version %I% * @since 0.7.1 * @see net.usenet_client.utils * @see net.usenet_client.app */
[ "me@rzelnick.com" ]
me@rzelnick.com
f245518bf46bcae2a8686d4f404c9553f260d490
8462d3ea5c3b2caf1c0169b8bd997a163dd2148a
/src/chess/ChessPosition.java
c3385c6a5b559c774a9a0ab3291001d2312d3117
[]
no_license
EvaldoRibeiro/chess-system-java
39abdb2c39f5ca5d176878153e3d09e5bf98abfb
74485e5b960cd428b02c5700c73eacb22f5e3480
refs/heads/master
2022-11-26T00:41:03.262320
2020-07-29T17:51:49
2020-07-29T17:51:49
282,087,928
0
0
null
null
null
null
UTF-8
Java
false
false
772
java
package chess; import boardgame.Position; public class ChessPosition { private char column; private int row; public ChessPosition(char column, int row) { if (column < 'a' || column > 'h'|| row < 1 || row > 8) { throw new ChessException("Erro instanciando ChessPoistion. Valores valido sao de a1 a h8."); } this.column = column; this.row = row; } public char getColumn() { return column; } public int getRow() { return row; } protected Position toPosition() { return new Position(8 - row, column - 'a'); } protected static ChessPosition fromPosition(Position position) { return new ChessPosition((char)('a' + position.getColumn()), 8 - position.getRow()); } @Override public String toString() { return "" + column + row; } }
[ "evardis@gmail.com" ]
evardis@gmail.com
756f17280a4241f4805418a5c7bb76ea2cd73756
79a6cd39cbdcf03b67824863bf41ab10895049d3
/org.xtext.dsl.restaurante.parent/org.xtext.dsl.restaurante.ui/src/org/xtext/dsl/restaurante/ui/RestauranteOutlineTransformer.java
7959878deafe382e97564f3b4bb45a029a94555d
[ "MIT" ]
permissive
vicegd/org.xtext.dsl.restaurante
228a4f6168c93b12ae13200d21a8393dd0a552bd
8a0d5d09193e478051c54d8779f8fcb83f9a0d74
refs/heads/master
2021-07-14T23:20:33.036586
2017-10-21T08:59:38
2017-10-21T08:59:38
107,642,453
1
1
null
null
null
null
ISO-8859-1
Java
false
false
6,437
java
package org.xtext.dsl.restaurante.ui; import java.util.ArrayList; import java.util.List; import org.eclipse.emf.ecore.EAttribute; import org.eclipse.emf.ecore.EObject; import org.eclipse.xtext.ui.editor.outline.IOutlineNode; import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider; import org.xtext.dsl.restaurante.restaurante.Ingrediente; import org.xtext.dsl.restaurante.restaurante.Menu; import org.xtext.dsl.restaurante.restaurante.Postre; import org.xtext.dsl.restaurante.restaurante.Principal; import org.xtext.dsl.restaurante.restaurante.Producto; import org.xtext.dsl.restaurante.restaurante.ProductoO; import org.xtext.dsl.restaurante.restaurante.ProductoY; import org.xtext.dsl.restaurante.restaurante.Restaurante; import org.xtext.dsl.restaurante.restaurante.impl.RestaurantePackageImpl; public class RestauranteOutlineTransformer extends DefaultOutlineTreeProvider { @Override protected void createNode(IOutlineNode parentNode, EObject modelElement) { if (modelElement instanceof Restaurante) { createEObjectNode(parentNode, modelElement); //Se mete a Restaurante debajo de la raiz } else if (modelElement instanceof Ingrediente) { createEObjectNode(parentNode, modelElement); //Se mete al Ingrediente debajo de Restaurante int posicion = parentNode.getChildren().size()-1; //posición del elemento modelElement en el árbol de objetos IOutlineNode IOutlineNode nodoActual = parentNode.getChildren().get(posicion); //se obtiene el nodo de dicha posición (el nodo correspondiente al Ingrediente) Ingrediente i = (Ingrediente)modelElement; //EAttribute a = EcoreFactory.eINSTANCE.createEAttribute(); //FALLA AL HACER LA REFERENCIA EAttribute aNombre = RestaurantePackageImpl.eINSTANCE.getIngrediente_Nombre(); aNombre.setDefaultValue(i.getNombre()); createEObjectNode(nodoActual, aNombre); if (i.getInfoURL() != null) { EAttribute aURL = RestaurantePackageImpl.eINSTANCE.getIngrediente_InfoURL(); aURL.setDefaultValue(i.getInfoURL()); createEObjectNode(nodoActual, aURL); } if (i.getFoto() != null) { EAttribute aFoto = RestaurantePackageImpl.eINSTANCE.getIngrediente_Foto(); aFoto.setDefaultValue(i.getFoto()); createEObjectNode(nodoActual, aFoto); } EAttribute aAlergenico = RestaurantePackageImpl.eINSTANCE.getIngrediente_Alergenico(); aAlergenico.setDefaultValue(i.isAlergenico()?true:false); createEObjectNode(nodoActual, aAlergenico); } else if (modelElement instanceof Producto) { createEObjectNode(parentNode, modelElement); //Se mete al Producto debajo de Restaurante int posicion = parentNode.getChildren().size()-1; //posición del elemento modelElement en el árbol de objetos IOutlineNode IOutlineNode nodoActual = parentNode.getChildren().get(posicion); //se obtiene el nodo de dicha posición (el nodo correspondiente al Producto) Producto pr = (Producto)modelElement; if (((Producto)modelElement).getNutricional() != null) { //información nutricional de todos los productos createEObjectNode(nodoActual, pr.getNutricional()); int posicionNutricional = nodoActual.getChildren().size()-1; //posición del elemento modelElement en el árbol de objetos IOutlineNode IOutlineNode nodoNutricional = nodoActual.getChildren().get(posicionNutricional); //se obtiene el nodo de dicha posición (el nodo correspondiente a la información Nutricional) EAttribute aEnergia = RestaurantePackageImpl.eINSTANCE.getNutricional_Energia(); aEnergia.setDefaultValue(pr.getNutricional().getEnergia()); createEObjectNode(nodoNutricional, aEnergia); EAttribute aGrasas = RestaurantePackageImpl.eINSTANCE.getNutricional_Grasas(); aGrasas.setDefaultValue(pr.getNutricional().getGrasas()); createEObjectNode(nodoNutricional, aGrasas); EAttribute aHidratos = RestaurantePackageImpl.eINSTANCE.getNutricional_Hidratos(); aHidratos.setDefaultValue(pr.getNutricional().getHidratos()); createEObjectNode(nodoNutricional, aHidratos); EAttribute aProteinas = RestaurantePackageImpl.eINSTANCE.getNutricional_Proteinas(); aProteinas.setDefaultValue(pr.getNutricional().getProteinas()); createEObjectNode(nodoNutricional, aProteinas); EAttribute aSal = RestaurantePackageImpl.eINSTANCE.getNutricional_Sal(); aSal.setDefaultValue(pr.getNutricional().getSal()); createEObjectNode(nodoNutricional, aSal); } if (modelElement instanceof Principal){ //Si es Principal queremos introducir también los ingredientes Principal p = (Principal)modelElement; for (Ingrediente i : p.getIngredientes()){ createEObjectNode(nodoActual, i); } EAttribute aSalsa = RestaurantePackageImpl.eINSTANCE.getPrincipal_Salsa(); aSalsa.setDefaultValue(p.getSalsa()); createEObjectNode(nodoActual, aSalsa); } if (modelElement instanceof Postre){ //Si es Postre queremos introducir también los ingredientes Postre p = (Postre)modelElement; for (Ingrediente i : p.getIngredientes()){ createEObjectNode(nodoActual, i); } } } else if (modelElement instanceof Menu) { createEObjectNode(parentNode, modelElement); //Se mete al Menú debajo de Restaurante int posicion = parentNode.getChildren().size()-1; //posición del elemento modelElement en el árbol de objetos IOutlineNode IOutlineNode nodoActual = parentNode.getChildren().get(posicion); //se obtiene el nodo de dicha posición (el nodo correspondiente al Menú) Menu m = (Menu)modelElement; //para la lista de productos incluidos dentro del menú if (m.getProductos() != null) { ProductoY py = m.getProductos(); for (Producto p : obtenerListadaDeProductos(py)){ createEObjectNode(nodoActual, p); //Se introduce cada producto que cuelga del menú } } } } List<Producto> obtenerListadaDeProductos(ProductoY productoY){ List<Producto> resultado = new ArrayList<Producto>(); resultado.addAll(obtenerListadaDeProductosO(productoY.getIzq())); for (ProductoO prO : productoY.getDer()) { resultado.addAll(obtenerListadaDeProductosO(prO)); } return resultado; } List<Producto> obtenerListadaDeProductosO(ProductoO productoO){ List<Producto> resultado = new ArrayList<Producto>(); resultado.add(productoO.getIzq()); for (Producto pr : productoO.getDer()) { resultado.add(pr); } return resultado; } }
[ "vicegd@gmail.com" ]
vicegd@gmail.com
3111d6819d0df174289d361055c9ec8b1009368e
e74a0c134e99793cd4a7c7b4446a1377679b790f
/src/main/java/net/onima/onimafaction/plants/type/NetherWartFastPlant.java
53c2abe11c8848f4dbf0206c27e4e7f76d8c36eb
[]
no_license
ItsMeJules/OnimaFaction
e6afdcddd7ec0240bb8bec93e5f862b387814841
e6ea73ee730252040ca71378fe45622bd18e0cde
refs/heads/master
2022-04-14T14:47:21.610125
2020-04-03T20:10:42
2020-04-03T20:10:42
212,818,709
0
0
null
null
null
null
UTF-8
Java
false
false
752
java
package net.onima.onimafaction.plants.type; import org.bukkit.Location; import net.onima.onimaapi.utils.time.Time; import net.onima.onimafaction.plants.FastPlant; import net.onima.onimafaction.plants.PlantStage; import net.onima.onimafaction.plants.PlantType; public class NetherWartFastPlant extends FastPlant { public NetherWartFastPlant(Location plantLocation) { super(PlantType.NETHER_WART, plantLocation, 30 * Time.MINUTE); } @SuppressWarnings("deprecation") @Override public void initData() { initialData = plantLocation.getBlock().getData(); stage = PlantStage.fromOrdinal(PlantStage.NetherWartStage.SEEDED, initialData); harvestTime = (initialHarvestTime / stage.maxOrdinal()) * (stage.maxOrdinal() - stage.ordinal()); } }
[ "jules.prn06@gmail.com" ]
jules.prn06@gmail.com
1f9b4da3885b1625866f1f32df9f9013ecbcac79
baecf216f8c7a2f9762c1288256eb6227cece103
/src/model/Message.java
22cf78d0f7da15b6e3e13aa7325147f9af79891e
[]
no_license
ecuDickens/SENG6245_messenger
cc3064dee8ddfcf64234ec0207ada3256c424cb6
c1140675c1ac649acb370db5011aeb9fd496aa81
refs/heads/master
2021-01-01T03:40:34.820048
2016-04-28T12:53:51
2016-04-28T12:53:51
56,975,974
0
0
null
null
null
null
UTF-8
Java
false
false
3,828
java
package model; import model.enums.MessageTypeEnum; /** * Represents a message being sent from a client to the server or vice versa. * The text could represent different things depending on the message type. */ public class Message { // What type of message it is. private MessageTypeEnum type; // Who the message is from. private String sourceUser = ""; // Who the message is for (Could be null if a request to the server). private String targetUser = ""; // The relevant messsage. private String text = ""; public MessageTypeEnum getType() { return type; } public void setType(MessageTypeEnum type) { this.type = type; } public String getSourceUser() { return sourceUser; } public void setSourceUser(String sourceUser) { this.sourceUser = sourceUser; } public String getTargetUser() { return targetUser; } public void setTargetUser(String targetUser) { this.targetUser = targetUser; } public String getText() { return text; } public void setText(String text) { this.text = text; } public Message withType(final MessageTypeEnum type) { setType(type); return this; } public Message withSourceUser(final String sourceUser) { setSourceUser(sourceUser); return this; } public Message withTargetUser(final String targetUser) { setTargetUser(targetUser); return this; } public Message withText(final String text) { setText(text); return this; } @Override public String toString() { return String.format("{'type':'%s','source_user':'%s','target_user':'%s','text':'%s'}", type, sourceUser, targetUser, text); } // Poor man's JSON deserializer... public static Message toMessage(final String string) { if (!string.startsWith("{'type':'")) { return null; } String[] tokens = string.replace("{'type':'", "").split("','source_user':'", 2); if (2 != tokens.length) { return null; // type is mandatory } final MessageTypeEnum type = MessageTypeEnum.from(tokens[0]); if (null == type) { return null; } final String sourceUserName; if (tokens[1].startsWith("','target_user':'")) { return null; // source user is mandatory } else { tokens = tokens[1].split("','target_user':'", 2); if (2 != tokens.length) { return null; } sourceUserName = tokens[0]; } // if target user might be empty. final String targetUserName; if (tokens[1].startsWith("','text':'")) { targetUserName = ""; tokens[1] = tokens[1].replace("','text':'", ""); } else { tokens = tokens[1].split("','text':'", 2); if (2 != tokens.length) { return null; } targetUserName = tokens[0]; } if (!tokens[1].endsWith("'}")) { return null; } final String text = tokens[1].substring(0, tokens[1].lastIndexOf("'}")); return new Message().withType(type) .withSourceUser(sourceUserName) .withTargetUser(targetUserName) .withText(text); } @Override public boolean equals(final Object obj) { if (obj instanceof Message) { final Message message = (Message) obj; return type == message.getType() && sourceUser.equals(message.getSourceUser()) && targetUser.equals(message.getTargetUser()) && text.equals(message.getText()); } return false; } }
[ "ndickens@bandwidth.com" ]
ndickens@bandwidth.com
b8b1dc8ae2d432ffab284fb465a9a4ab01f738fe
245a1d3415e26134dd32477b5f6483042324834c
/Workspace/Practiceprogram/src/nestedclasses/NestedClassExample_1.java
512154fa16e7802f164368cfd5f0ce23210fe3e6
[]
no_license
sagarshri/DemoRepo
93a7deff348e04973b465c95165f6c108dc45d1c
15888ffa30108e423d69b851b727fdf6af05b3e3
refs/heads/master
2020-04-28T05:02:16.721573
2019-03-20T06:07:23
2019-03-20T06:07:23
175,004,330
0
0
null
null
null
null
UTF-8
Java
false
false
437
java
package nestedclasses; // 1. Writing a class within another is allowed in Java. The class written within is called the nested class. // 2. Types of nested class : // Non static nested class // - Inner Class // - Method-local inner class // - Annonymous inner claas // Static nested Classes public class NestedClassExample_1 { class insideClass { public void method1() { } } }
[ "sagarshrivastava1989@gmail.com" ]
sagarshrivastava1989@gmail.com
5353b27cd72b937f4652501602af27d87cf8d639
ecaeda0f36ec693ce928f0f5a3f75953da0c69f2
/code/src/common/Person.java
bd28f69a1c5bf26a3d911f5e3c09bbe4e9e55d7b
[]
no_license
pascohen/TA-Java8
ee384f1979255efd61e80e59cd76560b1399c4a2
aaeea2f9775df57a699c1403e9dced334e3ba1c1
refs/heads/master
2021-01-02T22:30:56.125382
2013-11-22T13:59:25
2013-11-22T13:59:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
233
java
package common; /** * @author Przemyslaw Bielicki */ public interface Person { String getFirstName(); String getLastName(); int getAge(); Sex getSex(); public enum Sex { MALE, FEMALE } }
[ "przemyslaw.bielicki@amadeus.com" ]
przemyslaw.bielicki@amadeus.com
c907dc91c2223090795b09c778727bd5ba1fd762
aec5b9e53838b86438eb897331831743fbdf06ae
/app/src/main/java/com/pupu/rushui/widget/RulerView.java
9dfddc9cefcbbaea02087b092eb47eaa6d24cf72
[]
no_license
yanzuwu18/rushui
e5a649213b9987793917856789b58b0de9446a85
43fef05730fac8500aba92d21b9e6cd7be0dd8d4
refs/heads/master
2022-09-17T14:55:39.131139
2018-09-08T11:39:43
2018-09-08T11:39:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
12,927
java
package com.pupu.rushui.widget; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; import android.view.ViewConfiguration; import android.widget.Scroller; import com.pupu.rushui.R; import com.pupu.rushui.util.CommonUtil; import com.pupu.rushui.util.Logger; public class RulerView extends View { //from puLan:新增渐变颜色效果 int startColor = 0xff44fc76, endColor = 0xff0663f9;//起始和末端的颜色值 private int mMinVelocity; private Scroller mScroller; //Scroller是一个专门用于处理滚动效果的工具类 用mScroller记录/计算View滚动的位置,再重写View的computeScroll(),完成实际的滚动 private VelocityTracker mVelocityTracker; //主要用跟踪触摸屏事件(flinging事件和其他gestures手势事件)的速率。 private int mWidth; private int mHeight; private float mSelectorValue = 50.0f; // 未选择时 默认的值 滑动后表示当前中间指针正在指着的值 private float mMaxValue = 200; // 最大数值 private float mMinValue = 100.0f; //最小的数值 private float mPerValue = 1; //最小单位 如 1:表示 每2条刻度差为1. 0.1:表示 每2条刻度差为0.1 // 在demo中 身高mPerValue为1 体重mPerValue 为0.1 private float mLineSpaceWidth = 5; // 尺子刻度2条线之间的距离 private float mLineWidth = 4; // 尺子刻度的宽度 private float mLineMaxHeight = 420; // 尺子刻度分为3中不同的高度。 mLineMaxHeight表示最长的那根(也就是 10的倍数时的高度) private float mLineMidHeight = 30; // mLineMidHeight 表示中间的高度(也就是 5 15 25 等时的高度) private float mLineMinHeight = 17; // mLineMinHeight 表示最短的那个高度(也就是 1 2 3 4 等时的高度) private float mTextMarginTop = 10; //o private float mTextSize = 48; //尺子刻度下方数字 textsize private boolean mAlphaEnable = false; // 尺子 最左边 最后边是否需要透明 (透明效果更好点) private float mTextHeight; //尺子刻度下方数字 的高度 private Paint mTextPaint; // 尺子刻度下方数字( 也就是每隔10个出现的数值) paint private Paint mLinePaint; // 尺子刻度 paint private int mTotalLine; //共有多少条 刻度 private int mMaxOffset; //所有刻度 共有多长 private float mOffset; // 默认状态下,mSelectorValue所在的位置 位于尺子总刻度的位置 private int mLastX, mMove; private OnValueChangeListener mListener; // 滑动后数值回调 private int mLineColor = Color.GRAY; //刻度的颜色 private int mTextColor = Color.BLACK; //文字的颜色 public void setStartColor(int startColor) { this.startColor = startColor; invalidate(); } public void setEndColor(int endColor) { this.endColor = endColor; invalidate(); } public RulerView(Context context) { this(context, null); } public RulerView(Context context, AttributeSet attrs) { this(context, attrs, 0); } public RulerView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context, attrs); } protected void init(Context context, AttributeSet attrs) { Log.d("zkk---", "init"); mScroller = new Scroller(context); this.mLineSpaceWidth = myfloat(25.0F); this.mLineWidth = myfloat(2.0F); this.mLineMaxHeight = myfloat(100.0F); this.mLineMidHeight = myfloat(60.0F); this.mLineMinHeight = myfloat(40.0F); this.mTextHeight = myfloat(40.0F); final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RulerView); mAlphaEnable = typedArray.getBoolean(R.styleable.RulerView_alphaEnable, mAlphaEnable); mLineSpaceWidth = typedArray.getDimension(R.styleable.RulerView_lineSpaceWidth, mLineSpaceWidth); mLineWidth = typedArray.getDimension(R.styleable.RulerView_lineWidth, mLineWidth); mLineMaxHeight = typedArray.getDimension(R.styleable.RulerView_lineMaxHeight, mLineMaxHeight); mLineMidHeight = typedArray.getDimension(R.styleable.RulerView_lineMidHeight, mLineMidHeight); mLineMinHeight = typedArray.getDimension(R.styleable.RulerView_lineMinHeight, mLineMinHeight); mLineColor = typedArray.getColor(R.styleable.RulerView_lineColor, mLineColor); mTextSize = typedArray.getDimension(R.styleable.RulerView_textSize, mTextSize); mTextColor = typedArray.getColor(R.styleable.RulerView_textColor, mTextColor); mTextMarginTop = typedArray.getDimension(R.styleable.RulerView_textMarginTop, mTextMarginTop); mSelectorValue = typedArray.getFloat(R.styleable.RulerView_selectorValue, 0.0f); mMinValue = typedArray.getFloat(R.styleable.RulerView_minValue, 0.0f); mMaxValue = typedArray.getFloat(R.styleable.RulerView_maxValue, 100.0f); mPerValue = typedArray.getFloat(R.styleable.RulerView_perValue, 0.1f); mMinVelocity = ViewConfiguration.get(getContext()).getScaledMinimumFlingVelocity(); mTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mTextPaint.setTextSize(mTextSize); mTextPaint.setColor(mTextColor); mTextHeight = getFontHeight(mTextPaint); mLinePaint = new Paint(Paint.ANTI_ALIAS_FLAG); mLinePaint.setStrokeWidth(mLineWidth); mLinePaint.setColor(mLineColor); // setValue(1990, 1940, 2016, 1); } public static int myfloat(float paramFloat) { return (int) (0.5F + paramFloat * 1.0f); } private float getFontHeight(Paint paint) { Paint.FontMetrics fm = paint.getFontMetrics(); return fm.descent - fm.ascent; } /** * @param selectorValue 未选择时 默认的值 滑动后表示当前中间指针正在指着的值 * @param minValue 最大数值 * @param maxValue 最小的数值 * @param per 最小单位 如 1:表示 每2条刻度差为1. 0.1:表示 每2条刻度差为0.1 在demo中 身高mPerValue为1 体重mPerValue 为0.1 */ public void setValue(float selectorValue, float minValue, float maxValue, float per) { this.mSelectorValue = selectorValue; this.mMaxValue = maxValue; this.mMinValue = minValue; this.mPerValue = (int) (per * 10.0f); this.mTotalLine = ((int) ((mMaxValue * 10 - mMinValue * 10) / mPerValue)) + 1; mMaxOffset = (int) (-(mTotalLine - 1) * mLineSpaceWidth); mOffset = (mMinValue - mSelectorValue) / mPerValue * mLineSpaceWidth * 10; Log.d("zkk===", "mOffset-- " + mOffset + " =====mMaxOffset " + mMaxOffset + " mTotalLine " + mTotalLine); invalidate(); setVisibility(VISIBLE); } public void setOnValueChangeListener(OnValueChangeListener listener) { mListener = listener; } @Override protected void onSizeChanged(int w, int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); if (w > 0 && h > 0) { mWidth = w; mHeight = h; } } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); float left, height; String value; int alpha = 0; float scale; int srcPointX = mWidth / 2; for (int i = 0; i < mTotalLine; i++) { left = srcPointX + mOffset + i * mLineSpaceWidth; if (left < 0 || left > mWidth) { continue; // 先画默认值在正中间,左右各一半的view。 多余部分暂时不画(也就是从默认值在中间,画旁边左右的刻度线) } if (i % 10 == 0) { height = mLineMaxHeight; } else if (i % 5 == 0) { height = mLineMidHeight; } else { height = mLineMinHeight; } //from puLan:计算当前颜色值 float ratio = left / mWidth; int color = CommonUtil.getColor(startColor, endColor, ratio); mLinePaint.setColor(color); if (mAlphaEnable) { scale = 1 - Math.abs(left - srcPointX) / srcPointX; alpha = (int) (255 * scale * scale); mLinePaint.setAlpha(alpha); } canvas.drawLine(left, 0, left, height, mLinePaint); if (i % 10 == 0) { value = String.valueOf((int) (mMinValue + i * mPerValue / 10)); if (mAlphaEnable) { //from puLan:设置渐变色 mTextPaint.setColor(color); mTextPaint.setAlpha(alpha); } canvas.drawText(value, left - mTextPaint.measureText(value) / 2, height + mTextMarginTop + mTextHeight, mTextPaint); // 在为整数时,画 数值 } } } @Override public boolean onTouchEvent(MotionEvent event) { Log.d("zkk---", "onTouchEvent-"); int action = event.getAction(); int xPosition = (int) event.getX(); int yPosition = (int) event.getY(); if (mVelocityTracker == null) { mVelocityTracker = VelocityTracker.obtain(); } mVelocityTracker.addMovement(event); switch (action) { case MotionEvent.ACTION_DOWN: mScroller.forceFinished(true); mLastX = xPosition; mMove = 0; break; case MotionEvent.ACTION_MOVE: mMove = (mLastX - xPosition); changeMoveAndValue(); break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: countMoveEnd(); countVelocityTracker(); return false; default: break; } mLastX = xPosition; return true; } private void countVelocityTracker() { Log.d("zkk---", "countVelocityTracker-"); mVelocityTracker.computeCurrentVelocity(1000); //初始化速率的单位 float xVelocity = mVelocityTracker.getXVelocity(); //当前的速度 if (Math.abs(xVelocity) > mMinVelocity) { mScroller.fling(0, 0, (int) xVelocity, 0, Integer.MIN_VALUE, Integer.MAX_VALUE, 0, 0); } } /** * 滑动结束后,若是指针在2条刻度之间时,改变mOffset 让指针正好在刻度上。 */ private void countMoveEnd() { mOffset -= mMove; if (mOffset <= mMaxOffset) { mOffset = mMaxOffset; } else if (mOffset >= 0) { mOffset = 0; } mLastX = 0; mMove = 0; mSelectorValue = mMinValue + Math.round(Math.abs(mOffset) * 1.0f / mLineSpaceWidth) * mPerValue / 10.0f; mOffset = (mMinValue - mSelectorValue) * 10.0f / mPerValue * mLineSpaceWidth; notifyValueChange(); postInvalidate(); } /** * 滑动后的操作 */ private void changeMoveAndValue() { mOffset -= mMove; if (mOffset <= mMaxOffset) { mOffset = mMaxOffset; mMove = 0; mScroller.forceFinished(true); } else if (mOffset >= 0) { mOffset = 0; mMove = 0; mScroller.forceFinished(true); } mSelectorValue = mMinValue + Math.round(Math.abs(mOffset) * 1.0f / mLineSpaceWidth) * mPerValue / 10.0f; notifyValueChange(); postInvalidate(); } private void notifyValueChange() { if (null != mListener) { mListener.onValueChange(mSelectorValue); } } /** * 滑动后的回调 */ public interface OnValueChangeListener { void onValueChange(float value); } @Override public void computeScroll() { Log.d("zkk---", "computeScroll-"); super.computeScroll(); if (mScroller.computeScrollOffset()) { //mScroller.computeScrollOffset()返回 true表示滑动还没有结束 if (mScroller.getCurrX() == mScroller.getFinalX()) { countMoveEnd(); } else { int xPosition = mScroller.getCurrX(); mMove = (mLastX - xPosition); changeMoveAndValue(); mLastX = xPosition; } } } }
[ "pengguangpu@mi-ya.com.cn" ]
pengguangpu@mi-ya.com.cn
cf0dd170c89d99e25fc9bfff1bfd70179523b07b
c47e859672c04b66796294c8eddeb8063cd22a63
/src/main/java/com/cqqyd2014/wh/vol/addvol/ajax/action/AddVolAddTempBarcodeAction.java
1c161e5ad33f8a31a16b4f230404d8a69e5125d9
[]
no_license
cqqyd2014/bfkjs
8235462b1da4b04e100ce46b55cbd7c5272d364e
5613671d7cc9b946953bd4762747edbca3a836cb
refs/heads/master
2021-09-16T03:02:58.585473
2018-06-15T06:57:55
2018-06-15T06:57:55
111,646,029
0
0
null
null
null
null
UTF-8
Java
false
false
4,711
java
package com.cqqyd2014.wh.vol.addvol.ajax.action; import java.util.Map; import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.InterceptorRef; import org.apache.struts2.convention.annotation.Namespace; import org.apache.struts2.convention.annotation.ParentPackage; import org.apache.struts2.convention.annotation.Result; import org.hibernate.HibernateException; import org.hibernate.Session; import com.cqqyd2014.annotation.Authority; import com.cqqyd2014.common.action.UserLoginedAction; import com.cqqyd2014.hibernate.HibernateSessionFactory; @SuppressWarnings("serial") @ParentPackage("bfkjs-json-default") @Namespace("/wh") public class AddVolAddTempBarcodeAction extends UserLoginedAction { String barcode; String contract_id; public String getBarcode() { return barcode; } public void setBarcode(String barcode) { this.barcode = barcode; } public String getContract_id() { return contract_id; } public void setContract_id(String contract_id) { this.contract_id = contract_id; } private Map<String, Object> msg; public Map<String, Object> getMsg() { return msg; } public void setMsg(Map<String, Object> msg) { this.msg = msg; } @Action(value = "add_vol_add_temp_barcode", results = { @Result(type = "json", params = { "root", "msg" })}, interceptorRefs = { @InterceptorRef("defaultStack"), @InterceptorRef("authorityInterceptor") }) @Authority(module = "add_vol_add_temp_barcode", privilege = "[00020003]", error_url = "authority_ajax_error") @Override public String execute() { // TODO Auto-generated method stub super.execute(); sm.setAuth_success(true); Session session = HibernateSessionFactory.getSession(); try { com.cqqyd2014.util.message.IfMessage ir=com.cqqyd2014.wh.logic.GoodsLogic.if_available_checksn(barcode); if (ir.isIf_ok()==false) { throw new com.cqqyd2014.util.exception.AjaxSuccessMessageException(ir.getMessage()); } com.cqqyd2014.hibernate.dao.VGoodsDAO omdao=new com.cqqyd2014.hibernate.dao.VGoodsDAO(); com.cqqyd2014.hibernate.entities.VGoods vg=omdao.getEntityViewByBarcode(session, com_id, barcode) ; com.cqqyd2014.wh.model.Goods g=com.cqqyd2014.wh.logic.GoodsLogic.getModelFromEntity(vg); //需要仓库库房,普通库位的记录 java.util.ArrayList<String> whs=com.cqqyd2014.util.StringUtil.toArrayList("SUPPLY"); java.util.ArrayList<String> storages=com.cqqyd2014.util.StringUtil.toArrayList("DEFAUL"); ir=com.cqqyd2014.wh.logic.GoodsLogic.if_available_in_wh_storage(session, g, whs,null, storages,null); if (!ir.isIf_ok()){ //库位和库房不合要求 throw new com.cqqyd2014.util.exception.AjaxSuccessMessageException(ir.getMessage()); } @SuppressWarnings("unchecked") java.util.ArrayList<com.cqqyd2014.wh.model.Goods > odis = (java.util.ArrayList<com.cqqyd2014.wh.model.Goods>) session_http .get("temp_add_vol_barcode"); //4、本次入库不要重复录入 for (int i=0;i<odis.size();i++){ String old_sn=odis.get(i).getBarcode(); if (old_sn.equals(barcode)){ throw new com.cqqyd2014.util.exception.AjaxSuccessMessageException("不要重复录入该条码"); } } //com.cqqyd2014.hibernate.dao.GoodsDAO gdao=new com.cqqyd2014.hibernate.dao.GoodsDAO(); //com.cqqyd2014.hibernate.entities.Goods g=gdao.getSnItem(session, sn, com_id); String goodsId=g.getGoods_id(); //4、该商品是否在合同中 com.cqqyd2014.hibernate.dao.ContractDDAO cddao=new com.cqqyd2014.hibernate.dao.ContractDDAO(); com.cqqyd2014.hibernate.entities.ContractD cd=cddao.getObjectByGoodsId(session, com_id, contract_id, goodsId); if (cd==null){ throw new com.cqqyd2014.util.exception.AjaxSuccessMessageException("该商品不在合同中"); } odis.add(g); session_http.put("temp_add_vol_barcode", odis); sm.setO(odis); sm.setO2(odis.size()); sm.setSuccess(true); sm.setSound("picked_ok"); sm.setBody(barcode+"已经录入"); } catch (HibernateException e) { //if (null != tx) { // tx.rollback();// 撤销事务 //} System.out.println(e.getMessage()); e.printStackTrace(); sm.setSuccess(false); sm.setBody(e.getMessage()); sm.setSound("error"); } catch (com.cqqyd2014.util.exception.AjaxSuccessMessageException e){ sm.setSuccess(false); sm.setBody(e.getMessage()); sm.setSound("error"); } finally { HibernateSessionFactory.closeSession(); } sm.setSuccess(true); msg=sm.toMap(); return SUCCESS; } }
[ "cqqyd2014@hotmail.com" ]
cqqyd2014@hotmail.com
dedc28922ae862d845e3ddbe82b2ef960a513eef
d52ab012b10bab544769ade0e6e29126a8e3d403
/src/basics/Armstrong.java
df37bf14349c218c908b5a4f35ac52ddbfc4de89
[]
no_license
Aniruddha-Raje/javaBasics
dc2673aa56126b6aaffb6c4c1e618f790e2bac27
61898fd0fc5a6d18127a5c67fd3de5a17f4447b4
refs/heads/master
2021-01-23T16:28:27.203868
2019-01-08T03:40:41
2019-01-08T03:40:41
93,299,025
0
0
null
null
null
null
UTF-8
Java
false
false
1,024
java
package basics; /** * @author Aniruddha.Raje * */ public class Armstrong { public static void main(String[] args) { for(int i = 0 ; i < 10000000; i ++) { if(isAmstrong(i)) { System.out.println(i); } } } public static boolean isAmstrong(int number) { int power = (""+number).length(); int sum = 0; int temp = number; while (temp > 0) { int rem = temp % 10; int pow = 1; for(int i = 0; i< power; i++){ pow = pow * rem ; } sum += pow; temp = temp / 10; } return sum == number; } } /*class FindArmstrong { int temp, rem, sum; FindArmstrong() { sum = 0; }// constructor void displayArmstrong() { for (int i = 1; i <= 1000; i++) { temp = i; while (temp > 0) { rem = temp % 10; sum = sum + (rem * rem * rem); temp = temp / 10; } if (sum == i) { System.out.println("The Numremer " + i + " is Armstrong Number"); } sum = 0; } }// displayArmstrong } */
[ "aniruddha.raje@blazeclan.com" ]
aniruddha.raje@blazeclan.com
16d5d1e509dcce69d69d6c96e6b0e4274244d11e
6a7cd30d6fa06019a00476e53535bb45cb6b7f2a
/Accountica/src/my/project/ebanking/actions/WithdrawAccountConfirmAction.java
c474943b8e506769e82eef6418e8ff5605138e9a
[]
no_license
arif-mahmud/e-banking
83cc7b8536aec69cc69bb583658b9d1903abf92b
cb4aa983f79cb01abb9e3751f69313000cf2164b
refs/heads/master
2016-08-12T03:58:41.267996
2016-04-09T14:31:31
2016-04-09T14:31:31
55,846,141
0
1
null
null
null
null
UTF-8
Java
false
false
1,322
java
package my.project.ebanking.actions; import com.opensymphony.xwork2.ActionSupport; import my.project.ebanking.domains.LedgerAccount; import my.project.ebanking.services.LedgerAccountService; import my.project.ebanking.util.InsufficientFundsException; import my.project.ebanking.util.InvalidAccountException; public class WithdrawAccountConfirmAction extends ActionSupport{ private LedgerAccount ledgeraccount; private LedgerAccountService ledgerService; public WithdrawAccountConfirmAction() { super(); } public void setLedgerService(LedgerAccountService ledgerService) { this.ledgerService = ledgerService; } public LedgerAccount getLedgeraccount() { return ledgeraccount; } public void setLedgeraccount(LedgerAccount ledgeraccount) { this.ledgeraccount = ledgeraccount; } public String execute() throws Exception{ String msg =""; try{ ledgerService.withdraw(ledgeraccount, ledgeraccount.getWithdrawAmount()); return "success"; } catch (InvalidAccountException e) { msg = e.getIdentity().toString(); return "failure"; } catch (InsufficientFundsException e) { msg = e.getRequired().toString(); return "failure"; } catch(Exception e){ msg ="DB Insert error"; System.out.println("Exception"); e.printStackTrace(); return "failure"; } } }
[ "arif.cse93@gmail.com" ]
arif.cse93@gmail.com
577fbed9c608ddb70d5612f046db6ba1eb684788
f5d82e2443cd844fc2d66dec81dfc28219589a9b
/app/src/main/java/com/example/stefani/weddingplanner/Fragments/guestlist/GuestsListPresenter.java
12201280a494426eae7adef83f2402b4a9a4a5df
[]
no_license
Stefani237/Wedding-Planner
505ded214d6925f6bcb07bc841635ded8b080567
085f937ddaf9fe01312650dbc51219b84187a71f
refs/heads/master
2020-03-22T11:11:10.094879
2018-07-06T07:56:40
2018-07-06T07:56:40
139,953,777
2
0
null
null
null
null
UTF-8
Java
false
false
5,359
java
package com.example.stefani.weddingplanner.Fragments.guestlist; import android.util.Log; import com.example.stefani.weddingplanner.Fragments.guestDetails.GuestDetailsFragment; import com.example.stefani.weddingplanner.Net.ConnectionToFirebase; import com.example.stefani.weddingplanner.SMS.SmsSenderHelper; import com.example.stefani.weddingplanner.BasicClasses.Constants; import com.example.stefani.weddingplanner.BasicClasses.GuestClass; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.FirebaseDatabase; import java.util.ArrayList; import java.util.List; public class GuestsListPresenter implements IGuestsList.Presenter { private IGuestsList.View mView; private List<GuestClass> mGuestClassList; private SmsSenderHelper mSmsSenderHelper; public GuestsListPresenter(IGuestsList.View guestDetailsFragmentView) { mView = guestDetailsFragmentView; mGuestClassList = new ArrayList<>(); initializeViews(); mSmsSenderHelper = new SmsSenderHelper(mView.getViewContext()); getAllDetailsFromDB(); } private void getAllDetailsFromDB() { // reads guests list from DB ConnectionToFirebase.getInstance().getAllGuestDetailsFromDB(guestList -> { mGuestClassList = new ArrayList<>(guestList); mView.updateAdapterData(mGuestClassList); // update list view }); } @Override public void initializeViews() { mView.initializeViews(mGuestClassList); } @Override public void updateListAccordingSMS(String phoneNumber, Integer numberOfGuests) { // for correct message content for (GuestClass guest : mGuestClassList) { if (guest.getmPhone().equalsIgnoreCase(phoneNumber)) { // to read or write data from the database, you need an instance of DatabaseReference: DatabaseReference databaseReference = FirebaseDatabase.getInstance().getReferenceFromUrl(Constants.GUESTS_DB_URL); // update number of guest that are coming: databaseReference.child(guest.getmID()).child(Constants.GUEST_NUM).setValue("" + numberOfGuests); // update isComing to true or false: if (numberOfGuests > Constants.NOT_COMING_SMS_RESPONSE) // is coming databaseReference.child(guest.getmID()).child(Constants.GUEST_COMING).setValue("TRUE"); else if (numberOfGuests == Constants.NOT_COMING_SMS_RESPONSE) { // not coming databaseReference.child(guest.getmID()).child(Constants.GUEST_COMING).setValue("FALSE"); } return; } } } @Override public void wrongMessageFromGuest(String phoneNumber) { // we want to show the name of the guest that returned a bad SMS in the sms_error_message for (GuestClass guest : mGuestClassList) { if (guest.getmPhone().equalsIgnoreCase(phoneNumber)) { // if sender is on guests list, get his name mView.showWrongMessage("" + guest.getmFullName()); break; } } } @Override public void sendSMS() { if(mGuestClassList.size() > 0){ int res = mSmsSenderHelper.sendSMS(mGuestClassList); if (res == 0){ // not sent mView.toastSmsNotSent(); } else{ // sent mView.toastSmsSent(); } } else{ mView.toastEmptyList(); } /*int res = mSmsSenderHelper.sendSMS(mGuestClassList); if (res == 0){ // not sent mView.toastSmsNotSent(); } else{ // sent mView.toastSmsSent(); }*/ } @Override public void onItemSelected(int positionFilter) { // get filter selection ArrayList<GuestClass> filteredGuests; switch (positionFilter) { case 0: // All guests filteredGuests = new ArrayList<>(mGuestClassList); break; case 1: // arriving filteredGuests = filter("true"); break; case 2: // not arriving filteredGuests = filter("false"); break; default: filteredGuests = new ArrayList<>(mGuestClassList); } mView.updateAdapterData(filteredGuests); } private ArrayList<GuestClass> filter(String isArriving){ // create new list to show according to filter ArrayList<GuestClass> guestsList = new ArrayList<>(); for (GuestClass guest : mGuestClassList) { if (guest.ismIsComing().equalsIgnoreCase(isArriving)) { guestsList.add(guest); } } return guestsList; } @Override public void startGuestDetailFragment(GuestClass mGuest) { // move to GuestDetailsFragment GuestDetailsFragment guestsListFragment = new GuestDetailsFragment(); guestsListFragment.setGuestDetails(mGuest); mView.setNewFragment(guestsListFragment, guestsListFragment.getClass().toString()); } @Override public void removeGuest(String getmID) { FirebaseDatabase.getInstance().getReferenceFromUrl(Constants.GUESTS_DB_URL).child(getmID).removeValue(); // remove from Firebase. } }
[ "34422589+Stefani237@users.noreply.github.com" ]
34422589+Stefani237@users.noreply.github.com
94eb9ba3c6372aed33896b7c353478a413266a62
575055e5935e5a23527c2e813533a8c416f0cb22
/app/src/main/java/com/app/manikandanr/sampleclients/DataModels/StudentObjectALertData.java
204d97dbd1b0bbce029cb2640ba0913dd4c957ea
[]
no_license
DeveloperManis1224/Spark-Invention
c4416fc9c44b7e7871426df11f8f20058b6db9c4
a1b67a1e45c56acc22838e1942b00829de3fb9ba
refs/heads/master
2020-03-31T00:05:33.700884
2019-06-06T20:02:58
2019-06-06T20:02:58
151,725,253
3
0
null
null
null
null
UTF-8
Java
false
false
1,157
java
package com.app.manikandanr.sampleclients.DataModels; import java.util.ArrayList; public class StudentObjectALertData { private ArrayList<Students> students; private String message; private ArrayList<Marketing> marketings; private String status; public ArrayList<Students> getStudents () { return students; } public void setStudents (ArrayList<Students> students) { this.students = students; } public String getMessage () { return message; } public void setMessage (String message) { this.message = message; } public ArrayList<Marketing> getMarketings () { return marketings; } public void setMarketings (ArrayList<Marketing> marketings) { this.marketings = marketings; } public String getStatus () { return status; } public void setStatus (String status) { this.status = status; } @Override public String toString() { return "ClassPojo [students = "+students+", message = "+message+", marketings = "+marketings+", status = "+status+"]"; } }
[ "developer.manikandan2495@gmail.com" ]
developer.manikandan2495@gmail.com
cdf220b165b67839026a635b7b75ccb852f99d6a
b953e78471b9a10edc6cfab4469ccd643dce1dff
/Minesweeper/task/src/minesweeper/Free.java
6a59cd87a8960e955a8ae7d6306c4cc1720197e6
[ "MIT" ]
permissive
JohnFunkCode/Minesweeper
ccebeef0792453022f4ad4ac56e27f2b97bb4f67
487b4c9625240b9c2f8337f104751a03e6b8e855
refs/heads/main
2023-05-01T14:29:38.878947
2021-05-27T02:29:54
2021-05-27T02:29:54
350,932,830
0
0
null
null
null
null
UTF-8
Java
false
false
181
java
package minesweeper; public class Free extends Cell{ public Free(boolean debugMode){this.debugMode=debugMode;} public void draw(){ System.out.print('.'); } }
[ "email@johnfunk.com" ]
email@johnfunk.com
bcc85674fd4afe890ed54ad9c4ebd78dc0b0d6e1
339ecb95de3688d9f54eee49839a0b882377f1fd
/src/main/java/visitor/hitPopBumperVisitor.java
71be891634c4abdbf78868199e0ab28f86bbd47e
[]
no_license
cmaldonadoa/cc3002-pinball
efc6c139f5713696bac56c7922a022edc2e85a7f
f5bf490ad69cbf093c75a928d3cb7c99637c5319
refs/heads/master
2020-03-18T13:50:14.588619
2018-08-19T22:29:17
2018-08-19T22:29:17
134,812,493
0
0
null
null
null
null
UTF-8
Java
false
false
439
java
package visitor; import controller.Game; import logic.gameelements.bumper.PopBumper; /** * Adds the score of a hit {@link PopBumper} to the game. * * @author Cristobal Maldonado */ public class hitPopBumperVisitor implements Visitor { @Override public void visitGame(Game game) { int currentScore = game.getScore(); int score = new PopBumper().getScore(); game.setScore(currentScore + score); } }
[ "cristobal.maldonado@ing.uchile.cl" ]
cristobal.maldonado@ing.uchile.cl
93b8350fbac3cf9d310c36a7d11ba6784d3c26f1
4aaef9267497fdc2807404080b4b7bd6698ce456
/permission/src/test/java/com/guyue/permission/DeptTest.java
dd9f9bb4b8810b82fb93ba8d6e8a7a7d7d67c814
[]
no_license
gstsgy/springCloudTemplates
85a84f2874ee997097d2048197230ae9d769d91e
1a0d29ec2163b4a274609909f7caab54debea371
refs/heads/master
2023-01-24T11:32:50.844378
2020-12-08T11:25:18
2020-12-08T11:25:18
319,611,083
0
0
null
null
null
null
UTF-8
Java
false
false
1,834
java
package com.guyue.permission; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.guyue.permission.bean.db.DeptDO; import com.guyue.permission.mapper.DeptMapper; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; import java.util.List; /** * @ClassName DeptTest * @Description TODO * @Author guyue * @Date 2020/10/14 上午10:01 **/ @SpringBootTest//(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @RunWith(SpringRunner.class) public class DeptTest { @Autowired private DeptMapper deptMapper; @Test public void add(){ DeptDO deptDO = new DeptDO(); deptDO.setInsertId("admin"); deptDO.setUpdateId("admin"); deptDO.setName("测试2"); //deptDO.setParentId(); deptMapper.insert(deptDO); System.out.println(deptDO.getId()); } @Test public void update(){ DeptDO deptDO = deptMapper.selectById(2); deptDO.setParentId(1L); deptMapper.updateById(deptDO); System.out.println(deptDO.getId()); } @Test public void query(){ QueryWrapper<DeptDO> queryWrapper = new QueryWrapper(); queryWrapper.isNull("parent_Id").eq("effective",1); List<DeptDO> depts = deptMapper.selectList(queryWrapper); System.out.println(depts); } /*@Test public void add(){ DeptDO deptDO = new DeptDO(); deptDO.setInsertId("admin"); deptDO.setUpdateId("admin"); deptDO.setName("测试2"); //deptDO.setParentId(); deptMapper.insert(deptDO); System.out.println(deptDO.getId()); }*/ }
[ "hujj@suray.cn" ]
hujj@suray.cn
56cfceeb68903367eb1cc3470e23f838f1f4b5f0
ff443bad5681f9aa8868a2f4000406a1668d1da6
/groovy-psi/src/main/java/org/jetbrains/plugins/groovy/lang/psi/dataFlow/reachingDefs/DefinitionMap.java
8e16bf1d54711d21c8305bca627ca12667b4682c
[ "Apache-2.0" ]
permissive
consulo/consulo-groovy
db1b6108922e838b40c590ba33b495d2d7084d1d
f632985a683dfc6053f5602c50a23f619aca78cf
refs/heads/master
2023-09-03T19:47:57.655695
2023-09-02T11:02:52
2023-09-02T11:02:52
14,021,532
0
0
null
null
null
null
UTF-8
Java
false
false
2,417
java
/* * Copyright 2000-2012 JetBrains s.r.o. * * 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.jetbrains.plugins.groovy.lang.psi.dataFlow.reachingDefs; import consulo.util.collection.primitive.ints.*; import org.jetbrains.plugins.groovy.lang.psi.controlFlow.Instruction; import javax.annotation.Nullable; import java.util.function.Consumer; /** * @author peter */ public class DefinitionMap { private final IntObjectMap<IntSet> myMap = IntMaps.newIntObjectHashMap(); public void registerDef(Instruction varInsn, int varId) { IntSet defs = myMap.get(varId); if(defs == null) { myMap.put(varId, defs = IntSets.newHashSet()); } else { defs.clear(); } defs.add(varInsn.num()); } public void merge(DefinitionMap map2) { map2.myMap.forEach(new IntObjConsumer<IntSet>() { public void accept(int num, IntSet defs) { IntSet defs2 = myMap.get(num); if(defs2 == null) { defs2 = IntSets.newHashSet(defs.toArray()); myMap.put(num, defs2); } else { defs2.addAll(defs.toArray()); } } }); } public boolean eq(final DefinitionMap m2) { if(myMap.size() != m2.myMap.size()) { return false; } for(IntObjectMap.IntObjectEntry<IntSet> entry : myMap.entrySet()) { int num = entry.getKey(); IntSet defs1 = entry.getValue(); final IntSet defs2 = m2.myMap.get(num); if(!(defs2 != null && defs2.equals(defs1))) { return false; } } return true; } public void copyFrom(DefinitionMap map, int fromIndex, int toIndex) { IntSet defs = map.myMap.get(fromIndex); if(defs == null) { defs = IntSets.newHashSet(); } myMap.put(toIndex, defs); } @Nullable public int[] getDefinitions(int varId) { IntSet set = myMap.get(varId); return set == null ? null : set.toArray(); } public void forEachValue(Consumer<IntSet> procedure) { myMap.values().forEach(procedure); } }
[ "vistall.valeriy@gmail.com" ]
vistall.valeriy@gmail.com
741d5d6fad83df3f54e6bb5b8ca7b9ddeb84c929
32f5326e8fedc53491b60a02fe4a1f4ffc831f50
/app/src/main/java/com/floooh/myapplication/MainActivity.java
5e67198803c8052767766a7196e253b7468eaa7d
[]
no_license
jayanthtg/moviedb
3d90b5a4bdb077390141fe1547f2d4efa676a2dd
11fa608b9506d44b956d4cbefbdb036e99e6a6be
refs/heads/master
2020-04-23T14:59:53.517709
2019-02-18T09:07:22
2019-02-18T09:07:22
171,250,066
0
0
null
null
null
null
UTF-8
Java
false
false
2,079
java
package com.floooh.myapplication; import android.content.Intent; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.support.v7.widget.Toolbar; import android.view.View; import android.view.Menu; import android.view.MenuItem; import java.util.ArrayList; public class MainActivity extends AppCompatActivity { private RecyclerView mRecyclerView; private Adapter mAdapter = new Adapter(); private Cloud mCloud = new Cloud(); private DatabaseHandler mDatabaseHandler; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); mDatabaseHandler = new DatabaseHandler(this); mRecyclerView = findViewById(R.id.recyclerview); mRecyclerView.setLayoutManager(new LinearLayoutManager(this)); mRecyclerView.setAdapter(mAdapter); } @Override protected void onResume() { super.onResume(); ArrayList<Movie> movies = mDatabaseHandler.getMovies(); mAdapter.setMovies(movies); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_main, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { startActivity(new Intent(this, Search.class)); } return super.onOptionsItemSelected(item); } }
[ "jayanth.krishna33@gmail.com" ]
jayanth.krishna33@gmail.com
7d818047f1c0dfa90054d36dff6c2faea2952236
863acb02a064a0fc66811688a67ce3511f1b81af
/sources/com/flurry/sdk/C7386Gd.java
754c393270fbe72dff52e114281f81970552e57a
[ "MIT" ]
permissive
Game-Designing/Custom-Football-Game
98d33eb0c04ca2c48620aa4a763b91bc9c1b7915
47283462b2066ad5c53b3c901182e7ae62a34fc8
refs/heads/master
2020-08-04T00:02:04.876780
2019-10-06T06:55:08
2019-10-06T06:55:08
211,914,568
1
1
null
null
null
null
UTF-8
Java
false
false
2,404
java
package com.flurry.sdk; import java.io.ByteArrayOutputStream; import java.io.Closeable; import java.io.DataOutputStream; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Locale; /* renamed from: com.flurry.sdk.Gd */ public final class C7386Gd { /* renamed from: a */ private static SimpleDateFormat f14467a = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ", Locale.US); /* renamed from: b */ String f14468b; /* renamed from: c */ long f14469c; public C7386Gd(String str, long j) { this.f14468b = str; this.f14469c = j; } /* renamed from: a */ public final byte[] mo23824a() { Throwable th; DataOutputStream dataOutputStream = null; try { ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); DataOutputStream dataOutputStream2 = new DataOutputStream(byteArrayOutputStream); try { dataOutputStream2.writeLong(this.f14469c); dataOutputStream2.writeUTF(this.f14468b); dataOutputStream2.flush(); byte[] byteArray = byteArrayOutputStream.toByteArray(); C7354Ad.m16261a((Closeable) dataOutputStream2); return byteArray; } catch (IOException e) { dataOutputStream = dataOutputStream2; try { byte[] bArr = new byte[0]; C7354Ad.m16261a((Closeable) dataOutputStream); return bArr; } catch (Throwable th2) { dataOutputStream2 = dataOutputStream; th = th2; C7354Ad.m16261a((Closeable) dataOutputStream2); throw th; } } catch (Throwable th3) { th = th3; C7354Ad.m16261a((Closeable) dataOutputStream2); throw th; } } catch (IOException e2) { byte[] bArr2 = new byte[0]; C7354Ad.m16261a((Closeable) dataOutputStream); return bArr2; } } public final String toString() { StringBuilder sb = new StringBuilder(); sb.append(f14467a.format(Long.valueOf(this.f14469c))); sb.append(": "); sb.append(this.f14468b); sb.append("\n"); return sb.toString(); } }
[ "tusharchoudhary0003@gmail.com" ]
tusharchoudhary0003@gmail.com
1532d08bb3312a1f5dcacbdd81ed93f265e68c96
3aab2c3de2ead1c9f23aca9856a55f239c44cda9
/src/test/java/com/periodicals/dao/jdbc/PaymentsJdbcDAOTest.java
329f18c039ab0bbff2fec2b1ce3a0df9c5f479de
[]
no_license
waytodanny/PeriodicalsProcessRep
d116cbb99a5ee9b65f04aaf00ad6f2b7f9e6d6bb
f6c5db61bd32f15971dc78d3a01df72f52639175
refs/heads/master
2021-05-11T12:51:09.060112
2018-01-16T09:50:49
2018-01-16T09:50:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
8,182
java
//package com.periodicals.dao.jdbc; // //import com.periodicals.exceptions.DaoException; //import com.periodicals.dao.factories.JdbcDAOFactory; //import com.periodicals.entities.Payment; //import dbTestHelpers.InMemoryDbManager; //import org.apache.log4j.LogManager; //import org.apache.log4j.Logger; //import org.apache.log4j.xml.DOMConfigurator; //import org.junit.jupiter.api.*; // //import java.sql.Connection; //import java.sql.SQLException; //import java.util.ArrayList; //import java.util.List; // //import static org.junit.jupiter.api.Assertions.*; // //class PaymentsJdbcDAOTest { // private static final Long INSERTED_KEY = 1L; // private static final Long INVALID_PK = 111L; // private static InMemoryDbManager inmManager; // private static PaymentsJdbcDAO paymentsDao; // private static Payment // testPayment, nonExistingPayment, samePaymentFromDB, insertedPayment; // private static List<Integer> testPerIds; // private static Connection conn; // // private static Logger log = Logger.getLogger(PaymentsJdbcDAOTest.class.getSimpleName()); // // static { // new DOMConfigurator().doConfigure("src\\main\\resources\\log4j.xml", LogManager.getLoggerRepository()); // } // // @BeforeAll // static void BeforeAll() { // try { // inmManager = new InMemoryDbManager(); // inmManager.insertDefaultData(); // // testPerIds = new ArrayList<>(); // testPerIds.add(1); testPerIds.add(2); testPerIds.add(3); // testPayment = new Payment(2, 20.5); // testPayment.setPeriodicalsId(testPerIds); // // nonExistingPayment = new Payment(2, 12.6); // nonExistingPayment.setId(112L); // } catch (SQLException | IllegalArgumentException e) { // log.error(e.getMessage()); // fail(e.getMessage()); // } // } // // @AfterAll // static void AfterAll() { // inmManager = null; // paymentsDao = null; // testPayment = null; // nonExistingPayment = null; // insertedPayment = null; // } // // @BeforeEach // void setUp() { // try { // conn = inmManager.getConnection(); // paymentsDao = (PaymentsJdbcDAO) JdbcDAOFactory.getInstance().getPaymentsDao(); // insertedPayment = paymentsDao.getByKey(INSERTED_KEY); // insertedPayment.setPeriodicalsId(paymentsDao.getPaymentPeriodicals(insertedPayment.getId())); // } catch (DaoException e) { // log.error(e.getMessage()); // fail(e.getMessage()); // } // } // // @AfterEach // void tearDown() { // testPayment.setId(null); // samePaymentFromDB = null; // try { // conn.close(); // } catch (SQLException e) { // log.error(e.getMessage()); // fail(e.getMessage()); // } // } // // @Test // void addPayment() { // try { // paymentsDao.add(testPayment); // assertTrue(testPayment.getId() != 0); // // samePaymentFromDB = paymentsDao.getByKey(testPayment.getId()); // // assertNotNull(samePaymentFromDB); // // testPayment.setPaymentTime(samePaymentFromDB.getPaymentTime()); // assertEquals(samePaymentFromDB, testPayment); // // assertTrue(paymentsDao.delete(testPayment.getId())); // } catch (DaoException e) { // log.error(e.getMessage()); // fail(e.getMessage()); // } // } // // @Test // void addNullablePayment() { // Assertions.assertThrows(DaoException.class, () -> { // paymentsDao.add(null); // }); // } // // @Test // void addPaymentWithNonNullKey() { // Assertions.assertThrows(DaoException.class, () -> { // testPayment.setId(INSERTED_KEY); // paymentsDao.add(testPayment); // }); // } // // @Test // void addSamePaymentTwice() { // Assertions.assertThrows(DaoException.class, () -> { // paymentsDao.add(testPayment); // paymentsDao.add(testPayment); // }); // // try { // assertTrue(paymentsDao.delete(testPayment.getId())); // } catch (DaoException e) { // log.error(e.getMessage()); // fail(e.getMessage()); // } // } // // @Test // void getByValidPK() { // try { // samePaymentFromDB = paymentsDao.getByKey(insertedPayment.getId()); // // assertNotNull(samePaymentFromDB); // assertEquals(samePaymentFromDB, insertedPayment); // } catch (DaoException e) { // log.error(e.getMessage()); // fail(e.getMessage()); // } // } // // @Test // void getByInvalidPK() { // Assertions.assertThrows(DaoException.class, () -> { // paymentsDao.getByKey(INVALID_PK); // }); // } // // @Test // void getByNullableKey() { // Assertions.assertThrows(DaoException.class, () -> { // paymentsDao.getByKey(null); // }); // } // // @Test // void deleteExistingPayment() { // try { // paymentsDao.add(testPayment); // assertTrue(testPayment.getId() != 0); // // boolean deleted = paymentsDao.delete(testPayment.getId()); // assertTrue(deleted); // } catch (DaoException e) { // e.printStackTrace(); // } // // } // // @Test // void deleteNonExistingPayment() { // try { // assertFalse(paymentsDao.delete(nonExistingPayment.getId())); // } catch (DaoException e) { // log.error(e.getMessage()); // fail(e.getMessage()); // } // } // // @Test // void deleteNullablePayment() { // Assertions.assertThrows(DaoException.class, () -> { // paymentsDao.delete(null); // }); // } // // @Test // void deleteNotIdentifiedPayment() { // assertNull(testPayment.getId()); // Assertions.assertThrows(DaoException.class, () -> { // paymentsDao.delete(testPayment.getId()); // }); // } // // @Test // void getExistingPaymentPeriodicals(){ // try { // int expectedSize = 2; // List<Integer> resultList = paymentsDao.getPaymentPeriodicals(insertedPayment.getId()); // int resultSize = resultList.size(); // // assertEquals(expectedSize, resultSize); // } catch (DaoException e) { // log.error(e.getMessage()); // fail(e.getMessage()); // } // } // // @Test // void getNonExistingPaymentPeriodicals(){ // try { // int expectedSize = 0; // List<Integer> resultList = paymentsDao.getPaymentPeriodicals(testPayment.getId()); // int resultSize = resultList.size(); // // assertEquals(expectedSize, resultSize); // } catch (DaoException e) { // log.error(e.getMessage()); // fail(e.getMessage()); // } // } // // @Test // void getNullablePaymentPeriodicals(){ // Assertions.assertThrows(DaoException.class, () -> { // paymentsDao.getPaymentPeriodicals(null); // }); // } // // @Test // void deleteExistingPaymentPeriodicals(){ // System.out.println(); // } // // @Test // void addPaymentPeriodicals(){ // try { // paymentsDao.add(testPayment); // assertNotNull(testPayment.getId()); // // paymentsDao.addPaymentPeriodicals(testPayment); // List<Integer> resultIds = paymentsDao.getPaymentPeriodicals(testPayment.getId()); // // int expectedSize = testPerIds.size(); // int resultSize = resultIds.size(); // // assertEquals(expectedSize, resultSize); // assertEquals(testPerIds, resultIds); // // paymentsDao.deletePaymentPeriodicals(testPayment.getId()); // paymentsDao.delete(testPayment.getId()); // } catch (DaoException e) { // log.error(e.getMessage()); // fail(e.getMessage()); // } // } //}
[ "11webboy" ]
11webboy
af81c6df6790a4fa5fdcbcb7b61091b25647e8b1
905fce3b85805a628ef9382ccbf6ed70c4c3a90f
/Gestao De Inventario/src/pt/iade/gestaoInventario/models/dao/CategoriaDAO.java
336048bafb9cf64f32d3a145f7f7ede2b258a251
[]
no_license
29213/GestaoDeInventarios
7a3cc9b2a415ca0a6d26b7609c58d9f26a617ddb
29e44727c90283c52a01bd0b532c5a3e74f68e2b
refs/heads/master
2020-09-03T18:27:43.736713
2020-01-23T23:05:21
2020-01-23T23:05:21
219,532,939
0
0
null
null
null
null
ISO-8859-1
Java
false
false
3,754
java
package pt.iade.gestaoInventario.models.dao; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.logging.Level; import java.util.logging.Logger; import javafx.collections.FXCollections; import javafx.collections.ObservableList; import pt.iade.gestaoInventario.models.Categoria; // TODO: Auto-generated Javadoc /** * * <p>Esta classe perminte ter interação com a base de dados. * <p> Perminte: Inserir, alterar, remover, listar e buscar * * @author Renato Pitta Simões */ public class CategoriaDAO { /** * Inserir. * * @param categoria a categoria * @return verdadeiro, se for bem sucedido */ public boolean inserir(Categoria categoria) { String sql = "INSERT INTO categorias(descricao) VALUES(?)"; Connection connection = DBConnection.conectar(); try { PreparedStatement stmt = connection.prepareStatement(sql); stmt.setString(1, categoria.getDescricao()); stmt.execute(); return true; } catch (SQLException ex) { Logger.getLogger(CategoriaDAO.class.getName()).log(Level.SEVERE, null, ex); return false; } } /** * Alterar. * * @param categoria a categoria * @return verdadeiro, se for bem sucedido */ public boolean alterar(Categoria categoria) { String sql = "UPDATE categorias SET descricao=? WHERE idCategoria=?"; Connection connection = DBConnection.conectar(); try { PreparedStatement stmt = connection.prepareStatement(sql); stmt.setString(1, categoria.getDescricao()); stmt.setInt(2, categoria.getIdCategoria()); stmt.execute(); return true; } catch (SQLException ex) { Logger.getLogger(CategoriaDAO.class.getName()).log(Level.SEVERE, null, ex); return false; } } /** * Remover. * * @param categoria a categoria * @return verdadeiro, se for bem sucedido */ public boolean remover(Categoria categoria) { String sql = "DELETE FROM categorias WHERE idCategoria=?"; Connection connection = DBConnection.conectar(); try { PreparedStatement stmt = connection.prepareStatement(sql); stmt.setInt(1, categoria.getIdCategoria()); stmt.execute(); return true; } catch (SQLException ex) { Logger.getLogger(CategoriaDAO.class.getName()).log(Level.SEVERE, null, ex); return false; } } /** * Listar. * * @return a lista */ public ObservableList<Categoria> listar() { String sql = "SELECT * FROM categorias"; Connection connection = DBConnection.conectar(); ObservableList<Categoria> retorno = FXCollections.observableArrayList(); try { PreparedStatement stmt = connection.prepareStatement(sql); ResultSet resultado = stmt.executeQuery(); while (resultado.next()) { Categoria categoria = new Categoria(); categoria.setIdCategoria(resultado.getInt("idCategoria")); categoria.setDescricao(resultado.getString("descricao")); retorno.add(categoria); } } catch (SQLException ex) { Logger.getLogger(CategoriaDAO.class.getName()).log(Level.SEVERE, null, ex); } return retorno; } /** * Buscar. * * @param categoria a categoria * @return a categoria */ public Categoria buscar(Categoria categoria) { String sql = "SELECT * FROM categorias WHERE idCategoria=?"; Categoria retorno = new Categoria(); Connection connection = DBConnection.conectar(); try { PreparedStatement stmt = connection.prepareStatement(sql); stmt.setInt(1, categoria.getIdCategoria()); ResultSet resultado = stmt.executeQuery(); if (resultado.next()) { categoria.setDescricao(resultado.getString("descricao")); retorno = categoria; } } catch (SQLException ex) { Logger.getLogger(CategoriaDAO.class.getName()).log(Level.SEVERE, null, ex); } return retorno; } }
[ "50029213@iade.pt" ]
50029213@iade.pt
8e27e70aca845cab1da64bcad1864a31abc78dd7
dbcbbc5a9d002b6f2700b2965956d1862c212a93
/src/main/java/org/apache/cocoon/servletscope/ServletScope.java
d94144bcd97502bff11c9936b5d83b9100c0dc54
[]
no_license
kailIII/dspace-cocoon-servlet-service-impl
eb847d5f818da1cd68abfe3811ec0212e34e9fc0
636fbfb1c3e658712e7e8c3dd96274aafafd2b9b
refs/heads/master
2021-01-16T17:52:05.395463
2011-10-13T09:35:12
2011-10-13T09:35:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,193
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.cocoon.servletscope; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import javax.servlet.ServletContext; import org.springframework.beans.factory.ObjectFactory; import org.springframework.beans.factory.config.Scope; /** * Stack based scope implementation. It is based on the CallStack and * an object is in scope when it is in the top frame of the stack. * * @version $Id: CallScope.java 562806 2007-08-05 02:26:41Z vgritsenko $ * @since 2.2 */ public class ServletScope implements Scope { static private String destructionCallbacksAttributeName = ServletScope.class.getName() + "/destructionCallbacks"; private ServletContext servletContext; public void setServletContext(ServletContext servletContext) { this.servletContext = servletContext; } /* (non-Javadoc) * @see org.springframework.beans.factory.config.Scope#get(java.lang.String, org.springframework.beans.factory.ObjectFactory) */ public Object get(String name, ObjectFactory objectFactory) { Object scopedObject = servletContext.getAttribute(name); if (scopedObject == null) { scopedObject = objectFactory.getObject(); servletContext.setAttribute(name, scopedObject); } return scopedObject; } /* (non-Javadoc) * @see org.springframework.beans.factory.config.Scope#remove(java.lang.String) */ public Object remove(String name) { Object scopedObject = servletContext.getAttribute(name); if (scopedObject != null) { servletContext.removeAttribute(name); } return scopedObject; } /* (non-Javadoc) * @see org.springframework.beans.factory.config.Scope#getConversationId() */ public String getConversationId() { // There is no conversation id concept for the call stack return null; } /* (non-Javadoc) * @see org.springframework.beans.factory.config.Scope#registerDestructionCallback(java.lang.String, java.lang.Runnable) */ public void registerDestructionCallback(String name, Runnable callback) { Map destructionCallbacks = getDestructionCallbacks(servletContext); destructionCallbacks.put(name, callback); } /** * @param servletContext * @return the destruction callbacks map that is stored as a attribute of servletContext */ private static Map getDestructionCallbacks(ServletContext servletContext) { Map destructionCallbacks = (Map)servletContext.getAttribute(destructionCallbacksAttributeName); if (destructionCallbacks == null) { destructionCallbacks = new HashMap(); servletContext.setAttribute(destructionCallbacksAttributeName, destructionCallbacks); } return destructionCallbacks; } /** * Executes destruction callbacks of beans from servlet scope. This method should be called once the Servlet that the scope * is tied to is being destroyed. * @param servletContext */ public static void executeDestructionCallbacks(ServletContext servletContext) { Map destructionCallbacks = getDestructionCallbacks(servletContext); Iterator i = destructionCallbacks.values().iterator(); while (i.hasNext()) { ((Runnable) i.next()).run(); } } }
[ "kim.shepherd@gmail.com" ]
kim.shepherd@gmail.com
d64dda99f8e0257d696fb3a445671ab139a6f3fe
52ce55f9843b8fb698c78424cd281eac03cc09f9
/Android-Mobile/PhoodBuddy-Android/app/src/main/java/com/phoodbuddy/phoodbuddy/Controllers/RecipeDetailController.java
b4628d3db71c3b87eeebdc757c08f2ce7eb42195
[]
no_license
WilliamRADFunk/phood-buddy
310a05c24a510c059974a0a7cae1f086e5024f97
1a6abad05439b472c6187e9a13f4cbac48a68493
refs/heads/master
2023-04-29T05:27:21.686970
2019-10-06T22:15:26
2019-10-06T22:15:26
50,206,053
1
1
null
2023-04-19T18:28:01
2016-01-22T20:35:03
Java
UTF-8
Java
false
false
2,049
java
package com.phoodbuddy.phoodbuddy.Controllers; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.ListView; import android.widget.TextView; import com.phoodbuddy.phoodbuddy.R; import java.util.ArrayList; import java.util.List; /** * Created by Evan Glazer on 3/15/2016. */ public class RecipeDetailController extends BaseAdapter { Context mContext; List<String> recipeList; LayoutInflater inflater; ViewHolder holder; public RecipeDetailController(Context c, List<String> data) { recipeList = new ArrayList<>(); mContext = c; recipeList = data; inflater = LayoutInflater.from(mContext); } @Override public int getCount() { return recipeList.size(); } @Override public String getItem(int position) { return recipeList.get(position); } @Override public long getItemId(int position) { return 0; } @Override public View getView(int position, View convertView, ViewGroup parent) { holder = new ViewHolder(); if(convertView == null) { convertView = inflater.inflate(R.layout.recipe_detail_child, null); holder.ingredient = (TextView) convertView.findViewById(R.id.ingredient_recipe); holder.step = (TextView) convertView.findViewById(R.id.steps_detail); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.step.setText("Step"+ " "+ (position+1)); holder.ingredient.setText(recipeList.get(position).toString()); //Picasso.with(mContext).load(mealsList.get(position).getImage()).into(holder.img); //holder.foodName.setText(mealsList.get(position).getName()); return convertView; } public class ViewHolder{ ListView ingredients; TextView ingredient; TextView step; } }
[ "evanowner@live.com" ]
evanowner@live.com
d46d658e279e3f62111c4f72771e0aadb81e637f
0ef4d25e4ad719b166260af2a4ee0fe53724ecd0
/ObjectOrientedDesign/src/carrentalsystem/model/Member.java
0c8b889891f7be4e487c4f3b7ac85cbd4e6f3cee
[]
no_license
js456/JavaPrep
254b6c61791ad13d8e566de25ccce42139872593
609aff9eee56dba6388437065a978f9ef110d372
refs/heads/main
2023-02-01T17:31:42.529132
2020-12-18T08:15:12
2020-12-18T08:15:12
322,531,339
0
0
null
null
null
null
UTF-8
Java
false
false
107
java
package carrentalsystem.model; public class Member { String drivingLicienceNumber; int memberId; }
[ "jitendra.saini@broadcom.com" ]
jitendra.saini@broadcom.com
1d41d1f7235c7c15476ad597d04c04e3543d3364
b3d0c1410360f7040145e6359f4519818530d500
/lib/src/main/java/com/ittianyu/relight/widget/native_/SwipeRefreshWidget.java
825c2b0a1495d97da3a7299715c6d41544f9f45e
[ "Apache-2.0" ]
permissive
squareBQ/relight
27a5c42fac4844a2aac3a72238425a09b5062e85
f028ba23a2f45b7b1b1c9c49e12eb5922af5980b
refs/heads/master
2020-04-15T16:13:48.170960
2019-01-05T09:09:07
2019-01-05T09:09:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,928
java
package com.ittianyu.relight.widget.native_; import android.arch.lifecycle.Lifecycle; import android.content.Context; import android.support.annotation.ColorInt; import android.support.annotation.ColorRes; import android.support.v4.widget.SwipeRefreshLayout; import com.ittianyu.relight.widget.Widget; public class SwipeRefreshWidget extends ViewGroupWidget<SwipeRefreshLayout, SwipeRefreshWidget> { private Boolean enabled; private Integer size; private Boolean refreshing; private int[] colorResIds; private int[] colors; private Integer distance; private SwipeRefreshLayout.OnRefreshListener listener; public SwipeRefreshWidget(Context context, Lifecycle lifecycle) { this(context, lifecycle, (Widget) null); } public SwipeRefreshWidget(Context context, Lifecycle lifecycle, Widget... children) { super(context, lifecycle, children); } @Override public SwipeRefreshLayout createView(Context context) { return new SwipeRefreshLayout(context); } @Override public void updateProps(SwipeRefreshLayout view) { super.updateProps(view); if (enabled != null) { enabled(enabled); } if (size != null) { size(size); } if (refreshing != null) { refreshing(refreshing); } if (colorResIds != null) { colorSchemeResources(colorResIds); } if (colors != null) { colorSchemeColors(colors); } if (distance != null) { distanceToTriggerSync(distance); } } public SwipeRefreshWidget enabled(Boolean enabled) { this.enabled = enabled; view.setEnabled(enabled); return self(); } public SwipeRefreshWidget size(Integer size) { this.size = size; view.setSize(size); return self(); } public SwipeRefreshWidget refreshing(Boolean refreshing) { this.refreshing = refreshing; view.setRefreshing(refreshing); return self(); } public SwipeRefreshWidget colorSchemeResources(@ColorRes int... colorResIds) { this.colorResIds = colorResIds; view.setColorSchemeResources(colorResIds); return self(); } public SwipeRefreshWidget colorSchemeColors(@ColorInt int... colors) { this.colors = colors; view.setColorSchemeColors(colors); return self(); } public SwipeRefreshWidget distanceToTriggerSync(Integer distance) { this.distance = distance; view.setDistanceToTriggerSync(distance); return self(); } public SwipeRefreshWidget onRefreshListener(SwipeRefreshLayout.OnRefreshListener listener) { this.listener = listener; view.setOnRefreshListener(listener); return self(); } public Boolean isRefreshing() { return view.isRefreshing(); } }
[ "86839868@qq.com" ]
86839868@qq.com
7da2dff666ab0cf612ff8e80c81a6e2e4317164e
aba9a8b1b3ee39e5aa4fa4fb563d39a0b58d9497
/netty4-demos/src/main/java/com/waylau/netty/demo/codec/jackcon/JsonGeneratorDemo.java
20789252633d5488374c1f7459af0db9ca47e228
[]
no_license
wayss000/PracticeCode
8626742d0e493647c06450308a64dff5020978e3
300e1a7dfaea583ae5fd8ec2eee4c30672b9ac51
refs/heads/master
2022-12-25T10:11:36.317164
2022-02-11T11:06:13
2022-02-11T11:06:13
90,707,702
1
1
null
2022-12-16T10:57:47
2017-05-09T05:56:24
Java
UTF-8
Java
false
false
1,436
java
package com.waylau.netty.demo.codec.jackcon; import java.io.File; import java.io.IOException; import com.fasterxml.jackson.core.JsonEncoding; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonGenerationException; import com.fasterxml.jackson.core.JsonGenerator; /** * 说明: * * @author <a href="http://www.waylau.com">waylau.com</a> 2015年11月8日 */ public class JsonGeneratorDemo { private static final String FILE_PATH = "d:\\user.json"; /** * */ public JsonGeneratorDemo() { // TODO Auto-generated constructor stub } /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { try { JsonFactory jfactory = new JsonFactory(); JsonGenerator jGenerator = jfactory.createJsonGenerator(new File( FILE_PATH), JsonEncoding.UTF8); jGenerator.writeStartObject(); // { jGenerator.writeStringField("name", "mkyong"); // "name" : "mkyong" jGenerator.writeNumberField("age", 29); // "age" : 29 jGenerator.writeFieldName("messages"); // "messages" : jGenerator.writeStartArray(); // [ jGenerator.writeString("msg 1"); // "msg 1" jGenerator.writeString("msg 2"); // "msg 2" jGenerator.writeString("msg 3"); // "msg 3" jGenerator.writeEndArray(); // ] jGenerator.writeEndObject(); // } jGenerator.close(); } catch (JsonGenerationException e) { e.printStackTrace(); } } }
[ "wayss000@gmail.com" ]
wayss000@gmail.com
ead9c4072156ff23175cb1563145fc9d8141552f
ad92841ccd2822c784db899ec56016b8a9ce856c
/src/main/java/com/dentaltw/instaslam/fragments/FeedActivityFragment.java
bb0c4c5bd2321b57b48df8902124310c09dcfaae
[]
no_license
YacheLee/InstaSlam
16ed158010265c0e184fe48b31ae06521622d42d
c8ea076ee0f7a84e02731b870deaf21c48038ac0
refs/heads/master
2021-01-20T01:38:49.922231
2017-04-27T07:32:17
2017-04-27T07:32:17
89,314,591
0
0
null
null
null
null
UTF-8
Java
false
false
1,879
java
package com.dentaltw.instaslam.fragments; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.dentaltw.instaslam.R; /** * A simple {@link Fragment} subclass. * Use the {@link FeedActivityFragment#newInstance} factory method to * create an instance of this fragment. */ public class FeedActivityFragment extends Fragment { // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; public FeedActivityFragment() { // Required empty public constructor } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @return A new instance of fragment FeedActivityFragment. */ // TODO: Rename and change types and number of parameters public static FeedActivityFragment newInstance() { FeedActivityFragment fragment = new FeedActivityFragment(); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment return inflater.inflate(R.layout.fragment_feed_activity, container, false); } }
[ "mymislife@gmail.com" ]
mymislife@gmail.com
c1cbec2a79de50faae76fa2ec1e01dcd504e5eb0
d4ab2701ff7a3d6f49ae97ec7a76fe1aa8ad43d0
/HelloWorld.java
5b4edc9b42af60262284205e6a0b57704e7ee5fe
[]
no_license
console-easemob/javabeginner
18f8ddf0233f012983ea921b920e385bc98dc4b7
c25056c99129477dcf3027d68d37c9c4054e8d78
refs/heads/master
2016-09-16T15:32:03.614899
2015-07-20T07:07:25
2015-07-20T07:07:25
39,003,402
0
1
null
2015-07-21T09:48:45
2015-07-13T09:35:16
Java
UTF-8
Java
false
false
259
java
public class HelloWorld { /** * * 输出一行字符串“Hello World!” * * @param args * */ public static void main(String[] args) { /* System.out.println("Hello World!"); */ logger.log("Hello World!"); } }
[ "console@easemob.com" ]
console@easemob.com
d27c2abc05241acb7eb8f956e2e6d6744b863c34
f856213c28f136ff7337298283cc17856eb3a4f0
/app/src/main/java/com/ormediagroup/youngplus/fragment/PromotionFragment2.java
a6c7a19449dd2f0b17a48df5472b17f9ec081a99
[]
no_license
crayonxiaoxin/YoungPlus
e1207440e4c1f8d52ba3a2226a1541c3c8777174
ebbd9eb99c0c6073801194e78efb385e944f2377
refs/heads/master
2020-04-10T03:14:42.900941
2019-06-25T02:55:29
2019-06-25T02:55:29
160,764,341
0
0
null
null
null
null
UTF-8
Java
false
false
11,606
java
package com.ormediagroup.youngplus.fragment; import android.content.DialogInterface; import android.graphics.Bitmap; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v4.app.Fragment; import android.util.Log; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ScrollView; import android.widget.Spinner; import android.widget.TextView; import com.ormediagroup.youngplus.R; import com.ormediagroup.youngplus.lau.API; import com.ormediagroup.youngplus.lau.LauUtil; import com.ormediagroup.youngplus.lau.NoAutoScrollView; import com.ormediagroup.youngplus.lau.ProcessingDialog; import com.ormediagroup.youngplus.lau.ServiceWebviewClient; import com.ormediagroup.youngplus.loadAndRetry.LoadingAndRetryManager; import com.ormediagroup.youngplus.loadAndRetry.OnLoadingAndRetryListener; import com.ormediagroup.youngplus.network.JSONResponse; import com.squareup.picasso.Picasso; import org.json.JSONException; import org.json.JSONObject; /** * Created by Lau on 2018/12/19. */ public class PromotionFragment2 extends BaseFragment { private View view; private TextView promotionTopIn; private WebView promotionMiddleDesc; private EditText promotionName, promotionPhone, promotionEmail; private Button promotionSubmit; // private String debug = "&to=lau@efortunetech.com"; private String debug = ""; private LinearLayout promotionPanel; private ScrollView promotionParentLayout; private LoadingAndRetryManager loadingAndRetryManager; private Spinner promotionSex; public static PromotionFragment2 newInstance(int id) { PromotionFragment2 f = new PromotionFragment2(); Bundle bundle = new Bundle(); bundle.putInt("id", id); f.setArguments(bundle); return f; } @Nullable @Override public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { view = inflater.inflate(R.layout.fragment_promotion2, container, false); initView(); initData(); return view; } @Override public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { super.onViewCreated(view, savedInstanceState); loadingAndRetryManager = LoadingAndRetryManager.generate(this.promotionParentLayout, new OnLoadingAndRetryListener() { @Override public void setRetryEvent(View retryView) { retryView.findViewById(R.id.base_retry).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { loadingAndRetryManager.showLoading(); initData(); } }); } }); loadingAndRetryManager.showLoading(); } private void initData() { String[] sex = {"男", "女"}; LauUtil.setSpinner(mActivity, promotionSex, sex); Bundle bundle = getArguments(); if (bundle != null) { int id = bundle.getInt("id", 0); if (id != 0) { new JSONResponse(mActivity, API.API_GET_PROMOTION, "id=" + id, new JSONResponse.onComplete() { @Override public void onComplete(JSONObject json) { loadingAndRetryManager.showContent(); try { JSONObject data = json.getJSONObject("data"); final String title = data.getString("title"); String top_desc = data.getString("top_desc"); String middle_desc = data.getString("middle_desc"); promotionTopIn.setText(LauUtil.HTMLTagDecode(top_desc)); promotionMiddleDesc.loadDataWithBaseURL("file:///android_asset/", LauUtil.formatHTML(middle_desc), "text/html;charset=UTF-8", null, null); WebSettings ws = promotionMiddleDesc.getSettings(); ws.setJavaScriptEnabled(true); ws.setLoadsImagesAutomatically(true); ws.setSupportZoom(false); ws.setDomStorageEnabled(true); // ws.setNeedInitialFocus(false); promotionMiddleDesc.setWebViewClient(new ServiceWebviewClient(mActivity)); final ProcessingDialog dialog = new ProcessingDialog(mActivity); promotionSubmit.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (!LauUtil.isNull(promotionName) && !LauUtil.isNull(promotionPhone) && !LauUtil.isNull(promotionEmail)) { if (LauUtil.isPhone(promotionPhone.getText().toString().trim())) { if (LauUtil.isEmail(promotionEmail.getText().toString().trim())) { dialog.loading("正在提交..."); String sexStr = promotionSex.getSelectedItem().toString().equals("男") ? "M" : "F"; String params = "username=" + promotionName.getText().toString() + "&userphone=" + promotionPhone.getText().toString() + "&useremail=" + promotionEmail.getText().toString() + "&usersex=" + sexStr + "&title=" + title + debug; Log.i(TAG, "onClick: promotion params = " + params); new JSONResponse(mActivity, API.API_ADD_PROMOTION, params, new JSONResponse.onComplete() { @Override public void onComplete(JSONObject json) { Log.i(TAG, "onComplete: promotion = " + json); try { if (json.getInt("rc") == 0) { dialog.loadingToSuccess("提交成功").setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { promotionName.setText(""); promotionPhone.setText(""); promotionEmail.setText(""); } }); } else { dialog.loadingToFailed("提交失敗,請聯絡Young+客服"); } } catch (JSONException e) { e.printStackTrace(); dialog.loadingToFailed("請檢查網絡連接"); } } }); } else { dialog.warning("請輸入正確的電郵").setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { promotionEmail.requestFocus(); } }); } } else { dialog.warning("請輸入8~11位電話號碼").setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { promotionPhone.requestFocus(); } }); } } else { dialog.warning("請不要留空").setOnDismissListener(new DialogInterface.OnDismissListener() { @Override public void onDismiss(DialogInterface dialog) { LauUtil.nullEditTextFocus(promotionPanel); } }); } } }); } catch (JSONException e) { e.printStackTrace(); } } }); } } } private void initView() { promotionTopIn = view.findViewById(R.id.promotion_top_in); promotionMiddleDesc = view.findViewById(R.id.promotion_middle_desc); promotionName = view.findViewById(R.id.promotion_name); promotionPhone = view.findViewById(R.id.promotion_phone); promotionEmail = view.findViewById(R.id.promotion_email); promotionSex = view.findViewById(R.id.promotion_sex); promotionSubmit = view.findViewById(R.id.promotion_submit); promotionPanel = view.findViewById(R.id.promotion_panel); promotionParentLayout = view.findViewById(R.id.promotion_parent); // 解决EditText抢占焦点问题 promotionParentLayout.setDescendantFocusability(ViewGroup.FOCUS_BEFORE_DESCENDANTS); promotionParentLayout.setFocusable(true); promotionParentLayout.setFocusableInTouchMode(true); promotionParentLayout.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { v.requestFocusFromTouch(); return false; } }); } }
[ "lau@efortunetech.com" ]
lau@efortunetech.com
9b1c06a0a655e64bcbdcd61ff60f5b0ee0652325
03537e593fd6c1c17e659730111c5c0ea9f93e74
/core/src/main/java/com/syntrice/lazurite/world/World.java
f11f08f5a02f56b6951fa4ec0c7f214beb9a1683
[]
no_license
Syntrice/lazurite
3356f946b601a42645454c6f910a823563ecbc41
8dc13e3638360147c4fa3f4fc6c1213982804716
refs/heads/master
2023-03-24T15:25:46.597421
2021-03-14T21:45:24
2021-03-14T21:45:24
337,101,701
0
0
null
null
null
null
UTF-8
Java
false
false
704
java
package com.syntrice.lazurite.world; import com.badlogic.gdx.graphics.Color; public class World { private Tile[][] tiles; private int width, height; public World(Tile[][] tiles) { this.tiles = tiles; width = tiles.length; height = tiles[0].length; } public Tile tile(int x, int y) { if (x < 0 || x >= width || y < 0 || y >= height) return Tile.BOUNDS; return tiles[x][y]; } public int glyph(int x, int y) { return tile(x,y).glyph(); } public Color background(int x, int y) { return tile(x,y).background(); } public Color foreground (int x, int y) { return tile(x,y).foreground(); } }
[ "syntrice@protonmail.com" ]
syntrice@protonmail.com
61f5d7ee8078d425ac88b9ec5d35f3e8705e83ed
d241ff38bb205942c3408bc6692ba5eb09874c34
/src/com/sccc/entity/Admin.java
c8c51551691a67ecbba6c778a1cd1e40a9ce9dc0
[]
no_license
Dark1X/BBSforStruts2
2b85f993c314715b4c1227d16891d0b0724d0570
48e17abd46a8316ffae0e9649eeb0647e5cd61e7
refs/heads/master
2021-06-17T03:56:22.775729
2017-04-14T03:35:30
2017-04-14T03:35:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
365
java
package com.sccc.entity; public class Admin { private String username; private String passwd; public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPasswd() { return passwd; } public void setPasswd(String passwd) { this.passwd = passwd; } }
[ "=" ]
=
40f6d49df4b458b036835594a8c994f807afdc5e
2548d35c32b63d1b1c813702a8a739c7f0ef657e
/src/testGui/java/org/intellij/xquery/runner/ui/run/main/datasource/DataSourcesDialogGuiTest.java
231af613921becd073b4077ce81e600a06bdf202
[ "Apache-2.0" ]
permissive
overstory/marklogic-intellij-plugin
5a0da9e0e2f3771fa2444e56af4e24991fd3e077
82a07f36b7ac79fa0b701d3caaa67846d9dce896
refs/heads/master
2022-05-11T07:55:04.498910
2020-02-20T09:37:01
2020-02-20T09:37:01
84,892,241
12
2
Apache-2.0
2022-05-04T12:11:09
2017-03-14T01:38:44
Java
UTF-8
Java
false
false
7,885
java
/* * Copyright 2013-2014 Grzegorz Ligas <ligasgr@gmail.com> and other contributors * (see the CONTRIBUTORS file). * * 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.intellij.xquery.runner.ui.run.main.datasource; import net.java.openjdk.cacio.ctc.junit.CacioTestRunner; import org.intellij.xquery.CheatingIdeaApplicationManager; import org.intellij.xquery.runner.state.datasources.XQueryDataSourceConfiguration; import org.intellij.xquery.runner.state.datasources.XQueryDataSourcesSettings; import org.intellij.xquery.runner.ui.datasources.DataSourcesSettingsForm; import org.jetbrains.annotations.NotNull; import org.junit.After; import org.junit.Before; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import javax.swing.Action; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.SwingUtilities; import java.awt.event.ActionEvent; import static org.mockito.BDDMockito.given; import static org.mockito.Matchers.anyListOf; import static org.mockito.Mockito.atLeast; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verifyNoMoreInteractions; import static org.mockito.Mockito.verifyZeroInteractions; /** * User: ligasgr * Date: 10/11/13 * Time: 00:50 */ @RunWith(CacioTestRunner.class) @Ignore("Temporarily switching off until I have better idea how to rewrite dialog not to be too bound to idea") public class DataSourcesDialogGuiTest { private JPanel parent; private DataSourceSelector selector; private DataSourcesSettingsForm settingsForm; private TestDataSourcesDialog dialog; private XQueryDataSourcesSettings dataSourceSettings; private Object showMonitor; @Before public void setUp() throws Exception { CheatingIdeaApplicationManager.removeApplication(); selector = mock(DataSourceSelector.class); settingsForm = mock(DataSourcesSettingsForm.class); dataSourceSettings = mock(XQueryDataSourcesSettings.class); parent = mock(JPanel.class); given(parent.isShowing()).willReturn(true); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { dialog = new TestDataSourcesDialog(parent, selector, settingsForm); } }); showMonitor = new Object(); } @After public void tearDown() throws Exception { CheatingIdeaApplicationManager.restoreApplication(); } @Test public void shouldDelegateCreationOfCenterPanelToSettingsForm() throws InterruptedException { showDialog(); clickCancelButton(); performVerifications(new Runnable() { @Override public void run() { verify(settingsForm).getFormComponent(); } }); } @Test public void shouldUpdateDataSourceConfigurationsWithCurrentStateFromForm() throws InterruptedException { showDialog(); clickOkButton(); performVerifications(new Runnable() { @Override public void run() { verify(settingsForm, atLeastOnce()).getCurrentConfigurations(); verify(dataSourceSettings).setDataSourceConfigurations(anyListOf(XQueryDataSourceConfiguration.class)); } }); } @Test public void shouldUpdateDataSourceSelectorWithCurrentConfigurations() throws InterruptedException { showDialog(); clickOkButton(); performVerifications(new Runnable() { @Override public void run() { verify(settingsForm, atLeast(2)).getCurrentConfigurations(); verify(selector).setDataSources(anyListOf(XQueryDataSourceConfiguration.class)); } }); } @Test public void shouldUpdateCurrentlySelectedDataSourceWithSelectionFromDialog() throws InterruptedException { final XQueryDataSourceConfiguration cfg = new XQueryDataSourceConfiguration(); given(settingsForm.getSelectedDataSource()).willReturn(cfg); showDialog(); clickOkButton(); performVerifications(new Runnable() { @Override public void run() { verify(settingsForm).getSelectedDataSource(); verify(selector).setSelectedDataSource(cfg); } }); } @Test public void shouldNotUpdateCurrentlySelectedDataSourceWhenNoSelectionInDialog() throws InterruptedException { given(settingsForm.getSelectedDataSource()).willReturn(null); showDialog(); clickOkButton(); performVerifications(new Runnable() { @Override public void run() { verify(selector).setDataSources(anyListOf(XQueryDataSourceConfiguration.class)); verify(settingsForm).getSelectedDataSource(); verifyNoMoreInteractions(selector); } }); } @Test public void shouldDoNothingIfWasClosedWithClose() throws InterruptedException { showDialog(); clickCancelButton(); performVerifications(new Runnable() { @Override public void run() { verifyZeroInteractions(selector, dataSourceSettings); } }); } private void clickOkButton() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { Action okAction = dialog.getOKAction(); ActionEvent event = new ActionEvent(DataSourcesDialogGuiTest.this, 0, "command"); okAction.actionPerformed(event); } }); } private void clickCancelButton() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { Action cancelAction = dialog.getCancelAction(); ActionEvent event = new ActionEvent(DataSourcesDialogGuiTest.this, 0, "command"); cancelAction.actionPerformed(event); } }); } private void performVerifications(Runnable verifications) throws InterruptedException { synchronized (showMonitor) { showMonitor.wait(); verifications.run(); } } private void showDialog() { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { synchronized (showMonitor) { dialog.show(); showMonitor.notify(); } } }); } private class TestDataSourcesDialog extends DataSourcesDialog { public TestDataSourcesDialog(JComponent parent, DataSourceSelector selector, DataSourcesSettingsForm settingsForm) { super(parent, selector, settingsForm); } @NotNull @Override public Action getOKAction() { return super.getOKAction(); } @NotNull @Override public Action getCancelAction() { return super.getCancelAction(); } @Override protected XQueryDataSourcesSettings getDataSourceSettings() { return dataSourceSettings; } } }
[ "ligasgr@gmail.com" ]
ligasgr@gmail.com
65eeeb058ff25e0048593521e0bcd9d1d784359f
ed0f68b321e41529b180600ec562cdfe86628071
/49.group-anagrams.java
90a307670e3b917466ff4c6c711f79adc5ddeb68
[]
no_license
skyskiper/leetcode
b0950d3b7a70556743dffe12d60103bc70da67e0
c2258fd005a058847b02ece93d7e9aafdba6b080
refs/heads/master
2020-03-25T23:07:47.772389
2019-05-21T10:51:43
2019-05-21T10:51:43
144,259,855
0
0
null
null
null
null
UTF-8
Java
false
false
2,422
java
/* * @lc app=leetcode id=49 lang=java * * [49] Group Anagrams * * https://leetcode.com/problems/group-anagrams/description/ * * algorithms * Medium (45.32%) * Total Accepted: 307.7K * Total Submissions: 678.9K * Testcase Example: '["eat","tea","tan","ate","nat","bat"]' * * Given an array of strings, group anagrams together. * * Example: * * * Input: ["eat", "tea", "tan", "ate", "nat", "bat"], * Output: * [ * ⁠ ["ate","eat","tea"], * ⁠ ["nat","tan"], * ⁠ ["bat"] * ] * * Note: * * * All inputs will be in lowercase. * The order of your output does not matter. * * */ public class Solution { /** * 单词分组,将由相同字母组成的单词分到一组 * 字母排序算法: * 将单词里的字母进行排序,这样只要字母组合相同,不同单词排序后组成的新单词都相同。 * @param strs * @return */ public List<List<String>> groupAnagrams1(String[] strs) { Map<String, List<String>> map = new HashMap<>(); for(String str:strs) { char[] letters = str.toCharArray(); Arrays.sort(letters); String new_str = String.valueOf(letters); if(!map.containsKey(new_str)) { map.put(new_str, new ArrayList<>()); } map.get(new_str).add(str); } return new ArrayList<List<String>>(map.values()); } /** * 素数求解算法: * 使用26个素数分别表示26个小写字母,这样可以实现一个单词可以由多个素数的乘积表示,由于素数的特性,不同的单词计算出来的结果必不相同,从而一个单词可以由一个素数表示, * 在比对单词时,可极大减小运算量。 * @param strs * @return */ public List<List<String>> groupAnagrams(String[] strs) { int[] primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103}; Map<Integer, List<String>> map = new HashMap<>(); for(String str:strs) { int k = 1; for(char ch:str.toCharArray()) { k *= primes[ch-'a']; } if(!map.containsKey(k)) { map.put(k, new ArrayList<>()); } map.get(k).add(str); } return new ArrayList<List<String>>(map.values()); } }
[ "sum920229@gmail.com" ]
sum920229@gmail.com
08194a5003c66f3253db383ff61412d6d86ad74e
617b113244e5afcd1fb4c2ad96d96a53d1afd381
/PluginsAndFeatures/com.persistent.winazure.eclipseplugin/src/com/persistent/winazureroles/SimplePfxPwdDlg.java
e93a1a36295f9104e240a2e282460e871831d09e
[]
no_license
gouthammc/MyRun
6e123eec797155f32ea167c3df1f4ebba40475af
18875fe784341d4ecfde26c1de8882ff2414cee6
refs/heads/master
2021-03-13T00:06:48.947103
2014-04-28T15:11:34
2014-04-28T15:11:34
19,239,800
0
1
null
null
null
null
UTF-8
Java
false
false
3,651
java
/** * Copyright 2014 Microsoft Open Technologies, Inc. * * 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.persistent.winazureroles; import org.eclipse.jface.dialogs.IDialogConstants; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ModifyEvent; import org.eclipse.swt.events.ModifyListener; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; import com.microsoftopentechnologies.wacommon.utils.CerPfxUtil; import com.microsoftopentechnologies.wacommon.utils.PluginUtil; public class SimplePfxPwdDlg extends org.eclipse.jface.dialogs.Dialog { private Text txtPwd; private String pfxPath; private String password; private Button okButton; protected SimplePfxPwdDlg(Shell parentShell, String path) { super(parentShell); this.pfxPath = path; } @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(Messages.certPwd); } @Override protected Control createButtonBar(Composite parent) { Control ctrl = super.createButtonBar(parent); okButton = getButton(IDialogConstants.OK_ID); okButton.setEnabled(false); return ctrl; } protected Control createContents(Composite parent) { Composite container = new Composite(parent, SWT.NONE); GridLayout gridLayout = new GridLayout(1, false); container.setLayout(gridLayout); GridData gridData = new GridData(); gridData.widthHint = 400; container.setLayoutData(gridData); Label lblName = new Label(container, SWT.LEFT); gridData = new GridData(); gridData.horizontalIndent = 5; gridData.verticalIndent = 10; lblName.setLayoutData(gridData); lblName.setText(Messages.enterPfxPwd); txtPwd = new Text(container, SWT.SINGLE | SWT.BORDER | SWT.PASSWORD); gridData = new GridData(); gridData.horizontalAlignment = GridData.FILL; gridData.verticalIndent = 10; gridData.grabExcessHorizontalSpace = true; txtPwd.setLayoutData(gridData); txtPwd.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent event) { enableOkBtn(); } }); return super.createContents(parent); } /** * Method enables or disables OK button. * Disable OK button password is empty. */ private void enableOkBtn() { if (okButton != null) { if (txtPwd.getText().trim().isEmpty()) { okButton.setEnabled(false); } else { okButton.setEnabled(true); } } } @Override protected void okPressed() { boolean isValid = false; if (CerPfxUtil.validatePfxPwd(pfxPath, txtPwd.getText().trim())) { isValid = true; password = txtPwd.getText().trim(); } else { PluginUtil.displayErrorDialog(getShell(), com.gigaspaces.azure.wizards.Messages.error, com.gigaspaces.azure.wizards.Messages.invalidPfxPwdMsg); } if (isValid) { super.okPressed(); } } /** * Return password value. * @return */ public String getPwd() { return password; } }
[ "mcgoutham28@gmail.com" ]
mcgoutham28@gmail.com
2a7bf34b47343e71061b76b59d2e3ba9f7603839
ab42b765c9e1a31c407da19b4a56202473c10840
/CS300-Programs/P07 Exploring a Maze/src/Maze.java
9d8511eab5d79b522219cf5390f9c6f07540b083
[]
no_license
Caffretro/CS200-400
270ba652f0036bc05555da2e726f66d0321fc349
9731601bf008f67ca95ba4f6b482596fb196ccad
refs/heads/main
2022-12-29T06:14:59.439081
2020-10-15T04:42:52
2020-10-15T04:42:52
304,211,814
0
0
null
null
null
null
UTF-8
Java
false
false
14,488
java
//////////////////// ALL ASSIGNMENTS INCLUDE THIS SECTION ///////////////////// // // Title: Exploring a Maze // Files: None // Course: CS300 Spring 2018 // // Author: Junheng Wang // Email: jwang922@wisc.edu // Lecturer's Name: Mouna Kacem // //////////////////// PAIR PROGRAMMERS COMPLETE THIS SECTION /////////////////// // // Partner Name: N/A // Partner Email: N/A // Lecturer's Name: N/A // // VERIFY THE FOLLOWING BY PLACING AN X NEXT TO EACH TRUE STATEMENT: // ___ Write-up states that pair programming is allowed for this assignment. // ___ We have both read and understand the course Pair Programming Policy. // ___ We have registered our team prior to the team registration deadline. // ///////////////////////////// CREDIT OUTSIDE HELP ///////////////////////////// // // Students who get help from sources other than their partner must fully // acknowledge and credit those sources of help here. Instructors and TAs do // not need to be credited here, but tutors, friends, relatives, room mates // strangers, etc do. If you received no outside help from either type of // source, then please explicitly indicate NONE. // // Persons: None // Online Sources: None // /////////////////////////////// 80 COLUMNS WIDE /////////////////////////////// public class Maze { // this is how we build the map, check if solved, and trace the movements private final String vWall = "|"; private final String hWall = "---"; private MazeRunnerStack path; private Boolean solved; private char[][] mazeInfo; private String[][] map; // following fields are the position tracers private Position start; private Position current; private Position finish; private char facing; public Maze(char[][] mazeInfo) { this.facing = 'r';// default facing is r, since we can go out anyway this.mazeInfo = mazeInfo; this.map = new String[mazeInfo.length * 2 + 1][mazeInfo[0].length * 2 + 1]; // map size should be twice the width or height plus one this.solved = false; for (int k = 0; k < map.length; k++) { for (int h = 0; h < map[k].length; h++) { if (k % 2 == 0) { if (h % 2 == 0) { map[k][h] = "+"; } else { map[k][h] = hWall; } } // horizontal walls and + else { if (h % 2 == 1) { map[k][h] = " "; } // spots in the maze else if (h == (map[k].length - 1)) { map[k][map[k].length - 1] = "|"; } // right side walls, since mazeInfo doesn't say anything about right side } } } // First, set the boundaries and spaces in the map. for (int i = 0; i < mazeInfo.length; i++) { for (int j = 0; j < mazeInfo[i].length; j++) { switch (mazeInfo[i][j]) { case 'L': map[2 * i + 1][2 * j] = vWall; map[2 * i + 2][2 * j + 1] = hWall; break; case '.': map[2 * i + 1][2 * j] = " "; map[2 * i + 2][2 * j + 1] = " "; break; case '|': map[2 * i + 1][2 * j] = vWall; map[2 * i + 2][2 * j + 1] = " "; break; case '_': map[2 * i + 1][2 * j] = " "; map[2 * i + 2][2 * j + 1] = hWall; break; } } } // initializing walls using mazeInfo } public void setStart(int row, int col) { this.map[2 * row + 1][2 * col + 1] = " S "; this.start = new Position(row, col); // initializing start position and update in the map } public void setFinish(int row, int col) { this.map[2 * row + 1][2 * col + 1] = " F "; this.finish = new Position(row, col); // initializing finish position and update in the map } public void displayMaze() { Position temp = new Position(); if (solved) {// when the maze is solved map[2 * start.row + 1][2 * start.col + 1] = " S "; map[2 * finish.row + 1][2 * finish.col + 1] = " F "; System.out.println("Solution is:"); for (int i = 0; i < map.length; i++) { for (int j = 0; j < map[i].length; j++) { System.out.print(map[i][j]); } System.out.println(); } // print out the map System.out.print("Path is: "); for (int i = 0; i < path.getSize() - 1; i++) { path.printEntry(i); } // print out the entry reversely according to the properties of stack // printing the last one since there's no arrows System.out.println("[" + path.peek().row + "," + path.peek().col + "]"); } else {// when the maze cannot be solved System.out.println("No solution could be found."); while (!path.isEmpty()) { temp = path.pop(); map[2 * temp.row + 1][2 * temp.col + 1] = " "; } // cleaning the trace, leaving the map with blanks map[2 * start.row + 1][2 * start.col + 1] = " S "; map[2 * finish.row + 1][2 * finish.col + 1] = " F "; // Restoring the start and finish positions for (int i = 0; i < map.length; i++) { for (int j = 0; j < map[i].length; j++) { System.out.print(map[i][j]); } System.out.println(); } // printing out the map } } public void solveMaze() { this.path = new MazeRunnerStack(); path.push(start); //set the start position this.current = new Position(start.row, start.col); // Position temp = new Position(); this.facing = 'r'; char move = ' '; int steps = 0; //count how many steps we have stepped through String wayOut = ""; do { // following cases are in the sequence of right-hand rule wayOut = findWay(current.row, current.col); if (facing == 'u' || facing == 'U') {// facing upward if (wayOut.contains("R")) { move = 'R'; current = turn(move); } else if (wayOut.contains("U")) { move = 'S'; current = turn(move); } else if (wayOut.contains("L")) { move = 'L'; current = turn(move); } else if (wayOut.contains("D")) { move = 'B'; current = turn(move); } } else if (facing == 'r' || facing == 'R') { if (wayOut.contains("D")) { move = 'R'; current = turn(move); } else if (wayOut.contains("R")) { move = 'S'; current = turn(move); } else if (wayOut.contains("U")) { move = 'L'; current = turn(move); } else if (wayOut.contains("L")) { move = 'B'; current = turn(move); } } else if (facing == 'd' || facing == 'D') { if (wayOut.contains("L")) { move = 'R'; current = turn(move); } else if (wayOut.contains("D")) { move = 'S'; current = turn(move); } else if (wayOut.contains("R")) { move = 'L'; current = turn(move); } else if (wayOut.contains("U")) { move = 'B'; current = turn(move); } } else if (facing == 'l' || facing == 'L') { if (wayOut.contains("U")) { move = 'R'; current = turn(move); } else if (wayOut.contains("L")) { move = 'S'; current = turn(move); } else if (wayOut.contains("D")) { move = 'L'; current = turn(move); } else if (wayOut.contains("R")) { move = 'B'; current = turn(move); } } if (path.contains(current)) { while (path.contains(current)) { if (!path.peek().equals(current)) { temp = path.pop(); map[2 * temp.row + 1][2 * temp.col + 1] = " "; } else { break; } } //for clearing redundant steps } else { map[2 * current.row + 1][2 * current.col + 1] = " * "; path.push(current); }//recording steps steps++; // System.out.println("" + path.peek().row + " , " + path.peek().col + " " + facing); } while (!current.equals(finish) && steps <= (mazeInfo.length * mazeInfo[0].length * 4)); //ends either we found a solution or the solution could not be found if (path.peek().equals(finish) && steps <= (mazeInfo.length * mazeInfo[0].length * 4)) { solved = true; } else { solved = false; } } public String findWay(int row, int col) { //private helper method that returns a String that records what are the ways we can go String wayOut = ""; if (map[row * 2][col * 2 + 1] != hWall) { wayOut += "U"; } if (map[row * 2 + 1][col * 2 + 2] != vWall) { wayOut += "R"; } if (map[row * 2 + 2][col * 2 + 1] != hWall) { wayOut += "D"; } if (map[row * 2 + 1][col * 2] != vWall) { wayOut += "L"; } return wayOut; } public Position turn(char move) { //moving the current Position object according to the position and movement Position nextStep = new Position(current.row, current.col); if (move == 'r' || move == 'R') {//go to the right switch (this.facing) { case 'u': case 'U': this.facing = 'r'; nextStep.setPosition(current.row, current.col + 1); break; case 'r': case 'R': this.facing = 'd'; nextStep.setPosition(current.row + 1, current.col); break; case 'd': case 'D': this.facing = 'l'; nextStep.setPosition(current.row, current.col - 1); break; case 'l': case 'L': this.facing = 'u'; nextStep.setPosition(current.row - 1, current.col); break; } } else if (move == 'l' || move == 'L') {//go to the left switch (this.facing) { case 'u': case 'U': this.facing = 'l'; nextStep.setPosition(current.row, current.col - 1); break; case 'r': case 'R': this.facing = 'u'; nextStep.setPosition(current.row - 1, current.col); break; case 'd': case 'D': this.facing = 'r'; nextStep.setPosition(current.row, current.col + 1); break; case 'l': case 'L': this.facing = 'd'; nextStep.setPosition(current.row + 1, current.col); break; } } else if (move == 's' || move == 'S') {//go straight on switch (this.facing) { case 'u': case 'U': nextStep.setPosition(current.row - 1, current.col); break; case 'r': case 'R': nextStep.setPosition(current.row, current.col + 1); break; case 'd': case 'D': nextStep.setPosition(current.row + 1, current.col); break; case 'l': case 'L': nextStep.setPosition(current.row, current.col - 1); break; } } else if (move == 'b' || move == 'B') {//go back switch (this.facing) { case 'u': case 'U': this.facing = 'd'; nextStep.setPosition(current.row + 1, current.col); break; case 'r': case 'R': this.facing = 'l'; nextStep.setPosition(current.row, current.col - 1); break; case 'd': case 'D': this.facing = 'u'; nextStep.setPosition(current.row - 1, current.col); break; case 'l': case 'L': this.facing = 'r'; nextStep.setPosition(current.row, current.col + 1); break; } } return nextStep; } public static void main(String[] args) { char[][] info = new char[3][3]; info[0][0] = 'L'; info[0][1] = '.'; info[0][2] = '|'; info[1][0] = 'L'; info[1][1] = '|'; info[1][2] = '|'; info[2][0] = 'L'; info[2][1] = '_'; info[2][2] = '_'; Maze test = new Maze(info); test.setStart(0, 0); test.setFinish(0, 2); test.solveMaze(); test.displayMaze(); } }
[ "caffretro@gmail.com" ]
caffretro@gmail.com
8f5e94f1d43a92df6873e6ffc53012c39e3b09ea
63990ae44ac4932f17801d051b2e6cec4abb8ad8
/bus-image/src/main/java/org/aoju/bus/image/nimble/opencv/J2kImageWriteParam.java
7bd3c6ce62eec1d983a1c76d2113d8fd95c0c1a3
[ "MIT" ]
permissive
xeon-ye/bus
2cca99406a540cf23153afee8c924433170b8ba5
6e927146074fe2d23f9c9f23433faad5f9e40347
refs/heads/master
2023-03-16T17:47:35.172996
2021-02-22T10:31:48
2021-02-22T10:31:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,303
java
/********************************************************************************* * * * The MIT License (MIT) * * * * Copyright (c) 2015-2021 aoju.org and other contributors. * * * * Permission is hereby granted, free of charge, to any person obtaining a copy * * of this software and associated documentation files (the "Software"), to deal * * in the Software without restriction, including without limitation the rights * * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * * copies of the Software, and to permit persons to whom the Software is * * furnished to do so, subject to the following conditions: * * * * The above copyright notice and this permission notice shall be included in * * all copies or substantial portions of the Software. * * * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * * THE SOFTWARE. * * * ********************************************************************************/ package org.aoju.bus.image.nimble.opencv; import javax.imageio.ImageWriteParam; import java.util.Locale; /** * @author Kimi Liu * @version 6.2.0 * @since JDK 1.8+ */ public class J2kImageWriteParam extends ImageWriteParam { private static final String[] COMPRESSION_TYPES = {"LOSSY", "LOSSLESS"}; private int compressionRatiofactor; public J2kImageWriteParam(Locale locale) { super(locale); super.canWriteCompressed = true; super.compressionMode = MODE_EXPLICIT; super.compressionType = "LOSSY"; super.compressionTypes = COMPRESSION_TYPES; this.compressionRatiofactor = 10; } @Override public void setCompressionType(String compressionType) { super.setCompressionType(compressionType); if (isCompressionLossless()) { this.compressionRatiofactor = 0; } } @Override public boolean isCompressionLossless() { return compressionType.equals("LOSSLESS"); } public int getCompressionRatiofactor() { return compressionRatiofactor; } public void setCompressionRatiofactor(int compressionRatiofactor) { this.compressionRatiofactor = compressionRatiofactor; } }
[ "839536@qq.com" ]
839536@qq.com
dfe94c78d3730a80a820d0a6203fe88abc2581b2
59dffc19bf0cdbdaa64893e20eb47a0581a786c8
/src/main/java/com/facens/af/swagger/SwaggerConfig.java
ff46ead06ec653463fb9d6c4f566bec3c800a859
[]
no_license
h4ad-facens/facens-poo-af
97e492c6501924845a75d6ff4da95985ad5a7cea
18f4c52156c541bed43cdb621bd00ae135a1bef9
refs/heads/master
2023-04-04T14:58:37.539613
2020-11-30T02:19:49
2020-11-30T02:19:49
null
0
0
null
null
null
null
UTF-8
Java
false
false
685
java
package com.facens.af.swagger; 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 SwaggerConfig { @Bean public Docket api() { return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.any()) .paths(PathSelectors.any()).build(); } }
[ "vinyygamerlol@gmail.com" ]
vinyygamerlol@gmail.com
ea51a1188bb147d1f541383ec79b688c86dff1ef
0c1b72bc3a14c071946c0674ad43d65a1f79bdbe
/app/src/main/java/com/expressivemoods/RecyclerViewAdapter.java
79e360da05b643de8260939551107aaadcb5f3f0
[]
no_license
saisuma98/Expressive-Moods
b946b54171a8e85d5ed44bc850749e014f63f013
aa238fb0be8376a303152f507f6bb40cb592d647
refs/heads/master
2020-08-02T11:58:53.596334
2019-09-27T15:17:48
2019-09-27T15:17:48
211,343,932
0
0
null
null
null
null
UTF-8
Java
false
false
3,909
java
package com.expressivemoods; import android.content.Context; import android.content.Intent; import android.media.MediaPlayer; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.bumptech.glide.Glide; import java.io.IOException; import java.util.ArrayList; public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.ViewHolder>{ private static final String TAG = "RecyclerViewAdapter"; private ArrayList<String> mySongNames ; private ArrayList<String> mySongUrl ; private Context mContext; public RecyclerViewAdapter(Context context, ArrayList<String> SongNames, ArrayList<String> SongUrl ) { mySongNames = SongNames; mySongUrl = SongUrl; mContext = context; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.layout_listitem, parent, false); ViewHolder holder = new ViewHolder(view); return holder; } @Override public void onBindViewHolder(ViewHolder holder, final int position) { Log.d(TAG, "onBindViewHolder: called."); holder.songName.setText(mySongNames.get(position)); final MediaPlayer mediaPlayer = new MediaPlayer(); holder.play.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { try { mediaPlayer.setDataSource(mySongUrl.get(position)); } catch (IOException e) { e.printStackTrace(); } if(!mediaPlayer.isPlaying()) { mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { @Override public void onPrepared(MediaPlayer mp) { mp.start(); } }); try { mediaPlayer.prepare(); } catch (IOException e) { e.printStackTrace(); } }else{ mediaPlayer.start(); } Toast.makeText(mContext,"Play pressed "+mySongUrl.get(position),Toast.LENGTH_LONG).show(); } }); holder.pause.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { mediaPlayer.pause(); Toast.makeText(mContext,"Pause pressed",Toast.LENGTH_SHORT).show(); } }); holder.resume.setOnClickListener(new View.OnClickListener(){ @Override public void onClick(View v) { mediaPlayer.release(); Toast.makeText(mContext,"Resume pressed",Toast.LENGTH_SHORT).show(); } }); } @Override public int getItemCount() { return mySongNames.size(); } public class ViewHolder extends RecyclerView.ViewHolder{ TextView songName; Button play,pause,resume; RelativeLayout parentLayout; public ViewHolder(View itemView) { super(itemView); songName = itemView.findViewById(R.id.song_name); play = (Button)itemView.findViewById(R.id.btnPlay); pause = (Button)itemView.findViewById(R.id.btnPause); resume = (Button)itemView.findViewById(R.id.btnResume); parentLayout = itemView.findViewById(R.id.parent_layout); } } }
[ "nasirbashak007@gmail.com" ]
nasirbashak007@gmail.com
dbe3ebf0f0842b5ae044f3898faa433210bc8f5b
e050c1103f20e94b9868c8acf477a48191178d3a
/instrument-starters/opentracing-spring-cloud-mongo-starter/src/test/java/io/opentracing/contrib/spring/cloud/mongo/TracingMongoClientPostProcessorTest.java
5979ab862939c2d6ca6c9336982d58bec4dcfc7a
[ "Apache-2.0" ]
permissive
wuyupengwoaini/java-spring-cloud
51d99f6186c18bc4f8d8bdf6a4c9a12f26e6b752
fe7b110d57ab2cc953a5d0a0eb6fc5895e096531
refs/heads/master
2020-08-10T10:42:50.104822
2019-10-12T09:34:25
2019-10-12T09:34:25
165,630,232
0
0
Apache-2.0
2019-01-14T09:09:31
2019-01-14T09:09:31
null
UTF-8
Java
false
false
2,112
java
/** * Copyright 2017-2019 The OpenTracing Authors * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package io.opentracing.contrib.spring.cloud.mongo; import static org.assertj.core.api.Assertions.assertThat; import com.mongodb.MongoClient; import com.mongodb.MongoClientOptions; import com.mongodb.MongoClientURI; import io.opentracing.Tracer; import io.opentracing.contrib.mongo.TracingMongoClient; import org.junit.Before; import org.junit.Test; import org.mockito.Mock; public class TracingMongoClientPostProcessorTest { @Mock private Tracer tracer; @Mock private TracingMongoClient tracingClient; private TracingMongoClientPostProcessor processor; @Before public void setup() { processor = new TracingMongoClientPostProcessor(tracer); } @Test public void testNonMongoClientBeansAreReturnedUnaltered() { final Object expected = new Object(); final Object actual = processor.postProcessAfterInitialization(expected, "any-bean-name"); assertThat(actual).isSameAs(expected); } @Test public void testMongoClientBeansReplacedWithTracingClient() { final MongoClient client = new MongoClient(new MongoClientURI("mongodb://localhost/test", MongoClientOptions.builder())); final Object actual = processor.postProcessAfterInitialization(client, "any-bean-name"); assertThat(actual).isInstanceOf(TracingMongoClient.class); } @Test public void testTracingMongoClientBeanNotWrapped() { final Object actual = processor.postProcessAfterInitialization(tracingClient, "any-bean-name"); assertThat(actual).isSameAs(tracingClient); } }
[ "geoand@gmail.com" ]
geoand@gmail.com
4a8c8165914be2e1c69fc5f2218337f5d21842b0
b00b25295a6d7b96a08441e4b4f28f7370840c35
/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/android/support/v7/cardview/R.java
e050a416f3942943036e7be4059d22e2aea1c91c
[]
no_license
talhasaglam/FinansalProject
1a4ee8562b51b6d3f13d2968bfea7c2e0b37f7c4
cab689c40889fcd30862d9cf90958f2a63f16e44
refs/heads/master
2020-04-13T12:29:22.951813
2018-12-25T13:47:05
2018-12-25T14:49:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,135
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package android.support.v7.cardview; public final class R { private R() {} public static final class attr { private attr() {} public static final int cardBackgroundColor = 0x7f04004b; public static final int cardCornerRadius = 0x7f04004c; public static final int cardElevation = 0x7f04004d; public static final int cardMaxElevation = 0x7f04004e; public static final int cardPreventCornerOverlap = 0x7f04004f; public static final int cardUseCompatPadding = 0x7f040050; public static final int contentPadding = 0x7f04006d; public static final int contentPaddingBottom = 0x7f04006e; public static final int contentPaddingLeft = 0x7f04006f; public static final int contentPaddingRight = 0x7f040070; public static final int contentPaddingTop = 0x7f040071; } public static final class color { private color() {} public static final int cardview_dark_background = 0x7f060026; public static final int cardview_light_background = 0x7f060027; public static final int cardview_shadow_end_color = 0x7f060028; public static final int cardview_shadow_start_color = 0x7f060029; } public static final class dimen { private dimen() {} public static final int cardview_compat_inset_shadow = 0x7f07004c; public static final int cardview_default_elevation = 0x7f07004d; public static final int cardview_default_radius = 0x7f07004e; } public static final class style { private style() {} public static final int Base_CardView = 0x7f0f000f; public static final int CardView = 0x7f0f00ae; public static final int CardView_Dark = 0x7f0f00af; public static final int CardView_Light = 0x7f0f00b0; } public static final class styleable { private styleable() {} public static final int[] CardView = { 0x101013f, 0x1010140, 0x7f04004b, 0x7f04004c, 0x7f04004d, 0x7f04004e, 0x7f04004f, 0x7f040050, 0x7f04006d, 0x7f04006e, 0x7f04006f, 0x7f040070, 0x7f040071 }; public static final int CardView_android_minWidth = 0; public static final int CardView_android_minHeight = 1; public static final int CardView_cardBackgroundColor = 2; public static final int CardView_cardCornerRadius = 3; public static final int CardView_cardElevation = 4; public static final int CardView_cardMaxElevation = 5; public static final int CardView_cardPreventCornerOverlap = 6; public static final int CardView_cardUseCompatPadding = 7; public static final int CardView_contentPadding = 8; public static final int CardView_contentPaddingBottom = 9; public static final int CardView_contentPaddingLeft = 10; public static final int CardView_contentPaddingRight = 11; public static final int CardView_contentPaddingTop = 12; } }
[ "orkunsozen070@gmail.com" ]
orkunsozen070@gmail.com
55bf296dad30b3f91ce2a5037ddc1f8f8ac7c75d
d747f54f7c033cadced82805799754584fdcb54a
/src/main/java/com/example/demo/model/CommentaryEntityDemo.java
59ee8197d8bf410d9e71f3cb93abe0f8437cb0e9
[]
no_license
HARITHAKISHORE97/CrikBot
e3f94ee371be037766fad64a61ff3b5a9e8ddc95
794e648495e7d79ac049d9d9eef07fccf5665da7
refs/heads/master
2020-04-27T23:52:20.197493
2019-03-10T09:36:39
2019-03-10T09:36:39
174,793,848
0
0
null
null
null
null
UTF-8
Java
false
false
1,190
java
package com.example.demo.model; import org.hibernate.annotations.GenericGenerator; import org.springframework.boot.autoconfigure.web.ResourceProperties; import javax.persistence.*; @Entity @Table(name = "CommentaryDemo") public class CommentaryEntityDemo { @Column(name = "Id") @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private String id; private String runs; private String over; @Column(length = 2048) private String commentary; public String getRuns() { return runs; } public void setRuns(String runs) { this.runs = runs; } public String getOver() { return over; } public void setOver(String over) { this.over = over; } public String getCommentary() { return commentary; } public void setCommentary(String commentary) { this.commentary = commentary; } @Override public String toString() { return "CommentaryEntity{" + "id='" + id + '\'' + ", runs='" + runs + '\'' + ", over=" + over + ", commentary='" + commentary + '\'' + '}'; } }
[ "k.haritha@coviam.com" ]
k.haritha@coviam.com
25b1cf658372c22180e65e3e28ce6952c0405849
fe756eea3747713ba093d9444efe5c1c184c0351
/lib_util/src/main/java/com/gmf/util/constant/MemoryConstants.java
2bd5f2d5f9878a27dd8111e0806afad8dd26521a
[ "Apache-2.0" ]
permissive
GMF018/GMFComponent
20e30077fc0b1de11ce170b8bca6ca02b435c233
bc86b236d37ae747514bc727c618581a79bdd663
refs/heads/master
2021-05-21T19:52:26.286393
2020-04-04T17:04:49
2020-04-04T17:04:49
252,777,887
0
0
null
null
null
null
UTF-8
Java
false
false
473
java
package com.gmf.util.constant; import androidx.annotation.IntDef; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; public final class MemoryConstants { public static final int BYTE = 1; public static final int KB = 1024; public static final int MB = 1048576; public static final int GB = 1073741824; @IntDef({BYTE, KB, MB, GB}) @Retention(RetentionPolicy.SOURCE) public @interface Unit { } }
[ "chenchangyan@talk-fun.com" ]
chenchangyan@talk-fun.com
7465d6344010d77d5c9542a2c7e0c359dbcc1acd
5bfceecfd87965d6a5acc8d51f94ad42360bd64e
/exo11/src/main/java/fr/gtm/tp/exo11/domain/Plate.java
33d841fc111b72af28f4d3b26e3044a8f51dedcf
[]
no_license
stevenroman91/Workspace
7affc4ac6695cabd41fdcc923e1f34601b497994
233a3a24330dff73375a27b414cd197a446e04c8
refs/heads/master
2022-05-06T06:49:50.871095
2018-07-10T13:21:29
2018-07-10T13:21:29
135,457,752
0
1
null
2022-04-19T19:41:30
2018-05-30T14:50:56
JavaScript
UTF-8
Java
false
false
186
java
package fr.gtm.tp.exo11.domain; /** * * @author Adminl * */ public interface Plate { /** * Caulcul de la surface de l'assiette * * @return */ public float calArea(); }
[ "veneran_steven@hotmail.com" ]
veneran_steven@hotmail.com
9a579a689584d3cf0f4e9dfa0233aaee62836d51
9fa2aa5b7453fb8e47a1ec7c216f4bfc0c919074
/src/com/company/Main.java
5c22644daf86242b9de352600bac38631b40ebe7
[]
no_license
Ayad-Ben-Saliem/FileIOPractice
b0c8c48a5c1eeca984f6e24e973f03e3d626c8c1
c4b2b521d16c2a057c0a6a38fddf878e5e025667
refs/heads/master
2020-03-09T07:26:13.992683
2018-04-09T15:46:39
2018-04-09T15:46:39
128,664,154
0
0
null
null
null
null
UTF-8
Java
false
false
891
java
package com.company; import java.io.*; import java.util.Scanner; public class Main { public static void main(String[] args) { //saveDemo(); readDemo(); } public static void saveDemo(){ PersonSaver saver = new PersonSaver(); File f = new File("People"); Person p1 = new Person(); Person p2 = new Person("Hesham"); Person p3 = new Person("Ahmed", 13); Person p4 = new Person(null, 10, "LY"); saver.savePerson(p1, f); saver.savePerson(p2, f); saver.savePerson(p3, f); saver.savePerson(p4); } public static void readDemo(){ File f1 = new File("People"); PeopleReader reader = new PeopleReader(); Person[] persons = reader.readPeople(f1); for(Person person : persons){ System.out.println(person.getName()); } } }
[ "ayad@eng.misuratau.edu.ly" ]
ayad@eng.misuratau.edu.ly
0ad75704716fb7aa348834a6e763f0c0fbe4ce74
07a87e1046a616d9e61ed704897eba1ec7e28d54
/gs05/src/test/java/com/gs05/Gs05ApplicationTests.java
bfb241a99e2e159b234bd8d89c3b706f916a129f
[]
no_license
arapiku/gs05
dd66602182901cb2ce0a850e8e44c06b9fd5dfe9
6e378792d2e505f2a7b3b4c71d8270e0cc570c22
refs/heads/master
2021-05-14T00:14:43.738268
2018-01-07T05:13:58
2018-01-07T05:13:58
116,535,778
0
0
null
null
null
null
UTF-8
Java
false
false
323
java
package com.gs05; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit4.SpringRunner; @RunWith(SpringRunner.class) @SpringBootTest public class Gs05ApplicationTests { @Test public void contextLoads() { } }
[ "arpaiku420@gmail.com" ]
arpaiku420@gmail.com
43ab66427da57cab653e8666069f113e115a9ef9
89052c5dac8063a6acca387abda3aab2d3a70036
/SameTree100.java
14bf6ec21cc7e628ddb669138e17f174dc3ddd21
[]
no_license
hqnjkkl/leetcodeEasy
f8df80334bb59b764f95a9c5211f1a5c8b4a47b8
296bef415d0753cf3da42f74960bf8c5bd1389a9
refs/heads/master
2020-04-30T14:21:47.198287
2019-03-27T00:06:05
2019-03-27T00:06:05
176,884,202
0
0
null
null
null
null
UTF-8
Java
false
false
640
java
package leetcodeEasy; public class SameTree100 { public static void main(String[] args) { TreeNode p = new TreeNode(2,new TreeNode(1),new TreeNode(3)); TreeNode q = new TreeNode(2,new TreeNode(1),new TreeNode(3)); System.out.println(new SameTree100().isSameTree(p, q)); } /** * accepted 16minutes * @param p * @param q * @return */ public boolean isSameTree(TreeNode p, TreeNode q) { if(p==null && q==null) return true; if(p!=null && q!=null) { if(p.val==q.val) if(isSameTree(p.left,q.left)) { return isSameTree(p.right,q.right); } } return false; } }
[ "314851859@qq.com" ]
314851859@qq.com
399611e69523bbb294e92835abf92a5c48cb07f3
f7af10c480ad856a8cd6ece9fa7689b9ef8ed39a
/instrumentation/src/testDiscovery/TestDiscoveryInstrumenter.java
c2637d4cd3c666052047e799d9f3da692c4e039e
[ "Apache-2.0" ]
permissive
takeya/intellij-coverage
5d7adf8accf9f0fac54c9cdc621efdfd7b7b0aa4
9c57900c2d2d3bcca8c0461abc20124914034854
refs/heads/master
2021-01-23T07:44:07.287934
2016-12-16T09:47:33
2016-12-16T09:47:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
9,443
java
/* * Copyright 2000-2015 JetBrains s.r.o. * * 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.intellij.rt.coverage.testDiscovery; import com.intellij.rt.coverage.data.ProjectData; import org.jetbrains.org.objectweb.asm.*; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; public class TestDiscoveryInstrumenter extends ClassVisitor { private static final int ADDED_CODE_STACK_SIZE = 6; protected final ClassVisitor myClassVisitor; private final String myClassName; private final String myInternalClassName; private final ClassLoader myClassLoader; private final String myInternalCounterClassJVMName; private static final String myInternalCounterClassName = "int"; private final InstrumentedMethodsFilter myMethodFilter; private final String[] myMethodNames; private int myCurrentMethodCount; private boolean myVisitedStaticBlock; private int myClassVersion; private volatile Method myDefineClassMethodRef; private static final String METHODS_VISITED = "__$methodsVisited$__"; private static final String METHODS_VISITED_CLASS = "[Z"; private static final boolean INLINE_COUNTERS = System.getProperty("idea.inline.counter.fields") != null; public TestDiscoveryInstrumenter(ClassVisitor classVisitor, ClassReader cr, String className, ClassLoader loader) { super(Opcodes.ASM6, classVisitor); myClassVisitor = classVisitor; myMethodFilter = new InstrumentedMethodsFilter(className); myClassName = className.replace('$', '.'); // for inner classes myInternalClassName = className.replace('.', '/'); myInternalCounterClassJVMName = myInternalClassName+"$" + myInternalCounterClassName; myClassLoader = loader; myMethodNames = collectMethodNames(cr, className); } private String[] collectMethodNames(ClassReader cr, final String className) { final List instrumentedMethods = new ArrayList(); final ClassVisitor instrumentedMethodCounter = new ClassVisitor(Opcodes.ASM6) { final InstrumentedMethodsFilter methodsFilter = new InstrumentedMethodsFilter(className); public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { methodsFilter.visit(version, access, name, signature, superName, interfaces); myClassVersion = version; super.visit(version, access, name, signature, superName, interfaces); } public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { if (methodsFilter.shouldVisitMethod(access, name, desc, signature, exceptions)) { if ("<init>".equals(name)) { final int slashPos = className.lastIndexOf('.'); final int $Pos = className.lastIndexOf('$'); name = className.substring(Math.max(slashPos, $Pos) + 1); } instrumentedMethods.add(name); } return super.visitMethod(access, name, desc, signature, exceptions); } }; cr.accept(instrumentedMethodCounter, 0); return (String[]) instrumentedMethods.toArray(new String[instrumentedMethods.size()]); } private void generateInnerClassWithCounter() { ClassWriter cw = new ClassWriter(0); MethodVisitor mv; cw.visit(myClassVersion, Opcodes.ACC_STATIC + Opcodes.ACC_FINAL + Opcodes.ACC_SUPER + Opcodes.ACC_SYNTHETIC, myInternalCounterClassJVMName, // ? null, "java/lang/Object", null); { cw.visitOuterClass(myInternalClassName, myInternalCounterClassJVMName, null); cw.visitField(Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL | Opcodes.ACC_STATIC, METHODS_VISITED, METHODS_VISITED_CLASS, null, null); MethodVisitor staticBlockVisitor = cw.visitMethod(Opcodes.ACC_STATIC, "<clinit>", "()V", null, null); staticBlockVisitor = new StaticBlockMethodVisitor(staticBlockVisitor); staticBlockVisitor.visitCode(); staticBlockVisitor.visitInsn(Opcodes.RETURN); staticBlockVisitor.visitMaxs(ADDED_CODE_STACK_SIZE, 0); staticBlockVisitor.visitEnd(); } { mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", "()V", null, null); mv.visitVarInsn(Opcodes.ALOAD, 0); mv.visitMethodInsn(Opcodes.INVOKESPECIAL, "java/lang/Object", "<init>", "()V"); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(1, 1); mv.visitEnd(); } cw.visitEnd(); try { byte[] bytes = cw.toByteArray(); //saveBytes(bytes, myInternalCounterClassJVMName.replace('/', '.') + ".class"); Method defineClassMethodRef = myDefineClassMethodRef; if (defineClassMethodRef == null) { defineClassMethodRef = ClassLoader.class.getDeclaredMethod("defineClass", new Class[]{byte[].class, Integer.TYPE, Integer.TYPE}); if (defineClassMethodRef != null) { defineClassMethodRef.setAccessible(true); myDefineClassMethodRef = defineClassMethodRef; } } defineClassMethodRef.invoke(myClassLoader, new Object[]{bytes, new Integer(0), new Integer(bytes.length)}); } catch (Throwable t) { t.printStackTrace(); } } public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { myMethodFilter.visit(version, access, name, signature, superName, interfaces); super.visit(version, access, name, signature, superName, interfaces); } public MethodVisitor visitMethod(final int access, final String name, final String desc, final String signature, final String[] exceptions) { final MethodVisitor mv = cv.visitMethod(access, name, desc, signature, exceptions); if (mv == null) return mv; if ("<clinit>".equals(name)) { if (INLINE_COUNTERS) { myVisitedStaticBlock = true; return new StaticBlockMethodVisitor(mv); } else { return mv; } } if (!myMethodFilter.shouldVisitMethod(access, name, desc, signature, exceptions)) return mv; return new MethodVisitor(Opcodes.ASM6, mv) { final int myMethodId = myCurrentMethodCount++; public void visitCode() { // todo for constructor insert the code after calling 'super' visitFieldInsn(Opcodes.GETSTATIC, INLINE_COUNTERS ? myInternalClassName : myInternalCounterClassJVMName, METHODS_VISITED, METHODS_VISITED_CLASS); pushInstruction(this, myMethodId); visitInsn(Opcodes.ICONST_1); visitInsn(Opcodes.BASTORE); super.visitCode(); } }; } public void visitEnd() { if (INLINE_COUNTERS) { visitField(Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL | Opcodes.ACC_STATIC, METHODS_VISITED, METHODS_VISITED_CLASS, null, null); if (!myVisitedStaticBlock) { MethodVisitor mv = super.visitMethod(Opcodes.ACC_STATIC, "<clinit>", "()V", null, null); mv = new StaticBlockMethodVisitor(mv); mv.visitCode(); mv.visitInsn(Opcodes.RETURN); mv.visitMaxs(ADDED_CODE_STACK_SIZE, 0); mv.visitEnd(); } } else { if (myMethodNames.length > 0) { generateInnerClassWithCounter(); visitInnerClass(myInternalCounterClassJVMName, myInternalClassName, myInternalCounterClassName, Opcodes.ACC_PRIVATE + Opcodes.ACC_FINAL + Opcodes.ACC_STATIC); } } super.visitEnd(); } private class StaticBlockMethodVisitor extends MethodVisitor { public StaticBlockMethodVisitor(MethodVisitor mv) { super(Opcodes.ASM6, mv); } public void visitCode() { super.visitCode(); visitLdcInsn(myClassName); pushInstruction(this, myMethodNames.length); visitIntInsn(Opcodes.NEWARRAY, Opcodes.T_BOOLEAN); pushInstruction(this, myMethodNames.length); visitTypeInsn(Opcodes.ANEWARRAY, "java/lang/String"); for(int i = 0; i < myMethodNames.length; ++i) { visitInsn(Opcodes.DUP); pushInstruction(this, i); visitLdcInsn(myMethodNames[i]); visitInsn(Opcodes.AASTORE); } visitMethodInsn(Opcodes.INVOKESTATIC, ProjectData.PROJECT_DATA_OWNER, "trace", "(Ljava/lang/String;[Z[Ljava/lang/String;)[Z", false); visitFieldInsn(Opcodes.PUTSTATIC, INLINE_COUNTERS ? myInternalClassName : myInternalCounterClassJVMName, METHODS_VISITED, METHODS_VISITED_CLASS); // no return here } public void visitMaxs(int maxStack, int maxLocals) { final int ourMaxStack = ADDED_CODE_STACK_SIZE; super.visitMaxs(Math.max(ourMaxStack, maxStack), maxLocals); } } private static void pushInstruction(MethodVisitor mv, int operand) { if (operand < Byte.MAX_VALUE) mv.visitIntInsn(Opcodes.BIPUSH, operand); else mv.visitIntInsn(Opcodes.SIPUSH, operand); } }
[ "anna.kozlova@jetbrains.com" ]
anna.kozlova@jetbrains.com
4dcdcc19fdbc964f995e49f56105f0d1e09846c4
b6589dfb4f5b30c3d72102bb866eb72de8c0f324
/src/test/java/com/darania/BracketChecker/BracketCheckerTest.java
7b8d6a26343df7fd2f5ebd110c5ccc33da27a2bd
[]
no_license
DanaMurali/Java-Testing
49b6aa2bdc05178ac4ce86c573396dc4122b8a3b
cda6d37102bb93111c9c2af0409e3108741d408b
refs/heads/master
2023-09-03T16:56:20.788332
2021-10-28T20:34:48
2021-10-28T20:34:48
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,789
java
package com.darania.BracketChecker; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.*; class BracketCheckerTest { @Test void correctNumberOfBrackets() { //given String input = "{()}"; // String expected = //when BracketChecker checker = new BracketChecker(); boolean actual = checker.bracketChecker(input); //here you want to call the function, the function is bracketChecker so try checker.bracketChecker //then assertThat(actual).isEqualTo(true); //here you want to say the expected result, so the string in line 17 would return true. // so line 20 runs your function and in line 24 you have to physically write in the correct result where you wrote isEqualto(input) and then the test is making sure they match //this should be either true or false since our function only returns a boolean,so in otherwords since the string in line 17 does have matching opening/closing brackets it should return true, so your expected is (true) } @Test void inCorrectNumberOfBrackets () { //given String input = "[{()]"; //when BracketChecker checker = new BracketChecker(); boolean actual = checker.bracketChecker(input); //then assertThat(actual).isEqualTo(false); } @Test void inputIsEmpty() { //given String input = ""; //when BracketChecker checker = new BracketChecker(); boolean actual = checker.bracketChecker(input); //then assertThat(actual).isEqualTo(false); } }
[ "90543261+DanaMurali@users.noreply.github.com" ]
90543261+DanaMurali@users.noreply.github.com
e28f99a5b1c34017862b35c58669c4e8c42d22eb
b8042e45854b6d6b45e4d4da8a1dc44d77aab4d7
/12_abstract-factory/src/main/java/cn/jondai/abstract_factory/ShuKingdomFactory.java
ffdaebaa0624e127960b00d042847631983dfd5b
[]
no_license
JonDai/java-design-patterns
1aeb11b64d817cc9e9b284e780022b6313231b29
6250ecf8d0cb277fde9a7a90b1f8c252913ef7ce
refs/heads/master
2021-01-18T10:51:58.174348
2016-05-04T03:25:23
2016-05-04T03:25:23
56,471,734
2
0
null
null
null
null
UTF-8
Java
false
false
349
java
package cn.jondai.abstract_factory; /** * Created by JonDai on 2016/4/26. */ public class ShuKingdomFactory implements KingdomFactory{ public Army createArmy() { return new ShuArmy(); } public Castle createCastle() { return new ShuCastle(); } public King createKing() { return new ShuKing(); } }
[ "jondai@aliyun.com" ]
jondai@aliyun.com
087252fc6a6b5f07951cc87a987b40dbcf87c175
d572c07960be9e0aaffba735cf6333365e3136ff
/springboot-004-mybatis-xml-mapper/src/main/java/com/yihaomen/service/UserInfoService.java
3625be87c81d05d90dcf8602cf561e579cb65c62
[]
no_license
cuiyaoqiang/https---github.com-cuiayaoqiang-springcloud
b00f6985f2103bd76a3b193f168b82e52cd34481
d0c8387ad59f5a063a985192764341d0bd1d44a1
refs/heads/master
2021-09-05T06:53:17.805032
2018-01-25T01:26:43
2018-01-25T01:26:43
118,746,073
0
1
null
null
null
null
UTF-8
Java
false
false
670
java
package com.yihaomen.service; import java.util.List; import java.util.Random; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.yihaomen.dao.UserInfoDao; import com.yihaomen.model.UserInfo; @Service public class UserInfoService { @Autowired private UserInfoDao userInfoDao; public List<UserInfo> findAllUsers(){ return userInfoDao.findAllUsers(); } public UserInfo createUser() { UserInfo u =new UserInfo(); long curMillis = System.currentTimeMillis(); u.setName("Name-" + curMillis); u.setAddress("Address: " + curMillis); userInfoDao.addUserInfo(u); return u; } }
[ "731143851@qq.com" ]
731143851@qq.com
06cdb227d40bfb7751e318e0cee983bad53e37f0
32922108473c30c63f46a5fa8178e76fb1dea545
/app/src/main/java/com/csci448/freshapps/keepitfresh/ItemType.java
0472189a79fd1487965de01d38241eaf0aeee433
[]
no_license
akurzon/KeepItFresh
bcb033e43ec43a4e67f64d2e9730af5c41156e76
11c4386897d8ab47aeda0e79c9065c0abce4d51d
refs/heads/master
2021-01-21T06:31:19.988538
2017-05-09T09:44:39
2017-05-09T09:44:39
83,251,580
0
0
null
null
null
null
UTF-8
Java
false
false
86
java
package com.csci448.freshapps.keepitfresh; public enum ItemType { STORED, CART }
[ "akurzon@mymail.mines.edu" ]
akurzon@mymail.mines.edu
ae60baaa5175f094a1c2d912b61ddd2038115d3d
21b43795e1e6fb89ceb14ebdca2a01990bad9a5d
/src/main/java/com/mycompany/myapp/domain/DTO/UserDTO.java
f7bd8164b8e9dde0b7e1f7bdf0d3f2fdc356da75
[]
no_license
BulkSecurityGeneratorProject1/basketball
f6e57c92f539cc795139a24892d387642164330f
d21fe9c6d0e9cd5d3fb80f483c30b2b1623f691f
refs/heads/master
2022-12-22T18:18:09.530422
2017-01-23T20:13:51
2017-01-23T20:13:51
296,649,680
0
0
null
2020-09-18T14:48:17
2020-09-18T14:48:17
null
UTF-8
Java
false
false
2,396
java
package com.mycompany.myapp.domain.DTO; import com.mycompany.myapp.config.Constants; import com.mycompany.myapp.domain.Authority; import com.mycompany.myapp.domain.User; import org.hibernate.validator.constraints.Email; import javax.validation.constraints.*; import java.util.Set; import java.util.stream.Collectors; /** * A DTO representing a user, with his authorities. */ public class UserDTO { @Pattern(regexp = Constants.LOGIN_REGEX) @Size(min = 1, max = 50) private String login; @Size(max = 50) private String firstName; @Size(max = 50) private String lastName; @Email @Size(min = 5, max = 100) private String email; private boolean activated = false; @Size(min = 2, max = 5) private String langKey; private Set<String> authorities; public UserDTO() { } public UserDTO(User user) { this(user.getLogin(), user.getFirstName(), user.getLastName(), user.getEmail(), user.getActivated(), user.getLangKey(), user.getAuthorities().stream().map(Authority::getName) .collect(Collectors.toSet())); } public UserDTO(String login, String firstName, String lastName, String email, boolean activated, String langKey, Set<String> authorities) { this.login = login; this.firstName = firstName; this.lastName = lastName; this.email = email; this.activated = activated; this.langKey = langKey; this.authorities = authorities; } public String getLogin() { return login; } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public String getEmail() { return email; } public boolean isActivated() { return activated; } public String getLangKey() { return langKey; } public Set<String> getAuthorities() { return authorities; } @Override public String toString() { return "UserDTO{" + "login='" + login + '\'' + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + ", activated=" + activated + ", langKey='" + langKey + '\'' + ", authorities=" + authorities + "}"; } }
[ "casanovaalex11@gmail.com" ]
casanovaalex11@gmail.com
87395c691f3baa9018d15dd45314a32e6a5deb04
e5494ef7fb85b5a9e2462c36d45c7b8e6b987b28
/src/interface_segregation/exemplo1/BankPayment.java
990e3ea413eb7506f210cc24167c6f5925d2b2ac
[]
no_license
gustaveco1997/solid-samples-java
af7622a1480f0a4ed223eb5b50833628231643ef
d3a987abd45b46b287c471aa4e8a85bdb72efb36
refs/heads/main
2023-07-29T19:41:16.774248
2021-09-13T14:03:12
2021-09-13T14:03:12
404,730,028
0
0
null
null
null
null
UTF-8
Java
false
false
392
java
package interface_segregation.exemplo1; import java.util.ArrayList; import java.util.List; public class BankPayment implements IBank{ @Override public Object status() { return new Object(); } @Override public List<Object> getPayments() { return new ArrayList<>(); } @Override public void initiatePayments() { //do something } }
[ "gustavohdosreis@gmail.com" ]
gustavohdosreis@gmail.com
9398e7e6d64dfc7d20da531fd7782063eea3981c
fe53c7b237a65e823b0a6549ab6977690ee95321
/src/main/java/ch/fer/epost/application/repository/UserRepository.java
31db6b57ebd9a000fdbf5ca6ea3f6ea759d26a3b
[]
no_license
savoy750/ePostBox
84ace59b881f02f503fb25b8f10799108f4634d0
0d4e3e971ed959678971ba055173deab06593802
refs/heads/master
2020-03-12T00:05:38.771154
2018-04-20T09:30:46
2018-04-20T09:30:46
130,340,956
0
0
null
2018-04-20T09:42:02
2018-04-20T09:30:43
Java
UTF-8
Java
false
false
1,548
java
package ch.fer.epost.application.repository; import ch.fer.epost.application.domain.User; import org.springframework.cache.annotation.Cacheable; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.EntityGraph; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import java.util.List; import java.util.Optional; import java.time.Instant; /** * Spring Data JPA repository for the User entity. */ @Repository public interface UserRepository extends JpaRepository<User, Long> { String USERS_BY_LOGIN_CACHE = "usersByLogin"; String USERS_BY_EMAIL_CACHE = "usersByEmail"; Optional<User> findOneByActivationKey(String activationKey); List<User> findAllByActivatedIsFalseAndCreatedDateBefore(Instant dateTime); Optional<User> findOneByResetKey(String resetKey); Optional<User> findOneByEmailIgnoreCase(String email); Optional<User> findOneByLogin(String login); @EntityGraph(attributePaths = "authorities") Optional<User> findOneWithAuthoritiesById(Long id); @EntityGraph(attributePaths = "authorities") @Cacheable(cacheNames = USERS_BY_LOGIN_CACHE) Optional<User> findOneWithAuthoritiesByLogin(String login); @EntityGraph(attributePaths = "authorities") @Cacheable(cacheNames = USERS_BY_EMAIL_CACHE) Optional<User> findOneWithAuthoritiesByEmail(String email); Page<User> findAllByLoginNot(Pageable pageable, String login); }
[ "jhipster-bot@users.noreply.github.com" ]
jhipster-bot@users.noreply.github.com
b1f7621968b7756d96923b11f016bc27c1a76e58
e41507592722fd1549a9b43d7545b4d6d5d256ed
/src/main/java/org/fhir/pojo/ClaimInsuranceHelper.java
179a580062edd022cb3902fbd0c4cd688ff72150
[ "MIT" ]
permissive
gmai2006/fhir
a91636495409615ab41cc2a01e296cddc64159ee
8613874a4a93a108c8520f8752155449464deb48
refs/heads/master
2021-05-02T07:11:25.129498
2021-02-26T00:17:15
2021-02-26T00:17:15
120,861,248
2
0
null
2020-01-14T22:16:55
2018-02-09T05:29:57
Java
UTF-8
Java
false
false
2,194
java
/* * #%L * FHIR Implementation * %% * Copyright (C) 2018 DataScience 9 LLC * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ /** * This code is 100% AUTO generated. Please do not modify it DIRECTLY * If you need new features or function or changes please update the templates * then submit the template through our web interface. */ package org.fhir.pojo; import org.fhir.entity.ClaimInsuranceModel; import com.google.gson.GsonBuilder; /** * Auto generated from the FHIR specification * generated on 07/14/2018 */ public class ClaimInsuranceHelper { public static java.util.List<ClaimInsurance> fromArray2Array(java.util.List<ClaimInsuranceModel> list) { return list.stream() .map(x -> new ClaimInsurance(x)) .collect(java.util.stream.Collectors.toList()); } public static ClaimInsurance fromArray2Object(java.util.List<ClaimInsuranceModel> list) { return new ClaimInsurance(list.get(0)); } public static java.util.List<ClaimInsuranceModel> toModel(ClaimInsurance reference, String parentId) { ClaimInsuranceModel model = new ClaimInsuranceModel(reference, parentId); return java.util.Arrays.asList(new ClaimInsuranceModel[] { model }); } public static java.util.List<ClaimInsuranceModel> toModelFromArray(java.util.List<ClaimInsurance> list, String parentId) { return (java.util.List<ClaimInsuranceModel>)list.stream() .map(x -> new ClaimInsuranceModel(x, parentId)) .collect(java.util.stream.Collectors.toList()); } public static ClaimInsurance fromJson(String json) { if (null == json) return null; return new GsonBuilder().create().fromJson(json, ClaimInsurance.class); } }
[ "gmai2006@gmail.com" ]
gmai2006@gmail.com
17f4f5ef7d20aff53e5076a60c70d1b5c8904c73
afbedba4e9780d84d015b04c3dc334ebcf9b7c00
/GWP/src/com/circlemenu/CircleImageView.java
341dcf47c6164ec7e509763a7e6b7b174d433311
[]
no_license
0359xiaodong/GWP80_B
4217111b88282908d1eab3cd82197b70e2587c5c
66833875b2ee650d96be96410a5fdfcd0dcaab78
refs/heads/master
2020-12-11T05:53:42.561352
2015-10-29T07:10:12
2015-10-29T07:10:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,146
java
package com.circlemenu; /* * Copyright 2013 Csaba Szugyiczki * * 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. */ import com.printshare.R; import android.annotation.SuppressLint; import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.widget.LinearLayout; /** * * @author Szugyi * Custom ImageView for the CircleLayout class. * Makes it possible for the image to have an angle, position and a name. * Angle is used for the positioning in the circle menu. */ public class CircleImageView extends LinearLayout { private float angle = 0; private int position = 0; private String name; public float getAngle() { return angle; } public void setAngle(float angle) { this.angle = angle; } public int getPosition() { return position; } public void setPosition(int position) { this.position = position; } public String getName(){ return name; } public void setName(String name){ this.name = name; } /** * @param context */ public CircleImageView(Context context) { this(context, null); } /** * @param context * @param attrs */ public CircleImageView(Context context, AttributeSet attrs) { this(context, attrs, 0); } /** * @param context * @param attrs * @param defStyle */ @SuppressLint("NewApi") public CircleImageView(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); if (attrs != null) { TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.CircleImageView); name = a.getString(R.styleable.CircleImageView_name); } } }
[ "darren4qyl@gmail.com" ]
darren4qyl@gmail.com
c94d9027f8aeeee72d35cb62981088edee63600d
7712c309821ca9d473db6a695d66513cb4d9aed8
/src/hufs/eselab/SkillCheck3/Day0831/WorkFatigue.java
18145d89c1a93cb30b2af90194aec5109bd7fefc
[]
no_license
ggoowlgns/Algorithm_Practice
038902cb9622552f454a86277470b946fa3b53ef
e123ebb99009238eeb1c39b2fa5df75d90916066
refs/heads/master
2020-07-15T08:34:51.097791
2019-09-21T15:28:55
2019-09-21T15:28:55
205,522,339
0
0
null
null
null
null
UTF-8
Java
false
false
1,513
java
package hufs.eselab.SkillCheck3.Day0831; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; public class WorkFatigue { public static void main(String[] args){ Solution s = new Solution(); int n = 3; int[] works = {1,1}; System.out.println(s.solution(n,works)); } static class Solution { public long solution(int n, int[] works) { long answer = 0; List<Integer> li_works = new ArrayList<>(); for (int i : works)li_works.add(i); //제일 큰걸 하나씩 찾음 int biggest = 0; int idx =0; while(n >0) { int num = find_biggest(li_works); //제일큰값이 0 보다 클 때만 if(num == 0) break; idx = li_works.indexOf(num); li_works.set(idx, num - 1); //-1 한값을 넣어준다. n--; } for(Integer i : li_works) answer += (i*i); return answer; } private int find_biggest(List<Integer> li){ int biggest = -1; if (li.size() == 1) return li.get(0); // for(Integer i : li){ // biggest = Math.max(i,biggest); // } int half = li.size()/2; biggest = Math.max(find_biggest(li.subList(0,half)), find_biggest(li.subList(half,li.size()))); return biggest; } } }
[ "30282681+ggoowlgns@users.noreply.github.com" ]
30282681+ggoowlgns@users.noreply.github.com
401c0b71eecf0496858d6380d44fed3da860e526
cdd87204a5c8576f39daa7b027406a8787ca4628
/app/src/main/java/yc/com/pinyin_study/mine/model/engine/ShareEngine.java
026940a224e2e81eb30da8010c7a955391911fef
[]
no_license
YangChengTeam/pingyin-study
0016b9662088b221da627f17131336ea541ce26c
d1724abadc989e946ab6e94449aaa0106d9b4493
refs/heads/master
2022-02-18T11:05:13.811404
2022-02-11T06:07:30
2022-02-11T06:07:30
174,971,529
0
0
null
null
null
null
UTF-8
Java
false
false
846
java
package yc.com.pinyin_study.mine.model.engine; import android.content.Context; import io.reactivex.Observable; import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.schedulers.Schedulers; import yc.com.pinyin_study.base.model.engine.BaseEngine; import yc.com.rthttplibrary.bean.ResultInfo; /** * Created by wanglin on 2019/5/10 10:32. */ public class ShareEngine extends BaseEngine { public ShareEngine(Context context) { super(context); } public Observable<ResultInfo<String>> share() { // return HttpCoreEngin.get(mContext).rxpost(UrlConfig.share_reward_url, new TypeReference<ResultInfo<String>>() { // }.getType(), null, true, true, true); return request.share().subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()); } }
[ "2037097758@qq.com" ]
2037097758@qq.com
df80f5c2c07c09fe7995140b9a3e48b7c773120c
9e5a76c6ab3a9230d1c9476d95d49f08a2eb96d6
/app/src/main/java/com/thevisitapp/visitapp/SecondSeriesActivity.java
45c5132aa037c84f49e3a876795034b35c0c5460
[]
no_license
sambulosenda/locationapp
cfe7151baf67573322267ccbbf2d6378ccd0ab58
f29d26787f1970c0e0adff26ab4fbe144caf23fd
refs/heads/master
2020-12-25T13:07:27.557707
2015-09-15T03:02:13
2015-09-15T03:02:13
42,787,536
0
0
null
2019-03-09T16:23:36
2015-09-19T19:55:59
Java
UTF-8
Java
false
false
6,949
java
package com.thevisitapp.visitapp; import android.content.Intent; import android.os.AsyncTask; import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.Window; import android.widget.AdapterView; import android.widget.ListView; import android.widget.Toast; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; public class SecondSeriesActivity extends ActionBarActivity { ListView mList; @Override protected void onCreate(Bundle savedInstanceState) { requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); super.onCreate(savedInstanceState); setContentView(R.layout.activity_after_destination); ArrayList<String> seriesIds; Bundle extras = getIntent().getExtras(); seriesIds = extras.getStringArrayList("nextSeries"); String name = extras.getString("name"); Log.d("SECOND SERIES", name); getSupportActionBar().setTitle(name); getSupportActionBar().setDisplayHomeAsUpEnabled(true); Toast.makeText(this, "actually correct activity", Toast.LENGTH_LONG).show(); new Series().execute(seriesIds); } public class Series extends AsyncTask<ArrayList<String>, Void, JSONObject> { protected JSONObject doInBackground(ArrayList<String>...lists){ String myUrl = "http://thevisitapp.com/api/series/read?identifiers="; ArrayList<String> seriesIds = lists[0]; Log.d("SERIES IDS IN SECOND", seriesIds.toString()); myUrl = formatUrl(myUrl, seriesIds); Log.d("AD URL", myUrl); HttpRequest request = new HttpRequest(); Log.d("GETTING JSON FROM URL", request.getJSONFromUrl(myUrl).toString()); return request.getJSONFromUrl(myUrl); } protected void onPostExecute(JSONObject result){ ArrayList<String> modelNames = new ArrayList<>(); Log.d("JSON RESPONSE", result.toString()); final ArrayList<JSONObject> modelsObjectList = new ArrayList<>(); try { JSONObject info = result.getJSONObject("info"); JSONArray models = info.getJSONArray("models"); Log.d("SECOND MODELS", models.toString()); for(int i = 0; i < models.length(); i++){ modelsObjectList.add(models.getJSONObject(i)); Log.d("MODELS OBJECT", models.getJSONObject(i).toString()); } Log.d("MODELS OBJECT LIST", modelsObjectList.toString()); for(int i = 0; i < modelsObjectList.size(); i++){ modelNames.add(modelsObjectList.get(i).getString("name")); System.out.println("NAMES " + modelNames.get(i)); } } catch(JSONException e ){ Log.d("JSONEXCEPTION", e.getMessage().toString()); } Log.d("MODEL NAMES", modelNames.toString()); Toast.makeText(SecondSeriesActivity.this, modelNames.toString(), Toast.LENGTH_LONG).show(); mList = (ListView) findViewById(android.R.id.list); CustomMainAdapter mainAdapter = new CustomMainAdapter(SecondSeriesActivity.this, modelNames); mList.setAdapter(mainAdapter); setProgressBarIndeterminateVisibility(false); mList.setOnItemClickListener(new AdapterView.OnItemClickListener() { String name; Long id; public void onItemClick(AdapterView<?> parent, View view, int position, long id) { JSONObject passingObject = modelsObjectList.get(position); ArrayList<String> nextPlacesList = new ArrayList<>(); try { if(passingObject.optJSONArray("places") == null){ name = passingObject.getString("name"); id = passingObject.getLong("id"); Log.d("NEXT ACTIVITY NAME", name); System.out.println("NEXT ACTIVITY ID " + id); Log.d("NEXT SERIES LIST", nextPlacesList.toString()); Intent intent = new Intent(SecondSeriesActivity.this, SecondSeriesActivity.class); intent.putExtra("id", id); intent.putExtra("name", name); intent.putExtra("placesList", nextPlacesList); startActivity(intent); } JSONArray places = passingObject.getJSONArray("places"); for(int i = 0; i < places.length(); i++){ nextPlacesList.add(places.getString(i)); } name = passingObject.getString("name"); id = passingObject.getLong("id"); Log.d("NEXT ACTIVITY NAME", name); System.out.println("NEXT ACTIVITY ID " + id); Log.d("NEXT SERIES LIST", nextPlacesList.toString()); } catch(JSONException e){ Log.d("JSONEXCEPTION", e.getMessage()); } Intent intent = new Intent(SecondSeriesActivity.this, PlacesListActivity.class); intent.putExtra("id", id); intent.putExtra("name", name); intent.putExtra("placesList", nextPlacesList); startActivity(intent); } }); } } private String formatUrl(String myUrl, ArrayList<String> seriesIds) { int count = 0; //adds comma after every series but the last one for(int i = 0; i < seriesIds.size(); i++){ myUrl += seriesIds.get(i); if(count != seriesIds.size() -1){ myUrl += ","; } count++; } return myUrl; } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_after_destination, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
[ "rmoreno.cesar@gmail.com" ]
rmoreno.cesar@gmail.com
3a5036ee5a841d9791e272c17d805b43e753c38d
6c5858f9b664d4937c940e78e4584f1e551a6328
/src/main/java/com/chandebois/repositories/UserRepository.java
39e47417236f1ad54b9932576708eccfdf83a27c
[]
no_license
achandebois/spring-boot-docker
d3e8cac14a2c7cdb3499b7556bf3098153607131
db5b14f39b74b02c6f1420d5c2e4fe96f1633c05
refs/heads/master
2020-05-29T14:39:13.060282
2016-06-08T16:09:58
2016-06-08T16:09:58
60,710,581
0
0
null
null
null
null
UTF-8
Java
false
false
366
java
package com.chandebois.repositories; import com.chandebois.entities.User; import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.stereotype.Repository; /** * Created by nonok on 08/06/2016. */ @Repository public interface UserRepository extends MongoRepository<User, String> { User findByNickName(String acs_test); }
[ "arnaud.chandebois@gmail.com" ]
arnaud.chandebois@gmail.com
8f65b53a477ebf24da0ff1e38031490a2d047b23
822e7f6744ae54d6405f11b75a01479849ee1ff5
/基础/Design pattern/Factory(工厂模式)/Factory1.3/src/com/ypy/dp/factory/Apple.java
653b8d2a2733aad54650ac1dd0f044a5f444a2c4
[]
no_license
dl-ypy/java
05c8c2fc21b460d33efa1e2e04a65993e7c71845
794be9fff1db12ca92d69b44c17f189a85e7c1dc
refs/heads/master
2021-05-05T18:12:24.688574
2019-03-15T07:45:01
2019-03-15T07:45:01
106,920,362
0
0
null
null
null
null
UTF-8
Java
false
false
132
java
package com.ypy.dp.factory; public class Apple extends Foot{ public void printName() { System.out.println("apple"); } }
[ "792015431@qq.com" ]
792015431@qq.com
ed068b629ba875e6fe2d78da04d8eafcf59e8b95
4b5abde75a6daab68699a9de89945d8bf583e1d0
/app-release-unsigned/sources/m/q.java
ab2be037e4377a8c07d937a1218b5ebee5d68325
[]
no_license
agustrinaldokurniawan/News_Android_Kotlin_Mobile_Apps
95d270d4fa2a47f599204477cb25bae7bee6e030
a1f2e186970cef9043458563437b9c691725bcb5
refs/heads/main
2023-07-03T01:03:22.307300
2021-08-08T10:47:00
2021-08-08T10:47:00
375,330,796
0
0
null
null
null
null
UTF-8
Java
false
false
419
java
package m; import h.a.t.a; import i.q.d; public final class q implements Runnable { public final /* synthetic */ d e; /* renamed from: f reason: collision with root package name */ public final /* synthetic */ Exception f3840f; public q(d dVar, Exception exc) { this.e = dVar; this.f3840f = exc; } public final void run() { a.z(this.e).a(a.n(this.f3840f)); } }
[ "agust.kurniawan@Agust-Rinaldo-Kurniawan.local" ]
agust.kurniawan@Agust-Rinaldo-Kurniawan.local
81d7a22888e9c1d66f20442c6f5e53d462bfea77
b315bd497fe338ef983634515e292a0a5cdddaf5
/app/src/main/java/com/tolaotesanya/healthpad/activities/MainActivity.java
2615565b961e5d31b5d835709d1840f27b7a5488
[]
no_license
TolaTess/HealthPad
265bbf08ae2d1119d01b02450e0149330349c5a3
ea3213088af821813e2720405ef59eb6b06b540c
refs/heads/master
2023-01-08T13:19:52.579800
2020-11-05T12:22:04
2020-11-05T12:22:04
265,553,131
0
0
null
null
null
null
UTF-8
Java
false
false
8,450
java
package com.tolaotesanya.healthpad.activities; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.TextView; import android.widget.Toast; import com.google.android.material.navigation.NavigationView; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.DatabaseReference; import com.google.firebase.database.ServerValue; import com.google.firebase.database.ValueEventListener; import com.squareup.picasso.Picasso; import com.tolaotesanya.healthpad.R; import com.tolaotesanya.healthpad.activities.auth.LoginActivity; import com.tolaotesanya.healthpad.coordinator.IntentPresenter; import com.tolaotesanya.healthpad.dependencies.DependencyRegistry; import com.tolaotesanya.healthpad.fragment.chat.ChatFragment; import com.tolaotesanya.healthpad.fragment.posts.PostsFragment; import com.tolaotesanya.healthpad.fragment.requests.RequestFragment; import com.tolaotesanya.healthpad.modellayer.database.FirebasePresenter; import com.tolaotesanya.healthpad.modellayer.enums.ClassName; import androidx.annotation.NonNull; import androidx.appcompat.app.ActionBarDrawerToggle; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; import androidx.core.view.GravityCompat; import androidx.drawerlayout.widget.DrawerLayout; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentTransaction; import de.hdodenhof.circleimageview.CircleImageView; public class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { private static final String TAG = "MainActivity"; private DrawerLayout drawerLayout; private NavigationView navigationView; private CircleImageView header_image; private TextView userNameView; private Menu menu; private String user_id; private PostsFragment homeFragment; //Injection private FirebasePresenter presenter; private IntentPresenter intentPresenter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); homeFragment = new PostsFragment(); FirebaseAuth mCurrentUser = FirebaseAuth.getInstance(); user_id = mCurrentUser.getCurrentUser().getUid(); attachDrawerNav(); DependencyRegistry.shared.inject(this); } public void configureWith(FirebasePresenter presenter, IntentPresenter intentPresenter) { this.presenter = presenter; this.intentPresenter = intentPresenter; onlineCheck(); } @Override protected void onStart() { Log.d(TAG, "onStart: "); super.onStart(); setFragment(homeFragment); navigationView.setNavigationItemSelectedListener(this); navigationView.setCheckedItem(R.id.nav_home); fetchData(header_image, userNameView, menu, user_id); } private void onlineCheck() { if (presenter.getMcurrent_user_id() != null) { presenter.getmUserDatabase().child(presenter.getMcurrent_user_id()) .child("online").setValue("true"); } } public void attachDrawerNav() { Log.d(TAG, "attachDrawerNav: "); Toolbar mToolbar = findViewById(R.id.main_page_toolbar); setSupportActionBar(mToolbar); this.getSupportActionBar().setTitle("Health Pad"); drawerLayout = findViewById(R.id.drawer_layout); navigationView = findViewById(R.id.nav_view); navigationView.bringToFront(); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawerLayout, mToolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawerLayout.addDrawerListener(toggle); toggle.syncState(); View navView = navigationView.getHeaderView(0); header_image = navView.findViewById(R.id.header_image); userNameView = navView.findViewById(R.id.header_name); menu = navigationView.getMenu(); } private void fetchData(final CircleImageView header_image, final TextView userNameView, final Menu menu, String user_id) { Log.d(TAG, "fetchData: "); Log.d(TAG, "attachDrawerNav: " + user_id); presenter.getmUserDatabase().child(user_id).addValueEventListener(new ValueEventListener() { @Override public void onDataChange(@NonNull DataSnapshot dataSnapshot) { if(dataSnapshot != null) { if (dataSnapshot.hasChild("user_type")) { String userType = dataSnapshot.child("user_type").getValue().toString(); if (userType.equals("doctor")) { menu.findItem(R.id.nav_request).setVisible(true); menu.findItem(R.id.nav_doctor).setVisible(false); } else { menu.findItem(R.id.nav_request).setVisible(false); menu.findItem(R.id.nav_doctor).setVisible(true); } } else { menu.findItem(R.id.nav_request).setVisible(false); menu.findItem(R.id.nav_doctor).setVisible(true); } if (dataSnapshot.hasChild("thumb_image")) { String username = dataSnapshot.child("name").getValue().toString(); String image = dataSnapshot.child("thumb_image").getValue().toString(); userNameView.setText(username); Picasso.get().load(image).placeholder(R.drawable.ic_launcher_foreground).into(header_image); } else { Toast.makeText(MainActivity.this, "Please load an image", Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(MainActivity.this, "Error Test", Toast.LENGTH_SHORT).show(); } } @Override public void onCancelled(@NonNull DatabaseError databaseError) { } }); } @Override public void onBackPressed() { if (drawerLayout.isDrawerOpen(GravityCompat.START)) { drawerLayout.closeDrawer(GravityCompat.START); } else { super.onBackPressed(); } } @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { switch (item.getItemId()) { case R.id.nav_home: setFragment(homeFragment); break; case R.id.nav_doctor: intentPresenter.presentIntent(MainActivity.this, ClassName.AllDoctors, null, null); break; case R.id.nav_account: intentPresenter.presentIntent(MainActivity.this, ClassName.Account, null, null); break; case R.id.nav_logout: FirebaseAuth.getInstance().signOut(); presenter.getmUserDatabase().child(presenter.getMcurrent_user_id()) .child("online").setValue(ServerValue.TIMESTAMP); Intent authIntent = new Intent(MainActivity.this, LoginActivity.class); startActivity(authIntent); finish(); //intentPresenter.presentIntent(MainActivity.this, ClassName.Auth, null, null); break; case R.id.nav_posts: intentPresenter.presentIntent(MainActivity.this, ClassName.Posts, null, null); break; case R.id.nav_chat: ChatFragment chatFragment = new ChatFragment(); setFragment(chatFragment); break; case R.id.nav_request: RequestFragment requestFragment = new RequestFragment(); setFragment(requestFragment); break; } drawerLayout.closeDrawer(GravityCompat.START); return true; } public void setFragment(Fragment fragment) { FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.fragment_cont, fragment); fragmentTransaction.commit(); } }
[ "x17131553@student.ncirl.ie" ]
x17131553@student.ncirl.ie
558f3bfce43475f3b4f396b47da448f53d79c68a
b99a301c114e57c5733c1150a1ecfc5091839d2b
/src/cs320/Midterm/CarAdmin.java
62461074a35c88e580d98583512b479fec01924b
[]
no_license
vibhank/web-programming
2313314d732ebb1d336061556c156df4bea384d4
5cf32832845e0b63b339c9c8421b9b1c3229550d
refs/heads/master
2021-01-20T17:19:30.018944
2016-06-29T04:39:48
2016-06-29T04:39:48
62,190,988
0
0
null
null
null
null
UTF-8
Java
false
false
6,478
java
package cs320.Midterm; import java.io.IOException; import java.io.PrintWriter; import java.util.ArrayList; import javax.servlet.ServletConfig; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @WebServlet("/Midterm/CarAdmin") public class CarAdmin extends HttpServlet { private static final long serialVersionUID = 1L; Integer addQA = 100; public CarAdmin() { super(); } public void init(ServletConfig config) throws ServletException { super.init(config); ArrayList<View> ViewList = new ArrayList<View>(); getServletContext().setAttribute("ViewList", ViewList); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { boolean isValidMake = true; boolean isValidModel = true; boolean isValidYear = true; boolean isValidSearch = true; ArrayList<View> ViewList = (ArrayList<View>) getServletContext().getAttribute("ViewList");//quoteList = ViewList response.setContentType("text/html"); PrintWriter out = response.getWriter(); out.println("<html>"); out.println("<head>"); out.println("<link rel=\"stylesheet\" href=\"https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css\">"); out.print("</head>"); out.println("<body class=\"bg-success\">"); out.println("<div class=\"page-header bg-warning text-primary\">"); out.println("<h1>"); out.println(" Car Administrator"); out.println("<small>CS320 Midterm</small>"); /*(shwetlana)*/ out.println(" </h1>"); out.println("</div>"); out.println("<form action='CarAdmin' method='post'>"); out.println("<table class= \"table table-bordered\">"); // Was the name parameter submitted? If so, let's validate it! if( request.getParameter("Make") != null ){ if (request.getParameter("Make").trim().length() == 0) isValidMake = false; } // Was the name parameter submitted? If so, let's validate it! if( request.getParameter("Model") != null ){ if (request.getParameter("Model").trim().length() == 0) isValidModel = false; } if( request.getParameter("Year") != null ){ if (request.getParameter("Year").trim().length() == 0) isValidYear = false; } if( request.getParameter("Year") != null){ try{ int temp = Integer.parseInt(request.getParameter("Year")); }catch(Exception e){ isValidYear = false; } if(request.getParameter("Year").matches("^([0-9]{4})") != true){ isValidYear = false; } } out.println("</table>"); if (!isValidMake) out.println("<p class=\"text-danger\">Enter a valid Make</p>"); out.println("<p>MAKE: </p>"); out.print(" <input name=\"Make\" "); if (request.getParameter("Make") != null && isValidMake) out.print(" value=\"" + request.getParameter("Make") + "\" "); out.println(" type=\"text\" class=\"form-control\" placeholder=\"Make\"><br />"); if (!isValidModel) out.println(" <p class=\"text-danger\">Enter a valid Model</p>"); out.println("<p>Model: </p>"); out.print(" <input name=\"Model\" "); if (request.getParameter("Model") != null && isValidModel) out.print(" value=\"" + request.getParameter("Model") + "\" "); out.println(" type=\"text\" class=\"form-control\" placeholder=\"Model\"><br />"); if (!isValidYear) out.println(" <p class=\"text-danger\">Enter a valid Year</p>"); out.println("<p>YEAR: </p>"); out.print(" <input name=\"Year\" "); if (request.getParameter("Year") != null && isValidYear) out.print(" value=\"" + request.getParameter("Year") + "\" "); out.println(" type=\"text\" class=\"form-control\" placeholder=\"Year\"><br />"); out.println("<input type='submit' name='add' value='Add' />"); out.println("<br><br>"); out.println("</form>"); /*To Search*/ out.println("<form action=\"CarAdmin\" method=\"post\">"); out.println("<div class=\"page-header bg-warning text-primary\">"); out.println("<h1>"); out.println("Search Form"); out.println(" </h1>"); out.println("</div>"); out.print(" <input name=\"Search\" "); //if (request.getParameter("") != null){ //if((request.getParameter("Search")==request.getParameter("Make")) ||(request.getParameter("Search")==request.getParameter("Model")) || (request.getParameter("Search")==request.getParameter("Year"))) out.println(" type=\"text\" class=\"form-control\" placeholder=\"Search\"><br />"); out.print(" <input name=\"dropdown\" "); out.println("<select>"); out.println("<option>"+request.getParameter("Year")+"</option>"); out.println("</select>"); out.println(" <input type=\"submit\" class=\"btn btn-primary\" value=\"Search\">"); //} out.println("</form>"); /*Remove Link*/ out.println("<form action='CarAdmin' method='post'>"); out.println("<table class= \"table table-bordered\">"); out.println("<tr><th>MAKE</th><th>MODEL</th><th>YEAR</th><th>Remove Link</th></tr>"); out.println("<div class=\"page-header bg-warning text-primary\">"); out.println("<h1>Form to Remove</h1>"); out.println("</div>"); for(int i=0;i<ViewList.size();i++){ out.println("<tr><td>"+ViewList.get(i).getMake()+"</td>"); out.println("<td>"+ViewList.get(i).getModel()+"</td>"); out.println("<td>"+ViewList.get(i).getYear()+"</td>"); out.println("<td><a href='Remove?id="+ViewList.get(i).getId()+"'>Delete</a></td></tr>"); } out.println("</form>"); out.println("</body>"); out.println("</html>"); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String Make = request.getParameter("Make"); String Model = request.getParameter("Model"); String Year = request.getParameter("Year"); response.setContentType("text/html"); PrintWriter out = response.getWriter(); ArrayList<View> ViewList = (ArrayList<View>) getServletContext().getAttribute("ViewList"); if(Make!=null && Model!=null && Year!=null && !Make.isEmpty() && !Model.isEmpty() && !Year.isEmpty()){ ViewList.add(new View(addQA++,Make, Model, Year)); response.sendRedirect("CarAdmin"); } else { doGet(request, response); } } }
[ "vibhank@gmail.com" ]
vibhank@gmail.com
72ec865d6f64e5c944417211f29b7d1bfe12eb0c
29673151c2a3c38263b54a94a21032cf68e778cc
/src/main/java/com/skitchina/mapper/SubmitMapper.java
1d3d787fc9dfc7d5a062f8c2614a393dc0bd84d3
[]
no_license
humengstark/skitchina
41af8c50d7b9fee895785a30d6dd5be19e8b2fac
bdc6f7906fd5bcb6a389bbd15f653acd41019f0d
refs/heads/master
2021-01-02T08:59:28.094596
2017-11-02T16:15:24
2017-11-02T16:15:24
92,722,428
0
0
null
null
null
null
UTF-8
Java
false
false
783
java
package com.skitchina.mapper; import com.skitchina.model.Submit; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Select; import java.util.List; import java.util.Map; /** * Created by hu meng on 2017/4/25. */ public interface SubmitMapper { //查找所有Submit @Select("SELECT*FROM submit ORDER BY time4 DESC LIMIT #{m},#{rows}") List<Submit> getAllSubmits(Map params); //add submit @Insert("INSERT INTO submit (user2_id,achievement,time4,name,freight,price,freightandprice) VALUES (#{user2_id},#{achievement},#{time4},#{name},#{freight},#{price},#{freightandprice})") void addSubmit(Map params); //根据user_id查询submit @Select("SELECT*FROM submit WHERE id=#{id}") Submit getSubmitById(int id); }
[ "humengstark@foxmail.com" ]
humengstark@foxmail.com