blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
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
689M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
131 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
5a836637e49de8b62dc40ab38d52fad184259625
5f512f041984cbc73c3389ad68121f4edb03b19a
/src/main/java/kys/study/ProjectEuler/Problem003.java
e471d725ad0d3d6344984edb994313769e11d059
[]
no_license
KimYongSung/projectEuler
b0fe62201cf91a08733f81df4280c26952be7c4d
6640458729f484b7cf04fd6391d051adcd4ddbf5
refs/heads/master
2021-01-17T15:55:01.083727
2016-06-13T03:54:27
2016-06-13T03:54:27
59,537,765
2
0
null
null
null
null
UTF-8
Java
false
false
829
java
package kys.study.ProjectEuler; /** * <pre> * 어떤 수를 소수의 곱으로만 나타내는 것을 소인수분해라 하고, 이 소수들을 그 수의 소인수라고 합니다. * 예를 들면 13195의 소인수는 5, 7, 13, 29 입니다. * 600851475143의 소인수 중에서 가장 큰 수를 구하세요. * </pre> * @author kim * */ public class Problem003 { public void problem3(long num){ checkInsu(num); System.out.println(checkInsu(num)); } public Long checkInsu(long num){ long insu = 0; boolean insuFlag = false; for(long i = 2; i<num ;i++){ if(num%i==0){ insu = i; insuFlag = true; break; } } long nextNum = 0; if(insuFlag) nextNum = num/insu; else insu = num; return nextNum == 0 ? insu : checkInsu(nextNum); } }
4d23ef5d63b16ffa5ff64f87340b206375546ac7
79b933ae2cf12e2e6776231fbc1971f70358cd87
/src/main/java/com/indihx/comm/InitSysConstants.java
cf86efb429533157ed94ae26ebf74be24940754d
[]
no_license
svcgv/vote
4e41338495acf89e9791d91e6e8d2ee312a07a8e
c84b5245eef2be369ef6be54e34fe28b2f9bf58a
refs/heads/master
2020-04-01T22:55:44.931246
2018-11-30T10:46:15
2018-11-30T10:46:15
153,733,177
1
1
null
null
null
null
UTF-8
Java
false
false
5,208
java
/** * */ package com.indihx.comm; /** * <p>标 题: 物业管理信息系统(PMS)</p> * <p>描 述: 系统内公共常量定义</p> * <p>版 权: Copyright (c) 2018 </p> * <p>公 司: 上海泓智信息科技有限公司</p> * <p>创建时间: 2018年2月9日下午2:25:43</p> * <p>@author zhengwei</p> * <p>@version 1.0</p> * <p>InitSysConstants.java</p> * <p>用于定义系统全局常量</p> */ public class InitSysConstants { //系统全局session名 public final static String USER_SESSION="PMS_USER"; /*市局机构ID*/ public final static String OrgIdShiJu ="1000";//市局ID /*机构类型-与字典值对应*/ public final static String ORGTYPE_SHIJU ="01";//市局 public final static String ORGTYPE_QUJU ="02";//区局 public final static String ORGTYPE_JIEDAO ="03";//街道办 public final static String ORGTYPE_JUWEIHUI ="04";//居委会 public final static String ORGTYPE_WYGS ="05";//物业公司 public final static String ORGTYPE_YZDH ="06";//业主大会 /*系统角色-与系统Role配置值对应(之后有改动统一再此修改与表中一致--有新增的或不同的,不能改变以上的值只能增加)*/ public final static String ROLE_CMD ="999";//系统管理员 public final static String ROLE_SHIJU ="1000";//市局 public final static String ROLE_QUJU ="1001";//区局 public final static String ROLE_JIEDAO ="1002";//街道办 public final static String ROLE_JUWEIHUI ="1003";//居委会 public final static String ROLE_WYGS ="1004";//物业公司 /*数据状态*/ public final static String DATA_ZhengChang ="00";//正常---正式表中有效数据 public final static String DATA_ZhanCun ="01";//暂存---流程中的过程数据-一般存在于临时或副本表中 public final static String DATA_YiZhuXiao ="04";//已注销----正式表中无效数据 public final static String DATA_XiuGaiZhong ="02";//修改中----正式表中数据正在修改申请(此类数据不能再次发起修改和删除流程) public final static String DATA_ShanChuZhong ="03";//删除中----正式表中数据正在删除/注销申请(此类数据不能再次发起修改和删除流程) /*机构状态-与字典值对应*/ public final static String ORG_STATUS_ZhengChangShiYong ="0"; public final static String ORG_STATUS_JinYogn ="1"; public final static String ORG_STATUS_YiZhuXiao ="2"; /*人员类型-与字典值对应*/ public final static String USER_TYPE_XMJL ="01"; /*数据状态-与字典值对应*/ public final static String INFO_STATUS_ZhegnChang ="00"; public final static String INFO_STATUS_ZanCun ="01"; public final static String INFO_STATUS_XiuGaiZhong ="02"; public final static String INFO_STATUS_ShanChuZhong ="03"; public final static String INFO_STATUS_YiZhuXiao ="04"; /*证件类型-与字典值对应*/ public final static String CERTTYPE_SFZ ="1"; /*性别-与字典值对应*/ public final static String SEXTYPE_NAN ="1"; public final static String SEXTYPE_NV ="2"; /*文化程度-与字典值对应*/ public final static String EDUCATION_ChuZhong ="1"; public final static String EDUCATION_GaoZhong ="2"; public final static String EDUCATION_DaZhuan ="3"; public final static String EDUCATION_BenKe ="4"; public final static String EDUCATION_ShuoShiYanJiuSheng ="5"; public final static String EDUCATION_BoShiYanJiuSheng ="6"; /*诚信指标类型-与字典值对应*/ public final static String CreditQuotaKind_LH ="01";//良好信息 public final static String CreditQuotaKind_BL ="02";//不良信息 /*电子表决结果-与字典值对应*/ public final static String VoteResult_TY ="01";//同意 public final static String VoteResult_BTY="02";//不同意 public final static String VoteResult_QQ ="03";//弃权 /*电子表决方式-与字典值对应*/ public final static String VoteWays_DZBJ ="01";//电子表决 public final static String VoteWays_SDBL ="02";//手动补录 /*电子表决状态-与字典值对应*/ //public final static String VoteStatus_ZhiDingBiaoJueYiTi ="01";//拟制表决议题 public final static String VoteStatus_QueDingBiaoJueFanWei ="01";//待确定表决范围 public final static String VoteStatus_GuanLianFenHu = "02";//已关联分户 public final static String VoteStatus_BiaoJueZhong ="03";//表决中 public final static String VoteStatus_BiaoJueWanJie ="04";//表决完结 //public final static String VoteStatus_ZhuXiao ="05";//已注销 public final static String VOTE_EFFECTIVE = "00"; //有效 public final static String Vote_NONEFFECTIVE = "01"; //无效 public final static String WsStatus_ZhengChang = "00"; /*微信公众号相关参数, 放到PARAMS_INFO表里*/ //public final static String TOKEN = "11111111"; //public final static String APPID = "wx0faa55f1a53f29c5"; //public final static String SECRET = "a9a586b82bfb51e89a35a51a443d517f"; /*定义一个页面size*/ public final static int BIG_SIZE = 20; public final static int MIDDLE_SIZE = 10; public final static int SMALL_SIZE = 5; //投票系统身份证上传路径 public final static String CERT_PATH = "d:/vote/idcard/"; }
384455eee5943158ea0a1691b84fc47a8f965d4b
d93ee7c862a0aced3da0af09729219172b238da4
/app/src/main/java/com/nowa/com/utils/UserInformationDialog.java
eaa92765a337571b19234f87ea0aa62d2472bc1b
[]
no_license
Maychell/NowA
47246e57d5992196312d2849e4723dca9ebffdfe
d8d77b41a18fc8d67501a9ad43978363dc4623d9
refs/heads/master
2021-01-10T16:16:23.122545
2015-11-30T15:54:25
2015-11-30T15:54:25
44,057,374
0
1
null
null
null
null
UTF-8
Java
false
false
2,981
java
package com.nowa.com.utils; import android.app.ActionBar; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.content.Context; import android.content.DialogInterface; import android.os.Bundle; import android.support.annotation.Nullable; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import com.nowa.R; import com.nowa.com.domain.User; /** * Created by maychellfernandesdeoliveira on 14/10/2015. */ public class UserInformationDialog extends DialogFragment { private EditText input; private User user; private Context ctx; public UserInformationDialog(Context ctx, User user) { this.ctx=ctx; this.user=user; } @Nullable @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //LayoutInflater inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.dialog_user_information, null); getDialog().setTitle("Perfil do usuário"); CustomViewHolder viewHolder = new CustomViewHolder(view); viewHolder.userName.setText(user.getName()); viewHolder.course.setText(user.getCourse()); viewHolder.registerNumber.setText(user.getRegisterNumber()); viewHolder.loginUser.setText(user.getLogin()); viewHolder.email.setText(user.getEmail()); viewHolder.description.setText(user.getDescription()); // if button is clicked, close the custom dialog viewHolder.btnClose.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { getDialog().dismiss(); } }); return view; } public class CustomViewHolder extends RecyclerView.ViewHolder { protected ImageView imageView; protected TextView userName, course, registerNumber, loginUser, email, description; protected Button btnClose; public CustomViewHolder(View view) { super(view); this.imageView = (ImageView) view.findViewById(R.id.thumbnail); this.userName = (TextView) view.findViewById(R.id.txt_user_name); this.course = (TextView) view.findViewById(R.id.txt_course); this.registerNumber = (TextView) view.findViewById(R.id.txt_register_number); this.loginUser = (TextView) view.findViewById(R.id.txt_user); this.email = (TextView) view.findViewById(R.id.txt_email); this.description = (TextView) view.findViewById(R.id.txt_description); this.btnClose = (Button) view.findViewById(R.id.btn_close); } } }
5a88c5a315d873f7387a65e2b22da2a9da2b7caf
0f8e1e61cc2dd58a41ed6b4f97153e514a28d685
/source/Help.java
466ecb36065102e6b107f4434657e80588d67d9b
[]
no_license
rrdbn4/CS5405Project
16e31c785f44b135796211cf7e79b0341841c61e
c7921bb4d2bdd0ab4daa58496fdd795942b34ff9
refs/heads/master
2020-05-20T12:04:30.662585
2014-12-01T04:33:54
2014-12-01T04:33:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,434
java
/** * @author Matthew Lindner, Holly Busken, Robert Dunn * @version 1.0 * Class that provides some useful help about using our program. * Text area is contained in jScrollPane, which is placed inside JInternal Frame. */ package code; import javax.swing.*; public class Help extends JInternalFrame { /** * Text box that will contain the help information. */ private JTextArea textArea; /** * Scroll Pane for the text area. */ JScrollPane scrollPane; /** * The default width and height of the JInternalFrame */ private int width = 980; private int height = 500; public Help() { super("Help", true, true, true, true); setBounds(0, 10, width, height); textArea = new JTextArea("About Menu:\n" + "\tAuthors - The names of each group member, their emails, and instructions on how to execute the application.\n" + "\tProblem Description - Condensed text description of the assignment.\n" + "\tHelp - This window, explains the functionality of this program.\n" + "\tReferences - Citations of any outside help any group memeber may have used to complete this project.\n\n" + "Demos:\n" + "\tSelect a sort, and it will immediatly begin sorting. Helpful if the user does not understand what a sort does, or how various sorts operate differntly.\n\n" + "MultiTasking:\n" + "\tAllows user to select multiple sorts. Once the user has picked their sorts, he or she should click the \"Start\" button. This allows the user to compare the speed of differnt sorts.\n\n" + "Clock:\n" + "\tThe current time. Helpful if the user wants to time a sort.\n\n" + "Start/Stop - Either starts or stops all open sorts.\n" + "Pause/Resume - Either pauses or resumes all open sorts.\n" + "Speed - adjust the speed of all open sorts.\n" + "Number of Elements - Changes the number of elemnts all open sorts have to process. The user is required to press \"Start\" after changing the number of elemenmts."); /** * The help text is read only. */ textArea.setEditable(false); /** * If the width of the text area is not big enough to accommodate each sentence, the words will wrap to the next line. */ textArea.setLineWrap(true); textArea.setWrapStyleWord(true); /** * Create the scroll pane object, add the text area */ scrollPane = new JScrollPane(textArea); /** * Add the scroll pane to the JPanel */ add(scrollPane); } }
611e7daa5a1a6066ce6da866e46c2b86c9fa14dc
6ead167a3fe3a3f3bec59a868c2bf2fe938417b5
/design_pattern/Adapter_pattern/src/main/java/iterenum/EnumerationIteratorTestDrive.java
942551c8e02a8914d6bc9dafc57485d8f30a17df
[]
no_license
LanceDai/learn
67b62bbd1222f98eaa0f5d7bd6218d729967dbf3
8c23f15546082e2563f10151eabf7afabd76514d
refs/heads/master
2022-07-30T22:25:10.571509
2019-09-11T09:14:40
2019-09-11T09:14:40
150,918,963
3
2
null
2022-06-21T00:51:35
2018-09-30T01:49:07
Java
UTF-8
Java
false
false
333
java
package iterenum; import java.util.*; public class EnumerationIteratorTestDrive { public static void main (String args[]) { Vector<String> v = new Vector<String>(Arrays.asList(args)); Iterator<?> iterator = new EnumerationIterator(v.elements()); while (iterator.hasNext()) { System.out.println(iterator.next()); } } }
7dbb34edb111579506a4453e1cdf3dfb94052bfd
72c3eb7e5098874a225ed3e8a8b17e634c6b51f3
/src/com/antree/service/AtDictionaryService.java
e7c0db06cecd9b3c88f9daecb7f582327e9a4e47
[]
no_license
xhuanghun/antree
cdfbc156ebaca791f088ef0784685a4df4975844
a295f82b723e048cbbefdd67e92e14be5d9f57c7
refs/heads/master
2020-07-09T08:27:57.982991
2016-11-18T14:18:17
2016-11-18T14:18:17
74,018,387
0
0
null
null
null
null
UTF-8
Java
false
false
825
java
package com.antree.service; import java.util.List; import org.apache.log4j.Logger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.antree.bean.AtDictionary; import com.antree.mapper.AtDictionaryMapper; import com.antree.model.AtDictionaryModel;; /** * * <br> * <b>功能:</b>AtDictionaryService<br> * <b>作者:</b>黄贵群<br> * <b>日期:</b> <br> * <b>版权所有:<b>版权所有(C)<br> */ @Service("atDictionaryService") public class AtDictionaryService<T> extends BaseService<T> { private final static Logger log= Logger.getLogger(AtDictionaryService.class); @Autowired private AtDictionaryMapper<T> mapper; public AtDictionaryMapper<T> getMapper() { return mapper; } }
68c4f7dc968314f3794f6e5b95f4356bfebbb558
fe853e76a7b8a63dd2ac84384bb50c96a7c2daea
/src/by/teachmeskills/lesson5/Passenger.java
9b8dd22e85715c89eb87d66ee1c55bed900b1341
[]
no_license
olya807/TMS_Java_Core
f5eecefd37d306565ae8ee7a4c807742d6bd5365
5d4f801d9370676cfeb1f8b33b5b527c9d668cad
refs/heads/master
2023-05-05T15:46:45.712025
2021-05-30T14:34:59
2021-05-30T14:34:59
360,301,325
0
0
null
2021-07-28T20:34:52
2021-04-21T20:43:52
Java
UTF-8
Java
false
false
732
java
package by.teachmeskills.lesson5; public class Passenger extends Ground { String bodyType; int passengersAmount; int distance; public String characteristics() { return String.format("Body type is %s.\r\nPassengers amount is %s.\r\nOutput value is %s kW.", bodyType, passengersAmount, output()); } public void kilometersAmount(int time) { distance = time * maxSpeed; System.out.printf("During %s hour(s) the car %s moving %s km/h will cover %s km and consume %s l of fuel.", time, model, maxSpeed, distance, fuelConsumption(distance)); } private int fuelConsumption(int distance) { return distance / 100 * fuelConsumption; } }
b86510eb7b11fde0fa073be2a18cf49a58d530f7
72dc90052ed2c6d5c317cdde3813d2aca599ac17
/app/src/main/java/a00267320/ait/com/androidacc/Constants.java
938a9653f199f43fed8291fb8e6c2944bea5b071
[]
no_license
charuag3/Human-Activity-App
8fdfa77f904bc43bb959463095b7220bf7f540f3
9c55e1768cef3eeae163867d29f3a0d7d29a6873
refs/heads/master
2020-05-23T19:18:24.675535
2019-05-15T22:06:16
2019-05-15T22:06:16
186,909,072
0
0
null
null
null
null
UTF-8
Java
false
false
414
java
package a00267320.ait.com.androidacc; public class Constants { public static final String X_COOR = "x-coor"; public static final String Y_COOR = "y-coor"; public static final String Z_COOR = "z-coor"; public static final String X_AXIS = "x-axis"; public static final String Y_AXIS = "y-axis"; public static final String Z_AXIS = "z-axis"; public static final String TIME = "time"; }
0a114369f29315002f66b8a9af095282d221e90a
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/32/32_8448c5594ad2a0047f6abb3cd4319831bba992d5/NFAFactoryTest/32_8448c5594ad2a0047f6abb3cd4319831bba992d5_NFAFactoryTest_t.java
7d4faeb6426d7e73f27c2c8a32c0c185bc4009b2
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
1,935
java
package Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; import org.junit.Before; import org.junit.Test; import Generator.NFA.NFA; import Generator.NFA.NFAFactory; import Generator.NFA.NFASimulator; import Generator.Token.op_code; public class NFAFactoryTest { NFASimulator NFASim; NFAFactory Factory; @Before public void setUp() throws Exception { NFASim = new NFASimulator(); Factory = new NFAFactory(); } //@Test public void testEpsilon() { NFA epsNFA = NFA.EpsilonNFA(); epsNFA = Factory.build("$NULL ()()()()()*||||a"); //System.out.println(epsNFA); assertEquals("a", NFASim.parse(epsNFA, "a").token); assertEquals("Failed", NFASim.parse(epsNFA, " ").token); } //@Test public void testSample() { NFA test = Factory.build("$TEST (1)(2)*(3)(4|5|6)+(|^-)"); //System.out.println(test); assertEquals("135", NFASim.parse(test, "135").token); assertEquals("1223654^-", NFASim.parse(test, "1223654^-").token); assertEquals("1223654", NFASim.parse(test, "1223654").token); assertEquals("13555^-", NFASim.parse(test, "13555^-").token); test = Factory.build("$TEST \\[(\\ )*\\]"); String code = "[ ]"; assertEquals(code, NFASim.parse(test, code).token); code = "[ ]"; assertEquals(code, NFASim.parse(test, code).token); } @Test public void testAddMultExpr() { NFA test = Factory.build("$TEST (0|1|2|3|4|5|6|7|8|9)+(\\ |((\\+|\\*)(\\ )*(0|1|2|3|4|5|6|7|8|9)+)*)*"); String code = "12 + 56 + 78 * 9"; System.out.println(NFASim.parse(test, code)); assertEquals(code, NFASim.parse(test, code).token); } @Test public void testDoubleStar() { NFA test = Factory.build("$TEST (a|()*)*"); System.out.println(test); String code = "aaaaaa"; System.out.println(NFASim.parse(test, code)); assertEquals(code, NFASim.parse(test, code).token); } }
e5f229cf7454b64c6172900be57b3052cd0b4ea5
80233b58934b1dc51e79bb60f535d9ad466a127d
/src/main/java/student/demo/service/UserService.java
31de5b1e3ed711f85443bf7829effdd1d70b2628
[]
no_license
aaaron769/SpringBoot_MySql_db
d9530c7373de333d67ad7fd55902a2744a30c281
18899925bb31e40dfe1b9b934f4781322d8b8699
refs/heads/master
2020-05-29T11:24:43.807145
2019-05-28T23:16:36
2019-05-28T23:16:36
189,115,503
0
0
null
null
null
null
UTF-8
Java
false
false
928
java
package student.demo.service; import java.util.List; import javax.transaction.Transactional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.stereotype.Service; import student.demo.models.User; @Service("userService") public class UserService { @Autowired @Qualifier("userDao") private UserDao userDao; @Transactional public User getUserById(long userId) { return userDao.selectUserById(userId); } @Transactional public void addUser(User user) { userDao.insertUser(user); } @Transactional public void modifyUser(User user) { userDao.updateUser(user); } @Transactional public void removeUser(long userId) { userDao.deleteUser(userId); } public List<User> getAllUsers() { return userDao.getAllUsers(); } }
e3b156f735f4edb2a2e4ac82f4a99652b0716c2e
8b854582c73db1e5546bd92b83e8c1be55bc42f8
/StrangeCounter.java
4687fac71eaeb5a87d3b72590817e17157dfbd6d
[]
no_license
slvslv42/surendran
fa7a9d40e3d61289e2386fd57c87d0e11549a986
75987f890e7d876a1577948e9642ebf0c90d47f4
refs/heads/master
2021-01-11T05:41:02.581731
2017-07-13T13:39:17
2017-07-13T13:39:17
71,537,153
0
0
null
null
null
null
UTF-8
Java
false
false
384
java
import java.util.Scanner; public class StrangeCounter { public static void main(String arg[]) { Scanner in=new Scanner(System.in); int t=in.nextInt(); in.close(); int val=3; int ref=val; for(int i=1;i<=t;i++) { if(i==t) break; if(val==1) { val=ref*2; ref=val; } else val--; } System.out.println(val); } }
9bef728a0fae97896dae56b25d2e20ef72f9d642
da4816fcdbb2895366672877fcac813101f73aab
/src/main/java/io/renren/modules/app/entity/DynamicSqlEntity.java
00bfa481315e53888f2c41c73fa4a9966e1f45a1
[]
no_license
guangyinren/bld-web
0ca0d1b8d6c1b4cdc8f45a79e57148df0038df04
209a456f9c53e9d6c7f74b0f96bd5a6ec8790a38
refs/heads/master
2020-04-11T18:00:00.300476
2018-12-16T08:40:18
2018-12-16T08:40:18
161,982,348
0
0
null
2018-12-16T08:34:21
2018-12-16T08:34:21
null
UTF-8
Java
false
false
663
java
package io.renren.modules.app.entity; import com.baomidou.mybatisplus.annotations.TableId; import com.baomidou.mybatisplus.annotations.TableName; import java.io.Serializable; import java.util.Date; /** * * * @author lhc * @email * @date 2018-11-11 13:01:55 */ @TableName("dynamic_sql") public class DynamicSqlEntity implements Serializable { private static final long serialVersionUID = 1L; /** * */ @TableId private String dynamicSqlId; /** * 设置: */ public void setDynamicSqlId(String dynamicSqlId) { this.dynamicSqlId = dynamicSqlId; } /** * 获取: */ public String getDynamicSqlId() { return dynamicSqlId; } }
cbd30c6a3cf6042f2d76ea3e2dbd23dcd5a12408
9af7ff6b77b9e1aac67d7cf9f49b695511d94310
/StandardProductRepositoryBySQL2.3/src/DBSystem/TypeDB.java
ab9290009e498ae7a4db4453cc8adb56686c50a2
[]
no_license
zjmeixinyanzhi/MultipleDatacenterCollaborativeProcessSystem
bc5e30d27d23b0d1455207eddf90b63f1b2c9939
36e28e145eff16d9f7c80c5c5af684aac4f5370a
refs/heads/master
2021-01-09T21:55:31.022679
2017-04-05T14:00:26
2017-04-05T14:00:26
54,820,368
0
0
null
null
null
null
UTF-8
Java
false
false
1,901
java
package DBSystem; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; public class TypeDB { private static Connection conn = null; private static DBConn dbcommCommon = null; public String dbTable = null; public TypeDB(String ip, String port, String mccps_sid ,String user, String passwd, String dbTable){ this.dbcommCommon = new DBConn(ip, port, mccps_sid, user, passwd); //初始化数据库 if(null == conn){ conn = dbcommCommon.getConnection(); if(conn == null){ dbcommCommon.bIsConnection = false; } else{ dbcommCommon.bIsConnection = true; } } this.dbTable = dbTable; } public int getTypeId(String Name){ int id = -1; System.out.println("Sp_typeDB::public int getSp_typeId(String Name) | 返回Sp_typeID"); try { String StrSql = "SELECT * FROM " + this.dbTable + " where Name=?"; if(null == conn){ return -1; } PreparedStatement pstmt = conn.prepareStatement(StrSql); pstmt.setString(1, Name); //execute select ResultSet rs = pstmt.executeQuery(); while (rs.next()) { id = rs.getInt("Id"); } } catch (SQLException e) { String strSqlState = e.getSQLState(); if (strSqlState.equals("08S01")) { conn = dbcommCommon.getConnection(); return getTypeId(Name); } e.printStackTrace(); return -1; } return id; } public static synchronized void closeConnected() { try { if (null != conn) { conn.close(); conn = null; } } catch (SQLException e) { e.printStackTrace(); } } public static void main(String args[]){ TypeDB typeDB = new TypeDB("10.3.10.1", "3306", "RSProductDB", "mca", "mca", "sp_type"); // 10.3.10.1_3306_mccps_mca_mca_RSProductDB int SpTypeId = typeDB.getTypeId("FY3AMERSI"); System.out.println(SpTypeId); } }
58b32b97911aa90fb3b1a68d102f34b474551f09
18917afa2ff8bc420c1f9e1ab07bce7da8faebaa
/app/src/main/java/lorena/u3b_a15lorenaae/dialogo_mensaje.java
3911c4dafe125bf858eed4a1d6cc04f3e602f625
[]
no_license
a15lorenaae/U3b_a15lorenaae
6d1618f492e7563760051a10d306e5ec6a04491a
9f8e3ea99c12d7c6261ffa472d129d3eb5d5e36c
refs/heads/master
2021-01-10T14:41:31.406432
2015-10-12T16:48:30
2015-10-12T16:48:30
44,120,817
0
0
null
null
null
null
UTF-8
Java
false
false
652
java
package lorena.u3b_a15lorenaae; import android.app.AlertDialog; import android.app.Dialog; import android.app.DialogFragment; import android.os.Bundle; /** * Created by Lorena on 12/10/2015. */ public class dialogo_mensaje extends DialogFragment{ @Override public Dialog onCreateDialog(Bundle savedInstanceState){ AlertDialog.Builder builder=new AlertDialog.Builder(getActivity()) .setTitle("Atención") .setMessage("Nova mensaxe. Preme o botón 'Back' para volver a pantalla principal") .setIcon(android.R.drawable.ic_dialog_info); return builder.create(); } }
2039cbaf8d96d176758700a9113f4a69d7a3db27
a518079335bc9ac23a4ec633a386589df25f0725
/robot_components/gun/PowerManual.java
35e1694c0705f6455388d6e02e2c95f972cec708
[ "MIT" ]
permissive
John-Paul-R/ModularBot-for-Robocode
df5c0cf3da383ba6f2910f9655c55f62837b5a9c
ed2700603bc5360bda82bd3022753930bcf98a0b
refs/heads/master
2020-03-20T22:04:31.646839
2018-06-19T18:31:25
2018-06-19T18:31:25
137,777,794
0
0
null
null
null
null
UTF-8
Java
false
false
720
java
package robot_components.gun; import robot_components.data_management.Bot; import robot_components.data_management.BotState; import robot_components.data_management.DataManager; import robot_components.data_management.Enemy; public class PowerManual extends BulletPowerSelector { private double _bulletPower; public PowerManual(DataManager data) { super(data); _bulletPower = 2; } public PowerManual(DataManager data, double power) { super(data); _bulletPower = power; } public void setPower(double power) { _bulletPower = power; } @Override public double getPower(Enemy target) { return _bulletPower; } @Override public double getPower(BotState target) { return _bulletPower; } }
63c7caf2738a3b4a41655ee1ae93c9990345b744
b252fe014d02556fc410fb067c6b280bb2140120
/1.5/tests/org.eclipse.epf.diagram.tests/src/org/eclipse/epf/diagram/tests/DiagramTests.java
89838cc29ab10f0ae92778d0dae1f41d13e18fbe
[]
no_license
cvgaviao/EPF-Composer
1f981801aa4941ea49feb927562151d65b52d989
cbac2164b90995dea18716f02587f21cf8c48932
refs/heads/master
2021-01-10T22:02:19.130973
2013-09-26T18:00:01
2013-09-26T18:00:01
4,354,385
0
4
null
null
null
null
UTF-8
Java
false
false
980
java
//------------------------------------------------------------------------------ // Copyright (c) 2005, 2006 IBM Corporation and others. // All rights reserved. This program and the accompanying materials // are made available under the terms of the Eclipse Public License v1.0 // which accompanies this distribution, and is available at // http://www.eclipse.org/legal/epl-v10.html // // Contributors: // IBM Corporation - initial implementation //------------------------------------------------------------------------------ package org.eclipse.epf.diagram.tests; import junit.framework.Test; import junit.framework.TestSuite; /** * JUnit test suite for org.eclipse.epf.diagram. * * @author Shilpa Toraskar * @since 1.2 */ public class DiagramTests { public static Test suite() { TestSuite suite = new TestSuite(DiagramTests.class.getPackage().getName()); //$JUnit-BEGIN$ suite.addTestSuite(DiagramUIServiceTest.class); //$JUnit-END$ return suite; } }
[ "klow" ]
klow
7b224b53c65153beeceb105aee1ba061e2e4a09e
90242be3c27000754c1fad40dca888e92b6c082f
/backend/src/main/java/pl/edu/pw/elka/tin/spy/spyweb/application/UserController.java
c93ef13abf2f44ab282b774023430f6de1549ed4
[]
no_license
wjanaszek/spyweb
df8ae18bc0a06a0f410f545f669f30258d9e3f8f
a5d59ff4b6caf3d31816df96f96986d3225f044c
refs/heads/master
2020-03-14T17:13:44.628843
2018-05-23T21:50:52
2018-05-23T21:50:52
131,714,632
0
0
null
null
null
null
UTF-8
Java
false
false
1,616
java
package pl.edu.pw.elka.tin.spy.spyweb.application; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; import pl.edu.pw.elka.tin.spy.spyweb.application.domain.*; import pl.edu.pw.elka.tin.spy.spyweb.application.exception.ResourceNotFoundException; import pl.edu.pw.elka.tin.spy.spyweb.utils.RestPreconditions; import java.util.Date; import java.util.List; @RestController @CrossOrigin @RequestMapping("/api/users") @Slf4j class UserController { @Autowired private UserRepository userRepository; @Autowired private TaskRepository taskRepository; @GetMapping @ResponseBody @ResponseStatus(HttpStatus.OK) public List<User> getAllUsers() { return userRepository.findAll(); } @PostMapping("/{id}") @ResponseStatus(HttpStatus.CREATED) public Task addTaskToUser(@PathVariable Integer id) throws ResourceNotFoundException { User user = userRepository.findById(id) .orElseThrow(ResourceNotFoundException::new); Task task = new Task(user); log.info("Creating task " + task.toString() + " for user " + user.toString()); return this.taskRepository.save(task); } @GetMapping("/{id}") @ResponseBody @ResponseStatus(HttpStatus.OK) public User getUser(@PathVariable Integer id) throws ResourceNotFoundException { return RestPreconditions.checkFound(this.userRepository.findById(id) .orElseThrow(ResourceNotFoundException::new)); } }
4d0d3f44e03e86b475bebf45434e098ca80d721a
cd185c2196c54e00d3491df22412640d0675bad2
/app/src/androidTest/java/fi/jamk/vko_38_picasso_demo/ExampleInstrumentedTest.java
c128cca1d35751579fef9ca65b2dc529ec18b503
[]
no_license
SnakeRule/VKO_38_picasso_demo
dac612c324fd3fc4f2d00a580bb0241a615f2866
91965c1a907e0cc076d322f0f2fca89b029d4548
refs/heads/master
2021-07-02T13:26:59.996930
2017-09-24T10:16:36
2017-09-24T10:16:36
104,634,313
0
0
null
null
null
null
UTF-8
Java
false
false
758
java
package fi.jamk.vko_38_picasso_demo; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumentation test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() throws Exception { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("fi.jamk.vko_38_picasso_demo", appContext.getPackageName()); } }
26b69ec0451465190ca7f72e17bb600ae33561ed
191e63ed6283cdd8454aed37c32e79fde1031ca4
/5. Advanced Object Oriented Design/BaiTap/InterfaceResizeable/src/geometric/Square.java
3682cf23e199aa746cf2d87726cda289b8728da8
[]
no_license
nhatnpa2508/NhatModule02
095e3b898618d34d75395bbc8bf6e6a6749bd94d
1fb19e26c40de4a5830e941e78e57330ed6bbe95
refs/heads/master
2022-12-22T15:40:46.324037
2019-08-19T07:34:09
2019-08-19T07:34:09
191,078,938
0
0
null
2022-12-16T09:43:46
2019-06-10T01:58:44
CSS
UTF-8
Java
false
false
999
java
package geometric; import resize.Resizeable; public class Square extends Rectangle implements Resizeable { public Square(){} public Square(double side) { super(side, side); } public Square(double side, String color, boolean filled) { super(side, side, color, filled); } public double getSide(){ return getWidth(); } public void setSide(double side){ setWidth(side); setHeight(side); } @Override public void setWidth(double width) { super.setWidth(width); } @Override public void setHeight(double height) { super.setHeight(height); } @Override public String toString() { return "A Square with side=" + getSide() + ", which is a subclass of " + super.toString(); } @Override public void resize(double percent) { this.width *= (percent+100)/100; this.height *= (percent+100)/100; } }
6adf4601224dacbf4d3345b589c304ecd4b37d91
5ef722b695d9a8ba41048d208ae00518c7b4d637
/grpc-client/src/main/java/com/github/marlonflorencio/grpcclient/grpc/config/GlobalInterceptorConfiguration.java
879abfa0b9935ebd0b30a1989a571ed5290797f2
[]
no_license
MarlonFlorencio/grpc-spring-boot-maven
b396e5a83a14d1bac42ced5ac3440e46db59a7c6
93060569ab4ee56987f1a43ebf64b7551c9c3f47
refs/heads/main
2023-08-15T11:58:07.722772
2021-09-24T03:17:24
2021-09-24T03:17:24
409,816,731
1
0
null
null
null
null
UTF-8
Java
false
false
428
java
package com.github.marlonflorencio.grpcclient.grpc.config; import io.grpc.ClientInterceptor; import net.devh.boot.grpc.client.interceptor.GrpcGlobalClientInterceptor; import org.springframework.context.annotation.Configuration; @Configuration public class GlobalInterceptorConfiguration { @GrpcGlobalClientInterceptor ClientInterceptor deadLineClientInterceptor() { return new DeadlineInterceptor(); } }
059bd9a206fb0e9a5314e2184e77ece8101b9d67
3ca53c13d2953805c00406476ceda9684887a8ad
/src/com/iwxxm/common/DSSensorType.java
dfafca6d87625e1615efec31deb2077ab37f0db2
[]
no_license
yw2017051032/tac2iwxxm
ae93c12b08b7316cd59de032d4ae2e8082bc6c0b
5a08cb9ecd0833fd4435bf6db81a2b8126380ec1
refs/heads/master
2020-03-17T03:03:06.671868
2018-06-05T16:55:59
2018-06-05T17:06:03
133,217,637
3
0
null
null
null
null
GB18030
Java
false
false
1,085
java
// // 此文件是由 JavaTM Architecture for XML Binding (JAXB) 引用实现 v2.2.8-b130911.1802 生成的 // 请访问 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // 在重新编译源模式时, 对此文件的所有修改都将丢失。 // 生成时间: 2018.04.04 时间 10:18:30 PM CST // package com.iwxxm.common; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlType; /** * <p>DS_Sensor_Type complex type的 Java 类。 * * <p>以下模式片段指定包含在此类中的预期内容。 * * <pre> * &lt;complexType name="DS_Sensor_Type"> * &lt;complexContent> * &lt;extension base="{http://www.isotc211.org/2005/gmd}DS_Series_Type"> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "DS_Sensor_Type", namespace = "http://www.isotc211.org/2005/gmd") public class DSSensorType extends DSSeriesType { }
3a8da49309149c8056b041ca841cacb4a529718e
5ba25c74a3dfe5058333c90148a1d770720eb048
/thenine-202/test01/src/main/java/ltd/thenine/entity/User_PoRel.java
de542153d663f9254b4e1026ad903a0ce6eb4891
[]
no_license
Ericlogin/AnnoyingWeb
d1aefce99e7138a31882156d5561d39a1921048d
744aadced2c871aa82b49c7508126f19279091f9
refs/heads/main
2023-04-28T07:11:14.531700
2021-04-30T06:19:37
2021-04-30T06:19:37
363,040,365
0
0
null
null
null
null
UTF-8
Java
false
false
665
java
package ltd.thenine.entity; public class User_PoRel { private String position_ids; private int position_id; private int user_id; public String getPosition_ids() { return position_ids; } public void setPosition_ids(String position_ids) { this.position_ids = position_ids; } public int getPosition_id() { return position_id; } public void setPosition_id(int position_id) { this.position_id = position_id; } public int getUser_id() { return user_id; } public void setUser_id(int user_id) { this.user_id = user_id; } }
261dbb69a7048bf5efd6d8aa438f24cdab57d4b0
dc8d50bc6029d425c932baf3c9ce638ae0e8e77e
/baige-common/src/main/java/com/wacai/open/baige/common/protocol/produce/ProduceConstants.java
b7b39443ea074864dab3abe8f5504a727de3f0be
[]
no_license
wacai/baige
adcff0826cc217d3a28fb6dbf84b0491c3bfe8b8
4b21f10cf10ff509978afdfe9e4e09c416b1406c
refs/heads/master
2020-03-21T21:57:20.421263
2019-04-03T13:36:07
2019-04-03T13:36:07
139,095,323
1
5
null
null
null
null
UTF-8
Java
false
false
210
java
package com.wacai.open.baige.common.protocol.produce; public class ProduceConstants { /** * 单条消息体的最大字节数 */ public static final int MAX_BODY_SIZE_IN_BYTES = 5 * 1024 * 1024; }
f44e767c0e1b2ad4edd9d18d8a6b437ab1163da3
eb407e06b169bf6f24be4b1231bf8207b25eb3da
/Trie/421.MaximumXORofTwoNumbersinanArray/Solution.java
d0657d4d2a8760bafa746e78df3dfcfb38d9ddd3
[]
no_license
sijiey2/Coding_Practice
3a90d25c6032aa0a7cea1c10c1b40507cf9e55e5
756d3035d18057271090a39edd87626a69b71c2f
refs/heads/master
2021-04-15T19:07:02.161417
2018-04-30T23:36:34
2018-04-30T23:36:34
126,279,732
0
0
null
null
null
null
UTF-8
Java
false
false
1,353
java
// Trie // num & 1 => get the last digit // num ^ 1 => get the opposite of the last digit // 79ms (8ms) class TrieNode { TrieNode[] children = new TrieNode[2]; } public class Solution { public int findMaximumXOR(int[] nums) { if (nums == null || nums.length == 0) { return 0; } TrieNode root = new TrieNode(); TrieNode cur = root; // create Trie for (int n: nums) { for (int i = 31; i >= 0; i--) { int curBit = (n >>> i) & 1; if (cur.children[curBit] == null) { cur.children[curBit] = new TrieNode(); } cur = cur.children[curBit]; } cur = root; } // get max int max = Integer.MIN_VALUE; for (int n: nums) { int curSum = 0; for (int i = 31; i >= 0; i--) { int curBit = (n >>> i) & 1; // get the cur bit if (cur.children[curBit ^ 1] != null) { curSum += (1 << i); // get the original position (value) cur = cur.children[curBit ^ 1]; } else { cur = cur.children[curBit]; } } max = Math.max(curSum, max); cur = root; } return max; } public static void main(String[] args) { Solution sol = new Solution(); int[] nums = {3,10,5,25,2,8}; System.out.println(sol.findMaximumXOR(nums)); System.out.println(Integer.toBinaryString(28)); System.out.println(Integer.toBinaryString(25)); System.out.println(Integer.toBinaryString(5)); } }
4d2cc09908e1f26feac80254a83d60f6c9cb456c
071402a43b8b8520becd4434c28318c9cbf208fb
/letv_framework/src/main/java/com/letv/framework/util/CrashHandler.java
af52fcf04d4679d7ca6968619c7f535fa82ff753
[]
no_license
wulianshu/letvframework
f124c31bd74e87b89c00b6760ac5a608d47039ec
7de6d3860f5740c508a91c8fd32c2623c329f856
refs/heads/master
2021-01-10T01:52:46.549618
2016-02-19T01:10:13
2016-02-19T01:10:13
52,050,406
1
0
null
null
null
null
UTF-8
Java
false
false
5,778
java
package com.letv.framework.util; import android.content.Context; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.os.Build; import android.os.Environment; import android.os.Looper; import android.util.Log; import java.io.File; import java.io.FileWriter; import java.io.PrintWriter; import java.io.StringWriter; import java.io.Writer; import java.lang.Thread.UncaughtExceptionHandler; import java.lang.reflect.Field; import java.util.Locale; /** * UncaughtException处理类,当程序发生Uncaught异常的时候,有该类 * 来接管程序,并记录 发送错误报告. */ public class CrashHandler implements UncaughtExceptionHandler { /** * Debug Log tag */ public static final String TAG = "CrashHandler"; /** 是否开启日志输出,在Debug状态下开启, * 在Release状态下关闭以提示程序性能 * */ /** * 系统默认的UncaughtException处理类 */ private UncaughtExceptionHandler mDefaultHandler; /** * CrashHandler实例 */ private static CrashHandler INSTANCE; /** * 程序的Context对象 */ private Context mContext; private String VERSION_NAME; private String NAME; /** * 保证只有一个CrashHandler实例 */ private CrashHandler() { } /** * 获取CrashHandler实例 ,单例模式 */ public synchronized static CrashHandler getInstance() { if (INSTANCE == null) { INSTANCE = new CrashHandler(); } return INSTANCE; } /** * 初始化,注册Context对象, * 获取系统默认的UncaughtException处理器, * 设置该CrashHandler为程序的默认处理器 * * @param ctx */ public void init(Context ctx) { mContext = ctx; mDefaultHandler = Thread.getDefaultUncaughtExceptionHandler(); Thread.setDefaultUncaughtExceptionHandler(this); } /** * 当UncaughtException发生时会转入该函数来处理 */ public void uncaughtException(Thread thread, Throwable ex) { if (!handleException(ex) && mDefaultHandler != null) { //如果用户没有处理则让系统默认的异常处理器来处理 mDefaultHandler.uncaughtException(thread, ex); } else { //Sleep一会后结束程序 try { Thread.sleep(3000); } catch (InterruptedException e) { Log.e(TAG, "Error : ", e); } android.os.Process.killProcess(android.os.Process.myPid()); System.exit(10); } } private void showErrMsg(String msg){ try{ Looper.prepare(); UiUtil.showToast(mContext, "程序出错啦!" + msg); Looper.loop(); }catch(Throwable e){ e.printStackTrace(); } } /** * 自定义错误处理,收集错误信息 * 发送错误报告等操作均在此完成. * 开发者可以根据自己的情况来自定义异常处理逻辑 * * @param ex * @return true:如果处理了该异常信息;否则返回false */ private boolean handleException(Throwable ex) { if (ex == null) { return true; } final String msg = ex.getLocalizedMessage(); //使用Toast来显示异常信息 new Thread() { @Override public void run() { showErrMsg(msg); } }.start(); //保存错误报告文件 collectCrashDeviceInfo(mContext); String err = saveCrashInfoToFile(ex); StringBuffer sb = new StringBuffer(); sb.append(NAME + "\n" + Build.VERSION.SDK_INT + "\n" + VERSION_NAME + "\n"); Field[] fields = Build.class.getDeclaredFields(); for (Field field : fields) { try { field.setAccessible(true); sb.append(field.getName().toLowerCase(Locale.CHINA) + ":\t" + field.get(null).toString()); sb.append("\n"); } catch (Exception e) { e.printStackTrace(); } } sb.append(err); String path = Environment.getExternalStorageDirectory().getAbsolutePath() + "/crash/"; File f = new File(path); if (!f.exists()) f.mkdirs(); File file = new File(path + "crash" + System.currentTimeMillis() + ".txt"); try { FileWriter fw = new FileWriter(file); fw.write(sb.toString()); fw.flush(); fw.close(); } catch (Exception e) { } return true; } /** * 保存错误信息到字符串 * * @param ex * @return */ private String saveCrashInfoToFile(Throwable ex) { Writer info = new StringWriter(); PrintWriter printWriter = new PrintWriter(info); ex.printStackTrace(printWriter); ex.printStackTrace(); Throwable cause = ex.getCause(); while (cause != null) { cause.printStackTrace(printWriter); cause = cause.getCause(); } String result = info.toString(); printWriter.close(); return result; } private void collectCrashDeviceInfo(Context ctx) { try { PackageManager pm = ctx.getPackageManager(); PackageInfo pi = pm.getPackageInfo(ctx.getPackageName(), PackageManager.GET_ACTIVITIES); if (pi != null) { NAME = pi.packageName == null ? "not set" : pi.packageName; VERSION_NAME = pi.versionName == null ? "not set" : pi.versionName; } } catch (NameNotFoundException e) { Log.e(TAG, "Error while collect package info", e); } } }
54f0cd7e3ec101119dfc7854222590be9f879f51
dba32a69b3c7dd8e6d81f3076c4c5743f44e4d85
/src/DesignPattern/behavior/chainresponsibility/ChainPatternTest.java
39f52b95e79f1e40ac3686bbb9b2bd44a834c399
[]
no_license
hmwang2000/LeetCode
8b1afc98372618d3a94b3efc0e879f23df996cf5
ba5be33ff6b8bd1a4ec7e81c7f4b798f35102656
refs/heads/master
2020-04-09T06:38:09.038491
2018-12-03T02:21:03
2018-12-03T02:21:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
890
java
package DesignPattern.behavior.chainresponsibility; import java.util.Scanner; //ATMDispenseChain public class ChainPatternTest { private DispenseChain c1; public ChainPatternTest() { // initialize the chain this.c1 = new Dollar50Dispenser(); DispenseChain c2 = new Dollar20Dispenser(); DispenseChain c3 = new Dollar10Dispenser(); // set the chain of responsibility c1.setNextChain(c2); c2.setNextChain(c3); } public static void main(String[] args) { ChainPatternTest atmDispenser = new ChainPatternTest(); // while (true) { int amount = 0; System.out.println("Enter amount to dispense"); Scanner input = new Scanner(System.in); amount = input.nextInt(); if (amount % 10 != 0) { System.out.println("Amount should be in multiple of 10s."); return; } // process the request atmDispenser.c1.dispense(new Currency(amount)); // } } }
ab6fbac73c3494b04d7848f6ccced5d9869f8ac3
1b13fe35f05930e8a7b046b62a65ab8c0734958e
/test/src/main/java/test/dto/MyContact.java
03619cef455dbd2ae948f8647e06a40ed7e8852f
[]
no_license
hamzalak/hotels-gestion
edb1f7842caa1bbbae783e46eea9fc98a04e0c94
b3ef8cfc791591cce36fed3e73faf81dd9a8adcb
refs/heads/master
2020-04-30T13:00:47.297965
2019-11-11T22:32:11
2019-11-11T22:32:11
176,839,047
0
0
null
null
null
null
UTF-8
Java
false
false
325
java
package test.dto; public class MyContact { private String email ; private String text ; public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getText() { return text; } public void setText(String text) { this.text = text; } }
76cdc22716c907479c2efd3fb962cb40ddf97228
52dfd3b628c52901b722ca6923f39f01bbe7291f
/src/main/designpattern/designPattern2/com/metacube/shoppingcart/facade/ShoppingFacade.java
f36d1d5a67ecdd3798bcfd035c98ba9019bf1c2b
[]
no_license
meta-manasi-pandya/GETATraining
a5c1976bea2a4d9f3bb34c407f92d51f555e1e69
f6b413d7428069e4a523d9f287eb7c29384fd10e
refs/heads/master
2021-05-16T16:51:20.582471
2018-05-21T10:10:50
2018-05-21T10:10:50
119,957,213
0
1
null
2018-05-31T06:30:32
2018-02-02T08:52:36
Java
UTF-8
Java
false
false
3,686
java
package main.designpattern.designPattern2.com.metacube.shoppingcart.facade; import java.util.Map; import java.util.Map.Entry; import main.designpattern.designPattern2.com.metacube.shoppingcart.dao.Factory; import main.designpattern.designPattern2.com.metacube.shoppingcart.dao.impl.InMemoryShoppingCartDao; import main.designpattern.designPattern2.com.metacube.shoppingcart.entity.Product; import main.designpattern.designPattern2.com.metacube.shoppingcart.entity.ShoppingCart; import main.designpattern.designPattern2.com.metacube.shoppingcart.enums.Database; import main.designpattern.designPattern2.com.metacube.shoppingcart.enums.EntityType; import main.designpattern.designPattern2.com.metacube.shoppingcart.enums.OperationStatus; /** * This class performs operation related to Shopping cart like total etc. * @author Manasi Pandya * */ public class ShoppingFacade { private static ShoppingFacade shoppingFacadeInstance; InMemoryShoppingCartDao shoppingCartDao =(InMemoryShoppingCartDao) Factory.getInstance(EntityType.SHOPPING_CART, Database.IN_MEMORY); private ShoppingFacade(){}; public static ShoppingFacade getInstance(){ if(shoppingFacadeInstance == null){ shoppingFacadeInstance = new ShoppingFacade(); } return shoppingFacadeInstance; } /** * gets the list of products in user's cart * * @param userID */ public Map<Product, Integer> getList(String Uid){ Map<Product, Integer> productList = shoppingCartDao.getCart(Uid).getItems(); return productList; } /** * returns total price of the cart * * @param userID */ public float getTotalPrice (String Uid){ Map<Product, Integer> productList = getList(Uid); float tot = 0.0f; for( Entry<Product, Integer> m: productList.entrySet()){ tot += (m.getKey().getPrice()*m.getValue()); } return tot; } /** * checks if a cart exist, if it doesn't adds one * * @param userID * @param cart */ public Map<Product, Integer> addCart(String Uid, ShoppingCart cart) { if(shoppingCartDao.getCart(Uid) == null){ cart.setUserId(Uid); shoppingCartDao.addCart(cart); return getList(Uid); } else { return getList(Uid); } } /** * checks if a cart exist, if it does, it removes it. * * @param userID */ public OperationStatus removeCart(String Uid) { if( shoppingCartDao.getCart(Uid) != null ){ shoppingCartDao.removeCart(Uid); return OperationStatus.CART_REMOVED_SUCCESSFULLY; } else { return OperationStatus.ERROR; } } /** * checks if a cart exist, it also checks if the entered product ID exists, if it does, it adds one * * @param userID * @param productID * @param quantity */ public OperationStatus addToCart(String Uid, int productId, int quantity ){ if(shoppingCartDao.getCart(Uid) != null){ Product pro = ProductFacade.getInstance().getProduct(productId); shoppingCartDao.addProductToCart(Uid, pro, quantity); return OperationStatus.ADDED_TO_CART; } else { return OperationStatus.ERROR; } } /** * checks if a cart exist, it also checks if the entered product ID exists in the cart, if it does, it removes the product * * @param userID * @param productID */ public OperationStatus removeFromCart(String Uid, int productId ){ if(shoppingCartDao.getCart(Uid) != null){ Product pro = ProductFacade.getInstance().getProduct(productId); shoppingCartDao.removeProductFromCart(Uid, pro); return OperationStatus.REMOVED_FROM_CART; } else { return OperationStatus.ERROR; } } /** * checks if the user is present in the system * * @param userID */ public boolean checkUser(String uid) { return UserFacade.getInstance().checkUser(uid); } }
b9e070f62f39c769d1c5ec778c9dc169d6c5bd01
145c40a0f8b8bba492fe324e7868d04a1b84771f
/services/project-service/src/main/java/com/thao/qlts/project/common/annotation/LogAnnotation.java
25a36c458f9c1db6f72e11a102ca14618aaef19e
[]
no_license
Khangbt/qlks
67d3d379ab0edb9af416f9da4fa33de6bed9b6c6
f88a4cfed31936f2794d71ee21092c85d7c827db
refs/heads/main
2023-08-15T15:43:35.996389
2021-10-05T04:14:43
2021-10-05T04:14:43
357,884,062
0
0
null
2021-10-05T04:14:44
2021-04-14T11:40:30
TypeScript
UTF-8
Java
false
false
379
java
package com.thao.qlts.project.common.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Created by namnv iist on 06/05/2020. */ @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface LogAnnotation { Class table(); }
c4b9378a8446b35e41b124beb4bf59c14943e2bd
f4b3b26f8c2cfe1af6588a57f54d7d173a9181fa
/app/src/main/java/com/prituladima/collectionmapsarchexample/processors/MapProcessor.java
3bec71b7450aa8b1d9ab0806e4686f6b5bc361ce
[]
no_license
prituladima/CollectionMapsArchExample
0c767c1190a87568e382ca3e4c7a1320c8062c5e
4d008deb5d0a4f38299499b5c44f9981536fc127
refs/heads/master
2021-04-28T02:24:14.759643
2018-08-23T12:52:13
2018-08-23T12:52:13
122,113,525
0
0
null
null
null
null
UTF-8
Java
false
false
166
java
package com.prituladima.collectionmapsarchexample.processors; public interface MapProcessor extends Processor { long add(); long search(); long remove(); }
9c8f610955d5e07c080c8f3dc7df84d00eafb57a
6b9703cfb63248a8d6cc99a51ef3eaad0ea06c44
/app/src/main/java/com/sneider/diycode/widget/WebViewProgressBar.java
ac539a8f76ee0ed5b24d61e3de0f1430c2ffd095
[]
no_license
candebbs/DiyCodeAndroid
9a9340ed323e0def28cf1274f80f118cb35844ec
840e97c5d7bc1c48e1fe1bef0ebacc83467745a7
refs/heads/master
2020-03-19T07:56:30.560777
2017-07-18T07:41:01
2017-07-18T07:41:01
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,842
java
package com.sneider.diycode.widget; import android.animation.Animator; import android.animation.ValueAnimator; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Paint; import android.util.AttributeSet; import android.view.View; import android.view.animation.LinearInterpolator; import com.blankj.utilcode.util.SizeUtils; import com.sneider.diycode.R; public class WebViewProgressBar extends View { private Context mContext; private int mMax;//进度条最大的进度 private int mDefaultHeight;//高度 private int mCurProgress;//当前的进度 private int mWidth; private int mHeight; private Paint mPaint; private int mColor; public WebViewProgressBar(Context context) { this(context, null); } public WebViewProgressBar(Context context, AttributeSet attrs) { this(context, attrs, 0); } public WebViewProgressBar(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); mContext = context; initAttr(attrs); } private void initAttr(AttributeSet attrs) { TypedArray array = mContext.obtainStyledAttributes(attrs, R.styleable.webview_progressbar); mMax = array.getInt(R.styleable.webview_progressbar_max, 100); mCurProgress = array.getInt(R.styleable.webview_progressbar_progress, 0); mDefaultHeight = array.getInt(R.styleable.webview_progressbar_progressHeight, 8); mColor = array.getColor(R.styleable.webview_progressbar_progressColor, getResources().getColor(R.color.colorAccent)); array.recycle(); mPaint = new Paint(); mPaint.setColor(mColor); } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); int widthSize = MeasureSpec.getSize(widthMeasureSpec); int heightSize = MeasureSpec.getSize(heightMeasureSpec); int widthMode = MeasureSpec.getMode(widthMeasureSpec); int heightMode = MeasureSpec.getMode(heightMeasureSpec); //矩形宽度为view的80% if (widthMode == MeasureSpec.EXACTLY) { mWidth = widthSize; } else if (widthMode == MeasureSpec.AT_MOST) { //mDefaultWidth 为你自定义设置的属性 mWidth = SizeUtils.dp2px(300); } else if (widthMode == MeasureSpec.UNSPECIFIED) { mWidth = widthSize; } if (heightMode == MeasureSpec.EXACTLY) { mHeight = heightSize; } else if (heightMode == MeasureSpec.AT_MOST) { //mDefaultHeight 为你自定义设置的属性 mHeight = SizeUtils.dp2px(mDefaultHeight); } setMeasuredDimension(mWidth, mHeight); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); float result = mWidth * ((float) mCurProgress / (float) 100); canvas.drawRect(0, 0, result, mDefaultHeight, mPaint); } public int getMax() { return mMax; } public void setMax(int max) { mMax = max; } public int getCurProgress() { return mCurProgress; } public interface OnEndListener { void onEnd();//动画结束的回调 } public void setCurProgress(int curProgress, long time, final OnEndListener listener) { if (mCurProgress == 100) {//重置mCurProgress为0 mCurProgress = 0; } //注意是从 mCurProgress->curProgress 来动画来实现 ValueAnimator animator = ValueAnimator.ofInt(mCurProgress, curProgress); animator.setDuration(time); animator.setInterpolator(new LinearInterpolator()); animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { mCurProgress = (int) animation.getAnimatedValue(); postInvalidate();//通知刷新 } }); animator.start(); animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationEnd(Animator animation) { if (listener != null) { listener.onEnd(); } } @Override public void onAnimationStart(Animator animation) { } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); } public void setNormalProgress(int newProgress) { mCurProgress = 0; mCurProgress = newProgress; postInvalidate(); } }
f435b5ded38d58ed7e8d58255bc0cbefd8e7e13b
b557a010a5360041ce6ee8e0d518f0da083dcdfb
/ProyectoFinal/src/Controlador/ControladorMain.java
b0c1c081548ecca9553779f0852001bbb6cbb333
[]
no_license
candyNava/farmaciaSanGabriel
06940d1a17e478b14ad95a5e7a4db8e96ba54205
cdf45f53bce952ca4e0b1a3f295a3536500b15ef
refs/heads/master
2021-01-14T07:29:30.069645
2020-02-24T04:20:51
2020-02-24T04:20:51
242,639,849
1
0
null
null
null
null
UTF-8
Java
false
false
1,790
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 Controlador; import Modelo.DbConexion; import Vista.LoginMenu; import Modelo.hiloAnimacion; import Vista.FromCliente; import Vista.FromEmpleado; import Vista.FromProducto; import Vista.FromVenta; import Vista.LoginMenu1; import Vista.VentasTotales; import Vista.vistaAnimacion; import java.io.FileReader; import java.sql.SQLException; import java.util.Properties; /** * * @author CandyPalomaNavaLlama */ public class ControladorMain { public static void main(String[] args) throws ClassNotFoundException, SQLException { DbConexion db = new DbConexion(); db.Conexion(); LoginMenu vLogin =new LoginMenu(); LoginMenu1 vLogin1 =new LoginMenu1(); FromCliente vCliente =new FromCliente(); FromEmpleado vEmpleado =new FromEmpleado(); FromVenta vVenta =new FromVenta(); FromProducto vProducto =new FromProducto(); VentasTotales vTotales= new VentasTotales(); vistaAnimacion animacion = new vistaAnimacion(); hiloAnimacion hilo = new hiloAnimacion(animacion,vLogin ); hilo.start(); animacion.setVisible(true); ControlVenta controlventa=new ControlVenta(db,vVenta,vLogin1,vTotales); ControlLogin controlLogin=new ControlLogin(vLogin, db, vEmpleado, vCliente,vLogin1,vVenta, vProducto); ControlCliente controlCliente=new ControlCliente(db, vCliente); ControlReporteVentas controlVenta=new ControlReporteVentas (db, vTotales); ControlProducto controlProducto =new ControlProducto(db,vProducto); } }
d75164d2000392ed06aac14933b8f087538e1818
beb2fbdd8e5343fe76c998824c7228a546884c5e
/com.kabam.marvelbattle/src/com/google/android/gms/ads/search/SearchAdRequest.java
f728a704c3b152894c3f55a63a8cec3d1c48e491
[]
no_license
alamom/mcoc_11.2.1_store_apk
4a988ab22d6c7ad0ca5740866045083ec396841b
b43c41d3e8a43f63863d710dad812774cd14ace0
refs/heads/master
2021-01-11T17:13:02.358134
2017-01-22T19:51:35
2017-01-22T19:51:35
79,740,812
0
0
null
null
null
null
UTF-8
Java
false
false
7,002
java
package com.google.android.gms.ads.search; import android.content.Context; import android.graphics.Color; import android.location.Location; import android.os.Bundle; import com.google.android.gms.ads.mediation.MediationAdapter; import com.google.android.gms.ads.mediation.NetworkExtras; import com.google.android.gms.ads.mediation.customevent.CustomEvent; import com.google.android.gms.internal.bg; import com.google.android.gms.internal.bg.a; public final class SearchAdRequest { public static final int BORDER_TYPE_DASHED = 1; public static final int BORDER_TYPE_DOTTED = 2; public static final int BORDER_TYPE_NONE = 0; public static final int BORDER_TYPE_SOLID = 3; public static final int CALL_BUTTON_COLOR_DARK = 2; public static final int CALL_BUTTON_COLOR_LIGHT = 0; public static final int CALL_BUTTON_COLOR_MEDIUM = 1; public static final String DEVICE_ID_EMULATOR = bg.DEVICE_ID_EMULATOR; public static final int ERROR_CODE_INTERNAL_ERROR = 0; public static final int ERROR_CODE_INVALID_REQUEST = 1; public static final int ERROR_CODE_NETWORK_ERROR = 2; public static final int ERROR_CODE_NO_FILL = 3; private final bg ld; private final int xl; private final int xm; private final int xn; private final int xo; private final int xp; private final int xq; private final int xr; private final int xs; private final String xt; private final int xu; private final String xv; private final int xw; private final int xx; private final String xy; private SearchAdRequest(Builder paramBuilder) { this.xl = Builder.a(paramBuilder); this.xm = Builder.b(paramBuilder); this.xn = Builder.c(paramBuilder); this.xo = Builder.d(paramBuilder); this.xp = Builder.e(paramBuilder); this.xq = Builder.f(paramBuilder); this.xr = Builder.g(paramBuilder); this.xs = Builder.h(paramBuilder); this.xt = Builder.i(paramBuilder); this.xu = Builder.j(paramBuilder); this.xv = Builder.k(paramBuilder); this.xw = Builder.l(paramBuilder); this.xx = Builder.m(paramBuilder); this.xy = Builder.n(paramBuilder); this.ld = new bg(Builder.o(paramBuilder), this); } bg V() { return this.ld; } public int getAnchorTextColor() { return this.xl; } public int getBackgroundColor() { return this.xm; } public int getBackgroundGradientBottom() { return this.xn; } public int getBackgroundGradientTop() { return this.xo; } public int getBorderColor() { return this.xp; } public int getBorderThickness() { return this.xq; } public int getBorderType() { return this.xr; } public int getCallButtonColor() { return this.xs; } public String getCustomChannels() { return this.xt; } public <T extends CustomEvent> Bundle getCustomEventExtrasBundle(Class<T> paramClass) { return this.ld.getCustomEventExtrasBundle(paramClass); } public int getDescriptionTextColor() { return this.xu; } public String getFontFace() { return this.xv; } public int getHeaderTextColor() { return this.xw; } public int getHeaderTextSize() { return this.xx; } public Location getLocation() { return this.ld.getLocation(); } @Deprecated public <T extends NetworkExtras> T getNetworkExtras(Class<T> paramClass) { return this.ld.getNetworkExtras(paramClass); } public <T extends MediationAdapter> Bundle getNetworkExtrasBundle(Class<T> paramClass) { return this.ld.getNetworkExtrasBundle(paramClass); } public String getQuery() { return this.xy; } public boolean isTestDevice(Context paramContext) { return this.ld.isTestDevice(paramContext); } public static final class Builder { private final bg.a le = new bg.a(); private int xl; private int xm; private int xn; private int xo; private int xp; private int xq; private int xr = 0; private int xs; private String xt; private int xu; private String xv; private int xw; private int xx; private String xy; public Builder addCustomEventExtrasBundle(Class<? extends CustomEvent> paramClass, Bundle paramBundle) { this.le.b(paramClass, paramBundle); return this; } public Builder addNetworkExtras(NetworkExtras paramNetworkExtras) { this.le.a(paramNetworkExtras); return this; } public Builder addNetworkExtrasBundle(Class<? extends MediationAdapter> paramClass, Bundle paramBundle) { this.le.a(paramClass, paramBundle); return this; } public Builder addTestDevice(String paramString) { this.le.s(paramString); return this; } public SearchAdRequest build() { return new SearchAdRequest(this, null); } public Builder setAnchorTextColor(int paramInt) { this.xl = paramInt; return this; } public Builder setBackgroundColor(int paramInt) { this.xm = paramInt; this.xn = Color.argb(0, 0, 0, 0); this.xo = Color.argb(0, 0, 0, 0); return this; } public Builder setBackgroundGradient(int paramInt1, int paramInt2) { this.xm = Color.argb(0, 0, 0, 0); this.xn = paramInt2; this.xo = paramInt1; return this; } public Builder setBorderColor(int paramInt) { this.xp = paramInt; return this; } public Builder setBorderThickness(int paramInt) { this.xq = paramInt; return this; } public Builder setBorderType(int paramInt) { this.xr = paramInt; return this; } public Builder setCallButtonColor(int paramInt) { this.xs = paramInt; return this; } public Builder setCustomChannels(String paramString) { this.xt = paramString; return this; } public Builder setDescriptionTextColor(int paramInt) { this.xu = paramInt; return this; } public Builder setFontFace(String paramString) { this.xv = paramString; return this; } public Builder setHeaderTextColor(int paramInt) { this.xw = paramInt; return this; } public Builder setHeaderTextSize(int paramInt) { this.xx = paramInt; return this; } public Builder setLocation(Location paramLocation) { this.le.a(paramLocation); return this; } public Builder setQuery(String paramString) { this.xy = paramString; return this; } public Builder tagForChildDirectedTreatment(boolean paramBoolean) { this.le.h(paramBoolean); return this; } } } /* Location: C:\tools\androidhack\com.kabam.marvelbattle\classes.jar!\com\google\android\gms\ads\search\SearchAdRequest.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */
16c9453a9efc61ebc04b57e6aa87444f0cabf827
112b3b381cf316743f7b8aca3a577c9d08840739
/app/src/main/java/com/example/android/logindemo/login/ProfileActivity.java
7e680f1b8a1d6bef85adc2bea227b1432ddd6c03
[]
no_license
Kasun49/irate
f08e5ffb76ddde2b525c3e8f0124e03660f895e1
7a736062a90459d0a934f58e437e71f162c07506
refs/heads/master
2020-05-09T10:10:51.632731
2019-04-12T15:15:12
2019-04-12T15:15:12
181,032,016
0
0
null
null
null
null
UTF-8
Java
false
false
3,592
java
package com.example.android.logindemo.login; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.example.android.logindemo.R; 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.FirebaseDatabase; import com.google.firebase.database.ValueEventListener; import com.google.firebase.storage.FirebaseStorage; public class ProfileActivity extends AppCompatActivity { private ImageView profilePic; private TextView profileName, profileAge, profileEmail; private Button profileUpdate, changePassword; private FirebaseAuth firebaseAuth; private FirebaseDatabase firebaseDatabase; private FirebaseStorage firebaseStorage; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile); profileName = findViewById(R.id.tvProfileName); profileAge = findViewById(R.id.tvProfileAge); profileEmail = findViewById(R.id.tvProfileEmail); profileUpdate = findViewById(R.id.btnProfileUpdate); changePassword = findViewById(R.id.btnChangePassword); getSupportActionBar().setDisplayHomeAsUpEnabled(true); firebaseAuth = FirebaseAuth.getInstance(); firebaseDatabase = FirebaseDatabase.getInstance(); firebaseStorage = FirebaseStorage.getInstance(); DatabaseReference databaseReference = firebaseDatabase.getReference(firebaseAuth.getUid()); /*StorageReference storageReference = firebaseStorage.getReference(); storageReference.child(firebaseAuth.getUid()).child("Images/Profile Pic").getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() { @Override public void onSuccess(Uri uri) { Picasso.get().load(uri).fit().centerCrop().into(profilePic); } });*/ databaseReference.addValueEventListener(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { UserProfile userProfile = dataSnapshot.getValue(UserProfile.class); profileEmail.setText("Email: " + userProfile.getUserEmail()); } @Override public void onCancelled(DatabaseError databaseError) { Toast.makeText(ProfileActivity.this, databaseError.getCode(), Toast.LENGTH_SHORT).show(); } }); profileUpdate.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(ProfileActivity.this, UpdateProfile.class)); } }); changePassword.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(ProfileActivity.this, UpdatePassword.class)); } }); } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()){ case android.R.id.home: onBackPressed(); } return super.onOptionsItemSelected(item); } }
2a9e19b32b86c2c7ee9d350b822dfa68cac0ed07
94b6aaf872dd881c4fee93018b2c5c0d4f1134c9
/modules/Rast/src/edu/uncc/genosets/rast/RastLoadWizardIterator.java
6d5392c15f0e8def140b468ac21bc5d68ee18e4e
[ "BSD-3-Clause" ]
permissive
aacain/genosets
6978f00729bcda179890e2a6e2ef361689a6edbf
96f7a161b35f79c1e87aa88be93666adaeaf2f56
refs/heads/master
2020-04-06T07:00:33.820564
2015-02-16T17:15:43
2015-02-16T17:15:43
26,338,552
1
0
null
null
null
null
UTF-8
Java
false
false
6,524
java
/* * Copyright (C) 2014 Aurora Cain * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package edu.uncc.genosets.rast; import edu.uncc.genosets.datamanager.entity.AnnotationMethod; import edu.uncc.genosets.datamanager.entity.Organism; import edu.uncc.genosets.datamanager.rast.RastLoader; import edu.uncc.genosets.datamanager.wizards.MethodWizardPanel; import edu.uncc.genosets.taskmanager.TaskManagerFactory; import java.awt.Component; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.NoSuchElementException; import java.util.Set; import javax.swing.JComponent; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import org.openide.WizardDescriptor; import org.openide.util.ChangeSupport; public final class RastLoadWizardIterator implements WizardDescriptor.InstantiatingIterator<WizardDescriptor>, ChangeListener { private int index; private List<WizardDescriptor.Panel<WizardDescriptor>> panels; private WizardDescriptor wizard; private ChangeSupport cs = new ChangeSupport(this); private List<WizardDescriptor.Panel<WizardDescriptor>> getPanels() { if (panels == null) { MethodWizardPanel rastMethodPanel = new MethodWizardPanel(new AnnotationMethod()); panels = new ArrayList<WizardDescriptor.Panel<WizardDescriptor>>(); RastLoadWizardPanel1 rastWizard1 = new RastLoadWizardPanel1(); panels.add(rastWizard1); panels.add(rastMethodPanel); String[] steps = new String[panels.size()]; for (int i = 0; i < panels.size(); i++) { Component c = panels.get(i).getComponent(); // Default step name to component name of panel. steps[i] = c.getName(); if (c instanceof JComponent) { // assume Swing components JComponent jc = (JComponent) c; jc.putClientProperty(WizardDescriptor.PROP_CONTENT_SELECTED_INDEX, i); jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DATA, steps); jc.putClientProperty(WizardDescriptor.PROP_AUTO_WIZARD_STYLE, true); jc.putClientProperty(WizardDescriptor.PROP_CONTENT_DISPLAYED, true); jc.putClientProperty(WizardDescriptor.PROP_CONTENT_NUMBERED, true); } } } return panels; } @Override public WizardDescriptor.Panel<WizardDescriptor> current() { return getPanels().get(index); } @Override public String name() { return index + 1 + ". from " + getPanels().size(); } @Override public boolean hasNext() { return index < getPanels().size() - 1; } @Override public boolean hasPrevious() { return index > 0; } @Override public void nextPanel() { if (!hasNext()) { throw new NoSuchElementException(); } index++; } @Override public void previousPanel() { if (!hasPrevious()) { throw new NoSuchElementException(); } index--; } // If nothing unusual changes in the middle of the wizard, simply: @Override public void addChangeListener(ChangeListener l) { this.cs.addChangeListener(l); } @Override public void removeChangeListener(ChangeListener l) { this.cs.removeChangeListener(l); } // If something changes dynamically (besides moving between panels), e.g. // the number of panels changes in response to user input, then use // ChangeSupport to implement add/removeChangeListener and call fireChange // when needed @Override public Set instantiate() throws IOException { AnnotationMethod method = (AnnotationMethod)this.wizard.getProperty(MethodWizardPanel.PROP_AnnotationMethod); File rastFile = (File)this.wizard.getProperty(RastLoadWizardPanel1.PROP_RASTFILE); File fastaFile = (File)this.wizard.getProperty(RastLoadWizardPanel1.PROP_FASTAFILE); Organism organism = (Organism)this.wizard.getProperty(RastLoadWizardPanel1.PROP_ORGANISM); RastLoadWizardPanel1.ID_TYPE idType = (RastLoadWizardPanel1.ID_TYPE)this.wizard.getProperty(RastLoadWizardPanel1.PROP_ID_TYPE); InputStream fastaStream = null; if(idType == RastLoadWizardPanel1.ID_TYPE.LOAD_FASTA){ fastaStream = new FileInputStream(fastaFile); } InputStream rastStream = new FileInputStream(rastFile); RastLoader loader = new RastLoader(organism, method, rastStream, method, fastaStream, 11, false); //RastLoader loader = new RastLoader(organism, (AnnotationMethod)this.wizard.getProperty(MethodWizardPanel.PROP_AnnotationMethod), rastStream, (AnnotationMethod)this.wizard.getProperty(MethodWizardPanel.PROP_AnnotationMethod), fastaStream, 11); TaskManagerFactory.getDefault().addPendingTask(loader); return Collections.EMPTY_SET; } @Override public void initialize(WizardDescriptor wizard) { this.wizard = wizard; } @Override public void uninitialize(WizardDescriptor wizard) { index = 0; this.wizard = null; panels = null; } @Override public void stateChanged(ChangeEvent e) { // RastLoadWizardPanel1.ID_TYPE idType = rastWizard1.getComponent().getIdType(); // if (idType != null && idType.equals(RastLoadWizardPanel1.ID_TYPE.LOAD_FASTA)) { // MethodWizardPanel fastaMethodPanel = new MethodWizardPanel(new AnnotationMethod()); // fastaMethodPanel.setMethodPropertyName("PROP_FASTA_METHOD"); // this.getPanels().add(fastaMethodPanel); // this.cs.fireChange(); // } } }
ae053620270399f1e51021d0201abe9c4079b26e
8db3549f645775e999633a0ddf1e93b4d0af8c9e
/src/main/java/io/pivotal/pal/tracker/SwaggerConfig.java
bf315cf025d8deae39efed64c10c574dea13f2a9
[]
no_license
ankitdangayach/pal-trackertest
7a3181aa984eebf97c0009979ada91624f05fd99
1dcf565fb33456b851c64a508f8c77b7407dc149
refs/heads/master
2020-06-27T03:56:11.492868
2019-10-04T11:13:36
2019-10-04T11:13:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
896
java
package io.pivotal.pal.tracker; 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(); } }
0b95fd326d3c26b15cdeaf6d2423ae39317ac427
e2b43880631bdca6ff278c955ff42ea8f6de8e8b
/iScmCore/src/main/java/com/iscm/core/db/dao/BaseDao.java
ef12774c45a03a616af3f65bbcb1418eafdfe57b
[]
no_license
EvanSole/iScmPlatform
61280fc9f989ecee78cc026365330fe25105beca
c60ac20138b45ea435ba447077c94181b3d94b61
refs/heads/master
2021-01-01T03:43:08.378403
2016-05-22T10:59:31
2016-05-22T10:59:31
59,404,007
0
0
null
null
null
null
UTF-8
Java
false
false
32,653
java
package com.iscm.core.db.dao; import com.iscm.AutoBasePO; import com.iscm.BasePO; import com.iscm.NormalBasePO; import com.iscm.common.constants.AutoIdConstants; import com.iscm.common.utils.IScmBeanUtil; import com.iscm.core.db.splitdb.DbShardsUtil; import com.iscm.core.db.util.AliasToMapResultTransformer; import com.iscm.core.db.util.PoUtils; import com.iscm.service.autoid.IAutoIdClient; import org.apache.commons.beanutils.BeanUtils; import org.hibernate.*; import org.hibernate.InstantiationException; import org.hibernate.criterion.CriteriaSpecification; import org.hibernate.jdbc.Work; import org.springframework.beans.factory.annotation.Autowired; import javax.persistence.Column; import javax.persistence.Table; import java.io.Serializable; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; import java.math.BigInteger; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Statement; import java.util.*; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.stream.Collectors; public abstract class BaseDao<T extends BasePO> { private Class<T> entityClass; @Autowired public IAutoIdClient autoIdClient; @Autowired private SessionFactory sessionFactory; public void flush(String... splitTable){ this.getSession(splitTable).flush(); } /** * 通过反射获取子类确定的泛型类 */ public BaseDao() { Type genType = getClass().getGenericSuperclass(); Type[] params = ((ParameterizedType) genType).getActualTypeArguments(); entityClass = (Class) params[0]; } /******************************************以下为开放方法********************************************/ /** * 根据ID加载PO实例 * * @param id * @return 返回相应的持久化PO实例 */ public T load(Serializable id, String... splitTable) { return (T) getSession(splitTable).load(entityClass, id); } /** * 根据ID获取PO实例 * * @param id * @return 返回相应的持久化PO实例 */ public T get(Serializable id, String... splitTable) { return (T) getSession(splitTable).get(entityClass, id); } /* 根据ID获取PO实例 并使用悲观锁 锁定记录 */ public T getForLock(Serializable id, String... splitTable){ String hql = " from " + entityClass.getSimpleName() + " lockObj where id = :id"; Map paramsMap = new HashMap<>(); paramsMap.put("id",id); Query query = null; query = createQuery(hql, paramsMap, false, splitTable); query.setLockMode("lockObj" , LockMode.PESSIMISTIC_WRITE); List list = query.list(); if(list.size() > 0){ return (T)list.get(0); }else{ return null; } } /** * 执行查询,默认执行hql * * @param hql * @param tableAlias 表别名 * @param obj 查询条件对象 map或object * @return 查询结果 */ public List findByHqlForLock(String hql,String tableAlias, Object obj, String... splitTable) { Query query = null; query = createQuery(hql, obj, false, splitTable); query.setLockMode(tableAlias, LockMode.PESSIMISTIC_WRITE); return query.list(); } /** * 执行查询,默认执行hql * * @param hql * @param obj 查询条件对象 map或object * @return 查询结果 */ public List findByHqlForLock(String hql, Object obj, String... splitTable) { Query query = null; query = createQuery(hql, obj, false, splitTable); query.setLockOptions(LockOptions.UPGRADE); return query.list(); } /** * 获取PO的所有对象 * * @return */ public List<T> loadAll(String... splitTable) { Criteria criteria = getSession(splitTable).createCriteria(entityClass); criteria.setResultTransformer(CriteriaSpecification.DISTINCT_ROOT_ENTITY); return criteria.list(); } public T save(T entity, String... splitTable) throws Exception { setEntityId(entity); PoUtils.setPoDefaultValue(entity); getSession(splitTable).save(entity); setAutoEntityId(entity); return entity; } /** * 删除PO * @param entity */ public void delete(T entity, String... splitTable) { getSession(splitTable).delete(entity); } /** * 根据主键id删除PO */ public void delete(long id, String... splitTable) { String hql = "delete " + entityClass.getName() + " where id = :id"; Map param = new HashMap(); param.put("id", id); executeByHql(hql, param, splitTable); } /** * 获得BasePO类 * @param cls * @return */ private Class getBasePoClass(Class cls){ if(cls == BasePO.class){ return cls; }else{ return getBasePoClass(cls.getSuperclass()); } } private void ONUpdate(T entity) { try { //根据传入的属性名称构造属性的set方法名 Method method = getBasePoClass(entity.getClass()).getMethod("setUpdateTime",Long.class); if (null != method) { method.invoke(entity, new Date().getTime()); } } catch (Exception e) { e.printStackTrace(); } } /** * 更改PO * * @param entity */ public void update(T entity, String... splitTable) { this.ONUpdate(entity); getSession(splitTable).update(entity); } /** * 更改PO * * @param entity */ public void updateSetNullValue(T entity, String... splitTable) throws Exception{ PoUtils.setPoDefaultValue(entity); this.update(entity); } /** * 保存或更新PO,用于保存临时状态或更新游离状态的PO * * @param entity */ public T saveOrUpdate(T entity, String... splitTable) throws Exception { long id = getEntityId(entity); if (id == 0) { this.save(entity, splitTable); } else { T target = (T) get(id, splitTable); if (target != null) { //BeanUtils.copyProperties(entity, target); IScmBeanUtil.copyProperties(entity, target); this.ONUpdate(target); getSession(splitTable).merge(target); } else { this.save(entity, splitTable); } } return entity; } /** * 执行查询,默认执行hql * * @param hql * @param obj 查询条件对象 map或object * @return 查询结果 */ public List findByHql(String hql, Object obj, String... splitTable) { Query query = null; query = createQuery(hql, obj, false, splitTable); return query.list(); } /** * 执行查询,默认执行sql * * @param sql * @param obj 查询条件对象 map或object * @return 查询结果 */ public List findBySql(String sql, Object obj, String... splitTable) { Query query = null; query = createQuery(sql, obj, true, splitTable); return query.list(); } /** * 根据hql查询 * * @param hql * @param obj * @param splitTable * @return * @throws Exception */ public Map pageQueryByHql(String hql, Object obj, String... splitTable) throws Exception { return pagedQuery(hql, obj, false, splitTable); } /** * 根据sql 查询 * * @param sql * @param obj * @param splitTable * @return * @throws Exception */ public Map pageQueryBySql(String sql, Object obj, String... splitTable) throws Exception { return pagedQuery(sql, obj, true, splitTable); } /** * 分页查询函数,使用hql. * * @throws Exception */ private Map pagedQuery(String hql, Object obj, boolean nativeFlag, String... splitTable) throws Exception { Map retMap = new HashMap(); int page = 1, pageSize = 15; String _gridIdForExport = ""; if (obj != null) { int tempNum = 0; tempNum = getPageMessage(obj, "page"); if (tempNum != 0) { page = tempNum; } tempNum = 0; tempNum = getPageMessage(obj, "pageSize"); if (tempNum != 0) { pageSize = tempNum; } } int startIndex = (page - 1) * pageSize; // Count查询 long total = findForRowCount(hql, obj, nativeFlag(nativeFlag), splitTable); Query query = createQuery(hql, obj, nativeFlag(nativeFlag), splitTable); List list = query.setFirstResult(startIndex).setMaxResults(pageSize).list(); retMap.put("rows", list); retMap.put("total", total); return retMap; } /** * 返回第一行第一列(sql查询) * * @param sql * @param obj * @return */ public Object executeScalarBySql(String sql, Object obj, String... splitTable) { return executeScalar(sql, obj, true, splitTable); } /** * 返回第一行第一列(hql查询) * * @param hql * @param obj * @return */ public Object executeScalarByHql(String hql, Object obj, String... splitTable) { return executeScalar(hql, obj, false, splitTable); } /** * 返回第一行第一列 * * @param sql * @param obj * @param nativeFlag * @return */ private Object executeScalar(String sql, Object obj, boolean nativeFlag, String... splitTable) { Query query = createQuery(sql, obj, nativeFlag, splitTable); List list = query.list(); if (null != list && list.size() > 0) { try { Object objtemp = list.get(0); if (null != objtemp) { if (objtemp instanceof Map) { Map map = (Map) objtemp; return map.values().toArray()[0]; } return objtemp; } } catch (Exception e) { } } return null; } /** * 批量执行sql * * @param sql sql * @param params 参数list */ @Deprecated private void batchExecute(final String sql, final List params, String... splitTable) { this.getSession(splitTable).doWork(new Work() { @Override public void execute(Connection conn) throws SQLException { PreparedStatement ps = conn.prepareStatement(sql); try { for (int i = 0; i < params.size(); i++) { Object[] obj = (Object[]) params.get(i); for (int j = 0; j < obj.length; j++) { ps.setObject(j + 1, obj[j]); } ps.addBatch(); } ps.executeBatch(); }finally { ps.close(); } } }); } /** * 批量执行sql * * @param list sql List */ @Deprecated private void executeBatchSql(final List<Map> list, String... splitTable) { this.getSession(splitTable).doWork(new Work() { @Override public void execute(Connection conn) throws SQLException { Statement ps = conn.createStatement(); try { for (int i = 0; i < list.size(); i++) { String sql = (String) list.get(i).get("sql"); ps.addBatch(sql); } ps.executeBatch(); }finally { ps.close(); } } }); } /** * 包装nativeFlag参数 * * @param nativeFlag * @return */ private boolean nativeFlag(boolean... nativeFlag) { boolean flag = false; if (null != nativeFlag && nativeFlag.length > 0) { //更好的写法是if(ArrayUtils.isNotEmpty(nativeFlag),但这是框架级别代码尽量不要依赖第三方工具包 flag = nativeFlag[0]; } return flag; } /** * 获得对象中的page相关属性 * * @param obj * @param proName * @return */ private int getPageMessage(Object obj, String proName) throws IllegalAccessException, NoSuchMethodException, InvocationTargetException { int num = 0; Object numObj; if (obj instanceof Map) { numObj = ((Map) obj).get(proName); } else { numObj = BeanUtils.getProperty(obj, proName); } if (numObj != null) { num = Integer.parseInt(numObj.toString()); } return num; } /** * 执行sql 包括更新等操作 * * @param sql * @param obj */ public int executeBySql(String sql, Object obj, String... splitTable) { Query query = createQuery(sql, obj, true, splitTable); return query.executeUpdate(); } /** * 执行hql 包括更新等操作 * * @param hql * @param obj */ public int executeByHql(String hql, Object obj, String... splitTable) { Query query = createQuery(hql, obj, false, splitTable); return query.executeUpdate(); } /** * 批量执行hql * @param hql * @param list * @param cls * @param splitTable */ public void batchExecuteHql(final String hql, final List <List>list, final Class <T> cls, final String... splitTable) { this.getSession(splitTable).doWork(new Work() { @Override public void execute(Connection conn) throws SQLException { List<ColumnObject> colList = getColumnObjList(cls); String innerSql = hql; if (colList == null) { colList = new ArrayList<ColumnObject>(); } if (colList.size() == 0) { try { makeColumnList(colList, cls); } catch (Exception e) { e.printStackTrace(); } } Table table = cls.getAnnotation(Table.class); innerSql = convertHql2Sql(innerSql, colList); innerSql = innerSql.replace(cls.getSimpleName(), table.name()); if(splitTable != null && splitTable.length > 0){ innerSql = DbShardsUtil.parseSql(innerSql, splitTable[0]); } PreparedStatement ps = conn.prepareStatement(innerSql); try { for (int i = 0; i < list.size(); i++) { List innerList = list.get(i); for (int j = 0; j < innerList.size(); j++) { ps.setObject(j + 1, innerList.get(j)); } ps.addBatch(); } ps.executeBatch(); }finally { ps.close(); } } }); } /** * 创建Query对象. 对于需要first,max,fetchsize,cache,cacheRegion等诸多设置的函数,可以在返回Query后自行设置. * 留意可以连续设置,如下: * <pre> * dao.getQuery(hql).setMaxResult(100).setCacheable(true).list(); * </pre> * * @param hql * @param paramMap 参数map * @param nativeFlag 是否为本地sql */ private Query createQuery(String hql, Object paramMap, boolean nativeFlag, String... splitTable) { Query query = null; if (nativeFlag(nativeFlag) == true) { query = getSession(splitTable).createSQLQuery(hql); query.setResultTransformer(AliasToMapResultTransformer.INSTANCE); } else { query = getSession(splitTable).createQuery(hql); } if (paramMap != null) { if (paramMap instanceof Map) { query.setProperties((Map) paramMap); } else { query.setProperties(paramMap); } } return query; } private long findForRowCount(final String queryStr, final Object paramMap, boolean nativeFlag, String... splitTable) { String countSql = ""; if (nativeFlag(nativeFlag) == true) { countSql = getCountSQL(queryStr); } else { countSql = getCountHQL(queryStr); } return findForLong(countSql, paramMap, nativeFlag(nativeFlag), splitTable); } private String getCountHQL(String hql) { String localObject1 = "*"; hql = hql.replaceAll("\\s+", " "); int i = hql.toLowerCase().indexOf("from "); int j = hql.toLowerCase().indexOf("distinct"); int k = hql.toLowerCase().indexOf("select"); if ((-1 != j) && (i > j) && (j > k)) { String localObject2[] = hql.substring(k + 6, i).split(","); String str = ""; for (int m = 0; m < localObject2.length; m++) { str = localObject2[m].trim(); if (!str.startsWith("distinct")) continue; localObject1 = str; break; } } String localObject2 = "select count(" + localObject1 + ") " + hql.substring(i); return localObject2; } private String getCountSQL(String sql) { sql = sql.replaceAll("\\s+", " "); String str; str = "select count(*) as cnt from ( " + sql + " ) cntTab"; return str; } private long findForLong(final String hql, final Object paramMap, boolean nativeFlag, String... splitTable) { List list = createQuery(hql, paramMap, nativeFlag(nativeFlag), splitTable).list(); if (-1 != hql.toLowerCase().indexOf("group by")){ return list.size(); } if (list != null && list.size() == 1) { if (nativeFlag(nativeFlag) == true) { return ((BigInteger) ((Map) list.get(0)).get("cnt")).longValue(); } else { return (Long) list.get(0); } } else if(list!=null){ return list.size(); }else { return 0l; } } private void setEntityId(T entity) throws Exception { if (entity instanceof NormalBasePO) {//只有分库分表的需要setiId long id = ((NormalBasePO) entity).getId(); if (id <= 0) { long autoId = getAutoId(entity.getClass().getSimpleName()); if (autoId <= 0) { throw new Exception("BaseDao.setEntityId has error when entity(" + entity.getClass().getSimpleName() + ") to get autoId!"); } ((NormalBasePO) entity).setId(autoId); } } } /** * * @param entity */ private void setAutoEntityId(T entity) { try { if (entity instanceof AutoBasePO) { Long id = (Long)getSession().getIdentifier(entity); ((AutoBasePO) entity).setId(id); } } catch (Exception e) { e.printStackTrace(); } } private int getAutoId(String entityName) { Integer key = AutoIdConstants.getMap().get(entityName); if (null != key && key > 0) { return autoIdClient.getAutoId(key); } return 0; } private long getEntityId(T entity) { long id = 0; try { if (entity instanceof AutoBasePO) { id = ((AutoBasePO) entity).getId(); } else if (entity instanceof NormalBasePO) { id = ((NormalBasePO) entity).getId(); } else { Method method = entity.getClass().getMethod("getId"); id = (long) method.invoke(entity); } } catch (Exception e) { e.printStackTrace(); } return id; } void setSessionFactory(SessionFactory sessionFactory) { this.sessionFactory = sessionFactory; } SessionFactory getSessionFactory() { return sessionFactory; } Session getSession(String... splitid) { if (null != splitid && splitid.length > 0) { DatabaseContextHolder.setCustomerTable(splitid[0]); } return sessionFactory.getCurrentSession(); } /** * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。</br> * 例如:HELLO_WORLD->HelloWorld * @param name 转换前的下划线大写方式命名的字符串 * @return 转换后的驼峰式命名的字符串 */ private String camelName(String name) { StringBuilder result = new StringBuilder(); // 快速检查 if (name == null || name.isEmpty()) { // 没必要转换 return ""; } else if (!name.contains("_")) { // 不含下划线,仅将首字母小写 return name.substring(0, 1).toLowerCase() + name.substring(1); } // 用下划线将原始字符串分割 String camels[] = name.split("_"); for (String camel : camels) { // 跳过原始字符串中开头、结尾的下换线或双重下划线 if (camel.isEmpty()) { continue; } // 处理真正的驼峰片段 if (result.length() == 0) { // 第一个驼峰片段,全部字母都小写 result.append(camel.toLowerCase()); } else { // 其他的驼峰片段,首字母大写 result.append(camel.substring(0, 1).toUpperCase()); result.append(camel.substring(1).toLowerCase()); } } return result.toString(); } private ConcurrentMap<Class,List<ColumnObject>> batchSqlEntityMap = new ConcurrentHashMap<Class,List<ColumnObject>>(); private String convertHql2Sql(String sql,List<ColumnObject>list){ for(ColumnObject col:list){ String ori = col.getClsField(); String dest = col.getField(); sql = sql.replace(ori,dest); } return sql; } private List<ColumnObject> getColumnObjList(Class cls){ return batchSqlEntityMap.get(cls); } private void setColumnObjList(Class cls,List<ColumnObject> list){ batchSqlEntityMap.putIfAbsent(cls, list); } private String makefrontSql(List<ColumnObject>list,String tableName,Class cls){ List <String>fieldList = new ArrayList<String>(); for(ColumnObject columnObject:list){ if(columnObject.getField().equals("id")){ if(columnObject.getIdType().equals("db")){ continue; } } fieldList.add(columnObject.getField()); } String fieldSql = fieldList.stream().collect(Collectors.joining(", ")); return "insert into "+ tableName+" ("+fieldSql+") "; } private String makeValueSql(List<ColumnObject>list,Map map,Class cls){ List<String>valueList = new ArrayList<String>(); for(ColumnObject columnObject:list){ if(columnObject.getField().equals("id")){ if(columnObject.getIdType().equals("db")){ }else{ valueList.add(String.valueOf(map.get(columnObject.getClsField()))); } continue; } Object valueObj = map.get(columnObject.getClsField()); String value = ""; if(valueObj == null){ value = "null"; }else{ if(columnObject.getType().equals("1")){ value = getSqlVal(String.valueOf(valueObj)); }else{ value += String.valueOf(valueObj); } } valueList.add(value); } String valueSql = valueList.stream() .collect(Collectors.joining(", ")); return "("+valueSql+")"; } public void executeBatchSqlByEntity(final List <Map>list, final Class <T>cls, String... splitTable){ this.getSession(splitTable).doWork(new Work() { @Override public void execute(Connection conn) throws SQLException { List <ColumnObject> colList = getColumnObjList(cls); if(colList == null){ colList = new ArrayList<ColumnObject> (); } if(colList.size()==0){ try { makeColumnList(colList,cls); } catch (Exception e) { e.printStackTrace(); } } Statement ps = conn.createStatement(); long start = System.currentTimeMillis(); Table table = cls.getAnnotation(Table.class); String sql = makefrontSql(colList,table.name(),cls) +" values"; for (int i = 0; i < list.size(); i++) { Map map = list.get(i); sql+= makeValueSql(colList,map,cls) + ","; } sql = sql.substring(0,sql.length()-1); try { ps.execute(sql); System.out.println("反射用了 " + String.valueOf(System.currentTimeMillis() - start) + "ms"); ps.executeBatch(); }finally { ps.close(); } } }); } public void executeBatchSqlByEntity(final String sql, final List <Map>list, final Class <T>cls, String... splitTable) { this.getSession(splitTable).doWork(new Work() { @Override public void execute(Connection conn) throws SQLException { List <ColumnObject> colList = getColumnObjList(cls); if(colList == null){ colList = new ArrayList<ColumnObject> (); } if(colList.size()==0){ try { makeColumnList(colList,cls); } catch (Exception e) { e.printStackTrace(); } } Statement ps = conn.createStatement(); ps.clearBatch(); long start = System.currentTimeMillis(); Table table = cls.getAnnotation(Table.class); try { for (int i = 0; i < list.size(); i++) { try { // System.out.println(makeBatchSql(colList,list.get(i))); ps.addBatch(makeBatchSql(colList, list.get(i), table.name(), cls)); } catch (Exception e) { e.printStackTrace(); } } System.out.println("反射用了 " + String.valueOf(System.currentTimeMillis() - start) + "ms"); ps.executeBatch(); }finally { ps.close(); } } }); } public String makeBatchSql(List<ColumnObject>list,Map map,String tableName,Class cls) throws InvocationTargetException, IllegalAccessException, NoSuchFieldException { List<String> fieldList = new ArrayList<String>(); List<String> valueList = new ArrayList<String>(); for(ColumnObject columnObject:list){ if(columnObject.getField().equals("id")){ if(columnObject.getIdType().equals("db")){ }else{ fieldList.add(columnObject.getField()); valueList.add(String.valueOf(map.get(columnObject.getClsField()))); } continue; } fieldList.add(columnObject.getField()); Object valueObj = map.get(columnObject.getClsField()); String value = ""; if(valueObj == null){ value = "null"; }else{ if(columnObject.getType().equals("1")){ value = getSqlVal(String.valueOf(valueObj)); }else{ value += String.valueOf(valueObj); } } valueList.add(value); } String fieldSql = fieldList.stream() .collect(Collectors.joining(", ")); String valueSql = valueList.stream() .collect(Collectors.joining(", ")); return "insert into "+ tableName+" ("+fieldSql+") " + " values("+valueSql+")"; } /** * 拼装sql val * @param val * @return */ public String getSqlVal(String val){ return "'" + getPreventInjectValue(val) + "'"; } /** * 获得防注入的val * @param val * @return */ public String getPreventInjectValue(String val){ return val.replaceAll("'","''"); } private void makeColumnList(List list,Class cls) throws IllegalAccessException, InstantiationException, InvocationTargetException { if(cls == Object.class){ return; } Method m[]=cls.getDeclaredMethods(); for(int i = 0;i < m.length;i++){ Method m1 = m[i]; Column col = m1.getAnnotation(Column.class); if(col != null){ ColumnObject columnObject = new ColumnObject(); columnObject.setField(col.name()); columnObject.setNullable(col.nullable()); columnObject.setMethod(m1); columnObject.setFieldCls(m1.getReturnType()); if(col.name().equals("id")){ if(cls == NormalBasePO.class){ columnObject.setIdType("service"); }else{ columnObject.setIdType("db"); } } String clsFieldTemp= m1.getName().substring(3); clsFieldTemp = (char)(clsFieldTemp.charAt(0) + 32)+clsFieldTemp.substring(1); columnObject.setClsField(clsFieldTemp); list.add(columnObject); } } if(cls.getSuperclass()!=null){ makeColumnList(list, cls.getSuperclass()); } } class ColumnObject{ private String field; private Method method; private String type; private Class fieldCls; private boolean isNullable; private String idType; private String clsField; public String getField() { return field; } public void setField(String field) { this.field = field; } public Method getMethod() { return method; } public void setMethod(Method method) { this.method = method; } public String getType() { return type; } public void setType(String type) { this.type = type; } public Class getFieldCls() { return fieldCls; } public void setFieldCls(Class fieldCls) { this.fieldCls = fieldCls; if(fieldCls == String.class){ this.setType("1"); }else{ this.setType("2"); } } public boolean isNullable() { return isNullable; } public void setNullable(boolean isNullable) { this.isNullable = isNullable; } public String getIdType() { return idType; } public void setIdType(String idType) { this.idType = idType; } public String getClsField() { return clsField; } public void setClsField(String clsField) { this.clsField = clsField; } } }
3c48c02ba4ada0b8f186b38eef8480f4a0b7aedb
c3907d0dffca2dffe408934cca7656715a27cee7
/zhihu/src/main/java/com/github/wycm/zhihu/task/TopicActivityPageTask.java
b26fe3d86074899819642bcf5434510b5f46c975
[ "LicenseRef-scancode-unknown-license-reference" ]
permissive
wycm/zhihu-crawler
388b6cf2dcf3a8732c8438e0ae03b8070e32a7fe
f9eb6def1ae4798d26132127151eca28b6caad5b
refs/heads/3.0
2022-07-30T00:15:27.173033
2019-04-02T08:34:59
2019-04-02T08:34:59
57,126,883
1,026
439
Apache-2.0
2019-04-02T08:35:00
2016-04-26T12:36:34
Java
UTF-8
Java
false
false
4,922
java
package com.github.wycm.zhihu.task; import com.github.wycm.common.*; import com.github.wycm.common.util.CrawlerUtils; import com.github.wycm.common.util.PatternUtil; import com.github.wycm.proxy.AbstractHttpClient; import com.github.wycm.proxy.AbstractPageTask; import com.github.wycm.zhihu.dao.mongodb.entity.Answer; import com.github.wycm.zhihu.dao.mongodb.entity.Article; import com.github.wycm.zhihu.dao.mongodb.entity.TopicActivity; import com.github.wycm.zhihu.service.ZhihuComponent; import lombok.NoArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeanUtils; import java.util.List; /** * Created by wycm on 2018/10/17. * 话题动态抓取task */ @Slf4j @NoArgsConstructor public class TopicActivityPageTask extends AbstractPageTask { private ZhihuComponent zhihuComponent; public TopicActivityPageTask(CrawlerMessage message, ZhihuComponent zhihuComponent){ super(message); this.url = message.getUrl(); this.currentRetryTimes = message.getCurrentRetryTimes(); this.proxyFlag = true; this.zhihuComponent = zhihuComponent; } @Override public void run(){ try { Page page = getHttpClient().executeRequestWithRetry(new CrawlerMessage(url), (String s) -> false); if (page == null){ log.debug("executeRequestWithRetry failed, url:{}", url); } else { handle(page); } receiveNewTask(); } catch (InterruptedException e){ log.error(e.getMessage(), e); } catch (Exception e1){ log.error("meet unknown exception"); log.error(e1.getMessage(), e1); try { receiveNewTask(); } catch (InterruptedException e) { log.error(e.getMessage(), e); return; } } } @Override protected void createNewTask(CrawlerMessage crawlerMessage) { } /** * 话题动态页面,可以获取到【问题】、【答案】(问题的部分答案)、【文章】 * @param page */ @Override protected void handle(Page page) { if (!page.getHtml().contains("paging")) { //代理异常,未能正确返回目标请求数据,丢弃 currentProxy = null; return; } List<TopicActivity> list = zhihuComponent.getZhihuTopicActivityMongoPageParser().parseListPage(page); log.info("topicActivity parse_success, size:{}", list.size()); list.forEach(t -> { zhihuComponent.getZhihuTopicActivityMongodbDao().replace(t); if (t.getTarget().getType().equals("answer")) { log.debug("find answer activity"); Answer answer = new Answer(); zhihuComponent.getZhihuQuestionMongodbDao().insert(t.getTarget().getQuestion()); BeanUtils.copyProperties(t.getTarget(), answer); zhihuComponent.getZhihuAnswerMongodbDao().replace(answer); } else if (t.getTarget().getType().equals("article")) { log.debug("find article activity"); Article article = new Article(); BeanUtils.copyProperties(t.getTarget(), article); zhihuComponent.getZhihuArticleMongodbDao().replace(article); } }); String topicId = PatternUtil.group(page.getUrl(), "topics/(\\d+)/feeds", 1); zhihuComponent.getTopicMongodbDao().updateTopicActivityUpdateTime(topicId); log.info("topicActivity store_success, size:{}", list.size()); } @Override public void retry() { if (getCurrentRetryTimes() <= getMaxRetryTimes()) { crawlerMessage.setCurrentRetryTimes(crawlerMessage.getCurrentRetryTimes() + 1); zhihuComponent.getTaskQueueService().sendTask(CrawlerUtils.getTaskQueueName(this.getClass()), crawlerMessage, 10000); } else { log.warn(this.getClass().getSimpleName() + "maxRetryTimes:{}, currentRetryTimes:{}", getMaxRetryTimes(), getCurrentRetryTimes()); } } @Override protected AbstractHttpClient getHttpClient() { return zhihuComponent.getZhihuHttpClient(); } @Override protected String getProxyQueueName() { return zhihuComponent.getCommonProperties().getTargetPageProxyQueueName(); } @Override protected ProxyQueue getProxyQueue() { return zhihuComponent.getProxyQueue(); } @Override protected TaskQueueService getTaskQueueService() { return zhihuComponent.getTaskQueueService(); } @Override protected LocalIPService getLocalIPService() { return zhihuComponent.getLocalIPService(); } @Override public int getMaxRetryTimes() { return 3; } @Override public int getCurrentRetryTimes() { return 0; } }
1a102b5ca1aa5d74fd36e8b9f45ac3972e04cc70
498cead6076648ffe53087d06bd57d126514c3ae
/datosTipoObjeto/ListaVehiculo.java
2a2752cbf3e84feb2439f5d28e46c7eeba9fcaf0
[]
no_license
fjsaca2001/poo2020
513224f4a15c3491daf0d1f069d97fadcea9e5d4
31ae77dd7f42b0331188a0c7a5b4c2d2238b266e
refs/heads/master
2020-12-31T08:16:57.796981
2020-03-06T17:22:15
2020-03-06T17:22:15
238,947,445
0
0
null
null
null
null
UTF-8
Java
false
false
2,808
java
package datosTipoObjeto; import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class ListaVehiculo { public static void main(String[] args) { Scanner entrada = new Scanner(System.in); List<Vehiculo> vehiculos = new ArrayList<Vehiculo>(); boolean b = true; System.out.println("Sistema de ingreso de vehiculos"); do { System.out.println("Dijite 1 para almacenar un nuevo vehiculo."); System.out.println("Dijite 2 para presentar."); System.out.println("Dijite 3 para salir."); int c = entrada.nextInt(); entrada.nextLine(); switch (c){ case 1: Vehiculo vehiculo = new Vehiculo(); System.out.print("Ingrese placa: "); vehiculo.setPlaca(entrada.nextLine()); System.out.print("Ingrese marca: "); vehiculo.setMarca(entrada.nextLine()); System.out.print("Ingrese modelo: "); vehiculo.setModelo(entrada.nextLine()); System.out.print("Ingrese color: "); vehiculo.setColor(entrada.nextLine()); System.out.print("Ingrese año: "); vehiculo.setAnio(entrada.nextInt()); entrada.nextLine(); System.out.print("Ingrese cilindraje: "); vehiculo.setCilindraje(entrada.nextInt()); entrada.nextLine(); vehiculos.add(vehiculo); break; case 2: //System.out.println("Vehiculos Ingresados"); for (Vehiculo v: vehiculos) { /* System.out.println("Placa: "+v.getPlaca()+"\nMarca: "+v.getMarca()+"\nCilindraje: "+ v.getCilindraje());*/ System.out.println("---------------------------------"); System.out.println("Placa: "+v.getPlaca()); System.out.println("Marca: "+v.getMarca()); System.out.println("Cilindraje: "+v.getCilindraje()); System.out.println("Año: "+v.getAnio()); System.out.println("Modelo: "+v.getModelo()); System.out.println("Color: "+v.getColor()); System.out.println("---------------------------------"); } break; case 3: b = false; break; default: System.out.println("Incorrecto. verifique su respuesta"); } }while (b); } }
157aa5e7079c8e55a0e77164d3023b5a509838df
13ea5da0b7b8d4ba87d622a5f733dcf6b4c5f1e3
/crash-reproduction-new-fitness/results/TIME-7b-5-22-Single_Objective_GGA-WeightedSum-BasicBlockCoverage-opt/org/joda/time/format/DateTimeParserBucket_ESTest.java
cc7c2953c0a4f704ac5c23270fd1c76e1c52c3c2
[ "MIT", "CC-BY-4.0" ]
permissive
STAMP-project/Botsing-basic-block-coverage-application
6c1095c6be945adc0be2b63bbec44f0014972793
80ea9e7a740bf4b1f9d2d06fe3dcc72323b848da
refs/heads/master
2022-07-28T23:05:55.253779
2022-04-20T13:54:11
2022-04-20T13:54:11
285,771,370
0
0
null
null
null
null
UTF-8
Java
false
false
1,492
java
/* * This file was automatically generated by EvoSuite * Wed Oct 27 16:36:55 UTC 2021 */ package org.joda.time.format; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.shaded.org.mockito.Mockito.*; import static org.evosuite.runtime.EvoAssertions.*; import java.util.Locale; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.ViolatedAssumptionAnswer; import org.joda.time.Chronology; import org.joda.time.DateTimeFieldType; import org.joda.time.DateTimeZone; import org.joda.time.format.DateTimeParserBucket; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class DateTimeParserBucket_ESTest extends DateTimeParserBucket_ESTest_scaffolding { @Test(timeout = 4000) public void test0() throws Throwable { Chronology chronology0 = mock(Chronology.class, new ViolatedAssumptionAnswer()); doReturn((DateTimeZone) null).when(chronology0).getZone(); doReturn((Chronology) null).when(chronology0).withUTC(); DateTimeParserBucket dateTimeParserBucket0 = new DateTimeParserBucket(1001L, chronology0, (Locale) null); DateTimeFieldType.halfdayOfDay(); DateTimeFieldType dateTimeFieldType0 = DateTimeFieldType.dayOfWeek(); dateTimeParserBucket0.saveField(dateTimeFieldType0, 45); // Undeclared exception! dateTimeParserBucket0.computeMillis(false, "%(+W]6MK"); } }
1b8716366508079687a226836a2f5baa0651aa30
4039d9871b35e4533691c48c6a67d028fba39c24
/src/main/java/org/springframework/cloud/gateway/swagger/model/Contact.java
8830419345ebbf1a33b13456e15e32d0a1045f58
[ "Apache-2.0" ]
permissive
shengnian/spring-cloud-gateway-swagger2
b88b2c4214bc8ef3dd08dc9e7e7bd3dcda9f2154
3ae4c26ed8cfac146a27f59ba01431dcbf943f32
refs/heads/master
2020-06-16T10:41:53.484087
2019-06-28T04:01:00
2019-06-28T04:01:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,250
java
/* * Copyright (c) 2018, vindell (https://github.com/vindell). * * 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.springframework.cloud.gateway.swagger.model; public class Contact { /** * 联系人 **/ private String name = ""; /** * 联系人url **/ private String url = ""; /** * 联系人email **/ private String email = ""; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getUrl() { return url; } public void setUrl(String url) { this.url = url; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } }
b6cb7e6f48e6eb7f99a9306e2630a02aecefa1b6
83ee46f7cd73ef009d60edb2ef6f8978bb6188f3
/app/src/main/java/com/justrelief/fragments/ContactClinicDetailsFragment.java
a72da19cdb97d909b124aefe7d4f33cdda843aff
[]
no_license
garg26/JustRelief
c0ac55cb03e350723be29b68399cef026fa9dc16
322e5f85eb27030fe8123b3a3479d832b43d570a
refs/heads/master
2021-01-02T09:00:13.565199
2019-04-26T14:21:40
2019-04-26T14:21:40
99,117,881
0
0
null
2017-08-03T06:46:43
2017-08-02T13:12:17
Java
UTF-8
Java
false
false
23,671
java
package com.justrelief.fragments; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.Gravity; import android.view.LayoutInflater; import android.view.View; import android.widget.AdapterView; import android.widget.ImageView; import android.widget.LinearLayout; import com.justrelief.R; import com.justrelief.models.response.GetClinicResponse; import com.justrelief.models.response.GetClinicResponseTable; import com.justrelief.models.response.GetPaymentResponse; import com.tokenautocomplete.TokenCompleteTextView; import java.io.File; import java.util.ArrayList; import java.util.List; import simplifii.framework.activity.IMAGEViewer; import simplifii.framework.activity.PDFViewer; import simplifii.framework.asyncmanager.FileParamObject; import simplifii.framework.asyncmanager.HttpParamObject; import simplifii.framework.exceptionhandler.RestException; import simplifii.framework.fragments.MediaFragment; import simplifii.framework.models.BaseApi; import simplifii.framework.models.ContactClinicResponse; import simplifii.framework.models.DeleteFilesItem; import simplifii.framework.models.FileUploadUrlItem; import simplifii.framework.models.GetDocFileItem; import simplifii.framework.models.GetDocFileTable; import simplifii.framework.models.GetFileItem; import simplifii.framework.models.MasterListResponse; import simplifii.framework.models.response.MasterValues; import simplifii.framework.utility.AppConstants; import simplifii.framework.utility.BaseApiGenerator; import simplifii.framework.utility.CollectionUtils; import simplifii.framework.widgets.ContactsCompletionView; import simplifii.framework.widgets.CustomFontTextView; public class ContactClinicDetailsFragment extends AppBaseFragment implements AdapterView.OnItemSelectedListener { private MediaFragment mediaFragment; private List<String> list_selected_payment; private String documentType; private List<MasterValues> document_list, payment_list; private LinearLayout ll_image_container; @Override public void initViews() { ll_image_container = (LinearLayout) findView(R.id.ll_image_container); list_selected_payment = new ArrayList<>(); ContactsCompletionView completionView = (ContactsCompletionView) findView(R.id.ccv_payment_mode); completionView.setTokenListener(new TokenCompleteTextView.TokenListener<String>() { @Override public void onTokenAdded(String token) { list_selected_payment.add(token); } @Override public void onTokenRemoved(String token) { list_selected_payment.remove(token); } }); GetClinicResponseTable clinicResponseTable = null; Bundle bundle = getActivity().getIntent().getBundleExtra(AppConstants.BUNDLE_KEYS.EXTRA_BUNDLE); if (bundle != null) { clinicResponseTable = (GetClinicResponseTable) bundle.getSerializable(AppConstants.BUNDLE_KEYS.CLINIC_DETAIL); } getClinicResponse(clinicResponseTable); getPaymentResponse(clinicResponseTable); getDocumentFile(); getPaymentList(); mediaFragment = new MediaFragment(); getActivity().getSupportFragmentManager().beginTransaction().add(mediaFragment, "Profile image").commit(); setOnItemSelectedListener(this, R.id.spin_documents_type); setOnClickListener(R.id.btn_save_and_next, R.id.tv_clinic_type_image, R.id.tv_document_image, R.id.btn_upload); } private void getPaymentResponse(GetClinicResponseTable clinicResponseTable) { if (clinicResponseTable != null) { List<GetPaymentResponse> paymentResponse = clinicResponseTable.getTable2(); if (paymentResponse != null && paymentResponse.size() > 0) { for (int i = 0; i < paymentResponse.size(); i++) { String label = paymentResponse.get(i).getLabel(); ContactsCompletionView completionView = (ContactsCompletionView) findView(R.id.ccv_payment_mode); completionView.addObject(label); } } } } private void getClinicResponse(GetClinicResponseTable clinicResponseTable) { if (clinicResponseTable != null) { String clinic_name = null, clinic_email = null, clinic_phone = null, facilityImage = null, overView = null; List<GetClinicResponse> clinicResponse = clinicResponseTable.getTable(); if (clinicResponse != null) { for (int i = 0; i < clinicResponse.size(); i++) { GetClinicResponse clinicIndex = clinicResponse.get(i); clinic_name = clinicIndex.getFacilityName(); clinic_email = clinicIndex.getFacilityEmailId(); clinic_phone = clinicIndex.getFacilityPhone(); facilityImage = clinicIndex.getFacilityImage(); overView = clinicIndex.getOverView(); } } setResponse(clinic_name, clinic_email, clinic_phone, overView, facilityImage); } } private void setResponse(String clinic_name, String clinic_email, String clinic_phone, String overView, String facilityImage) { setEditText(R.id.et_contact_number, clinic_phone); setEditText(R.id.et_email, clinic_email); setEditText(R.id.et_clinic_name, clinic_name); setEditText(R.id.et_about_clinic, overView); setImageNameToLayout(facilityImage); } private void getPaymentList() { HttpParamObject httpParamObject = BaseApiGenerator.getMasterList(); executeTask(AppConstants.TASKCODES.MASTER_LIST, httpParamObject); } @Override public void onClick(View v) { int i = v.getId(); if (i == R.id.btn_save_and_next) { upload(); } else if (i == R.id.tv_document_image) { askPermissions(AppConstants.MEDIA_TYPES.DOC); } else if (i == R.id.tv_clinic_type_image) { askPermissions(AppConstants.MEDIA_TYPES.IMAGE); } else if (i == R.id.btn_upload) { uploadDocument(); } } @Override protected void onPermissionVerify(String mediaType) { if (mediaType.equals("doc")) { getDocument(); } else { getImage(); } } private void uploadDocument() { File file = null; if (getTag(R.id.tv_document_image) != null) { file = getTag(R.id.tv_document_image); } if (file != null) { if (file.exists()) { String facilityID = getFacilityID(); String fileExtension = getFileExtension(file); if (CollectionUtils.isNotEmpty(facilityID) && CollectionUtils.isNotEmpty(fileExtension)) { String docTypeID = getDocTypeID(documentType); if (CollectionUtils.isNotEmpty(docTypeID) && !docTypeID.equalsIgnoreCase("0")) { FileUploadUrlItem urlItem = new FileUploadUrlItem(facilityID, AppConstants.FILE_TYPES.PDF, docTypeID, fileExtension); FileParamObject fileParamObject = BaseApiGenerator.uploadDocument(urlItem, file); executeTask(AppConstants.TASKCODES.UPLOAD_DOCUMENT, fileParamObject); } else { showToast(getString(R.string.error_document_type_empty)); } } else { showToast(R.string.error); } } else { showToast(getString(R.string.error_document_empty)); } } else { showToast(getString(R.string.error_document_empty)); } } private void getImage() { mediaFragment.getImage(new MediaFragment.MediaListener() { @Override public void setUri(Uri uri, String MediaType) { } @Override public void setUri(Uri uri, String MediaType, String path) { } @Override public void setBitmap(Bitmap bitmap, String MediaType) { // if (bitmap != null) { // setImagePath(bitmap, R.id.tv_clinic_type_image); // } if (MediaType.equals("img")) { if (bitmap != null) { getImagePathFromBitmap(bitmap, R.id.tv_clinic_type_image); } } } }, getActivity()); } private void getDocument() { mediaFragment.getDoc(new MediaFragment.MediaListener() { @Override public void setUri(Uri uri, String MediaType) { } @Override public void setUri(Uri uri, String MediaType, String path) { if (MediaType.equals("doc")) { File doc_path = new File(path); if (doc_path.exists()) { String name = doc_path.getName(); setText(R.id.tv_document_image, name); setTag(R.id.tv_document_image, doc_path); } } } @Override public void setBitmap(Bitmap bitmap, String MediaType) { if (MediaType.equals("img")) { if (bitmap != null) { getImagePathFromBitmap(bitmap, R.id.tv_document_image); } } } }, getActivity()); } private String getDocTypeID(String documentType) { int value = 0; for (int i = 0; i < document_list.size(); i++) { if (document_list.get(i).getLabel().equals(documentType)) { value = document_list.get(i).getValue(); } } return String.valueOf(value); } private void upload() { File file = null; if (getTag(R.id.tv_clinic_type_image) != null) { file = getTag(R.id.tv_clinic_type_image); } if (file != null) { if (file.exists()) { String facilityID = getFacilityID(); String fileExtension = getFileExtension(file); if (CollectionUtils.isNotEmpty(facilityID) && CollectionUtils.isNotEmpty(fileExtension)) { if (CollectionUtils.isNotEmpty(list_selected_payment)) { String payModeID = getValueIDs(list_selected_payment, payment_list); if (CollectionUtils.isNotEmpty(payModeID)) { if (CollectionUtils.isNotEmpty(getEditText(R.id.et_contact_number))) { if (CollectionUtils.isNotEmpty(getEditText(R.id.et_email))) { if (CollectionUtils.isNotEmpty(getEditText(R.id.et_about_clinic))) { ContactClinicResponse clinicResponse = new ContactClinicResponse(facilityID, getEditText(R.id.et_contact_number), getEditText(R.id.et_email), getEditText(R.id.et_about_clinic), payModeID, fileExtension); FileParamObject fileParamObject = BaseApiGenerator.uploadImage(file, file.getName(), clinicResponse); executeTask(AppConstants.TASKCODES.UPLOAD_IMAGE, fileParamObject); } else { showToast(getString(R.string.error_about_clinic_empty)); } } else { showToast(getString(R.string.email_address_empty)); } } else { showToast(getString(R.string.error_contact_no_empty)); } } else { showToast(getString(R.string.error_payment_mode_empty)); } } else { showToast(getString(R.string.error_payment_mode_empty)); } } else { showToast(R.string.error); } } else { showToast(R.string.clinic_image_empty); } } else { showToast(R.string.clinic_image_empty); } // String fileExtension = getFileExtension(file); // String facilityID = getFacilityID(); // // if (CollectionUtils.isNotEmpty(facilityID)) { // String payModeID = getValueIDs(list_selected_payment, payment_list); // if (CollectionUtils.isNotEmpty(getEditText(R.id.et_contact_number)) && CollectionUtils.isNotEmpty(getEditText(R.id.et_email)) && CollectionUtils.isNotEmpty(payModeID)) { // ContactClinicResponse clinicResponse = new ContactClinicResponse(facilityID, getEditText(R.id.et_contact_number), getEditText(R.id.et_email), getEditText(R.id.et_about_clinic), payModeID, fileExtension); // FileParamObject fileParamObject = BaseApiGenerator.uploadImage(file, file.getName(), clinicResponse); // executeTask(AppConstants.TASKCODES.UPLOAD_IMAGE, fileParamObject); // } // } } private String getFileExtension(File file) { String extension = null; if (file.exists()) { String absolutePath = file.getAbsolutePath(); int i = absolutePath.lastIndexOf("."); extension = absolutePath.substring(i + 1); } return extension; } private String getStringExtension(String string) { String extension = null; if (CollectionUtils.isNotEmpty(string)) { int i = string.lastIndexOf("."); extension = string.substring(i + 1); } return extension; } @Override public int getViewID() { return R.layout.fragment_contact_clinic_details; } @Override public void onPostExecute(Object response, int taskCode, Object... params) { super.onPostExecute(response, taskCode, params); if (response == null) { return; } switch (taskCode) { case AppConstants.TASKCODES.UPLOAD_IMAGE: BaseApi baseApi = (BaseApi) response; if (baseApi.isSuccess()) { showToast(getString(R.string.information_save_successfully)); getActivity().setResult(AppConstants.RESULT_CODE.CLINIC_CONTACT); getActivity().finish(); } else { showToast(R.string.fail); } break; case AppConstants.TASKCODES.UPLOAD_DOCUMENT: BaseApi baseApi1 = (BaseApi) response; if (baseApi1.isSuccess()) { showToast(getString(R.string.document_upload_successfully)); ll_image_container.removeAllViews(); startFragment(); } break; case AppConstants.TASKCODES.MASTER_LIST: MasterListResponse masterListResponse = (MasterListResponse) response; List<MasterValues> paymentList = masterListResponse.getTable(); List<MasterValues> documentList = masterListResponse.getTable1(); payment_list = paymentList; document_list = documentList; List<MasterValues> payment_list = getList(paymentList); List<String> paymentlist = getLabel(payment_list); if (CollectionUtils.isNotEmpty(paymentlist)) { setAdapter(paymentlist); } List<MasterValues> document_list = getList(documentList); List<String> label = getLabel(document_list); label.add(0, getString(R.string.select_document_type)); setadapter(label, R.id.spin_documents_type); break; case AppConstants.TASKCODES.DOC_FILE: GetDocFileTable docTable = (GetDocFileTable) response; setDocNameToLayout(docTable); break; case AppConstants.TASKCODES.DELETE_FILE: BaseApi baseApi2 = (BaseApi) response; if (baseApi2.isSuccess()) { showToast(getString(R.string.delete_successfully)); startFragment(); } else { showToast(R.string.fail); } break; } } private String getFacilityID() { String facilityID = null; Bundle bundle = getActivity().getIntent().getBundleExtra(AppConstants.BUNDLE_KEYS.EXTRA_BUNDLE); if (bundle.size() > 0) { facilityID = bundle.getString(AppConstants.BUNDLE_KEYS.FACILITYID); } return facilityID; } private void startFragment() { Fragment fragment = new ContactClinicDetailsFragment(); getActivity().getSupportFragmentManager().beginTransaction().replace(R.id.frame, fragment).commit(); } private void setDocNameToLayout(GetDocFileTable docTable) { List<GetDocFileItem> docFileItems = docTable.getTable(); if (docFileItems == null) { setNoRecord(); } else { for (int i = 0; i < docFileItems.size(); i++) { GetDocFileItem getDocFileItem = docFileItems.get(i); String docDesc = getDocFileItem.getDocDesc(); String docPath = getDocFileItem.getDocPath(); Integer id = getDocFileItem.getID(); String stringExtension = getStringExtension(docPath); if (stringExtension.equals("pdf")) { setImageToLayout(docPath, docDesc, AppConstants.FILE_TYPES.PDF, id.toString()); } else { setImageToLayout(docPath, docDesc, AppConstants.FILE_TYPES.IMG, id.toString()); } } } } private void setImageToLayout(final String fileURL, String type, final String fileType, final String fileID) { final View view = addDocFileToLayout(); setNoRecordGone(); findView(R.id.tv_image_name).setVisibility(View.VISIBLE); findView(R.id.tv_upload_file).setVisibility(View.VISIBLE); CustomFontTextView fileName = (CustomFontTextView) view.findViewById(R.id.tv_upload_image); CustomFontTextView tv_title = (CustomFontTextView) view.findViewById(R.id.tv_image_title); String name = fileURL.substring(fileURL.lastIndexOf("/") + 1); fileName.setSelected(true); fileName.setText(name); tv_title.setText(type); ImageView iv_delete = (ImageView) view.findViewById(R.id.iv_upload_delete); if (fileType.equals(AppConstants.FILE_TYPES.IMAGE)) { iv_delete.setVisibility(View.GONE); } iv_delete.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { deleteEntry(fileID, AppConstants.FILE_TYPES.PDF); ll_image_container.removeView(view); } }); if (fileType.equals(AppConstants.FILE_TYPES.PDF)) { fileName.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Bundle bundle = new Bundle(); bundle.putString(AppConstants.BUNDLE_KEYS.DOC_FILE_URL, fileURL); startNextActivity(bundle, PDFViewer.class); } }); } else { fileName.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Bundle bundle = new Bundle(); bundle.putString(AppConstants.BUNDLE_KEYS.IMG_FILE_URL, fileURL); startNextActivity(bundle, IMAGEViewer.class); } }); } ll_image_container.addView(view); } private void setNoRecordGone() { CustomFontTextView tv_no_record = (CustomFontTextView) findView(R.id.tv_no_record); tv_no_record.setVisibility(View.GONE); } private void deleteEntry(String fileID, String fileType) { String facilityID = getFacilityID(); if (CollectionUtils.isNotEmpty(facilityID)) { DeleteFilesItem filesItem = new DeleteFilesItem(facilityID, fileID, fileType); HttpParamObject httpParamObject = BaseApiGenerator.deleteTimeEntry(filesItem); executeTask(AppConstants.TASKCODES.DELETE_FILE, httpParamObject); } } private void setNoRecord() { CustomFontTextView tv_no_record = (CustomFontTextView) findView(R.id.tv_no_record); tv_no_record.setVisibility(View.VISIBLE); tv_no_record.setGravity(Gravity.CENTER); tv_no_record.setText(R.string.no_record_found); } private void setImageNameToLayout(String fileURL) { if (CollectionUtils.isEmpty(fileURL)) { setNoRecord(); } else { setImageToLayout(fileURL, getString(R.string.upload_image), AppConstants.FILE_TYPES.IMAGE, AppConstants.FILE_TYPES.PDF); } } private void callImageViewerActivity(CustomFontTextView fileName, final String docPath) { } private void callPdfViewerActivity(CustomFontTextView fileName, final String docPath) { } private View addDocFileToLayout() { LayoutInflater inflater = LayoutInflater.from(getActivity()); return inflater.inflate(R.layout.row_photos, ll_image_container, false); } private List<MasterValues> getList(List<MasterValues> paymentList) { List<MasterValues> masterValues = new ArrayList<>(); masterValues.addAll(paymentList); return masterValues; } private List<String> getLabel(List<MasterValues> masterValuesList) { List<String> list = new ArrayList<>(); for (MasterValues masterValues : masterValuesList) { list.add(masterValues.getLabel()); } return list; } private void setAdapter(List<String> list) { setContactCompletionView(list, list_selected_payment, R.id.ccv_payment_mode); } @Override public void onBackgroundError(RestException re, Exception e, int taskCode, Object... params) { super.onBackgroundError(re, e, taskCode, params); switch (taskCode) { case AppConstants.TASKCODES.UPLOAD_IMAGE: showToast(getString(R.string.error)); break; } } @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { int i = parent.getId(); if (i == R.id.spin_documents_type) { documentType = parent.getItemAtPosition(position).toString(); } } private void getDocumentFile() { String facilityID = getFacilityID(); if (CollectionUtils.isNotEmpty(String.valueOf(facilityID))) { GetFileItem fileItem = new GetFileItem((String.valueOf(facilityID)), AppConstants.MEDIA_TYPES.DOC); HttpParamObject httpParamObject = BaseApiGenerator.getImageFile(fileItem); executeTask(AppConstants.TASKCODES.DOC_FILE, httpParamObject); } } @Override public void onNothingSelected(AdapterView<?> parent) { } }
b4842cc74ef1e80a61045861fefe773bfe11880a
9eebadb6640947eca1142f4507da6bed5b149f95
/dataverse-webapp/src/main/java/edu/harvard/iq/dataverse/util/xml/XmlStreamWriterUtils.java
d09e93977115229a2f447a45d65f08e632b7981c
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
CeON/dataverse
324f30938847b1a1be02f71775216fb94daabdcb
98c744f36ef43d06cd5ae0047c1066c3b89a9507
refs/heads/develop
2023-06-27T10:16:01.574068
2023-06-13T09:11:18
2023-06-13T09:11:18
160,691,081
10
5
NOASSERTION
2023-06-13T08:52:16
2018-12-06T15:05:02
Java
UTF-8
Java
false
false
2,400
java
package edu.harvard.iq.dataverse.util.xml; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import javax.xml.stream.XMLStreamException; import javax.xml.stream.XMLStreamWriter; import java.util.Arrays; import java.util.List; public class XmlStreamWriterUtils { // -------------------- LOGIC -------------------- public static void writeAttribute(XMLStreamWriter xmlw, String name, String value) throws XMLStreamException { if (StringUtils.isNotEmpty(value)) { xmlw.writeAttribute(name, value); } } public static void writeFullElement(XMLStreamWriter xmlw, String name, String value) throws XMLStreamException { writeFullElementWithAttributes(xmlw, name, value); } public static void writeFullElementList(XMLStreamWriter xmlw, String name, List<String> values) throws XMLStreamException { if (CollectionUtils.isNotEmpty(values)) { for (String value : values) { writeFullElement(xmlw, name, value); } } } public static void writeFullAttributesOnlyElement(XMLStreamWriter xmlw, String name, XmlAttribute ...attributes) throws XMLStreamException { List<XmlAttribute> attributesList = Arrays.asList(attributes); if (attributesList.stream().allMatch(attr -> StringUtils.isEmpty(attr.getAttributeValue()))) { return; } xmlw.writeStartElement(name); for (XmlAttribute attribute: attributesList) { if (StringUtils.isNotEmpty(attribute.getAttributeValue())) { xmlw.writeAttribute(attribute.getAttributeName(), attribute.getAttributeValue()); } } xmlw.writeEndElement(); } public static void writeFullElementWithAttributes(XMLStreamWriter xmlw, String name, String value, XmlAttribute ...attributes) throws XMLStreamException { if (StringUtils.isNotEmpty(value)) { xmlw.writeStartElement(name); for (XmlAttribute attribute: Arrays.asList(attributes)) { if (StringUtils.isNotEmpty(attribute.getAttributeValue())) { xmlw.writeAttribute(attribute.getAttributeName(), attribute.getAttributeValue()); } } xmlw.writeCharacters(value); xmlw.writeEndElement(); } } }
503f7fac918a9eaccfb5df58a91c510dac36b69f
7c14e265e975cb0a714a385a896b106fd136eabb
/src/main/java/com/ynz/pdf/extractpdf/parser/ARKInvestmentParser.java
6a01c9d73c180970ba2207a97923d7425fa25451
[]
no_license
yichunzhao/extract-pdf
cb899cbf4f2f1d70329c776b54a214ef25486650
d44e6311790ee5e24d1050aa5fae42d3003f5071
refs/heads/master
2023-02-07T22:01:58.620895
2020-12-28T22:44:48
2020-12-28T22:44:48
320,938,654
0
0
null
null
null
null
UTF-8
Java
false
false
1,792
java
package com.ynz.pdf.extractpdf.parser; import com.ynz.pdf.extractpdf.model.ARKDataModel; import com.ynz.pdf.extractpdf.parser.states.BrokenState; import com.ynz.pdf.extractpdf.parser.states.DateState; import com.ynz.pdf.extractpdf.statemachine.context.ARKLineTextContext; import com.ynz.pdf.extractpdf.statemachine.state.ARKLineTextState; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import org.springframework.stereotype.Component; import java.util.ArrayList; import java.util.List; @Component @NoArgsConstructor @Getter @Setter public class ARKInvestmentParser implements TextParser<ARKDataModel>, ARKLineTextContext { private static final String linePattern = "^\\d{1,2}/\\d{1,2}/\\d{4}\\s+(Sell|Buy).+[$]\\d+.\\d{2}$"; private ARKLineTextState currentState; private String line; private ARKDataModel model; @Override public List<ARKDataModel> parse(String text) { List<ARKDataModel> list = new ArrayList<>(); String[] lines = text.split(System.lineSeparator()); for (String line : lines) { if (!isValidLine(line)) continue; processLine(line); list.add(getModel()); } return list; } public void processLine(String line) { this.setLine(line); model = new ARKDataModel(); if (this.currentState == null || this.currentState instanceof BrokenState) setNextState(new DateState()); while (!(this.currentState instanceof BrokenState)) { this.currentState.doAction(this); } } @Override public void setNextState(ARKLineTextState state) { this.currentState = state; } public boolean isValidLine(String target) { return target.matches(linePattern); } }
3f07583ef3b090cd6f708c47d5f10f814bc980e6
1584faa7facf9b2fa2e0fb6d8ecb672a6457a782
/week-02/exercises/stateless-unit-test-exercises/src/test/java/Exercise02Test.java
0927e3ecfbe29f47570423198673f981cd9ec050
[]
no_license
JacobRosenbaum/dev10-classwork
4c652f1a187df78b9a138b13688b7964766b9f49
b1444ce74f590462536cb10c04e3e6c87cc2bd1f
refs/heads/main
2023-03-04T04:58:59.065185
2021-02-19T18:25:16
2021-02-19T18:25:16
319,703,778
0
0
null
null
null
null
UTF-8
Java
false
false
842
java
import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class Exercise02Test { @Test void shouldBeCorrectFormat() { assertEquals("<b>a</b>", Exercise02.surroundWithTag("a", "b")); assertEquals("<span>Squidward Tentacles</span>", Exercise02.surroundWithTag("Squidward Tentacles", "span")); } @Test void shouldBeJustText() { assertEquals("splendid", Exercise02.surroundWithTag("splendid", null)); assertEquals("yessir, let's ride", Exercise02.surroundWithTag("yessir, let's ride", "")); } @Test void shouldBeNull() { assertEquals(null, Exercise02.surroundWithTag(null, null)); } @Test void shouldBeJustTags() { assertEquals("<a></a>", Exercise02.surroundWithTag(null, "a")); } }
d128465ebb8ba94ec5f20cdc5f979ab07e85d68f
8455c43c7590c1fda63693022e5cb8eca707f41e
/src/main/java/org/qiqiang/girl/Start.java
5d21427f64945378ee35c152adcdc1fadec80219
[]
no_license
lwgboy/girlSpider
59bebd26cec795af9a827537c99028520360f861
7f11040b4725c1af0e1b55c52eacaa645d9f7e07
refs/heads/master
2022-01-05T16:09:11.672444
2018-11-30T03:02:54
2018-11-30T03:02:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
547
java
package org.qiqiang.girl; import us.codecraft.webmagic.Spider; /** * @author qiqiang * @Description * @date 2018-09-10 */ public class Start { public static void main(String[] args) { Properties.path = args[1]; Spider.create(new GirlPageProcessor()) //美女图片首页 .addUrl("http://www.27270.com/ent/meinvtupian/") .addPipeline(new ImagePipeline()) //开启十个线程 .thread(Integer.valueOf(args[0])) .run(); } }
27352c473ba2c91475f09487fd0f37c0b9578a1c
85db870fc737f3eaffe1ee666247434a70017517
/library-foxit/src/main/java/com/foxit/uiextensions/annots/note/NoteModule.java
81492ff0dabc94ce2bef12fd0eb799af2c51a135
[]
no_license
PEP-Mobile-Team/Android_SDK_Reference
1b9997891fb68cbc48031330ad5d459955ae7805
3026e8dc19d0f43c9fe7cb23b9cbb71c47724e85
refs/heads/master
2023-08-07T20:01:22.441531
2021-10-12T11:45:57
2021-10-12T11:45:57
261,699,402
2
0
null
null
null
null
UTF-8
Java
false
false
8,773
java
/** * Copyright (C) 2003-2019, Foxit Software Inc.. * All Rights Reserved. * <p> * http://www.foxitsoftware.com * <p> * The following code is copyrighted and is the proprietary of Foxit Software Inc.. It is not allowed to * distribute any parts of Foxit PDF SDK to third party or public without permission unless an agreement * is signed between Foxit Software Inc. and customers to explicitly grant customers permissions. * Review legal.txt for additional license and legal information. */ package com.foxit.uiextensions.annots.note; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Paint.Style; import android.graphics.Rect; import android.graphics.drawable.BitmapDrawable; import android.view.ViewGroup; import com.foxit.sdk.PDFViewCtrl; import com.foxit.uiextensions.Module; import com.foxit.uiextensions.ToolHandler; import com.foxit.uiextensions.UIExtensionsManager; import com.foxit.uiextensions.annots.AnnotHandler; import com.foxit.uiextensions.controls.propertybar.PropertyBar; import com.foxit.uiextensions.utils.AppDisplay; import com.foxit.uiextensions.utils.AppDmUtil; import java.util.ArrayList; public class NoteModule implements Module, PropertyBar.PropertyChangeListener { private Context mContext; private AppDisplay mDisplay; private PDFViewCtrl mPdfViewCtrl; private NoteAnnotHandler mAnnotHandler; private NoteToolHandler mToolHandler; private PDFViewCtrl.UIExtensionsManager mUiExtensionsManager; private ViewGroup mParentView; private int mCurrentColor; private int mCurrentOpacity; private int mCurrentIconType; private ArrayList<BitmapDrawable> mBitmapDrawables; private Paint mPaint; public ToolHandler getToolHandler() { return mToolHandler; } public AnnotHandler getAnnotHandler() { return mAnnotHandler; } public NoteModule(Context context, ViewGroup parent, PDFViewCtrl pdfViewCtrl, PDFViewCtrl.UIExtensionsManager uiExtensionsManager) { mContext = context; mParentView = parent; mDisplay = new AppDisplay(context); mPdfViewCtrl = pdfViewCtrl; mUiExtensionsManager = uiExtensionsManager; } @Override public String getName() { return MODULE_NAME_NOTE; } @Override public boolean loadModule() { mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setStyle(Style.STROKE); mPaint.setDither(true); mAnnotHandler = new NoteAnnotHandler(mContext, mParentView, mPdfViewCtrl, this); mToolHandler = new NoteToolHandler(mContext, mPdfViewCtrl); mToolHandler.setPropertyChangeListener(this); mAnnotHandler.setToolHandler(mToolHandler); if (mUiExtensionsManager != null && mUiExtensionsManager instanceof UIExtensionsManager) { ((UIExtensionsManager) mUiExtensionsManager).registerToolHandler(mToolHandler); ((UIExtensionsManager) mUiExtensionsManager).registerAnnotHandler( mAnnotHandler); ((UIExtensionsManager) mUiExtensionsManager).registerModule(this); } initVariable(); mPdfViewCtrl.registerRecoveryEventListener(memoryEventListener); mPdfViewCtrl.registerDrawEventListener(mDrawEventListener); return true; } private void initVariable() { mCurrentColor = PropertyBar.PB_COLORS_NOTE[0]; mCurrentOpacity = 100; mCurrentIconType = NoteConstants.TA_ICON_COMMENT; if (mUiExtensionsManager != null && mUiExtensionsManager instanceof UIExtensionsManager) { com.foxit.uiextensions.config.Config config = ((UIExtensionsManager) mUiExtensionsManager).getConfig(); mCurrentColor = config.uiSettings.annotations.note.color; mCurrentOpacity = (int) (config.uiSettings.annotations.note.opacity * 100); String typeName = config.uiSettings.annotations.note.icon; mCurrentIconType = NoteUtil.getIconByIconName(typeName); } mToolHandler.setColor(mCurrentColor); mToolHandler.setOpacity(mCurrentOpacity); mToolHandler.setIconType(mCurrentIconType); Rect rect = new Rect(0, 0, dp2px(32), dp2px(32)); mBitmapDrawables = new ArrayList<BitmapDrawable>(); for (int i = 1; i < NoteConstants.TA_ICON_COUNT + 1; i++) { Bitmap mBitmap = Bitmap.createBitmap(dp2px(32), dp2px(32), Config.RGB_565); Canvas canvas = new Canvas(mBitmap); @SuppressWarnings("deprecation") BitmapDrawable bd = new BitmapDrawable(mBitmap); mPaint.setStyle(Style.FILL); mPaint.setColor(Color.YELLOW); String iconName = NoteUtil.getIconNameByType(i); canvas.drawPath(NoteUtil.getPathStringByType(iconName, AppDmUtil.rectToRectF(rect)), mPaint); mPaint.setStyle(Style.STROKE); mPaint.setStrokeWidth(dp2px(1)); mPaint.setARGB(255, (int) (255 * 0.36f), (int) (255 * 0.36f), (int) (255 * 0.64f)); canvas.drawPath(NoteUtil.getPathStringByType(iconName, AppDmUtil.rectToRectF(rect)), mPaint); int save = canvas.save(); canvas.restore(); mBitmapDrawables.add(bd); } } @Override public boolean unloadModule() { mPdfViewCtrl.unregisterRecoveryEventListener(memoryEventListener); mPdfViewCtrl.unregisterDrawEventListener(mDrawEventListener); if (mUiExtensionsManager != null && mUiExtensionsManager instanceof UIExtensionsManager) { ((UIExtensionsManager) mUiExtensionsManager).unregisterToolHandler(mToolHandler); ((UIExtensionsManager) mUiExtensionsManager).unregisterAnnotHandler(mAnnotHandler); } mToolHandler.removePropertyBarListener(); return true; } private PDFViewCtrl.IDrawEventListener mDrawEventListener = new PDFViewCtrl.IDrawEventListener() { @Override public void onDraw(int pageIndex, Canvas canvas) { mAnnotHandler.onDrawForControls(canvas); } }; @Override public void onValueChanged(long property, int value) { UIExtensionsManager uiExtensionsManager = (UIExtensionsManager) mUiExtensionsManager; AnnotHandler currentAnnotHandler = uiExtensionsManager.getCurrentAnnotHandler(); if (property == PropertyBar.PROPERTY_COLOR || property == PropertyBar.PROPERTY_SELF_COLOR) { if (uiExtensionsManager.getCurrentToolHandler() == mToolHandler) { mCurrentColor = value; mToolHandler.setColor(value); } if (currentAnnotHandler == mAnnotHandler) { mAnnotHandler.onColorValueChanged(value); } } else if (property == PropertyBar.PROPERTY_OPACITY) { if (uiExtensionsManager.getCurrentToolHandler() == mToolHandler) { mCurrentOpacity = value; mToolHandler.setOpacity(value); } if (currentAnnotHandler == mAnnotHandler) { mAnnotHandler.onOpacityValueChanged(value); } } else if (property == PropertyBar.PROPERTY_ANNOT_TYPE) { if (uiExtensionsManager.getCurrentToolHandler() == mToolHandler) { mCurrentIconType = value; mToolHandler.setIconType(value); } if (currentAnnotHandler == mAnnotHandler) { String iconName = NoteUtil.getIconNameByType(value); mAnnotHandler.onIconTypeChanged(iconName); } } } @Override public void onValueChanged(long property, float value) { } @Override public void onValueChanged(long property, String iconName) { } private int dp2px(int dip) { return mDisplay.dp2px(dip); } PDFViewCtrl.IRecoveryEventListener memoryEventListener = new PDFViewCtrl.IRecoveryEventListener() { @Override public void onWillRecover() { if (mAnnotHandler.getAnnotMenu() != null && mAnnotHandler.getAnnotMenu().isShowing()) { mAnnotHandler.getAnnotMenu().dismiss(); } if (mAnnotHandler.getPropertyBar() != null && mAnnotHandler.getPropertyBar().isShowing()) { mAnnotHandler.getPropertyBar().dismiss(); } } @Override public void onRecovered() { } }; }
0314bb1ed1ff12a1c7606f4204f70048ad4fe50f
73644bbb56f4fbd16ae3253afaa5470dd6602f91
/rebatis-core/src/main/java/org/apache/ibatis/reflection/wrapper/ObjectWrapper.java
550fd2064d4d4793fe70880430e4f74c4aec555f
[]
no_license
GoSkyer/rebatis
980a4c492c40dcaaada06e7c746bb0654475b24f
1a028c3ee7201307fae719935e9104d1eed6001d
refs/heads/master
2022-06-26T16:28:47.914115
2021-07-17T17:30:12
2021-07-17T17:30:12
177,432,229
0
1
null
2022-06-20T22:46:44
2019-03-24T15:21:04
Java
UTF-8
Java
false
false
965
java
/** * Copyright 2009-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.ibatis.reflection.wrapper; import org.apache.ibatis.reflection.property.PropertyTokenizer; /** * @author Clinton Begin */ public interface ObjectWrapper { Object get(PropertyTokenizer prop); boolean isCollection(); void add(Object element); // <E> void addAll(List<E> element); }
186d1153fee96fbe777402f53f3fefaffb75f216
51b614b02a3ad7a8b72c2853d940a1497a7e8a62
/XMLExample/src/main/java/pkgLibrary/BookException.java
fdc36e8cc35f9c137ba05df892f708f1b30a09bb
[]
no_license
mbolinas/181PS3
73cae8b67ddd9029865aa986220a1ea08cc78968
41275c7b79a75dbb14c51fe4a53ede4ff51501aa
refs/heads/master
2021-01-22T22:53:42.956048
2017-03-20T15:18:42
2017-03-20T15:18:42
85,592,496
0
0
null
null
null
null
UTF-8
Java
false
false
331
java
package pkgLibrary; public class BookException extends Exception{ public BookException(){ super(); } public BookException(String message){ super(message); } public BookException(String message, Throwable clause){ super(message, clause); } public BookException(Throwable clause){ super(clause); } }
ce6e8be976c91318811b701d9f34acad0b06d541
e755451c72ceba8e6c7e2e8c7181069c340b9eac
/app/src/main/java/com/example/fkz/medesigntest/MyAdapter.java
1fb7740e88b97ed1e22f0c646563ce3fed58a18b
[]
no_license
fkzdaz/MeDesignTest
736aa3b670b60556d7117c9ba1cee31445cdbaa8
206fecccf749db09c89e597ec67047a9198eacc7
refs/heads/master
2021-01-18T04:02:37.664725
2017-03-22T01:12:46
2017-03-22T01:12:46
85,770,208
0
0
null
null
null
null
UTF-8
Java
false
false
1,392
java
package com.example.fkz.medesigntest; import android.support.v7.widget.RecyclerView; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import java.util.List; /** * Created by fkz on 2017/3/22. */ public class MyAdapter extends RecyclerView.Adapter<MyAdapter.ViewHolder> { // 数据集 private List<String> mDataset; public MyAdapter(List<String> dataset) { super(); mDataset = dataset; } @Override public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { // 创建一个View,简单起见直接使用系统提供的布局,就是一个TextView View view = View.inflate(viewGroup.getContext(), android.R.layout.simple_list_item_1, null); // 创建一个ViewHolder ViewHolder holder = new ViewHolder(view); return holder; } @Override public void onBindViewHolder(ViewHolder viewHolder, int i) { // 绑定数据到ViewHolder上 viewHolder.mTextView.setText(mDataset.get(i)); } @Override public int getItemCount() { return mDataset.size(); } public static class ViewHolder extends RecyclerView.ViewHolder { public TextView mTextView; public ViewHolder(View itemView) { super(itemView); mTextView = (TextView) itemView; } } }
d54d974ee3ffe06ae60bcef2ad40184a43a5f72d
d09eb4536cd33f524caf890e2f913935cc06013f
/distributed-transaction-support/dtx-client/src/main/java/rabbit/open/dtx/client/datasource/proxy/RollbackInfoProcessor.java
a5f8473e9818d1a05774e20947c841802ca22d2f
[ "Apache-2.0" ]
permissive
RabbitOpen/RabbitORM2
cf97000cfb120460c8d9242ba5c4f8fbb1c3720f
c447e2c2f4545826288b61be02c7b6e0467fef77
refs/heads/master
2022-12-23T12:59:01.655813
2021-07-17T03:43:37
2021-07-17T03:43:37
113,806,602
22
4
Apache-2.0
2022-12-16T03:25:38
2017-12-11T03:15:10
Java
UTF-8
Java
false
false
4,746
java
package rabbit.open.dtx.client.datasource.proxy; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import rabbit.open.dtx.client.datasource.parser.SQLMeta; import rabbit.open.dtx.client.datasource.parser.SQLType; import rabbit.open.dtx.client.datasource.proxy.ext.DeleteRollbackInfoProcessor; import rabbit.open.dtx.client.datasource.proxy.ext.InsertRollbackInfoProcessor; import rabbit.open.dtx.client.datasource.proxy.ext.UpdateRollbackInfoProcessor; import rabbit.open.dtx.common.annotation.RollbackPolicy; import rabbit.open.dtx.common.context.DistributedTransactionContext; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; import java.sql.Timestamp; import java.util.*; /** * sql 回滚信息处理器 * @author xiaoqianbin * @date 2019/12/4 **/ public abstract class RollbackInfoProcessor { protected Logger logger = LoggerFactory.getLogger(getClass()); private static Map<SQLType, RollbackInfoProcessor> processorMap = new EnumMap<>(SQLType.class); /** * @param sqlMeta 当前预编译sql信息 * @param preparedStatementValues 预编译sql的值信息 * @param txConn 数据库链接代理对象 * @author xiaoqianbin * @date 2019/12/4 **/ public abstract RollbackInfo generateRollbackInfo(SQLMeta sqlMeta, List<Object> preparedStatementValues, TxConnection txConn) throws SQLException; /** * 处理回滚消息 * @param record * @param info * @param connection * @return true:成功 * @author xiaoqianbin * @date 2019/12/5 **/ public abstract boolean processRollbackInfo(RollBackRecord record, RollbackInfo info, Connection connection); protected void setPreparedStatementValue(PreparedStatement stmt, int index, Object value) throws SQLException { if (value instanceof byte[]) { stmt.setBytes(index, (byte[]) value); } else if (value instanceof Timestamp) { stmt.setTimestamp(index, (Timestamp) value); } else if (value instanceof Date) { stmt.setTimestamp(index, new Timestamp(((Date) value).getTime())); } else if (value instanceof Float) { stmt.setFloat(index, (float) value); } else if (value instanceof Double) { stmt.setDouble(index, (double) value); } else { stmt.setObject(index, value); } } protected RollbackInfo createRollbackInfo(SQLMeta sqlMeta, List<Object> preparedStatementValues) { RollbackInfo rollbackInfo = new RollbackInfo(); rollbackInfo.setMeta(sqlMeta); rollbackInfo.setPreparedValues(preparedStatementValues); rollbackInfo.setRollbackPolicy(DistributedTransactionContext.getDistributedTransactionObject().getRollbackPolicy()); return rollbackInfo; } public static RollbackInfoProcessor getRollbackInfoProcessor(SQLType type) { if (!processorMap.containsKey(type)) { synchronized (RollbackInfoProcessor.class) { if (processorMap.containsKey(type)) { return processorMap.get(type); } processorMap.put(SQLType.DELETE, new DeleteRollbackInfoProcessor()); processorMap.put(SQLType.INSERT, new InsertRollbackInfoProcessor()); processorMap.put(SQLType.UPDATE, new UpdateRollbackInfoProcessor()); } } return processorMap.get(type); } protected void safeClose(AutoCloseable c) { try { if (null != c) { c.close(); } } catch (Exception e) { logger.error(e.getMessage(), e); } } protected boolean isStrictRollback(RollbackInfo info) { return RollbackPolicy.STRICT == info.getRollbackPolicy(); } /** * 打印回滚日志 * @param record 回滚记录 * @param sql sql信息 * @param preparedValues sql的值 * @param effectDataSize 回滚操作影响的数据条数 * @author xiaoqianbin * @date 2019/12/6 **/ protected void printRollbackLog(RollBackRecord record, String sql, Collection<Object> preparedValues, int effectDataSize) { if (0 == effectDataSize) { logger.error("[txGroupId --> {}, txBranchId --> {}, dataId -->{}] roll back failed: {}, \n preparedValues: {}", record.getTxGroupId(), record.getTxBranchId(), record.getId(), sql, preparedValues); } else { logger.info("[txGroupId --> {}, txBranchId --> {}, dataId -->{}] roll back success: {}, \n preparedValues: {}", record.getTxGroupId(), record.getTxBranchId(), record.getId(), sql, preparedValues); } } }
c746fe175ddf4426a8ec88f925ff2e4a5f2ba9c0
b7bd5d9e3af9589659f589770d09567f72b1e19b
/ambit2-hpcws/src/main/java/cz/it4i/hpcaas/filetransfer/GetFileTransferMethodResponse.java
1a4847cb7ce3cc3acbfd9f4062500c3694b682a4
[]
no_license
ideaconsult/ambit2-haas
bccae4492bf1a5f063493f0af8c34af16c9af069
9a7dade2d183e6ad8384ccdb04f073570f10de37
refs/heads/master
2021-06-28T14:06:54.316189
2020-06-16T05:14:50
2020-06-16T05:14:50
163,846,410
0
0
null
2020-10-13T11:30:08
2019-01-02T13:45:26
Java
UTF-8
Java
false
false
1,794
java
package cz.it4i.hpcaas.filetransfer; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for anonymous complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="GetFileTransferMethodResult" type="{http://hpcaas.it4i.cz/}FileTransferMethodExt" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "", propOrder = { "getFileTransferMethodResult" }) @XmlRootElement(name = "GetFileTransferMethodResponse") public class GetFileTransferMethodResponse { @XmlElement(name = "GetFileTransferMethodResult") protected FileTransferMethodExt getFileTransferMethodResult; /** * Gets the value of the getFileTransferMethodResult property. * * @return * possible object is * {@link FileTransferMethodExt } * */ public FileTransferMethodExt getGetFileTransferMethodResult() { return getFileTransferMethodResult; } /** * Sets the value of the getFileTransferMethodResult property. * * @param value * allowed object is * {@link FileTransferMethodExt } * */ public void setGetFileTransferMethodResult(FileTransferMethodExt value) { this.getFileTransferMethodResult = value; } }
a03ff054f559034e5d2dda5afe7890acbc559e8e
2eac1e6360ddd6a44367039798a7d9afdb10857e
/app/src/main/java/com/example/fatecanos/alunosmobile/telas/PreMenuActivity.java
06b8c05659d69ba60f740bbaf4d7c4e637b72636
[]
no_license
TechWilli/projeto-android-fatec
ebeb3e29bff7ee3ef03cbacd0b2863809cdebced
85c8d4211f8453e6459fa33c49b2e6d6e792506b
refs/heads/master
2020-09-02T06:33:59.706253
2019-11-12T00:15:45
2019-11-12T00:15:45
219,156,736
0
0
null
null
null
null
UTF-8
Java
false
false
1,543
java
package com.example.fatecanos.alunosmobile.telas; import android.content.Intent; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; //import android.widget.TextView; import com.example.fatecanos.alunosmobile.R; public class PreMenuActivity extends AppCompatActivity { Button areaAluno, areaDisciplina, areaNota; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_pre_menu); areaAluno = (Button) findViewById(R.id.btareaalunos); areaAluno.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent it = new Intent(PreMenuActivity.this, AluMenuActivity.class); startActivity(it); } }); areaDisciplina = (Button) findViewById(R.id.btareadisciplinas); areaDisciplina.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent it = new Intent(PreMenuActivity.this, DisMenuActivity.class); startActivity(it); } }); areaNota = (Button) findViewById(R.id.btareanotas); areaNota.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent it = new Intent(PreMenuActivity.this, NotaMenuActivity.class); startActivity(it); } }); } }
83bbc27fd0cf5cb02176267a260aeec3bebbf1b2
d61439ebf7a75917a06a2ec4d51e52248a14c55c
/ComicBooks3.java
6573945241625edf25717bb12945f663b8b24775
[]
no_license
atulgolhar/java
63694faeb99c1c69d33812573c63cfeff0d3eea1
57f04ea6c7de8943c978121ca2b7c7162d8a2500
refs/heads/master
2023-05-01T03:25:06.391146
2023-04-28T19:18:02
2023-04-28T19:18:02
77,857,136
0
0
null
null
null
null
UTF-8
Java
false
false
2,411
java
package com.java21days; // updates ComicBook using enum import java.util.*; public class ComicBooks3 { public ComicBooks3() { } public static void main(String[] arguments) { HashMap quality = new HashMap(); quality.put(Condition.PRISTINE_MINT, 5.00F); quality.put(Condition.MINT, 3.00F); quality.put(Condition.NEAR_MINT, 2.00F); quality.put(Condition.VERY_FINE, 1.50F); quality.put(Condition.FINE, 1.00F); quality.put(Condition.GOOD, 0.50F); quality.put(Condition.POOR, 0.25F); quality.put(Condition.COVERLESS, 0.10F); Comic3[] comix = new Comic3[5]; // set up collection comix[0] = new Comic3("Amazing Spider-Man", "1A", Condition.VERY_FINE, 5_000.00F); comix[0].setPrice( (Float) quality.get(comix[0].condition) ); comix[1] = new Comic3("Incredible Hulk", "181", Condition.NEAR_MINT, 240.00F); comix[1].setPrice( (Float) quality.get(comix[1].condition) ); comix[2] = new Comic3("Cerebus", "1A", Condition.GOOD, 144.00F); comix[2].setPrice( (Float) quality.get(comix[2].condition) ); comix[3] = new Comic3("Prez", "1", Condition.PRISTINE_MINT, 30.00F); comix[3].setPrice( (Float) quality.get(comix[3].condition) ); comix[4] = new Comic3("Night Nurse", "1", Condition.COVERLESS, 22.00F); comix[4].setPrice( (Float) quality.get(comix[4].condition) ); for (Comic3 comix1 : comix) { System.out.println("Title: " + comix1.title); System.out.println("Issue: " + comix1.issueNumber); System.out.println("Condition: " + comix1.condition); System.out.println("Price: $" + comix1.price + "\n"); } } } class Comic3 { // helper class String title; String issueNumber; Condition condition; float basePrice; float price; Comic3(String inTitle, String inIssueNumber, Condition inCondition, float inBasePrice) { // constructor method title = inTitle; issueNumber = inIssueNumber; condition = inCondition; basePrice = inBasePrice; } void setPrice(float factor) { price = basePrice * factor; } } enum Condition { PRISTINE_MINT, MINT, NEAR_MINT, VERY_FINE, FINE, GOOD, POOR, COVERLESS }
7502aee333623ffb79b6cf640904388ab01fe96f
7bfcda3f318cb06912583d538fe370c347803105
/redis/redis-console/src/main/java/com/ctrip/xpipe/redis/console/controller/consoleportal/KeeperContainerInfoController.java
dad16e523f316e2b620a9b4e35e28b591e9b5684
[ "Apache-2.0" ]
permissive
sdgdsffdsfff/x-pipe
9f4271775dd9be3b612670afd70bc7282dfb1c38
b78cec0db95263417f99ad88deff582ca1c0f046
refs/heads/master
2021-01-18T05:18:27.766693
2020-01-10T04:51:08
2020-01-10T04:51:08
67,751,571
0
1
Apache-2.0
2020-01-10T04:51:10
2016-09-09T00:45:55
Java
UTF-8
Java
false
false
997
java
package com.ctrip.xpipe.redis.console.controller.consoleportal; import com.ctrip.xpipe.redis.console.controller.AbstractConsoleController; import com.ctrip.xpipe.redis.console.model.KeeperContainerInfoModel; import com.ctrip.xpipe.redis.console.service.KeeperContainerService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @RequestMapping(AbstractConsoleController.CONSOLE_PREFIX) public class KeeperContainerInfoController extends AbstractConsoleController { @Autowired KeeperContainerService keeperContainerService; @RequestMapping(value = "/keepercontainer/infos/all", method = RequestMethod.GET) public List<KeeperContainerInfoModel> getAllKeeperContainerInfos() { return keeperContainerService.findAllInfos(); } }
2ac71a6bbdc4b6b7a174843fe446ab2225df7b1a
2a75855090809c5e6557cc083028e3765333efb5
/src/com/bebo/service/EmployeeService.java
e2fd8d4c330139c8c74bc568c080f64b1013974e
[]
no_license
anilthakur0909/EMS
008bb12daea8086c85efc65f2ed393ca0f979218
1f0a3c6aebe946e2fa396994ccad27ffe8e8e7c8
refs/heads/master
2021-01-19T17:04:27.839361
2017-10-10T06:17:30
2017-10-10T06:17:30
101,042,619
0
0
null
null
null
null
MacCentralEurope
Java
false
false
4,506
java
package com.bebo.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import com.bebo.dao.EmployeeDao; import com.bebo.model.Employee; /* * @author Anil.Thakur */ @Service @Transactional(propagation=Propagation.REQUIRED) public class EmployeeService { @Autowired private EmployeeDao employeeDao; public void register(Employee employee) throws Exception { validateEmployee(employee); employeeDao.register(employee); } public boolean employeeExist(Employee employee) { return employeeDao.employeeExist(employee); } public List<Employee> findAllEmployee() { return employeeDao.findAllEmployee(); } public List<Employee> findEmployeeUsingCriteia() { return employeeDao.findEmployeeUsingCriteia(); } public void deleteEmployee(int employeeId ) { employeeDao.deleteEmployee(employeeId); } private void validateEmployee(Employee employee) throws Exception{ if(employeeDao.isUserNameExist(employee.getUsername())){ throw new Exception(); } } } /* PROPAGATION_REQUIRED = 0; If DataSourceTransactionObject T1 is already started for Method M1.If for another Method M2 Transaction object is required ,no new Transaction object is created . Same object T1 is used for M2 PROPAGATION_MANDATORY = 2; method must run within a transaction. If no existing transaction is in progress, an exception will be thrown PROPAGATION_REQUIRES_NEW = 3; If DataSourceTransactionObject T1 is already started for Method M1 and it is in progress(executing method M1) . If another method M2 start executing then T1 is suspended for the duration of method M2 with new DataSourceTransactionObject T2 for M2.M2 run within its own transaction context PROPAGATION_NOT_SUPPORTED = 4; If DataSourceTransactionObject T1 is already started for Method M1.If another method M2 is run concurrently .Then M2 should not run within transaction context. T1 is suspended till M2 is finished. PROPAGATION_NEVER = 5; None of the methods run in transaction context. An isolation level: It is about how much a transaction may be impacted by the activities of other concurrent transactions.It a supports consistency leaving the data across many tables in a consistent state. It involves locking rows and/or tables in a database. The problem with multiple transaction Scenario 1.If T1 transaction reads data from table A1 that was written by another concurrent transaction T2.If on the way T2 is rollback,the data obtained by T1 is invalid one.E.g a=2 is original data . If T1 read a=1 that was written by T2.If T2 rollback then a=1 will be rollback to a=2 in DB.But,Now ,T1 has a=1 but in DB table it is changed to a=2. Scenario2.If T1 transaction reads data from table A1.If another concurrent transaction(T2) update data on table A1. Then the data that T1 has read is different from table A1.Because T2 has updated the data on table A1.E.g if T1 read a=1 and T2 updated a=2.Then a!=b. Scenario 3.If T1 transaction reads data from table A1 with certain number of rows. If another concurrent transaction(T2) inserts more rows on table A1. The number of rows read by T1 is different from rows on table A1 Scenario 1 is called Dirty reads Scenario 2 is called Nonrepeatable reads Scenario 3 is called Phantom reads . So,isolation level is the extend to which Scenario 1 ,Scenario 2 ,Scenario 3 can be prevented. You can obtained complete isolation level by implementing locking.That is preventing concurrent reads and writes to the same data from occurring.But it affects performance .The level of isolation depends upon application to application how much isolation is required. ISOLATION_READ_UNCOMMITTED :Allows to read changes that havenít yet been committed.It suffer from Scenario 1 ,Scenario 2 ,Scenario 3 ISOLATION_READ_COMMITTED:Allows reads from concurrent transactions that have been com- mitted.It may suffer from Scenario 2 ,Scenario 3 . Because other transactions may be updating the data. ISOLATION_REPEATABLE_READ:Multiple reads of the same field will yield the same results untill it is changed by itself.It may suffer from Scenario 3.Because other transactions may be inserting the data ISOLATION_SERIALIZABLE: Scenario 1,Scenario 2,Scenario 3 never happens.It is complete isolation.It involves full locking.It affets performace because of locking. */
d1c41a3531fa5e44096c63660274d27ebbc32f6e
56de50e9c597db02e4b4949fd8b79cce01ff2ff9
/Zovkic-6/src/main/java/sample/dodavanjeNovihE/DodavanjeNovogSimptomaController.java
7de38c2caa6607776c246365df35f071f328b376
[]
no_license
izovkic98/Zovkic-6
367595d6296402ab68a11b1a282dd172c22e98d3
072c174f5e48f33e97db56f56e909e619bfa5857
refs/heads/master
2023-07-02T01:20:07.141157
2021-07-26T21:19:49
2021-07-26T21:19:49
389,770,250
0
0
null
null
null
null
UTF-8
Java
false
false
3,591
java
package main.java.sample.dodavanjeNovihE; import javafx.fxml.FXML; import javafx.scene.control.Alert; import javafx.scene.control.Button; import javafx.scene.control.TextField; import main.java.hr.java.covidportal.model.Simptom; import main.java.sample.pretrage.PretragaSimptomaController; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class DodavanjeNovogSimptomaController { private static final Logger logger = LoggerFactory.getLogger(DodavanjeNovogSimptomaController.class); @FXML private TextField nazivSimptomaTextField; @FXML private TextField vrijedonstSimptomaTextField; @FXML private TextField sifraSimptomaTextField; @FXML private TextField opisSimptomaTextField; @FXML public Button gumbZaSpremanje; @FXML public void dodavanjeNovogSimptoma() { String naziv = nazivSimptomaTextField.getText(); String vrijednost = vrijedonstSimptomaTextField.getText(); String sifra = sifraSimptomaTextField.getText(); String opis = opisSimptomaTextField.getText(); if (!(naziv.isBlank() || vrijednost.isBlank() || sifra.isBlank() || opis.isBlank())) { PretragaSimptomaController.listaSimptoma.add(new Simptom(naziv, vrijednost, sifra, opis)); Alert a = new Alert(Alert.AlertType.NONE); a.setAlertType(Alert.AlertType.INFORMATION); a.setTitle("Obavijest"); a.setContentText("Simptom uspješno unesen"); a.show(); // DODATNI ZADATAK 2. nazivSimptomaTextField.setStyle("-fx-background-color: WHITE"); vrijedonstSimptomaTextField.setStyle("-fx-background-color: WHITE"); sifraSimptomaTextField.setStyle("-fx-background-color: WHITE"); opisSimptomaTextField.setStyle("-fx-background-color: WHITE"); logger.info("Uspješno je dodan novi simptom !"); } else { Alert a = new Alert(Alert.AlertType.NONE); a.setAlertType(Alert.AlertType.ERROR); a.setTitle("Obavijest"); a.setContentText("Nisu sva polja unesena! Ponovi."); a.show(); // DODATNI ZADATAK 2. if (naziv.isBlank()) { nazivSimptomaTextField.setStyle("-fx-background-color: RED"); } if (vrijednost.isBlank()) { vrijedonstSimptomaTextField.setStyle("-fx-background-color: RED"); } if (sifra.isBlank()) { sifraSimptomaTextField.setStyle("-fx-background-color: RED"); } if (opis.isBlank()) { opisSimptomaTextField.setStyle("-fx-background-color: RED"); } } nazivSimptomaTextField.clear(); opisSimptomaTextField.clear(); sifraSimptomaTextField.clear(); vrijedonstSimptomaTextField.clear(); } // 3 ZADATAK public void promijeniSimtpom(Simptom simptom) { nazivSimptomaTextField.setText(simptom.getNaziv()); vrijedonstSimptomaTextField.setText(simptom.getVrijednost()); sifraSimptomaTextField.setText(simptom.getSifra()); opisSimptomaTextField.setText(simptom.getOpis()); } public void azurirajSimptom(Simptom simptom) { simptom.setNaziv(nazivSimptomaTextField.getText()); simptom.setNaziv(vrijedonstSimptomaTextField.getText()); simptom.setNaziv(sifraSimptomaTextField.getText()); simptom.setNaziv(opisSimptomaTextField.getText()); PretragaSimptomaController.listaSimptoma.add(simptom); } }
74110aaa0b5879a8b310defb3e59e73b3df08f31
70dc84d4e5d49f36dfd05addd6f188706f35978f
/src/main/java/com/terremark/api/EnabledValue.java
ee436f25bee8c48fea47dbca7602ddee1240e6e6
[ "Apache-2.0" ]
permissive
anglachelgo/terremark-api
fb2964084c6cab17c2528dbd4512be7595181cd3
b51cdebae528e9d36042988db46c9c8fe75a1cb9
refs/heads/master
2021-01-16T22:53:41.970785
2013-08-23T21:40:52
2013-08-23T21:40:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,973
java
/** * Copyright 2012 Terremark Worldwide 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.terremark.api; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * <p> * Java class for EnabledValue complex type. * <p> * The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="EnabledValue"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;sequence> * &lt;element name="Enabled" type="{http://www.w3.org/2001/XMLSchema}boolean"/> * &lt;element name="Value" type="{http://www.w3.org/2001/XMLSchema}int" minOccurs="0"/> * &lt;element name="Unit" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/> * &lt;/sequence> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "EnabledValue", propOrder = {"enabled", "value", "unit"}) public class EnabledValue extends ToStringGenerator { @XmlElement(name = "Enabled") protected boolean enabled; @XmlElement(name = "Value", nillable = true) protected Integer value; @XmlElement(name = "Unit", nillable = true) protected String unit; /** * Gets the value of the enabled property. */ public boolean isEnabled() { return enabled; } /** * Sets the value of the enabled property. */ public void setEnabled(final boolean value) { this.enabled = value; } /** * Gets the value of the value property. * * @return possible object is {@link Integer } */ public Integer getValue() { return value; } /** * Sets the value of the value property. * * @param value allowed object is {@link Integer } */ public void setValue(final Integer value) { this.value = value; } /** * Gets the value of the unit property. * * @return possible object is {@link String } */ public String getUnit() { return unit; } /** * Sets the value of the unit property. * * @param value allowed object is {@link String } */ public void setUnit(final String value) { this.unit = value; } }
d0cb7b3b1ef57e255c7520ccd33de096927bd937
3dfa4dbfc1d0a1342f235201b52c3a80f321fbaf
/app/src/main/java/com/test/coolweather/gson/AQI.java
28e3560f2f34dc682537ddbe0d778c0f7201fb5a
[ "Apache-2.0" ]
permissive
css0306/weathertest
139fc1cf1fea86581d2b49aaa2e6fb7b6e206e0d
e7a47cef6bca642457b19d01d6e057765b03d321
refs/heads/master
2020-03-29T18:44:04.031472
2018-09-26T06:51:30
2018-09-26T06:51:30
150,228,592
0
0
null
null
null
null
UTF-8
Java
false
false
169
java
package com.test.coolweather.gson; public class AQI { public AQICity city; public class AQICity{ public String aqi; public String pm25; } }
d2fbe994e63a9ca6dd8fbc25cbb14cc414d13d58
30034aaf5ad7d79cb372f77940b7716e39b0f306
/src/main/java/com/ycdr/domain/PerfectUser.java
c28d7aac085ceaaac0f66196431af5a5fdefd14f
[]
no_license
DRYingChuan/wmjz
6fcac474d263cc91a89f70e83313d539e2cc61fa
05302d368171b91bb012dc453f488b5c921416f5
refs/heads/master
2021-06-10T19:01:21.338826
2016-12-19T10:05:40
2016-12-19T10:05:40
75,263,282
0
0
null
null
null
null
UTF-8
Java
false
false
1,646
java
package com.ycdr.domain; import javax.persistence.*; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; import java.io.Serializable; /** * Created by YcDr on 2016/12/3. */ @Table(name = "PERFECT_USER") @Entity @XmlRootElement public class PerfectUser implements Serializable { private static final int USERNAME=100; private static final int USERPASSWORD=100; private Integer userId; private String userName; private String userPassWord; public PerfectUser() { super(); } public PerfectUser(String userName) { this.userName = userName; } public PerfectUser(Integer userId) { this.userId = userId; } public PerfectUser(Integer userId, String userName, String userPassWord) { this.userId = userId; this.userName = userName; this.userPassWord = userPassWord; } @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name = "USERID") @Id @XmlAttribute(name = "userid") public Integer getUserId() { return userId; } public void setUserId(Integer userId) { this.userId = userId; } @Column(name = "USERNAME",length=PerfectUser.USERNAME) public String getUserName() { return userName; } public void setUserName(String userName) { this.userName = userName; } @Column(name = "USERPASSWORD",length =PerfectUser.USERPASSWORD ) public String getUserPassWord() { return userPassWord; } public void setUserPassWord(String userPassWord) { this.userPassWord = userPassWord; } }
3b41273b4cf986a770dea499be661c726f5ec774
40483119a4fa7eee306a15b249fb54da20f04b68
/src/test/java/io/zentity/resolution/AttributeIdConfidenceScoreMapTest.java
b98a4d79ee9fd62e956253dc73748271e168a508
[ "Apache-2.0" ]
permissive
fintechstudios/zentity
8109a5d51995e692117d389d83023d21d1980d40
b962fd1cf26f36126f6ae554346ae2effdef595d
refs/heads/master
2023-03-06T08:34:46.248939
2021-01-28T00:05:18
2021-01-28T00:05:18
318,009,662
3
1
Apache-2.0
2021-04-12T16:34:30
2020-12-02T22:35:24
Java
UTF-8
Java
false
false
2,451
java
package io.zentity.resolution; import org.junit.Test; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; public class AttributeIdConfidenceScoreMapTest { static final String ATTRIBUTE_NAME = "attr"; static final String MATCHER_NAME = "matcher"; static final String INDEX_NAME = "idx"; static final String INDEX_FIELD_NAME = "idxFieldName"; @Test public void testGetScore() { AttributeIdConfidenceScoreMap map = new AttributeIdConfidenceScoreMap(); double score = 0.5d; map.setScore(ATTRIBUTE_NAME, MATCHER_NAME, INDEX_NAME, INDEX_FIELD_NAME, score); assertEquals((Double) score, map.getScore(ATTRIBUTE_NAME, MATCHER_NAME, INDEX_NAME, INDEX_FIELD_NAME)); } @Test public void testSetScore() { AttributeIdConfidenceScoreMap map = new AttributeIdConfidenceScoreMap(); double score = 0.5d; assertEquals((Double) score, map.setScore(ATTRIBUTE_NAME, MATCHER_NAME, INDEX_NAME, INDEX_FIELD_NAME, score)); } @Test public void testSetScoreOverwrite() { AttributeIdConfidenceScoreMap map = new AttributeIdConfidenceScoreMap(); double score1 = 0.5d; assertEquals((Double) score1, map.setScore(ATTRIBUTE_NAME, MATCHER_NAME, INDEX_NAME, INDEX_FIELD_NAME, score1)); assertEquals((Double) score1, map.getScore(ATTRIBUTE_NAME, MATCHER_NAME, INDEX_NAME, INDEX_FIELD_NAME)); double score2 = 0.75d; assertEquals((Double) score2, map.setScore(ATTRIBUTE_NAME, MATCHER_NAME, INDEX_NAME, INDEX_FIELD_NAME, score2)); assertEquals((Double) score2, map.getScore(ATTRIBUTE_NAME, MATCHER_NAME, INDEX_NAME, INDEX_FIELD_NAME)); } @Test public void testHasScore() { AttributeIdConfidenceScoreMap map = new AttributeIdConfidenceScoreMap(); double score = 0.5d; map.setScore(ATTRIBUTE_NAME, MATCHER_NAME, INDEX_NAME, INDEX_FIELD_NAME, score); assertTrue(map.hasScore(ATTRIBUTE_NAME, MATCHER_NAME, INDEX_NAME, INDEX_FIELD_NAME)); } @Test public void testDoNotHasScore() { AttributeIdConfidenceScoreMap map = new AttributeIdConfidenceScoreMap(); double score = 0.5d; map.setScore(ATTRIBUTE_NAME, MATCHER_NAME, INDEX_NAME, INDEX_FIELD_NAME, score); assertFalse(map.hasScore(ATTRIBUTE_NAME, MATCHER_NAME, "another-index", INDEX_FIELD_NAME)); } }
d121096adce669e5d5d77a7addfdcc0e828a725e
dbc3f51604655e7a4aee45ccd474e722ddb1a534
/xs2a/xs2a-api/src/main/java/de/sdvrz/xs2a/api/model/AccountTransactionsResponse.java
e1c950bcf7e513efebca521509dd820e3bf6accc
[ "Apache-2.0" ]
permissive
feststelltaste/PSD2
08d7019ebcbc8fde7f8b35dc0defa845a9a2fe05
37181253d039e729a1a7b25a4a9174494ad25003
refs/heads/master
2021-05-02T18:35:38.326743
2018-02-13T23:00:57
2018-02-13T23:00:57
120,612,914
0
1
null
2018-02-08T10:17:27
2018-02-07T12:35:21
Java
UTF-8
Java
false
false
1,143
java
/** * Copyright 2018 SDV-IT, Sparda Datenverarbeitung eG * * 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 de.sdvrz.xs2a.api.model; import io.swagger.annotations.ApiModel; /** * */ @ApiModel(value = "AccountTransactionsResponse", description = "Response for /{version}/accounts/{account-id}/transactions request", subTypes = {AccountTransactions.class}) public class AccountTransactionsResponse { AccountTransactions transactions; public AccountTransactions getTransactions() { return transactions; } public void setTransactions(AccountTransactions transactions) { this.transactions = transactions; } }
69fc6d23334ea5e385444a17251f543587107e72
06d76ab89e6cd8cc7d9281b65e0c92bfa3c32af5
/searchsdk/src/main/java/com/sfmap/api/services/cloud/CloudStorageUpdataServerHandler.java
5f240ce563e6feb8b826546ca2a80b2c2124fd46
[]
no_license
onlie08/SFLocationDemo
f7042c598fdb1bd4fe5eeba791df6ae6f779d73e
7c15f13b1d6335a6dbf20b6ee7cce62bd20c1ca9
refs/heads/master
2022-12-15T20:09:31.577510
2020-08-25T02:38:57
2020-08-25T02:38:57
217,438,626
1
0
null
2020-09-17T05:55:44
2019-10-25T02:54:37
Java
UTF-8
Java
false
false
4,886
java
package com.sfmap.api.services.cloud; import android.content.Context; import com.sfmap.api.services.core.AppInfo; import com.sfmap.api.services.core.JsonResultHandler; import com.sfmap.api.services.core.LatLonPoint; import com.sfmap.api.services.core.SearchException; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.net.Proxy; import java.util.Map; class CloudStorageUpdataServerHandler extends JsonResultHandler<Object,CloudStorageResult> { private String path="/gds/storage/data/update?"; /** * 使用Json解析返回结果。 * * @param context * @param tsk * @param prx * @param device */ public CloudStorageUpdataServerHandler(Context context, Object tsk, Proxy prx, String device) { super(context, tsk, prx, device); } @Override protected CloudStorageResult parseJson(JSONObject obj) throws SearchException { CloudStorageResult result=null; try { processServerErrorcode(getJsonStringValue(obj, "status", ""), getJsonStringValue(obj, "message", "")); // 解析结果 if (obj.has("results")) { JSONObject results = obj.optJSONObject("results"); if (results != null) { result=new CloudStorageResult(); JSONArray jsonArray = results.optJSONArray("ids"); if(jsonArray!=null&&jsonArray.length()>0) { int[] ids=new int[jsonArray.length()]; for (int i = 0; i < jsonArray.length(); i++) { ids[i] = jsonArray.getInt(i); } result.setId(ids); } } } } catch (JSONException e) { e.printStackTrace(); } return result; } @Override protected boolean getRequestType() { return false; } @Override protected int getServiceCode() { return 0; } @Override protected String[] getRequestLines() { if (task != null) { CloudStorage.Updata addObject=(CloudStorage.Updata)task; String[] str = new String[1]; StringBuilder sb = new StringBuilder(); try { // 入参设置 if (addObject!=null){ sb.append("datasetId=").append(addObject.getDataSetId()); //拼data json字符串 StringBuffer dataJson=new StringBuffer(); CloudItem[] items= addObject.getCloudItems(); dataJson.append("["); for(int j=0;j<items.length;j++){ if(j!=0)dataJson.append(","); CloudItem item=items[j]; dataJson.append("{"); String coords="\"coordinates\":"; if(item.getCoordinates().size()>0){ String coord=""; for(int i=0;i<item.getCoordinates().size();i++){ LatLonPoint point=item.getCoordinates().get(i); if(i!=0)coord+=","; coord+=point.getLongitude()+" "+point.getLatitude(); } coords+="\""+coord+"\""; }else { coords+="\""+item.getLon()+" "+item.getLat()+"\""; } dataJson.append(coords); // 自定义字段 for(Map.Entry<String ,Object> entry:item.getExtras().entrySet()){ dataJson.append(","); String st="\""+entry.getKey()+"\":\""+entry.getValue().toString()+"\""; dataJson.append(st); } dataJson.append("}"); } dataJson.append("]"); sb.append("&data=").append(dataJson); StringBuffer idsString=new StringBuffer(); int[] ids= addObject.getDataIds(); for(int i=0;i<ids.length;i++){ if(i!=0) idsString.append(","); idsString.append(ids[i]); } sb.append("&ids=").append(idsString); } } catch (Exception e) { e.printStackTrace(); } str[0] = sb.toString(); return str; } return null; } @Override protected String getUrl() { String url = null; url = AppInfo.getCloudUrl(this.context)+path; return url+path; } }
cf9a07d010d99f8a9ae7e22717d5e5a0100cab4c
7ea659d79aad7c765f4f72addeab7e9ef21fd469
/src/cn/cms/util/Encryption.java
894718bb4495bd25bbe06329885a717f43600eac
[]
no_license
bigoat2015/course_manage_system
669f5d5ef966bd635e0f08f67e278e06fc324455
2a3b58125e2eae1831026ac37c7e1b660d241a2f
refs/heads/master
2016-08-11T21:18:31.382594
2015-05-22T02:11:06
2015-05-22T02:11:06
36,047,256
2
1
null
null
null
null
UTF-8
Java
false
false
1,552
java
package cn.cms.util; import java.security.MessageDigest; import java.util.UUID; import cn.cms.exception.MyException; import sun.misc.BASE64Encoder; /** * 加密 * @author Administrator * */ public class Encryption { //private static final String KEY = ":[email protected]"; // 密匙 public final static String calcMD5(String ss) throws MyException{ String s = ss==null ? "" : ss; char hexDigits[] = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'}; //字典 try{ byte[] strTemp = s.getBytes(); MessageDigest mdTemp = MessageDigest.getInstance("MD5"); mdTemp.update(strTemp); //更新数据 byte[] md = mdTemp.digest(); // 加密 int j = md.length; char str[] = new char[j*2]; //新字符串数组 int k = 0; // 计数器 for(int i=0; i<j; i++){ byte b = md[i]; str[k++] = hexDigits[b >>> 4 & 0xf]; str[k++] = hexDigits[b & 0xf]; } return new String(str); //加密后的字符串 }catch(Exception e){ throw new MyException("error", "密码转换时出错"); } } public final static String baseMd5(String message) throws Exception { try { MessageDigest md = MessageDigest.getInstance("md5"); byte md5[] = md.digest(message.getBytes()); BASE64Encoder encoder = new BASE64Encoder(); return encoder.encode(md5); } catch (Exception e) { throw e; } } // 产生全球唯一的ID值 public final static String generateID(){ return UUID.randomUUID().toString(); } }
ed0a3b76db7196b0f275b1da24aca07ab5089b99
fcb19f0899ee727ad54aeb2ff6f7164441bbdad4
/JavaHomeworksDraghiciAndreea/src/javahomeworksdraghiciandreea/WrappersAndOperators.java
e54631e3a085c893323a8e8c648ae1932d94d314
[]
no_license
AndreeaDraghi/JavaHomeworksDraghiciAndreea
c134a55cabaf1476b6c60f4d043f5eef84130f1c
22ae8ea68168513b19810238f51877efeaee510b
refs/heads/master
2021-01-19T00:12:04.650358
2017-01-19T23:36:34
2017-01-21T12:07:46
72,920,546
0
0
null
null
null
null
UTF-8
Java
false
false
23,828
java
/* * Homework 2 * Exercise 3: Do the exercise from point 2 using wrapper classes defined in Java (from Integer to ...Boolean). */ package javahomeworksdraghiciandreea; import java.util.Objects; /** * * @author Andreea */ public class WrappersAndOperators { public static void main(String[] args){ // I start this program creating the Integer Wrapper Class wa and wb; System.out.println("\n********** Operations with Integer Wrapper Class**********"); Integer wa = 400; Integer wb = 50; // Here are operations with the arithmetic operators System.out.println("\nArithmetic Operators for Integer Wrapper Class where wa = 400 and wb = 50 "); System.out.println("\nThe result of the '+ operator' for (wa+wb) is: " + (wa+wb)); System.out.println("The result of the '- operator' for (wa-wb) is: " + (wa-wb) ); System.out.println("The result of the '* operator' for (wa*wb) is: " + (wa*wb)); System.out.println("The result of the '/ operator' for (wa/wb) is: " + (wa/wb)); System.out.println("The result of the '% operator' for (wa%wb) is: " + (wa%wb)); System.out.println("The result of the 'Postfix ++ operator' for (wa++) is: " + (wa++)); wa--; System.out.println("The result of the 'Prefix ++ operator' for (++wb) is: " + (++wb)); --wb; // Here are operations with the relational operators System.out.println("\nRelational Operators for Integer Wrapper Class when wa = 400 and wb = 50 "); System.out.println("\na < wb : "+(wa < wb)); System.out.println("wa > wb : "+(wa > wb)); System.out.println("wa >= wb : "+(wa >= wb)); System.out.println("wa <= wb : "+(wa <= wb)); System.out.println("wa == wb : "+(Objects.equals(wa, wb))); System.out.println("wa != wb : "+(!Objects.equals(wa, wb))); // Here are operations with the bitwise operators System.out.println("\nBitwise Operators for Integer Wrapper Class when wa = 400 and wb = 50 "); System.out.println("\na & wb : " + (wa & wb)); System.out.println("wa | wb : " + (wa | wb)); System.out.println("wa ^ wb : " + (wa ^ wb)); System.out.println("~wa : " + (~wa)); System.out.println("wa << wb : " + (wa << wb)); System.out.println("wa >> wb : " + (wa >> wb)); System.out.println("wa >>> wb : " + (wa >>> wb)); // Here are operations with the logical operators System.out.println("\nLogical Operators for Integer Wrapper Class when wa = 400 and wb = 50 "); if ( (wa == 400) && (wb == 50) ) { System.out.println("\nIt is TRUE that wa = 400 and wb = 50"); } if ( (wa == 10) || (wb == 50) ) { System.out.println("It is TRUE that wa = 10 or wb = 50"); } // Here are operations with the assignment operators System.out.println("\nAssignment Operators for Integer Wrapper Class when wa = 400 and wb = 50 "); System.out.println("\nThe result of the '= operator' for (wa=wb) is " +( wa = wb)); System.out.println("The result of the '+= operator' for (wa+=wb) is " +( wa += wb)); System.out.println("The result of the '-= operator' for (wa-=wb) is " +( wa -= wb)); System.out.println("The result of the '*= operator' for (wa*=wb) is " +( wa *= wb)); System.out.println("The result of the '/= operator' for (wa/=wb) is " +( wa /= wb)); System.out.println("The result of the '%= operator' for (wa%=wb) is " +( wa %= wb)); System.out.println("The result of the '>>= operator' for (wa>>=wb) is " +( wa >>= wb)); System.out.println("The result of the '<<= operator' for (wa<<=wb) is " +( wa <<= wb)); System.out.println("The result of the '|= operator' for (wa|=wb) is " +( wa |= wb)); System.out.println("The result of the '&= operator' for (wa&=wb) is " +( wa &= wb)); System.out.println("The result of the '^= operator' for (wa^=wb) is " +( wa ^= wb)); // Here are operations with the misc operators; System.out.println("\nMisc Operators for Integer Wrapper Class when wa = 400 and wb = 50 "); wa = 400; System.out.println("\nConditional result for '(wa==wb)?wa:wb is' " + ((Objects.equals(wa, wb)) ? wa : wb) ); if (wa instanceof Integer){ System.out.println("The following Integer object is an instance of Integer class:" + wa); } if (wb instanceof Integer){ System.out.println("The following Integer object is an instance of Integer class:" + wb); } // Here i've created the Long Wrapper Class wc and wd; System.out.println("\n********** Operations with Long Wrapper Class **********"); Long wc = 100000L; Long wd = 50000L; // Here are operations with the arithmetic operators System.out.println("\nArithmetic Operators for Long Wrapper Class when wc = 100000 and wd = 50000 "); System.out.println("\nThe result of the '+ operator' for (wc+wd) is: " + (wc+wd)); System.out.println("The result of the '- operator' for (wc-wd) is: " + (wc - wd)); System.out.println("The result of the '* operator' for (wc*wd) is: " + (wc*wd)); System.out.println("The result of the '/ operator' for (wc/wd) is: " + (wc/wd)); System.out.println("The result of the '% operator' for (wc%wd) is: " + (wc%wd)); System.out.println("The result of the 'Postfix ++ operator' for (wc++) is: " + (wc++)); wc--; System.out.println("The result of the 'Prefix ++ operator' for (++wd) is: " + (++wd)); --wd; // Here are operations with the relational operators System.out.println("\nRelational Operators for Long Wrapper Class when wc = 100000 and wd = 50000 "); System.out.println("\na < wd : "+(wc < wd)); System.out.println("wc > wd : "+(wc > wd)); System.out.println("wc >= wd : "+(wc >= wd)); System.out.println("wc <= wd : "+(wc <= wd)); System.out.println("wc == wd : "+(Objects.equals(wc, wd))); System.out.println("wc != wd : "+(!Objects.equals(wc, wd))); // Here are operations with the bitwise operators System.out.println("\nBitwise Operators for Long Wrapper Class when wc = 100000 and wd = 50000 "); System.out.println("\na & wd : " + (wc & wd)); System.out.println("wc | wd : " + (wc | wd)); System.out.println("wc ^ wd : " + (wc ^ wd)); System.out.println("~wc : " + (~wc)); System.out.println("wc << wd : " + (wc << wd)); System.out.println("wc >> wd : " + (wc >> wd)); System.out.println("wc >>> wd : " + (wc >>> wd)); // Here are operations with the logical operators System.out.println("\nLogical Operators for Long Wrapper Class when wc = 100000 and wd = 50000 "); if ( (wc == 100000) && (wd == 50000) ) { System.out.println("\nIt is TRUE that wc = 100000 and wd = 50000"); } if ( (wc == 100) || (wd == 50000) ) { System.out.println("It is TRUE that wc = 100 or wd = 50000"); } // Here are operations with the assignment operators System.out.println("\nAssignment Operators for Long Wrapper Class when wc = 100000 and wd = 50000 "); System.out.println("\nThe result of the '= operator' for (wc=wd) is " +( wc = wd)); System.out.println("The result of the '+= operator' for (wc+=wd) is " +( wc += wd)); System.out.println("The result of the '-= operator' for (wc-=wd) is " +( wc -= wd)); System.out.println("The result of the '*= operator' for (wc*=wd) is " +( wc *= wd)); System.out.println("The result of the '/= operator' for (wc/=wd) is " +( wc /= wd)); System.out.println("The result of the '%= operator' for (wc%=wd) is " +( wc %= wd)); System.out.println("The result of the '>>= operator' for (wc>>=wd) is " +( wc >>= wd)); System.out.println("The result of the '<<= operator' for (wc<<=wd) is " +( wc <<= wd)); System.out.println("The result of the '|= operator' for (wc|=wd) is " +( wc |= wd)); System.out.println("The result of the '&= operator' for (wc&=wd) is " +( wc &= wd)); System.out.println("The result of the '^= operator' for (wc^=wd) is " +( wc ^= wd)); wc = 100000L; // Here are operations with the misc operators; System.out.println("\nMisc Operators for Long Wrapper Class when wc = 100000 and wd = 50000 "); System.out.println("\nConditional result for '(wc==wd)?wc:wd is' " + ((Objects.equals(wc, wd)) ? wc : wd) ); if (wc instanceof Long){ System.out.println("The following Long object is an instance of Long class:" + wc); } if (wd instanceof Long){ System.out.println("The following Long object is an instance of Long class:" + wd); } // Here i've created the Short Wrapper Class we and wf; System.out.println("\n********** Operations with Short Wrapper Class **********"); Short we = 10; Short wf = 5; // Here are operations with the arithmetic operators System.out.println("\nArithmetic Operators for Short Wrapper Class when we = 10 and wf = 5 "); System.out.println("\nThe result of the '+ operator' for (we+wf) is: " + (we + wf)); System.out.println("The result of the '- operator' for (we-wf) is: " + (we - wf)); System.out.println("The result of the '* operator' for (we*wf) is: " + (we * wf)); System.out.println("The result of the '/ operator' for (we/wf) is: " + (we / wf)); System.out.println("The result of the '% operator' for (we%wf) is: " + (we % wf)); System.out.println("The result of the 'Postfix ++ operator' for (we++) is: " + (we++)); we--; System.out.println("The result of the 'Prefix ++ operator' for (++wf) is: " + ( ++wf )); --wf; // Here are operations with the relational operators System.out.println("\nRelational Operators for Short Wrapper Class when we = 10 and wf = 5 "); System.out.println("\na < wf : "+(we < wf)); System.out.println("we > wf : "+(we > wf)); System.out.println("we >= wf : "+(we >= wf)); System.out.println("we <= wf : "+(we <= wf)); System.out.println("we == wf : "+(Objects.equals(we, wf))); System.out.println("we != wf : "+(!Objects.equals(we, wf))); // Here are operations with the bitwise operators System.out.println("\nBitwise Operators for Short Wrapper Class when we = 10 and wf = 5 "); System.out.println("\na & wf : " + (we & wf)); System.out.println("we | wf : " + (we | wf)); System.out.println("we ^ wf : " + (we ^ wf)); System.out.println("~we : " + (~we)); System.out.println("we << wf : " + (we << wf)); System.out.println("we >> wf : " + (we >> wf)); System.out.println("we >>> wf : " + (we >>> wf)); // Here are operations with the logical operators System.out.println("\nLogical Operators for Short Wrapper Class when we = 10 and wf = 5 "); if ( (we == 10) && (wf == 5) ) { System.out.println("\nIt is TRUE that we = 10 and wf = 5"); } if ( (we == 10) || (wf == 50) ) { System.out.println("It is TRUE that we = 10 or wf = 5"); } // Here are operations with the misc operators; System.out.println("\nMisc Operators for Short Wrapper Class when we = 10 and wf = 5 "); System.out.println("\nConditional result for '(we==wf)?we:wf is' " + ((Objects.equals(we, wf)) ? we : wf) ); if (we instanceof Short){ System.out.println("The following Short object is an instance of Short class:" + we); } if (wf instanceof Short){ System.out.println("The following Short object is an instance of Short class:" + wf); } // Here wi've created the Float Wrapper Class wi and wj; System.out.println("\n********** Operations with Float Wrapper Class **********"); Float wi = 451.6f; Float wj = 273.8f; // Here are operations with the arithmetic operators System.out.println("\nArithmetic Operators for Float Wrapper Class when wi = 451.6f and wj = 273.8f "); System.out.println("\nThe result of the '+ operator' for (wi+wj) is: " + (wi + wj)); System.out.println("The result of the '- operator' for (wi-wj) is: " + (wi - wj)); System.out.println("The result of the '* operator' for (wi*wj) is: " + (wi*wj)); System.out.println("The result of the '/ operator' for (wi/wj) is: " + (wi/wj)); System.out.println("The result of the '% operator' for (wi%wj) is: " + (wi%wj)); System.out.println("The result of the 'Postfix ++ operator' for (wi++) is: " + (wi++)); wi--; System.out.println("The result of the 'Prefix ++ operator' for (++wj) is: " + (++wj)); --wj; // Here are operations with the relational operators System.out.println("\nRelational Operators for Float Wrapper Class when wi = 451.6f and wj = 273.8f "); System.out.println("\na < wj : "+(wi < wj)); System.out.println("wi > wj : "+(wi > wj)); System.out.println("wi >= wj : "+(wi >= wj)); System.out.println("wi <= wj : "+(wi <= wj)); System.out.println("wi == wj : "+(Objects.equals(wi, wj))); System.out.println("wi != wj : "+(!Objects.equals(wi, wj))); // Here are operations with the logical operators System.out.println("\nLogical Operators for Float Wrapper Class when wi = 451.6 and wj = 273.8 "); if ( (wi == 451.6f) && (wj == 273.8f) ) { System.out.println("\nIt is TRUE that wi = 451.6f and wj = 273.8f"); } if ( (wi == 451.6f) || (wj == 50f) ) { System.out.println("It is TRUE that wi = 451.6 or wj = 273.8"); } // Here are operations with the assignment operators System.out.println("\nAssignment Operators for Float Wrapper Class when wi = 451.6 and wj = 273.8 "); System.out.println("\nThe result of the '= operator' for (wi=wj) is " +( wi = wj)); System.out.println("The result of the '+= operator' for (wi+=wj) is " +( wi += wj)); System.out.println("The result of the '-= operator' for (wi-=wj) is " +( wi -= wj)); System.out.println("The result of the '*= operator' for (wi*=wj) is " +( wi *= wj)); System.out.println("The result of the '/= operator' for (wi/=wj) is " +( wi /= wj)); System.out.println("The result of the '%= operator' for (wi%=wj) is " +( wi %= wj)); wi = 451.6f; // Here are operations with the misc operators; System.out.println("\nMisc Operators for Float Wrapper Class when wi = 451.6f and wj = 273.8f "); System.out.println("\nConditional result for '(wi==wj)?wi:wj is' " + ((Objects.equals(wi, wj)) ? wi : wj) ); if (wi instanceof Float){ System.out.println("The following Float object is an instance of Float class:" + wi); } if (wj instanceof Float){ System.out.println("The following Float object is an instance of Float class:" + wj); } // Here i've created the Double Wrapper Class wk and wl System.out.println("\n********** Operations with Double Wrapper Class **********"); Double wk = 19765.41d; Double wl = 18837.27d; // Here are operations with the arithmetic operators System.out.println("\nArithmetic Operators for Double Wrapper Class when wk = 19765.41d and wl = 18837.27d "); System.out.println("\nThe result of the '+ operator' for (wk+wl) is: " + (wk + wl)); System.out.println("The result of the '- operator' for (wk-wl) is: " + (wk - wl)); System.out.println("The result of the '* operator' for (wk*wl) is: " + (wk*wl)); System.out.println("The result of the '/ operator' for (wk/wl) is: " + (wk/wl)); System.out.println("The result of the '% operator' for (wk%wl) is: " + (wk%wl)); System.out.println("The result of the 'Postfix ++ operator' for (wk++) is: " + (wk++)); wk--; System.out.println("The result of the 'Prefix ++ operator' for (++wl) is: " + (++wl)); --wl; // Here are operations with the relational operators System.out.println("\nRelational Operators for Double Wrapper Class when wk = 19765.41d and wl = 18837.27d "); System.out.println("\na < wl : "+(wk < wl)); System.out.println("wk > wl : "+(wk > wl)); System.out.println("wk >= wl : "+(wk >= wl)); System.out.println("wk <= wl : "+(wk <= wl)); System.out.println("wk == wl : "+(Objects.equals(wk, wl))); System.out.println("wk != wl : "+(!Objects.equals(wk, wl))); // There are no bitwise operations for Double Wrapper Class System.out.println("\nThere are no bitwise operations for Double Wrapper Class "); // Here are operations with the logical operators System.out.println("\nLogical Operators for Double Wrapper Class when wk = 451.6 and wl = 273.8 "); if ( (wk == 19765.41d) && (wl == 18837.27d) ) { System.out.println("\nIt is TRUE that wk = 19765.41d and wl = 18837.27d"); } if ( (wk == 19765.41d) || (wl == 50f) ) { System.out.println("It is TRUE that wk = 19765.41d or wl = 18837.27d"); } // Here are operations with the assignment operators System.out.println("\nAssignment Operators for Double Wrapper Class when wk = 451.6 and wl = 273.8 "); System.out.println("\nThe result of the '= operator' for (wk=wl) is " +( wk = wl)); System.out.println("The result of the '+= operator' for (wk+=wl) is " +( wk += wl)); System.out.println("The result of the '-= operator' for (wk-=wl) is " +( wk -= wl)); System.out.println("The result of the '*= operator' for (wk*=wl) is " +( wk *= wl)); System.out.println("The result of the '/= operator' for (wk/=wl) is " +( wk /= wl)); System.out.println("The result of the '%= operator' for (wk%=wl) is " +( wk %= wl)); wk = 19765.41d; // Here are operations with the misc operators; System.out.println("\nMisc Operators for Double Wrapper Class when wk = 451.6 and wl = 273.8 "); System.out.println("\nConditional result for '(wk==wl)?wk:wl is' " + ((Objects.equals(wk, wl)) ? wk : wl) ); if (wk instanceof Double){ System.out.println("The following Double object is an instance of Double class:" + wk); } if (wl instanceof Double){ System.out.println("The following Double object is an instance of Double class:" + wl); } // Here I've created the Character Wrapper Class wx and wy; System.out.println("\n********** Operations with Character Wrapper Class **********"); Character wx= 'a'; Character wy = 'b'; // Here are operations with the relational operators System.out.println("\nRelational Operators for Character Wrapper Class when wx= 'a' and wy = 'b' "); System.out.println("\na < wy : "+(wx< wy)); System.out.println("wx> wy : "+(wx> wy)); System.out.println("wx>= wy : "+(wx>= wy)); System.out.println("wx<= wy : "+(wx<= wy)); System.out.println("wx== wy : "+(Objects.equals(wx, wy))); System.out.println("wx!= wy : "+(!Objects.equals(wx, wy))); // Here are operations with the logical operators System.out.println("\nLogical Operators for Character Wrapper Class when wx= 'a' and wy = 'b' "); if ( (wx== 'a') && (wy == 'b') ) { System.out.println("\nIt is TRUE that wx= 'a' and wy = 'b' "); } if ( (wx== 'a') || (wy == 'c') ) { System.out.println("It is TRUE that wx= 'a' or wy = 'c'"); } // Here are operations with the assignment operators System.out.println("\nAssignment Operators for Character Wrapper Class when wx= 'a' and wy = 'b' "); System.out.println("\nThe result of the '= operator' for (k=wy) is " +( wx = wy)); wx = 'a'; // Here are operations with the misc operators; System.out.println("\nMisc Operators for Character Wrapper Class when wx= 'a' and wy = 'b' "); System.out.println("\nConditional result for '(k==wy)?k:wy is' " + ((Objects.equals(wx, wy)) ? wx: wy) ); if (wx instanceof Character){ System.out.println("The following Character object is an instance of Character class:" + wx); } if (wy instanceof Character){ System.out.println("The following Character object is an instance of Character class:" + wy); } // Here I've created the Boolean Wrapper Class ww and wz; System.out.println("\n********** Operations with Boolean Wrapper Class **********"); Boolean ww= true; Boolean wz = false; // Here are operations with the relational operators System.out.println("\nRelational Operators for Boolean Wrapper Class when ww= true and wz = false "); System.out.println("ww== wz : "+(Objects.equals(ww, wz))); System.out.println("ww!= wz : "+(!Objects.equals(ww, wz))); System.out.println("ww & wz : " + (ww & wz)); System.out.println("ww && wz : " + (ww && wz)); System.out.println("ww | wz : " + (ww | wz)); System.out.println("ww || wz: " + (ww || wz)); System.out.println("ww ^ wz : " + (ww ^ wz)); System.out.println("!ww : " + (!ww)); // Here are operations with the logical operators System.out.println("\nLogical Operators for Boolean Wrapper Class when ww = true and wz = false "); if ( (ww== true) && (wz == false) ) { System.out.println("\nIt is TRUE that ww= true and wz = false "); } if ( (ww== true) || (wz == true) ) { System.out.println("It is TRUE that ww= true or wz = false"); } // Here are operations with the misc operators (k used just the conditional one); System.out.println("\nMisc Operators for Boolean Wrapper Class when ww= true and wz = false "); System.out.println("\nConditional result for '(ww==wz)?ww:wz is' " + ((Objects.equals(ww, wz)) ? ww: wz) ); if (ww instanceof Boolean){ System.out.println("The following Boolean object is an instance of Boolean class:" + ww); } if (wz instanceof Boolean){ System.out.println("The following Boolean object is an instance of Boolean class:" + wz); } } }
5a5240893a9a054cac6af7da8daeff7b11081e26
bc7345cbc938db7836a4ba7fda9b2353b0e1d712
/Projeto POO versão nova/GerenteDeQuestoes.java
36111a2d79142d63713de84f98b3c6c771061592
[]
no_license
thamiresneves/projetoQuestionario
3898d6a246b920272fa749ee88e3aaab194f000c
94092bb0e7a3db18b7d63f90035b439381cf447c
refs/heads/master
2021-01-25T04:03:16.763679
2015-03-22T14:51:17
2015-03-22T14:51:17
27,484,286
0
0
null
null
null
null
ISO-8859-1
Java
false
false
6,538
java
package br.ufpb.projetopoo; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class GerenteDeQuestoes { private List <QuestaoVouF> questoesVouF = new ArrayList<QuestaoVouF> (); private List <QuestaoObjetiva> questoesObjetivas = new ArrayList<QuestaoObjetiva> (); private List <QuestaoDissertativa> questoesDissertativas = new ArrayList<QuestaoDissertativa> (); public List <QuestaoVouF> getQuestoesVouF() { return questoesVouF; } public List <QuestaoObjetiva> getQuestoesObjetivas() { return questoesObjetivas; } public List <QuestaoDissertativa> getQuestoesDissertativas() { return questoesDissertativas; } public void cadastrarQuestaoDissertativa(TipoDeQuestoes tq, long numDeQuestao, String pergunta, String resposta){ QuestaoDissertativa questao = new QuestaoDissertativa(tq, numDeQuestao,pergunta,resposta); this.questoesDissertativas.add(questao); } public void cadastrarQuestaoObjetiva(TipoDeQuestoes tq, long numDeQuestao, String pergunta, String resposta, List<String> alternativas){ QuestaoObjetiva questao = new QuestaoObjetiva(tq, numDeQuestao, pergunta, resposta, alternativas); this.questoesObjetivas.add(questao); } public void cadastrarQuestaoVouF(TipoDeQuestoes tq, long numDeQuestao, String pergunta, String resposta){ QuestaoVouF questao = new QuestaoVouF(tq, numDeQuestao,pergunta,resposta); this.questoesVouF.add(questao); } public String pesquisarQuestaoDissertativa(long numDeQuestao)throws QuestaoInexistenteException{ for(QuestaoDissertativa q: this.questoesDissertativas){ if(q.getNumDeQuestao() == numDeQuestao){ return q.getPergunta(); } }throw new QuestaoInexistenteException ("Questão de número: " + numDeQuestao + " não foi encontrada!"); } public String pesquisarQuestaoObjetiva(long numDeQuestao)throws QuestaoInexistenteException{ for(QuestaoObjetiva q: this.questoesObjetivas){ if(q.getNumDeQuestao() == numDeQuestao){ return q.getPergunta(); } }throw new QuestaoInexistenteException ("Questão de número: " + numDeQuestao + " não foi encontrada!"); } public String pesquisarQuestaoVouF(long numDeQuestao)throws QuestaoInexistenteException{ for(QuestaoVouF q: this.questoesVouF){ if(q.getNumDeQuestao() == numDeQuestao){ return q.getPergunta(); } }throw new QuestaoInexistenteException ("Questão de número: " + numDeQuestao + " não foi encontrada!"); } public void removerQuestaoDissertativa(long numDeQuestao) throws QuestaoInexistenteException{ boolean removeu = false; for(QuestaoDissertativa q : this.questoesDissertativas){ if(q.getNumDeQuestao()== numDeQuestao){ questoesDissertativas.remove(q); removeu = true; break; } }if(!removeu){ throw new QuestaoInexistenteException ("Questão de número: " + numDeQuestao + " não foi encontrada!"); } } public void removerQuestaoObjetiva(long numDeQuestao) throws QuestaoInexistenteException{ boolean removeu = false; for(QuestaoObjetiva q : this.questoesObjetivas){ if(q.getNumDeQuestao()== numDeQuestao){ questoesObjetivas.remove(q); removeu = true; break; } }if(!removeu){ throw new QuestaoInexistenteException ("Questão de número: " + numDeQuestao + " não foi encontrada!"); } } public void removerQuestaoVouF(long numDeQuestao) throws QuestaoInexistenteException{ boolean removeu = false; for(QuestaoVouF q : this.questoesVouF){ if(q.getNumDeQuestao()== numDeQuestao){ questoesVouF.remove(q); removeu = true; break; } }if(!removeu){ throw new QuestaoInexistenteException ("Questão de número: " + numDeQuestao + " não foi encontrada!"); } } public void gravarQuestoesDissertativasEmArquivo(String nomeArquivo) throws IOException { BufferedWriter gravador = null; try { gravador = new BufferedWriter(new FileWriter(nomeArquivo)); for (QuestaoDissertativa questao: this.questoesDissertativas){ gravador.write(questao.getTq()+"\n"); gravador.write(questao.getNumDeQuestao()+"\n"); gravador.write(questao.getPergunta()+"\n"); gravador.write(questao.getResposta()+"\n"); } } finally { if (gravador!=null){ gravador.close(); } } } public void lerQuestoesDissertativasDoArquivo(String nomeArquivo) throws IOException { BufferedReader leitor = null; try { leitor = new BufferedReader(new FileReader(nomeArquivo)); leitor.readLine(); leitor.readLine(); leitor.readLine(); leitor.readLine(); } finally { if (leitor!=null){ leitor.close(); } } } public void gravarQuestoesObjetivasEmArquivo(String nomeArquivo) throws IOException { BufferedWriter gravador = null; try { gravador = new BufferedWriter(new FileWriter(nomeArquivo)); for (QuestaoObjetiva questao: this.questoesObjetivas){ gravador.write(questao.getTq()+"\n"); gravador.write(questao.getNumDeQuestao()+"\n"); gravador.write(questao.getPergunta()+"\n"); gravador.write(questao.getResposta()+"\n"); gravador.write(questao.getAlternativas()+"\n"); } } finally { if (gravador!=null){ gravador.close(); } } } public void lerQuestoesObjetivasDoArquivo(String nomeArquivo) throws IOException { BufferedReader leitor = null; try { leitor = new BufferedReader(new FileReader(nomeArquivo)); leitor.readLine(); leitor.readLine(); leitor.readLine(); leitor.readLine(); leitor.readLine(); } finally { if (leitor!=null){ leitor.close(); } } } public void gravarQuestoesVouFEmArquivo(String nomeArquivo) throws IOException { BufferedWriter gravador = null; try { gravador = new BufferedWriter(new FileWriter(nomeArquivo)); for (QuestaoVouF questao: this.questoesVouF){ gravador.write(questao.getTq()+"\n"); gravador.write(questao.getNumDeQuestao()+"\n"); gravador.write(questao.getPergunta()+"\n"); gravador.write(questao.getResposta()+"\n"); } } finally { if (gravador!=null){ gravador.close(); } } } public void lerQuestoesVouFDoArquivo(String nomeArquivo) throws IOException { BufferedReader leitor = null; try { leitor = new BufferedReader(new FileReader(nomeArquivo)); leitor.readLine(); leitor.readLine(); leitor.readLine(); leitor.readLine(); } finally { if (leitor!=null){ leitor.close(); } } } }
38ea77165999f7a418e31802fb131dc47f17173d
f928b5d8cd06af4b6ea90fafe42fb58e199ce5a1
/src/main/java/com/onlineassessment/service/ScheduleMTService.java
a993adca32457ba7e93419398b02c0a0eb233e91
[]
no_license
vikarm-verma/SpringBootwithJavaSwingOnlineTestPortal
0b66189edce0f21f12061e0a683e9ee95ac01011
0a62fe93e6a2791e15212384d0f5396cb4b26b45
refs/heads/main
2023-02-22T16:27:04.416314
2021-01-28T14:23:06
2021-01-28T14:23:06
333,767,900
0
0
null
null
null
null
UTF-8
Java
false
false
1,073
java
package com.onlineassessment.service; import java.util.ArrayList; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.onlineassessment.entity.ScheduleMT; import com.onlineassessment.repository.ScheduleMTRepository; @Service public class ScheduleMTService { @Autowired ScheduleMTRepository scheduleMTRepository; public List<ScheduleMT> getAllMTS() { List<ScheduleMT> list = new ArrayList<ScheduleMT>(); this.scheduleMTRepository.findAll().forEach(mts -> list.add(mts)); return list; } public ScheduleMT getExamById(String id) { return scheduleMTRepository.findByMTId(id); } public void addMT(ScheduleMT stMT) { scheduleMTRepository.save(stMT); } public void deleteMT(String id) { this.scheduleMTRepository.deleteById(id); } public void updateExam(ScheduleMT sr, String examId) { // sr.setId=id; this.scheduleMTRepository.save(sr); } public void updateMT(Boolean active,String id) { this.scheduleMTRepository.updateMT(active, id); } }
a919c0f9b8bfe47799377b01c74e7ca5aa750748
43267a2dbdb3788b1b2c11fa8020e7bc8e91bb8f
/DesignPatterns/src/main/java/com/github/pengqiangx/demo/dp/prototype/one/refactor/TestDemo.java
41c7eba55e9c3b30d1a17198b65c749a35b0f9b0
[]
no_license
pengqiangx/demo
80d3f0632e4c84a166796ac39aa95396faa31b26
73c4a29914e55ae236f1f48af5002b28a60ed732
refs/heads/master
2020-12-25T14:48:38.042960
2018-11-25T09:04:43
2018-11-25T09:04:43
62,355,906
0
0
null
null
null
null
UTF-8
Java
false
false
969
java
package com.github.pengqiangx.demo.dp.prototype.one.refactor; import org.junit.Test; /** * 测试 */ public class TestDemo { @Test public void test1(){ //先创建原型实例 OrderApi order = new PersonalOrder(); order.setOrderProductNum(100); System.out.println(order.getOrderProductNum()); // 通过克隆来获取新的实例 OrderApi order2 = (OrderApi) order.clone(); order2.setOrderProductNum(80); System.out.println(order2.getOrderProductNum()); //再次输出原型实例的值 System.out.println("再次输出原型实例="+ order.getOrderProductNum()); } @Test public void test2(){ PersonalOrder order = new PersonalOrder(); order.setOrderProductNum(3987); order.setCustomerName("zhangsan"); order.setProductId("P0001"); OrderBusiness business = new OrderBusiness(); business.saveOrder(order); } }
3715437e7a13e191679dfaa999a5bac915aebee1
d6e6df075f62d5ee1d90466746fe6107a2b2876e
/app/src/main/java/com/example/advancedandroidarchitecture/networking/ServiceModule.java
f35d4fd1fc5cecb124f6ff7ab752dfd62af6f063
[]
no_license
johnkiprop/Advanced-Architecture
7c6c01bc90e7c4501ef0a2d06538b97a14cc025e
20145277bc2cf90f17d701a1f0b3919c7c4b0f94
refs/heads/master
2020-12-26T07:16:40.161889
2020-01-31T12:57:57
2020-01-31T12:57:57
237,430,769
1
0
null
null
null
null
UTF-8
Java
false
false
1,329
java
package com.example.advancedandroidarchitecture.networking; import com.example.advancedandroidarchitecture.models.AdapterFactory; import com.example.advancedandroidarchitecture.models.ZonedDateTimeAdapter; import com.example.advancedandroidarchitecture.net.networking.NetworkModule; import com.squareup.moshi.Moshi; import javax.inject.Named; import javax.inject.Singleton; import dagger.Module; import dagger.Provides; import okhttp3.Call; import retrofit2.Retrofit; import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import retrofit2.converter.moshi.MoshiConverterFactory; @Module(includes = NetworkModule.class) public abstract class ServiceModule { @Provides @Singleton static Moshi provideMoshi(){ return new Moshi.Builder() .add(AdapterFactory.create()) .add(new ZonedDateTimeAdapter()) .build(); } @Provides @Singleton static Retrofit provideRetrofit(Moshi moshi, Call.Factory callFactory, @Named("base_url") String baseUrl){ return new Retrofit.Builder() .callFactory(callFactory) .addConverterFactory(MoshiConverterFactory.create(moshi)) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .baseUrl(baseUrl) .build(); } }
6fc828a013ea8c9e161190ea340e6d485bc91fc7
5cc23b488d7124293e45b2487a74fec6ec34ea02
/Calculator/app/src/test/java/com/adarshjayakumar/calculator/ExampleUnitTest.java
197294a6d6fe54f75d6f4d119414bf1b0f5c64e7
[]
no_license
adarshjaya12/Android-Studio
506c069344b0f40aa59590a0da813d12c0a47415
39533b1fa617b9b9e395e0c377abfeb966608bbc
refs/heads/master
2021-01-10T14:46:58.874856
2016-03-17T01:34:30
2016-03-17T01:34:30
49,470,050
0
0
null
null
null
null
UTF-8
Java
false
false
323
java
package com.adarshjayakumar.calculator; import org.junit.Test; import static org.junit.Assert.*; /** * To work on unit tests, switch the Test Artifact in the Build Variants view. */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
ae2a7433e05d8fc1a4ff63ccd39d65a4164f7276
0212cd8efd92b881f36ccab6da5d4952e4d0e99a
/src/calcApp/LoginGUI.java
d1a21ea5398151979bf7e8526b99c678d7b32c2c
[]
no_license
palmerchaplin/Calculator-Application
a3b747384ed65fc5a8575e723576abacaf4d7213
d89314510a8cd8723c0165e89c41d9229c5f4be3
refs/heads/master
2020-03-10T20:54:08.917323
2018-04-15T05:34:09
2018-04-15T05:34:09
129,580,193
0
0
null
null
null
null
UTF-8
Java
false
false
3,280
java
package calcApp; import java.awt.BorderLayout; import java.awt.Color; import java.awt.EventQueue; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.UIManager; import javax.swing.border.EmptyBorder; import java.awt.GridBagLayout; import java.awt.GridLayout; import javax.swing.JLabel; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; public class LoginGUI extends JFrame { private JPanel contentPane; private JTextField textFieldUname; private JTextField textFieldPword; private JTextField txtSystemMessage; private JTextField textFieldLockout; private JLabel lblLockoutcount; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { LoginGUI frame = new LoginGUI(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public LoginGUI() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 450, 300); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(new GridLayout(0, 1, 0, 0)); JLabel lblLogin = new JLabel("Login"); lblLogin.setHorizontalAlignment(SwingConstants.CENTER); contentPane.add(lblLogin); JLabel lblUsername = new JLabel("Username"); contentPane.add(lblUsername); textFieldUname = new JTextField(); contentPane.add(textFieldUname); textFieldUname.setColumns(10); JLabel lblPassword = new JLabel("Password"); contentPane.add(lblPassword); textFieldPword = new JTextField(); contentPane.add(textFieldPword); textFieldPword.setColumns(10); JButton btnRegister = new JButton("Login"); btnRegister.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String uname = textFieldUname.getText(); String pword = textFieldPword.getText(); USER user1 = new USER("", "", ""); Database dbc = new Database(user1); if(dbc.getRecordByUname(uname) != dbc.getRecordByUname(uname)) //how to check uname to unamme and corresponding pwords? { CalculatorGUI calc = new CalculatorGUI(); calc.setVisible(true); } else //because of problems, made this not happen by if statement always being true. Having problems incrementing lock { int newLock = dbc.incrementLock(uname); txtSystemMessage.setText("Incorrect Entry"); textFieldLockout.setText(Integer.toString(newLock)); } } }); btnRegister.setForeground(UIManager.getColor("Button.light")); contentPane.add(btnRegister); txtSystemMessage = new JTextField(); txtSystemMessage.setForeground(Color.LIGHT_GRAY); txtSystemMessage.setEditable(false); txtSystemMessage.setText("System Message"); contentPane.add(txtSystemMessage); txtSystemMessage.setColumns(10); lblLockoutcount = new JLabel("LockoutCount"); contentPane.add(lblLockoutcount); textFieldLockout = new JTextField(); textFieldLockout.setEditable(false); contentPane.add(textFieldLockout); textFieldLockout.setColumns(10); } }
8a903b4e0497e40e1221f24a6cb590c2fd0c0407
dd82d71687517d4c2d9359e6696adb06fddaea6c
/src/main/java/ru/mybooklist/event/OnRegistrationCompleteEvent.java
5c862814e626a1e8e5116963083e5b1b3708e198
[]
no_license
itegulov/MyBookList
d3024dd8441e3f71417e65f20cc82ad0bf2997f1
1e83090cb70ef5954f2a156db35ddc1ff7f1c88d
refs/heads/master
2021-01-21T02:30:30.491247
2015-11-23T22:17:05
2015-11-23T22:17:05
38,671,176
0
0
null
null
null
null
UTF-8
Java
false
false
721
java
package ru.mybooklist.event; import org.springframework.context.ApplicationEvent; import ru.mybooklist.model.User; import java.util.Locale; /** * @author Daniyar Itegulov */ public class OnRegistrationCompleteEvent extends ApplicationEvent { private final User user; private final Locale locale; private final String appUrl; public OnRegistrationCompleteEvent(User user, Locale locale, String appUrl) { super(user); this.user = user; this.locale = locale; this.appUrl = appUrl; } public User getUser() { return user; } public Locale getLocale() { return locale; } public String getAppUrl() { return appUrl; } }
bd1adbf04fa7960dfa278d6f9075d62df87fa5d8
2180f02c5b9e71bfa20b28c5e7b01824c68a013d
/src/Patterns/Builder/VegBurger.java
de3bd89c2ec043dc14d89cccdc6fee31f36f15f3
[]
no_license
Thom9521/Design_Patterns
e158160b4a378cf32e31f8860befca098b46d826
a84ec5a59bd549d8fba905ce4f518815f0a64bb0
refs/heads/master
2021-04-06T02:11:05.814614
2018-03-15T10:16:59
2018-03-15T10:16:59
124,358,405
0
0
null
null
null
null
UTF-8
Java
false
false
214
java
package Patterns.Builder; public class VegBurger extends Burger { @Override public float price(){ return 25.0f; } @Override public String name(){ return "Veg Burger"; } }
f2ed0641cc79631fd598753a44816963eef0886e
c689ca270872442908d60ff402fc03f661bfdf5d
/app/src/androidTest/java/com/car/vendor/ApplicationTest.java
9e532b043a0d7a2a2d70fc1df481f27647f0ca14
[]
no_license
soumyamads/CarVendorApp
5373d87e4aa9190990519df38c8cf4b9bc93d475
d39b013450cc7a96074cce55881423c5699d519b
refs/heads/master
2021-01-10T03:35:10.363476
2016-02-26T06:41:23
2016-02-26T06:41:23
48,997,232
0
0
null
null
null
null
UTF-8
Java
false
false
345
java
package com.car.vendor; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
c369ad9d9b9249fda95bfac1aa6b504786f278ec
3584c74ee75e1b91fe75c589e0b7ae25b12d9ba4
/src/main/java/com/pyjava/hadoopdemo/mr/wcdemo/WCRunner.java
ad11aa3302cf351b35eb8e256fd9a9e375620631
[]
no_license
whpeak/hadoopdemo
0aed63e4d1327667db0f22903e9fdf525811c712
fecbed652672bdee02776c91698a1f132ca611c0
refs/heads/master
2020-07-11T16:52:29.799864
2018-04-23T03:31:23
2018-04-23T03:31:23
73,999,433
0
0
null
null
null
null
UTF-8
Java
false
false
2,263
java
package com.pyjava.hadoopdemo.mr.wcdemo; import java.io.IOException; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.LongWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat; import org.apache.hadoop.util.Tool; import org.apache.hadoop.util.ToolRunner; import com.pyjava.hadoopdemo.common.hadoop.ConfCommon; import com.pyjava.hadoopdemo.common.hadoop.FSCommon; public class WCRunner extends Configured implements Tool{ /** * 创建job * step1: 设置job的mapper * step2:设置mapper的输出 * * step3:设置job的reduce * step4:设置reduce的输出 * @param conf * @param args * @return * @throws IOException */ private Job createJob(Configuration conf,String[] args) throws IOException { Job job =Job.getInstance(conf); conf=ConfCommon.updateConf(conf); FileSystem fs = FSCommon.getFS(conf); String hdfs_url=fs.getUri().toString(); String input_path=hdfs_url+"/Users/wangheng/Documents/fileIO/input1"; System.out.println(input_path); String output_path=hdfs_url+"/Users/wangheng/Documents/fileIO/output1"; System.out.println(output_path); // job.setJarByClass(WCRunner.class); job.setMapperClass(WCMapper.class); job.setMapOutputKeyClass(Text.class); job.setMapOutputValueClass(LongWritable.class); job.setReducerClass(WCReducer.class); job.setOutputKeyClass(Text.class); job.setOutputValueClass(Text.class); FileInputFormat.setInputPaths(job, new Path(input_path)); Path output=new Path(output_path); if(fs.exists(output)) { fs.delete(output, true); } FileOutputFormat.setOutputPath(job, output); return job; } public int run(String[] args) throws Exception { Configuration conf =getConf(); Job job =this.createJob(conf, args); return job.waitForCompletion(true)?0:1; } public static void main(String[] args) throws Exception { WCRunner wcRunner =new WCRunner(); ToolRunner.run( wcRunner,args); } }
64cca855011fdbcca2bb5a4b2ae9b4c0739070cf
1c18616fb66d5d0316beb2df68676029b405c3dd
/src/main/java/students/eriks_jaloveckis/lesson_8/level_4/task_19/Triangle.java
ba4817014b82bfd3eb54fe699548ace32cb41244
[]
no_license
Vija-M/jg-java-1-online-spring-april-tuesday-2021
edb4c73cc4a13bdaa132bccca6a1c6d0088b2d5d
49817deb3052f24332442d2454932714915b50ad
refs/heads/main
2023-07-14T03:16:12.145252
2021-08-24T16:20:50
2021-08-24T16:20:50
399,513,003
2
0
null
2021-08-24T15:17:35
2021-08-24T15:17:34
null
UTF-8
Java
false
false
452
java
package students.eriks_jaloveckis.lesson_8.level_4.task_19; class Triangle extends Shape { private double x; Triangle(double x) { super("Triangle"); this.x = x; } @Override double calculateArea() { return (x * calculateHeight()) / 2; } @Override double calculatePerimeter() { return 3 * x; } private double calculateHeight() { return (x * Math.sqrt(3)) / 2; } }
5d1efc8d73ccb1558cddcfa01f5b9bec5f30309d
dfc0ffcccaec220d60be1ed89a3927c4bcc6a08f
/src/main/java/com/jing/_15/Node.java
69c679c08f7c6239390aef8a2c644866c2f8b47f
[]
no_license
dogeByte/sword-to-offer
446149cf5047bd80f8bb5db20b334e2351408e45
7445afa57cdc7b03622aa43f86dcf189b3df70b6
refs/heads/master
2021-06-16T23:53:56.688480
2017-05-22T00:53:46
2017-05-22T00:53:46
86,459,729
1
0
null
null
null
null
UTF-8
Java
false
false
555
java
package com.jing._15; /** * 单向链表的节点 * * @version 1.0.0 * @author JingBo * @see LastKthNode */ public class Node<T> { private T value; private Node<T> next; public Node(T value, Node<T> next) { this.value = value; this.next = next; } public T getValue() { return value; } public void setValue(T value) { this.value = value; } public Node<T> getNext() { return next; } public void setNext(Node<T> next) { this.next = next; } }
907d54d8ec41d49592a0f924bae9b6b9efffddcf
35e8a12f96c6f46aa77907c3a3ee2af30c8c8d3f
/hub.sam.sdl.model/src/hub/sam/sdl/SdlPidExpressionEvaluation.java
a7fb26032575a710d8cd9cd705bb011190227502
[]
no_license
markus1978/tef
36049dee71a99d24401d4a01fe33a3018e7bb776
38bfc24dc64822b7b3ed74e41f85b3a8c10c1955
refs/heads/master
2020-04-06T04:30:58.699975
2015-08-13T07:51:37
2015-08-13T07:51:37
25,520,279
1
2
null
2015-08-13T07:51:37
2014-10-21T12:13:17
Java
UTF-8
Java
false
false
439
java
/** * <copyright> * </copyright> * * $Id$ */ package hub.sam.sdl; /** * <!-- begin-user-doc --> * A representation of the model object '<em><b>Sdl Pid Expression Evaluation</b></em>'. * <!-- end-user-doc --> * * * @see hub.sam.sdl.EmfSdlPackage#getSdlPidExpressionEvaluation() * @model * @generated */ public interface SdlPidExpressionEvaluation extends SdlEvaluation { } // SdlPidExpressionEvaluation
0f526a77ad1add49e5d645d8484251b8bdeee7db
693a11ceaea66da0728c62e01222fe2c73fc951c
/src/main/java/view/BannerPrinter.java
897d6df83c30dee47c83269a16e243c671bd03a7
[]
no_license
jing928/SupermarketSupportSystem
39efe3e989ba268584d1070ad428b8d8660ca2f2
5eaff5ad70716285aa8fc0eda41ad4605097e443
refs/heads/master
2020-03-25T22:52:15.021767
2018-10-16T02:20:07
2018-10-16T02:20:07
144,247,033
1
0
null
null
null
null
UTF-8
Java
false
false
406
java
package view; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class BannerPrinter { public static void print() throws IOException { BufferedReader in = new BufferedReader(new FileReader("src/main/resources/banner.txt")); String line = in.readLine(); while (line != null) { System.out.println(line); line = in.readLine(); } in.close(); } }
446678d0af24f38f58fdfa86ed22927fe101236c
3eef7f7daab995ec5ae6c159220b24533cd7de7b
/12/src/main/java/myTag/MyTable.java
ffd9389f599ce1a072a5bfc05ce3880a55b8adcd
[]
no_license
endlesslydivided/MToPoI_2_2
a1a9e98efa1c44411ec605633324d427a5b95f16
d440f749e0e0650d9f833d7b4215e75b0f819d04
refs/heads/main
2023-05-05T15:45:24.256695
2021-05-25T10:24:05
2021-05-25T10:24:05
349,753,692
1
1
null
null
null
null
UTF-8
Java
false
false
1,055
java
package myTag; import javax.servlet.jsp.JspWriter; import javax.servlet.jsp.tagext.TagSupport; import java.io.IOException; import java.util.Enumeration; public class MyTable extends TagSupport { public int doStartTag() { JspWriter jspWriter = pageContext.getOut(); try { jspWriter.print("<table border=\"1\" >" + "<tr>" + "<th>Параметр</th><th>Значение</th>" + "</tr>"); Enumeration params = pageContext.getRequest().getParameterNames(); while(params.hasMoreElements()) { String paramName = (String)params.nextElement(); jspWriter.print("<tr><td>" + paramName + "</td>"); String paramValue = pageContext.getRequest().getParameter(paramName); jspWriter.println("<td> " + paramValue + "</td></tr>"); } } catch (IOException e) { System.out.println("Мой ввод: " + e); } return EVAL_BODY_INCLUDE; } }
688cd0484fd692455a58fd858376e39e339c6fe2
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/11/11_10916be6880c38b14014b6a886ec613a0100b944/MenuRender/11_10916be6880c38b14014b6a886ec613a0100b944_MenuRender_t.java
898130c63a14370f0eaf113f5d24de607f753a3e
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
5,599
java
//This class renders the main menu for the client. It also operates the UI for the main menu import java.awt.*; import java.awt.event.*; public class MenuRender implements MouseMotionListener, MouseListener, MouseWheelListener, KeyListener { ScreenManager sm; private final int HOVER_START = 1; private final int HOVER_EXIT = 2; private final int HOVER_JOINMENU = 3; private final int HOVER_JOINBACK = 4; private final int HOVER_JOINCONNECT = 5; private final int MENU_MAIN = 0; private final int MENU_JOIN = 1; int buttonHovered; int screenWidth; int screenHeight; boolean running; int returnValue; Point mouse; Font font1; Font font2; public static String IP; int displayedMenu; private void init(){ mouse = new Point(); Window w = sm.getFullScreenWindow(); w.setBackground(Color.BLACK); w.setForeground(Color.WHITE); screenHeight = w.getHeight(); screenWidth = w.getWidth(); int fontSize = (int)Math.round(/*Font Size:*/12.0/**/*screenWidth*.001); font1 = new Font("Arial", Font.BOLD, fontSize); fontSize = (int)Math.round(/*Font Size:*/18.0/**/*screenWidth*.001); font2 = new Font("Arial", Font.BOLD, fontSize); w.addMouseMotionListener(this); w.addMouseListener(this); w.addMouseWheelListener(this); w.addKeyListener(this); IP = new String(); running = true; } public int menu(ScreenManager screenmanager){ sm = screenmanager; init(); while(running){ Graphics2D g = sm.getGraphics(); g.clearRect(0, 0, screenWidth, screenHeight); g.setColor(Color.WHITE); buttonHovered = 0; if(displayedMenu == MENU_JOIN){//the "join game menu" g.setFont(font2); g.drawString("JOIN GAME", (int) (screenWidth - screenHeight*.5), (int) (screenHeight*.17)); //ip address entry field g.setFont(font1); g.drawString("Enter the IP Address:", (int) (screenHeight*.1), (int) (screenHeight*.20)); g.drawRect((int) (screenHeight*.1), (int) (screenHeight*.22), (int) (screenHeight*.2), (int) (screenHeight*.04)); g.drawString(IP + "_", (int) (screenHeight*.11), (int) (screenHeight*.24)); if(mouse.x > screenHeight*.1 && mouse.x < screenHeight*.15 && mouse.y > screenHeight*.28 && mouse.y < screenHeight*.30){ g.setColor(Color.YELLOW); buttonHovered = HOVER_JOINCONNECT; } else { g.setColor(Color.WHITE); } g.drawString("Connect", (int) (screenHeight*.1), (int) (screenHeight*.30)); //back button if(mouse.x > screenHeight*.1 && mouse.x < screenHeight*.15 && mouse.y > screenHeight*.34 && mouse.y < screenHeight*.36){ g.setColor(Color.YELLOW); buttonHovered = HOVER_JOINBACK; } else { g.setColor(Color.WHITE); } g.drawString("Back", (int) (screenHeight*.1), (int) (screenHeight*.36)); } else if(displayedMenu == MENU_MAIN){//the main game menu g.setFont(font1); if(mouse.x > screenHeight*.1 && mouse.x < screenHeight*.21 && mouse.y > screenHeight*.18 && mouse.y < screenHeight*.20){ g.setColor(Color.YELLOW); buttonHovered = HOVER_START; } g.drawString("Start Game", (int) (screenHeight*.1), (int) (screenHeight*.20)); if(mouse.x > screenHeight*.1 && mouse.x < screenHeight*.15 && mouse.y > screenHeight*.26 && mouse.y < screenHeight*.28){ g.setColor(Color.YELLOW); buttonHovered = HOVER_EXIT; }else{ g.setColor(Color.WHITE); } g.drawString("Exit", (int) (screenHeight*.1), (int) (screenHeight*.28)); if(mouse.x > screenHeight*.1 && mouse.x < screenHeight*.21 && mouse.y > screenHeight*.22 && mouse.y < screenHeight*.24){ g.setColor(Color.YELLOW); buttonHovered = HOVER_JOINMENU; }else{ g.setColor(Color.WHITE); } g.drawString("Join Game", (int) (screenHeight*.1), (int)(screenHeight*.24)); g.setColor(Color.WHITE); g.drawString("Pre-Alpha", (int) (screenWidth - screenHeight*.4), (int) (screenHeight*.20)); g.setFont(font2); g.drawString("BROOMBALL SIMULATOR", (int) (screenWidth - screenHeight*.5), (int) (screenHeight*.17)); } g.dispose(); //update the screen sm.update(); try { Thread.sleep(10); } catch (InterruptedException e) { e.printStackTrace(); } } return returnValue; } public void keyPressed(KeyEvent e) { if(displayedMenu == MENU_JOIN){//Ip entering code if(e.getKeyCode() == KeyEvent.VK_BACK_SPACE){ if(IP.length() > 0){ IP = IP.substring(0, IP.length() - 1); } } else { IP += Character.toString(e.getKeyChar()); } } } public void keyReleased(KeyEvent e) {} public void keyTyped(KeyEvent e) {} public void mouseWheelMoved(MouseWheelEvent e) {} public void mouseClicked(MouseEvent arg0) {} public void mouseEntered(MouseEvent arg0) {} public void mouseExited(MouseEvent arg0) {} public void mousePressed(MouseEvent arg0) { returnValue = buttonHovered; if(returnValue != 0){ if(returnValue == HOVER_JOINMENU){ displayedMenu = MENU_JOIN; IP = ""; } else if(returnValue == HOVER_JOINBACK){ displayedMenu = MENU_MAIN; }else if(returnValue == HOVER_JOINCONNECT){ running = false; }else{ running = false; } } } public void mouseReleased(MouseEvent arg0) {} public void mouseDragged(MouseEvent e) { mouseMoved(e); } public void mouseMoved(MouseEvent e) { mouse.x = e.getX(); mouse.y = e.getY(); } }
54e0d6ccf57a4e4dc9cb46798f624492ea5ffcf3
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/5/5_638addd39ea488f84e1006c676e4182162263907/MenuBar/5_638addd39ea488f84e1006c676e4182162263907_MenuBar_s.java
abd2567b579c0589afadce7b5e8780b8394441d7
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
6,000
java
/*************************************************************************** * Copyright 2006-2007 by Christian Ihle * * [email protected] * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ package net.usikkert.kouchat.ui.swing; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.SwingUtilities; import net.usikkert.kouchat.Constants; public class MenuBar extends JMenuBar implements ActionListener { private static final long serialVersionUID = 1L; private JMenu fileMenu, toolsMenu, helpMenu; private JMenuItem minimizeMI, quitMI, clearMI, awayMI, topicMI, settingsMI, aboutMI, commandsMI; private Mediator mediator; public MenuBar() { fileMenu = new JMenu( "File" ); fileMenu.setMnemonic( 'F' ); minimizeMI = new JMenuItem( "Minimize" ); minimizeMI.setMnemonic( 'M' ); minimizeMI.addActionListener( this ); quitMI = new JMenuItem( "Quit" ); quitMI.setMnemonic( 'Q' ); quitMI.addActionListener( this ); fileMenu.add( minimizeMI ); fileMenu.addSeparator(); fileMenu.add( quitMI ); toolsMenu = new JMenu( "Tools" ); toolsMenu.setMnemonic( 'T' ); clearMI = new JMenuItem( "Clear chat" ); clearMI.setMnemonic( 'C' ); clearMI.addActionListener( this ); awayMI = new JMenuItem( "Set away" ); awayMI.setMnemonic( 'S' ); awayMI.addActionListener( this ); topicMI = new JMenuItem( "Change topic" ); topicMI.setMnemonic( 'E' ); topicMI.addActionListener( this ); settingsMI = new JMenuItem( "Settings" ); settingsMI.setMnemonic( 'S' ); settingsMI.addActionListener( this ); toolsMenu.add( clearMI ); toolsMenu.add( awayMI ); toolsMenu.add( topicMI ); toolsMenu.addSeparator(); toolsMenu.add( settingsMI ); helpMenu = new JMenu( "Help" ); helpMenu.setMnemonic( 'H' ); commandsMI = new JMenuItem( "Commands" ); commandsMI.setMnemonic( 'O' ); commandsMI.addActionListener( this ); aboutMI = new JMenuItem( "About" ); aboutMI.setMnemonic( 'A' ); aboutMI.addActionListener( this ); helpMenu.add( commandsMI ); helpMenu.addSeparator(); helpMenu.add( aboutMI ); add( fileMenu ); add( toolsMenu ); add( helpMenu ); } public void setMediator( Mediator mediator ) { this.mediator = mediator; } public void setAwayState( boolean away ) { settingsMI.setEnabled( !away ); topicMI.setEnabled( !away ); } public void disableMinimize() { minimizeMI.setEnabled( false ); } @Override public void actionPerformed( ActionEvent e ) { if ( e.getSource() == quitMI ) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { mediator.quit(); } } ); } else if ( e.getSource() == settingsMI ) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { mediator.showSettings(); } } ); } else if ( e.getSource() == minimizeMI ) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { mediator.minimize(); } } ); } else if ( e.getSource() == awayMI ) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { mediator.setAway(); } } ); } else if ( e.getSource() == topicMI ) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { mediator.setTopic(); } } ); } else if ( e.getSource() == clearMI ) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { mediator.clearChat(); } } ); } else if ( e.getSource() == commandsMI ) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { mediator.showCommands(); } } ); } else if ( e.getSource() == aboutMI ) { SwingUtilities.invokeLater( new Runnable() { @Override public void run() { MessageDialog aboutD = new MessageDialog( null, true ); aboutD.setTitle( Constants.APP_NAME + " - About" ); aboutD.setTopText( Constants.APP_NAME + " v" + Constants.APP_VERSION ); aboutD.setContent( "Copyright 2006-2007 by " + Constants.AUTHOR_NAME + "\n" + Constants.AUTHOR_MAIL + "\n" + Constants.AUTHOR_WEB + "\n\nSource available under the " + Constants.APP_LICENSE + ".\nSee " + Constants.APP_LICENSE_FILE + " for details." ); aboutD.setVisible( true ); } } ); } } }
198c2d3912410e91154527d9f2b1afad32d83c6f
0ceacf5a44d8a14dd75a0ded466fea9b3c4ebe00
/src/main/java/org/openapitools/client/model/Config.java
4f42ea79aa382f4d111149c37efc253337a2003a
[]
no_license
ozkatz/java-lakefs
b6cf2fdd58dade314a14d265d847ad501956ee13
17b9af09d7dfccbfccbf550f3aef26af4333df96
refs/heads/main
2023-01-24T12:41:59.058750
2020-12-09T12:38:55
2020-12-09T12:38:55
319,952,093
0
0
null
null
null
null
UTF-8
Java
false
false
2,371
java
/* * lakeFS API * lakeFS HTTP API * * The version of the OpenAPI document: 0.1.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ package org.openapitools.client.model; import java.util.Objects; import java.util.Arrays; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; import com.google.gson.annotations.SerializedName; import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonWriter; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import java.io.IOException; /** * Config */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", date = "2020-12-09T13:58:34.593755+02:00[Asia/Jerusalem]") public class Config { public static final String SERIALIZED_NAME_BLOCKSTORE_TYPE = "blockstore.type"; @SerializedName(SERIALIZED_NAME_BLOCKSTORE_TYPE) private String blockstoreType; public Config blockstoreType(String blockstoreType) { this.blockstoreType = blockstoreType; return this; } /** * Get blockstoreType * @return blockstoreType **/ @javax.annotation.Nullable @ApiModelProperty(value = "") public String getBlockstoreType() { return blockstoreType; } public void setBlockstoreType(String blockstoreType) { this.blockstoreType = blockstoreType; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Config config = (Config) o; return Objects.equals(this.blockstoreType, config.blockstoreType); } @Override public int hashCode() { return Objects.hash(blockstoreType); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Config {\n"); sb.append(" blockstoreType: ").append(toIndentedString(blockstoreType)).append("\n"); sb.append("}"); return sb.toString(); } /** * Convert the given object to string with each line indented by 4 spaces * (except the first line). */ private String toIndentedString(Object o) { if (o == null) { return "null"; } return o.toString().replace("\n", "\n "); } }
be6dcad53d9ab32906354c2316ec554dce4f0202
ffced0ab7dced58a5713ef2478d17213b785a845
/DWZSpringMVC/src/com/joe/exception/ExistedException.java
1520a1dbb3e52aa6f1a5a9e8cafe8799e1114fb1
[]
no_license
chocoai/12_JEE_DWZSpringMVC_JeeSite
c7d77becffe536d066042fb83f420e1a0684a021
f9fd8369d2c4605ad5843c460a220535fa3f75de
refs/heads/master
2020-05-17T08:15:58.672851
2014-01-21T09:41:42
2014-01-21T09:41:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
449
java
package com.joe.exception; /** * */ public class ExistedException extends ServiceException { /** 描述 */ private static final long serialVersionUID = -598071452360556064L; public ExistedException() { super(); } public ExistedException(String message) { super(message); } public ExistedException(Throwable cause) { super(cause); } public ExistedException(String message, Throwable cause) { super(message, cause); } }
819fc3dd9d6277410a66eeb9dffc7a282f9ab321
4f518904416478f7f9914ed99324a474ad9ba62d
/src/fr/nations/amen/shared/messagesaudio/AsyncYears.java
845c15ea4cf4cdf555c96adca98ce4f46d6b184d
[]
no_license
sebastienlebecq/amensite
eafebd5ae52dfd37c96da6ffc3ff364cc8bf78d3
b1db5cc2895f579245a9d69da6d42210c201bb8a
refs/heads/master
2021-01-19T03:20:08.560898
2016-06-11T10:34:57
2016-06-11T10:34:57
54,899,298
0
0
null
null
null
null
UTF-8
Java
false
false
506
java
package fr.nations.amen.shared.messagesaudio; import com.google.gwt.user.client.rpc.IsSerializable; public class AsyncYears implements Comparable<AsyncYears>, IsSerializable { int year; public int getYear(){ return this.year; } public int getPhotosNumber(){ int num = 0; return num; } public AsyncYears(){} public AsyncYears(int year){ this.year = year; } public int compareTo(AsyncYears otherYear) { return (year-otherYear.getYear()); } }
156a4e911a17c75346b4f09f988082ccb6f4c46c
6f5cf274a6bf87074b4bbfdba975c8d53563f4a9
/Evacart/src/gui/HelpInfo.java
e3deef60177e3e4400949ae8e094746bad3e85d3
[]
no_license
sjafer/EVACART_V1.0
30ada0348a70d74b68b83b7f8fb0bdbf0beabbf6
a6071663481563510cb8a8e1d84287a05e7299b5
refs/heads/master
2021-01-10T03:19:11.711637
2015-11-13T16:06:16
2015-11-13T16:06:16
46,139,277
0
0
null
null
null
null
UTF-8
Java
false
false
8,868
java
package gui; import java.awt.BorderLayout; import java.awt.Checkbox; import java.awt.Container; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; import java.net.URL; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; //import cdmodeler.CDModelerPlugin; /* * The class HelpInfo creates a frame containing message and links * to the CD++ Modeler manual in "*.doc" or "*.htm" formats. * The frame is instantiated when the User clicks "Help" button * in the toolbar of CD++ Modeler. The actual line of code that * activates the constructor is in the MainFrame.java: * private void showHelp() { * new HelpInfo(); <--THIS IS THE LINE * HelpLoader.showHelp(); * } * @author Chiril Chidisiuc * * @version 2006-07-31 */ public class HelpInfo extends JFrame implements ActionListener{ /** * */ private static final long serialVersionUID = 1L; private Checkbox optionDoc; private Checkbox optionHtm; private JButton buttonCancel; private JButton buttonOK; private JLabel messageLabel; private String classPathString; private String helpMessage; private String pluginPathString; private String buttonOkText; private String buttonCancelText; /** * This constructor creates the look of the frame * and instantiates all the components * * @param none * @return none * @author Chiril Chidisiuc * @version 2006-07-31 */ public HelpInfo() { HelpInfo.setDefaultLookAndFeelDecorated(true); //set native look this.setLocationRelativeTo(null); //center of the screen this.setIconImage(this.getIcon("Help/GUI_HTML/images/helpMini.GIF").getImage());//frame icon Container cp = this.getContentPane(); cp.setLayout(new BorderLayout()); cp.add(this.createMessagePanel(), "North"); cp.add(this.createOptionPanel(), "Center"); cp.add(this.createButtonPanel(), "South"); this.setTitle("CD++Modeler Help information"); this.setContentPane(cp); this.setResizable(false);//locked size this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);//close without terminating the whole process tree this.pack(); this.setVisible(true); this.classPathString = this.getClass().getResource("HelpInfo.class").toString(); //path to this class // jar:file:/C:/eclipse/plugins/CD++Builder_1.1.0/cdmodelerFull/CDModeler.jar!/gui/HelpInfo.class int pluginIndexStart = this.classPathString.indexOf("jar:file:/")+10; //in theory this should be (0 + 10) //index of "jar:file:/" should be 0 int pluginIndexEnd = this.classPathString.lastIndexOf("/"+ "CDModelerPlugin.PLUGIN_ID"+"/")+19; this.pluginPathString = this.classPathString.substring(pluginIndexStart,pluginIndexEnd); //plugin location // e.g. C:/eclipse/plugins/CD++Builder_1.1.0/ //Stream to write file // try { // BufferedWriter out = new BufferedWriter(new FileWriter("C:/HelpInfo.class_test.txt")); // out.write( (new Date()) + "\ttest1: " + this.pluginPathString); // out.close(); // } catch (IOException e) { // e.printStackTrace(); // } } /** * This method converts the given path to command line format by replacing * the path delimiters with Windows path delimiters. (each '/' is replaced * with '\') * * @param path:String - * the given current path (e.g. "C:/eclipse/workspace") * @return converted path as a String - path with new delimiters (e.g. * "C:\eclipse\workspace") * @author Chiril Chidisiuc * * @version 2006-06-20 */ protected String convertPathToCmd(String path){ char c1 = 47; // character 47 is: '/' char c2 = 92; // character 92 is: '\' return path.replace(c1,c2); //replace(char oldChar, char newChar) } /** * Creates image from a provided path and return it as parameter * * @param imageName * @return ImageIcon object * @author Chidisiuc Chiril * @version 2006-07-31 */ private ImageIcon getIcon(String imageName) { URL imageURL = null; imageURL = getClass().getResource(imageName); // System.out.println("getClass():"+this.getClass()+"\n"+this.getClass().getResource("")); return new ImageIcon(imageURL); } /** * Panel containing label with message is created and returned for further * use. * * @param none * @return JPanel object * @author Chiril Chidisiuc * @version 2006-07-31 */ private JPanel createMessagePanel(){ JPanel messagePanel = new JPanel(); this.helpMessage = "<html>" + " CD++ Modeler manual contains the detailed <BR> " + "instructions on usage of the tool " + "</html>"; this.messageLabel = new JLabel(); this.messageLabel.setFont(new Font("Courier New", Font.PLAIN, 12)); this.messageLabel.setText(this.helpMessage); messagePanel.add(this.messageLabel); return messagePanel; } /** * Panel containing checkboxes is created and returned for further use. * * @param none * @return JPanel object * @author Chiril Chidisiuc * @version 2006-07-31 */ private JPanel createOptionPanel(){ JPanel optionPanel = new JPanel(); // optionPanel.setBackground(new Color(0,0,0,0)); //transparent this.optionDoc = new Checkbox("\"*.doc\"", true); this.optionHtm = new Checkbox("\"*.htm\"", false); optionPanel.setLayout(new BorderLayout()); optionPanel.add(optionDoc, "West"); optionPanel.add(optionHtm , "Center"); return optionPanel; } /** * Panel containing buttons "Open Manual" and "Cancel" is created and * returned for further use. * * @param none * @return JPanel object * @author Chiril Chidisiuc * @version 2006-07-31 */ private JPanel createButtonPanel(){ JPanel buttonPanel = new JPanel(); // buttonPanel.setBackground(new Color(0,0,0,0)); //transparent this.buttonOkText = "Open Manual..."; this.buttonOK = new JButton(this.buttonOkText); this.buttonOK.setToolTipText("View the manual"); this.buttonOK.addActionListener(this); this.buttonOK.setIcon(this.getIcon("Help/GUI_HTML/images/Open16.gif")); this.buttonCancelText = "Cancel"; this.buttonCancel = new JButton(this.buttonCancelText); this.buttonCancel.setToolTipText("Close message"); this.buttonCancel.addActionListener(this); this.buttonCancel.setIcon(getIcon("Help/GUI_HTML/images/Cancel.gif")); buttonPanel.setLayout(new BorderLayout()); buttonPanel.add(this.buttonOK, "West"); buttonPanel.add(this.buttonCancel, "East"); return buttonPanel; } /** * This method creates the and carries out the process of opening manual in * native system application assigned to open the "*.doc" types of files * * @param none * @return none * @throws IOException * @author Chiril Chidisiuc * @version 2006-07-31 */ private void openManualDoc() throws IOException{ // Runtime.getRuntime().exec("cmd /c start "+"C:\\eclipse\\plugins\\CD++Builder_1.1.0\\cdmodelerfull\\Help\\CDModeller_from_main_manual.doc"); Runtime.getRuntime().exec("cmd /c start " +this.convertPathToCmd(this.pluginPathString).trim() +"cdmodelerfull\\Help\\CDModeller_from_main_manual.doc"); } /** * This method creates the and carries out the process of opening manual in * native system application assigned to open the "*.htm" types of files * * @param none * @return none * @throws IOException * @author Chiril Chidisiuc * @version 2006-07-31 */ private void openManualHtm() throws IOException{ // Runtime.getRuntime().exec("cmd /c start C:\\eclipse\\plugins\\CD++Builder_1.1.0\\cdmodelerfull\\Help\\CDModeller_from_main_manual.htm"); Runtime.getRuntime().exec("cmd /c start " +this.convertPathToCmd(this.pluginPathString).trim() +"cdmodelerfull\\Help\\CDModeller_from_main_manual.htm"); } /** * This method opens the selected version(s) of the manual. * If none are selected, no action is taken. * * @param none * @return none * @author Chiril Chidisiuc * @version 2006-07-31 */ private void openManual(){ try { if (!((this.optionDoc.getState() == false)&&(this.optionHtm.getState() == false))){ if (this.optionDoc.getState() == true) { openManualDoc(); } if (this.optionHtm.getState() == true) { openManualHtm(); } this.dispose(); } } catch (IOException e) { e.printStackTrace(); } } /** * Implementation of the inherited method from ActionListener. * Opens manual if "Open Manual" button was selected by calling openManual() method and * Closes the frame otherwise. * Implemented by Chiril Chidisiuc * * * @param ev:ActionEvent * @return none * @version 2006-07-31 */ public void actionPerformed(ActionEvent ev) { if (((JButton) ev.getSource()).getText().trim().equals(this.buttonOkText)){ this.openManual(); } else { this.dispose(); } } }
75946ce88a71608f3667d6e1477d7f33f8c5a584
f63f3952bb6608ac5fa39c937ef190d5b3cc1fa8
/src/test/java/org/rygn/nosql/mapreduce/first/MRLocalClusterIntegrationTest.java
068d49a502b052ca35d3d383236aae342487b653
[]
no_license
rgirodon/fisa_de2_mapreduce_wordcount
fa3554c592470cb8a5db88d087feb5ea45c3bf77
e15fa05bb8acf8f116240903e9a0f339f2e9a57d
refs/heads/master
2021-08-06T02:08:34.671299
2019-12-04T15:00:12
2019-12-04T15:00:12
225,893,482
0
0
null
2020-10-13T17:58:11
2019-12-04T15:03:30
Java
UTF-8
Java
false
false
6,090
java
package org.rygn.nosql.mapreduce.first; import static org.junit.Assert.assertEquals; import java.io.IOException; import java.io.InputStream; import java.util.Scanner; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.github.sakserv.minicluster.config.ConfigVars; import com.github.sakserv.minicluster.impl.HdfsLocalCluster; import com.github.sakserv.minicluster.impl.MRLocalCluster; import com.github.sakserv.propertyparser.PropertyParser; public class MRLocalClusterIntegrationTest { // Logger private static final Logger LOG = LoggerFactory.getLogger(MRLocalClusterIntegrationTest.class); // Setup the property parser private static PropertyParser propertyParser; static { try { propertyParser = new PropertyParser(ConfigVars.DEFAULT_PROPS_FILE); propertyParser.parsePropsFile(); } catch(IOException e) { LOG.error("Unable to load property file: {}", propertyParser.getProperty(ConfigVars.DEFAULT_PROPS_FILE)); } } private static HdfsLocalCluster dfsCluster; private static MRLocalCluster mrLocalCluster; private static String testFile = propertyParser.getProperty(ConfigVars.MR_TEST_DATA_FILENAME_KEY); private static String testDataHdfsInputDir = propertyParser.getProperty(ConfigVars.MR_TEST_DATA_HDFS_INPUT_DIR_KEY); private static String testDataHdfsOutputDir = propertyParser.getProperty(ConfigVars.MR_TEST_DATA_HDFS_OUTPUT_DIR_KEY); private static String mrOutputText = "1"; @BeforeClass public static void setUp() throws Exception { dfsCluster = new HdfsLocalCluster.Builder() .setHdfsNamenodePort(Integer.parseInt(propertyParser.getProperty(ConfigVars.HDFS_NAMENODE_PORT_KEY))) .setHdfsTempDir(propertyParser.getProperty(ConfigVars.HDFS_TEMP_DIR_KEY)) .setHdfsNumDatanodes(Integer.parseInt(propertyParser.getProperty(ConfigVars.HDFS_NUM_DATANODES_KEY))) .setHdfsEnablePermissions( Boolean.parseBoolean(propertyParser.getProperty(ConfigVars.HDFS_ENABLE_PERMISSIONS_KEY))) .setHdfsFormat(Boolean.parseBoolean(propertyParser.getProperty(ConfigVars.HDFS_FORMAT_KEY))) .setHdfsConfig(new Configuration()) .build(); dfsCluster.start(); mrLocalCluster = new MRLocalCluster.Builder() .setNumNodeManagers(Integer.parseInt(propertyParser.getProperty(ConfigVars.YARN_NUM_NODE_MANAGERS_KEY))) .setJobHistoryAddress(propertyParser.getProperty(ConfigVars.MR_JOB_HISTORY_ADDRESS_KEY)) .setResourceManagerAddress(propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_ADDRESS_KEY)) .setResourceManagerHostname(propertyParser.getProperty(ConfigVars.YARN_RESOURCE_MANAGER_HOSTNAME_KEY)) .setResourceManagerSchedulerAddress(propertyParser.getProperty( ConfigVars.YARN_RESOURCE_MANAGER_SCHEDULER_ADDRESS_KEY)) .setResourceManagerResourceTrackerAddress(propertyParser.getProperty( ConfigVars.YARN_RESOURCE_MANAGER_RESOURCE_TRACKER_ADDRESS_KEY)) .setResourceManagerWebappAddress(propertyParser.getProperty( ConfigVars.YARN_RESOURCE_MANAGER_WEBAPP_ADDRESS_KEY)) .setUseInJvmContainerExecutor(Boolean.parseBoolean(propertyParser.getProperty( ConfigVars.YARN_USE_IN_JVM_CONTAINER_EXECUTOR_KEY))) .setHdfsDefaultFs(dfsCluster.getHdfsConfig().get("fs.defaultFS")) .setConfig(new Configuration()) .build(); mrLocalCluster.start(); } @AfterClass public static void tearDown() throws Exception { mrLocalCluster.stop(); dfsCluster.stop(); } @Test public void testMRLocalCluster() throws Exception { String inputFileContents = resourceFileToString(testFile); writeFileToHdfs(testDataHdfsInputDir + "/" + testFile, inputFileContents); Driver driver = new Driver(); driver.setConfiguration(mrLocalCluster.getConfig()); String[] args = new String[2]; args[0] = testDataHdfsInputDir; args[1] = testDataHdfsOutputDir; Driver.main(args); assertEquals(mrOutputText, getCountForWord(testDataHdfsOutputDir + "/part-r-00000", "This")); } private void writeFileToHdfs(String fileName, String contents) throws Exception { // Write a file to HDFS containing the test string FileSystem hdfsFsHandle = dfsCluster.getHdfsFileSystemHandle(); FSDataOutputStream writer = hdfsFsHandle.create(new Path(fileName)); writer.writeUTF(contents); writer.close(); hdfsFsHandle.close(); } private String getCountForWord(String fileName, String word) throws Exception { String output = readFileFromHdfs(fileName); for(String line: output.split("\n")) { if(line.contains(word)) { return line.split("\t")[1]; } } return ""; } private String readFileFromHdfs(String filename) throws Exception { FileSystem hdfsFsHandle = dfsCluster.getHdfsFileSystemHandle(); FSDataInputStream reader = hdfsFsHandle.open(new Path(filename)); String output = reader.readUTF(); reader.close(); hdfsFsHandle.close(); return output; } private String resourceFileToString(String fileName) { InputStream inputStream = getClass().getClassLoader().getResourceAsStream(fileName); Scanner scanner = new Scanner(inputStream).useDelimiter("\\A"); return scanner.hasNext() ? scanner.next() : ""; } }
82546856346d884572aa4f28dd5f29d0ad49805f
4dea6aae9b107b7fd812d3b4422741f1c0744ad2
/ficha1Noda/src/ficha1nodo/NodoDepto.java
d09736e596237a0dfee8304194329c545ab9e947
[]
no_license
jpstorm21/Proyectos-java-cplusplus
7b92747bc03595e5fd2ae0d7c92ccd774488e8ee
dd8ff3e2ba0628791c94725df034f1f8409b4ead
refs/heads/master
2020-12-13T11:36:01.129236
2020-01-16T20:05:40
2020-01-16T20:05:40
234,401,774
1
0
null
null
null
null
UTF-8
Java
false
false
572
java
package ficha1nodo; public class NodoDepto { private Departamento departamento; private NodoDepto nextDepto; public NodoDepto(Departamento D) { this.departamento = D; nextDepto = null; } public Departamento getDepartamento() { return departamento; } public void setDepartamento(Departamento departamento) { this.departamento = departamento; } public NodoDepto getNextDepto() { return nextDepto; } public void setNextDepto(NodoDepto n) { this.nextDepto = n; } }
e7d49286e11088ff0d8228bc30e0ceeceba5e8cc
933bc089b4a0af12cc2b6f651a3db5bb5d0075ff
/src/main/java/com/cursomodelagem/repositories/PedidoRepository.java
467bf68d657df52cef5aa5a89050d6adb97c5729
[]
no_license
emival91/spring-boot-ionic-backend
f8c2d3ec324d5917e68c4a7465d4d8d3e071da2c
6f549c8856eaf6ad849acf9d37bdf1a3e84d2c0b
refs/heads/master
2023-07-09T02:37:16.134556
2021-08-03T00:33:59
2021-08-03T00:33:59
392,356,000
0
0
null
null
null
null
UTF-8
Java
false
false
225
java
package com.cursomodelagem.repositories; import org.springframework.data.jpa.repository.JpaRepository; import com.cursomodelagem.domain.Pedido; public interface PedidoRepository extends JpaRepository<Pedido, Integer> { }
40c8a98b81660dafdd921db6336ed360399603e0
67e2449c3ead17a22b53f1a5073452241584586a
/src/test/java/edu/emory/mathcs/nlp/benchmark/Benchmark.java
7700fd04e3c9b0249b78b879a43cb80e0effa006
[ "Apache-2.0" ]
permissive
Lucas-Xiao/cs571
1762e76287893d00958233f5360d3e76c964d38f
7988fd712760d03409dd2e710d75712b10608563
refs/heads/master
2021-01-15T14:50:14.433629
2015-09-28T18:24:41
2015-09-28T18:24:41
41,688,633
0
0
null
2015-08-31T16:58:40
2015-08-31T16:58:40
null
UTF-8
Java
false
false
1,018
java
/** * Copyright 2015, Emory University * * 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 edu.emory.mathcs.nlp.benchmark; import java.util.Random; import org.junit.Test; /** * @author Jinho D. Choi ({@code [email protected]}) */ public class Benchmark { @Test public void speed() { Random rand = new Random(); for (int i=0; i<10; i++) { for (int j=0; j<20; j++) { System.out.print((int)Math.abs(rand.nextInt())%2); } System.out.println(); } } }
65e2643dad8c3f442af4f64d48dcf3a54073c78c
7ea367f7d18dcfd0eb4f8b49e686219b338dccef
/ivanchuk/src/task24/TaskTest.java
27057bdb088640ad281eb4061a0583de34bf90ce
[]
no_license
karzhouAndrew/JavaRepository
243db4029809940da6abc557922a148c88f52d6c
ab176579b0a17c3fec42f84241f5338babe6c101
refs/heads/master
2021-01-21T21:47:37.373255
2015-11-03T18:11:39
2015-11-03T18:11:39
34,864,695
0
28
null
2016-05-14T07:02:49
2015-04-30T16:28:23
Java
UTF-8
Java
false
false
1,856
java
package task24; //Создать иерархию классов, описывающих бытовую технику. //Создать несколько объектов описанных классов, часть из них включить в розетку. //Иерархия должна иметь хотя бы три уровня. public class TaskTest { public static void main(String[] args) { HouseholdAppliances laptop = new Laptop("Apple", 2.4, 2300); HouseholdAppliances personalComputer = new PersonalComputer("Asus", 3.0, "Lg"); HouseholdAppliances dvdPlayer = new DVDPlayer("Lg", "DVD", "HDMI"); HouseholdAppliances homeTheater = new HomeTheater("Sony", "DVD", "Sony"); personalComputer.includeInSocket(); homeTheater.includeInSocket(); dvdPlayer.includeInSocket(); personalComputer.switchOffFromSocket(); System.out.println("Laptop: " + laptop.getIncludedInSocket() + " " + laptop.getBrand() + " " + ((Laptop) laptop).getProcessorPower() + " " + ((Laptop) laptop).getBatteryCapacity()); System.out.println("PC: " + personalComputer.getIncludedInSocket() + " " + personalComputer.getBrand() + " " + ((PersonalComputer) personalComputer).getProcessorPower() + " " + ((PersonalComputer) personalComputer).getMonitorBrand()); System.out.println("DVD player: " + dvdPlayer.getIncludedInSocket() + " " + dvdPlayer.getBrand() + " " + ((DVDPlayer) dvdPlayer).getSupportedFormats() + " " + ((DVDPlayer) dvdPlayer).getInterfaces()); System.out.println("Home theater: " + homeTheater.getIncludedInSocket() + " " + homeTheater.getBrand() + " " + ((HomeTheater) homeTheater).getSupportedFormats() + " " + ((HomeTheater) homeTheater).getProjectorBrand()); } }
78b486555fe3af88adf6e64d4efdb28beda241e4
831fadea50d93b86cbbe0c1c8172972c8fbb6289
/RecyclerView_practice_fromEmpty/app/src/test/java/com/example/recyclerview_practice_fromempty/ExampleUnitTest.java
cc5d231b4b2dc9d1888cb7da42ece27ccb00046a
[]
no_license
spide333/AndroidStudy
e55a8d3558f66717d34e622417a268395048ac04
e72ead13be7d584d9a69867ab27451140ec6eb43
refs/heads/master
2022-08-03T15:07:57.860271
2020-05-27T06:58:56
2020-05-27T06:58:56
null
0
0
null
null
null
null
UTF-8
Java
false
false
404
java
package com.example.recyclerview_practice_fromempty; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
af68fd232278b7d20e12ee33a8ec14fb02a507df
590903b89958410b0bf910b5fb2a5047ae7711c2
/src/main/java/ru/alcereo/LatencySimulator.java
2b8142ab1aa3f871e70620672a52b282c7098c15
[]
no_license
Alcereo/StormLatencyTestingTopology
01188bd0f875a8fcad419d26aae07d3537b8a3d4
5b335cb038c5b986058e7d80b98eb2e743b25926
refs/heads/master
2021-07-02T06:15:25.290316
2017-09-23T10:07:33
2017-09-23T10:07:33
104,558,503
0
0
null
null
null
null
UTF-8
Java
false
false
394
java
package ru.alcereo; /** * Created by alcereo on 23.09.17. */ public class LatencySimulator { public static void sleep(int milliseconds) { long startTime = System.currentTimeMillis(); while(System.currentTimeMillis()-startTime<milliseconds){ int b=0; for (int j = 0; j < 10000; j++) { b=b%(j+1); } } } }
3c5cf4af884fb16df947e0b75d9e4633fbdc1716
ddbe85cb1016af4770a0c746a539d51ee021463c
/src/main/java/com/example/junittest/excel/service/aa.java
1bdc1e05b9ca483b9670b5a0a9ac1a5985e5cffc
[]
no_license
SoulKingdom/javaDemo
b9bf4c974388824637b572d6a033ba7dc15d31d1
c361797d70c48fedc6cb463d5a2cc9de21ed1144
refs/heads/master
2023-05-12T23:01:17.458466
2020-07-17T07:41:25
2020-07-17T07:41:25
214,622,578
3
0
null
2023-05-09T18:40:18
2019-10-12T09:52:17
Java
UTF-8
Java
false
false
179
java
package com.example.junittest.excel.service; /** * @dept 上海软件研发中心 * @description TODO * @author HaoXin.Liu * @date 2019/11/4 9:45 **/ public class aa { }
f301369b150636a1ffd6c11a73de25306dbec6b5
f66fc1aca1c2ed178ac3f8c2cf5185b385558710
/reladomo/src/main/java/com/gs/fw/common/mithra/DefaultJtaProvider.java
eace81d17b4d980c1fe8557076cc7c7127a041d6
[ "Apache-2.0", "BSD-3-Clause", "MIT", "LicenseRef-scancode-public-domain" ]
permissive
goldmansachs/reladomo
9cd3e60e92dbc6b0eb59ea24d112244ffe01bc35
a4f4e39290d8012573f5737a4edc45d603be07a5
refs/heads/master
2023-09-04T10:30:12.542924
2023-07-20T09:29:44
2023-07-20T09:29:44
68,020,885
431
122
Apache-2.0
2023-07-07T21:29:52
2016-09-12T15:17:34
Java
UTF-8
Java
false
false
1,041
java
/* Copyright 2016 Goldman Sachs. 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.gs.fw.common.mithra; import javax.transaction.TransactionManager; public class DefaultJtaProvider implements JtaProvider { private TransactionManager transactionManager; public DefaultJtaProvider(TransactionManager transactionManager) { this.transactionManager = transactionManager; } public TransactionManager getJtaTransactionManager() { return transactionManager; } }
bbc50bf71adf8145a36cec00c7b6b4d4ae7dda4f
db053c556e400b565f95c2610e40ce127f3ef59a
/src/main/java/dataAccess/NonExistentNodeIdException.java
95ef88b9d1bb77041030254e923803cfab9329ed
[]
no_license
SwamWithTurtles/graph-simulation
1bd7df226b6ce94fc70f5e4233ab31abc7bc5e69
9b82f6243a281c8baa1cad73921ca1eccc5a40f8
refs/heads/master
2021-01-22T23:20:13.368720
2015-03-12T18:49:07
2015-03-12T18:49:07
32,094,232
0
0
null
null
null
null
UTF-8
Java
false
false
94
java
package dataAccess; public class NonExistentNodeIdException extends RuntimeException { }
401993b1cd29d7ab7a3251f0b98b65e66c275639
f794c2eb1ebab4933ecfa348f7a8e4e82cca0c70
/app/src/main/java/com/getproz/servicepartner/ModelClass/LeadModelClass.java
83b4d24be8988f9bc2c2407a0dc3f48fb7fb51fd
[ "BSD-3-Clause" ]
permissive
muwechi/getproz-servicepartner
b02818713b13c54f2a314986c3caa5ea5393a1f2
8f0e1423590619f0ee0c0e20a5fb281845062c3b
refs/heads/main
2023-04-14T13:14:06.678307
2021-04-11T19:36:54
2021-04-11T19:36:54
356,636,288
0
0
BSD-3-Clause
2021-04-22T16:39:18
2021-04-10T16:25:41
Java
UTF-8
Java
false
false
1,838
java
package com.getproz.servicepartner.ModelClass; public class LeadModelClass { String booking_id; String time_slot; String confirmed_on; String coins; String user_address; String user_phone; String user_name; String lat; String distance; public String getDistance() { return distance; } public void setDistance(String distance) { this.distance = distance; } public String getLat() { return lat; } public void setLat(String lat) { this.lat = lat; } public String getLng() { return lng; } public void setLng(String lng) { this.lng = lng; } String lng; public String getBooking_id() { return booking_id; } public void setBooking_id(String booking_id) { this.booking_id = booking_id; } public String getTime_slot() { return time_slot; } public void setTime_slot(String time_slot) { this.time_slot = time_slot; } public String getConfirmed_on() { return confirmed_on; } public void setConfirmed_on(String confirmed_on) { this.confirmed_on = confirmed_on; } public String getCoins() { return coins; } public void setCoins(String coins) { this.coins = coins; } public String getUser_address() { return user_address; } public void setUser_address(String user_address) { this.user_address = user_address; } public String getUser_phone() { return user_phone; } public void setUser_phone(String user_phone) { this.user_phone = user_phone; } public String getUser_name() { return user_name; } public void setUser_name(String user_name) { this.user_name = user_name; } }
c71b78d977f2c2b9ce6edeafb82baa221788c7bf
2a089268dcebf9124efc059039abe4d8ed45b7f4
/src/main/java/me/dragon/model/entity/User.java
9318fc8d5e01062473a80d95e63a62e756e4188c
[]
no_license
Grandaunt/NovSpringBoot
95c8109e0838f6f2d4e42d444990e25c8765044f
4ae017c8c499a0aa7d96e2e221e16b6dce773e23
refs/heads/master
2020-03-17T19:56:59.980335
2018-04-23T15:48:11
2018-04-23T15:48:11
null
0
0
null
null
null
null
UTF-8
Java
false
false
372
java
package me.dragon.model.entity; import lombok.Data; import org.springframework.data.annotation.Id; import javax.persistence.Column; import javax.persistence.GeneratedValue; import javax.persistence.Table; /** * Created by dragon on 11/4/2017. */ @Data @Table(name = "user") public class User { @Id @GeneratedValue(generator = "UUID") private String id; }
2e9c3175295b9f287155f45b9148a416f89ed60e
b506894c4107e2183b61805147d3049f8305aebb
/app/src/main/java/com/example/myapplication/advancelight/chapter8/rxjava/RxjavaActivity.java
afa026593559b4edd5440189ce8451d14b823917
[]
no_license
ivokc/godspeed-android
f1761b1b9fbb54b9f3673e5d45268d59c6d5ac0b
6e5e42973001773fd8e19e19d889557445f57640
refs/heads/master
2023-02-19T01:24:41.600997
2021-01-19T08:21:58
2021-01-19T08:21:58
317,812,267
0
0
null
null
null
null
UTF-8
Java
false
false
4,680
java
package com.example.myapplication.advancelight.chapter8.rxjava; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import androidx.appcompat.app.AppCompatActivity; import com.example.myapplication.R; import com.example.myapplication.advancelight.chapter8.rxjava.bus.RxBusActivity; import com.example.myapplication.advancelight.chapter8.rxjava.net.OkhttpActivity; import com.example.myapplication.advancelight.chapter8.rxjava.net.RetrofitActivity; public class RxjavaActivity extends AppCompatActivity implements View.OnClickListener { private Button bt_okhttp; private Button bt_create; private Button bt_filter; private Button bt_transform; private Button bt_combine; private Button bt_utility; private Button bt_error; private Button bt_conditional; private Button bt_conversion; private Button bt_retrofit; private Button bt_rxbus; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_rxjava); initView(); } private void initView() { bt_create = (Button) this.findViewById(R.id.bt_create); bt_transform = (Button) this.findViewById(R.id.bt_conversion); bt_filter = (Button) this.findViewById(R.id.bt_filter); bt_combine = (Button) this.findViewById(R.id.bt_combine); bt_utility = (Button) this.findViewById(R.id.bt_utility); bt_error = (Button) this.findViewById(R.id.bt_error); bt_conditional = (Button) this.findViewById(R.id.bt_conditional); bt_conversion = (Button) this.findViewById(R.id.bt_conversion); bt_okhttp = (Button) this.findViewById(R.id.bt_okhttp); bt_retrofit= (Button) this.findViewById(R.id.bt_retrofit); bt_rxbus= (Button) this.findViewById(R.id.bt_rxbus); bt_filter.setOnClickListener(this); bt_create.setOnClickListener(this); bt_transform.setOnClickListener(this); bt_combine.setOnClickListener(this); bt_utility.setOnClickListener(this); bt_error.setOnClickListener(this); bt_conditional.setOnClickListener(this); bt_conversion.setOnClickListener(this); bt_okhttp.setOnClickListener(this); bt_retrofit.setOnClickListener(this); bt_rxbus.setOnClickListener(this); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.bt_create: Intent intent = new Intent(RxjavaActivity.this, CreateActivity.class); startActivity(intent); break; case R.id.bt_transform: Intent transformIntent = new Intent(RxjavaActivity.this, TransformActivity.class); startActivity(transformIntent); break; case R.id.bt_filter: Intent filterIntent = new Intent(RxjavaActivity.this, FilterActivity.class); startActivity(filterIntent); break; case R.id.bt_combine: Intent combineIntent = new Intent(RxjavaActivity.this, CombineActivity.class); startActivity(combineIntent); break; case R.id.bt_utility: Intent utilityIntent = new Intent(RxjavaActivity.this, UtilityActivity.class); startActivity(utilityIntent); break; case R.id.bt_error: Intent errorIntent = new Intent(RxjavaActivity.this, ErrorActivity.class); startActivity(errorIntent); break; case R.id.bt_conditional: Intent conditionalIntent = new Intent(RxjavaActivity.this, ConditionalActivity.class); startActivity(conditionalIntent); break; case R.id.bt_conversion: Intent conversionIntent = new Intent(RxjavaActivity.this, ConversionActivity.class); startActivity(conversionIntent); break; case R.id.bt_okhttp: Intent okhttpIntent = new Intent(RxjavaActivity.this, OkhttpActivity.class); startActivity(okhttpIntent); break; case R.id.bt_retrofit: Intent retrofitIntent = new Intent(RxjavaActivity.this, RetrofitActivity.class); startActivity(retrofitIntent); break; case R.id.bt_rxbus: Intent rxbusIntent = new Intent(RxjavaActivity.this, RxBusActivity.class); startActivity(rxbusIntent); break; } } }
46c758eecc945bce03def06af7d2db8eb6ca2f9b
02b14c562ab6bde53e8e07e95db772d1e787ec56
/src/main/java/br/com/salon/carine/lima/controllers/AtendimentoController.java
d55183765aabe094feb3a2234a493c8a1cdd6418
[ "MIT" ]
permissive
IsraelLima25/SalonCarineLima
f771afda998e87fd3fa26eaaff65e7694480a5bc
4f90f177f9c15b9bd9bb0b33269f2fcb6ec3e61b
refs/heads/master
2023-03-23T04:07:03.472922
2021-03-16T12:43:27
2021-03-16T12:43:27
297,523,626
0
0
null
null
null
null
UTF-8
Java
false
false
6,956
java
package br.com.salon.carine.lima.controllers; import java.math.BigDecimal; import java.net.URI; import java.util.List; import java.util.logging.Logger; import javax.servlet.http.HttpServletRequest; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.data.domain.Page; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.validation.BindingResult; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.support.ServletUriComponentsBuilder; import br.com.salon.carine.lima.dto.FiltroDataAtendimentoDTO; import br.com.salon.carine.lima.dto.MarcarAtendimentoDTO; import br.com.salon.carine.lima.enuns.BandeiraCartao; import br.com.salon.carine.lima.enuns.TipoEndereco; import br.com.salon.carine.lima.enuns.TipoPagamento; import br.com.salon.carine.lima.exceptions.ArgumentNotValidException; import br.com.salon.carine.lima.models.Atendimento; import br.com.salon.carine.lima.models.Cliente; import br.com.salon.carine.lima.response.Message; import br.com.salon.carine.lima.response.ResponseMarcar; import br.com.salon.carine.lima.services.AtendimentoService; import br.com.salon.carine.lima.services.CarrinhoService; import br.com.salon.carine.lima.services.ClienteService; @Controller @RequestMapping(value = "/atendimento") public class AtendimentoController { @Autowired private ClienteService serviceCliente; @Autowired private CarrinhoService carrinhoService; @Autowired private AtendimentoService atendimentoService; @Autowired private LojaController controllerLoja; private Logger logger = Logger.getLogger("br.com.salon.carine.lima.Atendimento"); @RequestMapping(method = RequestMethod.GET, value = "listar") public ModelAndView formDetalheAtendimento( @RequestParam(defaultValue = "0") Integer page, @RequestParam(defaultValue = "5") Integer size) { this.logger.info("Iniciando busca paginada model"); /* Atualizar First Atendimento*/ atendimentoService.atualizarFirstId(atendimentoService.idFirstAtendimento()); /* Atualizar Last Atendimento*/ atendimentoService.atualizarLastId(atendimentoService.idLastAtendimento()); ModelAndView modelAndView = new ModelAndView("atendimento/lista"); Page<Atendimento> pageAtendimento = atendimentoService.findPageAtendimento(page, size); modelAndView.addObject("paginas", pageAtendimento); modelAndView.addObject("activeAtendimento", "active"); return modelAndView; } @RequestMapping(method = RequestMethod.GET, value = "cliente/filter") public ResponseEntity<List<Atendimento>> filterAtendimentoPorNome(String nome){ Page<Atendimento> pageAtendimento = atendimentoService.filtrarAtendimentoPorCliente(nome); return ResponseEntity.ok(pageAtendimento.getContent()); } @RequestMapping(method = RequestMethod.POST, value = "filterData") public ResponseEntity<Page<Atendimento>> filterDataAtendimento (@Valid FiltroDataAtendimentoDTO filtro, BindingResult result, HttpServletRequest request) { if(result.hasErrors()) { throw new ArgumentNotValidException(result,request); } Page<Atendimento> listaFiltrada = atendimentoService. getAtendimentosFilterData(filtro); return ResponseEntity.ok().body(listaFiltrada); } @RequestMapping(method = RequestMethod.GET, value = "formMarcar") public ModelAndView formMarcarAtendimento() { if(carrinhoService.getQuantidadeTotalItensCarrinho() > 0) { List<Cliente> clientes = serviceCliente.listarTodos(); BigDecimal valorTotalCarrinho = carrinhoService.getValorTotalCarrinho(); ModelAndView modelAndView = new ModelAndView("atendimento/formMarcar"); modelAndView.addObject("clientes", clientes); modelAndView.addObject("valorTotalCarrinho", valorTotalCarrinho); modelAndView.addObject("pagamentos", TipoPagamento.values()); modelAndView.addObject("bandeiras", BandeiraCartao.values()); modelAndView.addObject("enderecos", TipoEndereco.values()); return modelAndView; }else { return controllerLoja.getLoja(); } } @RequestMapping(method = RequestMethod.POST) public ResponseEntity<ResponseMarcar> marcaAtendimento( @Valid MarcarAtendimentoDTO atendimentoDTO, BindingResult result, HttpServletRequest request){ if(result.hasErrors()) { throw new ArgumentNotValidException(result, request); } URI uri = ServletUriComponentsBuilder.fromCurrentRequest().path("/{id}") .buildAndExpand(atendimentoDTO.getId()) .toUri(); ResponseMarcar response = atendimentoService.marcarAtendimento(atendimentoDTO, request, result); /* Atualizar First Atendimento*/ atendimentoService.atualizarFirstId(atendimentoService.idFirstAtendimento()); /* Atualizar Last Atendimento*/ atendimentoService.atualizarLastId(atendimentoService.idLastAtendimento()); return ResponseEntity.created(uri).body(response); } @RequestMapping(method = RequestMethod.GET, value = "/{id}") public ModelAndView detalheAtendimento(@PathVariable Integer id) { ModelAndView modelAndView = new ModelAndView("atendimento/formDetalhar"); Atendimento atendimento = atendimentoService.buscarAtendimentoPorId(id); modelAndView.addObject("atendimento",atendimento); return modelAndView; } @RequestMapping(method = RequestMethod.GET, value = "next") public ModelAndView nextAtendimento (@RequestParam Integer idAtendimentoAtual){ ModelAndView modelAndView = new ModelAndView("atendimento/formDetalhar"); Atendimento atendimento = atendimentoService.nextAtendimento(idAtendimentoAtual); modelAndView.addObject("atendimento", atendimento); return modelAndView; } @RequestMapping(method = RequestMethod.GET, value = "previous") public ModelAndView previousAtendimento (@RequestParam Integer idAtendimentoAtual){ ModelAndView modelAndView = new ModelAndView("atendimento/formDetalhar"); Atendimento atendimento = atendimentoService.previousAtendimento(idAtendimentoAtual); modelAndView.addObject("atendimento",atendimento); return modelAndView; } @CacheEvict(value = "listarHTML", allEntries = true) @RequestMapping(method = RequestMethod.POST, value = "cancelar") public ResponseEntity<Message> cancelar(Integer idAtendimentoCancelado) { Message message = this.atendimentoService.cancelar(idAtendimentoCancelado); /* Atualizar First Atendimento*/ atendimentoService.atualizarFirstId(atendimentoService.idFirstAtendimento()); /* Atualizar Last Atendimento*/ atendimentoService.atualizarLastId(atendimentoService.idLastAtendimento()); return ResponseEntity.ok().body(message); } }