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
6a6483f695147e584b5bfe05a5016eefec47f618
2e7dcd12ad488b8b443b16c4beffc5c17d2fd000
/4 kuy/Snail/src/main/java/Snail.java
5331fc651da527b543917f58acd2d49c51976ac8
[]
no_license
OleksandrChekalenko/codewars
a12ddcc851ae221e90fd67598ab10915e124e385
22114e6dcc997cb705a44eaa6b53e35d68c06368
refs/heads/master
2023-08-17T16:35:32.199682
2023-08-11T13:28:15
2023-08-11T13:28:15
157,531,287
0
0
null
null
null
null
UTF-8
Java
false
false
279
java
public class Snail { public static int[] snail(int[][] array) { int arrLength = 0; for (int[] i : array) { arrLength += i.length; } int rowLength = array[0].length; for (int i = ; i < rowLength; i++) { } } }
9d1fd4e6e4342859ebb7e25877cb65ef8c6e849d
d55f4eeadef003acadedd13ab7c661a8da024b44
/W1/Hackerrank/src/Easy4.java
e69cdca17ab2cefe35cb8ca5a80874060869dae8
[]
no_license
DairovOlzhas/OOP2018DairovOlzhas
f446178724fc8769300aee68442a96cfe099fe0a
81ba25cfecfe01fa4d42b53a1e94ffe83fcba4fa
refs/heads/master
2021-08-17T11:43:02.489517
2018-11-27T04:13:48
2018-11-27T04:13:48
146,871,725
0
0
null
null
null
null
UTF-8
Java
false
false
531
java
import java.util.Scanner; public class Easy4 { public static void main(String[] args) { Scanner sc=new Scanner(System.in); System.out.println("================================"); for(int i=0;i<3;i++){ String s1=sc.next(); int x=sc.nextInt(); for(int j = s1.length(); j < 15; j++) s1 += " "; System.out.printf("%s%03d\n", s1, x);//Complete this line } System.out.println("================================"); } }
b237643fcd60a375088f4713b3a8fee73d1f043e
561cd02be0afc651c5237828dc6172f3037f3d30
/Assignment 8/Logins.java
20383db2269eba26cf9a222b767dd93e479287ac
[]
no_license
ashish-rama/CS101-Intro-to-CS-Java
8e9a2bee1a20f644b6c522bf24b43dde26d97796
75198c060d6a52fd71686d1e276186c4ba767dcf
refs/heads/master
2021-05-08T03:58:42.262016
2017-10-26T04:11:06
2017-10-26T04:11:06
108,360,390
0
0
null
null
null
null
UTF-8
Java
false
false
3,516
java
package edu.nyu.cs101.assignment8; import java.util.Scanner; /** * Login Program (Assignment 8 Part 1) * @author Ashish Ramachandran (ar3986) */ public class Logins { //define global variables private static boolean NOT_CORRECT_USERNAME = true, NOT_CORRECT_PASSWORD = true; private static final int USERNAME_MAX_LENGTH = 16, USERNAME_MIN_LENGTH = 4, PASSWORD_MIN_LENGTH = 8; public static void main(String[] args) { Scanner scan = new Scanner(System.in); String username = "", password = ""; //while username input is incorrect while(NOT_CORRECT_USERNAME) { System.out.print("Username: "); username = scan.nextLine().trim(); System.out.println("\"" + username + "\""); //check if starts with letter and is within the length limits if(Character.isDigit(username.charAt(0))) { System.out.println("Error: username must not start with a number"); } else if(username.length() >= USERNAME_MAX_LENGTH) { System.out.println("Error: username must be less than " + USERNAME_MAX_LENGTH + " characters long"); } else if(username.length() < USERNAME_MIN_LENGTH) { System.out.println("Error: username must be at least " + USERNAME_MIN_LENGTH + " characters long"); } else { NOT_CORRECT_USERNAME = false; } } //while password input is incorrect while(NOT_CORRECT_PASSWORD) { System.out.print("Password: "); password = scan.nextLine().trim(); //check if password contains username, within the length limits, contains an uppercase //char, contains a lowercase char, and contains a numeric character if (password.contains(username)) { System.out.println("Error: password cannot contain the username"); } else if(password.length() < PASSWORD_MIN_LENGTH) { System.out.println("Error: password must be at least " + PASSWORD_MIN_LENGTH + " characters long"); } else if(!containsUpperCaseChar(password)) { System.out.println("Error: password must have at least one upper case letter."); } else if(!containsLowerCaseChar(password)) { System.out.println("Error: password must have at least one lower case letter."); } else if(!containsNumericChar(password)) { System.out.println("Error: password must have at least one numeric character."); } else { NOT_CORRECT_PASSWORD = false; } } System.out.println("Valid username/password"); scan.close(); } /** * Checks if a passed string contains at least one uppercase character * @param str the string to check * @return true if <code>str</code> contains at least one uppercase character */ private static boolean containsUpperCaseChar(String str) { for(int i = 0; i < str.length(); i++) { if(Character.isUpperCase(str.charAt(i))) return true; } return false; } /** * Checks if a passed string contains at least one lowercase character * @param str the string to check * @return true if <code>str</code> contains at least one lowercase character */ private static boolean containsLowerCaseChar(String str) { for(int i = 0; i < str.length(); i++) { if(Character.isLowerCase(str.charAt(i))) return true; } return false; } /** * Checks if a passed string contains at least one numeric character * @param str the string to check * @return true if <code>str</code> contains at least one numeric character */ private static boolean containsNumericChar(String str) { for(int i = 0; i < str.length(); i++) { if(Character.isDigit(str.charAt(i))) return true; } return false; } }
3bb42564b42e4c42ebe17bd8b73b48f7f78e9a5f
9b21f1d9ba654af01ed6c46e25945e237a5ae2bc
/src/com/company/ThreadClass.java
62098e3dd2a2e002e930d28b41debdb2634cc214
[]
no_license
bushido1586/Hello-world
e95193eadfa202e303fb655a9a2571cf9e0b4853
cae5902d791b596689b4c1516b7249bf3e5df51b
refs/heads/master
2022-12-29T06:09:59.777578
2020-10-10T23:09:30
2020-10-10T23:09:30
283,907,856
2
0
null
null
null
null
UTF-8
Java
false
false
217
java
package com.company; public class ThreadClass extends Thread { public void run(){ for (int i=0; i<5;i++){ System.out.println(Thread.currentThread().getName()+" is Running"); } } }
06f85f909edbeacf60a4ac73354ae3d4bc964c93
e39e29428ffddd56eb2909d24f24d63412248ba8
/sources/gov/nih/nlm/nls/lvg/Tools/GuiTool/Gui/ViewLexItemsDialog.java
a55da98bb822b6d3b2e295c5909423056f6dddd1
[]
no_license
ChrisLuNlm/Lvg2019
2aab9b9b73815e4e6c644a3805dc7322dc39cc5e
071b977198add7cabde4415411dc27a6a29a53d8
refs/heads/master
2020-03-31T23:05:09.246710
2018-10-11T19:36:18
2018-10-11T19:36:18
152,642,440
0
0
null
null
null
null
UTF-8
Java
false
false
13,497
java
package gov.nih.nlm.nls.lvg.Tools.GuiTool.Gui; import java.util.*; import java.awt.*; import java.awt.event.*; import javax.swing.*; import gov.nih.nlm.nls.lvg.Lib.*; import gov.nih.nlm.nls.lvg.Tools.GuiTool.Global.*; import gov.nih.nlm.nls.lvg.Tools.GuiTool.GuiLib.*; import gov.nih.nlm.nls.lvg.Tools.GuiTool.GuiComp.*; /************************************************************************* * This class show the detail information for a LexItem in a Vector. * The constructor is public and a Vector of lexItems object are passed in. * * <p><b>History:</b> * <ul> * </ul> * @author NLM NLS Development Team * * @version V-2019 **************************************************************************/ public class ViewLexItemsDialog extends JDialog { public ViewLexItemsDialog(JFrame owner, Vector<LexItem> lexItems, String title, String label, int index) { super(owner, title, false); owner_ = owner; index_ = index; if(index_ < 0) { index_ = 0; } else if(index_ > lexItems.size()-1) { index_ = lexItems.size()-1; } lexItems_ = lexItems; Init(); // Geometry Setting setLocationRelativeTo(owner); setSize(600, 530); // top panel JPanel topP = new JPanel(); topP.add(new JLabel(label)); // center JPanel centerP = new JPanel(); centerP.setBorder(BorderFactory.createTitledBorder( BorderFactory.createEtchedBorder(), "Output LexItem")); GridBagLayout gbl = new GridBagLayout(); centerP.setLayout(gbl); GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.NONE; gbc.anchor = GridBagConstraints.WEST; gbc.insets = new Insets(3, 3, 3, 3); GridBag.SetWeight(gbc, 100, 100); JButton srcCatB = new JButton("Details"); JButton tarCatB = new JButton("Details"); JButton srcInflB = new JButton("Details"); JButton tarInflB = new JButton("Details"); for(int i = 0; i < FIELD_NUM; i++) { GridBag.SetPosSize(gbc, 0, i, 1, 1); centerP.add(cb_[i], gbc); if(i == DETAIL_INFO) { GridBag.SetPosSize(gbc, 1, i, 2, 1); JScrollPane scrollPane = new JScrollPane(detailArea_); centerP.add(scrollPane, gbc); } else if(i == SRC_CAT) { GridBag.SetPosSize(gbc, 1, i, 1, 1); centerP.add(valueT_[i], gbc); GridBag.SetPosSize(gbc, 2, i, 1, 1); centerP.add(srcCatB, gbc); } else if(i == TAR_CAT) { GridBag.SetPosSize(gbc, 1, i, 1, 1); centerP.add(valueT_[i], gbc); GridBag.SetPosSize(gbc, 2, i, 1, 1); centerP.add(tarCatB, gbc); } else if(i == SRC_INFL) { GridBag.SetPosSize(gbc, 1, i, 1, 1); centerP.add(valueT_[i], gbc); GridBag.SetPosSize(gbc, 2, i, 1, 1); centerP.add(srcInflB, gbc); } else if(i == TAR_INFL) { GridBag.SetPosSize(gbc, 1, i, 1, 1); centerP.add(valueT_[i], gbc); GridBag.SetPosSize(gbc, 2, i, 1, 1); centerP.add(tarInflB, gbc); } else { GridBag.SetPosSize(gbc, 1, i, 2, 1); centerP.add(valueT_[i], gbc); } } // bottom panel ListButtonPanel bottomP = new ListButtonPanel(); JButton firstB = bottomP.GetFirstButton(); JButton prevB = bottomP.GetPreviousButton(); JButton nextB = bottomP.GetNextButton(); JButton lastB = bottomP.GetLastButton(); JButton goB = bottomP.GetGoButton(); JButton closeB = bottomP.GetCloseButton(); indexT_ = bottomP.GetIndexTextField(); indexT_.setText(Integer.toString(index_ + 1)); // top level getContentPane().add(topP, "North"); getContentPane().add(centerP, "Center"); getContentPane().add(bottomP, "South"); // inner class for action listener firstB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { index_ = 0; UpdatePage(); } }); prevB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { index_--; if(index_ < 0) { index_ = 0; Toolkit.getDefaultToolkit().beep(); } UpdatePage(); } }); nextB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { index_++; int max = lexItems_.size()-1; if(index_ > max) { index_ = max; Toolkit.getDefaultToolkit().beep(); } UpdatePage(); } }); lastB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { index_ = lexItems_.size()-1; UpdatePage(); } }); goB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { try { index_ = Integer.parseInt(indexT_.getText()) - 1; } catch(Exception e) { Toolkit.getDefaultToolkit().beep(); } int max = lexItems_.size()-1; if(index_ > max) { index_ = max; Toolkit.getDefaultToolkit().beep(); } else if(index_ < 0) { index_ = 0; Toolkit.getDefaultToolkit().beep(); } UpdatePage(); } }); closeB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { setVisible(false); } }); srcCatB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String name = GetCategoryName(valueT_[SRC_CAT].getText()); JOptionPane.showMessageDialog(owner_, name, "Category Details", JOptionPane.INFORMATION_MESSAGE); } }); tarCatB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String name = GetCategoryName(valueT_[TAR_CAT].getText()); JOptionPane.showMessageDialog(owner_, name, "Category Details", JOptionPane.INFORMATION_MESSAGE); } }); srcInflB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String name = GetInflectionName(valueT_[SRC_INFL].getText()); JOptionPane.showMessageDialog(owner_, name, "Inflection Details", JOptionPane.INFORMATION_MESSAGE); } }); tarInflB.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String name = GetInflectionName(valueT_[TAR_INFL].getText()); JOptionPane.showMessageDialog(owner_, name, "Inflection Details", JOptionPane.INFORMATION_MESSAGE); } }); } //protected protected static String GetCategoryName(String in) { String out = new String(); try { long value = Long.parseLong(in); out = "Value: " + in + "\nName: " + Category.ToName(value); } catch(Exception e) { out = "No detail information available!"; } return out; } protected static String GetInflectionName(String in) { String out = new String(); try { long value = Long.parseLong(in); out = "Value: " + in + "\nName: " + Inflection.ToName(value); } catch(Exception e) { out = "No detail information available!"; } return out; } private void UpdatePage() { if((lexItems_ != null) && (index_ >= 0) && (index_ < lexItems_.size())) { LexItem lexItem = lexItems_.elementAt(index_); defaults_[ORG_TERM] = lexItem.GetOriginalTerm(); defaults_[FLOW_NUM] = Integer.toString(lexItem.GetFlowNumber()); defaults_[FLOW_HIS] = lexItem.GetFlowHistory(); defaults_[SRC_TERM] = lexItem.GetSourceTerm(); defaults_[TAR_TERM] = lexItem.GetTargetTerm(); defaults_[SRC_CAT] = Long.toString(lexItem.GetSourceCategory().GetValue()); defaults_[TAR_CAT] = Long.toString(lexItem.GetTargetCategory().GetValue()); defaults_[SRC_INFL] = Long.toString(lexItem.GetSourceInflection().GetValue()); defaults_[TAR_INFL] = Long.toString(lexItem.GetTargetInflection().GetValue()); defaults_[MUTATE_INFO] = lexItem.GetMutateInformation(); defaults_[DETAIL_INFO] = lexItem.GetDetailInformation(); } for(int i = 0; i < FIELD_NUM; i++) { valueT_[i].setText(defaults_[i]); } detailArea_.setText(defaults_[DETAIL_INFO]); indexT_.setText(Integer.toString(index_ + 1)); OutputPanel.SetSelectedIndex(index_); } // private methods public void Init() { if((lexItems_ != null) && (index_ >= 0) && (index_ < lexItems_.size())) { LexItem lexItem = lexItems_.elementAt(index_); defaults_[ORG_TERM] = lexItem.GetOriginalTerm(); defaults_[FLOW_NUM] = Integer.toString(lexItem.GetFlowNumber()); defaults_[FLOW_HIS] = lexItem.GetFlowHistory(); defaults_[SRC_TERM] = lexItem.GetSourceTerm(); defaults_[TAR_TERM] = lexItem.GetTargetTerm(); defaults_[SRC_CAT] = Long.toString(lexItem.GetSourceCategory().GetValue()); defaults_[TAR_CAT] = Long.toString(lexItem.GetTargetCategory().GetValue()); defaults_[SRC_INFL] = Long.toString(lexItem.GetSourceInflection().GetValue()); defaults_[TAR_INFL] = Long.toString(lexItem.GetTargetInflection().GetValue()); defaults_[MUTATE_INFO] = lexItem.GetMutateInformation(); defaults_[DETAIL_INFO] = lexItem.GetDetailInformation(); } size_[ORG_TERM] = 15; size_[FLOW_NUM] = 2; size_[FLOW_HIS] = 15; size_[SRC_TERM] = 15; size_[TAR_TERM] = 15; size_[SRC_CAT] = 4; size_[TAR_CAT] = 4; size_[SRC_INFL] = 8; size_[TAR_INFL] = 8; size_[MUTATE_INFO] = 35; size_[DETAIL_INFO] = 0; if(detailArea_ == null) { detailArea_ = new JTextArea(5, 35); detailArea_.setLineWrap(true); detailArea_.setWrapStyleWord(true); detailArea_.setEditable(false); detailArea_.setText(defaults_[DETAIL_INFO]); } for(int i = 0; i < FIELD_NUM; i++) { cb_[i] = new JLabel(FIELD_STR[i] + ": "); valueT_[i] = new JTextField(defaults_[i], size_[i]); valueT_[i].setEditable(false); } } // private data private static final int FIELD_NUM = 11; private static final String[] FIELD_STR = {"Original term", "Flow number", "Flow history", "Source term", "Target term", "Source category", "Target category", "Source inflection", "Target inflection", "Mutate information", "Detail information" }; private static final int ORG_TERM = 0; private static final int FLOW_NUM = 1; private static final int FLOW_HIS = 2; private static final int SRC_TERM = 3; private static final int TAR_TERM = 4; private static final int SRC_CAT = 5; private static final int TAR_CAT = 6; private static final int SRC_INFL = 7; private static final int TAR_INFL = 8; private static final int MUTATE_INFO = 9; private static final int DETAIL_INFO = 10; private JLabel[] cb_ = new JLabel[FIELD_NUM]; private JTextField[] valueT_ = new JTextField[FIELD_NUM]; private int[] size_ = new int[FIELD_NUM]; private String[] defaults_ = new String[FIELD_NUM]; private JTextField indexT_ = null; private JTextArea detailArea_ = null; private JFrame owner_ = null; private int index_ = 0; private Vector<LexItem> lexItems_ = new Vector<LexItem>(); private final static long serialVersionUID = 5L; }
502a08e093435e1474fe5e5922d458512fbc02d0
a26bcd445bfbaa48adf8cde5e42982d32acdd93c
/src/main/java/com/wisdomelon/sys/entity/core/FtCoreDictType.java
a21ad820fcb93b9b0785ec614fbc01a9b608fb1c
[]
no_license
mini-watermelon/fast
5a1e73efcea57d145270812a84cdba48070edb82
75ed79f8c47fdc3ce072bafe7ebe47ce27c3b344
refs/heads/master
2020-04-15T04:42:18.500392
2019-01-11T07:57:51
2019-01-11T07:57:53
164,391,397
0
0
null
null
null
null
UTF-8
Java
false
false
1,769
java
package com.wisdomelon.sys.entity.core; import javax.persistence.*; @Table(name = "FT_CORE_DICT_TYPE") public class FtCoreDictType { @Id @Column(name = "ID") @GeneratedValue(generator = "JDBC") private String id; @Column(name = "NAME") private String name; @Column(name = "CODE") private String code; @Column(name = "STAT") private String stat; @Column(name = "CREATE_TIME") private String createTime; @Column(name = "REMARK") private String remark; /** * @return ID */ public String getId() { return id; } /** * @param id */ public void setId(String id) { this.id = id; } /** * @return NAME */ public String getName() { return name; } /** * @param name */ public void setName(String name) { this.name = name; } /** * @return CODE */ public String getCode() { return code; } /** * @param code */ public void setCode(String code) { this.code = code; } /** * @return STAT */ public String getStat() { return stat; } /** * @param stat */ public void setStat(String stat) { this.stat = stat; } /** * @return CREATE_TIME */ public String getCreateTime() { return createTime; } /** * @param createTime */ public void setCreateTime(String createTime) { this.createTime = createTime; } /** * @return REMARK */ public String getRemark() { return remark; } /** * @param remark */ public void setRemark(String remark) { this.remark = remark; } }
5d925fc51cd1fc50de476d27f33268c3564a45be
dc654f1fd11552b97fb062c0c7384017d9a96e66
/app/src/main/java/com/qlckh/chunlvv/common/SendThread.java
49f5a9504a6f9766506b3240fe79a4fd468df1c1
[]
no_license
AndyAls/chulvv
efef7d09d8567d9dacfd091b8a86dc2aa0171f81
7b832883683195e8b25d684b984a902cc4a9dbcb
refs/heads/master
2021-06-20T01:33:21.591074
2019-10-11T02:52:02
2019-10-11T02:52:02
207,237,043
0
0
null
null
null
null
UTF-8
Java
false
false
5,112
java
package com.qlckh.chunlvv.common; import android.os.Handler; import android.os.Message; import android.util.Log; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.net.Socket; import java.util.ArrayList; /** * @author Andy * @date 2018/8/18 15:11 * Desc: */ public class SendThread implements Runnable { private String ip; private int port; BufferedReader in; PrintWriter out; //打印流 Handler mainHandler; Socket s; private String receiveMsg; ArrayList<String> list = new ArrayList<String>(); public SendThread(String ip,int port, Handler mainHandler) { //IP,端口,数据 this.ip = ip; this.port=port; this.mainHandler = mainHandler; } /** * 套接字的打开 */ void open(){ try { s = new Socket(ip, port); //in收单片机发的数据 in = new BufferedReader(new InputStreamReader(s.getInputStream())); out = new PrintWriter(new BufferedWriter(new OutputStreamWriter( s.getOutputStream())), true); } catch (IOException e) { e.printStackTrace(); } } /** * 套接字的关闭 */ void close(){ try { s.close(); } catch (IOException e) { e.printStackTrace(); } } @Override public void run() { //创建套接字 open(); //BufferedReader Thread thread = new Thread(new Runnable() { @Override public void run() { while (true) { try { Thread.sleep(200); close(); open(); } catch (InterruptedException e1) { e1.printStackTrace(); } if (!s.isClosed()) { if (s.isConnected()) { if (!s.isInputShutdown()) { try { Log.i("mr", "等待接收信息"); char[] chars = new char[1024]; //byte[] bys = new byte[1024]; int len = 0; //int len = 0; while((len = in.read(chars)) != -1){ //while((len = in.read(bys)) != -1) { System.out.println("收到的消息: "+new String(chars, 0, len)); in.read(chars,0,len); receiveMsg = new String(chars, 0, len); // } Message msg=mainHandler.obtainMessage(); msg.what=0x00; msg.obj=receiveMsg; mainHandler.sendMessage(msg); } } catch (IOException e) { Log.i("mr", e.getMessage()); try { s.shutdownInput(); s.shutdownOutput(); s.close(); } catch (IOException e1) { e1.printStackTrace(); } e.printStackTrace(); } } } } } } }); thread.start(); while (true) { //连接中 if (!s.isClosed()&&s.isConnected()&&!s.isInputShutdown()) { // 如果消息集合有东西,并且发送线程在工作。 if (list.size() > 0 && !s.isOutputShutdown()) { out.println(list.get(0)); list.remove(0); } Message msg=mainHandler.obtainMessage(); msg.what=0x01; mainHandler.sendMessage(msg); } else { //连接中断了 Log.i("mr", "连接断开了"); Message msg=mainHandler.obtainMessage(); msg.what=0x02; mainHandler.sendMessage(msg); } try { Thread.sleep(200); } catch (InterruptedException e) { try { out.close(); in.close(); s.close(); } catch (IOException e1) { e1.printStackTrace(); } e.printStackTrace(); } } } public void send(String msg) { System.out.println("msg的值为: " + msg); list.add(msg); } }
081369d87177f0019136a58a3fbedb06ef8dedbb
f527ba6e2d7438ac3bc555bd4501b85ee0496479
/modules/global/src/com/haulmont/cuba/core/entity/Updatable.java
7b02d512e8d7e1600dbd5a865813ca0a74def4e1
[ "Apache-2.0" ]
permissive
Programmer095/cuba
c77d4dcf90ac1ba4f56078cced39154a460ae453
d92f6f140db4939f58195375cf0a751f88092cd2
refs/heads/master
2021-01-18T08:18:14.577636
2016-06-17T07:05:43
2016-06-17T07:07:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
961
java
/* * Copyright (c) 2008-2016 Haulmont. * * 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.haulmont.cuba.core.entity; import java.util.Date; /** * Interface to be implemented by entities that support update information saving. * */ public interface Updatable { Date getUpdateTs(); void setUpdateTs(Date updateTs); String getUpdatedBy(); void setUpdatedBy(String updatedBy); }
a13819b94d28a8de77e4537a182f01c19978fae7
3bc62f2a6d32df436e99507fa315938bc16652b1
/dmServer/src/main/java/com/intellij/dmserver/libraries/BundleWrapper.java
8baf20291d4329519bcd28532c211da4cf244f71
[ "Apache-2.0" ]
permissive
JetBrains/intellij-obsolete-plugins
7abf3f10603e7fe42b9982b49171de839870e535
3e388a1f9ae5195dc538df0d3008841c61f11aef
refs/heads/master
2023-09-04T05:22:46.470136
2023-06-11T16:42:37
2023-06-11T16:42:37
184,035,533
19
29
Apache-2.0
2023-07-30T14:23:05
2019-04-29T08:54:54
Java
UTF-8
Java
false
false
1,682
java
package com.intellij.dmserver.libraries; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.vfs.JarFileSystem; import com.intellij.openapi.vfs.VirtualFile; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.Nullable; import org.jetbrains.osgi.jps.build.CachingBundleInfoProvider; /** * @author michael.golubev */ public final class BundleWrapper extends BundleDefinition { private static final Logger LOG = Logger.getInstance(BundleWrapper.class); @NonNls private static final String MANIFEST_PATH = "META-INF/MANIFEST.MF"; @Nullable public static BundleWrapper load(VirtualFile jarFile) { String path = jarFile.getPath(); if (!CachingBundleInfoProvider.isBundle(path)) { return null; } VirtualFile bundleRoot = jarFile.isDirectory() ? jarFile : JarFileSystem.getInstance().getJarRootForLocalFile(jarFile); VirtualFile manifestFile = bundleRoot == null ? null : bundleRoot.findFileByRelativePath(MANIFEST_PATH); if (manifestFile == null) { LOG.error("Manifest is expected to exist"); } return new BundleWrapper(CachingBundleInfoProvider.getBundleSymbolicName(path), CachingBundleInfoProvider.getBundleVersion(path), jarFile, manifestFile); } private final VirtualFile myJarFile; private final VirtualFile myManifestFile; private BundleWrapper(String symbolicName, String version, VirtualFile jarFile, VirtualFile manifestFile) { super(symbolicName, version); myJarFile = jarFile; myManifestFile = manifestFile; } public VirtualFile getJarFile() { return myJarFile; } public VirtualFile getManifestFile() { return myManifestFile; } }
691b3b0b5240bf84ff000936a4da2a79d22b024a
2475a1741a24e0b1e62f734ce89f699528bec593
/project-scheduler-api/src/main/java/com/exercise/scheduler/api/controller/TaskController.java
c54957e53081806e84f3f8e2c5c43a91254633f3
[]
no_license
japili/scheduler
0dda8ef401a6858ddce490f3340d410cbc1481a6
66a965442cd9538a65a08a8302c14af80a7fed1d
refs/heads/master
2022-01-25T21:51:34.071623
2020-01-10T18:41:40
2020-01-10T18:41:40
233,107,204
0
0
null
2022-01-21T23:36:26
2020-01-10T18:27:47
Java
UTF-8
Java
false
false
3,630
java
/* * Copyright 2020 */ package com.exercise.scheduler.api.controller; import com.exercise.scheduler.api.resource.TaskResource; import com.exercise.scheduler.api.util.BeanUtil; import com.exercise.scheduler.persistence.model.Task; import com.exercise.scheduler.service.TaskService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; import java.util.List; /** * Created by japili on 09/01/2020. */ @RestController public class TaskController { @Autowired private TaskService taskService; @GetMapping("/projects/{projectId}/task") public List<TaskResource> getTasksByProjectId(@PathVariable String projectId) { List<Task> tasks = taskService.getTasks(projectId); List<TaskResource> taskResources = new ArrayList<>(); for (Task task : tasks) { taskResources.add(BeanUtil.convert(task, TaskResource.class)); } return taskResources; } @PostMapping("/projects/{projectId}/task") public TaskResource addTaskToProject(@PathVariable String projectId, @RequestBody TaskResource taskResource) { Task task = BeanUtil.convert(taskResource, Task.class); return BeanUtil.convert(taskService.addTaskToProject(projectId, task), TaskResource.class); } @GetMapping("/projects/{projectId}/task/{taskId}/dependencies") public List<TaskResource> getTaskDependecies(@PathVariable String projectId, @PathVariable String taskId) { Task task = taskService.getTask(taskId, projectId); List<TaskResource> taskResources = new ArrayList<>(); for (Task taskDependency : task.getTaskDependencies()) { taskResources.add(BeanUtil.convert(taskDependency, TaskResource.class)); } return taskResources; } @GetMapping("/projects/{projectId}/task/{taskId}/availableTasks") public List<TaskResource> getAvailableTasks(@PathVariable String projectId, @PathVariable String taskId) { List<Task> tasks = taskService.getAvailableTasks(taskId, projectId); List<TaskResource> taskResources = new ArrayList<>(); for (Task task : tasks) { taskResources.add(BeanUtil.convert(task, TaskResource.class)); } return taskResources; } @PostMapping("/projects/{projectId}/task/{taskId}/dependencies") public TaskResource addTaskDependency(@PathVariable String taskId, @PathVariable String projectId, @RequestBody List<String> taskIds) { Task updatedTask = taskService.addTaskDependency(taskId, projectId, taskIds); return BeanUtil.convert(updatedTask, TaskResource.class); } @GetMapping("/projects/{projectId}/schedule") public List<TaskResource> generateSchedule(@PathVariable String projectId) { List<Task> tasksWithScheduleDates = taskService.generateSchedule(projectId); List<TaskResource> taskResources = new ArrayList<>(); for (Task task : tasksWithScheduleDates) { taskResources.add(BeanUtil.convert(task, TaskResource.class)); } return taskResources; } }
568a6f3d60d8f269cf5e4c42314fb4c795813b90
f97a9e85ff4894835ee1b7643770908a7c41c087
/wb-core/src/main/java/com/wb/interact/Portal.java
0501c50093841a33ff979f55a29586cc8d8fdede
[ "Apache-2.0" ]
permissive
xiongxcodes/haohope-wb
1ee048e4103b9b168ef4bc50b8ed1f7759932bbc
da49ec117a72ef72c741772ba82a94ad5866e11c
refs/heads/master
2023-02-23T04:31:09.678830
2021-01-24T04:33:57
2021-01-24T04:33:57
332,143,434
0
0
null
null
null
null
UTF-8
Java
false
false
25,087
java
package com.wb.interact; import java.io.File; import java.util.ArrayList; import java.util.Iterator; import java.util.Map.Entry; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.json.JSONArray; import org.json.JSONObject; import com.wb.common.Base; import com.wb.common.Resource; import com.wb.common.Session; import com.wb.common.Str; import com.wb.common.Value; import com.wb.common.XwlBuffer; import com.wb.util.DbUtil; import com.wb.util.FileUtil; import com.wb.util.JsonUtil; import com.wb.util.StringUtil; import com.wb.util.SysUtil; import com.wb.util.WbUtil; import com.wb.util.WebUtil; public class Portal { private static JSONArray getModuleList(HttpServletRequest request, String path, String[] roles, int type) throws Exception { int displayType; if (type == 2) { displayType = 3; } else { displayType = type; } File base; if (path == null) { base = Base.modulePath; path = ""; } else { base = new File(Base.modulePath, path); if (!FileUtil.isAncestor(Base.modulePath, base)) { SysUtil.accessDenied(request); } } path = path + "/"; ArrayList<Entry<String, Integer>> fileNames = IDE.getSortedFile(base); JSONObject content = null; JSONArray fileArray = new JSONArray(); Iterator var19 = fileNames.iterator(); while (var19.hasNext()) { Entry<String, Integer> entry = (Entry)var19.next(); String fileName = (String)entry.getKey(); File file = new File(base, fileName); if (file.exists() && XwlBuffer.canDisplay(file, roles, displayType)) { boolean isFolder = file.isDirectory(); if (isFolder) { File configFile = new File(file, "folder.json"); if (configFile.exists()) { content = JsonUtil.readObject(configFile); } else { content = new JSONObject(); } } else { content = XwlBuffer.get(path + fileName); } JSONObject fileObject = new JSONObject(); String title = Str.getText(request, content.optString("title")); fileObject.put("text", StringUtil.select(new String[] {title, fileName})); String relPath = FileUtil.getModulePath(file); fileObject.put("path", relPath); fileObject.put("fileName", fileName); fileObject.put("inframe", Boolean.TRUE.equals(content.opt("inframe"))); if (isFolder) { fileObject.put("children", getModuleList(request, relPath, roles, type)); } else { String pageLink = (String)content.opt("pageLink"); if (!StringUtil.isEmpty(pageLink)) { fileObject.put("pageLink", pageLink); } fileObject.put("leaf", true); } if (type == 1) { fileObject.put("cls", "wb_pointer"); } String iconCls = content.optString("iconCls"); if (!StringUtil.isEmpty(iconCls)) { fileObject.put("iconCls", iconCls); } if (type == 2) { fileObject.put("checked", false); } fileArray.put(fileObject); } } return fileArray; } private static JSONArray getButtonList(HttpServletRequest request, String path, String[] roles, int type) throws Exception { int displayType; if (type == 2) { displayType = 3; } else { displayType = type; } File base; if (path == null) { base = Base.modulePath; path = ""; } else { base = new File(Base.modulePath, path); if (!FileUtil.isAncestor(Base.modulePath, base)) { SysUtil.accessDenied(request); } } path = path + "/"; ArrayList<Entry<String, Integer>> fileNames = IDE.getSortedFile(base); JSONObject content = null; JSONArray fileArray = new JSONArray(); Iterator var19 = fileNames.iterator(); String fileName = null; File file = null; JSONObject fileObject = null; String title = null; String iconCls = null; JSONObject button = null; String handler = null; String xtype = null; String afterrender = null; boolean selrecord = false; while (var19.hasNext()) { Entry<String, Integer> entry = (Entry)var19.next(); fileName = (String)entry.getKey(); file = new File(base, fileName); if (file.exists() && XwlBuffer.canDisplay(file, roles, displayType)) { boolean isFolder = file.isDirectory(); if (isFolder) { continue; } else { content = XwlBuffer.get(path + fileName); } fileObject = new JSONObject(); title = Str.getText(request, content.optString("title")); fileObject.put("text", StringUtil.select(new String[] {title, fileName})); iconCls = content.optString("iconCls"); if (!StringUtil.isEmpty(iconCls)) { fileObject.put("iconCls", iconCls); } fileObject.put("_tbar_button_", true); button = ((JSONObject)content.optJSONArray("children").get(0)).getJSONObject("configs"); handler = button.optString("button_handler"); if (!StringUtil.isEmpty(handler)) { fileObject.put("_handler_", handler); } xtype = button.optString("button_xtype"); if (!StringUtil.isEmpty(xtype)) { fileObject.put("xtype", xtype); } afterrender = button.optString("button_afterrender"); if (!StringUtil.isEmpty(afterrender)) { fileObject.put("_afterrender_", afterrender); } selrecord = button.optBoolean("button_selrecord", false); fileObject.put("_selrecord_", selrecord); if (selrecord) { fileObject.put("disabled", true); } fileArray.put(fileObject); } } return fileArray; } public static void getAppInfo(HttpServletRequest request, HttpServletResponse response) throws Exception { String url = FileUtil.getModulePath(request.getParameter("url")); if (!WbUtil.canAccess(request, url)) { SysUtil.accessDenied(request); } WebUtil.send(response, WbUtil.getAppInfo(url, request)); } public static void initHome(HttpServletRequest request, HttpServletResponse response) throws Exception { String desktopString = Resource.getString(request, "desktop", (String)null); String[] roles = Session.getRoles(request); if (desktopString == null) { desktopString = Resource.getString("sys.home.desktop", (String)null); } String userOptions; int treeWidth; int viewIndex; boolean treeCollapsed; boolean treeHidden; boolean navIconHidden; if (desktopString != null) { JSONObject desktop = new JSONObject(desktopString); userOptions = desktop.optString("userOptions", "{}"); treeWidth = desktop.optInt("treeWidth", 200); viewIndex = desktop.optInt("viewIndex", 2); treeCollapsed = desktop.optBoolean("treeCollapsed", false); treeHidden = desktop.optBoolean("treeHidden", false); navIconHidden = desktop.optBoolean("navIconHidden", true); JSONArray pages = desktop.optJSONArray("pages"); int i; int activeIndex; String url; String title; String pageLink; JSONObject portlet; JSONObject module; if (pages != null) { i = pages.length(); activeIndex = desktop.optInt("active", 0); JSONArray tabItems = new JSONArray(); for (int portlets = 0; portlets < i; ++portlets) { JSONObject page = pages.optJSONObject(portlets); pageLink = page.optString("url"); String k = FileUtil.getModulePath(pageLink, true); portlet = XwlBuffer.get(k, true); if (portlet != null && !WbUtil.canAccess(portlet, k, roles)) { portlet = null; } if (portlet == null) { if (i <= activeIndex) { --activeIndex; } } else { module = new JSONObject(); module.put("url", pageLink); String l = Str.getText(request, (String)portlet.opt("title")); module.put("title", StringUtil.select(new String[] {l, FileUtil.getFilename(k)})); module.put("iconCls", (String)portlet.opt("iconCls")); module.put("inframe", Boolean.TRUE.equals(portlet.opt("inframe"))); title = page.optString("params"); if (!StringUtil.isEmpty(title)) { module.put("params", new JSONObject(title)); } url = (String)portlet.opt("pageLink"); if (!StringUtil.isEmpty(url)) { JsonUtil.apply(module, new JSONObject(url)); } tabItems.put(module); } } request.setAttribute("activeIndex", Math.max(activeIndex, 0)); request.setAttribute("tabItems", StringUtil.text(tabItems.toString())); } JSONArray portlets = desktop.optJSONArray("portlets"); if (portlets != null) { activeIndex = portlets.length(); for (i = 0; i < activeIndex; ++i) { JSONArray cols = portlets.optJSONArray(i); int l = cols.length(); for (int k = 0; k < l; ++k) { portlet = cols.optJSONObject(k); url = FileUtil.getModulePath(portlet.optString("url"), true); module = XwlBuffer.get(url, true); if (module != null && !WbUtil.canAccess(module, url, roles)) { module = null; } if (module == null) { cols.remove(k); --k; --l; } else { title = Str.getText(request, (String)module.opt("title")); portlet.put("title", StringUtil.select(new String[] {title, FileUtil.getFilename(url)})); portlet.put("iconCls", (String)module.opt("iconCls")); portlet.put("inframe", Boolean.TRUE.equals(module.opt("inframe"))); pageLink = (String)module.opt("pageLink"); if (!StringUtil.isEmpty(pageLink)) { JsonUtil.apply(portlet, new JSONObject(pageLink)); } } } } request.setAttribute("portlets", StringUtil.text(portlets.toString())); } } else { userOptions = "{}"; treeWidth = 200; viewIndex = 2; treeCollapsed = false; treeHidden = false; navIconHidden = true; } request.setAttribute("treeWidth", treeWidth); request.setAttribute("viewIndex", viewIndex); request.setAttribute("treeCollapsed", treeCollapsed); request.setAttribute("treeHidden", treeHidden); request.setAttribute("navIconHidden", navIconHidden); request.setAttribute("userOptions", StringUtil.text(userOptions)); } public static void saveDesktop(HttpServletRequest request, HttpServletResponse response) throws Exception { doSaveDesktop(request, 1); } public static void saveAsDefaultDesktop(HttpServletRequest request, HttpServletResponse response) throws Exception { doSaveDesktop(request, 2); } public static void saveAsAllDesktop(HttpServletRequest request, HttpServletResponse response) throws Exception { doSaveDesktop(request, 3); } private static void doSaveDesktop(HttpServletRequest request, int type) throws Exception { JSONObject desktop = new JSONObject(); desktop.put("treeWidth", Integer.parseInt(request.getParameter("treeWidth"))); desktop.put("viewIndex", Integer.parseInt(request.getParameter("viewIndex"))); desktop.put("treeCollapsed", Boolean.parseBoolean(request.getParameter("treeCollapsed"))); desktop.put("treeHidden", Boolean.parseBoolean(request.getParameter("treeHidden"))); desktop.put("navIconHidden", Boolean.parseBoolean(request.getParameter("navIconHidden"))); desktop.put("pages", new JSONArray(request.getParameter("pages"))); desktop.put("portlets", new JSONArray(request.getParameter("portlets"))); desktop.put("active", Integer.parseInt(request.getParameter("active"))); desktop.put("userOptions", request.getParameter("userOptions")); if (type == 1) { Resource.set(request, "desktop", desktop.toString()); } else { if (type == 3) { DbUtil.run(request, "delete from WB_RESOURCE where RES_ID like '%@desktop'"); } Resource.set("sys.home.desktop", desktop.toString()); } } public static void saveUserOptions(HttpServletRequest request, HttpServletResponse response) throws Exception { String desktopString = Resource.getString(request, "desktop", (String)null); if (desktopString == null) { desktopString = Resource.getString("sys.home.desktop", (String)null); } JSONObject desktop = new JSONObject(StringUtil.select(new String[] {desktopString, "{}"})); desktop.put("userOptions", request.getParameter("userOptions")); Resource.set(request, "desktop", desktop.toString()); } public static String getButtonListText(HttpServletRequest request) throws Exception { return getButtonList(request, request.getParameter("xwl"), Session.getRoles(request), 1).toString(); } public static String getAppListText(HttpServletRequest request) throws Exception { JSONObject result = new JSONObject(); result.put("fileName", "Root"); result.put("children", getModuleList(request, request.getParameter("path"), Session.getRoles(request), 1)); return result.toString(); } public static void getAppList(HttpServletRequest request, HttpServletResponse response) throws Exception { WebUtil.send(response, getAppListText(request)); } public static void getPermList(HttpServletRequest request, HttpServletResponse response) throws Exception { WebUtil.send(response, (new JSONObject()).put("children", getModuleList(request, request.getParameter("path"), Session.getRoles(request), 2))); } public static void getUserPermList(HttpServletRequest request, HttpServletResponse response) throws Exception { WebUtil.send(response, (new JSONObject()).put("children", getModuleList(request, request.getParameter("path"), Session.getRoles(request), 3))); } public static void getAllList(HttpServletRequest request, HttpServletResponse response) throws Exception { WebUtil.send(response, (new JSONObject()).put("children", getModuleList(request, request.getParameter("path"), Session.getRoles(request), 4))); } public static void setTheme(HttpServletRequest request, HttpServletResponse response) throws Exception { String theme = request.getParameter("theme"); Value.set(request, "theme", theme); WebUtil.setSessionValue(request, "sys.theme", theme); } public static void setTouchTheme(HttpServletRequest request, HttpServletResponse response) throws Exception { String theme = request.getParameter("theme"); Value.set(request, "touchTheme", theme); WebUtil.setSessionValue(request, "sys.touchTheme", theme); } public static void initTouchHome(HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(false); boolean isNotLogin = session == null || session.getAttribute("sys.logined") == null; request.setAttribute("isNotLogin", isNotLogin ? 1 : 0); } private static void searchModule(HttpServletRequest request, HttpServletResponse response, boolean isPerm) throws Exception { JSONArray array = new JSONArray(); String query = request.getParameter("query").toLowerCase(); String[] roles = Session.getRoles(request); if (query.isEmpty()) { query = ".xwl"; } doSearchFile(request, Base.modulePath, query.toLowerCase(), "", "", array, isPerm, roles); WebUtil.send(response, (new JSONObject()).put("rows", array)); } public static void searchAppModule(HttpServletRequest request, HttpServletResponse response) throws Exception { searchModule(request, response, false); } public static void searchPermModule(HttpServletRequest request, HttpServletResponse response) throws Exception { searchModule(request, response, true); } private static boolean doSearchFile(HttpServletRequest request, File folder, String searchName, String parentText, String parentFile, JSONArray array, boolean isPerm, String[] roles) throws Exception { File[] files = FileUtil.listFiles(folder); File[] var14 = files; int var13 = files.length; for (int var12 = 0; var12 < var13; ++var12) { File file = var14[var12]; if (XwlBuffer.canDisplay(file, roles, isPerm ? 3 : 1)) { if (file.isDirectory()) { File indexFile = new File(file, "folder.json"); String folderFile = file.getName(); String folderTitle; JSONObject jo; if (indexFile.exists()) { jo = JsonUtil.readObject(indexFile); folderTitle = jo.optString("title"); if (folderTitle.isEmpty()) { folderTitle = folderFile; } } else { folderTitle = folderFile; } folderTitle = Str.getText(request, folderTitle); if (!isPerm && folderTitle.toLowerCase().indexOf(searchName) != -1) { jo = new JSONObject(); jo.put("path", parentText); jo.put("title", folderTitle); jo.put("file", folderFile); jo.put("parentFile", parentFile); jo.put("isFolder", true); array.put(jo); if (array.length() > 99) { return true; } } if (doSearchFile(request, file, searchName, StringUtil.concat(new String[] {parentText, "/", folderTitle}), StringUtil.concat(new String[] {parentFile, "/", folderFile}), array, isPerm, roles)) { return true; } } else { String path = FileUtil.getModulePath(file); if (path.endsWith(".xwl")) { JSONObject moduleData = XwlBuffer.get(path); String title = moduleData.optString("title"); if (title.isEmpty()) { title = path.substring(path.lastIndexOf(47) + 1); } title = Str.getText(request, title); if (title.toLowerCase().indexOf(searchName) != -1) { JSONObject jo = new JSONObject(); jo.put("path", parentText); jo.put("title", title); jo.put("file", file.getName()); jo.put("parentFile", parentFile); jo.put("isFolder", false); array.put(jo); if (array.length() > 99) { return true; } } } } } } return false; } public static void getMobileAppList(HttpServletRequest request, HttpServletResponse response) throws Exception { ArrayList<JSONObject> appList = new ArrayList(); JSONArray outputList = new JSONArray(); String[] roles = Session.getRoles(request); scanMobileApp(request, appList, new File(Base.modulePath, "apps"), roles); Iterator var6 = appList.iterator(); while (var6.hasNext()) { JSONObject jo = (JSONObject)var6.next(); outputList.put(jo); } WebUtil.send(response, (new JSONObject()).put("rows", outputList)); } private static void scanMobileApp(HttpServletRequest request, ArrayList<JSONObject> appList, File path, String[] roles) throws Exception { ArrayList<Entry<String, Integer>> fileNames = IDE.getSortedFile(path); Iterator var15 = fileNames.iterator(); while (var15.hasNext()) { Entry<String, Integer> entry = (Entry)var15.next(); String fileName = (String)entry.getKey(); File file = new File(path, fileName); if (XwlBuffer.canDisplay(file, roles, 2)) { if (file.isDirectory()) { scanMobileApp(request, appList, file, roles); } else { String url = FileUtil.getModulePath(file); JSONObject content = XwlBuffer.get(url, true); if (content != null) { JSONObject viewport = getViewport(content); if (viewport != null) { viewport = viewport.getJSONObject("configs"); JSONObject item = new JSONObject(); String title = Str.getText(request, content.optString("title")); item.put("title", StringUtil.select(new String[] {title, file.getName()})); String image = viewport.optString("appImage"); if (image.isEmpty()) { String glyph = viewport.optString("appGlyph"); if (glyph.isEmpty()) { item.put("glyph", "&#xf10a;"); } else { item.put("glyph", StringUtil.concat(new String[] {"&#x", glyph, ";"})); } } else { item.put("image", image); } item.put("url", url); appList.add(item); } } } } } } private static JSONObject getViewport(JSONObject rootNode) throws Exception { JSONObject module = (JSONObject)((JSONArray)rootNode.opt("children")).opt(0); JSONArray items = (JSONArray)module.opt("children"); if (items == null) { return null; } else { int j = items.length(); for (int i = 0; i < j; ++i) { JSONObject jo = (JSONObject)items.opt(i); if ("tviewport".equals(jo.opt("type"))) { return jo; } } return null; } } }
aa36e3cf613c65b3242c81c502bf04d7648fcb49
342077dcc7e1730d0d80f16a6131ae820a2d09a5
/src/Main.java
80ca26119eca744421357b0f7c51be6751669ed4
[]
no_license
ngweihow/binary_tree_algorithms
c5ec02c7df91c0737ec62e4cdb5f61ca503a7633
38832a5344dc29b255d9eced7a6a34f23f8c58f4
refs/heads/master
2020-05-09T19:27:34.947883
2019-04-21T05:55:58
2019-04-21T05:55:58
181,379,215
0
0
null
null
null
null
UTF-8
Java
false
false
1,071
java
import java.util.Random; public class Main { public static final int MAX_TREE = 100; public static final int MAX_NODE = 10000; public static void main(String[] args) { System.out.println("Hello World!"); Random random = new Random(); Tree tree = new Tree(random.nextInt(MAX_TREE)); //tree.initTree(); // Test Search Node root = new Node(6); tree.setRoot(root); tree.insertNode(null, root); tree.insertNode(tree.getRoot(), new Node(7)); tree.insertNode(tree.getRoot(), new Node(8)); tree.insertNode(tree.getRoot(), new Node(3)); tree.insertNode(tree.getRoot(), new Node(5)); tree.printTree(); tree.deleteNode(tree.getRoot(), new Node(5)); tree.printTree(); System.out.println(tree.treeSearch(root, new Node(9))); System.out.println(tree.lowestCommonAncestor(tree.getRoot(), new Node(3), new Node(8)).val); // Invert Binary Tree tree.invertBinaryTree(tree.getRoot()); tree.printTree(); } }
3f7c2f717e49af2dbe3cd587e5827e8e11a0c814
c1d6c67e5778c5d7e2a2a5d04f4acf929ca35a11
/mb-bg-ext-core/src/main/java/com/mb/ext/core/service/spec/ActivityDTO.java
20b2e3c4b4ce4885e791c5d468942d520cca858f
[]
no_license
CHANGQINGLUO/community-backend
653cb9fbb14009e5d550ead6474680750733baab
3d3a9bc05d28a16027bffb02f53c70fbf8891c46
refs/heads/master
2021-01-17T17:37:54.652271
2016-06-15T15:40:05
2016-06-15T15:40:05
59,839,200
0
0
null
null
null
null
UTF-8
Java
false
false
1,177
java
package com.mb.ext.core.service.spec; public class ActivityDTO extends BodyDTO { private static final long serialVersionUID = 1L; private String uuid; private String title; private String datetime; private String address; private String venue; private String desription; private UserDTO initiator; public String getUuid() { return uuid; } public void setUuid(String uuid) { this.uuid = uuid; } public String getDatetime() { return datetime; } public void setDatetime(String datetime) { this.datetime = datetime; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getDesription() { return desription; } public void setDesription(String desription) { this.desription = desription; } public UserDTO getInitiator() { return initiator; } public void setInitiator(UserDTO initiator) { this.initiator = initiator; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public String getVenue() { return venue; } public void setVenue(String venue) { this.venue = venue; } }
1e2990b5d4658633a497d48278e169c2f45fff5d
c52026fd7a1825d950a7ab08c1c918cb0fe851d8
/src/main/java/com/vasit/uaa/security/jwt/JWTFilter.java
a6cadd04df1e981c58b7978f83366d9b14ceb1f4
[]
no_license
juntong/uaa
3e7da6bb108127a72163e1609cb36746f4ad3d9c
5a9beed15a2beab0ca7240e97a9efbaca6ca336b
refs/heads/main
2023-04-08T22:36:16.772760
2021-04-19T06:19:43
2021-04-19T06:19:43
359,350,193
0
0
null
null
null
null
UTF-8
Java
false
false
1,845
java
package com.vasit.uaa.security.jwt; import java.io.IOException; import javax.servlet.FilterChain; import javax.servlet.ServletException; import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletRequest; import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.util.StringUtils; import org.springframework.web.filter.GenericFilterBean; /** * Filters incoming requests and installs a Spring Security principal if a header corresponding to a valid user is * found. */ public class JWTFilter extends GenericFilterBean { public static final String AUTHORIZATION_HEADER = "Authorization"; private final TokenProvider tokenProvider; public JWTFilter(TokenProvider tokenProvider) { this.tokenProvider = tokenProvider; } @Override public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException { HttpServletRequest httpServletRequest = (HttpServletRequest) servletRequest; String jwt = resolveToken(httpServletRequest); if (StringUtils.hasText(jwt) && this.tokenProvider.validateToken(jwt)) { Authentication authentication = this.tokenProvider.getAuthentication(jwt); SecurityContextHolder.getContext().setAuthentication(authentication); } filterChain.doFilter(servletRequest, servletResponse); } private String resolveToken(HttpServletRequest request) { String bearerToken = request.getHeader(AUTHORIZATION_HEADER); if (StringUtils.hasText(bearerToken) && bearerToken.startsWith("Bearer ")) { return bearerToken.substring(7); } return null; } }
024cee0ec9b0f1d85ac8d4d1cc3de4613ee500f5
2ec6ea2d6ef36b41f57cf7cb72dad3bb70541a9c
/domain_common/src/main/java/com/cnfantasia/server/domainbase/ebuyOrderDeliveryType/entity/EbuyOrderDeliveryType.java
e5d94752e370aeb8b2bfe4eaa36051f7d81c94a3
[]
no_license
6638112/propertyERP-2
b40dac0e6b96f51b351fcef03c9c530b9fc64938
8240b03f7c3ea195913bae467cac41e006c82c61
refs/heads/master
2023-07-08T17:07:20.127060
2018-03-19T07:13:05
2018-03-19T07:13:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,976
java
package com.cnfantasia.server.domainbase.ebuyOrderDeliveryType.entity; /* */ import java.io.Serializable;/* */ import java.math.BigInteger; import java.lang.Integer; /* import com.cnfantasia.server.domain.pub.BaseEntity; */ /** * 描述:(订单的配送设置) 实体类 * * @version 1.00 * @author null * */ /* */ public class EbuyOrderDeliveryType implements Serializable{ /* */ /* public class EbuyOrderDeliveryType extends BaseEntity{ */ private static final long serialVersionUID = 1L; /** */ private BigInteger id; /** 订单id */ private BigInteger tEbuyOrderFId; /** 供应商id */ private BigInteger tEbuySupplyMerchant; /** 配送方式 */ private Integer deliveryType; public EbuyOrderDeliveryType(){ } public EbuyOrderDeliveryType(EbuyOrderDeliveryType arg){ this.id = arg.getId(); this.tEbuyOrderFId = arg.gettEbuyOrderFId(); this.tEbuySupplyMerchant = arg.gettEbuySupplyMerchant(); this.deliveryType = arg.getDeliveryType(); } /** * * @param id * @param tEbuyOrderFId 订单id * @param tEbuySupplyMerchant 供应商id * @param deliveryType 配送方式 */ public EbuyOrderDeliveryType(BigInteger id,BigInteger tEbuyOrderFId,BigInteger tEbuySupplyMerchant,Integer deliveryType){ this.id = id; this.tEbuyOrderFId = tEbuyOrderFId; this.tEbuySupplyMerchant = tEbuySupplyMerchant; this.deliveryType = deliveryType; } @Override public String toString() { StringBuffer sbf = new StringBuffer(); sbf.append("id=").append(id).append(";"); sbf.append("tEbuyOrderFId=").append(tEbuyOrderFId).append(";"); sbf.append("tEbuySupplyMerchant=").append(tEbuySupplyMerchant).append(";"); sbf.append("deliveryType=").append(deliveryType).append(";"); return sbf.toString(); } public BigInteger getId() { return id; } public void setId(BigInteger id) { this.id = id; } public BigInteger gettEbuyOrderFId() { return tEbuyOrderFId; } public void settEbuyOrderFId(BigInteger tEbuyOrderFId) { this.tEbuyOrderFId = tEbuyOrderFId; } public BigInteger gettEbuySupplyMerchant() { return tEbuySupplyMerchant; } public void settEbuySupplyMerchant(BigInteger tEbuySupplyMerchant) { this.tEbuySupplyMerchant = tEbuySupplyMerchant; } public Integer getDeliveryType() { return deliveryType; } public void setDeliveryType(Integer deliveryType) { this.deliveryType = deliveryType; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; EbuyOrderDeliveryType other = (EbuyOrderDeliveryType) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } }
3b8b6583e53ecc7c0fa4ca1bef4c99bf4f0c621a
cbec7a145629c90b0f007852e053ec3d76d71554
/ProblemsOfAlgorithm(20-2)/src/BaekJoon/평범한배낭_12865.java
ef0a8eeada7e2f78ac684689222b6d645c635dea
[]
no_license
kimminkwon/ProblemsOfAlgorithm20_2
34bda52f05c0aa6401ece761dd226107158dba3c
45cf379091d05ad87df1acdba0210b97aeac868e
refs/heads/master
2023-05-21T02:17:39.626505
2021-06-14T13:57:04
2021-06-14T13:57:04
281,013,798
0
0
null
null
null
null
UTF-8
Java
false
false
1,754
java
package BaekJoon; import java.util.Arrays; import java.util.Scanner; public class 평범한배낭_12865 { private static int numOfItem; private static int maxWeight; private static int[][] items; private static int result; public static void main(String[] args) { makeInput(); knapsack(); printResult(); } private static void printResult() { System.out.println(result); } private static void knapsack() { int[][] dpKnap = new int[numOfItem + 1][maxWeight + 1]; for(int i = 0; i < numOfItem + 1; i++) dpKnap[i][0] = 0; for(int i = 0; i < maxWeight + 1; i++) dpKnap[0][i] = 0; for(int i = 1; i < numOfItem + 1; i++) { for(int j = 1; j < maxWeight + 1; j++) { // 1) i번째 물체의 무게를 포함할 수 없는 경우, i-1번째 물체까지일때 같은 무게와 다를게 없다. if(items[i][0] > j) { dpKnap[i][j] = dpKnap[i-1][j]; } else { // 2) i번째 물체의 무게를 포함할 수 있는 경우 // 2-1) i-1번째 물체까지일때 같은 무게가 효율적이거나, int case1 = dpKnap[i-1][j]; // 2-2) 현재 무게에서 i번쨰 물체의 무게를 뺀 뒤, i-1번째에서 해당 무게일 때의 최적값에 더한 값이 효율적이다. int w = j - items[i][0]; int case2 = dpKnap[i-1][w] + items[i][1]; dpKnap[i][j] = Math.max(case1, case2); } } } result = dpKnap[numOfItem][maxWeight]; } private static void makeInput() { Scanner input = new Scanner(System.in); numOfItem = input.nextInt(); maxWeight = input.nextInt(); items = new int[numOfItem + 1][2]; items[0][0] = 0; items[0][1] = 0; for(int i = 1; i < numOfItem + 1; i++) { items[i][0] = input.nextInt(); items[i][1] = input.nextInt(); } } }
7dde30552de4fa9c451c1998c0c377f672865b52
174fe4748575ea971e7fd6d34caf0d4cdf4c4a38
/app/src/main/java/com/theolympian/alu/NewsActivity.java
595ac8cf058ecdab4abf652aff7cd84972c190cf
[ "Apache-2.0" ]
permissive
Janofer-31j/NECAlumniApp-master
3ec261656368e67b988ab57e9b0bfdd9021ed844
6da5230c0cf3fe340bb2cdb4a75ba21aad45e723
refs/heads/master
2020-04-22T22:43:32.734821
2019-02-14T16:01:25
2019-02-14T16:01:25
170,718,165
0
0
null
null
null
null
UTF-8
Java
false
false
563
java
package com.theolympian.alu; import android.content.Context; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; public class NewsActivity extends NavigationDrawerActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); LayoutInflater inflator = (LayoutInflater) this.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View contentview=inflator.inflate(R.layout.activity_news, null, false); mDrawer.addView(contentview, 0); } }
a23384bf1cffdfa325c990f9185c8b2bebaf845d
c2f273e43d755326f067196c7b3b052e95ca8b9f
/server/src/main/java/dev/team/readtoday/server/user/application/profile/ProfileFetchingFailed.java
776baa4854e54a601c84972c7206ecef7dc3fba4
[]
no_license
javierorbe/readtoday
555fd9b33eca48aeaf50fc5cc5fa828aa12e1cd9
78b6c61934c149dd3fb0af043ebb930a18d75988
refs/heads/master
2023-05-12T02:22:28.835621
2021-05-20T06:01:41
2021-05-20T06:01:41
350,329,328
0
1
null
2021-05-20T14:47:17
2021-03-22T12:08:25
Java
UTF-8
Java
false
false
333
java
package dev.team.readtoday.server.user.application.profile; import java.io.Serial; public final class ProfileFetchingFailed extends RuntimeException { @Serial private static final long serialVersionUID = 9122222716247786898L; public ProfileFetchingFailed(String message, Exception cause) { super(message, cause); } }
354135d951bfcd7ad4e3407f320613cd7effacca
cb805bac66df9b10192c0f10cf6a7de3338458f1
/course-2021.03.13/src/main/java/com/liuyiyang/code/SymbolToEnglish.java
2d5c0c7abe5b5669b0a458338670a3daf2b48059
[ "Apache-2.0" ]
permissive
we-genesis/learning-zhangzhuo
12aff8aec0cbbd8beec158f39d06699fa719e534
1b34ed6ce6ca81e2d35199917f64dcf524a811a8
refs/heads/main
2023-04-19T13:02:08.933272
2021-04-29T18:17:14
2021-04-29T18:17:19
316,214,735
0
0
null
null
null
null
UTF-8
Java
false
false
2,110
java
package com.liuyiyang.code; /** * 第一题,某某公司开发一个编程工具,用来给代码自动生成注释,其中一个功能点,是把驼峰命名转为英文句子: * 例如某驼峰命名为: * getSystemResourceAsStream * 程序需要把该字符串转换为如下格式: * get system resource as stream * 顺便,做个单词翻转,最后输出: * teg metsys ecruoser sa maerts * 程序的原始输入就是标准的Java标识符 * 可能包含数字、大小写字母、下划线,下划线直接转为空格,数字两边都加空格,大写字母的前面加空格,只要单空格不要双空格 */ public class SymbolToEnglish { public static void main(String[] args) { StringBuilder sb = new StringBuilder(); String aString = "getSystemResourceAsStream"; for (int i = 0; i < aString.length(); i++) { char charAt = aString.charAt(i); if (charAt >= 'A' && charAt <= 'Z') { // 大写字母转为小写,前面加空格 sb.append(" " + String.valueOf((char) (charAt + 'a' - 'A'))); } else if (charAt >= '0' && charAt <= '9') { // 数字怎么处理?两边都加空格 sb.append(" " + String.valueOf(charAt) + ""); } else if (charAt == '_') { // 下划线直接转化为空格 sb.append(" "); } else if (charAt >= 'a' && charAt <= 'z') { // 小写字母不变 sb.append(String.valueOf(charAt)); } } String[] strings = sb.toString().replace(" ", " ").split(" "); for (int i = 0; i < strings.length; i++) { // get strings[i] = new StringBuilder(strings[i]).reverse().toString(); if (i == strings.length - 1) { System.out.print(strings[i]); } else { System.out.print(strings[i] + " "); } } System.out.println(); // get system resource as stream // teg metsys ecruoser sa maerts } }
3a23905429872f0be6d62ddae893cc37b73c91a3
57a9dcc5587dbbca2f8d4492be15f877fb30c770
/src/it/cinema/security/UserLoginServlet.java
58dc44605240b30391dc007b5595acbe8044bdcb
[]
no_license
SimoneMagliano/ProgettoFinale
43084ea9ad18d73a2b323c32941688996591d6fa
486d3e2ab17c9b9143fc1506fc18b0ba0da50b63
refs/heads/main
2023-07-17T00:55:24.080460
2021-08-30T20:27:47
2021-08-30T20:27:47
401,476,526
0
0
null
null
null
null
UTF-8
Java
false
false
1,536
java
package it.cinema.security; import java.io.*; import java.sql.SQLException; import javax.servlet.*; import javax.servlet.annotation.WebServlet; import javax.servlet.http.*; import it.cinema.dao.UserDAO; import it.cinema.entity.User; @WebServlet("/login") public class UserLoginServlet extends HttpServlet { private static final long serialVersionUID = 1L; public UserLoginServlet() { super(); } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String email = request.getParameter("email"); String password = request.getParameter("password"); UserDAO userDao = new UserDAO(); try { User user = userDao.checkLogin(email, password); String destPage = "index.jsp"; if (user != null) { HttpSession session = request.getSession(); session.setAttribute("user", user); destPage = "home.jsp"; } else { String message = "Email o Password errati"; request.setAttribute("message", message); } RequestDispatcher dispatcher = request.getRequestDispatcher(destPage); dispatcher.forward(request, response); } catch (SQLException | ClassNotFoundException ex) { throw new ServletException(ex); } } }
9673cc00320d6c81602db94d0686587ae19253e5
b478f69e80b48e9df53b054c05c5ece5db5a96b8
/Hellohi.java
0958e0d434054869e47ed0f9cbd7dfce86bfa65c
[]
no_license
skilrock123/rishabh
9186e0f227bb00ccdaaf72c4d6fedf2e52443d4e
7c9fb197831671e506cb7c381c9f4d8a07e492e5
refs/heads/master
2021-01-22T20:19:29.470515
2017-03-17T13:10:17
2017-03-17T13:10:17
85,312,683
0
0
null
2017-03-20T12:35:28
2017-03-17T13:07:52
Java
UTF-8
Java
false
false
92
java
class Hellohi { public static void main(String args[]) { system.out.println("jhakass"); }
cd31f7a3bc808285c636b164fc8a6b8a714bc9ed
75623123ed599ebfc18c131b0c72b54f41689c32
/src/java/it/csi/gescovid/acquistiapi/dto/test/Asr.java
b821183ebfbea85a2308da18b68fab0a8943fc8b
[]
no_license
regione-piemonte/gescovid19-acquistiapi
3e37381b8077e328fc16fff27c9b3c2a518af6e4
b54a6518dabd041b15107f32e114862905397dd1
refs/heads/master
2022-12-25T22:37:47.905887
2020-09-30T15:39:28
2020-09-30T15:39:28
299,950,678
0
1
null
null
null
null
UTF-8
Java
false
false
1,852
java
package it.csi.gescovid.acquistiapi.dto.test; import java.util.Objects; import java.util.ArrayList; import java.util.HashMap; import java.math.BigDecimal; import org.codehaus.jackson.annotate.JsonProperty; import org.codehaus.jackson.annotate.JsonCreator; import javax.validation.constraints.*; public class Asr { // verra' utilizzata la seguente strategia serializzazione degli attributi: [explicit-as-modeled] private BigDecimal codice = null; private String nome = null; /** * il codice identificativo della ASR **/ @JsonProperty("codice") public BigDecimal getCodice() { return codice; } public void setCodice(BigDecimal codice) { this.codice = codice; } /** * il nome dell&#39;AS **/ @JsonProperty("nome") public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Asr asr = (Asr) o; return Objects.equals(codice, asr.codice) && Objects.equals(nome, asr.nome); } @Override public int hashCode() { return Objects.hash(codice, nome); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Asr {\n"); sb.append(" codice: ").append(toIndentedString(codice)).append("\n"); sb.append(" nome: ").append(toIndentedString(nome)).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 "); } }
bfb39b76b3b4f7961842f4336071ca4afdeb23ff
44ac70077f29bf2fd91a2bc7d53b6c8cf7339bad
/CD.java
3b0feecd9e18771f2c735ae6c923ae77bef6914d
[]
no_license
dixitamathur1108/JavaProject1
ea2faa0a00751da35fc25799e90f2a6b6b1208c5
c890d67e78f01635b752f9374cffa4b9bd2570eb
refs/heads/master
2020-12-15T12:33:26.071375
2020-01-20T13:12:03
2020-01-20T13:12:03
235,104,384
0
0
null
null
null
null
UTF-8
Java
false
false
1,356
java
package package1; public class CD extends MediaItem{ public CD(int uid, String title, int no_of_copies, int runtime, String artist, String genre) { super(uid, title, no_of_copies, runtime); this.artist=artist; this.genre=genre; // TODO Auto-generated constructor stub } private String artist, genre; @Override public void addItem() { // TODO Auto-generated method stub System.out.println("New CD added"); } @Override public void checkIn() { // TODO Auto-generated method stub System.out.println("Check In!!"); } @Override public void checkOut() { // TODO Auto-generated method stub System.out.println("Check Out!!"); } public String getArtist() { return artist; } public void setArtist(String artist) { this.artist = artist; } public String getGenre() { return genre; } public void setGenre(String genre) { this.genre = genre; } @Override protected int getPublished_year() { // TODO Auto-generated method stub return 0; } @Override public int getReleasing_year() { // TODO Auto-generated method stub return 0; } @Override public String setDirector() { // TODO Auto-generated method stub return null; } @Override public String setArtist() { // TODO Auto-generated method stub return null; } }
bbd8e717662b554d50895b58cf8c7e2380729c83
52e1df55839f01663b988e89d8b32b31990708e2
/src/main/java/com/kfpanda/util/MapUtils.java
a31df95ce3520cc99a1e110dd91d977972271639
[]
no_license
kfpanda/panda-core
84249f5d02fb44ea186967c6ed8d3de3a0bb87eb
b59c63c76265fdf9f52026269b64489bbee760b3
refs/heads/master
2022-11-18T07:36:02.656593
2020-03-01T02:14:20
2020-03-01T02:14:20
22,452,907
0
0
null
2022-11-15T23:59:49
2014-07-31T02:19:17
Java
UTF-8
Java
false
false
616
java
package com.kfpanda.util; import java.util.Map; /** * map 工具类 * @author kfpanda * @date 2015年1月7日 下午7:50:23 */ public class MapUtils { /** * 如果map的值为空,则放入默认的值 * @param map * @param key * @param defaultValue 默认值 */ @SuppressWarnings("all") public static void putIfNull(Map map,Object key,Object defaultValue) { if(key == null) throw new IllegalArgumentException("key must be not null"); if(map == null) throw new IllegalArgumentException("map must be not null"); if(map.get(key) == null) { map.put(key, defaultValue); } } }
98e44281c411723974efa8b18bcb1849eb644605
0f9176c8ee7dcdc37979a77aa9d9566e94b894ba
/homework/src/main/java/com/huwei/bean/Container.java
09a24a2f455b9f264434cb49a6d4bf33f963ca25
[]
no_license
KingJin-web/testSpring
580921063d899e897f01267e506d8c9d17e4076e
4a17e7fbb211c3ad72ab9a9306ccc0492501c279
refs/heads/master
2023-08-03T08:58:23.735295
2021-09-22T10:20:52
2021-09-22T10:20:52
354,485,933
0
0
null
null
null
null
UTF-8
Java
false
false
3,041
java
package com.huwei.bean; import org.springframework.stereotype.Component; import org.springframework.stereotype.Service; @Service @Component public class Container { public static final int LENGTH=5; //定义常量 private Object[] objs=new Object[ LENGTH ]; private int count; //计数器,计量objs数组实际存的已测量对象的数目 private Object max; //数组中最大值的对象 private Object min; //数组中最小值的对象 private double avg; //平均值 private double sum; //总值 private Measurable measurable; //用于测量的测量工具 private double objvalue; public double getObjvalue(){ return this.objvalue; } public Object[] getObjs(){ //只返回有效数据,无效数据不能返回 Object[] newojbs=new Object[count]; //根据count来创建一个新数组,将 objs数组的值复制到 新数组中 System.arraycopy(objs, 0, newojbs, 0, count); // System.arraycopy(); return newojbs; } //设置当前容器所使用的测量工具. public void setMeasurable( Measurable measurable){ this.measurable=measurable; // //因为测量工具已经更换,所以数据要清零 objs=new Object[ LENGTH ]; count=0; max=null; min=null; avg=0; } public Object getMax(){ return this.max; } public Object getMin(){ return this.min; } public double getAvg(){ return this.avg; } public void save( Object obj){ //判断对象是否为空null, 如果是null, 则返回 if( obj==null){ System.out.println("要测量的对象不能为空"); return; } //判断当前数组是否已经满了 count>=数组.length //TODO: 将数组做成动态数组, 2.0版本. if( count>= objs.length ){ //创建一个新数组,它的长度为 objs长度的两倍 Object[] newobjects=new Object[ objs.length*2 ]; //将objs中原来的值放到 新数组 System.arraycopy System.arraycopy(objs, 0, newobjects, 0, objs.length); // 将新数组的引用赋给 objs objs=newobjects; } //如果不能存了, 则返回. 将这个obj存到 objs数组中. objs[count]=obj; //调用measurable.measure( obj) 对obj进行测量,得到测量后的值 double objvalue=measurable.measure( obj ); // objvalue就是测量后的值 //判断当前这个obj是否是第一个被没的对象,如果是,则最大值和最小值都是这个obj if( count==0 ){ max=obj; min=obj; }else{ //如果不是第一个被测的对象, 将当前对象测量后的值与max及min进行比较,找到最大值与最小值存起来 max, min double maxvalue=measurable.measure( max ); //调用测量工具测出最大值 double minvalue=measurable.measure( min ); //调测量工具测出最小值 if( objvalue>maxvalue ){ max=obj; } if( objvalue<minvalue){ min=obj; } } //计数器加一, count++; //sum累加测量值 sum+= objvalue; //计算平均值 avg=sum/count; } }
849ccb132047e3e29378a539797c94e0c55c3c9a
94a8865e16d7b5b8cec605df2462c665026ec59f
/app/src/main/java/com/example/haoji/FloatView/DragView.java
a37093b8c79bc7ce57f9bf5d2c77603419855125
[]
no_license
wuhoulang/Mvp_build2
bf80fbeaf2751bba93a8522c04222e19a8d9f91b
4dafd34a0bb268053b3bef2d307844167154f969
refs/heads/master
2020-09-20T23:59:23.164942
2019-11-28T10:32:22
2019-11-28T10:32:22
224,622,560
0
0
null
null
null
null
UTF-8
Java
false
false
4,789
java
package com.example.haoji.FloatView; import android.animation.ObjectAnimator; import android.annotation.SuppressLint; import android.content.Context; import android.os.Handler; import android.os.Message; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.View; import android.view.WindowManager; import android.widget.ImageView; import com.example.haoji.utils.ScreenUtil; import static android.view.FrameMetrics.ANIMATION_DURATION; /** * Created by HAOJI on 2019/8/16. */ @SuppressLint("AppCompatCustomView") public class DragView extends ImageView{ private int width; private int height; private int screenWidth; private int screenHeight; private int KscreenWidth; private int KscreenHeight; private Context context; //是否拖动 private boolean isDrag=false; public boolean isDrag() { return isDrag; } public DragView(Context context) { super(context); this.context=context; } public DragView(Context context, AttributeSet attrs) { super(context, attrs); this.context=context; } @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); width=getMeasuredWidth(); height=getMeasuredHeight(); screenWidth= ScreenUtil.getScreenWidth(context); screenHeight=ScreenUtil.getScreenHeight(context)-getStatusBarHeight(); } public int getStatusBarHeight(){ int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android"); return getResources().getDimensionPixelSize(resourceId); } private float downX; private float downY; private float mTouchStartX; private float mTouchStartY; @Override public boolean onTouchEvent(MotionEvent event) { super.onTouchEvent(event); if (this.isEnabled()) { KscreenWidth= (int) event.getRawX(); KscreenHeight= (int) event.getRawY(); Log.e("Kscreen","KscreenWidth:"+KscreenWidth); Log.e("Kscreen","KscreenHeight:"+KscreenHeight); switch (event.getAction()) { case MotionEvent.ACTION_DOWN: isDrag=false; downX = event.getX(); downY = event.getY(); mTouchStartX = event.getRawX(); mTouchStartY = event.getRawY(); Log.e("kid","ACTION_MOVE"); break; case MotionEvent.ACTION_MOVE: setAlpha(0.5f); Log.e("kid","ACTION_MOVE"); final float xDistance = event.getX() - downX; final float yDistance = event.getY() - downY; int l,r,t,b; //当水平或者垂直滑动距离大于10,才算拖动事件 if (Math.abs(xDistance) >10 ||Math.abs(yDistance)>10) { Log.e("kid","Drag"); isDrag=true; l = (int) (getLeft() + xDistance); r = l+width; t = (int) (getTop() + yDistance); b = t+height; //不划出边界判断,此处应按照项目实际情况,因为本项目需求移动的位置是手机全屏, // 所以才能这么写,如果是固定区域,要得到父控件的宽高位置后再做处理 if(l<0){ l=0; r=l+width; }else if(r>screenWidth){ r=screenWidth; l=r-width; } if(t<0){ t=0; b=t+height; }else if(b>screenHeight){ b=screenHeight; t=b-height; } this.layout(l, t, r, b); } break; case MotionEvent.ACTION_UP: setAlpha(1.0f); Log.e("Kscreen","screenWidth:"+screenWidth/2); if(KscreenWidth<screenWidth/2){ ObjectAnimator.ofFloat(this,"translationX",KscreenWidth-downX,0).setDuration(500).start(); } // setPressed(false); break; case MotionEvent.ACTION_CANCEL: setPressed(false); break; } return true; } return false; } }
6f702990a47f7abb91ab5bc33f29f0923fb3266e
ae5eb1a38b4d22c82dfd67c86db73592094edc4b
/project220/src/main/java/org/gradle/test/performance/largejavamultiproject/project220/p1104/Production22093.java
7f92f3272cd9dab691770ca1b6fb5e7988870ed2
[]
no_license
big-guy/largeJavaMultiProject
405cc7f55301e1fd87cee5878a165ec5d4a071aa
1cd6a3f9c59e9b13dffa35ad27d911114f253c33
refs/heads/main
2023-03-17T10:59:53.226128
2021-03-04T01:01:39
2021-03-04T01:01:39
344,307,977
0
0
null
null
null
null
UTF-8
Java
false
false
1,890
java
package org.gradle.test.performance.largejavamultiproject.project220.p1104; public class Production22093 { private String property0; public String getProperty0() { return property0; } public void setProperty0(String value) { property0 = value; } private String property1; public String getProperty1() { return property1; } public void setProperty1(String value) { property1 = value; } private String property2; public String getProperty2() { return property2; } public void setProperty2(String value) { property2 = value; } private String property3; public String getProperty3() { return property3; } public void setProperty3(String value) { property3 = value; } private String property4; public String getProperty4() { return property4; } public void setProperty4(String value) { property4 = value; } private String property5; public String getProperty5() { return property5; } public void setProperty5(String value) { property5 = value; } private String property6; public String getProperty6() { return property6; } public void setProperty6(String value) { property6 = value; } private String property7; public String getProperty7() { return property7; } public void setProperty7(String value) { property7 = value; } private String property8; public String getProperty8() { return property8; } public void setProperty8(String value) { property8 = value; } private String property9; public String getProperty9() { return property9; } public void setProperty9(String value) { property9 = value; } }
6453caf798853f959963e033b560afd5969e51c9
59d245bbb96541465082043a821a26883a01c731
/chapter6/gen/com/android/chapter6/R.java
5470fa84eb9285b6e823e4b18f537dc4081d3f32
[]
no_license
forevercqd/AndroidOpenGLES
52fe60c95f4186b3363cc55af3b03c4a3b869744
1b8d50227630f243114b450f95b9fba9b2ff2499
refs/heads/master
2020-12-13T14:26:34.740027
2020-01-17T01:22:10
2020-01-17T01:22:10
234,444,195
1
0
null
null
null
null
UTF-8
Java
false
false
642
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.android.chapter6; public final class R { public static final class attr { } public static final class drawable { public static final int icon=0x7f020000; } public static final class layout { public static final int main=0x7f030000; } public static final class string { public static final int app_name=0x7f040001; public static final int hello=0x7f040000; } }
71a2883d7f0acc5fdd69bfc0427a2a673ede245c
434112393389f4c03a5ae87ec402b94f8cef36c4
/PAYMAT2/app/src/main/java/com/example/paymat/about.java
f80391487a56f61cf6f138a65caf8411630648e1
[]
no_license
NOEL365/paymat
f30315ece6e506022e452d05d3bec1021c56cb73
5308eed69f87ad736f9bc0265fceccc5c5093c0f
refs/heads/master
2020-06-22T15:04:23.028003
2019-07-19T08:37:14
2019-07-19T08:37:14
197,734,455
0
0
null
null
null
null
UTF-8
Java
false
false
326
java
package com.example.paymat; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; public class about extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); } }
5a48c39eb5ca58be7488fad5c3010e77b7319384
9bee6c34db20f90cc1a2dc179e7dee9884b33add
/Code/Task List/src/com/company/Node.java
9510158390748e03dfaeb34dfa541b458d1292c9
[]
no_license
ammaridrees/Wait-Less
b8f8fa54ebb225350d4a2566f67aabe48cb11b6d
25299e294f74c8842f680268e0f7c5b646676e2f
refs/heads/master
2023-01-09T16:43:09.851786
2020-11-08T22:44:28
2020-11-08T22:44:28
301,572,269
1
0
null
null
null
null
UTF-8
Java
false
false
95
java
package com.company; public class Node { Task singleTask; Node next; Node tail; }
0a63978d5359a64f65b8f813f4d4e1bb72969be5
b9fa89583dd8d425d3bdcede97dbfdc27a986461
/app/src/main/java/com/cat/dongguk/dcatcare/UserData.java
2091de13b4d8f93ffc5a767ad21c0a8acbe6d130
[]
no_license
yjham2002/DcatCare
57b73a8b551618035c16487d366b0935fda798ce
a834cebaef7fd28f073762379e079e67e87a81ec
refs/heads/master
2021-01-20T19:27:30.118514
2016-08-04T06:59:10
2016-08-04T06:59:10
64,910,296
1
0
null
null
null
null
UTF-8
Java
false
false
135
java
package com.cat.dongguk.dcatcare; public class UserData { public int id, cat; public String mac, date, img_url, text, like; }
ca0ec77a1a54db6456726769398eede3abd4699d
f9ed6d1c47854aa4c839db3bf1bac464a1721a51
/src/main/java/pl/asie/charset/module/immersion/stacks/BlockStacks.java
ee4220e48f0d7f2122be275c7dc295b08da24e78
[]
no_license
modmuss50/Charset
313a0dc444c9a5d4da590aaa2238ceac38b458ab
dff4a0daa41efa4ceff91f99936defbfd01524ba
refs/heads/1.12
2021-01-04T22:25:59.619538
2018-04-25T12:42:22
2018-04-25T12:42:22
131,020,394
1
0
null
2018-04-25T14:38:05
2018-04-25T14:38:04
null
UTF-8
Java
false
false
9,528
java
/* * Copyright (c) 2015, 2016, 2017, 2018 Adrian Siekierka * * This file is part of Charset. * * Charset is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Charset is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Charset. If not, see <http://www.gnu.org/licenses/>. */ package pl.asie.charset.module.immersion.stacks; import gnu.trove.map.TObjectIntMap; import gnu.trove.map.hash.TObjectIntHashMap; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.particle.ParticleManager; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.property.ExtendedBlockState; import net.minecraftforge.common.property.IExtendedBlockState; import net.minecraftforge.common.property.IUnlistedProperty; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import pl.asie.charset.lib.block.BlockBase; import pl.asie.charset.lib.material.ItemMaterial; import pl.asie.charset.lib.material.ItemMaterialRegistry; import pl.asie.charset.lib.utils.RayTraceUtils; import pl.asie.charset.lib.utils.UnlistedPropertyGeneric; import javax.annotation.Nullable; import java.util.List; import java.util.WeakHashMap; public class BlockStacks extends BlockBase implements ITileEntityProvider { protected static final UnlistedPropertyGeneric<TileEntityStacks> PROPERTY_TILE = new UnlistedPropertyGeneric<>("tile", TileEntityStacks.class); public BlockStacks() { super(Material.IRON); setFullCube(false); setOpaqueCube(false); setSoundType(SoundType.METAL); setHardness(0.0F); setUnlocalizedName("charset.stacks"); } @Override @SideOnly(Side.CLIENT) public AxisAlignedBB getSelectedBoundingBox(IBlockState state, World worldIn, BlockPos pos) { RayTraceResult result = collisionRayTrace(state, worldIn, pos, RayTraceUtils.getStart(Minecraft.getMinecraft().player), RayTraceUtils.getEnd(Minecraft.getMinecraft().player)); if (result != null) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityStacks) { int id = result.subHit & 63; return StackShapes.getIngotBox(id, ((TileEntityStacks) tile).stacks[id]).offset(pos); } } return state.getBoundingBox(worldIn, pos).offset(pos); } @Override public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, @Nullable Entity entityIn, boolean isActualState) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityStacks) { for (int i = 0; i < 64; i++) { if (((TileEntityStacks) tile).stacks[i] != null) { addCollisionBoxToList(pos, entityBox, collidingBoxes, StackShapes.getIngotBox(i, ((TileEntityStacks) tile).stacks[i])); } } } else { addCollisionBoxToList(pos, entityBox, collidingBoxes, FULL_BLOCK_AABB); } } @Override public RayTraceResult collisionRayTrace(IBlockState blockState, World worldIn, BlockPos pos, Vec3d start, Vec3d end) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityStacks) { double distance = Double.MAX_VALUE; RayTraceResult resultOut = null; for (int i = 0; i < 64; i++) { if (((TileEntityStacks) tile).stacks[i] != null) { RayTraceResult result = this.rayTrace(pos, start, end, StackShapes.getIngotBox(i, ((TileEntityStacks) tile).stacks[i])); if (result != null) { double dist = result.hitVec.squareDistanceTo(start); if (dist < distance) { resultOut = result; resultOut.subHit = i; distance = dist; } } } } return resultOut; } else { return this.rayTrace(pos, start, end, FULL_BLOCK_AABB); } } @Override @SideOnly(Side.CLIENT) public float getAmbientOcclusionLightValue(IBlockState state) { return 1.0f; } @Override @SideOnly(Side.CLIENT) public boolean isTranslucent(IBlockState state) { return true; } @Override @SideOnly(Side.CLIENT) public BlockRenderLayer getBlockLayer() { return BlockRenderLayer.CUTOUT; } @Override public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { TileEntity tile = source.getTileEntity(pos); if (tile instanceof TileEntityStacks) { int count = 0; for (int i = 63; i > 0; i--) { if (((TileEntityStacks) tile).stacks[i] != null) { count = i; break; } } float height = ((count + 7) / 8) * 0.125f; return new AxisAlignedBB( 0, 0, 0, 1, height, 1 ); } else { return FULL_BLOCK_AABB; } } @Override public void getDrops(NonNullList<ItemStack> drops, IBlockAccess world, BlockPos pos, IBlockState state, @Nullable TileEntity te, int fortune, boolean silkTouch) { if (te instanceof TileEntityStacks) { TObjectIntMap<ItemMaterial> materials = new TObjectIntHashMap<>(); for (ItemStack stack : ((TileEntityStacks) te).stacks) { if (stack != null) { // TODO: use an ItemStackHashSet materials.adjustOrPutValue(ItemMaterialRegistry.INSTANCE.getOrCreateMaterial(stack), 1, 1); } } for (ItemMaterial material : materials.keySet()) { ItemStack stack = material.getStack(); if (!stack.isEmpty()) { int count = materials.get(material); for (int i = 0; i < count; i += stack.getMaxStackSize()) { stack = stack.copy(); stack.setCount(Math.min(count - i, stack.getMaxStackSize())); drops.add(stack); } } } } } @Override public boolean removedByPlayer(IBlockState state, World worldIn, BlockPos pos, EntityPlayer player, boolean willHarvest) { this.onBlockHarvested(worldIn, pos, state, player); if (player.isCreative()) { NonNullList<ItemStack> drops = NonNullList.create(); getDrops(drops, worldIn, pos, state, worldIn.getTileEntity(pos), 0, false); for (ItemStack s : drops) { spawnAsEntity(worldIn, pos, s); } worldIn.setBlockToAir(pos); return true; } else { return !(cooldownMap.containsKey(player) && cooldownMap.get(player) >= worldIn.getTotalWorldTime()); } } @Override public boolean canHarvestBlock(IBlockAccess world, BlockPos pos, EntityPlayer player) { return true; } private final WeakHashMap<EntityPlayer, Long> cooldownMap = new WeakHashMap<>(); @Override public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) { if (te instanceof TileEntityStacks) { if (cooldownMap.containsKey(player) && cooldownMap.get(player) >= worldIn.getTotalWorldTime()) { return; } if (player.isSneaking()) { NonNullList<ItemStack> drops = NonNullList.create(); getDrops(drops, worldIn, pos, state, te, 0, false); for (ItemStack s : drops) { spawnAsEntity(worldIn, pos, s); } worldIn.setBlockToAir(pos); } else { cooldownMap.put(player, worldIn.getTotalWorldTime() + 1); RayTraceResult result = collisionRayTrace(state, worldIn, pos, RayTraceUtils.getStart(player), RayTraceUtils.getEnd(player)); Vec3d hitPos = result != null ? result.hitVec : null; ItemStack stackRemoved = ((TileEntityStacks) te).removeStack(false, hitPos); if (!stackRemoved.isEmpty()) { if (stackRemoved.getCount() > 1) { stackRemoved = stackRemoved.copy(); stackRemoved.setCount(1); } spawnAsEntity(worldIn, pos, stackRemoved); } if (((TileEntityStacks) te).isEmpty()) { worldIn.setBlockToAir(pos); } } } } @Override public IBlockState getExtendedState(IBlockState state, IBlockAccess world, BlockPos pos) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityStacks) { return ((IExtendedBlockState) state).withProperty(PROPERTY_TILE, (TileEntityStacks) tile); } else { return state; } } @Override protected BlockStateContainer createBlockState() { return new ExtendedBlockState(this, new IProperty[0], new IUnlistedProperty[]{PROPERTY_TILE}); } @Nullable @Override public TileEntity createNewTileEntity(World worldIn, int meta) { return new TileEntityStacks(); } @Override @SideOnly(Side.CLIENT) public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager manager) { return true; } @Override @SideOnly(Side.CLIENT) public boolean addHitEffects(IBlockState state, World world, RayTraceResult target, ParticleManager manager) { return true; } }
f1a50ef28c901c495ca1295d853f2ddde8e874e6
367ad9c28b9f22def452b6941eb8a36e5d938787
/7-trade-web-app/src/test/java/com/mycompany/biz/scraw/JdbcTst.java
9f6d7096eba20579f4f3a57e925e889bbedcb9ea
[]
no_license
stategen/stategen-demo-trade-server
a995db807a66002581d39e3c9fff0ee971a25d77
b424ee1b029ad4f9f2557dde51dd8a36d231febf
refs/heads/master
2023-07-19T20:10:55.763232
2021-02-08T00:03:54
2021-02-08T00:03:54
153,772,658
0
3
null
2023-07-18T13:46:06
2018-10-19T11:28:02
Java
UTF-8
Java
false
false
2,706
java
package com.mycompany.biz.scraw; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; import lombok.Cleanup; /** * 测试时间处理(java.sql.Date,Time,Timestamp),取出指定时间段的数据 * @author * */ public class JdbcTst { /** * 将字符串代表的日期转为long数字(格式:yyyy-MM-dd hh:mm:ss) * @param dateStr * @return */ public static long str2Date(String dateStr) { DateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); try { return format.parse(dateStr).getTime(); } catch (ParseException e) { e.printStackTrace(); return 0; } } public static void main(String[] args) { ResultSet rs = null; try { //加载驱动类 Class.forName("com.mysql.jdbc.Driver"); @Cleanup Connection conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/trade?useUnicode=true", "stategen", "stategen"); // ps = conn.prepareStatement("select * from t_user where regTime>? and regTime<?"); // java.sql.Date start = new java.sql.Date(str2Date("2015-4-10 10:23:45")); // java.sql.Date end = new java.sql.Date(str2Date("2015-4-13 10:23:45")); // ps.setObject(1, start); // ps.setObject(2, end); String sql =" select\r\n" + " a.hoppy_id,\r\n" + " a.hoppy_name,\r\n" + " a.create_time,\r\n" + " a.update_time,\r\n" + " a.delete_flag\r\n" + " from demo_hoppy a\r\n" + " where\r\n" + " a.delete_flag = 0\r\n" + " and a.create_time <= ?"; @Cleanup PreparedStatement ps = conn.prepareStatement(sql); Date end = new Date(); ps.setObject(1, end); rs = ps.executeQuery(); while (rs.next()) { System.out.println( rs.getInt("hoppy_id") + "--" + rs.getString("hoppy_name") + "--" + rs.getTimestamp("create_time")); } } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (SQLException e) { e.printStackTrace(); } } }
91e584bb5ff43ee81bde85f87b1c75be10bace8b
0ab192f78db322bb9005dc29b4414b07184bc076
/src/com/shakshin/isoparser/Trace.java
4eba68dcc5ed22ec483fc9d12765214f7b8f5f68
[]
no_license
scalpovich/isoparser
5fe99dbc75297512295b5e74c6541f25eca7172f
e4c702ee44c1d6ec9f1ce6e71424b185661fbfce
refs/heads/master
2023-03-01T04:44:12.027774
2021-02-05T18:14:02
2021-02-05T18:14:02
null
0
0
null
null
null
null
UTF-8
Java
false
false
399
java
package com.shakshin.isoparser; import com.shakshin.isoparser.configuration.Configuration; public class Trace { public static Configuration cfg = null; public static void log(String who, String msg) { if (cfg == null) cfg = Configuration.get(); if (cfg != null && !cfg.trace) return; System.out.println(String.format("[%s]: %s", who, msg)); }; }
b93b53c0b1c98ea1205aa501ed319bed082e7ec7
4bb0c096afeb63358838dbbd9ce33f65370e0319
/MazeApp.java
bc5e45ce7e27f2cbaf4834632aab35d3f4edfee1
[]
no_license
nac018/MazeWithStackAndQueue
6e2d0d55f2862e23d5ee5e23db3bbd77381ab2f3
6986b0edac7ac9f56d932b408e4fcc236284b9d7
refs/heads/master
2022-10-14T04:08:09.913211
2020-06-08T18:29:10
2020-06-08T18:29:10
110,781,946
0
0
null
null
null
null
UTF-8
Java
false
false
10,674
java
package hw4; /** * The CSCI 151 Amazing Maze Solver GUI application. * * Students should not need to modify anything in this file. * * @author Benjamin Kuperman (Spring 2012) * */ import java.awt.*; import java.awt.event.*; import java.io.File; import javax.swing.*; import javax.swing.filechooser.FileFilter; public class MazeApp extends JFrame implements ActionListener { // Initial font size for the display private static int fontSize = 16; // Initial interval between animation in milliseconds private static int timerInterval = 500; private static final long serialVersionUID = 6228378229836664288L; // Fields for internal data representation Maze maze; MazeSolver solver; boolean mazeLoaded; // Fields for GUI interface JTextField filename; JTextField timerField; JTextField fontField; JTextArea mazeDisplay; JTextArea pathDisplay; JButton loadButton; JButton solveButton; JButton stepButton; JButton solverType; JButton resetButton; JButton quitButton; Timer timer; /** * Constructor -- does most of the work setting up the GUI. */ public MazeApp() { // Set up the frame super("Amazing Maze Solver"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Field for the maze file name filename = new JTextField(10); filename.setEditable(false); filename.setText("<no maze loaded>"); // Timer and font size fields timerField = new JTextField(5); fontField = new JTextField(5); // Glue text and input together JPanel filenamePanel = new JPanel(new BorderLayout()); filenamePanel.add(new JLabel("File: "), "West"); filenamePanel.add(filename, "Center"); JPanel fontPanel = new JPanel(new BorderLayout()); fontPanel.add(new JLabel("Font size:"), "West"); fontPanel.add(fontField, "Center"); JPanel timerPanel = new JPanel(new BorderLayout()); timerPanel.add(new JLabel("Timer (ms):"), "West"); timerPanel.add(timerField, "Center"); JPanel controls = new JPanel(new FlowLayout()); controls.add(timerPanel); controls.add(fontPanel); // Create the buttons loadButton = new JButton("load"); resetButton = new JButton("reset"); quitButton = new JButton("quit"); solverType = new JButton("stack"); solveButton = new JButton("start"); stepButton = new JButton("step"); // places to put all the top menu items JPanel buttons1 = new JPanel(new GridLayout(1, 3)); // top row of buttons JPanel buttons2 = new JPanel(new GridLayout(1, 3)); // bottom row of buttons JPanel buttonBar = new JPanel(new GridLayout(2, 2)); // combined layout of buttons // and text // load up the buttons in L to R order buttons1.add(loadButton); buttons1.add(resetButton); buttons1.add(quitButton); buttons2.add(solverType); buttons2.add(solveButton); buttons2.add(stepButton); // Glue the components together row by row buttonBar.add(filenamePanel); // top left buttonBar.add(buttons1); // top right buttonBar.add(controls); // bottom left buttonBar.add(buttons2); // bottom right // add padding from edges buttonBar.setBorder(BorderFactory.createEmptyBorder(10,10,0,10)); // Timer for the animations timer = new Timer(timerInterval, this); // Set up the bottom area to show the maze and path mazeDisplay = new JTextArea(20, 30); mazeDisplay.setEditable(false); pathDisplay = new JTextArea(4, 30); pathDisplay.setEditable(false); JPanel pane = new JPanel(new BorderLayout()); pane.setBorder(BorderFactory.createEmptyBorder( 10, //top 10, //left 10, //bottom 10) //right ); pane.add(new JScrollPane(mazeDisplay), "Center"); // let's maze be biggest pane.add(new JScrollPane(pathDisplay), "South"); // Create the overall layout (buttons on top, maze info below) JPanel panel = new JPanel(new BorderLayout()); panel.add(buttonBar,"North"); panel.add(pane); // add to the frame this.getContentPane().add(panel); // shrink wrap and display this.pack(); this.setLocationRelativeTo(null); // center this.setVisible(true); // Actionlisteners loadButton.addActionListener(this); filename.addActionListener(this); solveButton.addActionListener(this); solverType.addActionListener(this); stepButton.addActionListener(this); resetButton.addActionListener(this); quitButton.addActionListener(this); timerField.addActionListener(this); fontField.addActionListener(this); // Set up the class variables doTimer(); doFontSize(); mazeLoaded = false; this.maze = new Maze(); //makeNewSolver(); } /* * Collection of handlers to deal with GUI events. * * (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ @Override public void actionPerformed(ActionEvent e) { if ( (e.getSource() == loadButton) || (e.getSource() == filename) ){ loadFile(); } if (e.getSource() == solveButton) { if (mazeLoaded) { makeNewSolver(); solveButton(); } } if (e.getSource() == resetButton) { reset(); } if (e.getSource() == solverType) { toggleSolverType(); makeNewSolver(); } if (e.getSource() == quitButton) { doQuit(); } if (e.getSource() == timerField) { doTimer(); } if (e.getSource() == fontField) { doFontSize(); } if (e.getSource() == stepButton) { if (mazeLoaded) { //solver.addStartToWorklist(); doStep(); } } if (e.getSource() == timer) { // animate a step if (mazeLoaded) { //solver.addStartToWorklist(); doStep(); } } } /** * Allow the user to change the timer interval. */ private void doTimer() { int newValue = -1; try { newValue = Integer.parseInt(timerField.getText()); } catch (NumberFormatException nfe) { // do nothing } if (newValue>0) timerInterval = newValue; timerField.setText(Integer.toString(timerInterval)); timer.setDelay(timerInterval); } /** * Allow the user to change the font size. */ private void doFontSize() { int newValue = -1; try { newValue = Integer.parseInt(fontField.getText()); } catch (NumberFormatException nfe) { // do nothing } if (newValue>0) fontSize = newValue; fontField.setText(Integer.toString(fontSize)); mazeDisplay.setFont(new Font("Courier",Font.BOLD, fontSize)); pathDisplay.setFont(new Font("Courier",Font.BOLD, fontSize)); } /** * Allow the user to quit via button. */ private void doQuit() { System.exit(0); } /** * Set things back to the ready state. Called by the "reset" button * as well as many other methods. */ private void reset() { //need to add; makeNewSolver(); solver.makeEmpty(); maze.clearMaze(); updateMaze(); } /** * Performs a single step of the MazeSolver. Called when the * user clicks on "Step" as well as by the interval timer. */ private void doStep() { if (mazeLoaded && !solver.gameOver()) { solver.step(); if (solver.gameOver() || solver.isEmpty()) { solveButton(); solver.setGameOver(); timer.stop(); } } updateMaze(); } /** * Handles the user clicking on the solver type button. */ private void toggleSolverType() { String oldType = solverType.getText(); if (oldType.equalsIgnoreCase("queue")) { solverType.setText("stack"); } else if (oldType.equalsIgnoreCase("stack")) { solverType.setText("queue"); } else throw new UnsupportedOperationException("Don't know how to change from a: " + oldType); reset(); } /** * Builds a new MazeSolver of the type displayed on the button. */ private void makeNewSolver() { maze.clearMaze(); String oldType = solverType.getText(); if (oldType.equalsIgnoreCase("queue")) { solver = new MazeSolverQueue(this.maze); } else if (oldType.equalsIgnoreCase("stack")) { solver = new MazeSolverStack(this.maze); } else throw new UnsupportedOperationException("Don't know how to solve using a: " + oldType); } /** * Handles the starting/stopping of the timer. */ private void solveButton() { String label = solveButton.getText(); if (solver.gameOver()) { solveButton.setBackground(Color.white); solveButton.setText("start"); return; } if (label.equalsIgnoreCase("start")) { if ( mazeLoaded ) { solveButton.setText("stop"); solveButton.setBackground(Color.red); timer.start(); } } else if (label.equalsIgnoreCase("stop")) { solveButton.setText("start"); solveButton.setBackground(Color.green); timer.stop(); } } /** * Load a maze file into the solver. */ private void loadFile() { // Let the user pick from a filtered list of files JFileChooser chooser = new JFileChooser(new File(".")); chooser.setFileFilter(new FileFilter() { String description = "Maze files"; @Override public boolean accept(File f) { if (f.isDirectory()) { return true; } if (f.getName().startsWith("maze-")) return true; return false; } @Override public String getDescription() { return this.description; } }); File newFile = null; String newFileName = null; int returnVal = chooser.showOpenDialog(this); if(returnVal == JFileChooser.APPROVE_OPTION) { newFile = chooser.getSelectedFile(); newFileName = newFile.getName(); } else { // if they didn't pick a file, cancel the rest of the update return; } // Try to load it if (! maze.loadMaze(newFile.getPath()) ) { JOptionPane.showMessageDialog(this, "Cannot load file: "+newFileName); } else { // update name without path filename.setText(newFileName); // set things up as ready to go solveButton.setText("start"); solveButton.setBackground(Color.green); mazeLoaded=true; timer.stop(); reset(); } } /** * Update both the maze and the path text areas. */ private void updateMaze() { if (mazeLoaded) { // leave blank until first maze is loaded // update the maze mazeDisplay.setText(maze.toString()); //used to be toString() // update the path if (solver.gameOver()) { pathDisplay.setText(solver.getPath()); System.out.println(maze.toString()); } else { pathDisplay.setText("Maze is unsolved"); } } } /** * @param args */ public static void main(String[] args) { new MazeApp(); } }
af496a2c6bef479b8a34f2eb9cd306f862d12679
813a6974a9a60d237065b84f39d49ae2467c038e
/app/src/test/java/org/udu/alphamorze_android/ExampleUnitTest.java
c080d454733ce05f5dcd97f3717b6f0f2008f03e
[]
no_license
undefuser/AlphaMorze-android
d67c8d9eb4eec96804cd6f050e09388cbb06d1ce
4d7f967ef75be3ae5a972866e50b8b6dbd1c7d6c
refs/heads/master
2021-08-23T15:51:53.674688
2017-12-05T14:21:11
2017-12-05T14:21:11
111,670,757
0
0
null
null
null
null
UTF-8
Java
false
false
404
java
package org.udu.alphamorze_android; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } }
cffdf93efb0f37c878b9507d36c3f4d8da64ec48
e37d017ba2cc5c9bae996680d9a021ad1efd9a1b
/src/main/java/com/jury/rules/exception/OperatorException.java
3434fafbe9db6ba3671178485230fd93f8e2e882
[]
no_license
morganjury/jury-rules
faf114cbb3b6a719364a5c90755b2e6f871c3c92
dbcc1e16f8faeaf25e3a68511a387495df521cf0
refs/heads/master
2021-01-16T09:31:28.176399
2020-02-27T18:41:44
2020-02-27T18:41:44
243,063,003
0
0
null
2020-10-13T19:50:24
2020-02-25T17:48:33
Java
UTF-8
Java
false
false
194
java
package com.jury.rules.exception; public class OperatorException extends RuleException { public OperatorException() { } public OperatorException(String message) { super(message); } }
abd747454502b99de80a079808db78a897ad170d
2cf731177a6e130fda94b8eab009bed3072b2f48
/java_version_20/fireflow-engine/src/main/java/org/fireflow/client/impl/WorkflowSessionLocalImpl.java
35bc740015c0d65cebbd991cf5c029737bd61b9f
[]
no_license
TFMV/fireflow
3cbaf58ce40d04509d5349928990fe8cffacc46d
191762ef210fa6b0f326d507ebaeb6fd7d15ae56
refs/heads/master
2021-01-10T15:04:26.946562
2013-12-15T14:19:04
2013-12-15T14:19:04
44,412,974
0
1
null
null
null
null
UTF-8
Java
false
false
7,635
java
/** * Copyright 2007-2008 非也 * All rights reserved. * * 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。 * * 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 org.fireflow.client.impl; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; 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.XmlTransient; import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; import org.fireflow.client.WorkflowQuery; import org.fireflow.client.WorkflowSession; import org.fireflow.client.WorkflowStatement; import org.fireflow.client.query.WorkflowQueryDelegate; import org.fireflow.engine.context.RuntimeContext; import org.fireflow.engine.context.RuntimeContextAware; import org.fireflow.engine.entity.WorkflowEntity; import org.fireflow.engine.entity.runtime.ActivityInstance; import org.fireflow.engine.entity.runtime.ProcessInstance; import org.fireflow.engine.entity.runtime.WorkItem; import org.fireflow.engine.invocation.AssignmentHandler; import org.fireflow.engine.modules.ousystem.User; import org.fireflow.server.support.UserXmlAdapter; /** * @author chennieyun * */ @XmlRootElement(name="workflowSession") @XmlType(name="workflowSessionType",propOrder={"sessionId","currentUser"}) @XmlAccessorType(XmlAccessType.FIELD) public class WorkflowSessionLocalImpl implements WorkflowSession,RuntimeContextAware{ /** * */ private static final long serialVersionUID = -5596014590065796474L; @XmlTransient protected Map<String,Object> attributes = new HashMap<String,Object>(); @XmlTransient protected Map<String,AssignmentHandler> dynamicAssignmentHandlers = new HashMap<String,AssignmentHandler>(); @XmlTransient protected List<WorkItem> latestCreatedWorkItems = new ArrayList<WorkItem>(); @XmlTransient protected RuntimeContext context = null; @XmlElement(name="currentUser") @XmlJavaTypeAdapter(value = UserXmlAdapter.class) protected User currentUser = null; @XmlElement(name="sessionId") protected String sessionId = null; public String getSessionId(){ return sessionId; } public void setSessionId(String id){ sessionId = id; } public void clearAttributes() { this.attributes.clear(); } public Object getAttribute(String name) { return this.attributes.get(name); } public Object removeAttribute(String name) { return this.attributes.remove(name); } public WorkflowSession setAttribute(String name, Object attr) { this.attributes.put(name, attr); return this; } /* (non-Javadoc) * @see org.fireflow.engine.api.WorkflowSession#getCurrentUser() */ public User getCurrentUser() { return this.currentUser; } public void setCurrentUser(User currentUser){ this.currentUser = currentUser; } /* (non-Javadoc) * @see org.fireflow.engine.WorkflowSession#createWorkflowQuery(java.lang.Object) */ // public <T extends WorkflowEntity> WorkflowQuery<T> createWorkflowQuery(Class<T> c,String processType) { // WorkflowQueryImpl<T> query = new WorkflowQueryImpl<T>(this,c,processType); // return query; // } /* (non-Javadoc) * @see org.fireflow.engine.WorkflowSession#createWorkflowStatement() */ public WorkflowStatement createWorkflowStatement(String processType) { WorkflowStatementLocalImpl statement = new WorkflowStatementLocalImpl(this); statement.setProcessType(processType); return statement; } /* (non-Javadoc) * @see org.fireflow.engine.WorkflowSession#getCurrentActivityInstance() */ public ActivityInstance getCurrentActivityInstance() { return (ActivityInstance)this.attributes.get(CURRENT_ACTIVITY_INSTANCE); } public void setCurrentActivityInstance(ActivityInstance activityInstance){ this.setAttribute(CURRENT_ACTIVITY_INSTANCE, activityInstance); } /* (non-Javadoc) * @see org.fireflow.engine.WorkflowSession#getCurrentProcessInstance() */ public ProcessInstance getCurrentProcessInstance() { return (ProcessInstance)this.attributes.get(CURRENT_PROCESS_INSTANCE); } public void setCurrentProcessInstance(ProcessInstance processInstance){ this.setAttribute(CURRENT_PROCESS_INSTANCE, processInstance); } /* (non-Javadoc) * @see org.fireflow.engine.WorkflowSession#getLatestCreatedWorkItems() */ public List<WorkItem> getLatestCreatedWorkItems() { return latestCreatedWorkItems; } public void setLatestCreatedWorkItems(List<WorkItem> workItems){ if (workItems!=null){ latestCreatedWorkItems.addAll(workItems); } } /* (non-Javadoc) * @see org.fireflow.engine.WorkflowSession#putAllAttributes(java.util.Map) */ public WorkflowSession setAllAttributes(Map<String, Object> attributes) { if (attributes!=null){ this.attributes.putAll(attributes); } return this; } /** * @param ctx */ public void setRuntimeContext(RuntimeContext ctx){ this.context = ctx; } /** * @return */ public RuntimeContext getRuntimeContext(){ return this.context; } /** * 取得活动id等于activityId的动态分配句柄,并从session中将其删除。 * @param activityId * @return */ public AssignmentHandler consumeDynamicAssignmentHandler(String activityId) { return dynamicAssignmentHandlers.remove(activityId); } /* (non-Javadoc) * @see org.fireflow.engine.WorkflowSession#setDynamicAssignmentHandler(java.lang.String, org.fireflow.engine.service.human.AssignmentHandler) */ public WorkflowSession setDynamicAssignmentHandler(String activityId, AssignmentHandler assignmentHandler) { dynamicAssignmentHandlers.put(activityId, assignmentHandler); return this; } /* (non-Javadoc) * @see org.fireflow.engine.WorkflowSession#getAttributes() */ public Map<String, Object> getAllAttributes() { return this.attributes; } /* (non-Javadoc) * @see org.fireflow.engine.WorkflowSession#getDynamicAssignmentHandler() */ public Map<String, AssignmentHandler> getDynamicAssignmentHandler() { return this.dynamicAssignmentHandlers; } /* (non-Javadoc) * @see org.fireflow.engine.WorkflowSession#createWorkflowQuery(java.lang.Class) */ public <T extends WorkflowEntity> WorkflowQuery<T> createWorkflowQuery(Class<T> c) { WorkflowQueryImpl<T> query = new WorkflowQueryImpl<T>(c); WorkflowQueryDelegate delegate = (WorkflowQueryDelegate)this.createWorkflowStatement(context.getDefaultProcessType()); query.setQueryDelegate(delegate); return query; } /* (non-Javadoc) * @see org.fireflow.engine.WorkflowSession#createWorkflowStatement() */ public WorkflowStatement createWorkflowStatement() { WorkflowStatementLocalImpl statement = new WorkflowStatementLocalImpl(this); statement.setProcessType(context.getDefaultProcessType()); return statement; } }
4a0816e8a47ca3799d75e9100e0ce616837ff97a
895820ef35349ec5f3410372af8d795a21cf7569
/src/Arrays/OneDArrays/ContiguousSubarrayWithSum.java
421a8c230a0e64c74af18f9110aa3170f195f070
[]
no_license
dileep-msd/Leetcode_Solutions_Java
9b4f6e2714c342f0edfa8d6bf7ff8f06fbdfe2bf
8d3b4cd25131bc96d87d3cdb2d9ec1468b9cf809
refs/heads/master
2022-11-17T16:31:34.503279
2020-07-14T17:33:07
2020-07-14T17:33:07
null
0
0
null
null
null
null
UTF-8
Java
false
false
725
java
package Arrays.OneDArrays; public class ContiguousSubarrayWithSum { public static void main(String[] args) { int[] array = {2, 6, 1, 2, 4, 4}; int k = 7; findSubArray(array, k); } public static void findSubArray(int[] array, int k) { int start = 0; int sum = 0; for (int i = 0; i < array.length; i++) { while (start < i && sum > k) { sum -= array[start++]; } if (sum == k) { int end = i - 1; System.out.println("Subarray found at : " + start + " " + end); } if (i < array.length) { sum += array[i]; } } } }
[ "swersie723" ]
swersie723
bf0d1ca52b7fa92a1387104f63d72eb77c884a7c
c48ca6987fd76856687d5b6c8fc5487568cd6df5
/src/main/java/com/platform/parent/util/ClientCrendentialToken.java
79da691c0b7be81f6806d4c7df17176dea567fe2
[]
no_license
xuhaifengxhf/baojing
20cda848d57abefb65813dd1a61b72caa5e89c37
35713ca08a78abc6e6e53ac159f6ea006b049de3
refs/heads/master
2020-04-01T19:28:10.817908
2018-10-18T08:01:11
2018-10-18T08:01:11
153,555,249
0
1
null
null
null
null
UTF-8
Java
false
false
3,271
java
package com.platform.parent.util; import com.alibaba.fastjson.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.InputStream; import java.net.HttpURLConnection; public class ClientCrendentialToken { private static final Logger logger = LoggerFactory.getLogger(ClientCrendentialToken.class); private static String access_token = ""; private static String jsapi_ticket = ""; public static int time = 0; private static int expires_in = 7200; static{ Thread t = new Thread(new Runnable(){ public void run(){ do{ time++; try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } }while(true); }}); t.start(); } public static String getToken(){ if("".equals(access_token)||access_token==null){ send(); }else if(time>expires_in){ //当前token已经失效,从新获取信息 send(); } return access_token; } public static String getTicket(){ if("".equals(jsapi_ticket)||jsapi_ticket==null){ send(); }else if(time>expires_in){ //当前token已经失效,从新获取信息 send(); } return jsapi_ticket; } private static void send(){ String url = WXConfig.server_token_url + "&appid=" + WXConfig.appid + "&secret=" + WXConfig.appsecret; try { HttpURLConnection conn = HttpClientUtil.CreatePostHttpConnection(url.toString()); InputStream input = null; if (conn.getResponseCode() == 200) { input = conn.getInputStream(); } else { input = conn.getErrorStream(); } String result = new String(HttpClientUtil.readInputStream(input),"utf-8"); logger.info("In send got access_token result {}.", result); ClientToken ct = JSONObject.parseObject(result, ClientToken.class); access_token = ct.getAccess_token(); logger.info("In send got access_token {}.", access_token); String ticket_url = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token="+access_token+"&type=jsapi"; conn = HttpClientUtil.CreatePostHttpConnection(ticket_url.toString()); if (conn.getResponseCode() == 200) { input = conn.getInputStream(); } else { input = conn.getErrorStream(); } result = new String(HttpClientUtil.readInputStream(input),"utf-8"); logger.info("In send got jsapi_ticket result {}.", result); Ticket ticket = JSONObject.parseObject(result, Ticket.class); jsapi_ticket = ticket.getTicket(); logger.info("In send got jsapi_ticket {}.", jsapi_ticket); time = 0; } catch (Exception e) { logger.error("In send got exception {}.", e.getMessage()); } } }
[ "“[email protected]”" ]
a7d711efc5a64ac7a4ad7b6b9d436bb440ed668b
6df5a710a8ec10266c2065c99179d48c2fa53b4d
/Calculator/src/calculators/Programmer.java
f8b370c00937250295fc41bcc7b878ecad7f5878
[]
no_license
marin9/JavaApplications
f6cff46c0a6bd990cf08aee93a81713324284d0f
34af20eb74beb3af3865bc4ebf9b96755bb89f8f
refs/heads/master
2020-03-17T04:30:55.704127
2018-05-13T22:18:26
2018-05-13T22:18:26
null
0
0
null
null
null
null
UTF-8
Java
false
false
14,396
java
package calculators; import application.Main; import javafx.event.ActionEvent; import javafx.event.EventHandler; import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.control.Button; import javafx.scene.control.TextField; import javafx.scene.control.ToggleButton; import javafx.scene.layout.HBox; import javafx.scene.layout.Pane; import javafx.scene.layout.VBox; import m2math.MathParser; public class Programmer extends Pane{ private TextField display, binDisplay, decDisplay, octDisplay, hexDisplay; private ToggleButton binButton, decButton, octButton, hexButton; private Button[] buttons; private double ans=0; private char base; public Programmer(){ initGUI(); setListeners(); } private void initGUI(){ VBox vbox=new VBox(7); vbox.setPadding(new Insets(5)); binDisplay=new TextField(""); decDisplay=new TextField(""); octDisplay=new TextField(""); hexDisplay=new TextField(""); binDisplay.setAlignment(Pos.CENTER_RIGHT); decDisplay.setAlignment(Pos.CENTER_RIGHT); octDisplay.setAlignment(Pos.CENTER_RIGHT); hexDisplay.setAlignment(Pos.CENTER_RIGHT); binDisplay.setPrefColumnCount(19); decDisplay.setPrefColumnCount(19); octDisplay.setPrefColumnCount(19); hexDisplay.setPrefColumnCount(19); binDisplay.setEditable(false); decDisplay.setEditable(false); octDisplay.setEditable(false); hexDisplay.setEditable(false); binButton=new ToggleButton("BIN"); decButton=new ToggleButton("DEC"); base='d'; decButton.setSelected(true); octButton=new ToggleButton("OCT"); hexButton=new ToggleButton("HEX"); HBox hbox10=new HBox(9); hbox10.getChildren().addAll(binButton, binDisplay); HBox hbox9=new HBox(9); hbox9.getChildren().addAll(decButton, decDisplay); HBox hbox8=new HBox(9); hbox8.getChildren().addAll(octButton, octDisplay); HBox hbox7=new HBox(9); hbox7.getChildren().addAll(hexButton, hexDisplay); display=new TextField(""); display.setFocusTraversable(false); display.setAlignment(Pos.CENTER_LEFT); display.setPrefColumnCount(8); display.setStyle("-fx-background-color: #E0E0E0;" + "-fx-font-size: 20px;" + "-fx-font-weight: bold;"); buttons=new Button[36]; HBox hbox6=new HBox(9); buttons[35]=new Button("shL"); buttons[34]=new Button("shR"); buttons[33]=new Button("x\u00B2"); buttons[32]=new Button("x\u207F"); buttons[31]=new Button("del"); buttons[30]=new Button("C"); hbox6.getChildren().addAll(buttons[35], buttons[34], buttons[33], buttons[32], buttons[31], buttons[30]); HBox hbox5=new HBox(9); buttons[29]=new Button("asR"); buttons[28]=new Button("and"); buttons[27]=new Button("or"); buttons[26]=new Button("xor"); buttons[25]=new Button("not"); buttons[24]=new Button("mod"); hbox5.getChildren().addAll(buttons[29], buttons[28], buttons[27], buttons[26], buttons[25], buttons[24]); HBox hbox4=new HBox(9); buttons[23]=new Button("7"); buttons[22]=new Button("8"); buttons[21]=new Button("9"); buttons[20]=new Button("F"); buttons[19]=new Button("("); buttons[18]=new Button(")"); hbox4.getChildren().addAll(buttons[23], buttons[22], buttons[21], buttons[20], buttons[19], buttons[18]); HBox hbox3=new HBox(9); buttons[17]=new Button("4"); buttons[16]=new Button("5"); buttons[15]=new Button("6"); buttons[14]=new Button("E"); buttons[13]=new Button("*"); buttons[12]=new Button("/"); hbox3.getChildren().addAll(buttons[17], buttons[16], buttons[15], buttons[14], buttons[13], buttons[12]); HBox hbox2=new HBox(9); buttons[11]=new Button("1"); buttons[10]=new Button("2"); buttons[9]=new Button("3"); buttons[8]=new Button("D"); buttons[7]=new Button("+"); buttons[6]=new Button("-"); hbox2.getChildren().addAll(buttons[11], buttons[10], buttons[9], buttons[8], buttons[7], buttons[6]); HBox hbox1=new HBox(9); buttons[5]=new Button("0"); buttons[4]=new Button("A"); buttons[3]=new Button("B"); buttons[2]=new Button("C"); buttons[1]=new Button("Ans"); buttons[0]=new Button("="); hbox1.getChildren().addAll(buttons[5], buttons[4], buttons[3], buttons[2], buttons[1], buttons[0]); vbox.getChildren().addAll(hbox10, hbox9, hbox8, hbox7, display, hbox6, hbox5, hbox4, hbox3, hbox2, hbox1); getChildren().add(vbox); binButton.setPrefWidth(45); octButton.setPrefWidth(45); decButton.setPrefWidth(45); hexButton.setPrefWidth(45); binButton.getStylesheets().add(getClass().getResource("/calculators/toggle_button.css").toExternalForm()); decButton.getStylesheets().add(getClass().getResource("/calculators/toggle_button.css").toExternalForm()); octButton.getStylesheets().add(getClass().getResource("/calculators/toggle_button.css").toExternalForm()); hexButton.getStylesheets().add(getClass().getResource("/calculators/toggle_button.css").toExternalForm()); for(int i=0;i<36;++i){ buttons[i].setPrefHeight(30); buttons[i].setPrefWidth(45); if(i<24) buttons[i].getStylesheets().add(getClass().getResource("/calculators/button_cyan.css").toExternalForm()); else{ buttons[i].setStyle("-fx-font-size: 12px;" + "-fx-font-weight: bold;"); buttons[i].getStylesheets().add(getClass().getResource("/calculators/button_green.css").toExternalForm()); } } buttons[31].getStylesheets().add(getClass().getResource("/calculators/button_grey.css").toExternalForm()); buttons[30].getStylesheets().add(getClass().getResource("/calculators/button_grey.css").toExternalForm()); buttons[1].setPrefHeight(32); buttons[24].setStyle("-fx-font-size: 11px;" + "-fx-font-weight: bold;"); buttons[1].setStyle("-fx-font-size: 12px;" + "-fx-font-weight: bold;"); buttons[0].getStylesheets().add(getClass().getResource("/calculators/button_red.css").toExternalForm()); setDecKeyboard(); } private void setListeners(){ ButtonListener listener=new ButtonListener(); for(int i=0;i<buttons.length;++i){ buttons[i].setOnAction(listener); } ToggleListener tListener=new ToggleListener(); binButton.setOnAction(tListener); decButton.setOnAction(tListener); octButton.setOnAction(tListener); hexButton.setOnAction(tListener); } private void calculate(){ long result=0; try { Main.historyPane.append(display.getText()+" , "+base+"\n\n"); result = Math.round(MathParser.eval(display.getText(), false, ans, base)); ans=result; if(base=='b'){ display.setText(Long.toBinaryString(result)); Main.historyPane.append(" ="+Long.toBinaryString(result)+"\n\n"); }else if(base=='d'){ display.setText(""+result); Main.historyPane.append(" ="+result+"\n\n"); }else if(base=='o'){ display.setText(Long.toOctalString(result)); Main.historyPane.append(" ="+Long.toOctalString(result)+"\n\n"); } else if(base=='h'){ display.setText(Long.toHexString(result)); Main.historyPane.append(" ="+Long.toHexString(result)+"\n\n"); } binDisplay.setText(Long.toBinaryString(result)); decDisplay.setText(""+result); octDisplay.setText(Long.toOctalString(result)); hexDisplay.setText(Long.toHexString(result)); } catch (Exception e) { display.setText("Error."); binDisplay.setText(""); decDisplay.setText(""); octDisplay.setText(""); hexDisplay.setText(""); Main.historyPane.append(" = Error.\n\n"); } } private void setBinKeyboard(){ buttons[10].setDisable(true); //Button("2"); buttons[9].setDisable(true); //Button("3"); buttons[17].setDisable(true); //Button("4"); buttons[16].setDisable(true); //Button("5"); buttons[15].setDisable(true); //Button("6"); buttons[23].setDisable(true); //Button("7"); buttons[22].setDisable(true); //Button("8"); buttons[21].setDisable(true); //Button("9"); buttons[4].setDisable(true); //Button("A"); buttons[3].setDisable(true); //Button("B"); buttons[2].setDisable(true); //Button("C"); buttons[8].setDisable(true); //Button("D"); buttons[14].setDisable(true); //Button("E"); buttons[20].setDisable(true); //Button("F"); } private void setDecKeyboard(){ buttons[10].setDisable(false); //Button("2"); buttons[9].setDisable(false); //Button("3"); buttons[17].setDisable(false); //Button("4"); buttons[16].setDisable(false); //Button("5"); buttons[15].setDisable(false); //Button("6"); buttons[23].setDisable(false); //Button("7"); buttons[22].setDisable(false); //Button("8"); buttons[21].setDisable(false); //Button("9"); buttons[4].setDisable(true); //Button("A"); buttons[3].setDisable(true); //Button("B"); buttons[2].setDisable(true); //Button("C"); buttons[8].setDisable(true); //Button("D"); buttons[14].setDisable(true); //Button("E"); buttons[20].setDisable(true); //Button("F"); } private void setOctKeyboard(){ buttons[10].setDisable(false); //Button("2"); buttons[9].setDisable(false); //Button("3"); buttons[17].setDisable(false); //Button("4"); buttons[16].setDisable(false); //Button("5"); buttons[15].setDisable(false); //Button("6"); buttons[23].setDisable(false); //Button("7"); buttons[22].setDisable(true); //Button("8"); buttons[21].setDisable(true); //Button("9"); buttons[4].setDisable(true); //Button("A"); buttons[3].setDisable(true); //Button("B"); buttons[2].setDisable(true); //Button("C"); buttons[8].setDisable(true); //Button("D"); buttons[14].setDisable(true); //Button("E"); buttons[20].setDisable(true); //Button("F"); } private void setHexKeyboard(){ buttons[10].setDisable(false); //Button("2"); buttons[9].setDisable(false); //Button("3"); buttons[17].setDisable(false); //Button("4"); buttons[16].setDisable(false); //Button("5"); buttons[15].setDisable(false); //Button("6"); buttons[23].setDisable(false); //Button("7"); buttons[22].setDisable(false); //Button("8"); buttons[21].setDisable(false); //Button("9"); buttons[4].setDisable(false); //Button("A"); buttons[3].setDisable(false); //Button("B"); buttons[2].setDisable(false); //Button("C"); buttons[8].setDisable(false); //Button("D"); buttons[14].setDisable(false); //Button("E"); buttons[20].setDisable(false); //Button("F"); } private class ToggleListener implements EventHandler<ActionEvent>{ @Override public void handle(ActionEvent arg0) { ToggleButton btn=(ToggleButton)arg0.getSource(); if(btn==binButton){ base='b'; octButton.setSelected(false); decButton.setSelected(false); hexButton.setSelected(false); binButton.setSelected(true); setBinKeyboard(); }else if(btn==decButton){ base='d'; octButton.setSelected(false); binButton.setSelected(false); hexButton.setSelected(false); decButton.setSelected(true); setDecKeyboard(); }else if(btn==octButton){ base='o'; binButton.setSelected(false); decButton.setSelected(false); hexButton.setSelected(false); octButton.setSelected(true); setOctKeyboard(); }else if(btn==hexButton){ base='h'; octButton.setSelected(false); decButton.setSelected(false); binButton.setSelected(false); hexButton.setSelected(true); setHexKeyboard(); } display.setText(""); display.setText(""); binDisplay.setText(""); decDisplay.setText(""); octDisplay.setText(""); hexDisplay.setText(""); ans=0; } } private class ButtonListener implements EventHandler<ActionEvent>{ @Override public void handle(ActionEvent event) { Button btn=(Button)event.getSource(); if(btn==buttons[0]) calculate(); else if(btn==buttons[1]) display.appendText("Ans"); else if(btn==buttons[2]) display.appendText("C"); else if(btn==buttons[3]) display.appendText("B"); else if(btn==buttons[4]) display.appendText("A"); else if(btn==buttons[5]) display.appendText("0"); else if(btn==buttons[6]) display.appendText("-"); else if(btn==buttons[7]) display.appendText("+"); else if(btn==buttons[8]) display.appendText("D"); else if(btn==buttons[9]) display.appendText("3"); else if(btn==buttons[10]) display.appendText("2"); else if(btn==buttons[11]) display.appendText("1"); else if(btn==buttons[12]) display.appendText("/"); else if(btn==buttons[13]) display.appendText("*"); else if(btn==buttons[14]) display.appendText("E"); else if(btn==buttons[15]) display.appendText("6"); else if(btn==buttons[16]) display.appendText("5"); else if(btn==buttons[17]) display.appendText("4"); else if(btn==buttons[18]) display.appendText(")"); else if(btn==buttons[19]) display.appendText("("); else if(btn==buttons[20]) display.appendText("F"); else if(btn==buttons[21]) display.appendText("9"); else if(btn==buttons[22]) display.appendText("8"); else if(btn==buttons[23]) display.appendText("7"); else if(btn==buttons[24]) display.appendText("%"); else if(btn==buttons[25]) display.appendText("not("); else if(btn==buttons[26]) display.appendText("xor"); else if(btn==buttons[27]) display.appendText("or"); else if(btn==buttons[28]) display.appendText("and"); else if(btn==buttons[29]) display.appendText(">>>"); else if(btn==buttons[30]) { display.setText(""); binDisplay.setText(""); decDisplay.setText(""); octDisplay.setText(""); hexDisplay.setText(""); } else if(btn==buttons[31]) { String text=display.getText(); if(text.equals("")) return; text=text.substring(0, text.length()-1); display.setText(text); display.selectPositionCaret(text.length()); } else if(btn==buttons[32]) display.appendText("^"); else if(btn==buttons[33]) { if(base=='b') display.appendText("^(10)"); else display.appendText("^2"); } else if(btn==buttons[34]) display.appendText(">>"); else if(btn==buttons[35]) display.appendText("<<"); } } }
f56687db6486cbcad23bfb95b28892a593c4423a
b29a7dd721d7797c69c4fcb6db73a21815acb277
/boletin9_2/Boletin9_2.java
108871a8c3796c5069af98e7e3ad434390f78a39
[]
no_license
PabloVilaM/Programacion_Boletines7_8_9
ef5fdfe343f239882ead2276241c3e2fc29fb8bb
7caa14db75e7df03b7843c40d994070c685f6702
refs/heads/main
2023-08-26T02:53:46.083915
2021-11-10T11:38:36
2021-11-10T11:38:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
172
java
package boletin9_2; public class Boletin9_2 { public static void main(String[] args) { SumaM doit = new SumaM(); doit.facerSumayMul(); } }
f254620b52177aa1dfb5f739fba8fbcdbbde57b1
b144ec70268702e8dd0f76a7dfb70222337180ac
/auth/src/main/java/ru/job4j/auth/domain/Person.java
9a443819b7c518f601a67e438d2359047ef5628c
[]
no_license
Selesito/job4j_rest
8d1a3b9af338bfb13ec0f1c9ff6b7fb6b92ac87d
f16b8c7fcd0b19c417f86d6abb89ddcdb608efa1
refs/heads/master
2023-07-31T18:53:23.182160
2021-08-28T17:27:34
2021-08-28T17:27:34
385,693,040
0
0
null
null
null
null
UTF-8
Java
false
false
1,367
java
package ru.job4j.auth.domain; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import java.util.Objects; @Entity public class Person { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private int id; private String login; private String password; public static Person of(int id, String login, String password) { Person person = new Person(); person.setId(id); person.setLogin(login); person.setPassword(password); return person; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getLogin() { return login; } public void setLogin(String login) { this.login = login; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Person person = (Person) o; return id == person.id; } @Override public int hashCode() { return Objects.hash(id); } }
00484695cfae903bc22c4eca6c3ed73f0c59e1fb
ae5d79dde04149da151f5c5ee64130a6cf11992a
/src/main/java/com/qf/domain/BookCatalog.java
a61f7e4c1c847c5dd21f2a202b4796c908ef6820
[]
no_license
java1903-theseventhgroup/zhishu
8d3d49fe76a79ec59605fab87183692d7e550f3b
ec3e0680a0c4998289e1d6a28bc4867aa8f06b9f
refs/heads/master
2022-06-03T01:49:17.882737
2019-07-26T10:57:58
2019-07-26T10:57:58
199,001,065
0
0
null
2022-05-20T21:04:19
2019-07-26T10:54:20
Java
UTF-8
Java
false
false
338
java
package com.qf.domain; import lombok.Data; import java.io.Serializable; @Data public class BookCatalog implements Serializable { private Integer bookCatalogId; private Integer bookCatalogNum; private String bookCatalogName; private String bookCatalogInfo; private String bookRedioUrl; private Integer bId; }
c112a1430add6cd1cca8d4ab315134dd671a1cf4
9fcab821e0250a048f39e7db79ee3488e4c5dab1
/app/src/main/java/com/frontend/source/materialkit/adapter/AdapterListBasic.java
a8a8fabdf079017063721469493a68c245e1f753
[]
no_license
frontendsourcecode/Android-Material-Kit
342dbd9d952f9e95f134d76b11d2392a5ed17df7
dad61c979f1c28127120396107732746379a8939
refs/heads/master
2023-05-28T01:12:57.974151
2021-06-18T12:42:37
2021-06-18T12:42:37
378,133,949
1
0
null
null
null
null
UTF-8
Java
false
false
2,713
java
package com.frontend.source.materialkit.adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import androidx.recyclerview.widget.RecyclerView; import com.frontend.source.materialkit.R; import com.frontend.source.materialkit.model.People; import com.frontend.source.materialkit.utils.Tools; import java.util.ArrayList; import java.util.List; public class AdapterListBasic extends RecyclerView.Adapter<RecyclerView.ViewHolder> { private final Context ctx; private List<People> items = new ArrayList<>(); private OnItemClickListener mOnItemClickListener; public AdapterListBasic(Context context, List<People> items) { this.items = items; ctx = context; } public void setOnItemClickListener(final OnItemClickListener mItemClickListener) { this.mOnItemClickListener = mItemClickListener; } @Override public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { RecyclerView.ViewHolder vh; View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_people_chat, parent, false); vh = new OriginalViewHolder(v); return vh; } // Replace the contents of a view (invoked by the layout manager) @Override public void onBindViewHolder(RecyclerView.ViewHolder holder, final int position) { if (holder instanceof OriginalViewHolder) { OriginalViewHolder view = (OriginalViewHolder) holder; People p = items.get(position); view.name.setText(p.name); Tools.displayImageRound(ctx, view.image, p.image); view.lyt_parent.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { if (mOnItemClickListener != null) { mOnItemClickListener.onItemClick(view, items.get(position), position); } } }); } } @Override public int getItemCount() { return items.size(); } public interface OnItemClickListener { void onItemClick(View view, People obj, int position); } public class OriginalViewHolder extends RecyclerView.ViewHolder { public ImageView image; public TextView name; public View lyt_parent; public OriginalViewHolder(View v) { super(v); image = v.findViewById(R.id.image); name = v.findViewById(R.id.name); lyt_parent = v.findViewById(R.id.lyt_parent); } } }
763c336804647f01b1e573ef3f790ea545b332fb
a08fa8d4c23c8f32ceb3509a4157ae8f494f6567
/CS/SMC-CS-20B/Class_Activities/Activity9/bookCode/src/ch03/apps/LinkedListReverse.java
6bdffa8a2c75246837c15aa65a12bb2f23f754b1
[]
no_license
nashirj/Schoolwork
281819d2583479ddbc15238720ce241132a2dbf6
271a81c6400fd36ffac9cd1aa3b8e4d379201f4c
refs/heads/master
2021-04-09T19:08:02.470141
2020-03-21T22:07:54
2020-03-21T22:07:54
248,869,472
0
0
null
null
null
null
UTF-8
Java
false
false
2,675
java
//---------------------------------------------------------------------------- // LinkedListReverse.java by Dale/Joyce/Weems Chapter 3 // // Demonstrates both iterative and recursive reverse print of linked lists. // Tests the code developed for Section 3.7: Removing Recursion //---------------------------------------------------------------------------- package ch03.apps; import support.LLNode; import ch02.stacks.*; public class LinkedListReverse { static void recRevPrintList(LLNode<String> listRef) // Prints the contents of the listRef linked list to standard output // in reverse order { if (listRef != null) { recRevPrintList(listRef.getLink()); System.out.println(listRef.getInfo()); } } static void iterRevPrintList(LLNode<String> listRef) // Prints the contents of the listRef linked list to standard output // in reverse order { StackInterface<String> stack = new LinkedListStack<String>(); while (listRef != null) // put info onto the stack { stack.push(listRef.getInfo()); listRef = listRef.getLink(); } // Retrieve references in reverse order and print elements while (!stack.isEmpty()) { System.out.println(stack.top()); stack.pop(); } } public static void main(String[] args) { System.out.println("\n\nTesting empty list:"); LLNode<String> emptyList = null; System.out.println("\n recursive print: "); recRevPrintList(emptyList); System.out.println("\n iterative print: "); iterRevPrintList(emptyList); System.out.println("\n\nTesting list with: alpha:"); LLNode<String> temp1; temp1 = new LLNode<String>("alpha"); LLNode<String> singletonList = temp1; System.out.println("\n recursive print: "); recRevPrintList(singletonList); System.out.println("\n iterative print: "); iterRevPrintList(singletonList); System.out.println("\n\nTesting list with: alpha, beta, comma, delta, emma:"); LLNode<String> temp2, temp3, temp4, temp5; temp1 = new LLNode<String>("alpha"); temp2 = new LLNode<String>("beta"); temp3 = new LLNode<String>("comma"); temp4 = new LLNode<String>("delta"); temp5 = new LLNode<String>("emma"); LLNode<String> multiList = temp1; temp1.setLink(temp2); temp2.setLink(temp3); temp3.setLink(temp4); temp4.setLink(temp5); System.out.println("\n recursive print: "); recRevPrintList(multiList); System.out.println("\n iterative print: "); iterRevPrintList(multiList); } }
81937454db59a362b9696cc197705c9fb66ad57d
7d5917b74cb9a9d668de71ed224f9373166ad213
/src/ProxyWithJavaAssist/Martin/Example.java
e5823be71967bb90d5cecc1e0587e12dc530b3df
[]
no_license
ackhare/DynamicProxies
68f491e7738db6b80c1a1cafb5563246a29249e6
0900ab99c8a3891c069779e15faa06d8153eee22
refs/heads/master
2021-07-25T23:08:18.771953
2020-07-21T07:54:41
2020-07-21T07:54:41
74,195,514
3
0
null
null
null
null
UTF-8
Java
false
false
279
java
package ProxyWithJavaAssist.Martin; /** * Created by chetan on 19/11/16. */ public class Example implements IExample { private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } }
ff4c56b8f010a1a600f0beda89649dc672675bc4
ee82222c0420975149a3125661a349d2a7dfcff2
/src/com/ementalo/tcl/Permissions/BukkitPerms.java
bb74da1ab5b8e18a1916584cb8a7d1ff3270f866
[]
no_license
Kaos1337/TeleConfirmLite
51d214a36ee90d8c8df6a4e16389f5279eba0cf0
b3081e3c6a2e3c90be4bef57c9eac2e72570b92c
refs/heads/master
2020-04-07T09:17:53.231813
2012-03-11T17:37:36
2012-03-11T17:37:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
264
java
package com.ementalo.tcl.Permissions; import org.bukkit.entity.Player; public class BukkitPerms extends PermissionsBase { @Override public boolean hasPermission(Player player, String node) { return player.hasPermission(node); } }
c748c54e238f047aeaf0964e8fb28d5926efb979
54f352a242a8ad6ff5516703e91da61e08d9a9e6
/Source Codes/AtCoder/arc063/A/1187721.java
5e722db6d7fa7565ef6663604a9cd533183f05ea
[]
no_license
Kawser-nerd/CLCDSA
5cbd8a4c3f65173e4e8e0d7ed845574c4770c3eb
aee32551795763b54acb26856ab239370cac4e75
refs/heads/master
2022-02-09T11:08:56.588303
2022-01-26T18:53:40
2022-01-26T18:53:40
211,783,197
23
9
null
null
null
null
UTF-8
Java
false
false
330
java
import java.util.*; public class Main { static Scanner s = new Scanner(System.in); public static void main(String __[]){ solve(s.next()); } private static final void solve(String s) { int count=0; for(int i=1;i<s.length();i++) if(s.charAt(i)!=s.charAt(i-1)) count++; System.out.println(count); } }
af323b48c9936bed51ebe4c006ce4ea36ea8e243
8cc76558ba0227b83306a657ff43ff01d4934aaf
/src/Matrix.java
153375ab414e9777b95300d24008f1c122a2905a
[]
no_license
iSpammer/Eva
c918059e5d1b3355ac8e50b6a8498da8054c903e
99057f888de77e49a077e7cc4d19fe4d8236a023
refs/heads/master
2022-11-07T20:47:48.882465
2020-06-30T20:46:47
2020-06-30T20:46:47
276,205,195
0
0
null
null
null
null
UTF-8
Java
false
false
6,304
java
final public class Matrix { private final int M; // number of rows private final int N; // number of columns private final double[][] data; // M-by-N array // create M-by-N matrix of 0's public Matrix(int M, int N) { this.M = M; this.N = N; data = new double[M][N]; } // create matrix based on 2d array public Matrix(double[][] data) { M = data.length; N = data[0].length; this.data = new double[M][N]; for (int i = 0; i < M; i++) for (int j = 0; j < N; j++) this.data[i][j] = data[i][j]; } public Matrix(double[] data) { M = data.length; N = 1; this.data = new double[M][N]; for (int i = 0; i < M; i++) for (int j = 0; j < N; j++) this.data[i][j] = data[i]; } // copy constructor private Matrix(Matrix A) { this(A.data); } // create and return a random M-by-N matrix with values between 0 and 1 public static Matrix random(int M, int N) { Matrix A = new Matrix(M, N); for (int i = 0; i < M; i++) for (int j = 0; j < N; j++) A.data[i][j] = Math.random(); return A; } // create and return the N-by-N identity matrix public static Matrix identity(int N) { Matrix I = new Matrix(N, N); for (int i = 0; i < N; i++) I.data[i][i] = 1; return I; } // swap rows i and j private void swap(int i, int j) { double[] temp = data[i]; data[i] = data[j]; data[j] = temp; } // create and return the transpose of the invoking matrix public Matrix transpose() { Matrix A = new Matrix(N, M); for (int i = 0; i < M; i++) for (int j = 0; j < N; j++) A.data[j][i] = this.data[i][j]; return A; } // return C = A + B public Matrix plus(Matrix B) { Matrix A = this; if (B.M != A.M || B.N != A.N) throw new RuntimeException("Illegal matrix dimensions."); Matrix C = new Matrix(M, N); for (int i = 0; i < M; i++) for (int j = 0; j < N; j++) C.data[i][j] = A.data[i][j] + B.data[i][j]; return C; } // return C = A - B public Matrix minus(Matrix B) { Matrix A = this; if (B.M != A.M || B.N != A.N) throw new RuntimeException("Illegal matrix dimensions."); Matrix C = new Matrix(M, N); for (int i = 0; i < M; i++) for (int j = 0; j < N; j++) C.data[i][j] = A.data[i][j] - B.data[i][j]; return C; } // does A = B exactly? public boolean eq(Matrix B) { Matrix A = this; if (B.M != A.M || B.N != A.N) throw new RuntimeException("Illegal matrix dimensions."); for (int i = 0; i < M; i++) for (int j = 0; j < N; j++) if (A.data[i][j] != B.data[i][j]) return false; return true; } // return C = A * B public Matrix times(Matrix B) { Matrix A = this; if (A.N != B.M) throw new RuntimeException("Illegal matrix dimensions."); Matrix C = new Matrix(A.M, B.N); for (int i = 0; i < C.M; i++) for (int j = 0; j < C.N; j++) for (int k = 0; k < A.N; k++) C.data[i][j] += (A.data[i][k] * B.data[k][j]); return C; } // return x = A^-1 b, assuming A is square and has full rank public Matrix solve(Matrix rhs) { if (M != N || rhs.M != N || rhs.N != 1) throw new RuntimeException("Illegal matrix dimensions."); // create copies of the data Matrix A = new Matrix(this); Matrix b = new Matrix(rhs); // Gaussian elimination with partial pivoting for (int i = 0; i < N; i++) { // find pivot row and swap int max = i; for (int j = i + 1; j < N; j++) if (Math.abs(A.data[j][i]) > Math.abs(A.data[max][i])) max = j; A.swap(i, max); b.swap(i, max); // singular if (A.data[i][i] == 0.0) throw new RuntimeException("Matrix is singular."); // pivot within b for (int j = i + 1; j < N; j++) b.data[j][0] -= b.data[i][0] * A.data[j][i] / A.data[i][i]; // pivot within A for (int j = i + 1; j < N; j++) { double m = A.data[j][i] / A.data[i][i]; for (int k = i+1; k < N; k++) { A.data[j][k] -= A.data[i][k] * m; } A.data[j][i] = 0.0; } } // back substitution Matrix x = new Matrix(N, 1); for (int j = N - 1; j >= 0; j--) { double t = 0.0; for (int k = j + 1; k < N; k++) t += A.data[j][k] * x.data[k][0]; x.data[j][0] = (b.data[j][0] - t) / A.data[j][j]; } return x; } // print matrix to standard output public void show() { for (int i = 0; i < M; i++) { for (int j = 0; j < N; j++) System.out.printf("%9.4f ", data[i][j]); System.out.println(); } } // test client public static void main(String[] args) { double[][] d = { { 1, 2, 3 }, { 4, 5, 6 }, { 9, 1, 3} }; Matrix D = new Matrix(d); D.show(); System.out.println(); Matrix A = Matrix.random(5, 5); A.show(); System.out.println(); A.swap(1, 2); A.show(); System.out.println(); Matrix B = A.transpose(); B.show(); System.out.println(); Matrix C = Matrix.identity(5); C.show(); System.out.println(); A.plus(B).show(); System.out.println(); B.times(A).show(); System.out.println(); // shouldn't be equal since AB != BA in general System.out.println(A.times(B).eq(B.times(A))); System.out.println(); Matrix b = Matrix.random(5, 1); b.show(); System.out.println(); Matrix x = A.solve(b); x.show(); System.out.println(); A.times(x).show(); } }
965747aa22debd5769e53cdb9299bd6acc6484a3
d74c2ca437a58670dc8bfbf20a3babaecb7d0bea
/SAP_858310_lines/Source - 963k/js.webservices.lib/dev/src/_tc~je~webservices_lib/java/com/sap/engine/services/webservices/jaxr/impl/uddi_v2/types/getbindingdetail.java
d1b5836e816870ed388015d5f6609b945fd4d311
[]
no_license
javafullstackstudens/JAVA_SAP
e848e9e1a101baa4596ff27ce1aedb90e8dfaae8
f1b826bd8a13d1432e3ddd4845ac752208df4f05
refs/heads/master
2023-06-05T20:00:48.946268
2021-06-30T10:07:39
2021-06-30T10:07:39
381,657,064
0
0
null
null
null
null
UTF-8
Java
false
false
4,343
java
 package com.sap.engine.services.webservices.jaxr.impl.uddi_v2.types; /** * Schema complex type representation (generated by SAP Schema to Java generator). * Represents schema complex type {urn:uddi-org:api_v2}get_bindingDetail */ public class GetBindingDetail extends com.sap.engine.services.webservices.jaxrpc.encoding.GeneratedComplexType { public java.lang.String _d_originalUri() { return "urn:uddi-org:api_v2"; } public java.lang.String _d_originalLocalName() { return "get_bindingDetail"; } private static com.sap.engine.services.webservices.jaxrpc.encoding.AttributeInfo[] ATTRIBUTEINFO; private synchronized static void initAttribs() { // Creating attribute fields if (ATTRIBUTEINFO != null) return; ATTRIBUTEINFO = new com.sap.engine.services.webservices.jaxrpc.encoding.AttributeInfo[1]; ATTRIBUTEINFO[0] = new com.sap.engine.services.webservices.jaxrpc.encoding.AttributeInfo(); // Attribute 0 ATTRIBUTEINFO[0].fieldLocalName = "generic"; ATTRIBUTEINFO[0].fieldUri = ""; ATTRIBUTEINFO[0].fieldJavaName = "Generic"; ATTRIBUTEINFO[0].typeName = "string"; ATTRIBUTEINFO[0].typeUri = "http://www.w3.org/2001/XMLSchema"; ATTRIBUTEINFO[0].typeJavaName = "java.lang.String"; ATTRIBUTEINFO[0].defaultValue = null; ATTRIBUTEINFO[0].required = true; ATTRIBUTEINFO[0].setterMethod = "setGeneric"; ATTRIBUTEINFO[0].getterMethod = "getGeneric"; ATTRIBUTEINFO[0].checkMethod = "hasGeneric"; } // Field information private static com.sap.engine.services.webservices.jaxrpc.encoding.FieldInfo[] FIELDINFO; private synchronized static void initFields() { // Creating fields if (FIELDINFO != null) return; FIELDINFO = new com.sap.engine.services.webservices.jaxrpc.encoding.FieldInfo[1]; FIELDINFO[0] = new com.sap.engine.services.webservices.jaxrpc.encoding.FieldInfo(); // Field 0 FIELDINFO[0].defaultValue = null; FIELDINFO[0].fieldJavaName = "BindingKey"; FIELDINFO[0].fieldLocalName = "bindingKey"; FIELDINFO[0].fieldModel = 1; FIELDINFO[0].fieldUri = "urn:uddi-org:api_v2"; FIELDINFO[0].isSoapArray = false; FIELDINFO[0].maxOccurs = 2147483647; FIELDINFO[0].minOccurs = 1; FIELDINFO[0].nillable = false; FIELDINFO[0].soapArrayDimensions = 0; FIELDINFO[0].soapArrayItemTypeJavaName = null; FIELDINFO[0].soapArrayItemTypeLocalName = null; FIELDINFO[0].soapArrayItemTypeUri = null; FIELDINFO[0].typeJavaName = "java.lang.String"; FIELDINFO[0].typeLocalName = "bindingKey"; FIELDINFO[0].typeUri = "urn:uddi-org:api_v2"; FIELDINFO[0].getterMethod = "getBindingKey"; FIELDINFO[0].setterMethod = "setBindingKey"; FIELDINFO[0].checkMethod = "hasBindingKey"; } // Returns model Group Type public int _getModelType() { return 3; } // Attribute field private java.lang.String _a_Generic; private boolean _a_hasGeneric; // set method public void setGeneric(java.lang.String _Generic) { this._a_Generic = _Generic; this._a_hasGeneric = true; } // clear method public void clearGeneric(java.lang.String _Generic) { this._a_hasGeneric = false; } // get method public java.lang.String getGeneric() { return _a_Generic; } // has method public boolean hasGeneric() { return _a_hasGeneric; } // Element field private java.lang.String[] _f_BindingKey = new java.lang.String[0]; public void setBindingKey(java.lang.String[] _BindingKey) { this._f_BindingKey = _BindingKey; } public java.lang.String[] getBindingKey() { return _f_BindingKey; } private static boolean init = false; public synchronized com.sap.engine.services.webservices.jaxrpc.encoding.FieldInfo[] _getFields() { if (init == false) { com.sap.engine.services.webservices.jaxrpc.encoding.FieldInfo[] parent = super._getFields(); FIELDINFO = _insertFieldInfo(parent,FIELDINFO); init = true; } return FIELDINFO; } public int _getNumberOfFields() { return (FIELDINFO.length+super._getNumberOfFields()); } public com.sap.engine.services.webservices.jaxrpc.encoding.AttributeInfo[] _getAttributes() { return ATTRIBUTEINFO; } public int _getNumberOfAttributes() { return ATTRIBUTEINFO.length; } static { initFields(); initAttribs(); } }
a4b25c12d3a64efed992679a0d45556ed5ed40de
6a6010f483fc6d120d0a1629bc45d8f083023cf9
/app/src/main/java/com/tw2/myapplication/model/Gif.java
e06d7e292cc8ebc80ec17ea6ba163fdad24db641
[]
no_license
Tw2Studio/running-man
93d409a99ff289af8c1f2565e43df8e690bfabd4
958b51821c1ff510e3a51bbd45d3393752bb95af
refs/heads/master
2020-03-28T18:28:38.111327
2018-11-26T01:30:52
2018-11-26T01:30:52
148,884,535
0
0
null
null
null
null
UTF-8
Java
false
false
461
java
package com.tw2.myapplication.model; public class Gif { private String image; private String id; public Gif(String image, String id) { this.image = image; this.id = id; } public String getImage() { return image; } public void setImage(String image) { this.image = image; } public String getId() { return id; } public void setId(String id) { this.id = id; } }
fa3a08c9d037fb76d730d8ea84e93b0770b6601a
e75f6deead871a4938772a3bf5b33dc92e91927c
/org.oasis.oslcop.sysml.oslc-domain/src/main/java/org/oasis/oslcop/sysml/ISourceEnd.java
72366c5d0ff14de39a09daf864db411c515ce5ac
[]
no_license
jljohnson/sysml-oslc-server
09b6fcd5aeb4deeb548b6d77646a2a2b2e515c63
0d14bf7327b669edf0f69e1f92422ea59910e1d5
refs/heads/master
2023-01-19T08:32:59.666311
2020-11-10T15:26:28
2020-11-10T15:26:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,853
java
// Start of user code Copyright /******************************************************************************* * Copyright (c) 2012 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 * and Eclipse Distribution License v. 1.0 which accompanies this distribution. * * The Eclipse Public License is available at http://www.eclipse.org/legal/epl-v10.html * and the Eclipse Distribution License is available at * http://www.eclipse.org/org/documents/edl-v10.php. * * Contributors: * * Russell Boykin - initial API and implementation * Alberto Giammaria - initial API and implementation * Chris Peters - initial API and implementation * Gianluca Bernardini - initial API and implementation * Sam Padgett - initial API and implementation * Michael Fiedler - adapted for OSLC4J * Jad El-khoury - initial implementation of code generator (https://bugs.eclipse.org/bugs/show_bug.cgi?id=422448) * * This file is generated by org.eclipse.lyo.oslc4j.codegenerator *******************************************************************************/ // End of user code package org.oasis.oslcop.sysml; import java.net.URI; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.Map; import java.text.SimpleDateFormat; import java.util.HashSet; import java.util.List; import java.util.Set; import java.util.TreeSet; import java.util.Iterator; import org.eclipse.lyo.oslc4j.core.annotation.OslcAllowedValue; import org.eclipse.lyo.oslc4j.core.annotation.OslcDescription; import org.eclipse.lyo.oslc4j.core.annotation.OslcMemberProperty; import org.eclipse.lyo.oslc4j.core.annotation.OslcName; import org.eclipse.lyo.oslc4j.core.annotation.OslcNamespace; import org.eclipse.lyo.oslc4j.core.annotation.OslcOccurs; import org.eclipse.lyo.oslc4j.core.annotation.OslcPropertyDefinition; import org.eclipse.lyo.oslc4j.core.annotation.OslcRdfCollectionType; import org.eclipse.lyo.oslc4j.core.annotation.OslcRange; import org.eclipse.lyo.oslc4j.core.annotation.OslcReadOnly; import org.eclipse.lyo.oslc4j.core.annotation.OslcRepresentation; import org.eclipse.lyo.oslc4j.core.annotation.OslcResourceShape; import org.eclipse.lyo.oslc4j.core.annotation.OslcTitle; import org.eclipse.lyo.oslc4j.core.annotation.OslcValueType; import org.eclipse.lyo.oslc4j.core.model.AbstractResource; import org.eclipse.lyo.oslc4j.core.model.Link; import org.eclipse.lyo.oslc4j.core.model.Occurs; import org.eclipse.lyo.oslc4j.core.model.OslcConstants; import org.eclipse.lyo.oslc4j.core.model.Representation; import org.eclipse.lyo.oslc4j.core.model.ValueType; import org.oasis.oslcop.sysml.SysmlDomainConstants; import org.oasis.oslcop.sysml.IConjugation; import org.oasis.oslcop.sysml.IElement; import org.oasis.oslcop.sysml.IFeature; import org.oasis.oslcop.sysml.IFeatureMembership; import org.oasis.oslcop.sysml.IFeatureTyping; import org.oasis.oslcop.sysml.IGeneralization; import org.oasis.oslcop.sysml.ISysmlImport; import org.oasis.oslcop.sysml.IMembership; import org.oasis.oslcop.sysml.IMultiplicity; import org.oasis.oslcop.sysml.ISysmlPackage; import org.eclipse.lyo.oslc.domains.IPerson; import org.oasis.oslcop.sysml.IRedefinition; import org.oasis.oslcop.sysml.IRelationship; import org.oasis.oslcop.sysml.ISubsetting; import org.oasis.oslcop.sysml.IType; // Start of user code imports // End of user code @OslcNamespace(SysmlDomainConstants.SOURCEEND_NAMESPACE) @OslcName(SysmlDomainConstants.SOURCEEND_LOCALNAME) @OslcResourceShape(title = "SourceEnd Resource Shape", describes = SysmlDomainConstants.SOURCEEND_TYPE) public interface ISourceEnd { }
9bebb4d89ffdcd6a1439993a5aa6cd0c516a3c85
90eb7a131e5b3dc79e2d1e1baeed171684ef6a22
/sources/p298d/p299a/p300a/p301a/p303y0/p391i/C7207n.java
2dcb895f10cfb2df0d4ddb6a88d3450fff0258d6
[]
no_license
shalviraj/greenlens
1c6608dca75ec204e85fba3171995628d2ee8961
fe9f9b5a3ef4a18f91e12d3925e09745c51bf081
refs/heads/main
2023-04-20T13:50:14.619773
2021-04-26T15:45:11
2021-04-26T15:45:11
361,799,768
0
0
null
null
null
null
UTF-8
Java
false
false
673
java
package p298d.p299a.p300a.p301a.p303y0.p391i; import p298d.p299a.p300a.p301a.p303y0.p304b.C6023b; import p298d.p299a.p300a.p301a.p303y0.p304b.C6046e; import p298d.p299a.p300a.p301a.p303y0.p304b.C6219q; import p298d.p344x.p345b.C6862l; /* renamed from: d.a.a.a.y0.i.n */ public final class C7207n implements C6862l<C6023b, Boolean> { /* renamed from: g */ public final /* synthetic */ C6046e f14443g; public C7207n(C6046e eVar) { this.f14443g = eVar; } public Object invoke(Object obj) { C6023b bVar = (C6023b) obj; return Boolean.valueOf(!C6219q.m11193e(bVar.getVisibility()) && C6219q.m11194f(bVar, this.f14443g)); } }
69d877b56b4d52eceee7c6e58f992386bf5014d5
cbcb40ed68d1bbc9f2ba7b5ff0fc49b7c4c2bdd4
/src/main/java/com/jcl/payroll/enumtypes/DTRType.java
160eacf853545b28d1d7afbede77ca29d4b82e2f
[]
no_license
junald/wlloryap
090838371093aa08e92d06e74a448c72b70df0e6
222c5ede77cd62af359715fa42697166d5a072c1
refs/heads/master
2020-05-19T08:53:48.687985
2012-07-10T09:01:58
2012-07-10T09:01:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
363
java
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.jcl.payroll.enumtypes; /** * * @author junald */ public enum DTRType { WorkedHours, VL_WP, VL_WOP, SL_WP, SL_WOP , Undertime, HL, HS, Absent ,OT_RD,OT_RSD,OT_LHRGD,OT_LHRTD,OT_SHRGD,OT_SHRTD,OT_RM,OT_RSM,OT_LHRGM,OT_LHRTM,OT_SHRGM,OT_SHRTM }
7a6fc775ce971b25c177bc045992d1bb576a7560
1a77e9489269713b4af04bcbc2efaa2efad6fdfb
/app/src/main/java/com/blitz/sqliteapp/Adapters/ListAdapter.java
0410afc20333dfe2c542d3be68fd2531cde29d28
[]
no_license
BlitzV/SQLiteApp
12d694dc53e28c90ee8fb9239f7297a565967851
efc1c25e3e86b8002ac73d7b786d3797732b5322
refs/heads/master
2020-04-20T17:56:02.802803
2019-02-17T11:01:40
2019-02-17T11:01:40
169,003,638
0
0
null
null
null
null
UTF-8
Java
false
false
2,562
java
package com.blitz.sqliteapp.Adapters; import android.content.Context; import android.support.annotation.NonNull; import android.support.v7.widget.CardView; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import com.blitz.sqliteapp.R; import com.blitz.sqliteapp.model.ListaData; import java.util.List; public class ListAdapter extends RecyclerView.Adapter<ListAdapter.ViewHolder> { Context context; public List<ListaData> list; public ListAdapter(Context context, List<ListaData> list) { this.context = context; this.list = list; } @NonNull @Override public ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { View view = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.itemlist,viewGroup,false); ViewHolder viewHolder = new ViewHolder(view); return viewHolder; } @Override public void onBindViewHolder(@NonNull ViewHolder viewHolder, int i) { viewHolder.nombre.setText(list.get(i).getNombre()); viewHolder.personas.setText("Personas "+ String.valueOf(list.get(i).getPersonas())); viewHolder.descripcion.setText(list.get(i).getDescripcion()); viewHolder.caracteristicas.setText(list.get(i).getCaracteristicas()); if(list.get(i).getFavoritos() == 1){ viewHolder.star.setImageResource(R.drawable.twotone_star_black_24); }else{ viewHolder.star.setImageResource(R.drawable.twotone_star_border_black_24); } } @Override public int getItemCount() { return list.size(); } public class ViewHolder extends RecyclerView.ViewHolder { CardView cardView; ImageView imageView; ImageView star; TextView nombre, personas, descripcion, caracteristicas; public ViewHolder(@NonNull View itemView) { super(itemView); cardView = (CardView) itemView.findViewById(R.id.cardview); imageView = (ImageView) itemView.findViewById(R.id.image); nombre = (TextView) itemView.findViewById(R.id.name); personas = (TextView) itemView.findViewById(R.id.personas); descripcion = (TextView) itemView.findViewById(R.id.descripcion); caracteristicas = (TextView) itemView.findViewById(R.id.caracteristicas); star = (ImageView) itemView.findViewById(R.id.star); } } }
c9cde1fcb673668f1d4ccf33d5368199b8adc452
85fa414b74a24b4a5da830a686866d64339a1146
/src/main/java/jp/co/seattle/library/controller/ReturnBookController.java
8616b41c0d6fb5c78aee17fc6791d3c121c12901
[]
no_license
shin-kagaya/seattle-academy-library
ab4e0ba01d5907331394b136feda5403dce3a682
655f12df02f3f1c5aca78e8ef89cabdbbbf40b9e
refs/heads/develop
2023-05-04T01:28:32.983674
2021-05-26T08:29:38
2021-05-26T08:29:38
356,159,722
0
0
null
2021-05-26T08:29:39
2021-04-09T06:22:31
Java
UTF-8
Java
false
false
1,867
java
package jp.co.seattle.library.controller; import java.util.Locale; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Transactional; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import jp.co.seattle.library.service.BooksService; import jp.co.seattle.library.service.RentalService; /** * 書籍返却コントローラー */ @Controller public class ReturnBookController { final static Logger logger = LoggerFactory.getLogger(ReturnBookController.class); @Autowired private BooksService booksService; @Autowired private RentalService rentalService; /** * 返却処理をして詳細画面に遷移する * @param locale * @param bookId * @param model * @return 遷移画面先 */ @Transactional @RequestMapping(value = "/returnBook", method = RequestMethod.POST) //value=actionで指定したパラメータ public String editBook(Locale locale, @RequestParam("bookId") Integer bookId, Model model) { // デバッグ用ログ logger.info("Welcome ReturnBookControler.java! The client locale is {}.", locale); //RentalServiceのreturnBookメソッドを呼んで返却処理を行う rentalService.returnBook(bookId); //返却した本の詳細情報を詳細画面に表示 model.addAttribute("bookDetailsInfo", booksService.getBookInfo(bookId)); //貸出可表示をする model.addAttribute("rentOK", "貸出可"); return "details"; } }
921a5714d791ab5bd1450bdaa19927fb7de5c9ed
c987e2cb389808b20d00d49f1987670d9eb41084
/boletin22_1/src/New_User.java
21cd6794672e85280abb49e56bfad80cf3a1307f
[]
no_license
ZadenDrew/boletin22
b9dcf75601822fa26a3303c87433fa5a319fe6b2
fc45edea789a63c841198c4d1ba7f663538d202f
refs/heads/master
2020-03-11T19:36:53.607503
2018-04-19T12:35:51
2018-04-19T12:35:51
130,212,648
0
0
null
null
null
null
UTF-8
Java
false
false
17,328
java
/** * * @author acabezaslopez */ public class New_User extends javax.swing.JFrame { /** * Creates new form New_User */ public New_User() { initComponents(); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel2 = new javax.swing.JPanel(); jPanel1 = new javax.swing.JPanel(); jTextField1 = new javax.swing.JTextField(); jTextField2 = new javax.swing.JTextField(); jTextField3 = new javax.swing.JTextField(); jTextField4 = new javax.swing.JTextField(); jComboBox1 = new javax.swing.JComboBox<>(); jComboBox2 = new javax.swing.JComboBox<>(); jPasswordField1 = new javax.swing.JPasswordField(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); jPasswordField2 = new javax.swing.JPasswordField(); jLabel9 = new javax.swing.JLabel(); jButton1 = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jSeparator1 = new javax.swing.JSeparator(); jLabel10 = new javax.swing.JLabel(); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 48, Short.MAX_VALUE) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 48, Short.MAX_VALUE) ); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); setTitle("New User ....."); setIconImage(getIconImage()); jTextField1.setText("mary"); jTextField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField1ActionPerformed(evt); } }); jTextField2.setText("User Mary"); jTextField2.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jTextField2ActionPerformed(evt); } }); jTextField3.setText("(automatic)"); jTextField3.setDisabledTextColor(new java.awt.Color(204, 204, 204)); jTextField4.setText("(automatic)"); jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "staff", "others" })); jComboBox1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBox1ActionPerformed(evt); } }); jComboBox2.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "/bin", "/bash", "/home", "/boot" })); jPasswordField1.setText("jPasswordField1"); jPasswordField1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jPasswordField1ActionPerformed(evt); } }); jLabel1.setText("User Name :"); jLabel2.setText("Full Name :"); jLabel3.setText("User ID :"); jLabel4.setText("Group :"); jLabel5.setText("Home Directory :"); jLabel6.setText("Login Shell :"); jLabel7.setText("Password :"); jLabel8.setText("Confirm :"); jPasswordField2.setText("jPasswordField2"); jLabel9.setText("Create a new User "); jButton1.setText("Cancel"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButton1ActionPerformed(evt); } }); jButton2.setText("Ok"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel5) .addComponent(jLabel6) .addComponent(jLabel4) .addComponent(jLabel3) .addComponent(jLabel2) .addComponent(jLabel1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 43, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jTextField1, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jTextField2, javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jTextField3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jTextField4, javax.swing.GroupLayout.Alignment.TRAILING)) .addGap(36, 36, 36)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel9) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel7) .addComponent(jLabel8)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton1) .addGap(18, 18, 18) .addComponent(jButton2) .addGap(33, 33, 33)) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(82, 82, 82) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jPasswordField2, javax.swing.GroupLayout.DEFAULT_SIZE, 294, Short.MAX_VALUE) .addComponent(jPasswordField1)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addComponent(jSeparator1))) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(6, 6, 6) .addComponent(jLabel9) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel4)) .addGap(14, 14, 14) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel5)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jComboBox2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel6)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(jPasswordField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8) .addComponent(jPasswordField2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 56, Short.MAX_VALUE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButton1) .addComponent(jButton2)) .addGap(36, 36, 36)) ); jLabel10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/usuarios.png"))); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) .addGroup(layout.createSequentialGroup() .addGap(54, 54, 54) .addComponent(jLabel10) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jLabel10) .addGap(36, 36, 36) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void jTextField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField1ActionPerformed private void jTextField2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextField2ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jTextField2ActionPerformed private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jComboBox1ActionPerformed private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jButton1ActionPerformed private void jPasswordField1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jPasswordField1ActionPerformed // TODO add your handling code here: }//GEN-LAST:event_jPasswordField1ActionPerformed /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(New_User.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(New_User.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(New_User.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(New_User.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new New_User().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton jButton1; private javax.swing.JButton jButton2; private javax.swing.JComboBox<String> jComboBox1; private javax.swing.JComboBox<String> jComboBox2; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; private javax.swing.JPanel jPanel2; private javax.swing.JPasswordField jPasswordField1; private javax.swing.JPasswordField jPasswordField2; private javax.swing.JSeparator jSeparator1; private javax.swing.JTextField jTextField1; private javax.swing.JTextField jTextField2; private javax.swing.JTextField jTextField3; private javax.swing.JTextField jTextField4; // End of variables declaration//GEN-END:variables }
80ba5d0f454be80e1e895b3c5f93221c66952419
ecdd8cd99be313d736a1aeb01555dae89a9249ce
/space_android/app/src/main/java/com/tenth/space/utils/FileUtil.java
96d0017a99260a799a62e282d15a7e884da7c71c
[]
no_license
liuzhenpangzi/liuzhen
2c485215aefe5c134001078c4a680a5deb27293a
186c7d579a56f7c934713c7cc5ec76eae3759426
refs/heads/master
2021-01-12T08:02:10.961068
2016-12-22T02:48:24
2016-12-22T02:48:24
77,107,636
2
0
null
null
null
null
UTF-8
Java
false
false
16,734
java
package com.tenth.space.utils; import android.content.ContentResolver; import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Environment; import android.provider.MediaStore; import com.tenth.space.app.IMApplication; import com.tenth.space.config.SysConstant; import java.io.BufferedReader; import java.io.ByteArrayOutputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.net.HttpURLConnection; import java.net.URL; public class FileUtil { public static String SDCardRoot; public static File updateFile; static { // 获取SD卡路径 SDCardRoot = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator; } //uri转文件绝对路径 public static String getFilePathFromContentUri(Uri uri, ContentResolver contentResolver) { String filePath=""; //url分为2中:1、file开头标示文件夹选中的图片;2、content开头; if (uri!=null){ if (uri.toString().contains("file://")){ filePath=uri.toString().split("file://")[1]; return filePath; }else { String[] filePathColumn = {MediaStore.Images.Media.DATA}; Cursor cursor = contentResolver.query(uri, filePathColumn, null, null, null); cursor.moveToFirst(); int columnIndex = cursor.getColumnIndex(filePathColumn[0]); filePath = cursor.getString(columnIndex); cursor.close(); return filePath; } }else { return filePath; } } /** * 创建文件夹 * * @throws IOException */ public static File createFileInSDCard(String fileName, String dir) { File file = new File(SDCardRoot + dir + File.separator + fileName); try { file.createNewFile(); } catch (IOException e) { e.printStackTrace(); } updateFile = file; return file; } /** * 创建目录 * * @param dir * * @return */ public static File creatSDDir(String dir) { File dirFile = new File(SDCardRoot + dir + File.separator); dirFile.mkdirs(); return dirFile; } /** * 检测文件是否存在 */ public static boolean isFileExist(String fileName, String path) { File file = new File(SDCardRoot + path + File.separator + fileName); return file.exists(); } public static boolean isFileExist(String filePath) { File file = new File(filePath); return file.exists(); } /** * 通过流往文件里写东西 */ public static File writeToSDFromInput(String path, String fileName, InputStream input) { File file = null; OutputStream output = null; try { file = createFileInSDCard(fileName, path); output = new FileOutputStream(file, false); byte buffer[] = new byte[4 * 1024]; int temp; while ((temp = input.read(buffer)) != -1) { output.write(buffer, 0, temp); } output.flush(); } catch (Exception e) { e.printStackTrace(); } finally { try { output.close(); } catch (Exception e) { e.printStackTrace(); } } return file; } /** * 把字符串写入文件 */ public static File writeToSDFromInput(String path, String fileName, String data) { File file = null; OutputStreamWriter outputWriter = null; OutputStream outputStream = null; try { creatSDDir(path); file = createFileInSDCard(fileName, path); outputStream = new FileOutputStream(file, false); outputWriter = new OutputStreamWriter(outputStream); outputWriter.write(data); outputWriter.flush(); } catch (Exception e) { e.printStackTrace(); } finally { try { outputWriter.close(); } catch (Exception e) { e.printStackTrace(); } } return file; } public static String getFromCipherConnection(String actionUrl, String content, String path) { try { File[] files = new File[1]; files[0] = new File(path); // content = CipherUtil.getCipherString(content); String BOUNDARY = java.util.UUID.randomUUID().toString(); String PREFIX = "--", LINEND = "\r\n"; String MULTIPART_FROM_DATA = "multipart/form-data"; String CHARSET = "UTF-8"; URL uri = new URL(actionUrl); HttpURLConnection conn = (HttpURLConnection) uri.openConnection(); conn.setReadTimeout(5 * 1000); // 缓存的最长时间 conn.setDoInput(true);// 允许输入 conn.setDoOutput(true);// 允许输出 conn.setUseCaches(false); // 不允许使用缓存 conn.setRequestMethod("POST"); conn.setRequestProperty("connection", "keep-alive"); conn.setRequestProperty("Charsert", "UTF-8"); conn.setRequestProperty("Content-Type", MULTIPART_FROM_DATA + ";boundary=" + BOUNDARY); // 首先组拼文本类型的参数 StringBuilder sb = new StringBuilder(); sb.append(PREFIX); sb.append(BOUNDARY); sb.append(LINEND); sb.append("Content-Disposition: form-data; name=\"userName\"" + LINEND);// \"userName\" sb.append("Content-Type: text/plain; charset=" + CHARSET + LINEND); sb.append("Content-Transfer-Encoding: 8bit" + LINEND); sb.append(LINEND); sb.append(content); sb.append(LINEND); DataOutputStream outStream = new DataOutputStream(conn.getOutputStream()); outStream.write(sb.toString().getBytes()); // 发送文件数据 if (files != null) { for (File file : files) { StringBuilder sb1 = new StringBuilder(); sb1.append(PREFIX); sb1.append(BOUNDARY); sb1.append(LINEND); sb1.append("Content-Disposition: form-data; name=\"" + file.getName() + "\"; filename=\"" + file.getName() + "\"" + LINEND); sb1.append("Content-Type: application/octet-stream; charset=" + CHARSET + LINEND); sb1.append(LINEND); outStream.write(sb1.toString().getBytes()); try { InputStream is = new FileInputStream(file); byte[] buffer = new byte[1024]; int len = 0; while ((len = is.read(buffer)) != -1) { outStream.write(buffer, 0, len); } is.close(); outStream.write(LINEND.getBytes()); } catch (IOException e) { e.printStackTrace(); } } } // 请求结束标志 byte[] end_data = (PREFIX + BOUNDARY + PREFIX + LINEND).getBytes(); outStream.write(end_data); outStream.flush(); outStream.close(); // 得到响应码 int res = conn.getResponseCode(); if (res == 200) { BufferedReader in = new BufferedReader(new InputStreamReader( (InputStream) conn.getInputStream())); String line = null; StringBuilder result = new StringBuilder(); while ((line = in.readLine()) != null) { result.append(line); } in.close(); conn.disconnect();// 断开连接 return "true"; } else { return ""; } } catch (Exception e) { e.printStackTrace(); return ""; } } public static byte[] getFileContent(String fileName) { FileInputStream fin = null; try { fin = new FileInputStream(fileName); int length = fin.available(); byte[] bytes = new byte[length]; fin.read(bytes); return bytes; } catch (Exception e) { e.printStackTrace(); return null; } finally { try { if (fin != null) { fin.close(); } } catch (IOException e) { e.printStackTrace(); } } } /** * @param file * * @Description 删除文件或文件夹 */ public static void delete(File file) { if (!file.exists()) { return; // 不存在直接返回 } if (file.isFile()) { file.delete(); // 若是文件则删除后返回 return; } // 若是目录递归删除后,并最后删除目录后返回 if (file.isDirectory()) { File[] childFiles = file.listFiles(); if (childFiles == null || childFiles.length == 0) { file.delete(); // 如果是空目录,直接删除 return; } for (int i = 0; i < childFiles.length; i++) { delete(childFiles[i]); // 递归删除子文件或子文件夹 } file.delete(); // 删除最后的空目录 } return; } /** * @param dirFile 目录文件 * @param timeLine 时间分隔线 * * @Description 删除目录下过旧的文件 */ public static void deleteHistoryFiles(File dirFile, long timeLine) { // 不存在或是文件直接返回 if (!dirFile.exists() || dirFile.isFile()) { return; } try { // 如果是目录则删除过旧的文件 if (dirFile.isDirectory()) { File[] childFiles = dirFile.listFiles(); if (childFiles == null || childFiles.length == 0) { return; // 如果是空目录就直接返回 } // 遍历文件,删除过旧的文件 Long fileTime; for (int i = 0; i < childFiles.length; i++) { fileTime = childFiles[i].lastModified(); if (fileTime < timeLine) { delete(childFiles[i]); } } } } catch (Exception e) { e.printStackTrace(); } } public static void saveBitmap(Bitmap bm,String picName) { // File f = new File(SDCardRoot, picName); File f = new File(IMApplication.RootDirectory, picName); // if (f.exists()) { // f.delete(); // } try { FileOutputStream out = new FileOutputStream(f); bm.compress(Bitmap.CompressFormat.PNG, 100, out); out.flush(); out.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } public static Bitmap getDiskBitmap(String pathString) { Bitmap bitmap = null; try { File file = new File(pathString); if(file.exists()) { bitmap = BitmapFactory.decodeFile(pathString); } } catch (Exception e) { // TODO: handle exception } return bitmap; } public static File save2File(String savePath, String saveName, String crashReport) { try { File dir = new File(savePath); if (!dir.exists()) dir.mkdir(); File file = new File(dir, saveName); FileOutputStream fos = new FileOutputStream(file); fos.write(crashReport.toString().getBytes()); fos.close(); return file; } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; } public static String saveAudioResourceToFile(byte[] content, int userId) { try { String audioSavePath = CommonUtil.getAudioSavePath(userId); File file = new File(audioSavePath); FileOutputStream fops = new FileOutputStream(file); fops.write(content); fops.flush(); fops.close(); return audioSavePath; } catch (Exception e) { e.printStackTrace(); return null; } } public static String saveGifResourceToFile(byte[] content) { try { String gifSavePath = CommonUtil.getSavePath(SysConstant.FILE_SAVE_TYPE_IMAGE); File file = new File(gifSavePath); FileOutputStream fops = new FileOutputStream(file); fops.write(content); fops.flush(); fops.close(); return gifSavePath; } catch (Exception e) { e.printStackTrace(); return null; } } @SuppressWarnings("unused") private static Bitmap getBitmap(InputStream fs) { BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inSampleSize = 1; Bitmap imgBitmap = BitmapFactory.decodeStream(fs, null, opts); if (imgBitmap != null) { int width = imgBitmap.getWidth(); int height = imgBitmap.getHeight(); imgBitmap = Bitmap.createScaledBitmap(imgBitmap, width, height, true); } return imgBitmap; } public static long getFileLen(File file) { long total = 0; try { InputStream is = new FileInputStream(file); byte[] bytes = new byte[1024]; int len = 0; while ((len = is.read(bytes)) != -1) { total += len; } is.close(); } catch (Exception e) { } return total; } public static boolean isSdCardAvailuable() { boolean bRet = false; do { if (!Environment.getExternalStorageState().equals( Environment.MEDIA_MOUNTED)) { break; } if (CommonUtil.getSDFreeSize() < 5) { break; } bRet = true; } while (false); return bRet; } public static byte[] InputStreamToByte(InputStream is) throws IOException { ByteArrayOutputStream bytestream = new ByteArrayOutputStream(); int ch; while ((ch = is.read()) != -1) { bytestream.write(ch); } byte imgdata[] = bytestream.toByteArray(); bytestream.close(); return imgdata; } public static byte[] File2byte(String filePath) { byte[] buffer = null; try { File file = new File(filePath); FileInputStream fis = new FileInputStream(file); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] b = new byte[1024]; int n; while ((n = fis.read(b)) != -1) { bos.write(b, 0, n); } fis.close(); bos.close(); buffer = bos.toByteArray(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return buffer; } public static String getExtensionName(String filename) { if ((filename != null) && (filename.length() > 0)) { int dot = filename.lastIndexOf('.'); if ((dot > -1) && (dot < (filename.length() - 1))) { return filename.substring(dot + 1); } } return filename; } }
751a4997e20188f7e23778950af4ca81136b0502
13fed86ba6eceea2380b3543bbab700922da43bb
/task15/task1530/DrinkMaker.java
a50e474acb3567a568209bca7ec51543b56b14b5
[]
no_license
AntonyPalsh/JavaRushTaskCore
08a73e33fbcd433f47e0a4739575366760fde70f
83b99ffdf7e715d209c838366cc5d1f4cc9b62fe
refs/heads/main
2023-03-22T21:41:39.796761
2021-03-12T01:19:13
2021-03-12T01:19:13
342,810,722
1
0
null
null
null
null
UTF-8
Java
false
false
269
java
package com.javarush.task.task15.task1530; public abstract class DrinkMaker { abstract void getRightCup(); abstract void putIngredient(); abstract void pour(); void makeDrink() { getRightCup(); putIngredient(); pour(); } }
55fa0109be784bf7206a7c7eb33e3708f94848b1
32aab6ba61d2ba2d1c22ebd3614fa40c85362846
/backend/smarthome-sharedwifi/src/main/java/com/phicomm/smarthome/sharedwifi/model/router/ItemAuthBeatModel.java
5659b480d99dcc025ea89a9f13061a6b3bd22b71
[ "Apache-2.0" ]
permissive
rongwei84n/Auts_Assert_manager
d6346d14c87bc2e6eaf86c772441f73722b83ee0
8464d280fa7344d80191219c9491518a93a699bd
refs/heads/master
2021-01-21T14:19:25.267322
2017-06-24T09:16:56
2017-06-24T09:16:56
95,267,686
1
0
null
null
null
null
UTF-8
Java
false
false
1,067
java
package com.phicomm.smarthome.sharedwifi.model.router; import com.fasterxml.jackson.annotation.JsonProperty; import io.swagger.annotations.ApiModelProperty; /** * PROJECT_NAME: fhicomm.smarthome.model.sharedwifi * PACKAGE_NAME: com.fhicomm.sharedwifi.model * DESCRIPTION: * AUTHOR: liang04.zhang * DATE: 2017/6/7 */ public class ItemAuthBeatModel { @ApiModelProperty(value = "终端MAC地址") @JsonProperty("device_mac") private String deviceMac; @ApiModelProperty(value = "终端支付订单ID") @JsonProperty("order_id") private String orderId; public ItemAuthBeatModel(){} public ItemAuthBeatModel(String deviceMac, String orderId){ this.deviceMac = deviceMac; this.orderId = orderId; } public String getDeviceMac() { return deviceMac; } public void setDeviceMac(String deviceMac) { this.deviceMac = deviceMac; } public String getOrderId() { return orderId; } public void setOrderId(String orderId) { this.orderId = orderId; } }
e9c9cc3843d35f9c06c896e985a57c8cbfa51c9b
685e3097d073a5a948e26f15936897a126cfabdd
/MakeTwoArraysEqualbyReversingSubarrays/Solution.java
b0a68202a07a23c32faea3fa55348f9934fd1097
[]
no_license
flyPisces/LeetCodeSolution
2ae0b48c149bb1eb20c180647feaabd392120e4e
e4399fc8791491082934b634a60caa2a1e350fbd
refs/heads/master
2021-01-10T22:36:23.241283
2020-08-22T07:01:38
2020-08-22T07:01:38
69,706,033
1
0
null
null
null
null
UTF-8
Java
false
false
1,469
java
package MakeTwoArraysEqualbyReversingSubarrays; /** * Given two integer arrays of equal length target and arr. * * In one step, you can select any non-empty sub-array of arr and reverse it. You are allowed to make any number of steps. * * Return True if you can make arr equal to target, or False otherwise. * * * * Example 1: * * Input: target = [1,2,3,4], arr = [2,4,1,3] * Output: true * Explanation: You can follow the next steps to convert arr to target: * 1- Reverse sub-array [2,4,1], arr becomes [1,4,2,3] * 2- Reverse sub-array [4,2], arr becomes [1,2,4,3] * 3- Reverse sub-array [4,3], arr becomes [1,2,3,4] * There are multiple ways to convert arr to target, this is not the only way to do so. * Example 2: * * Input: target = [7], arr = [7] * Output: true * Explanation: arr is equal to target without any reverses. * Example 3: * * Input: target = [1,12], arr = [12,1] * Output: true * Example 4: * * Input: target = [3,7,9], arr = [3,7,11] * Output: false * Explanation: arr doesn't have value 9 and it can never be converted to target. * Example 5: * * Input: target = [1,1,1,1,1], arr = [1,1,1,1,1] * Output: true */ public class Solution { public boolean canBeEqual(int[] target, int[] arr) { int[] dp = new int[1001]; for (int num : target) { dp[num] ++; } for (int num : arr) { if (--dp[num] < 0) return false; } return true; } }
992dee1f79962e2b800daa39cc1e080387017b54
04c91ef36cb38436f9656aeec208773aba15171f
/InterviewPratice/src/org/web/automation/testcases/TC_001_RegistrationFunctionality.java
fc2e6752e17d93b6c69a10b02ebd2aef6cdf3264
[]
no_license
leebharambe/PraticeTest
0d31c2bf2f7a9d81d5437e2c04bd0b1a840ea479
6f551284b3aaaeeaa334fefa305d7eef6be94ce8
refs/heads/master
2023-06-25T23:10:18.667922
2021-07-10T04:53:57
2021-07-10T04:53:57
384,609,562
0
0
null
null
null
null
UTF-8
Java
false
false
1,061
java
package org.web.automation.testcases; import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class TC_001_RegistrationFunctionality { WebDriver driver; @BeforeMethod public void startBrowser() { System.setProperty("webdriver.chrome.driver", "F:\\Study Material\\SeleniumPractice\\src\\Drivers\\chromedriver.exe"); driver=new ChromeDriver(); driver.get("https://www.thetestingworld.com/testings/"); driver.navigate().back(); driver.navigate().forward(); driver.manage().window().maximize(); } @Test public void tc001() { driver.findElement(By.xpath("//input[@name='fld_username']")).sendKeys("Hello"); driver.findElement(By.xpath("//input[@name='fld_email']")).sendKeys("[email protected]"); driver.findElement(By.xpath("//input[@value='Sign up']")).click(); } @AfterMethod public void clsoeBrowser() { driver.close(); } }
[ "Leena@Leena-PC" ]
Leena@Leena-PC
013433ee7128ee40df936798410e69292a9af64e
7d6fad5bedbd1ae69358d4c4cd8fb483aeb7b4b7
/src/test/java/lesson08/a_add_basepage/MyFirstTest.java
f7a3996280e68d547ba88129a207bc6b1065b462
[]
no_license
QA-automation-engineer/test-automation-5
8dfc6f0c4e913c20740dd409bebcb959b217fb2b
2f1773cd5f21a54d80f8eedbc7b710e25f28e455
refs/heads/master
2022-01-01T09:30:59.465788
2019-09-18T11:15:16
2019-09-18T11:15:16
205,368,150
0
0
null
2021-12-14T21:32:52
2019-08-30T11:23:52
Java
UTF-8
Java
false
false
1,102
java
package lesson08.a_add_basepage; import org.hamcrest.CoreMatchers; import org.junit.Assert; import org.junit.Test; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; public class MyFirstTest extends BaseTest { @Test public void verifyFirstTipIsCorrectlyUpdatedAfterEnteringNewQuery() { LandingPage landingPage = new LandingPage(driver); String query1 = "Dress"; String query2 = "T-shirt"; landingPage.searchFor(query1); (new WebDriverWait(driver, 10)) .until(ExpectedConditions.visibilityOfElementLocated(landingPage.firstTip)); Assert.assertThat(landingPage.getFirstTipText(), CoreMatchers.containsString(query1)); landingPage.searchFor(query2); (new WebDriverWait(driver, 10)) .until(ExpectedConditions.textToBePresentInElementLocated(landingPage.firstTip, query2)); Assert.assertThat( landingPage.getFirstTipText(), CoreMatchers.containsString(query2 + "fdfd")); } }
3538d36e44661a63dc58714763e07b2360255b68
987d30d449ddb32c9c90d44a0986222a6ce04c57
/rxeasyhttp/src/main/java/com/zhouyou/http/interceptor/BaseDynamicInterceptor.java
e1a5aa5c5710df433949adf279ab9436660c4cfb
[ "Apache-2.0" ]
permissive
Boom618/DigitalFarms
a2b8759a16caeae25fbc466398437c07265d1f2a
b7b3617f004c3c2f760fff822520caf30f6042c4
refs/heads/master
2020-04-04T13:44:28.295214
2018-11-03T10:42:49
2018-11-03T10:42:49
155,973,528
0
0
null
null
null
null
UTF-8
Java
false
false
7,840
java
/* * Copyright (C) 2017 zhouyou([email protected]) * * 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.zhouyou.http.interceptor; import com.zhouyou.http.utils.HttpLog; import com.zhouyou.http.utils.HttpUtil; import com.zhouyou.http.utils.Utils; import java.io.IOException; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Set; import java.util.TreeMap; import okhttp3.FormBody; import okhttp3.HttpUrl; import okhttp3.Interceptor; import okhttp3.MultipartBody; import okhttp3.Request; import okhttp3.Response; import static com.zhouyou.http.utils.HttpUtil.UTF8; /** * <p>描述:动态拦截器</p> * 主要功能是针对参数:<br> * 1.可以获取到全局公共参数和局部参数,统一进行签名sign<br> * 2.可以自定义动态添加参数,类似时间戳timestamp是动态变化的,token(登录了才有),参数签名等<br> * 3.参数值是经过UTF-8编码的<br> * 4.默认提供询问是否动态签名(签名需要自定义),动态添加时间戳等<br> * 作者: zhouyou<br> * 日期: 2017/5/3 15:32 <br> * 版本: v1.0<br> */ public abstract class BaseDynamicInterceptor<R extends BaseDynamicInterceptor> implements Interceptor { private HttpUrl httpUrl; private boolean isSign = false; //是否需要签名 private boolean timeStamp = false; //是否需要追加时间戳 private boolean accessToken = false; //是否需要添加token public BaseDynamicInterceptor() { } public boolean isSign() { return isSign; } public R sign(boolean sign) { isSign = sign; return (R) this; } public boolean isTimeStamp() { return timeStamp; } public R timeStamp(boolean timeStamp) { this.timeStamp = timeStamp; return (R) this; } public R accessToken(boolean accessToken) { this.accessToken = accessToken; return (R) this; } public boolean isAccessToken() { return accessToken; } @Override public Response intercept(Chain chain) throws IOException { Request request = chain.request(); if (request.method().equals("GET")) { this.httpUrl = HttpUrl.parse(parseUrl(request.url().url().toString())); request = addGetParamsSign(request); } else if (request.method().equals("POST")) { this.httpUrl = request.url(); request = addPostParamsSign(request); } return chain.proceed(request); } public HttpUrl getHttpUrl() { return httpUrl; } //get 添加签名和公共动态参数 private Request addGetParamsSign(Request request) throws UnsupportedEncodingException { HttpUrl httpUrl = request.url(); HttpUrl.Builder newBuilder = httpUrl.newBuilder(); //获取原有的参数 Set<String> nameSet = httpUrl.queryParameterNames(); ArrayList<String> nameList = new ArrayList<>(); nameList.addAll(nameSet); TreeMap<String, String> oldparams = new TreeMap<>(); for (int i = 0; i < nameList.size(); i++) { String value = httpUrl.queryParameterValues(nameList.get(i)) != null && httpUrl.queryParameterValues(nameList.get(i)).size() > 0 ? httpUrl.queryParameterValues(nameList.get(i)).get(0) : ""; oldparams.put(nameList.get(i), value); } String nameKeys = Arrays.asList(nameList).toString(); //拼装新的参数 TreeMap<String, String> newParams = dynamic(oldparams); Utils.checkNotNull(newParams, "newParams==null"); for (Map.Entry<String, String> entry : newParams.entrySet()) { String urlValue = URLEncoder.encode(entry.getValue(), UTF8.name()); //原来的URl: https://xxx.xxx.xxx/app/chairdressing/skinAnalyzePower/skinTestResult?appId=10101 if (!nameKeys.contains(entry.getKey())) {//避免重复添加 newBuilder.addQueryParameter(entry.getKey(), urlValue); } } httpUrl = newBuilder.build(); request = request.newBuilder().url(httpUrl).build(); return request; } //post 添加签名和公共动态参数 private Request addPostParamsSign(Request request) throws UnsupportedEncodingException { if (request.body() instanceof FormBody) { FormBody.Builder bodyBuilder = new FormBody.Builder(); FormBody formBody = (FormBody) request.body(); //原有的参数 TreeMap<String, String> oldparams = new TreeMap<>(); for (int i = 0; i < formBody.size(); i++) { oldparams.put(formBody.encodedName(i), formBody.encodedValue(i)); } //拼装新的参数 TreeMap<String, String> newParams = dynamic(oldparams); Utils.checkNotNull(newParams, "newParams==null"); //Logc.i("======post请求参数==========="); for (Map.Entry<String, String> entry : newParams.entrySet()) { String value = URLDecoder.decode(entry.getValue(), UTF8.name()); bodyBuilder.addEncoded(entry.getKey(), value); //Logc.i(entry.getKey() + " -> " + value); } String url = HttpUtil.createUrlFromParams(httpUrl.url().toString(), newParams); HttpLog.i(url); formBody = bodyBuilder.build(); request = request.newBuilder().post(formBody).build(); } else if (request.body() instanceof MultipartBody) { MultipartBody multipartBody = (MultipartBody) request.body(); MultipartBody.Builder bodyBuilder = new MultipartBody.Builder(); List<MultipartBody.Part> oldparts = multipartBody.parts(); //拼装新的参数 List<MultipartBody.Part> newparts = new ArrayList<>(); newparts.addAll(oldparts); TreeMap<String, String> oldparams = new TreeMap<>(); TreeMap<String, String> newParams = dynamic(oldparams); for (Map.Entry<String, String> stringStringEntry : newParams.entrySet()) { MultipartBody.Part part = MultipartBody.Part.createFormData(stringStringEntry.getKey(), stringStringEntry.getValue()); newparts.add(part); } for (MultipartBody.Part part : newparts) { bodyBuilder.addPart(part); } multipartBody = bodyBuilder.build(); request = request.newBuilder().post(multipartBody).build(); } return request; } //解析前:https://xxx.xxx.xxx/app/chairdressing/skinAnalyzePower/skinTestResult?appId=10101 //解析后:https://xxx.xxx.xxx/app/chairdressing/skinAnalyzePower/skinTestResult private String parseUrl(String url) { if (!"".equals(url) && url.contains("?")) {// 如果URL不是空字符串 url = url.substring(0, url.indexOf('?')); } return url; } /** * 动态处理参数 * * @param dynamicMap * @return 返回新的参数集合 */ public abstract TreeMap<String, String> dynamic(TreeMap<String, String> dynamicMap); }
2e07fe6ce4e997cf1c20fb99bb278357e13ee56b
c8412c01ac07271af40ff508109b673aa2caaf5b
/backward-manage/src/main/java/com/whiteplanet/backward/service/data/impl/UserLossStatServiceImpl.java
b3bbe4bf51a0d33157f3eeb440328fddd0f323c5
[]
no_license
brayJava/bray
d40c1878d4b93def8a1991261965663e91804643
3ffd52b13a1447bc94f24320607fa535df1a7a4e
refs/heads/master
2020-03-24T20:28:39.281546
2018-07-31T08:45:16
2018-07-31T08:45:16
142,980,114
0
0
null
null
null
null
UTF-8
Java
false
false
664
java
package com.whiteplanet.backward.service.data.impl; import com.whiteplanet.back.mapper.UserLossStatisticsMapper; import com.whiteplanet.mapper.LoginStatMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; /** * @author:wuzhiyuan * @description: 用户流失统计 * @date: Created in 16:03 2018/4/18 * @modified By: */ @Service public class UserLossStatServiceImpl { @Autowired private LoginStatMapper loginStatMapper; @Autowired private UserLossStatisticsMapper userLossStatisticsMapper; // void user }
d91ac3fcd74688aecbd10dbde631fd6dcaf16c3e
cbee8d31e51f0586f4a19465363420f1eab863ed
/GlobalActionBarService/app/build/generated/source/buildConfig/debug/com/example/android/globalactionbarservice/BuildConfig.java
0e6f9d95ff1825db8ec7ad349a6226b3406b9bf4
[ "Apache-2.0" ]
permissive
IsraelAbebe/AndroidAccseseblity
90fddfc6ae1b9c6c18f98cba577b22f2614f45e2
e6fcf63c0083f7a458baff940b89d9eb69158d10
refs/heads/master
2023-03-03T09:33:08.383217
2021-02-13T12:14:31
2021-02-13T12:14:31
338,565,458
0
0
null
null
null
null
UTF-8
Java
false
false
438
java
/** * Automatically generated file. DO NOT MODIFY */ package com.example.android.globalactionbarservice; public final class BuildConfig { public static final boolean DEBUG = Boolean.parseBoolean("true"); public static final String APPLICATION_ID = "com.example.android.demoservice"; public static final String BUILD_TYPE = "debug"; public static final int VERSION_CODE = 1; public static final String VERSION_NAME = "1.0"; }
f314110b3dfa74f781a2319dcc4d8ce92d2b2653
27e3aeada788e665b110b1825985c65a90e6538f
/Spring_Data_II/Products_Categories/src/main/java/com/codingdojo/prodscats/ProdsCatsApplication.java
c77350036d9bd4618685dd592491560435ac15c3
[]
no_license
maryguada/Java_Stack
ec8c167cdef43a944f2fcb4629fcbd0d58e28818
186907a36107ae9f170cf4030e3c3e93a4befa49
refs/heads/master
2020-08-06T08:36:13.174440
2019-10-10T04:22:57
2019-10-10T04:22:57
212,909,635
0
0
null
null
null
null
UTF-8
Java
false
false
323
java
package com.codingdojo.prodscats; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ProdsCatsApplication { public static void main(String[] args) { SpringApplication.run(ProdsCatsApplication.class, args); } }
93cf51151814f58ccdb4c32baa5fd8e66e09129e
547bcc712dd4eac9b3f6a2c2df3155e30d864080
/BIZ_hong/src/programing_6강/Circle.java
1e1d2da339e0b7842b30dcaaad123e151910af35
[]
no_license
betodo/polytech
d01cfccb076df289d6a879101b555e7e5ac13660
69979786b85d8595e56f586fe087e64c9a1823bd
refs/heads/master
2020-08-04T06:47:38.758235
2019-10-01T08:07:12
2019-10-01T08:07:12
212,043,733
0
0
null
null
null
null
UHC
Java
false
false
234
java
package programing_6강; public class Circle implements Shape { //같은 인터페이스를 구현하는 구체적인 클래스를 작성합니다. public void draw() { System.out.println("Inside Circle : draw() method"); } }
c25d562a2fad0602d1e80f0ba4bed3f997414142
60575219c4a223ab018ebd70829757fc8453fe66
/app/src/main/java/cn/edu/gdmec/android/mobileguard/m9advancedtools/db/AppLockOpenHelper.java
1f51df7ad2454727da6359c70738c9f7b0dcfa18
[]
no_license
lizengcheng/MobileGuard
1dc4664ccef9c0aa81b333485fa4b54686ea66dc
ebc7c8522729de282d858e9733ed201b72915f84
refs/heads/master
2021-09-01T06:59:42.778770
2017-12-25T14:45:13
2017-12-25T14:45:13
103,159,996
0
1
null
null
null
null
UTF-8
Java
false
false
669
java
package cn.edu.gdmec.android.mobileguard.m9advancedtools.db; import android.content.Context; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; /** * Created by Administrator on 2017/12/24. */ public class AppLockOpenHelper extends SQLiteOpenHelper{ public AppLockOpenHelper(Context context){ super(context,"applock.db",null,1); } @Override public void onCreate(SQLiteDatabase db){ db.execSQL("create table applock (id integer primary key autoincrement,packagename varchar(20))"); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion,int newVersion){ } }
2ab2ddde2402170e3dbb3db2e0db38077a1a2ef0
0e0dce1dff489175208192944f3da43f9524857f
/src/main/java/com/thinkgem/jeesite/modules/client/dao/ClientEmployeeDao.java
a35c27d3ba547ea345bd1861c2e5e10e7b0c2bd6
[ "Apache-2.0" ]
permissive
tunnyblock/tunnyblock
7529b67fcdbb1aec6c92eab8c1803d67c7c1d851
07391dd195321d1efc93264e6976b9e2b96deaee
refs/heads/master
2021-01-20T04:29:46.831919
2015-05-05T05:16:07
2015-05-05T05:16:07
26,125,806
0
0
null
null
null
null
UTF-8
Java
false
false
385
java
package com.thinkgem.jeesite.modules.client.dao; import org.springframework.stereotype.Repository; import com.thinkgem.jeesite.common.persistence.BaseDao; import com.thinkgem.jeesite.modules.client.entity.ClientEmployee; /** * 客户员工管理DAO接口 * @author 俞超 * @version 2014-11-26 */ @Repository public class ClientEmployeeDao extends BaseDao<ClientEmployee> { }
a845b53fd6dbefcae8ccac66080292f341cb109e
d7362f34d509a4fc2b409abc9c8136f7e6d5db8e
/SimbirSoft/src/main/java/ru/simbir/soft/dao/WordsRepository.java
1678a417fb1e631a4a4bf06024bd77f4ca12bc50
[]
no_license
MarselYsup/SimbirSoft
0419887d7a960c88827ff55558e1fa404a8b02c0
68585899bd0eb71f95a95bb667604d7c2893fa58
refs/heads/master
2023-08-30T12:46:57.301966
2021-10-18T18:31:33
2021-10-18T18:31:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
210
java
package ru.simbir.soft.dao; import java.util.Map; public interface WordsRepository { void save(Map<String,Integer> words,String url); void writeByUrl(String url); void deleteByUrl(String url); }
2ace1e7aed2d7693499ca979d8e5d8348aa1b84d
964601fff9212bec9117c59006745e124b49e1e3
/matos-midp-msa/src/main/java/javax/crypto/NoSuchPaddingException.java
51f0be0f65c18de47e67120018ec82fdc2600262
[ "Apache-2.0" ]
permissive
vadosnaprimer/matos-profiles
bf8300b04bef13596f655d001fc8b72315916693
fb27c246911437070052197aa3ef91f9aaac6fc3
refs/heads/master
2020-05-23T07:48:46.135878
2016-04-05T13:14:42
2016-04-05T13:14:42
null
0
0
null
null
null
null
UTF-8
Java
false
false
991
java
package javax.crypto; /* * #%L * Matos * $Id:$ * $HeadURL:$ * %% * Copyright (C) 2004 - 2014 Orange SA * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ import com.francetelecom.rd.stubs.annotation.ClassDone; @ClassDone public class NoSuchPaddingException extends java.security.GeneralSecurityException{ // Fields // Methods public NoSuchPaddingException(){ return; } public NoSuchPaddingException(String msg){ return; } }
0fefc12fe4ad908d686c7792f46020f335e83d51
e861c6590f6ece5e3c31192e2483c4fa050d0545
/app/src/main/java/plugin/android/ss/com/testsettings/settings/datetime/TimeFormatPreferenceController.java
d981f25612c8f49aafb7496f150a5ab3499cf79b
[]
no_license
calm-sjf/TestSettings
fc9a9c466f007d5eac6b4acdf674cd2e0cffb9a1
fddbb049542ff8423bdecb215b71dbdcc143930c
refs/heads/master
2023-03-22T02:46:23.057328
2020-12-10T07:37:27
2020-12-10T07:37:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,731
java
/* * Copyright (C) 2016 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package plugin.android.ss.com.testsettings.settings.datetime; import android.content.Context; import android.content.Intent; import android.provider.Settings; import android.support.v14.preference.SwitchPreference; import android.support.v7.preference.Preference; import android.support.v7.preference.TwoStatePreference; import android.text.TextUtils; import android.text.format.DateFormat; import com.android.settings.core.PreferenceControllerMixin; import com.android.settingslib.core.AbstractPreferenceController; import java.util.Calendar; import java.util.Date; public class TimeFormatPreferenceController extends AbstractPreferenceController implements PreferenceControllerMixin { static final String HOURS_12 = "12"; static final String HOURS_24 = "24"; private static final String KEY_TIME_FORMAT = "24 hour"; // Used for showing the current date format, which looks like "12/31/2010", "2010/12/13", etc. // The date value is dummy (independent of actual date). private final Calendar mDummyDate; private final boolean mIsFromSUW; private final UpdateTimeAndDateCallback mUpdateTimeAndDateCallback; public TimeFormatPreferenceController(Context context, UpdateTimeAndDateCallback callback, boolean isFromSUW) { super(context); mIsFromSUW = isFromSUW; mDummyDate = Calendar.getInstance(); mUpdateTimeAndDateCallback = callback; } @Override public boolean isAvailable() { return !mIsFromSUW; } @Override public void updateState(Preference preference) { if (!(preference instanceof TwoStatePreference)) { return; } preference.setEnabled( !AutoTimeFormatPreferenceController.isAutoTimeFormatSelection(mContext)); ((TwoStatePreference) preference).setChecked(is24Hour()); final Calendar now = Calendar.getInstance(); mDummyDate.setTimeZone(now.getTimeZone()); // We use December 31st because it's unambiguous when demonstrating the date format. // We use 13:00 so we can demonstrate the 12/24 hour options. mDummyDate.set(now.get(Calendar.YEAR), 11, 31, 13, 0, 0); final Date dummyDate = mDummyDate.getTime(); preference.setSummary(DateFormat.getTimeFormat(mContext).format(dummyDate)); } @Override public boolean handlePreferenceTreeClick(Preference preference) { if (!(preference instanceof TwoStatePreference) || !TextUtils.equals(KEY_TIME_FORMAT, preference.getKey())) { return false; } final boolean is24Hour = ((SwitchPreference) preference).isChecked(); update24HourFormat(mContext, is24Hour); mUpdateTimeAndDateCallback.updateTimeAndDateDisplay(mContext); return true; } @Override public String getPreferenceKey() { return KEY_TIME_FORMAT; } private boolean is24Hour() { return DateFormat.is24HourFormat(mContext); } static void update24HourFormat(Context context, Boolean is24Hour) { set24Hour(context, is24Hour); timeUpdated(context, is24Hour); } static void timeUpdated(Context context, Boolean is24Hour) { Intent timeChanged = new Intent(Intent.ACTION_TIME_CHANGED); timeChanged.addFlags(Intent.FLAG_RECEIVER_INCLUDE_BACKGROUND); int timeFormatPreference; if (is24Hour == null) { timeFormatPreference = Intent.EXTRA_TIME_PREF_VALUE_USE_LOCALE_DEFAULT; } else { timeFormatPreference = is24Hour ? Intent.EXTRA_TIME_PREF_VALUE_USE_24_HOUR : Intent.EXTRA_TIME_PREF_VALUE_USE_12_HOUR; } timeChanged.putExtra(Intent.EXTRA_TIME_PREF_24_HOUR_FORMAT, timeFormatPreference); context.sendBroadcast(timeChanged); } static void set24Hour(Context context, Boolean is24Hour) { String value = is24Hour == null ? null : is24Hour ? HOURS_24 : HOURS_12; Settings.System.putString(context.getContentResolver(), Settings.System.TIME_12_24, value); } }
a59645afab4f11fa6204cf737089a91d3ccef9b8
70a44a8deab374c0fab2a4cb583f710b2ae11381
/Kotlin_Server/Kotlin/src/main/java/com/module/user/controller/UserController.java
ed26875fb56292258fce20d9adb38ae21f7533df
[]
no_license
lixiaohui333/kotlinMall
caa23c212236d860b1e484b80703f976b7d32bfc
49ed385d4cb4a9ce3e3579b3e353d91a5a3f61aa
refs/heads/master
2020-03-27T02:59:05.134287
2018-10-16T16:05:27
2018-10-16T16:05:27
145,831,081
0
0
null
null
null
null
UTF-8
Java
false
false
6,486
java
package com.module.user.controller; import com.module.user.domain.BaseResp; import com.module.user.domain.EditUserReq; import com.module.user.domain.ForgetPwdReq; import com.module.user.domain.LoginReq; import com.module.user.domain.ModifyPwdReq; import com.module.user.domain.RegisterReq; import com.module.user.model.MessageInfo; import com.module.user.model.UserInfo; import com.module.user.service.MessageService; import com.module.user.service.SmsService; import com.module.user.service.UserService; import com.module.user.utils.DateUtil; import com.module.user.utils.push.PushSender; import java.util.Date; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @Controller @RequestMapping(produces = { "application/json;charset=UTF-8" }, value = { "/userCenter" }) public class UserController extends BaseController { @Autowired private UserService userService; @Autowired private MessageService messageService; private static final String DEFAULT_VERIFYCODE = "123456"; @RequestMapping(value = { "/login" }, method = { org.springframework.web.bind.annotation.RequestMethod.POST }) @ResponseBody public BaseResp<UserInfo> loginByPwd(@RequestBody LoginReq req) { BaseResp resp = new BaseResp(); String mobile = req.getMobile(); String pwd = req.getPwd(); if (StringUtils.isEmpty(mobile)) { resp.setStatus(-1); resp.setMessage("手机号码为空"); return resp; } if (StringUtils.isEmpty(pwd)) { resp.setStatus(-1); resp.setMessage("密码为空"); return resp; } UserInfo userInfo = this.userService.getUserByMobile(mobile); if (userInfo == null) { resp.setStatus(-1); resp.setMessage("用户不存在"); return resp; } if (!pwd.equals(userInfo.getUserPwd())) { resp.setStatus(-1); resp.setMessage("密码错误"); return resp; } try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } userInfo.setPushId(req.getPushId()); this.userService.modifyUser(userInfo); sendMessage(userInfo.getId(), req.getPushId()); userInfo.setUserPwd(null); resp.setStatus(0); resp.setMessage("登录成功"); resp.setData(userInfo); return resp; } private void sendMessage(Integer userId, String pushId) { String curTime = DateUtil.format(new Date(), DateUtil.FORMAT_LONG_NEW); MessageInfo msg = new MessageInfo(); msg.setMsgIcon("http://osea2fxp7.bkt.clouddn.com/108x108.png"); msg.setMsgTitle("登录成功"); msg.setMsgContent("恭喜您登录成功"); msg.setMsgTime(curTime); msg.setUserId(userId); this.messageService.addMessage(msg); PushSender.sendLoginEvent(pushId); } @RequestMapping(value = { "/forgetPwd" }, method = { org.springframework.web.bind.annotation.RequestMethod.POST }) @ResponseBody public BaseResp forgetPwd(@RequestBody ForgetPwdReq req) { BaseResp resp = new BaseResp(); String mobile = req.getMobile(); String verifyCode = req.getVerifyCode(); if (StringUtils.isEmpty(mobile)) { resp.setStatus(-1); resp.setMessage("手机号码为空"); return resp; } if (StringUtils.isEmpty(verifyCode)) { resp.setStatus(-1); resp.setMessage("验证码为空"); return resp; } UserInfo userInfo = this.userService.getUserByMobile(mobile); if (userInfo == null) { resp.setStatus(-1); resp.setMessage("用户不存在"); return resp; } if (!"123456".equals(verifyCode)) { resp.setStatus(-1); resp.setMessage("验证码错误"); return resp; } resp.setStatus(0); resp.setMessage("验证成功"); return resp; } @RequestMapping(value = { "/resetPwd" }, method = { org.springframework.web.bind.annotation.RequestMethod.POST }) @ResponseBody public BaseResp<String> resetPwd(@RequestBody ModifyPwdReq req) { BaseResp resp = new BaseResp(); String mobile = req.getMobile(); String pwd = req.getPwd(); if (StringUtils.isEmpty(mobile)) { resp.setStatus(-1); resp.setMessage("手机号码为空"); return resp; } if (StringUtils.isEmpty(pwd)) { resp.setStatus(-1); resp.setMessage("密码为空"); return resp; } UserInfo userInfo = this.userService.getUserByMobile(mobile); if (userInfo == null) { resp.setStatus(-1); resp.setMessage("用户不存在"); return resp; } userInfo.setUserPwd(pwd); int result = this.userService.modifyUser(userInfo); if (result > 0) { resp.setStatus(0); resp.setMessage("密码修改成功"); return resp; } resp.setStatus(-1); resp.setMessage("密码修改失败"); return resp; } @RequestMapping(value = { "/register" }, method = { org.springframework.web.bind.annotation.RequestMethod.POST }) @ResponseBody public BaseResp register(@RequestBody RegisterReq req) { BaseResp resp = new BaseResp(); String mobile = req.getMobile(); String verifyCode = req.getVerifyCode(); UserInfo userInfo = this.userService.getUserByMobile(mobile); if (userInfo != null) { resp.setStatus(-1); resp.setMessage("账号已被注册"); return resp; } if (!"123456".equals(verifyCode)) { resp.setStatus(-1); resp.setMessage("验证码错误"); return resp; } userInfo = new UserInfo(); userInfo.setUserMobile(mobile); userInfo.setUserName(mobile); userInfo.setUserPwd(req.getPwd()); this.userService.addUser(userInfo); resp.setStatus(0); resp.setMessage("注册成功"); return resp; } @RequestMapping(value = { "/editUser" }, method = { org.springframework.web.bind.annotation.RequestMethod.POST }) @ResponseBody public BaseResp<UserInfo> editUser(@RequestBody EditUserReq req) { BaseResp resp = new BaseResp(); UserInfo userInfo = this.userService.getUserById(Integer.valueOf(this.request.getHeader("token")).intValue()); if (userInfo == null) { resp.setStatus(-1); resp.setMessage("用户不存在"); return resp; } userInfo.setId(Integer.valueOf(this.request.getHeader("token"))); userInfo.setUserName(req.getUserName()); userInfo.setUserIcon(req.getUserIcon()); userInfo.setUserGender(req.getGender()); userInfo.setUserSign(req.getSign()); userInfo.setUserPwd(null); this.userService.modifyUser(userInfo); resp.setStatus(0); resp.setData(userInfo); return resp; } }
f78509eaa0a4c22ba49ee16d081f1e74e9111e95
ad5a78d7a0af9deaf916bd674d555f4862872429
/code/src/testing/let_junit_handle_exceptions/Logbook.java
5ee481690f529a30b23ef5f42fd69b40a0ab1137
[]
no_license
memopena/JavaByComparison
39bb6f7e9e070eea3f3c06addf6242ed8c90c48d
59ca51a6c1114f01f8137027badc37f98865dd3f
refs/heads/master
2020-09-20T13:09:30.221926
2019-11-27T18:12:51
2019-11-27T18:12:51
224,490,571
0
1
null
null
null
null
UTF-8
Java
false
false
1,278
java
/*** * Excerpted from "Java By Comparison", * published by The Pragmatic Bookshelf. * Copyrights apply to this code. It may not be used to create training material, * courses, books, articles, and the like. Contact us if you are in doubt. * We make no guarantees that this code is fit for any purpose. * Visit http://www.pragmaticprogrammer.com/titles/javacomp for more book information. ***/ package testing.let_junit_handle_exceptions; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.time.LocalDate; import java.util.LinkedList; import java.util.List; import java.util.Objects; public class Logbook { static final Path CREW_LOG = Paths.get("/var/log/crew.log"); List<String> readEntries(LocalDate date) throws IOException { Objects.requireNonNull(date); List<String> result = new LinkedList<>(); for (String entry : readAllEntries()) { if (entry.startsWith(date.toString())) { result.add(entry); } } return result; } public List<String> readAllEntries() throws IOException { return Files.readAllLines(CREW_LOG, StandardCharsets.UTF_8); } }
6cbe23a46911b1334f51153c15f0600831b449da
a2229381c858f6ad6852a5a386f58191651dd54a
/src/main/java/org/qty/aws/lambda/invoker/LambdaClientFactory.java
f05dde852d272531c9825b9d3b022e4ab657e962
[]
no_license
qrtt1/TWJUG20150801
79cbd4f81e0741e15aa8f9e14285442b226c198e
3a3900192fc80d79a8fc7aa67af57b1943976584
refs/heads/master
2021-01-18T21:12:19.920382
2016-11-03T16:37:54
2016-11-03T16:37:54
40,016,506
3
0
null
null
null
null
UTF-8
Java
false
false
596
java
package org.qty.aws.lambda.invoker; import com.amazonaws.auth.profile.ProfileCredentialsProvider; import com.amazonaws.regions.Region; import com.amazonaws.regions.Regions; import com.amazonaws.services.lambda.AWSLambda; import com.amazonaws.services.lambda.AWSLambdaClient; public class LambdaClientFactory { public static AWSLambda create() { ProfileCredentialsProvider provider = new ProfileCredentialsProvider("qty"); AWSLambda client = new AWSLambdaClient(provider); client.setRegion(Region.getRegion(Regions.AP_NORTHEAST_1)); return client; } }
b2e73658cf1415f9f872ac2f514867803d8cb783
3ec780175d8cce9466a4352b4aceb1344511bb52
/src/main/java/com/william/createwebservice/service/impl/RoleServiceImpl.java
02f041baf97932be198eddaf94b2441a272f068e
[]
no_license
williamcrowley555/create-web-service
6fa62fa9a71a2361e559c3b4ea8efc22934dab12
74c0075696ec60dae33fecc91e6aea0a99a0c7bb
refs/heads/master
2023-07-02T21:29:26.089425
2021-08-02T15:35:20
2021-08-02T15:35:20
387,080,267
0
0
null
null
null
null
UTF-8
Java
false
false
1,178
java
package com.william.createwebservice.service.impl; import com.william.createwebservice.exception.RoleServiceException; import com.william.createwebservice.io.entity.RoleEntity; import com.william.createwebservice.io.repository.RoleRepository; import com.william.createwebservice.service.RoleService; import com.william.createwebservice.shared.dto.RoleDTO; import com.william.createwebservice.ui.model.response.Role; import org.modelmapper.ModelMapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Optional; @Service public class RoleServiceImpl implements RoleService { @Autowired private RoleRepository roleRepository; @Override public RoleDTO getRoleByName(Role roleName) { Optional<RoleEntity> optional = roleRepository.findByName(roleName); if (optional.isEmpty()) { throw new RoleServiceException("Role is not found"); } ModelMapper modelMapper = new ModelMapper(); RoleEntity roleEntity = optional.get(); RoleDTO returnValue = modelMapper.map(roleEntity, RoleDTO.class); return returnValue; } }
40af2dc61cf56939536d3d037bf4a164a1c0fc8e
c8d88eecb9168ecfdabfc590c3afe320db670512
/cloud-gateway/src/test/java/com/lollaby/cloud/gateway/CloudGatewayApplicationTests.java
8d3e37e67bc7d0452b0a40500bf4af69f96cc096
[]
no_license
khadija1604/MicroservicesFullExample
53c3c59a964d20797bb3ddee08b4496a09505a91
8e6d9a1e63b2938a183b588e179ba3dfa5932e95
refs/heads/master
2023-03-03T04:08:20.221899
2021-02-15T12:18:51
2021-02-15T12:18:51
339,067,879
0
0
null
null
null
null
UTF-8
Java
false
false
223
java
package com.lollaby.cloud.gateway; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; @SpringBootTest class CloudGatewayApplicationTests { @Test void contextLoads() { } }
3e0cb1eed38b7d02f103a479d75c6dde3f572f8c
7ff1095bd15f74c5eb93550933d898e8266d0565
/src/main/java/analyzer/exercises/Comment.java
24627f276c69bb645f3441b909655539ac5e72bc
[ "AGPL-3.0-only" ]
permissive
jmrunkle/java-analyzer
1f4e74b1b2e7d0cd95d5033fb9edaeece5158a65
9067665c05e2145f614d16046ab7f01b0c0d0add
refs/heads/master
2021-09-24T03:49:03.535626
2021-08-30T10:33:25
2021-08-30T10:33:25
204,031,719
0
0
MIT
2019-08-23T16:11:50
2019-08-23T16:11:50
null
UTF-8
Java
false
false
78
java
package analyzer.exercises; public interface Comment { String toJson(); }
1aac5ce18e7ba6a47cb8967ac40dc7fe1e65c79c
a6e2e542027bf7854710654bfbcf5af59f448a92
/app/controllers/RouteController.java
f0d6670da88632bf183a4010b7723122d68fd443
[ "Apache-2.0" ]
permissive
smartrockclimbing/Smart-Rock-Climbing
45bae5a9b94f362437badf8ecf5c1b6ba75f5335
532ccedaf8450b433aaf55b88944a92351f3af25
refs/heads/master
2021-01-10T04:12:33.605190
2016-03-27T02:46:40
2016-03-27T02:46:40
49,612,290
0
0
null
null
null
null
UTF-8
Java
false
false
1,580
java
package controllers; import play.mvc.Controller; import play.mvc.Result; public class RouteController extends Controller { // Returns new route id in response // Route info contained in POST data // Only admins can create routes public Result createRoute(){ String string = "Route Created"; return ok(string); } // Returns JSON in response public Result getRouteById(Long routeId){ // Long climbIdentifier = Long.parseUnsignedLong(climbId); // String l1Str = Long.toUnsignedString(climbIdentifier); String string = "Got route by id\n{route_id: " + routeId.toString() + "}"; return ok(string); } // Returns JSON in response public Result getRouteByGPS(String lat, String longitude){ // Long climbIdentifier = Long.parseUnsignedLong(climbId); // String l1Str = Long.toUnsignedString(climbIdentifier); String string = "Got route by coordinates\nlatitude: " + lat + ", longitude: " + longitude + " }"; return ok(string); } // Returns JSON in response public Result getAllRoutes(){ String string = "Got all routes!"; return ok(string); } // Returns result in response // Onl y admins can delete routes public Result deleteRoute(Long routeId){ // Long climbIdentifier = Long.parseUnsignedLong(climbId); // String l1Str = Long.toUnsignedString(climbIdentifier); String string = "Delete route\n{route_id: " + routeId.toString() + "}"; return ok(string); } }
ea51e1d5ce1d64f4fda0dc4140f213d0c654dbc3
3b6d6f30b455f70918b3b4bde34732a134312138
/simple-stack-mortar-sample/src/main/java/com/example/mortar/screen/ChatScreen.java
bb07bc20df98fd93897e6054817ef031df125b29
[ "Apache-2.0" ]
permissive
ninjahoahong/simple-stack
19b24452c7da34953abfd4e3c9679b564e91acf8
ab40d30d26d0d90c5d17acc14b992840c5d8bb76
refs/heads/master
2021-04-27T19:06:21.058395
2018-07-17T13:15:12
2018-07-17T13:15:12
122,350,608
0
0
Apache-2.0
2018-02-21T15:01:08
2018-02-21T15:01:08
null
UTF-8
Java
false
false
6,387
java
/* * Copyright 2013 Square 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.example.mortar.screen; import android.support.annotation.Nullable; import android.util.Log; import com.example.mortar.R; import com.example.mortar.android.ActionBarOwner; import com.example.mortar.core.SingletonComponent; import com.example.mortar.model.Chat; import com.example.mortar.model.Chats; import com.example.mortar.model.Message; import com.example.mortar.util.BaseKey; import com.example.mortar.util.DaggerService; import com.example.mortar.util.Subscope; import com.example.mortar.util.ViewPresenter; import com.example.mortar.view.ChatView; import com.example.mortar.view.Confirmation; import com.google.auto.value.AutoValue; import com.zhuinden.servicetree.ServiceTree; import com.zhuinden.simplestack.navigator.Navigator; import com.zhuinden.statebundle.StateBundle; import javax.inject.Inject; import dagger.Provides; import io.reactivex.disposables.Disposable; import io.reactivex.disposables.Disposables; import io.reactivex.functions.Action; import io.reactivex.observers.DisposableObserver; import mortar.PopupPresenter; @AutoValue public abstract class ChatScreen extends BaseKey { public abstract int conversationIndex(); public static ChatScreen create(int conversationIndex) { return new AutoValue_ChatScreen(conversationIndex); } @Override public void bindServices(ServiceTree.Node node) { SingletonComponent singletonComponent = DaggerService.get(node); node.bindService(DaggerService.SERVICE_NAME, // DaggerChatScreen_Component.builder() // .singletonComponent(singletonComponent) // .module(new Module(conversationIndex())) // .build()); node.bindService("PRESENTER", DaggerService.<Component>get(node).presenter()); // <-- for Bundleable callback } @Override public int layout() { return R.layout.chat_view; } @dagger.Component(dependencies = {SingletonComponent.class}, modules = {Module.class}) @Subscope public interface Component extends SingletonComponent { Presenter presenter(); void inject(ChatView chatView); } @dagger.Module public static class Module { private final int conversationIndex; public Module(int conversationIndex) { this.conversationIndex = conversationIndex; } @Provides Chat conversation(Chats chats) { return chats.getChat(conversationIndex); } } @Subscope public static class Presenter extends ViewPresenter<ChatView> implements ServiceTree.Scoped { private final Chat chat; private final ActionBarOwner actionBar; private final PopupPresenter<Confirmation, Boolean> confirmer; private Disposable running = Disposables.empty(); @Inject public Presenter(Chat chat, ActionBarOwner actionBar) { this.chat = chat; this.actionBar = actionBar; this.confirmer = new PopupPresenter<Confirmation, Boolean>() { @Override protected void onPopupResult(Boolean confirmed) { if(confirmed) { Presenter.this.getView().toast("Haven't implemented that, friend."); } } }; } @Override public void dropView(ChatView view) { confirmer.dropView(view.getConfirmerPopup()); super.dropView(view); } @Override public void onLoad(@Nullable StateBundle savedInstanceState) { if(!hasView()) { return; } ActionBarOwner.Config actionBarConfig = actionBar.getConfig(); actionBarConfig = actionBarConfig.withAction(new ActionBarOwner.MenuAction("End", new Action() { @Override public void run() { confirmer.show(new Confirmation("End Chat", "Do you really want to leave this chat?", "Yes", "I guess not")); } })); actionBar.setConfig(actionBarConfig); confirmer.takeView(getView().getConfirmerPopup()); running = chat.getMessages().subscribeWith(new DisposableObserver<Message>() { @Override public void onComplete() { Log.w(getClass().getName(), "That's surprising, never thought this should end."); running = Disposables.empty(); } @Override public void onError(Throwable e) { Log.w(getClass().getName(), "'sploded, will try again on next config change."); Log.w(getClass().getName(), e); running = Disposables.empty(); } @Override public void onNext(Message message) { if(!hasView()) { return; } getView().getItems().add(message); } }); } @Override public void onExitScope() { ensureStopped(); } public void onConversationSelected(int position) { Navigator.getBackstack(getView().getContext()).goTo(MessageScreen.create(chat.getId(), position)); } public void visibilityChanged(boolean visible) { if(!visible) { ensureStopped(); } } private void ensureStopped() { running.dispose(); } } @Override public String title() { return "Chat"; } }
3daf67b4aea5719029cba229e60644c1cd5cc71f
bc65d65ffb9d7a2a42c2d12dcfcb8ebcfa43054c
/assignment01/src/ThatsYourstory.java
73b569abc91de5abd0136a14bb0c8dbbc32abce6
[]
no_license
sholoms/itp
87847604f2d235813b4902ecacaf3bb392c630bd
b6c8f417f6c34e96b3424badc56e1c5481e83586
refs/heads/main
2023-08-23T08:19:12.191559
2021-10-28T23:17:33
2021-10-28T23:17:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,455
java
// uses this class because that is what it says in the specs public class ThatsYourstory { public static void main(String[] args) { // used this size gterm window because this size fit well with the design GTerm gt = new GTerm(1100, 800); // used these colours because the contrast was nice gt.setBackgroundColor(30, 250, 200); gt.setFontColor(225, 15, 175); // no alternate data types // alternate names: name // used kidName because it is more descriptive and easier to remember whos name String kidName = gt.getInputString("Enter boys name"); // no alternate data types // alternate names: age // used kidAge because it is more descriptive and easier to remember whos age int kidAge = Integer.parseInt(gt.getInputString("Enter boys age between 3 and 10")); while (kidAge > 10 || kidAge < 3) { kidAge = Integer.parseInt(gt.getInputString("boys age must be between 3 and 10")); } // no alternate data types // alternate names: kidsFood // just used supper because being as there is only one "food" therefore nothing // to get confused with and it is descriptive String food = gt.getInputString("Enter pizza, hotdogs or fish and chips"); // no alternate data types // alternate names foodShop // used shop because it is short and being as there is only one shop it is // descriptive String shop = ""; // no reason to have any specific order so did this one just // to be consistent with the order that the options were given in // compared the first char as oppose to the whole string because it is a less // demanding comparison // included all this in the if else statements because only want one of these // options to happen based on user input if (food.charAt(0) == 'p' || food.charAt(0) == 'P') { shop = "pizza shop"; } else if (food.charAt(0) == 'h' || food.charAt(0) == 'H') { shop = "butcher"; } else { shop = "fish shop"; } // title // all font sizes, placements and colours because they looked nice gt.setXY(400, 25); gt.setFontSize(25); gt.println("Is It Supper Time Yet"); // first question gt.setFontSize(18); gt.setXY(25, 150); gt.println("There once was a boy named " + kidName + " who was " + kidAge + " years old."); gt.println( "One day when " + kidName + " was picked up from school, \nhe asked his mother is it supper time yet?"); // first pic gt.setXY(700, 100); gt.addImageIcon("leavingSchool.jpg"); // second question gt.setXY(375, 325); gt.println("No " + kidName + " his mother responded,\n first we have to order our food from the " + shop); // second pic gt.setXY(75, 250); // couldnt think of any reason to have any specific order so did this one just // to be consistent with the order that the options were given in // compared the first char as oppose to the whole string because it is a less // demanding comparison // included all this in the if else statements because i only want one of these // options to happen based on user input if (shop.charAt(0) == 'p') { gt.addImageIcon("pizzaShop.jpg"); } else if (shop.charAt(0) == 'b') { gt.addImageIcon("butcher.jpg"); } else { gt.addImageIcon("fishShop.png"); } // third question gt.setXY(25, 475); gt.println("After they ordered their " + food + " from the shop, " + kidName + "\n asked is it supper yet?"); gt.println("No answered his mother, first we have to pay for the food"); // third pic gt.setXY(700, 400); gt.addImageIcon("cashRegister.jpg"); // fourth question gt.setXY(375, 650); gt.println("Once they had paid " + kidName + " asked his mother is it supper time yet?"); gt.println("Yes answered his mother, it is time to eat our delicious " + food); // fourth pic gt.setXY(75, 555); gt.addImageIcon("supperTime.jpg"); /* * picture sources * Pick up from school; https://www.freepik.com/premium-vector/teacher-mother-boy-school- * class_6326923.htm * Pizza shop: https://www.clipartmax.com/middle/m2H7i8Z5m2A0d3A0_pizza-fast-food-italian- * cuisine-illustration-pizza-shop-cartoon/ * Butcher: https://www.colourbox.com/vector/cartoon-chef-cook-character-and-meat-shop- * vector-35894778 * Fish shop: https://www.facebook.com/batterfishandchipsshop/ * Supper time: https://www.dreamstime.com/illustration/cartoon-family-eating.html Cash * register: https://www.cleanpng.com/png-cashier-cash-register-clip-art-cashier-830928/ * */ } }
624be4da10cfaa65c80f7546d1517e10bee60637
4c8f90b99fc6a540b32d2ec606f138912579fb90
/src/main/java/com/example/demo/DemoApplication.java
9dafde9de0bc0d2946ff8b24ff73d7374b1eb841
[]
no_license
Muhidin123/spring-boot-practice
b91fe13d01d383e079a974d8dafcc0022398d359
c9bf4e7a0bef65d54cf66e5ec5bb776276794578
refs/heads/main
2023-04-17T02:26:50.397146
2021-04-02T15:48:19
2021-04-02T15:48:19
353,470,359
0
0
null
null
null
null
UTF-8
Java
false
false
1,022
java
package com.example.demo; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; //import org.springframework.context.annotation.Bean; import org.springframework.web.bind.annotation.CrossOrigin; //import org.springframework.web.servlet.config.annotation.CorsRegistry; //import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @SpringBootApplication @CrossOrigin //CAN BE USED TO ENABLE CROSS ORIGIN public class DemoApplication { public static void main(String[] args) { SpringApplication.run(DemoApplication.class, args); } //USING THIS METHOD WILL ENABLE CROSS ORIGIN // @Bean // public WebMvcConfigurer corsConfigurer() { // return new WebMvcConfigurer() { // @Override // public void addCorsMappings(CorsRegistry registry) { // registry.addMapping("/").allowedOrigins("http://localhost:8080", "http://localhost:3000"); // } // }; // } }
2afd22bf5ae5366523da8a8acf2d25259d6a31b7
3c0b7dbb2df2baebb239a894d755ada2402df4f8
/lab2/src/main/java/lab2/MyMutation.java
b4179722f1b29450870c50d979405fcf7038fd67
[]
no_license
asantep/EvolutionaryComputing
84d2f85f8b95d058f9e4b75b54d94e3ece83943c
6666d5b4054f1ab5f5f6e6252fd97b7dc1b879ee
refs/heads/master
2020-08-15T21:05:16.281951
2019-10-15T22:30:29
2019-10-15T22:30:29
215,407,720
0
0
null
null
null
null
UTF-8
Java
false
false
975
java
package lab2; import org.uncommons.watchmaker.framework.EvolutionaryOperator; import java.util.List; import java.util.Random; public class MyMutation implements EvolutionaryOperator<double[]> { int counter = 1; double pointer = 0.6; public List<double[]> apply(List<double[]> population, Random random) { // initial population // need to change individuals, but not their number! // your implementation: for(double[] solution: population){ double alpha = 8/Math.pow(counter,pointer); if (alpha < 0.4){ double zigma = random.nextDouble() * 1; for (int i=0; i<population.get(0).length; i++) { if (zigma < alpha || zigma > pointer) { solution[i] += random.nextGaussian() * alpha; } } } } counter++; return population; } }
a6443911ca68bfe70c74510b1416e336c7c8bbba
f7f29b8c8a8b997ecd8ae3009d17bd7cd42317f8
/35 - IOCProj35-SpringBeanLife-DeclarativeApproach/src/main/java/com/nt/test/SpringBeanLifeCycleTest_BF.java
2561591e33b178c88ce0dd182cd44c3ccf2e97be
[]
no_license
PraveenJavaWorld/Spring
802244885ec9f4e5710a5af630e47621c1c6d973
d4f987b987f2a8b142440c992114ecb66aec3412
refs/heads/master
2023-05-29T08:06:25.273785
2021-06-11T16:18:35
2021-06-11T16:18:35
315,967,988
1
0
null
null
null
null
UTF-8
Java
false
false
795
java
package com.nt.test; import org.springframework.beans.factory.support.DefaultListableBeanFactory; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import com.nt.beans.VoterEligibilityChecking; public class SpringBeanLifeCycleTest_BF { public static void main(String[] args) { //create IOC Container DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); //create XmlBeanDefinitionReader obj XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory); //load and parse xml file reader.loadBeanDefinitions("com/nt/cfgs/applicationContext.xml"); //get Spring bean VoterEligibilityChecking vote = factory.getBean("vote",VoterEligibilityChecking.class); System.out.println(vote.checking()); } }
f82d86189ccadfd158418e575209ac34db35e60c
4627d514d6664526f58fbe3cac830a54679749cd
/results/evosuite5/time-org.joda.time.format.DateTimeFormatterBuilder$PaddedNumber-5/org/joda/time/format/DateTimeFormatterBuilder$PaddedNumber_ESTest_scaffolding.java
e1ef5d04046350a19c259e7d1232c864e89167f9
[]
no_license
STAMP-project/Cling-application
c624175a4aa24bb9b29b53f9b84c42a0f18631bd
0ff4d7652b434cbfd9be8d8bb38cfc8d8eaa51b5
refs/heads/master
2022-07-27T09:30:16.423362
2022-07-19T12:01:46
2022-07-19T12:01:46
254,310,667
2
2
null
2021-07-12T12:29:50
2020-04-09T08:11:35
null
UTF-8
Java
false
false
21,735
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Tue Aug 20 22:05:41 GMT 2019 */ package org.joda.time.format; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; import org.junit.AfterClass; import org.evosuite.runtime.sandbox.Sandbox; import org.evosuite.runtime.sandbox.Sandbox.SandboxMode; @EvoSuiteClassExclude public class DateTimeFormatterBuilder$PaddedNumber_ESTest_scaffolding { @org.junit.Rule public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule(); private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone(); private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000); @BeforeClass public static void initEvoSuiteFramework() { org.evosuite.runtime.RuntimeSettings.className = "org.joda.time.format.DateTimeFormatterBuilder$PaddedNumber"; org.evosuite.runtime.GuiSupport.initialize(); org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100; org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000; org.evosuite.runtime.RuntimeSettings.mockSystemIn = true; org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED; org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT(); org.evosuite.runtime.classhandling.JDKClassResetter.init(); setSystemProperties(); initializeClasses(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); } @AfterClass public static void clearEvoSuiteFramework(){ Sandbox.resetDefaultSecurityManager(); java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); } @Before public void initTestCase(){ threadStopper.storeCurrentThreads(); threadStopper.startRecordingTime(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler(); org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode(); setSystemProperties(); org.evosuite.runtime.GuiSupport.setHeadless(); org.evosuite.runtime.Runtime.getInstance().resetRuntime(); org.evosuite.runtime.agent.InstrumentingAgent.activate(); } @After public void doneWithTestCase(){ threadStopper.killAndJoinClientThreads(); org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks(); org.evosuite.runtime.classhandling.JDKClassResetter.reset(); resetClasses(); org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode(); org.evosuite.runtime.agent.InstrumentingAgent.deactivate(); org.evosuite.runtime.GuiSupport.restoreHeadlessMode(); } public static void setSystemProperties() { java.lang.System.setProperties((java.util.Properties) defaultProperties.clone()); java.lang.System.setProperty("user.timezone", "Europe/Amsterdam"); java.lang.System.setProperty("user.dir", "/home/pderakhshanfar/rq3/botsing-integration-experiment"); java.lang.System.setProperty("java.io.tmpdir", "/tmp"); } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(DateTimeFormatterBuilder$PaddedNumber_ESTest_scaffolding.class.getClassLoader() , "org.joda.time.DateTimeZone", "org.joda.time.tz.DateTimeZoneBuilder$RuleSet", "org.joda.time.tz.DateTimeZoneBuilder$Transition", "org.joda.time.field.AbstractPartialFieldProperty", "org.joda.time.field.StrictDateTimeField", "org.joda.time.convert.ConverterSet$Entry", "org.joda.time.DateTimeFieldType$StandardDateTimeFieldType", "org.joda.time.chrono.BasicChronology$HalfdayField", "org.joda.time.format.DateTimeFormatterBuilder$TwoDigitYear", "org.joda.time.chrono.BasicChronology$YearInfo", "org.joda.time.LocalDate$Property", "org.joda.time.field.UnsupportedDurationField", "org.joda.time.DateMidnight$Property", "org.joda.time.format.PeriodFormatterBuilder$CompositeAffix", "org.joda.time.ReadWritableInterval", "org.joda.time.format.PeriodFormatterBuilder", "org.joda.time.format.DateTimePrinter", "org.joda.time.base.BaseLocal", "org.joda.time.chrono.ISOChronology", "org.joda.time.chrono.LenientChronology", "org.joda.time.format.PeriodFormatterBuilder$FieldFormatter", "org.joda.time.field.DividedDateTimeField", "org.joda.time.convert.DateConverter", "org.joda.time.chrono.ZonedChronology", "org.joda.time.format.DateTimeFormatterBuilder$TimeZoneOffset", "org.joda.time.field.BaseDateTimeField", "org.joda.time.field.ZeroIsMaxDateTimeField", "org.joda.time.base.BaseInterval", "org.joda.time.Duration", "org.joda.time.format.FormatUtils", "org.joda.time.format.PeriodFormatter", "org.joda.time.Interval", "org.joda.time.convert.LongConverter", "org.joda.time.base.AbstractInstant", "org.joda.time.tz.DateTimeZoneBuilder", "org.joda.time.format.DateTimeParserBucket", "org.joda.time.ReadWritablePeriod", "org.joda.time.convert.ConverterSet", "org.joda.time.LocalDateTime", "org.joda.time.tz.FixedDateTimeZone", "org.joda.time.base.BasePeriod$1", "org.joda.time.convert.IntervalConverter", "org.joda.time.format.PeriodPrinter", "org.joda.time.field.PreciseDateTimeField", "org.joda.time.chrono.LimitChronology$LimitException", "org.joda.time.convert.ReadableDurationConverter", "org.joda.time.base.BaseDuration", "org.joda.time.field.DecoratedDateTimeField", "org.joda.time.format.DateTimeFormatterBuilder$TimeZoneId", "org.joda.time.YearMonthDay", "org.joda.time.format.DateTimeParser", "org.joda.time.format.DateTimeFormatterBuilder$CharacterLiteral", "org.joda.time.YearMonth", "org.joda.time.chrono.GJChronology$CutoverField", "org.joda.time.LocalTime$Property", "org.joda.time.field.OffsetDateTimeField", "org.joda.time.DateTime$Property", "org.joda.time.convert.ReadablePeriodConverter", "org.joda.time.convert.ReadableIntervalConverter", "org.joda.time.DateTimeField", "org.joda.time.field.FieldUtils", "org.joda.time.format.ISODateTimeFormat", "org.joda.time.Partial", "org.joda.time.field.SkipDateTimeField", "org.joda.time.base.AbstractPeriod", "org.joda.time.chrono.GJDayOfWeekDateTimeField", "org.joda.time.DateTimeUtils$SystemMillisProvider", "org.joda.time.IllegalFieldValueException", "org.joda.time.format.DateTimeFormatterBuilder$Composite", "org.joda.time.format.DateTimeFormatterBuilder$UnpaddedNumber", "org.joda.time.field.ImpreciseDateTimeField$LinkedDurationField", "org.joda.time.ReadablePeriod", "org.joda.time.chrono.ZonedChronology$ZonedDateTimeField", "org.joda.time.chrono.GregorianChronology", "org.joda.time.convert.ConverterManager", "org.joda.time.chrono.GJChronology$LinkedDurationField", "org.joda.time.format.DateTimeFormatterBuilder$PaddedNumber", "org.joda.time.Minutes", "org.joda.time.chrono.BasicMonthOfYearDateTimeField", "org.joda.time.base.AbstractPartial", "org.joda.time.base.BasePartial", "org.joda.time.base.BaseDateTime", "org.joda.time.DateTimeUtils", "org.joda.time.base.AbstractDuration", "org.joda.time.LocalTime", "org.joda.time.base.AbstractInterval", "org.joda.time.Hours", "org.joda.time.base.BasePeriod", "org.joda.time.field.DecoratedDurationField", "org.joda.time.tz.DateTimeZoneBuilder$DSTZone", "org.joda.time.TimeOfDay$Property", "org.joda.time.TimeOfDay", "org.joda.time.format.ISOPeriodFormat", "org.joda.time.Partial$Property", "org.joda.time.field.ImpreciseDateTimeField", "org.joda.time.chrono.CopticChronology", "org.joda.time.field.PreciseDurationField", "org.joda.time.DateTimeUtils$FixedMillisProvider", "org.joda.time.tz.DateTimeZoneBuilder$OfYear", "org.joda.time.ReadableDuration", "org.joda.time.chrono.BasicGJChronology", "org.joda.time.format.DateTimeFormatterBuilder$NumberFormatter", "org.joda.time.DurationField", "org.joda.time.format.DateTimeFormatter", "org.joda.time.format.DateTimeFormatterBuilder$TimeZoneName", "org.joda.time.chrono.IslamicChronology$LeapYearPatternType", "org.joda.time.DateTime", "org.joda.time.format.PeriodFormatterBuilder$SimpleAffix", "org.joda.time.ReadWritableDateTime", "org.joda.time.convert.PeriodConverter", "org.joda.time.chrono.ZonedChronology$ZonedDurationField", "org.joda.time.Instant", "org.joda.time.convert.CalendarConverter", "org.joda.time.format.PeriodFormatterBuilder$Separator", "org.joda.time.chrono.LimitChronology$LimitDurationField", "org.joda.time.chrono.BasicDayOfYearDateTimeField", "org.joda.time.DurationFieldType$StandardDurationFieldType", "org.joda.time.chrono.BuddhistChronology", "org.joda.time.format.DateTimeFormatterBuilder$StringLiteral", "org.joda.time.tz.DateTimeZoneBuilder$Recurrence", "org.joda.time.convert.ReadablePartialConverter", "org.joda.time.DateTimeUtils$MillisProvider", "org.joda.time.DateTimeUtils$OffsetMillisProvider", "org.joda.time.convert.Converter", "org.joda.time.chrono.GJYearOfEraDateTimeField", "org.joda.time.convert.PartialConverter", "org.joda.time.Seconds", "org.joda.time.field.RemainderDateTimeField", "org.joda.time.JodaTimePermission", "org.joda.time.chrono.BasicWeekOfWeekyearDateTimeField", "org.joda.time.DateTimeFieldType", "org.joda.time.format.DateTimeFormatterBuilder$Fraction", "org.joda.time.format.DateTimeFormatterBuilder$FixedNumber", "org.joda.time.MutableDateTime$Property", "org.joda.time.ReadableInterval", "org.joda.time.chrono.LimitChronology$LimitDateTimeField", "org.joda.time.tz.DateTimeZoneBuilder$PrecalculatedZone", "org.joda.time.field.LenientDateTimeField", "org.joda.time.base.AbstractDateTime", "org.joda.time.field.SkipUndoDateTimeField", "org.joda.time.convert.AbstractConverter", "org.joda.time.field.DelegatedDateTimeField", "org.joda.time.chrono.BasicChronology", "org.joda.time.chrono.BasicYearDateTimeField", "org.joda.time.format.DateTimeFormatterBuilder", "org.joda.time.chrono.EthiopicChronology", "org.joda.time.tz.CachedDateTimeZone$Info", "org.joda.time.PeriodType", "org.joda.time.field.MillisDurationField", "org.joda.time.chrono.GJChronology", "org.joda.time.chrono.IslamicChronology", "org.joda.time.format.DateTimeFormatterBuilder$TextField", "org.joda.time.LocalDateTime$Property", "org.joda.time.chrono.BasicFixedMonthChronology", "org.joda.time.YearMonthDay$Property", "org.joda.time.field.UnsupportedDateTimeField", "org.joda.time.field.ScaledDurationField", "org.joda.time.chrono.ISOYearOfEraDateTimeField", "org.joda.time.field.PreciseDurationDateTimeField", "org.joda.time.MonthDay", "org.joda.time.MutablePeriod", "org.joda.time.MutableDateTime", "org.joda.time.tz.CachedDateTimeZone", "org.joda.time.ReadableDateTime", "org.joda.time.format.PeriodFormatterBuilder$Literal", "org.joda.time.format.PeriodParser", "org.joda.time.format.PeriodFormatterBuilder$PluralAffix", "org.joda.time.DateMidnight", "org.joda.time.convert.DurationConverter", "org.joda.time.chrono.GJMonthOfYearDateTimeField", "org.joda.time.format.DateTimeParserBucket$SavedState", "org.joda.time.chrono.BasicWeekyearDateTimeField", "org.joda.time.tz.DateTimeZoneBuilder$Rule", "org.joda.time.Days", "org.joda.time.format.DateTimeFormatterBuilder$MatchingParser", "org.joda.time.chrono.BasicSingleEraDateTimeField", "org.joda.time.format.DateTimeFormat", "org.joda.time.YearMonth$Property", "org.joda.time.chrono.LimitChronology", "org.joda.time.tz.UTCProvider", "org.joda.time.ReadableInstant", "org.joda.time.base.BaseSingleFieldPeriod", "org.joda.time.convert.NullConverter", "org.joda.time.tz.DefaultNameProvider", "org.joda.time.tz.Provider", "org.joda.time.chrono.AssembledChronology$Fields", "org.joda.time.DurationFieldType", "org.joda.time.MutableInterval", "org.joda.time.ReadWritableInstant", "org.joda.time.tz.NameProvider", "org.joda.time.convert.ReadableInstantConverter", "org.joda.time.convert.StringConverter", "org.joda.time.convert.InstantConverter", "org.joda.time.chrono.AssembledChronology", "org.joda.time.chrono.StrictChronology", "org.joda.time.chrono.GJEraDateTimeField", "org.joda.time.tz.ZoneInfoProvider", "org.joda.time.DateTimeZone$1", "org.joda.time.chrono.BaseChronology", "org.joda.time.chrono.JulianChronology", "org.joda.time.Period", "org.joda.time.Weeks", "org.joda.time.Chronology", "org.joda.time.format.PeriodFormatterBuilder$Composite", "org.joda.time.field.AbstractReadableInstantFieldProperty", "org.joda.time.format.PeriodFormatterBuilder$PeriodFieldAffix", "org.joda.time.LocalDate", "org.joda.time.format.DateTimeParserBucket$SavedField", "org.joda.time.chrono.BasicDayOfMonthDateTimeField", "org.joda.time.MonthDay$Property", "org.joda.time.ReadablePartial", "org.joda.time.chrono.GJChronology$ImpreciseCutoverField", "org.joda.time.field.BaseDurationField" ); } private static void resetClasses() { org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(DateTimeFormatterBuilder$PaddedNumber_ESTest_scaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( "org.joda.time.format.DateTimeFormatterBuilder$NumberFormatter", "org.joda.time.format.DateTimeFormatterBuilder$PaddedNumber", "org.joda.time.format.FormatUtils", "org.joda.time.DateTimeFieldType$StandardDateTimeFieldType", "org.joda.time.DurationFieldType$StandardDurationFieldType", "org.joda.time.DurationFieldType", "org.joda.time.DateTimeFieldType", "org.joda.time.format.DateTimeFormatterBuilder$FixedNumber", "org.joda.time.Chronology", "org.joda.time.chrono.BaseChronology", "org.joda.time.chrono.AssembledChronology", "org.joda.time.DateTimeField", "org.joda.time.field.BaseDateTimeField", "org.joda.time.chrono.BasicSingleEraDateTimeField", "org.joda.time.tz.FixedDateTimeZone", "org.joda.time.tz.ZoneInfoProvider", "org.joda.time.tz.DefaultNameProvider", "org.joda.time.DateTimeZone", "org.joda.time.base.AbstractInstant", "org.joda.time.Instant", "org.joda.time.chrono.GJChronology", "org.joda.time.DateTimeUtils$SystemMillisProvider", "org.joda.time.DateTimeUtils", "org.joda.time.DurationField", "org.joda.time.field.MillisDurationField", "org.joda.time.field.BaseDurationField", "org.joda.time.field.PreciseDurationField", "org.joda.time.field.PreciseDurationDateTimeField", "org.joda.time.field.PreciseDateTimeField", "org.joda.time.field.DecoratedDateTimeField", "org.joda.time.field.ZeroIsMaxDateTimeField", "org.joda.time.chrono.BasicChronology$HalfdayField", "org.joda.time.chrono.BasicChronology", "org.joda.time.chrono.BasicGJChronology", "org.joda.time.chrono.AssembledChronology$Fields", "org.joda.time.field.ImpreciseDateTimeField", "org.joda.time.chrono.BasicYearDateTimeField", "org.joda.time.field.ImpreciseDateTimeField$LinkedDurationField", "org.joda.time.chrono.GJYearOfEraDateTimeField", "org.joda.time.field.OffsetDateTimeField", "org.joda.time.field.DividedDateTimeField", "org.joda.time.field.DecoratedDurationField", "org.joda.time.field.ScaledDurationField", "org.joda.time.field.RemainderDateTimeField", "org.joda.time.chrono.GJEraDateTimeField", "org.joda.time.chrono.GJDayOfWeekDateTimeField", "org.joda.time.chrono.BasicDayOfMonthDateTimeField", "org.joda.time.chrono.BasicDayOfYearDateTimeField", "org.joda.time.chrono.BasicMonthOfYearDateTimeField", "org.joda.time.chrono.GJMonthOfYearDateTimeField", "org.joda.time.chrono.BasicWeekyearDateTimeField", "org.joda.time.chrono.BasicWeekOfWeekyearDateTimeField", "org.joda.time.field.DelegatedDateTimeField", "org.joda.time.field.SkipDateTimeField", "org.joda.time.field.UnsupportedDurationField", "org.joda.time.chrono.JulianChronology", "org.joda.time.chrono.GregorianChronology", "org.joda.time.chrono.BasicChronology$YearInfo", "org.joda.time.field.FieldUtils", "org.joda.time.chrono.GJChronology$CutoverField", "org.joda.time.chrono.GJChronology$ImpreciseCutoverField", "org.joda.time.chrono.GJChronology$LinkedDurationField", "org.joda.time.field.SkipUndoDateTimeField", "org.joda.time.base.AbstractDateTime", "org.joda.time.base.BaseDateTime", "org.joda.time.DateTime", "org.joda.time.chrono.LimitChronology", "org.joda.time.chrono.LimitChronology$LimitDurationField", "org.joda.time.chrono.LimitChronology$LimitDateTimeField", "org.joda.time.chrono.BuddhistChronology", "org.joda.time.tz.DateTimeZoneBuilder", "org.joda.time.tz.DateTimeZoneBuilder$PrecalculatedZone", "org.joda.time.tz.DateTimeZoneBuilder$DSTZone", "org.joda.time.tz.DateTimeZoneBuilder$Recurrence", "org.joda.time.tz.DateTimeZoneBuilder$OfYear", "org.joda.time.tz.CachedDateTimeZone", "org.joda.time.chrono.ZonedChronology", "org.joda.time.chrono.ZonedChronology$ZonedDurationField", "org.joda.time.chrono.ZonedChronology$ZonedDateTimeField", "org.joda.time.tz.CachedDateTimeZone$Info", "org.joda.time.base.AbstractPartial", "org.joda.time.base.BaseLocal", "org.joda.time.chrono.ISOYearOfEraDateTimeField", "org.joda.time.chrono.ISOChronology", "org.joda.time.LocalTime", "org.joda.time.chrono.IslamicChronology$LeapYearPatternType", "org.joda.time.chrono.IslamicChronology", "org.joda.time.IllegalFieldValueException", "org.joda.time.chrono.BasicFixedMonthChronology", "org.joda.time.chrono.EthiopicChronology", "org.joda.time.chrono.StrictChronology", "org.joda.time.field.StrictDateTimeField", "org.joda.time.LocalDateTime", "org.joda.time.field.UnsupportedDateTimeField", "org.joda.time.format.DateTimeFormatter", "org.joda.time.LocalDate", "org.joda.time.format.DateTimeParserBucket", "org.joda.time.base.BasePartial", "org.joda.time.YearMonth", "org.joda.time.format.DateTimeFormatterBuilder", "org.joda.time.field.AbstractPartialFieldProperty", "org.joda.time.YearMonth$Property", "org.joda.time.chrono.LenientChronology", "org.joda.time.field.LenientDateTimeField", "org.joda.time.MutableDateTime", "org.joda.time.convert.ConverterManager", "org.joda.time.convert.ConverterSet", "org.joda.time.convert.AbstractConverter", "org.joda.time.convert.ReadableInstantConverter", "org.joda.time.convert.StringConverter", "org.joda.time.convert.CalendarConverter", "org.joda.time.convert.DateConverter", "org.joda.time.convert.LongConverter", "org.joda.time.convert.NullConverter", "org.joda.time.convert.ReadablePartialConverter", "org.joda.time.convert.ReadableDurationConverter", "org.joda.time.convert.ReadableIntervalConverter", "org.joda.time.convert.ReadablePeriodConverter", "org.joda.time.convert.ConverterSet$Entry", "org.joda.time.format.ISODateTimeFormat", "org.joda.time.format.DateTimeFormatterBuilder$CharacterLiteral", "org.joda.time.format.DateTimeFormatterBuilder$MatchingParser", "org.joda.time.format.DateTimeFormatterBuilder$Composite", "org.joda.time.format.DateTimeFormatterBuilder$Fraction", "org.joda.time.format.DateTimeFormatterBuilder$TimeZoneOffset", "org.joda.time.format.DateTimeFormatterBuilder$StringLiteral", "org.joda.time.format.DateTimeFormatterBuilder$UnpaddedNumber", "org.joda.time.format.DateTimeParserBucket$SavedState", "org.joda.time.chrono.CopticChronology", "org.joda.time.format.DateTimeFormat", "org.joda.time.MonthDay", "org.joda.time.base.BaseSingleFieldPeriod", "org.joda.time.format.ISOPeriodFormat", "org.joda.time.format.PeriodFormatterBuilder", "org.joda.time.format.PeriodFormatterBuilder$Literal", "org.joda.time.format.PeriodFormatterBuilder$FieldFormatter", "org.joda.time.format.PeriodFormatterBuilder$SimpleAffix", "org.joda.time.format.PeriodFormatterBuilder$Composite", "org.joda.time.format.PeriodFormatterBuilder$Separator", "org.joda.time.format.PeriodFormatter", "org.joda.time.PeriodType", "org.joda.time.Minutes", "org.joda.time.Partial", "org.joda.time.tz.UTCProvider" ); } }
4c19a1d4339691d33bf52abff36d1c118a049ffe
982f363733e13d6f312c5357f34bd84c1e643498
/java/com/bcs/osm/ktpatilofbcsobad/MyFirebaseMessagingService.java
0a7fb594ca6c3cbd6ad1fcb3d48a0dfb8fb718a8
[]
no_license
sagarsurvse/KTPatilcsc-android-app
3da07671bcbf8df3b713cd220432231cffbcfa8b
783088c659ceba9e66c20d484e8e94601caafae1
refs/heads/master
2020-05-05T06:56:46.939734
2019-04-06T09:04:11
2019-04-06T09:04:11
179,807,252
0
0
null
null
null
null
UTF-8
Java
false
false
2,391
java
package com.bcs.osm.ktpatilofbcsobad; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; import android.content.Intent; import android.media.MediaPlayer; import android.media.RingtoneManager; import android.net.Uri; import android.support.v4.app.NotificationCompat; import android.util.Log; import com.google.firebase.messaging.FirebaseMessagingService; import com.google.firebase.messaging.RemoteMessage; /** * Created by Mark on 21/11/2018. */ public class MyFirebaseMessagingService extends FirebaseMessagingService { private static final String TAG = "MyFirebaseMsgService"; User user = User.getInstance(); @Override public void onMessageReceived(RemoteMessage remoteMessage) { Log.d(TAG, "From: " + remoteMessage.getFrom()); Log.d(TAG, "Notification Message Body: " + remoteMessage.getNotification().getBody()); //Calling method to show notification showNotification(remoteMessage.getNotification().getBody()); } private void showNotification(String messageBody) { final FirebaseMessageModel firebaseMessageModel = new FirebaseMessageModel(); firebaseMessageModel.setSenderDeviceId(user.deviceId); firebaseMessageModel.setSenderName(user.name); Intent intent = new Intent(this, LoginActivity.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT); Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.icon) .setContentTitle("NEW SMS From KTPatilcsc") .setContentText(messageBody) .setAutoCancel(true) .setContentIntent(pendingIntent) .setDefaults(Notification.FLAG_ONLY_ALERT_ONCE); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); MediaPlayer mp= MediaPlayer.create(MyFirebaseMessagingService.this, R.raw.ring); mp.start(); notificationManager.notify(0, notificationBuilder.build()); } }
5af976dd1741014e8fe3cd635165f957373b3386
eeaf5dd5bb55c67163c81a233a30d788a18d8ecf
/app/src/main/java/com/tylz/googleplay/factory/FragmentFactory.java
7ae1abd89b5c7876a45fb3f09ecab8aaed1761a0
[]
no_license
mmsapling/GooglePlay
39099a673d6c26d17ce43536a7090f377ceff30d
994841bb49ff895704ea6e993b5e95f47e88d450
refs/heads/master
2021-01-10T06:46:59.066156
2016-03-09T15:46:57
2016-03-09T15:46:57
53,510,041
1
0
null
null
null
null
UTF-8
Java
false
false
2,171
java
package com.tylz.googleplay.factory; import com.tylz.googleplay.base.BaseFragment; import com.tylz.googleplay.fragment.AppFragment; import com.tylz.googleplay.fragment.CategoryFragment; import com.tylz.googleplay.fragment.GameFragment; import com.tylz.googleplay.fragment.HomeFragment; import com.tylz.googleplay.fragment.HotFragment; import com.tylz.googleplay.fragment.RecomendFragment; import com.tylz.googleplay.fragment.SubjectFragment; import java.util.HashMap; import java.util.Map; /** * Created by xuanwen on 2016/1/12. */ public class FragmentFactory { public static final int FRAGMENT_HOME = 0; public static final int FRAGMENT_APP = 1; public static final int FRAGMENT_GAME = 2; public static final int FRAGMENT_SUBJECT = 3; public static final int FRAGMENT_RECOMMEND = 4; public static final int FRAGMENT_CATEGORY = 5; public static final int FRAGMENT_HOT = 6; private static Map<Integer,BaseFragment> mCacheFragmentMap = new HashMap<>(); public static BaseFragment createFragment(int position) { BaseFragment fragment = null; if(mCacheFragmentMap.containsKey(position)){ fragment = mCacheFragmentMap.get(position); return fragment; } switch (position) { case FRAGMENT_HOME: fragment = new HomeFragment(); break; case FRAGMENT_APP: fragment = new AppFragment(); break; case FRAGMENT_GAME: fragment = new GameFragment(); break; case FRAGMENT_SUBJECT: fragment = new SubjectFragment(); break; case FRAGMENT_RECOMMEND: fragment = new RecomendFragment(); break; case FRAGMENT_CATEGORY: fragment = new CategoryFragment(); break; case FRAGMENT_HOT: fragment = new HotFragment(); break; default: break; } //保存引用到集合中 mCacheFragmentMap.put(position,fragment); return fragment; } }
0b10e4f4590a26eecaf6257b645a43eb29363395
71ef1618384823d984b1949828f59d51db950c47
/visualization/edu.iu.sci2.visualization.scimap.references/src/edu/iu/sci2/visualization/scimap/references/JournalLocation.java
1046161f54d04f42ee3a0f165a9faf2d68ef2e0f
[]
no_license
mtgallant/cishell-plugins
d6a35838f0478ef6209abcc81b22ace30b6fd739
615e44ca380e0696c2572b15323d8720be9f569c
refs/heads/master
2020-09-25T23:08:35.956705
2017-12-05T19:11:16
2017-12-05T19:11:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
732
java
package edu.iu.sci2.visualization.scimap.references; public class JournalLocation { private String name; private int id; private float fraction; public JournalLocation(String name, String id, String fraction) { setName(name); setId(id); setFraction(fraction); } private void setFraction(String fraction) { this.fraction = Float.parseFloat(fraction); } private void setId(String id) { this.id = Integer.parseInt(id); } private void setName(String name) { this.name = name; } public float getFraction() { return fraction; } public int getId() { return id; } public String getName() { return name; } public String getCategory() { return MapOfScience.nodes.get(id).getCategory(); } }
f60efd916397dc823ef20e17c899b6927f429ba7
4d34209525c033e52e3d30852ca1d592f91fef5a
/Commons/src/main/java/idc/storyalbum/model/image/CharacterQuality.java
e9987a147fdd36a37617363bf32c21d218488e2a
[]
no_license
yonatang/story-graph-ng
f82540bbd6144073f8e9ea0c07af9c8daaf2df92
2aefe69a25e476fd63f359f4b09b881e65a74ded
refs/heads/master
2021-01-20T17:54:30.575592
2016-07-26T17:55:07
2016-07-26T17:55:07
64,242,596
0
0
null
null
null
null
UTF-8
Java
false
false
271
java
package idc.storyalbum.model.image; import lombok.Data; /** * Created by yonatan on 6/1/2016. */ @Data public class CharacterQuality { public enum Facing { FRONT, SIDE, BACK, DOWN, UP, BOTTOM; } private Rectangle box; private Facing facing; }
bafff916ea7561ebee94381690765139a7070740
09b6e98a28a3392447cdba2f73c89b7a1aa78334
/src/test/java/be/tribersoft/sensor/domain/impl/sensor/SensorRepositoryImplAllByDeviceTest.java
812d612f9b4ad57b9953851228ed68dda40e6602
[]
no_license
triberraar/triber-sensor
f3cc519d04a5dd3658ac6aa68ad568b1ec0093a9
96a4fe28cff0839ee267c5a7fc6057f06b95a64b
refs/heads/develop
2020-12-31T04:41:55.663536
2016-01-07T19:54:52
2016-01-07T19:54:52
44,480,892
0
0
null
2016-01-07T18:32:09
2015-10-18T14:19:24
Java
UTF-8
Java
false
false
1,276
java
package be.tribersoft.sensor.domain.impl.sensor; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import java.util.Arrays; import java.util.List; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import be.tribersoft.sensor.domain.api.sensor.Sensor; @RunWith(MockitoJUnitRunner.class) public class SensorRepositoryImplAllByDeviceTest { private static final String DEVICE_ID = "device id"; @InjectMocks private SensorRepositoryImpl sensorRepositoryImpl; @Mock private SensorJpaRepository sensorJpaRepository; @Mock private SensorEntity sensorEntity1, sensorEntity2; @Before public void setUp() { when(sensorJpaRepository.findAllByDeviceIdOrderByCreationDateDesc(DEVICE_ID)).thenReturn(Arrays.asList(sensorEntity1, sensorEntity2)); } @Test public void delegatesToSpringDataRepository() { List<? extends Sensor> all = sensorRepositoryImpl.allByDevice(DEVICE_ID); verify(sensorJpaRepository).findAllByDeviceIdOrderByCreationDateDesc(DEVICE_ID); assertThat(all).isEqualTo(Arrays.asList(sensorEntity1, sensorEntity2)); } }
8733cd4cc01008a9037bf181d689111ab7d6237f
afdca1a118ae1462c5c7a014b237ce149c0ecbb5
/hcmk/src/hcmk/com/hibernate/DAO/CartDetailDAO.java
59f72457ec325f0e9091a2060f0f5456fa9cf953
[]
no_license
geetndmaloburfi/hcmk
c92745ebb3c26bfdbb767b8125bb2778af0e375d
ef988115ba042ac0ef73831820f75fee57752656
refs/heads/master
2023-05-06T12:32:36.585264
2021-05-23T20:43:12
2021-05-23T20:43:12
354,677,589
0
1
null
null
null
null
UTF-8
Java
false
false
8,485
java
package hcmk.com.hibernate.DAO; import java.io.Serializable; import java.util.*; import javax.persistence.Query; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.cfg.Configuration; import hcmk.com.hibernate.entity.*; public class CartDetailDAO { public CartDetailDAO() { // TODO Auto-generated constructor stub } @SuppressWarnings("unchecked") public static List<Product> getProductByUser(long cartid) { SessionFactory factory=new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(CartDetail.class) .buildSessionFactory(); Session session =factory.getCurrentSession(); List<CartDetail> Cartdetails; List<Product> myproducts=new ArrayList<Product>(); try { session.beginTransaction(); Cartdetails=session.createQuery("from cartDetail where cartId="+cartid).getResultList(); for(CartDetail temp:Cartdetails) { myproducts.add(ProductDAO.getProductById((int)temp.getProductId().getProductId())); } } finally { session.close(); factory.close(); } if(Cartdetails.size()<=0) return null; else return myproducts; } @SuppressWarnings("unchecked") public static int getProductquantity(long cartid,Product p) { SessionFactory factory=new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(CartDetail.class) .buildSessionFactory(); Session session =factory.getCurrentSession(); List<CartDetail> Cartdetails; List<Product> myproducts=new ArrayList<Product>(); try { session.beginTransaction(); Cartdetails=session.createQuery("from cartDetail where cartId="+cartid).getResultList(); for(CartDetail temp:Cartdetails) { myproducts.add(ProductDAO.getProductById((int)temp.getProductId().getProductId())); } } finally { session.close(); factory.close(); } int quantity=0; for(int i=0;i<myproducts.size();i++) { if(p.equals(myproducts.get(i))) { quantity=Cartdetails.get(i).getQuantity(); } } return quantity; } @SuppressWarnings("unchecked") public static CartDetail getCartDetailAgain(long cartid,Product p) { SessionFactory factory=new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(CartDetail.class) .buildSessionFactory(); Session session =factory.getCurrentSession(); List<CartDetail> Cartdetails; List<Product> myproducts=new ArrayList<Product>(); try { session.beginTransaction(); Cartdetails=session.createQuery("from cartDetail where cartId="+cartid).getResultList(); for(CartDetail temp:Cartdetails) { myproducts.add(ProductDAO.getProductById((int)temp.getProductId().getProductId())); } } finally { session.close(); factory.close(); } for(int i=0;i<myproducts.size();i++) { if(p.equals(myproducts.get(i))) { return Cartdetails.get(i); } } return null; } public static void addDetail(CartDetail detail) { SessionFactory factory=new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(CartDetail.class) .buildSessionFactory(); Session session =factory.getCurrentSession(); try { session.beginTransaction(); session.saveOrUpdate(detail); session.getTransaction().commit(); } finally { session.close(); factory.close(); } } public static void updateDetail(CartDetail detail,int value) { SessionFactory factory=new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(CartDetail.class) .buildSessionFactory(); Session session =factory.getCurrentSession(); try { session.beginTransaction(); CartDetail s=session.get(CartDetail.class, detail.getCartDetailId()); s.setQuantity(value); session.saveOrUpdate(detail); session.getTransaction().commit(); } finally { session.close(); factory.close(); } } @SuppressWarnings("unchecked") public static CartDetail getIdWithOtherPrimaryKey(long cartId,long productId) { SessionFactory factory=new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(CartDetail.class) .buildSessionFactory(); Session session =factory.getCurrentSession(); List<CartDetail> Cartdetails; try { session.beginTransaction(); Cartdetails=session.createQuery("from cartDetail where cartId="+cartId+"and productId="+productId).getResultList(); } finally { session.close(); factory.close(); } return Cartdetails.get(0); } public static String updateExistingQuantity(Cart Mycart,List<Product> pInMyCart,long productToAdd) { CartDetail item=getIdWithOtherPrimaryKey(Mycart.getCartId(),productToAdd); Product pid=ProductDAO.getProductById((int)productToAdd); SessionFactory factory=new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(CartDetail.class) .buildSessionFactory(); Session session =factory.getCurrentSession(); int value=0; String price=""; double priceup=0; CartDetail s=null; try { session.beginTransaction(); s=session.get(CartDetail.class, item.getCartDetailId()); value=s.getQuantity()+1; price=s.getTotalPrice(); priceup=Double.parseDouble(price)+Double.parseDouble(pid.getPrice())+Double.parseDouble(pid.getMakingCharge()); s.setQuantity(value); s.setTotalPrice(priceup+""); session.saveOrUpdate(s); session.getTransaction().commit(); } finally { session.close(); factory.close(); } return (Double.parseDouble(pid.getPrice())+Double.parseDouble(pid.getMakingCharge()))+""; } @SuppressWarnings("unchecked") public static List<CartDetail> getCartDetail(Cart mycart) { SessionFactory factory=new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(CartDetail.class) .buildSessionFactory(); Session session =factory.getCurrentSession(); List<CartDetail> Cartdetails; try { session.beginTransaction(); Cartdetails=session.createQuery("from cartDetail where cartId="+mycart.getCartId()).getResultList(); } finally { session.close(); factory.close(); } return Cartdetails; } public static Object[] getCartDetailById(long id) { SessionFactory factory=new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(CartDetail.class) .buildSessionFactory(); Session session =factory.getCurrentSession(); CartDetail Cartdetail; Object[] obj=new Object[2]; try { session.beginTransaction(); Cartdetail=session.get(CartDetail.class, id); Cart cart=Cartdetail.getCartId(); obj[0]=Cartdetail; obj[1]=cart; } finally { session.close(); factory.close(); } return obj; } public static String deleteCartDetailById(long id) { SessionFactory factory=new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(CartDetail.class) .buildSessionFactory(); Session session =factory.getCurrentSession(); CartDetail Cartdetail; String price=""; Cart cart; try { session.beginTransaction(); Cartdetail=session.get(CartDetail.class, id); cart=Cartdetail.getCartId(); price=Cartdetail.getTotalPrice(); System.out.println(price); }finally { } session.close(); factory.close(); CartDAO.updateTotalPriceAfterDelete(cart, price); factory=new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(CartDetail.class) .buildSessionFactory(); session =factory.getCurrentSession(); try { Thread.sleep((long) 200); } catch (InterruptedException e) { e.printStackTrace(); } List<CartDetail> deleteditem; try { session.beginTransaction(); Query query = session.createQuery("delete cartDetail where cartDetailId= :id"); query.setParameter("id",id); int result = query.executeUpdate(); session.getTransaction().commit(); System.out.println(result); }finally { session.close(); factory.close(); } return price; } public static void deleteCartDetailByCartId(Cart c) { SessionFactory factory=new Configuration() .configure("hibernate.cfg.xml") .addAnnotatedClass(CartDetail.class) .buildSessionFactory(); Session session =factory.getCurrentSession(); try { session.beginTransaction(); Query query = session.createQuery("delete cartDetail where cartId="+c.getCartId()); query.executeUpdate(); session.getTransaction().commit(); }finally { session.close(); factory.close(); } return ; } }
ab9609e9e4656d669af1248b4d15fe0ef0db25c6
acef595951631cbbeec9a09fea2ad80ce21c8525
/src/com/sinoframe/common/jbpm4/EnTrainEndHandler.java
0c88787825ce0a006e523b9dd54a70484c762bd0
[]
no_license
aoke79/property
3e837f79fa732d4048c97e732d448c50c178f7f9
d3530840969a65ccc74260b03778685b78987020
refs/heads/master
2021-01-01T05:40:13.986484
2014-04-14T23:22:41
2014-04-14T23:22:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
483
java
package com.sinoframe.common.jbpm4; import org.jbpm.api.jpdl.DecisionHandler; import org.jbpm.api.model.OpenExecution; import com.sinoframe.common.ConstantList; public class EnTrainEndHandler implements DecisionHandler { public String decide(OpenExecution execution) { String executor = (String) execution.getVariable("executor"); if (ConstantList.GHFGBID.equals(executor)) { return "汇总"; }else{ return "汇总";//update by QLL } } }
5b5a1f34aada71bb6aac5dfadf3aba710601214c
e424d0a2a4cc6a51a90055a1b9a20dce17e77df8
/Mars_Mission/src/U2.java
25646cf6ebd1abc4adc8cf3452d945600e7610d1
[]
no_license
bensuri/Java-Final-Project
f10bd2e66aa1396864191942c5bc845b1194a30a
9b3b9da1b3142d7cc0d0cd31cfc57cf74f2cb08a
refs/heads/main
2023-04-22T00:42:11.859074
2021-05-06T20:18:38
2021-05-06T20:18:38
365,023,006
0
0
null
null
null
null
UTF-8
Java
false
false
709
java
public class U2 extends Rocket { // Class Data fields (all are constants) private static final int SELF_WEIGHT = 18 * 1000; // Tonnes private static final int MAX_WEIGHT = 29 * 1000; // Tonnes private static final int SELF_PRICE = 120; // $M private static final int LAUNCH_EXPLOSION_CHANCE = 12; // % private static final int LAND_CRASH_CHANCE = 16; // % public U2() { super(SELF_PRICE, SELF_WEIGHT, MAX_WEIGHT); } @Override public boolean launch() { return chance(LAUNCH_EXPLOSION_CHANCE); } @Override public boolean land() { return chance(LAND_CRASH_CHANCE); } @Override public String toString() { return super.fullString("U2", LAUNCH_EXPLOSION_CHANCE, LAND_CRASH_CHANCE); } }
4cdf97d27380fb523f94dd258bdcff527e8442a8
e45c7d01bf1ca0023f59071314b42ace8cdf6d89
/app/src/main/java/com/fastweather/android/MainActivity.java
6e3dc10028cdcbc61c4ec0d2d86311eb359a402e
[ "Apache-2.0" ]
permissive
sdwaxdwax/coolweather
c06ebbc1b8ebda079468c3f80dc074a87c8c3ade
16b683903f7fc1f1e745b2da754bd4c22c30ab60
refs/heads/master
2021-01-09T06:28:50.100023
2017-02-05T12:25:00
2017-02-05T12:25:00
80,987,511
0
0
null
null
null
null
UTF-8
Java
false
false
733
java
package com.fastweather.android; import android.content.Intent; import android.content.SharedPreferences; import android.preference.PreferenceManager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); if (prefs.getString("weather", null) != null) { Intent intent = new Intent(this, WeatherActivity.class); startActivity(intent); finish(); } } }
[ "2014jyh@gmail" ]
2014jyh@gmail
a1ceecccaf4079cd8631e9e3b9af4ea59fc5054f
c96963b96fab45b4f589c83b21d47396d55ff7ba
/src/employeePackage/Employee.java
54963f947637cd78cea837cdd8e328a6f2ea0b39
[]
no_license
Vaishnavi-459/universityapplication
f4087dd665f9144cc8f895f68b6c5c0a5813d503
2d26cc564503cc3f5d0a106ff05327e815e5c01d
refs/heads/main
2023-06-30T13:52:31.684715
2021-08-06T01:01:48
2021-08-06T01:01:48
393,207,895
0
0
null
null
null
null
UTF-8
Java
false
false
5,183
java
package employeePackage; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.sql.SQLException; import java.util.Date; import java.util.Scanner; import utilities.JdbcConnection; import utilities.Address; import utilities.Education; import utilities.Experience; public class Employee { public int empid; public String empname; public double empsalary; public int empdoj; public String empdob; public String empdesignation; public double empbonus = 0; public int addressid; public int eduid; public int expid; Address empAddress = new Address(); Experience empExperience = new Experience(); Education empEducation = new Education(); Connection con = JdbcConnection.getConnection(); PreparedStatement ps = null; ResultSet rs = null; public int getEmpId() { return empid; } public void setEmpId(int empid) { this.empid = empid; } public String getEmpName() { return empname; } public void setEmptName(String empname) { this.empname = empname; } public double getEmpSalary() { return empsalary; } public void setEmpSalary(double empsalary) { this.empsalary = empsalary; } public int getEmpDoj() { return empdoj; } public void setEmpDoj(int empdoj) { this.empdoj = empdoj; } public String getEmpDob() { return empdob; } public void setEmpDob(String empdob) { this.empdob = empdob; } public String getEmpDesignation() { return empdesignation; } public void setempDesignation(String empdesignation) { this.empdesignation = empdesignation; } public double getEmpBonus() { return empbonus; } public void setEmpBonus(double empbonus) { this.empbonus = empbonus; } public int getAddressid() { return addressid; } public Address getEmpAddress() { return empAddress; } public void setEmpAddress(Address empAddress) { this.empAddress = empAddress; } public Experience getEmpExperience() { return empExperience; } public void setEmpExperience(Experience empExperience) { this.empExperience = empExperience; } public Education getEmpEducation() { return empEducation; } public void setEmpEducation(Education empEducation) { this.empEducation = empEducation; } public void setEmployeeDetails() { Scanner sc = new Scanner(System.in); Scanner sc1 = new Scanner(System.in); Scanner sc2 = new Scanner(System.in); try { System.out.print("Enter Employee ID :"); int empid = sc.nextInt(); setEmpId(empid); } catch (Exception e) { System.out.println("enter valid input"); } try { System.out.print("Enter Employee Name :"); String empname = sc1.nextLine(); setEmptName(empname); } catch (Exception e) { System.out.println("enter valid input"); } try { System.out.print("Enter Employee salary :"); int empsalary = sc.nextInt(); setEmpSalary(empsalary); } catch (Exception e) { System.out.println("enter valid input"); } System.out.print("Enter date of joining year :"); int empdoj = sc.nextInt(); try { System.out.print("Enter dob :"); String empdob = sc1.nextLine(); setEmpDob(empdob); } catch (Exception e) { System.out.println("enter valid input"); } try { System.out.print("Enter designation :"); String empdesignation = sc1.nextLine(); setempDesignation(empdesignation); } catch (Exception e) { System.out.println("enter valid input"); } try { System.out.print("Enter bonus :"); double empbonus = sc2.nextDouble(); setEmpBonus(empbonus); } catch (Exception e) { System.out.println("enter valid input"); } System.out.println("Enter Employee Education details :"); empEducation.setEducationDetails(); System.out.println("Enter Employee Address details :"); empAddress.setAddress(); System.out.println("Enter Employee Experience details :"); empExperience.setExperience(); try { ps = con.prepareStatement("insert into employee values(?,?,?,?,?,?,?,?,?,?)"); ps.setInt(1, empid); ps.setString(2, empname); ps.setDouble(3, empsalary); ps.setInt(4, empdoj); ps.setString(5, empdob); ps.setString(6, empdesignation); ps.setDouble(7, empbonus); ps.setInt(8, addressid); ps.setInt(9, eduid); ps.setInt(10, expid); ps.executeUpdate(); System.out.println("Values Inserted successfully"); } catch (Exception e) { e.printStackTrace(); } } public void calculateSalary() { if (empsalary < 10000) { empbonus = empsalary * 20 / 100; } } public void getEmployeeDetails() { empEducation.getEducation(); empAddress.getAddress(); empExperience.getExperience(); try { String sql = "select * from employee"; ps = con.prepareStatement(sql); rs = ps.executeQuery(sql); // ResultSetMetaData rsmd = rs.getMetaData(); while (rs.next()) { System.out.println(rs.getInt(1) + "\t\t" + rs.getString(2) + "\t\t" + rs.getDouble(3) + "\t\t" + rs.getString(4) + "\t\t" + rs.getString(5) + "\t\t" + rs.getString(6) + "\t\t" + rs.getDouble(7) + "\t\t" + rs.getInt(8) + "\t\t" + rs.getInt(9) + "\t\t" + rs.getInt(10)); } } catch (SQLException e) { e.printStackTrace(); } } }
7a87f7b4959fe13657c2a8a31f8e5620d207cc9b
553eee14d3c51b4affbe17d0c4a1fead686b1ab0
/ejbModule/ec/edu/epn/calibracionequipos/beans/.svn/text-base/PersonalCalificadoDAO.java.svn-base
be8f89ac27a953eaa718ef628d25735564d132ad
[]
no_license
WilsonCastro1988/ServiciosSeguridadEPN
878c74b9e5cb56b5480e8d634fb623bc23547eb1
ef2319da6ed48ffc00d92f54964a02c187c5eeb7
refs/heads/master
2020-04-27T08:29:28.571128
2019-03-11T17:25:32
2019-03-11T17:25:32
174,173,102
0
0
null
2019-03-11T17:25:33
2019-03-06T15:42:50
Java
UTF-8
Java
false
false
391
package ec.edu.epn.calibracionequipos.beans; import java.util.List; import javax.ejb.Local; import ec.edu.epn.calibracionequipos.entidades.Personalcalificado; import ec.edu.epn.generic.DAO.DaoGenerico; @Local public interface PersonalCalificadoDAO extends DaoGenerico<Personalcalificado> { int consultarId(); List<Personalcalificado> buscarPersonal(String nombres, String cedula); }
5d362e298d8b9f05de88d9f69466144a3f8c0529
fbe4cf392d976f3c22c5c9f45b25a839f37e0ceb
/src/main/java/cz/rank/ubench/bp/BranchPrediction1.java
6ab64d92fddbe8714a5c9a86a95d787d7ecf5f1d
[ "MIT" ]
permissive
karl82/ubench
e98f1ec18b406501daf0538a6b9ca6d8edc09c24
a6a0c61558b8a1e5c4a6acb90e04937f964d9ee1
refs/heads/master
2020-03-27T04:26:27.645658
2013-12-16T10:11:36
2013-12-16T10:11:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,541
java
package cz.rank.ubench.bp; import java.util.Arrays; import java.util.Random; /** * @author Karel Rank */ public class BranchPrediction1 { public static final int MAX_INTS = 1000000; public static final int ITERATIONS = 100; private final int[] randomizedInts = new int[MAX_INTS]; private final int[] sortedInts = new int[MAX_INTS]; private BranchPrediction1() { final Random random = new Random(System.nanoTime()); final int[] ints = new int[MAX_INTS]; for (int i = 0; i < MAX_INTS; i++) { ints[i] = random.nextInt(MAX_INTS); } System.arraycopy(ints, 0, randomizedInts, 0, MAX_INTS); System.arraycopy(ints, 0, sortedInts, 0, MAX_INTS); Arrays.sort(sortedInts); } private void performTest() { long totalSorted = 0; long totalRandomized = 0; int totalOverHalf = 0; for (int i = 0; i < ITERATIONS; i++) { long t1 = System.nanoTime(); totalOverHalf += iterateOverRandomized(); long t2 = System.nanoTime(); totalRandomized += t2 - t1; t1 = System.nanoTime(); totalOverHalf += iterateOverSorted(); t2 = System.nanoTime(); totalSorted += t2 - t1; } System.out.format("Randomized total=%,12d ns; avg=%,12d ns\n", totalRandomized, totalRandomized / ITERATIONS); System.out.format("Sorted total=%,12d ns; avg=%,12d ns\n", totalSorted, totalSorted / ITERATIONS); System.out.println("Over half total=" + totalOverHalf); // Avoid BCE } private void warmUp() { for (int i = 0; i < ITERATIONS*ITERATIONS; i++) { iterateOverRandomized(); iterateOverSorted(); } } /** * @return ints greater than {@link #MAX_INTS} / 2 */ private int iterateOverRandomized() { int greaterInts = 0; for (int i : randomizedInts) { if (i > MAX_INTS / 2) { greaterInts++; } } return greaterInts; } /** * @return ints greater than {@link #MAX_INTS} / 2 */ private int iterateOverSorted() { int greaterInts = 0; for (int i : sortedInts) { if (i > MAX_INTS / 2) { greaterInts++; } } return greaterInts; } public static void main(String[] args) { BranchPrediction1 bp = new BranchPrediction1(); bp.warmUp(); bp.performTest(); } }
ca79b18c8ac27f02639e672926f2bcccfcd0c409
47deec283236c034c37922f8fd76f33e9d39f13e
/PowerAnalyzer/src/PowerMain.java
b3cb9fcdf2423726fc2e24e4d423bfad20f1076a
[]
no_license
eminyuce/my-java-development
1528c6003266fe5ebfdb3c8e64626149aae889a7
ad264e9a5bb622794a76090478922a6308d7dd3c
refs/heads/master
2021-01-01T18:41:40.214605
2015-12-09T15:50:34
2015-12-09T15:50:34
40,208,382
0
0
null
null
null
null
UTF-8
Java
false
false
1,559
java
public class PowerMain { public static void main(String[] args) { CurrentComponent currentComponent = new CurrentComponent(); currentComponent.setVoltage(100); currentComponent.setCurrent1(2); currentComponent.setCurrent2(3); currentComponent.setCurrent3(4); currentComponent.setCurrent4(5); currentComponent.setCurrent5(1); currentComponent.setCurrent6(2); currentComponent.setCurrent7(3); PowerAnalyzerService analyzerService = new PowerAnalyzerService(); double result = analyzerService.calculateCurrentTotal(currentComponent); System.out.println("Current Total="+result); result = analyzerService.calculateApparentPower(currentComponent); System.out.println("Apparent Power="+result); result = analyzerService.activePower(currentComponent); System.out.println("Active Power="+result); result = analyzerService.reactivePower(currentComponent); System.out.println("Reactive Power="+result); result = analyzerService.distortionPower(currentComponent); System.out.println("Distortion Power="+result); result = analyzerService.calculateDisplacementPowerFactor(currentComponent); System.out.println("Displacement Power Factor="+result); result = analyzerService.calculatePowerFactor(currentComponent); System.out.println("Power Factor="+result); result = analyzerService.calculateTotalHarmonicDistortion(currentComponent); System.out.println("Total Harmonic Distortion="+result); } }