blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
97d017daa2be55f12e0b7b96218006dc57072058
c1152de9d94c40ba49ab1898b4f896109f670c8c
/personal/src/arrays/MaxAvgSubArray.java
edb0e4b14be5dabae4c121ba226708fd0de5fbeb
[]
no_license
AmitLeo/javadatastructure
15f8c36767a5cffe5beadfb1580ff284fc0fc8d3
34b87f74a3d63bd3748609e3e5441b55836e7d3f
refs/heads/master
2016-09-01T13:11:44.998215
2015-11-21T13:45:20
2015-11-21T13:45:20
46,616,751
0
0
null
null
null
null
UTF-8
Java
false
false
1,076
java
package arrays; /** * Given an array with positive and negative numbers, find the maximum average subarray of given length. * * http://www.geeksforgeeks.org/find-maximum-average-subarray-of-k-length/ * * @author amishash * */ public class MaxAvgSubArray { public void solution(int argArr[], int argLength) { int counter = 0; int maxAvgSum = 0; int startingIndex=0; int tempSum = 0; for (int i = 0; i < argArr.length; i++ ) { counter++ ; tempSum = tempSum + argArr[i]; if (counter != argLength) { continue; } else { if (maxAvgSum < tempSum / argLength) { maxAvgSum = tempSum / argLength; startingIndex=i+1-(argLength); } tempSum = tempSum - argArr[i+1-(argLength)]; counter-- ; } } System.out.println("Max Sum is "+ maxAvgSum+" begins at Index "+startingIndex); } public static void main(String args[]) { MaxAvgSubArray maxAvgSubArray = new MaxAvgSubArray(); maxAvgSubArray.solution(new int[] {1, 12, -5, -6, 50, 3}, 4); } }
[ "amitsharma_leo@yahoo.co.in" ]
amitsharma_leo@yahoo.co.in
469ef4b8bcadbc81f053d77d287bf2f72debff33
9ab7abce5525e101482c64726d1a9717e640242c
/src/main/java/fr/ibformation/scenarryo_back/enums/RoleEnum.java
897adc5c4a8463ac133ee7bde2a604ce37ed858a
[]
no_license
niamoR-dev/scenarryo_back_final
4281e189cee2f6255d0bb53cbec688e79c8f195f
2e99dd96058238e6a63fa72d4c5152dc7f960b77
refs/heads/master
2023-05-24T19:10:12.045367
2021-06-06T09:12:14
2021-06-06T09:12:14
370,742,614
0
0
null
null
null
null
UTF-8
Java
false
false
154
java
package fr.ibformation.scenarryo_back.enums; public enum RoleEnum { // roles attributed to users ROLE_USER, ROLE_MODERATOR, ROLE_ADMIN }
[ "alexandre.segelle@hotmail.fr" ]
alexandre.segelle@hotmail.fr
f23321c67db10683368d413d2b098a7478c60a17
783b9cfbd703f0cd03c2244a40010794b28f0e1c
/src/com/baseev/coding/array/PrintSpiral.java
30abdf30a838f71bfdaf5b60501ddd593ca8d6a7
[]
no_license
baseev/Utils
44fe38fca32bd582f6f0fd8fdd89581830c628f6
1cdfa1e0ed1ce81ad31db80c6327d1719267ff1b
refs/heads/master
2021-01-10T14:02:55.017976
2016-02-12T05:43:02
2016-02-12T05:43:02
48,009,656
0
0
null
null
null
null
UTF-8
Java
false
false
912
java
package com.baseev.coding.array; public class PrintSpiral { public static void print(int arr[][]) { int m = 6; int n = 3; int i, k=0, l=0; while(k<m && l<n) { for(i=l;i<n;i++) { System.out.println(arr[k][i]); } k++; for (i = n; i < m; ++i) { System.out.println(arr[i][n-1]); } n--; if(k<m){ for (i = n-1; i >= l; --i) { System.out.println(arr[m-1][i]); } m--; } if(l<n) { for (i = m-1; i >= k; --i) { System.out.println(arr[i][l]); } l++; } } } public static void main(String[] args) { int arr[][] = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}, {13, 14, 15}, {16, 17, 18} }; PrintSpiral.print(arr); } }
[ "sapnabaseev@gmail.com" ]
sapnabaseev@gmail.com
e0682a79a4dd510cf0127b2c746fda0e11668599
a58a08be16df5d1a361dc8b545ea69f14756f0a0
/src/composite_pattern/used_pattern/Monitor.java
e27b1cec16430b302f5d05ecbd3b69b9cf914932
[]
no_license
LeeSM0518/design-pattern
e0cadbdc067d3aef0c80dea80e3e5bc69e32baf0
4cdc6d23dfa25c58359fe7b80a849dd0affe647e
refs/heads/master
2020-06-22T15:28:34.512321
2020-05-22T03:41:36
2020-05-22T03:41:36
197,737,384
0
0
null
null
null
null
UTF-8
Java
false
false
349
java
package composite_pattern.used_pattern; public class Monitor extends ComputerDevice { private int price; private int power; public Monitor(int price, int power) { this.price = price; this.power = power; } @Override public int getPrice() { return price; } @Override public int getPower() { return power; } }
[ "nalsm98@naver.com" ]
nalsm98@naver.com
525f86e850b4b1e5daa557c8cee855f7e0d7bc88
6e204686f69a6077505b256369a9896b32a72de0
/lab3/src/lab3/Task5.java
63f234a139213de45be7888200283305a0e47dbc
[]
no_license
danakendybayeva/OOP2019
9a0c935f5bef422e43eaff1525ca991b6b1d157b
8958af6de5353fe8ce29fdef6da9c7d29f3173a1
refs/heads/master
2020-09-05T01:33:57.184628
2019-12-06T06:31:06
2019-12-06T06:31:06
219,946,222
0
0
null
null
null
null
UTF-8
Java
false
false
3,582
java
package lab3; import java.util.*; public class Task5 { public static void main(String[] args) { // TODO Auto-generated method stub Vector<Object> v = new Vector<Object>(); Scanner sc = new Scanner(System.in); Persons p = new Persons("dana", "dmis"); Student stu1 = new Student("first", "street1", "is", 1, 2300); Staff sf1 = new Staff("math", "street1", "nis", 30000); v.add(p); v.add(stu1); v.add(sf1); String name, address, program, school; int year; double fee, pay; System.out.println("Insert all if u want to print info or add objectname if u want to add new object"); while(true) { String[] str = sc.nextLine().split(" "); if (str[0].equals("all")) { for(Object o: v) { System.out.println(o); } } else if (str[0].equals("add") && str[1].equals("Person")) { name = str[2]; address = str[3]; System.out.println("ok"); Persons p1 = new Persons(name, address); v.add(p1); }else if (str[0].equals("add") && str[1].equals("Student")) { name = str[2]; address = str[3]; program = str[4]; year = Integer.parseInt(str[5]); fee = Double.parseDouble(str[6]); Student s1 = new Student(name, address, program, year, fee); v.add(s1); System.out.println("ok"); } else if (str[0].equals("add") && str[1].equals("Staff")) { name = str[2]; address = str[3]; school = str[4]; pay = Double.parseDouble(str[6]); Staff st1 = new Staff(name, address, school, pay); v.add(st1); System.out.println("ok"); } else if (str[0].equals("bye")) { break; } } sc.close(); } } class Persons{ private String name; private String address; public Persons(String name, String address) { this.name = name; this.address = address; } String getName() { return name; } String getAddress() { return address; } void setAddress(String address) { this.address = address; } public String toString() { return "Person[name = " + name + ", address = " + address + "]"; } } class Student extends Persons{ private String program; private int year; private double fee; public Student(String name, String address, String program, int year, double fee) { super(name, address); this.program = program; this.year = year; this.fee = fee; // TODO Auto-generated constructor stub } String getProgram() { return program; } void setProgram(String program) { this.program = program; } int getYear() { return year; } void setYear(int year) { this.year = year; } double getFee() { return fee; } void setFee(double fee) { this.fee = fee; } @Override public String toString() { return "Student " + super.toString() + " [program = " + program + ", year = " + year + ", fee = " + fee + "]"; } } class Staff extends Persons{ String school; double pay; public Staff(String name, String address, String school, double pay) { super(name, address); this.school = school; this.pay = pay; // TODO Auto-generated constructor stub } String getSchool() { return school; } void setSchool(String school) { this.school = school; } double getPay() { return pay; } void setPay(double pay) { this.pay = pay; } @Override public String toString() { // TODO Auto-generated method stub return "Stuff " + super.toString() + " [school = " + school + ", pay = " + pay + "]"; } }
[ "danka.kent@gmail.com" ]
danka.kent@gmail.com
131e27ce7e40298fb733b061fbd7d4b01102ee66
0ae20c5dad0c8e0dec0423aedcc48a57c24e4412
/src/lecture1/jdbc1/UserDAO2.java
499604a18326d64b2d16b882cdbf9ba920814b28
[]
no_license
jejecrunch/JSP
fd88b148c7fdeea0a998b52a689fa7388391cb55
c067e1b3703a4802d212e537ddb8939538749cca
refs/heads/master
2020-05-15T06:39:30.576617
2019-04-28T14:17:19
2019-04-28T14:17:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,521
java
package lecture1.jdbc1; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; import lecture1.DB; public class UserDAO2 { public static User createUser(ResultSet resultSet) throws SQLException { User user = new User(); user.setId(resultSet.getInt("id")); user.setUserid(resultSet.getString("userid")); user.setName(resultSet.getString("name")); user.setDepartmentId(resultSet.getInt("departmentId")); user.setEmail(resultSet.getString("email")); user.setDepartmentName(resultSet.getString("departmentName")); user.setEnabled(resultSet.getBoolean("enabled")); user.setUserType(resultSet.getString("userType")); return user; } public static List<User> findAll() throws Exception { String sql = "SELECT u.*, d.departmentName " + "FROM user u LEFT JOIN department d ON u.departmentId = d.id"; try (Connection connection = DB.getConnection("student1"); PreparedStatement statement = connection.prepareStatement(sql); ResultSet resultSet = statement.executeQuery()) { ArrayList<User> list = new ArrayList<User>(); while (resultSet.next()) list.add(createUser(resultSet)); return list; } } public static List<User> findByName(String name) throws Exception { String sql = "SELECT u.*, d.departmentName " + "FROM user u LEFT JOIN department d ON u.departmentId = d.id " + "WHERE u.name LIKE ?"; try (Connection connection = DB.getConnection("student1"); PreparedStatement statement = connection.prepareStatement(sql)) { statement.setString(1, name + "%"); try (ResultSet resultSet = statement.executeQuery()) { ArrayList<User> list = new ArrayList<User>(); while (resultSet.next()) list.add(createUser(resultSet)); return list; } } } public static List<User> findByDepartmentId(int departmentId) throws Exception { String sql = "SELECT u.*, d.departmentName " + "FROM user u LEFT JOIN department d ON u.departmentId = d.id " + "WHERE u.departmentId = ?"; try (Connection connection = DB.getConnection("student1"); PreparedStatement statement = connection.prepareStatement(sql)) { statement.setInt(1, departmentId); try (ResultSet resultSet = statement.executeQuery()) { ArrayList<User> list = new ArrayList<User>(); while (resultSet.next()) list.add(createUser(resultSet)); return list; } } } public static List<User> findByNameAndDepartmentId(String name, int departmentId) throws Exception { String sql = "SELECT u.*, d.departmentName " + "FROM user u LEFT JOIN department d ON u.departmentId = d.id " + "WHERE u.name LIKE ? AND u.departmentId = ?"; try (Connection connection = DB.getConnection("student1"); PreparedStatement statement = connection.prepareStatement(sql)) { statement.setString(1, name + "%"); statement.setInt(2, departmentId); try (ResultSet resultSet = statement.executeQuery()) { ArrayList<User> list = new ArrayList<User>(); while (resultSet.next()) list.add(createUser(resultSet)); return list; } } } }
[ "gkswlgp456@gmail.com" ]
gkswlgp456@gmail.com
1dfa47d0f4d435ed508eab8fe166c59cba4ea050
6254347eaf4e96dc77e69820bef34df0eaf2d906
/pdfsam-enhanced/pdfsam-merge/tags/V_0_4_9e/src/it/pdfsam/plugin/merge/model/MergeTableModel.java
b184af7ca61020315e3278df7d7f7ebe22b22848
[]
no_license
winsonrich/pdfsam-v2
9044913b14ec2e0c33801a77fbbc696367a8f587
0c7cc6dfeee88d1660e30ed53c7d09d40bf986aa
refs/heads/master
2020-04-02T16:20:17.751695
2018-12-07T14:52:22
2018-12-07T14:52:22
154,608,091
0
0
null
2018-10-25T04:03:03
2018-10-25T04:03:03
null
UTF-8
Java
false
false
10,107
java
/* * Created on 03-Feb-2006 * Copyright (C) 2006 by Andrea Vacondio. * * This program is free software; you can redistribute it and/or modify it under the terms of the * GNU General Public License as published by the Free Software Foundation; * either version 2 of the License. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with this program; * if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ package it.pdfsam.plugin.merge.model; import it.pdfsam.plugin.merge.type.MergeItemType; import java.util.ArrayList; import java.util.LinkedList; import javax.swing.table.AbstractTableModel; /** * Model for the Merge table * @author Andrea Vacondio * @see javax.swing.table.AbstractTableModel */ public class MergeTableModel extends AbstractTableModel { /** * */ private static final long serialVersionUID = 3829562657030134592L; private final int SHOWED_COLS = 4; //colums order public final static int FILENAME = 0; public final static int PATH = 1; public final static int PAGES = 2; public final static int PAGESELECTION = 3; //colums names private String[] columnNames = {"File name", "Path", "Pages", "Page Selection"}; //tooltips private String[] toolTips = {"", "", "Total pages of the document", "Double click to set pages you want to merge (ex: 2 or All or 5-23 or 2,5-7,12)" }; //data array private ArrayList data = new ArrayList(); /** * @return Number of showed columns in Merge table */ public int getColumnCount() { return SHOWED_COLS; } /** * @return Rows number in Merge table */ public int getRowCount() { try{ return data.size(); } catch(NullPointerException e){ return 0; } } /** * Return the value at row, col */ public Object getValueAt(int row, int col) { return ((MergeItemType) data.get(row)).getValue(col); } /** * Return the value at row, col */ public MergeItemType getRow(int row) { return ((MergeItemType) data.get(row)); } /** * <p>set data source for the model * * @param input_data array <code>MergeItemType[]</code> as data source * */ public void setData(MergeItemType[] input_data){ data.clear(); for(int i=0; i<input_data.length; i++){ data.add(input_data[i]); } } /** * <p>Remove any data source for the model * * */ public void clearData(){ data.clear(); this.fireTableDataChanged(); } /** * Return true if the cell is editable */ public boolean isCellEditable(int row, int column) { if (PAGESELECTION==column){ return true; }else{ return false; } } /** * This empty implementation is provided so users don't have to implement * this method if their data model is not editable. * * @param value value to assign to cell * @param row row of cell * @param column column of cell */ public void setValueAt(Object value, int row, int column) { switch(column){ case FILENAME: ((MergeItemType)data.get(row)).setFileName(value.toString()); break; case PATH: ((MergeItemType)data.get(row)).setFilePath(value.toString()); break; case PAGES: ((MergeItemType)data.get(row)).setNumPages(value.toString()); break; case PAGESELECTION: ((MergeItemType)data.get(row)).setPageSelection(value.toString()); break; } } /** * <p>Add a row to the table data source and fire to Listeners * * @param input_data <code>MergeItemType</code> to add to the data source * */ public void addRow(MergeItemType input_data){ if (input_data != null){ data.add(input_data); int row_num = data.size(); this.fireTableRowsInserted(row_num,row_num); } } /** * <p>Add a row to the table data source and fire to Listeners * * @param input_data <code>MergeItemType</code> to add to the data source * */ public void addRowAt(int index, MergeItemType input_data){ if (input_data != null){ data.add(index, input_data); this.fireTableRowsInserted(index,index); } } /** * <p>Moves up a row to the table data source and fire to Listeners * * @param row Row number to move from the data source * */ public void moveUpRow(int row)throws IndexOutOfBoundsException{ if (row >= 1){ MergeItemType tmp_element = (MergeItemType)data.get(row); data.set(row, data.get((row-1))); data.set((row-1), tmp_element); fireTableRowsUpdated(row-1, row); } } /** * <p>Moves up a set of rows to the table data source and fire to Listeners * * @param rows Row numbers to move from the data source * */ public void moveUpRows(int[] rows)throws IndexOutOfBoundsException{ if (rows.length > 0){ MergeItemType tmp_element; //no moveup if i'm selecting the first elemento in the table if (rows[0] > 0){ tmp_element = (MergeItemType)data.get(rows[0]-1); for (int i=0; i<rows.length; i++){ if (rows[i] > 0){ data.set(rows[i]-1, data.get(rows[i])); } } data.set(rows[rows.length-1], tmp_element); } if (rows[0] >= 1){ fireTableRowsUpdated(rows[0]-1, rows[rows.length-1]); } } } /** * <p>Moves down a row to the table data source and fire to Listeners * * @param row Row number to remove from the data source * */ public void moveDownRow(int row)throws IndexOutOfBoundsException{ if (row < (data.size()-1)){ MergeItemType tmp_element = (MergeItemType)data.get(row); data.set(row, data.get((row+1))); data.set((row+1), tmp_element); fireTableRowsUpdated(row, row+1); } } /** * <p>Moves up a set of rows to the table data source and fire to Listeners * * @param rows Row numbers to move from the data source * */ public void moveDownRows(int[] rows)throws IndexOutOfBoundsException{ if (rows.length > 0){ MergeItemType tmp_element; //no moveup if i'm selecting the first elemento in the table if (rows[rows.length-1] < (data.size()-1)){ tmp_element = (MergeItemType)data.get(rows[rows.length-1]+1); for (int i=(rows.length-1); i>=0; i--){ if (rows[rows.length-1] < (data.size()-1)){ data.set(rows[i]+1, data.get(rows[i])); } } data.set(rows[0], tmp_element); } if (rows[rows.length-1] < (data.size()-1)){ fireTableRowsUpdated(rows[0], rows[rows.length-1]+1); } } } /** * <p>Remove a row from the table data source and fire to Listeners * * @param row row number to remove from the data source * @throws Exception if an exception occurs * */ public void deleteRow(int row) throws IndexOutOfBoundsException{ data.remove(row); fireTableRowsDeleted(row,row); } /** * <p>Remove a set of rows from the table data source and fire to Listeners * * @param rows rows number to remove from the data source * @throws Exception if an exception occurs * */ public void deleteRows(int[] rows) throws IndexOutOfBoundsException{ if (rows.length > 0){ LinkedList data_to_remove = new LinkedList(); for (int i=0; i<rows.length; i++){ data_to_remove.add(data.get(rows[i])); } for (int i=0; i<data_to_remove.size(); i++){ data.remove(data_to_remove.get(i)); } this.fireTableRowsDeleted(rows[0], rows[rows.length -1]); } } /** * <p> Return column name * * @param col Column number * @return Column name */ public String getColumnName(int col) { try{ return columnNames[col]; } catch (Exception e){ return null; } } /** * @return Returns the toolTips. */ public String[] getToolTips() { return toolTips; } /** * @param columnNames The columnNames to set. */ public void setColumnNames(String[] columnNames) { this.columnNames = columnNames; } }
[ "torakiki@2703fb93-1e26-0410-8fff-b03f68e33ab9" ]
torakiki@2703fb93-1e26-0410-8fff-b03f68e33ab9
979c86aca9c896394a29d1293593f114ddd48185
7bcfce3f540da2553de9fa92de1c65791a838a0f
/ClassWork/CW1/src/main/java/person/Student.java
da7da8073ce8d32674b617bcefdb5aeaec9140cd
[ "MIT" ]
permissive
garawaa/Android-TexasHoldemPokerOnline
541baee2be75e2563352a0f588a552ebe94de6ad
2824c114d0194392e343733e744c82b5e87a4046
refs/heads/main
2023-06-24T00:15:33.936048
2021-07-25T10:33:35
2021-07-25T10:33:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,058
java
package person; /** * @author Haim Adrian * @since 18-Oct-20 */ public class Student extends Person implements StudentIfc { private String department = ""; private int year = 0; public Student(String id, String name) { super(id, name); } public Student(String id, String name, String department, int year) { super(id, name); this.department = department; this.year = year; } @Override public String getDepartment() { return department; } @Override public void setDepartment(String department) { this.department = department; } @Override public int getYear() { return year; } @Override public void setYear(int year) { this.year = year; } @Override public String studentInfo() { return "dept='" + department + "', year=" + year; } @Override public String toString() { return super.toString() + ", " + studentInfo(); } }
[ "Haim.Adrian@quest.com" ]
Haim.Adrian@quest.com
154e3641514d958668b799211cda76f8f6c69b8f
247eb9943c8bad5743b0d182282749a686b8526d
/src/UI.java
0180f50a9dc963aa9ef4118773fa0863469c1863
[]
no_license
iMilchshake/RacetrackSolver
341dde7c7a16e91c6eab06856e31d1a7a0323ea7
0c026e9eff0e0529234c4a8d5341eae3485e203d
refs/heads/master
2020-08-15T17:06:29.176087
2019-10-30T12:41:43
2019-10-30T12:41:43
215,377,065
1
0
null
null
null
null
UTF-8
Java
false
false
7,728
java
//import com.sun.prism.GraphicsPipeline; //import sun.java2d.loops.DrawLine; import javax.swing.*; import java.awt.*; import java.util.ArrayList; import java.util.Vector; public class UI { public static MyPanel panel; public static void createAndShowGUI(Map map) { System.out.println("Created GUI on EDT? " + SwingUtilities.isEventDispatchThread()); JFrame f = new JFrame("Custom Title"); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); panel = new MyPanel(map); f.add(panel); f.pack(); f.setSize(500, 500); f.setVisible(true); } public static void MouseClicked(int x, int y) { panel.repaint(); } } class MyPanel extends JPanel { int width, height; Grid myGrid; public MyPanel(Map map) { setFocusable(true); setBorder(BorderFactory.createLineBorder(Color.black)); width = this.getSize().width; height = this.getSize().height; myGrid = new Grid(map); addKeyListener(new MyKeyListener(this)); MyMouseListener mListener = new MyMouseListener(this); addMouseListener(mListener); addMouseMotionListener(mListener); } public Dimension getPreferredSize() { return new Dimension(250, 250); } public void paintComponent(Graphics g) { super.paintComponent(g); myGrid.printGrid(g, getSize().width, getSize().height); myGrid.drawPlayers(g, RaceGame.players); if (RaceGame.mode == 1) { myGrid.drawPossibleMoves(g, RaceGame.currentPlayer); myGrid.drawPlayerPrediction(g,RaceGame.currentPlayer); } } } class Grid { public int CellCountX, CellCountY, actualCellSize, gridWidth, gridHeight; Map map; public Grid(Map map) { this.CellCountX = map.width; this.CellCountY = map.height; this.map = map; } public void drawPossibleMoves(Graphics g, Player p) { if (p == null || p.location == null) return; for (int x = -1; x <= 1; x++) { //-1 0 1 for (int y = -1; y <= 1; y++) {//-1 0 1 //System.out.println(p.location + " - " + p.velocity); Vector2 to = Vector2.add(p.location, p.velocity); //estimated location after moving if (map.validMove(p.location, new Vector2(to.x + x, to.y + y))) { g.setColor(new Color(13, 255, 9, 114)); } else { g.setColor(new Color(255, 0, 13, 114)); } FillCell(g, to.x + x, to.y + y, actualCellSize); } } } public void printGrid(Graphics g, int width, int height) { int maxCellSizeX = (width - CellCountX - 1) / CellCountX; int maxCellSizeY = (height - CellCountY - 1) / CellCountY; actualCellSize = Math.min(maxCellSizeX, maxCellSizeY); gridWidth = CellCountX * actualCellSize + (CellCountX); //Cells + Borders gridHeight = CellCountY * actualCellSize + (CellCountY); //Draw Grid (x bars) for (int x = 0; x < CellCountX + 1; x++) { g.drawLine(x * (actualCellSize + 1), 0, x * (actualCellSize + 1), gridHeight); } //Draw Grid (ybars) for (int y = 0; y < CellCountY + 1; y++) { g.drawLine(0, y * (actualCellSize + 1), gridWidth, y * (actualCellSize + 1)); } //Draw Walls for (int x = 0; x < CellCountX; x++) { for (int y = 0; y < CellCountY; y++) { if (map.getCell(x, y) == 1) { g.setColor(Color.BLACK); FillCell(g, x, y, actualCellSize); } else if (map.getCell(x, y) == 2) { g.setColor(Color.YELLOW); FillCell(g, x, y, actualCellSize); } else if (map.getCell(x, y) == 3) { g.setColor(Color.GREEN); FillCell(g, x, y, actualCellSize); } } } } public void drawPlayers(Graphics g, ArrayList<Player> playerList) { for (Player p : playerList) { //System.out.println(p.path.size() - 1); for (int i = 0; i < p.path.size() - 1; i++) { drawPlayer(g, p, p.path.get(i)); //g.drawLine(p.path.get(i).x,p.path.get(i).y,p.path.get(i+1).x,p.path.get(i+1).y); g.setColor(Color.BLACK); DrawCellLine2(g, p.path.get(i), p.path.get(i + 1)); } drawPlayer(g, p, p.location); } } public void drawPlayerPrediction(Graphics g, Player p) { if (p == null || p.location == null) return; Vector2 vel = new Vector2(p.velocity.x,p.velocity.y); Vector2 loc = new Vector2(p.location.x,p.location.y); while(!vel.equals(Vector2.zero())) { if(vel.x>0) vel.x-=1; else if(vel.x<0) vel.x+=1; if(vel.y>0) vel.y-=1; else if(vel.y<0) vel.y+=1; loc = Vector2.add(loc,vel); } drawPlayer(g,p,loc); } public void drawPlayer(Graphics g, Player p, Vector2 location) { g.setColor(Color.BLACK); g.drawOval(getCellMid(location.x, location.y, actualCellSize).x - actualCellSize / 4, getCellMid(location.x, location.y, actualCellSize).y - actualCellSize / 4, actualCellSize / 2, actualCellSize / 2); g.setColor(p.playerColor); g.fillOval(getCellMid(location.x, location.y, actualCellSize).x - actualCellSize / 4, getCellMid(location.x, location.y, actualCellSize).y - actualCellSize / 4, actualCellSize / 2, actualCellSize / 2); } public void DrawCellLine2(Graphics g, Vector2 a, Vector2 b) { Vector2 ac = getCellMid(a.x, a.y, actualCellSize); Vector2 bc = getCellMid(b.x, b.y, actualCellSize); g.drawLine(ac.x, ac.y, bc.x, bc.y); } public void DrawCellLine(Graphics g, int x1, int y1, int x2, int y2, int cellSize) { int pdx, pdy, es, el, err; int dx = Math.abs(x2 - x1); int dy = Math.abs(y2 - y1); int incx = sign(x2 - x1); int incy = sign(y2 - y1); if (dx > dy) { pdx = incx; pdy = 0; es = dy; el = dx; } else { pdx = 0; pdy = incy; es = dx; el = dy; } int x = x1; int y = y1; err = el / 2; //FillCell(g,x,y,cellSize); for (int t = 0; t < el; t++) { err -= es; if (err < 0) { err += el; x += incx; y += incy; } else { x += pdx; y += pdy; } FillCell(g, x, y, cellSize); } } public int sign(int x) { return (x > 0) ? 1 : (x < 0) ? -1 : 0; } public void FillCell(Graphics g, int cellX, int cellY, int cellSize) { g.fillRect((cellSize + 1) * cellX + 1, (cellSize + 1) * cellY + 1, cellSize, cellSize); } public Vector2 getCellMid(int cellX, int cellY, int cellSize) { return new Vector2((cellSize + 1) * cellX + 1 + (cellSize / 2), (cellSize + 1) * cellY + 1 + (cellSize / 2)); } public Vector2 CoordsToCell(Vector2 windowCoords) { //CellX = floor(WindowCoordsX-1)/(CellSize+1) double CellX = Math.floor(((double) windowCoords.x - 1) / ((double) actualCellSize + 1)); double CellY = Math.floor(((double) windowCoords.y - 1) / ((double) actualCellSize + 1)); return new Vector2((int) CellX, (int) CellY); } }
[ "Tobias20.3@hotmail.de" ]
Tobias20.3@hotmail.de
ebd0af18387ba565d50ac2659a7a0eaaa5e5e81b
316b58ef4b44d691bb82c14759a126b0a78b053f
/rest/com.paremus.examples.bookshelf.mongo/src/com/paremus/examples/bookshelf/mongo/MongoBookshelfComponent.java
1eb31a8ab9a3763dfbddc6a1f679f8d266de420c
[ "Apache-2.0" ]
permissive
doviche/examples
97f056c55a619dce0eef177cb1a28e00ab726dc7
e5a93606a3c97711fb2202f8232911911cd31b2d
refs/heads/master
2021-01-22T09:32:52.024371
2014-08-26T14:20:36
2014-08-26T14:24:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,860
java
package com.paremus.examples.bookshelf.mongo; import java.util.LinkedList; import java.util.List; import java.util.Map; import org.bndtools.service.endpoint.Endpoint; import aQute.bnd.annotation.component.Activate; import aQute.bnd.annotation.component.Component; import aQute.bnd.annotation.component.Deactivate; import aQute.bnd.annotation.component.Reference; import com.mongodb.BasicDBObject; import com.mongodb.DB; import com.mongodb.DBCollection; import com.mongodb.DBObject; import com.mongodb.Mongo; import com.mongodb.MongoURI; import com.paremus.examples.api.bookshelf.Book; import com.paremus.examples.api.bookshelf.Bookshelf; @Component(immediate = true) public class MongoBookshelfComponent implements Bookshelf { private MongoURI boundUri; private Mongo mongo; private DB db; @Reference(target = "(uri=mongodb:*)") void setEndpoint(Endpoint endpoint, Map<String, String> endpointProps) { boundUri = new MongoURI(endpointProps.get(Endpoint.URI)); } @Activate public void activate() throws Exception { mongo = boundUri.connect(); db = mongo.getDB("test"); System.out.printf("Connected to MongoDB instance at address %s, database %s.%n", boundUri, db.getName()); } @Deactivate public void deactivate() { mongo.close(); System.out.println("Disconnected from " + boundUri); } public void add(Book book) { DBObject object = new BasicDBObject(); object.put("author", book.getAuthor()); object.put("title", book.getTitle()); DBCollection coll = db.getCollection("books"); coll.insert(object); } public List<Book> listBooks() { List<Book> books = new LinkedList<Book>(); DBCollection coll = db.getCollection("books"); for (DBObject object : coll.find()) { Book book = new Book((String) object.get("author"), (String) object.get("title")); books.add(book); } return books; } }
[ "njbartlett@gmail.com" ]
njbartlett@gmail.com
a129edf3a2433db52464c76d77182e25e3edf0bb
3da66e34b366ecd8093be989eaeeca5672dd6a5a
/server/src/main/java/com/weirdo/server/service/CacheItemService.java
275fedcd29e99fc31dcd0e4d99212e2a34fa1abf
[]
no_license
MrclPaChong/SpringBootRedis
90e6fd241b7edb0345ccafa06198d6dbeabc081e
0610266f917b69faf1f21798c6001fc578a90734
refs/heads/master
2022-12-26T18:55:08.314401
2020-03-23T12:41:28
2020-03-23T12:41:28
248,198,515
0
0
null
2020-03-18T10:22:16
2020-03-18T10:17:06
Java
UTF-8
Java
false
false
2,274
java
package com.weirdo.server.service; import com.weirdo.model.dao.ItemDao; import com.weirdo.model.entity.Item; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CachePut; import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import java.util.UUID; /** * Redis缓存注解 * @Cacheable: 获取并将给定的内容添加进缓存(缓存不存在时才添加进去) * @CacheEvict:失效缓存 * @CachePut: 将给定的内容添加进缓存(不管缓存 存在不存在 都添加进去) * * 商品详情服务service * @Author:debug (SteadyJack) * @Link: weixin-> debug0868 qq-> 1948831260 * @Date: 2019/11/3 15:07 **/ @Service public class CacheItemService { private static final Logger log= LoggerFactory.getLogger(CacheItemService.class); @Autowired private ItemDao itemMapper; //TODO:value-必填;key-支持 springEL表达式 //TODO:java.lang.ClassCastException - 因为devtools为了实现重新装载class自己实现了一个类加载器,所以会导致类型强转异常 //TODO:缓存存在时,则直接取缓存,不存在,走方法体的逻辑 //unless = "#result == null" 不塞进缓存 @Cacheable(value = "SpringBootRedis:Item",key = "#id",unless = "#result == null") public Item getInfo(Integer id){ Item entity=itemMapper.queryById(id); log.info("--@Cacheable走数据库查询:{}",entity); return entity; } //TODO:不管你缓存存不存在,都会put到缓存中去 @CachePut(value = "SpringBootRedis:Item",key = "#id",unless = "#result == null") public Item getInfoV2(Integer id){ Item entity=itemMapper.queryById(id); entity.setCode(UUID.randomUUID().toString()); log.info("--@CachePut走数据库查询:{}",entity); return entity; } //TODO:失效/删除缓存 @CacheEvict(value = "SpringBootRedis:Item",key = "#id") public void delete(Integer id){ itemMapper.queryById(id); log.info("--@CacheEvict删除功能:id={}",id); } }
[ "dchenlei@yeah.net" ]
dchenlei@yeah.net
1211b9611d2a8b119fad194426f83f794bc02c24
fb2f1ed5521a6e94fe072468514b5016e88d2c35
/domain/src/test/java/com/jbenitoc/domain/store/BulkPurchaseDiscountTest.java
fbe63ef7cf97c26ce9a96997d0f5c2ea28c8f3c4
[]
no_license
beni0888/cabify-store-server
be4b5125726a902c9451c2eff75a77106b5a700f
d48e181cd9b704fe1056b788a71a807bd21e313c
refs/heads/master
2021-10-25T23:35:11.722252
2019-04-07T23:29:12
2019-04-08T08:31:12
179,925,109
0
0
null
null
null
null
UTF-8
Java
false
false
2,355
java
package com.jbenitoc.domain.store; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.Arguments; import org.junit.jupiter.params.provider.MethodSource; import org.junit.jupiter.params.provider.ValueSource; import java.math.BigDecimal; import java.util.stream.Stream; import static com.jbenitoc.domain.store.ItemQuantity.ONE; import static org.assertj.core.api.Assertions.assertThat; class BulkPurchaseDiscountTest { private static final ItemCode ITEM_CODE = ItemCode.create("ITEM"); private static final Price REGULAR_PRICE = Price.create(BigDecimal.TEN); private static final Price PRICE_WITH_DISCOUNT = Price.create(BigDecimal.ONE); private BulkPurchaseDiscount discount = new BulkPurchaseDiscount(ITEM_CODE, ItemQuantity.create(3), PRICE_WITH_DISCOUNT); @ParameterizedTest @ValueSource(ints = {1, 2}) void givenItemQuantityIsLessThanMinimum_whenIsApplicable_thenReturnFalse(int quantity) { CartEntry entry = CartEntry.create(ITEM_CODE, ItemQuantity.create(quantity)); assertThat(discount.isApplicable(entry)).isFalse(); } @ParameterizedTest @ValueSource(ints = {3,4,99999}) void givenItemQuantityIsHigherOrEqualThanMinimum_whenIsApplicable_thenReturnTrue(int quantity) { CartEntry entry = CartEntry.create(ITEM_CODE, ItemQuantity.create(quantity)); assertThat(discount.isApplicable(entry)).isTrue(); } @ParameterizedTest @MethodSource("getAmountProvider") void givenACartEntryAndItemPrice_whenGetAmount_thenItReturnsTheTotalAmountForTheEntry(CartEntry entry, Price price, Price expectedAmount) { Price amount = discount.getAmount(entry, price); assertThat(amount).isEqualTo(expectedAmount); } private static Stream getAmountProvider() { return Stream.of( Arguments.of(CartEntry.create(ITEM_CODE, ONE), REGULAR_PRICE, REGULAR_PRICE), Arguments.of(CartEntry.create(ITEM_CODE, ItemQuantity.create(2)), REGULAR_PRICE, Price.create(BigDecimal.valueOf(20))), Arguments.of(CartEntry.create(ITEM_CODE, ItemQuantity.create(3)), REGULAR_PRICE, Price.create(BigDecimal.valueOf(3))), Arguments.of(CartEntry.create(ITEM_CODE, ItemQuantity.create(99)), REGULAR_PRICE, Price.create(BigDecimal.valueOf(99))) ); } }
[ "beni0888@hotmail.com" ]
beni0888@hotmail.com
3cb85b552d04bb33039de5ef30d46bc95854ca5f
dc6f85de5595ff1e0cf948e9e9042ec08067d601
/src/kreis/tools/graphs/adjIterator.java
b46a9dd49969aa5c7b267f3700c8e000ff590a4a
[]
no_license
ruslankreis/kreisTools
d76847740dbec95e161b5798de0faa1847917f2d
471efcf72d8a4fc9a6dc32a676af454fa9fca335
refs/heads/master
2021-01-01T19:25:43.076130
2013-02-07T10:29:35
2013-02-07T10:29:35
null
0
0
null
null
null
null
UTF-8
Java
false
false
735
java
package kreis.tools.graphs; /** * Created with IntelliJ IDEA. * User: Pusher * Date: 2/3/13 * Time: 1:17 PM * To change this template use File | Settings | File Templates. */ public class adjIterator implements IadjIterator { private DenseGraph G; private int i; private int v; public adjIterator(DenseGraph g, int V) { G = g; v = V; i = -1; } @Override public int beg() { i = -1; return nxt(); } @Override public int nxt() { for (i++; i < G.V(); i++) if (G.map[v][i].exist) return i; return -1; } @Override public boolean end() { return i >= G.V(); } }
[ "forproplay@gmail.com" ]
forproplay@gmail.com
9323cb8f1b1d5c18003c520b099bdf501616d10f
eff86a8c19f59876394355c6ec7804aa179671c4
/src/com/mindtree/mce/validator/ScoreValidator.java
a7c11831ad5b31b73d37d5d37251d4ca9218ec61
[]
no_license
chandu8260/Grade-Evaluation
b39572d6cdd38ada8a81bd640c7d7c04e3a71f63
eebbff86cd29b2c58301ecaa9357ded1d2ccce81
refs/heads/master
2021-01-12T00:57:27.638400
2017-01-08T05:36:45
2017-01-08T05:39:01
78,323,605
0
0
null
null
null
null
UTF-8
Java
false
false
1,504
java
/** * */ package com.mindtree.mce.validator; import org.springframework.validation.Errors; import org.springframework.validation.ValidationUtils; import org.springframework.validation.Validator; import com.mindtree.mce.vo.ScoreVo; /** * @author m1018211 * */ public class ScoreValidator implements Validator { @Override public boolean supports(Class<?> clazz) { return clazz.isAssignableFrom(ScoreVo.class); } @Override public void validate(Object model, Errors errors) { ScoreVo score = (ScoreVo) model; if (score.getRegdNo().equalsIgnoreCase("select")) { errors.reject("regdNo", "regdNo.empty"); } ValidationUtils.rejectIfEmptyOrWhitespace(errors, "testName", "testName.empty"); if (score.getMaxScore() == null) { errors.reject("maxScore", "maxScore.invalid"); } else if (score.getMaxScore().doubleValue() > 100.0 || score.getMaxScore().doubleValue() < 0.0) { errors.reject("maxScore", "maxScore.invalid"); } if (score.getTestScore() == null) { errors.reject("testScore", "testScore.invalid"); } else if (score.getMaxScore() == null && (score.getTestScore().doubleValue() < 0.0 || score .getTestScore().doubleValue() > 100.0)) { errors.reject("testScore", "testScore.invalid"); } else if (score.getTestScore().doubleValue() < 0.0 || score.getTestScore().doubleValue() > score.getMaxScore() .doubleValue()) { errors.reject("testScore", "testScore.invalid"); } } }
[ "CHANDU@192.168.2.11" ]
CHANDU@192.168.2.11
a727a1cc94aee842cd2f3400d59c4d10827d9858
1b50fe1118a908140b6ba844a876ed17ad026011
/core/src/main/java/org/narrative/network/customizations/narrative/invoices/services/CreateWalletTransactionFromPaidInvoiceTaskBase.java
1d208752e944aac56130c335be848f133a650d63
[ "MIT" ]
permissive
jimador/narrative
a6df67a502a913a78cde1f809e6eb5df700d7ee4
84829f0178a0b34d4efc5b7dfa82a8929b5b06b5
refs/heads/master
2022-04-08T13:50:30.489862
2020-03-07T15:12:30
2020-03-07T15:12:30
null
0
0
null
null
null
null
UTF-8
Java
false
false
713
java
package org.narrative.network.customizations.narrative.invoices.services; import org.narrative.network.core.narrative.wallet.WalletTransaction; import org.narrative.network.customizations.narrative.invoices.Invoice; import org.narrative.network.shared.tasktypes.AreaTaskImpl; /** * Date: 2019-05-20 * Time: 07:45 * * @author jonmark */ public abstract class CreateWalletTransactionFromPaidInvoiceTaskBase extends AreaTaskImpl<WalletTransaction> { protected final Invoice invoice; protected CreateWalletTransactionFromPaidInvoiceTaskBase(Invoice invoice) { assert invoice.getStatus().isPaid() : "The provided invoice should be paid by this point!"; this.invoice = invoice; } }
[ "brian@narrative.org" ]
brian@narrative.org
2aaab4aefc9fe3ec6742496e54ae2a8c791b9ee2
3e0d77eedc400f6925ee8c75bf32f30486f70b50
/hibernateapp-spring/src/main/java/com/techchefs/hibernateapp/hql/GetWithProjections.java
996446552e613d24851ac124ead32bb63789ddb4
[]
no_license
sanghante/ELF-06June19-TechChefs-SantoshG
1c1349a1e4dcea33923dda73cdc7e7dbc54f48e6
a13c01aa22e057dad1e39546a50af1be6ab78786
refs/heads/master
2023-01-10T05:58:52.183306
2019-08-14T13:26:12
2019-08-14T13:26:12
192,526,998
0
0
null
2023-01-04T07:13:13
2019-06-18T11:30:13
Rich Text Format
UTF-8
Java
false
false
1,522
java
package com.techchefs.hibernateapp.hql; import java.util.List; import org.hibernate.Criteria; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.criterion.Projections; import org.springframework.context.ApplicationContext; import org.springframework.context.support.AbstractApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import com.techchefs.hibernateapp.dto.EmployeeInfoBean; public class GetWithProjections { public static void main(String[] args) { ApplicationContext ctx = new ClassPathXmlApplicationContext("beans.xml"); SessionFactory factory = ctx.getBean(SessionFactory.class); ((AbstractApplicationContext)ctx).registerShutdownHook(); Session session = factory.openSession(); Criteria criteria = session.createCriteria(EmployeeInfoBean.class); /* * Projection proj = Projections.property("name"); criteria.setProjection(proj); * * * List<String> list = criteria.list(); for (String ename : list) { * System.out.println(ename); } */ criteria.setProjection(Projections.projectionList() .add(Projections.property("name")) .add(Projections.property("email")) .add(Projections.property("age"))); List<Object[]> list = criteria.list(); for (Object[] result : list) { for( Object insideRes : result) { System.out.print(insideRes.toString()); System.out.print("--"); } System.out.println(); } } }
[ "santhosh.ghante@yahoo.com" ]
santhosh.ghante@yahoo.com
f6ca389499e234fa801dcf9f74b83091b8759c98
306394fc064edb1ac69a3e264be34579644622ed
/src/main/java/com/active/util/MyInterceptor.java
445b47e84195151d6de322ab8b1fc89af1d1571b
[]
no_license
zacharytse/Active
83cf0d3670bad99b568dbde275d65ab4cb74cc0d
626791dfdc475d0620aa5706786389d0863b523f
refs/heads/master
2022-01-30T22:14:49.464312
2019-05-18T10:18:38
2019-05-18T10:18:38
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,073
java
package com.active.util; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.web.servlet.HandlerInterceptor; import org.springframework.web.servlet.ModelAndView; public class MyInterceptor implements HandlerInterceptor { public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception e) throws Exception { } public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView arg3) throws Exception { } public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { // response.addHeader("Access-Control-Allow-Origin", "http://localhost:63342"); // response.addHeader("Access-Control-Allow-Origin", "http://www.shuva.cn"); response.addHeader("Access-Control-Allow-Origin", "*"); response.addHeader("Access-Control-Allow-Methods", "POST,GET"); response.addHeader("Access-Control-Allow-Credentials", "true"); return true; } }
[ "2481086105@qq.com" ]
2481086105@qq.com
f6022a4776083d881db599b0df3ca222d3da8e56
b6e0ead88e885c2c9a3bc0c364f415f928d476ab
/src/main/java/offer/UglyNumber.java
232e5b54a3d5a9eca65dbd6a698febf430134a77
[]
no_license
MrGeroge/Algorithm
eba30a1f2227366d59e6e92ab4c0879cb069a049
eb1bd15191fb0ae4c8211aa37f89351270d1a256
refs/heads/master
2021-04-30T15:52:36.471599
2018-02-12T13:40:44
2018-02-12T13:40:44
121,250,947
0
0
null
null
null
null
UTF-8
Java
false
false
1,476
java
package offer; /** * Created by George on 2018/1/9. */ public class UglyNumber {//丑数:因子只含2或者3或者5 public static void main(String[] args){ UglyNumber un=new UglyNumber(); System.out.print(un.uglyNumOfIndex(1500)); } public boolean isUgly(int num){ if(num<=0){ return false; } else{ while(num%2==0){ num=num/2; } while(num%3==0){ num=num/3; } while(num%5==0){ num=num/5; } if(num==1){ return true; } else{ return false; } } } public int uglyNumOfIndex(int index){ if(index<=0){ return 0; } else{ int[] uglys=new int[index]; uglys[0]=1; int m2=uglys[0]; int m3=uglys[0]; int m5=uglys[0]; int nextIndex=1; while(nextIndex<index){ int m=Math.min(Math.min(2*m2,3*m3),5*m5); uglys[nextIndex]=m; while(2*m2<=m){ m2++; } while(3*m3<=m){ m3++; } while(5*m5<=m){ m5++; } nextIndex++; } return uglys[nextIndex-1]; } } }
[ "18202790149@163.com" ]
18202790149@163.com
7e8afd3025f605f4485915ff2036d5c489fcf3c3
bbb5fbaa5d714331cbbc610bd86881ca6b366175
/src/com/lee/aafour/ReverseNodesGroup.java
7c59efbbc1fbcec2411ae57312c4a28b7b662c55
[]
no_license
zhihzhang/leetcode
9c99e9a9a12d6f5116c0db074beaa2b1cdd40675
cfc92dd583e91bdc75556c112db1fcf51a8da03d
refs/heads/master
2021-06-27T02:33:14.870846
2020-09-26T18:45:52
2020-09-26T18:45:52
138,515,096
0
0
null
null
null
null
UTF-8
Java
false
false
766
java
package com.lee.aafour; import com.lee.common.ListNode; public class ReverseNodesGroup { public static void main(String[] args) { // TODO Auto-generated method stub } // Given this linked list: 1->2->3->4->5 // For k = 2, you should return: 2->1->4->3->5 // For k = 3, you should return: 3->2->1->4->5 public ListNode reverseKGroup(ListNode head, int k) { if (head == null || head.next == null) { return head; } int count = 0; ListNode fast = head; while (fast != null && count < k) { fast = fast.next; count++; } if (count < k) { return head; } ListNode pre = reverseKGroup(fast, k); for (int i = 0; i < k; i++) { ListNode next = head.next; head.next = pre; pre = head; head = next; } return pre; } }
[ "zhihzhang@ebay.com" ]
zhihzhang@ebay.com
b4b36ed5cdc5eee1af1b6b3e6988e900608639cd
14f8fdd4f4aaad8c210563da2b0ab9bc5b1b711e
/src/main/java/com/software/dao/WarehourseMapper.java
eab48482978fbccd8fd279ee83796092b7d43385
[]
no_license
Tossnology/Distributed-SaleSystem
557c042bd91972ddba3de2ce89183214192f34a7
1d7949ad22085873d46ef73ebf9fe92dbccebf1f
refs/heads/master
2023-02-17T21:36:26.100419
2020-05-29T15:39:21
2020-05-29T15:39:21
327,778,559
0
0
null
null
null
null
UTF-8
Java
false
false
524
java
package com.software.dao; import java.util.List; import org.apache.ibatis.annotations.Mapper; import com.software.domain.Warehourse; @Mapper public interface WarehourseMapper { int deleteByPrimaryKey(Warehourse record); int insert(Warehourse record); int insertSelective(Warehourse record); Warehourse selectByPrimaryKey(Warehourse record); List<Warehourse> select(Warehourse record); int updateByPrimaryKeySelective(Warehourse record); int updateByPrimaryKey(Warehourse record); }
[ "jjdjiang@qq.com" ]
jjdjiang@qq.com
2eec16e5c85f450453508a0662ba811ac7fe81dc
04091b1c5b3dab756981fe36533b89e194d4db50
/permission/src/main/java/com/yanzhenjie/permission/target/Target.java
8088461d870d75d79b3137c4dfa324554cf19d03
[ "Apache-2.0" ]
permissive
hujinmeng/AndPermission
f00b3e480c996961d1a6a9d0124c8444aa41435e
a28f92f9925a35137ecc47cb73b40b64032630b5
refs/heads/master
2021-01-23T04:29:02.868165
2017-05-29T14:56:40
2017-05-29T14:56:40
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,077
java
/* * Copyright © Yan Zhenjie. All Rights Reserved * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.yanzhenjie.permission.target; import android.content.Context; import android.content.Intent; import android.support.annotation.NonNull; /** * <p>Request target.</p> * Created by Yan Zhenjie on 2017/5/1. */ public interface Target { Context getContext(); boolean shouldShowRationalePermissions(@NonNull String... permissions); void startActivity(Intent intent); void startActivityForResult(Intent intent, int requestCode); }
[ "smallajax@foxmail.com" ]
smallajax@foxmail.com
e5bde28f051e27f707c7c3ae0f143a1440a6b6f9
fc556a2869b21c035bcb91ddf4a1096aa995e3ef
/src/com/bradsproject/com/bradsproject/BradleyJewell/bMobs/Mob.java
2029ab3098f4c3474ce3b8710eccf5e86654e18f
[]
no_license
dhulliath/bMobs
f5bdf91450c7197a61caa25d05968330652e6dd5
ab43f0dc2cf0d5e399bc15a0c28e5a2f5de35d1c
refs/heads/master
2021-01-18T07:41:06.163989
2011-05-20T10:47:57
2011-05-20T10:47:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
294
java
package com.bradsproject.BradleyJewell.bMobs; public class Mob { public final String type; public boolean enabled = true; public double probability = 1.0; public boolean aggressive; public boolean burn; public int health = -1; public Mob(String t) { type = t; } }
[ "brad811@gmail.com" ]
brad811@gmail.com
4cf6c8d5872d39659226ea2ff1dc8763d346b90d
d81da7a2801a4e6d01b589abed5d2890491ec15f
/WalletUser/app/src/main/java/com/tong/gao/walletuser/bean/request/RequestSellCoin.java
0fb4d0718ec67e0910520871ae2bbe7c7988f66e
[]
no_license
JustinWuShiYuan/WalletUser2
20282d114969a0eeaf972207b9ab7ae76916dbe9
db90890edb132e1bdadfb73339df698570d6b93f
refs/heads/master
2020-04-18T21:40:30.731715
2019-03-13T09:10:42
2019-03-13T09:10:42
167,771,358
0
0
null
null
null
null
UTF-8
Java
false
false
5,407
java
package com.tong.gao.walletuser.bean.request; import java.io.Serializable; public class RequestSellCoin implements Serializable { private String number; private String amountType; private String limitMaxAmount; private String limitMinAmount; private String fixedAmount; private String price; private String type; private String pamentWay; private String coinId; private String coinType; private String prompt; private String autoReplyContent; private String isSeniorCertification; private String isMerchantsTrade; private String transactionPassword; private String googlecode; public RequestSellCoin(String number, String amountType, String limitMaxAmount, String limitMinAmount, String fixedAmount, String price, String type, String pamentWay, String coinId, String coinType, String prompt, String autoReplyContent, String isSeniorCertification, String isMerchantsTrade, String transactionPassword, String googlecode) { this.number = number; this.amountType = amountType; this.limitMaxAmount = limitMaxAmount; this.limitMinAmount = limitMinAmount; this.fixedAmount = fixedAmount; this.price = price; this.type = type; this.pamentWay = pamentWay; this.coinId = coinId; this.coinType = coinType; this.prompt = prompt; this.autoReplyContent = autoReplyContent; this.isSeniorCertification = isSeniorCertification; this.isMerchantsTrade = isMerchantsTrade; this.transactionPassword = transactionPassword; this.googlecode = googlecode; } public String getNumber() { return number; } public void setNumber(String number) { this.number = number; } public String getAmountType() { return amountType; } public void setAmountType(String amountType) { this.amountType = amountType; } public String getLimitMaxAmount() { return limitMaxAmount; } public void setLimitMaxAmount(String limitMaxAmount) { this.limitMaxAmount = limitMaxAmount; } public String getLimitMinAmount() { return limitMinAmount; } public void setLimitMinAmount(String limitMinAmount) { this.limitMinAmount = limitMinAmount; } public String getFixedAmount() { return fixedAmount; } public void setFixedAmount(String fixedAmount) { this.fixedAmount = fixedAmount; } public String getPrice() { return price; } public void setPrice(String price) { this.price = price; } public String getType() { return type; } public void setType(String type) { this.type = type; } public String getPamentWay() { return pamentWay; } public void setPamentWay(String pamentWay) { this.pamentWay = pamentWay; } public String getCoinId() { return coinId; } public void setCoinId(String coinId) { this.coinId = coinId; } public String getCoinType() { return coinType; } public void setCoinType(String coinType) { this.coinType = coinType; } public String getPrompt() { return prompt; } public void setPrompt(String prompt) { this.prompt = prompt; } public String getAutoReplyContent() { return autoReplyContent; } public void setAutoReplyContent(String autoReplyContent) { this.autoReplyContent = autoReplyContent; } public String getIsSeniorCertification() { return isSeniorCertification; } public void setIsSeniorCertification(String isSeniorCertification) { this.isSeniorCertification = isSeniorCertification; } public String getIsMerchantsTrade() { return isMerchantsTrade; } public void setIsMerchantsTrade(String isMerchantsTrade) { this.isMerchantsTrade = isMerchantsTrade; } public String getTransactionPassword() { return transactionPassword; } public void setTransactionPassword(String transactionPassword) { this.transactionPassword = transactionPassword; } public String getGooglecode() { return googlecode; } public void setGooglecode(String googlecode) { this.googlecode = googlecode; } @Override public String toString() { return "RequestSellCoin{" + "number='" + number + '\'' + ", amountType='" + amountType + '\'' + ", limitMaxAmount='" + limitMaxAmount + '\'' + ", limitMinAmount='" + limitMinAmount + '\'' + ", fixedAmount='" + fixedAmount + '\'' + ", price='" + price + '\'' + ", type='" + type + '\'' + ", pamentWay='" + pamentWay + '\'' + ", coinId='" + coinId + '\'' + ", coinType='" + coinType + '\'' + ", prompt='" + prompt + '\'' + ", autoReplyContent='" + autoReplyContent + '\'' + ", isSeniorCertification='" + isSeniorCertification + '\'' + ", isMerchantsTrade='" + isMerchantsTrade + '\'' + ", transactionPassword='" + transactionPassword + '\'' + ", googlecode='" + googlecode + '\'' + '}'; } }
[ "justingaotong@gmail.com" ]
justingaotong@gmail.com
414074d4a7effc7064d7e3370b6a06803887b185
1d295aefc3ab22a3f9309052a515b88a3fa196f7
/src/aplicacionrectangulo2/Rectangulo.java
e60f5b58b452c34983bfcc08095a9f9de3fbf61b
[]
no_license
19julio94/rectangulo
7baecd853db2ab48692333a6749f7d9a0ce2ba6a
cc60cec4d9d7fe421e939d3787cc071aab09076c
refs/heads/master
2021-01-13T00:36:48.082214
2015-10-15T07:42:39
2015-10-15T07:42:39
44,301,308
0
0
null
null
null
null
UTF-8
Java
false
false
814
java
package aplicacionrectangulo2; public class Rectangulo { private float base; private float altura; //constructores public Rectangulo(){ } public Rectangulo(float ba,float al){ base=ba; altura= al; } //metodos de acceso public void setBase(float ba){ base=ba; } public float getBase(){ return base; } public void setAltura(float altura){ this.altura = altura; } public float getAltura(){ return altura; } public float calcularArea (float ba,float al){ float area= ba*al; return area; //tamen return ba*al } public float calcularPerimetro(){ return 2*(base+altura); } }
[ "jpatriciodasilva@atanasoff03.danielcastelao.org" ]
jpatriciodasilva@atanasoff03.danielcastelao.org
ac57c0954ac57d4334ec87f2f6d9da44af708640
59bc1623aef7b7c9dcfadf4a53528a2fa961d0db
/practice/Tree & Binary tree/PathWithSumK.java
36d2e05c01a760d03511cd3e6f2154124b61e523
[]
no_license
rahul6660357/Data-Structure-using-java
20c06e07de680ea8c2d9f6382f5c34b3f08d13f9
f1a6bcd08e7bc87e9ac8a38dd2ab9344732ed85c
refs/heads/master
2020-07-21T05:41:36.466192
2020-02-25T11:57:59
2020-02-25T11:57:59
206,763,636
1
1
null
2019-10-22T09:46:14
2019-09-06T09:46:37
Java
UTF-8
Java
false
false
1,903
java
import java.util.Stack; public class PathWithSumK{ public static void main(String[] args){ int arr[] = {5,3,2,6,1,4,8,7}; // int arr[] = {8,4,5,3}; Node root = new Node(arr[0]); for(int i=1;i<arr.length;i++) { if(arr[i]<root.data) { attachInLeft(root,new Node(arr[i])); } else { attachInRight(root,new Node(arr[i])); } } printPath(root,12); } static Stack<Node> st = new Stack<>(); static int sum = 0; static void printPath(Node root ,int k){ if(root == null) return ; sum = sum + root.data; st.push(root); if(sum == k) { printStack(st); return ; } printPath(root.leftChild, k); printPath(root.rightChild, k); Node poppedEle = st.pop(); sum = sum - poppedEle.data; } static void printStack(Stack<Node> st){ Stack<Node> st2 = new Stack<>(); while(!st.isEmpty()){ Node ele = st.pop(); System.out.print(ele.data + " "); st2.push(ele); } while(!st2.isEmpty()){ st.push(st2.pop()); } } static void attachInLeft(Node root,Node new_node){ if(root.leftChild == null){ root.leftChild = new_node; return ; } if(new_node.data < root.data) { attachInLeft(root.leftChild,new_node); } else { attachInRight(root,new_node); } } static void attachInRight(Node root,Node new_node){ if(root.rightChild == null){ root.rightChild = new_node; return ; } if(new_node.data < root.data) { attachInLeft(root,new_node); } else { attachInRight(root.rightChild,new_node); } } }
[ "aniketchanana6@gmail.com" ]
aniketchanana6@gmail.com
3e772440cfb0cb7bcef902512c1adddf651c7b7f
403255606d7bb8c9dc18e9be7b449dab9ec16f38
/src/main/java/com/lovo/dao/IMessageDao.java
563515abef9d26ee668669a92a458f23c5874c76
[]
no_license
houmingsong/SpringMybatis
b185ee5d46140a69d0de85fe269b3bdd5ffecf83
0d336c4e422ef5d419e15bfbd2557ca025bfa859
refs/heads/master
2022-12-26T14:33:04.392327
2019-07-06T09:04:04
2019-07-06T09:04:04
195,519,503
0
0
null
2022-12-16T09:12:00
2019-07-06T09:03:03
JavaScript
UTF-8
Java
false
false
454
java
package com.lovo.dao; import java.util.List; import com.lovo.entity.MesEntity; import com.lovo.entity.MessageEntity; public interface IMessageDao { public List<MessageEntity> show(int currentpage); public int getTotalPage(); public List<MesEntity> show1(Integer id); public List<MessageEntity> show2(); public List<MessageEntity> QueryAllUsers(); public List<MessageEntity> select(String sex,String scondition); }
[ "castle@192.168.1.111" ]
castle@192.168.1.111
73a20e33330267f0e69374e02ebb96a7e8def657
9b1393329db738c134968d610e4afc93b4bc280f
/终期答辩/文档/毕设代码/android_src/main/java/com/example/ui/LogUI.java
5f558d80c7d176c99fc7a6459bcbed9b589f026c
[]
no_license
785172550/myGraduation
a8b17bcbcc21d73100367c98947b13b9483d30a4
6e7a47db19aef86c3ad43a4f2eb29282782dbcdd
refs/heads/master
2021-01-19T10:54:03.841133
2017-07-04T08:41:53
2017-07-04T08:41:53
87,912,180
0
0
null
null
null
null
UTF-8
Java
false
false
8,996
java
package com.example.ui; import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.view.animation.Animation; import android.view.animation.AnimationUtils; import android.widget.Button; import android.widget.EditText; import com.android.volley.AuthFailureError; import com.android.volley.Request; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.example.com.example.base.BaseActivity; import com.example.entity.SuccessResponse; import com.example.entity.User; import com.example.sean.liontest1.MainActivity; import com.example.sean.liontest1.R; import com.example.util.NetworkSingleton; import com.example.util.UserStatus; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import com.wang.avi.AVLoadingIndicatorView; import java.io.UnsupportedEncodingException; import java.lang.reflect.Type; import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.Map; /** * Created by Administrator on 2016/3/4. * 登录界面 */ public class LogUI extends BaseActivity { EditText username_et, psw_et; Button login_btn, forget_btn, reg_btn; AVLoadingIndicatorView avLoadingIndicatorView; Animation scale_animation; @Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); // 设置全屏 requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.activity_log); initview(); } protected void initview() { username_et = (EditText) findViewById(R.id.uname_edt); psw_et = (EditText) findViewById(R.id.pawd_edt); login_btn = (Button) findViewById(R.id.log_btn); forget_btn = (Button) findViewById(R.id.forget_btn); reg_btn = (Button) findViewById(R.id.reg_btn); avLoadingIndicatorView = (AVLoadingIndicatorView) findViewById(R.id.avloadingIndicatorView); //用户名 密码 String uname, pawd = null; scale_animation = AnimationUtils.loadAnimation(LogUI.this, R.anim.login_btn_scale_animation); //注册监听器 login_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // 首先检查是否为空 if (username_et.getText().toString().isEmpty() || psw_et.getText() .toString() .isEmpty()) { ShowToast("用户名或密码不能为空"); return; } login(); } }); forget_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); reg_btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // 进入注册界面 Intent regIntent = new Intent(LogUI.this, RegUI.class); LogUI.this.startActivity(regIntent); } }); } protected void login() { // login_btn.setVisibility(View.INVISIBLE); // 发起请求 String tag_register_req = "login_req"; String url = URL_PREFIX + "login.php"; final ProgressDialog pDialog = new ProgressDialog(this); pDialog.setMessage("Loading..."); pDialog.show(); final Gson gson = new Gson(); StringRequest login_req = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() { @Override public void onResponse(String response) { ShowLog(response); try { response = new String(response.getBytes("ISO-8859-1"),"UTF-8"); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } // 首先是获取code String resArray[] = response.split("code"); ShowLog(resArray[1]); String codeStr = resArray[1].substring(3, 6); int code = Integer.parseInt(codeStr); if (code == 201) { // 出错了 // 获取type的值 String typeStr = response.substring(9, 12); int type = Integer.parseInt(typeStr); if (type == 100 || type == 101) { ShowToast(R.string.database_operation_error); } else if (type == 102) { ShowToast(R.string.username_or_password_error); } } else if (code == 200) { // 正确的返回 ShowLog("测试"); // 解析JSON Type type = new TypeToken<SuccessResponse<User>>() { }.getType(); SuccessResponse<User> successResponse = gson.fromJson(response, type); ShowToast(R.string.login_success); // 想数据库中插入数据 insertIntoDatabase(successResponse); // 首先判断用户资料是否填写完整 com.example.model.User user = UserStatus.getLoginedUser(); ShowLog("user"+user.getName()); if (user.getName().isEmpty()) { naviToPersonUI(); } else { naviToMainActivity(); } LogUI.this.finish(); } pDialog.dismiss(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { ShowLog("登录失败,请重试"); pDialog.dismiss(); } }) { @Override protected Map<String, String> getParams() throws AuthFailureError { SimpleDateFormat sDateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); String date = sDateFormat.format(new java.util.Date()); Map<String, String> map = new HashMap<String, String>(); map.put("username", username_et.getText().toString()); map.put("password", md5(psw_et.getText().toString())); return map; } }; // 加入RequestQueue NetworkSingleton.getInstance(getApplicationContext()).addToRequestQueue(login_req); // login_btn.startAnimation(scale_animation); // scale_animation.setAnimationListener(new Animation.AnimationListener() { // @Override // public void onAnimationStart(Animation animation) { // // } // // @Override // public void onAnimationEnd(Animation animation) { // avLoadingIndicatorView.setVisibility(View.VISIBLE); // login_btn.setClickable(false); // } // // @Override // public void onAnimationRepeat(Animation animation) { // // } // }); //成功跳到下一个界面,不成功返回原来,toast提示密码用户名错误 /*if(登录不成功){ avLoadingIndicatorView.setVisibility(View.INVISIBLE); login_btn.clearAnimation(); login_btn.setClickable(true); }*/ } private void insertIntoDatabase(SuccessResponse<User> successResponse) { com.example.model.User user = new com.example.model.User(successResponse.getData() .getId(), successResponse.getData().getUsername(), successResponse.getData().getPassword(), successResponse.getData() .getHeader(), successResponse.getData().getName(), successResponse.getData().getSex(), successResponse.getData() .getAddress(), successResponse.getData().getContact(), successResponse.getData().getService_team(), successResponse.getData().getCreate_time(), successResponse.getData() .getUpdate_time()); user.save(); } private void naviToMainActivity() { Intent intent = new Intent(LogUI.this, MainActivity.class); startActivity(intent); } private void naviToPersonUI() { Intent intent = new Intent(LogUI.this, PersonalUI.class); startActivity(intent); } }
[ "785172550@qq.com" ]
785172550@qq.com
007fde16c5912ba485afc3332b98d1e1a03db51c
8cbdd9722383d9f60ff7a40e9a15209988f0ffca
/src/main/java/br/com/heltondoria/security/SecurityUtils.java
a8d764484b41ae278d394373bb6be0df88cf9f92
[]
no_license
heltondoria/DemoApplication
7316cf421f73a8e3d8075c6b91b2c11c04f26932
343ec4961a7eeb9892135995a762008ff171afed
refs/heads/master
2021-12-24T13:42:17.117780
2019-05-11T22:28:39
2019-05-11T22:28:39
116,714,905
0
0
null
2021-12-15T13:04:11
2018-01-08T18:50:36
Java
UTF-8
Java
false
false
2,491
java
package br.com.heltondoria.security; import org.springframework.security.core.context.SecurityContext; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.security.core.userdetails.UserDetails; import java.util.Optional; /** * Utility class for Spring Security. */ public final class SecurityUtils { private SecurityUtils() { } /** * Get the login of the current user. * * @return the login of the current user */ public static Optional<String> getCurrentUserLogin() { SecurityContext securityContext = SecurityContextHolder.getContext(); return Optional.ofNullable(securityContext.getAuthentication()) .map(authentication -> { if (authentication.getPrincipal() instanceof UserDetails) { UserDetails springSecurityUser = (UserDetails) authentication.getPrincipal(); return springSecurityUser.getUsername(); } else if (authentication.getPrincipal() instanceof String) { return (String) authentication.getPrincipal(); } return null; }); } /** * Check if a user is authenticated. * * @return true if the user is authenticated, false otherwise */ public static boolean isAuthenticated() { SecurityContext securityContext = SecurityContextHolder.getContext(); return Optional.ofNullable(securityContext.getAuthentication()) .map(authentication -> authentication.getAuthorities().stream() .noneMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(AuthoritiesConstants.ANONYMOUS))) .orElse(false); } /** * If the current user has a specific authority (security role). * <p> * The name of this method comes from the isUserInRole() method in the Servlet API * * @param authority the authority to check * @return true if the current user has the authority, false otherwise */ public static boolean isCurrentUserInRole(String authority) { SecurityContext securityContext = SecurityContextHolder.getContext(); return Optional.ofNullable(securityContext.getAuthentication()) .map(authentication -> authentication.getAuthorities().stream() .anyMatch(grantedAuthority -> grantedAuthority.getAuthority().equals(authority))) .orElse(false); } }
[ "jhipster-bot@users.noreply.github.com" ]
jhipster-bot@users.noreply.github.com
8ea12c1819ac518c9cf6e1d2f6804233ea35ae43
c885ef92397be9d54b87741f01557f61d3f794f3
/tests-without-trycatch/Gson-10/com.google.gson.internal.bind.ReflectiveTypeAdapterFactory/BBC-F0-opt-70/23/com/google/gson/internal/bind/ReflectiveTypeAdapterFactory_ESTest_scaffolding.java
e88f0d320cc681086556e0e7c780035c7eb808d8
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
16,713
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Sat Oct 23 07:26:26 GMT 2021 */ package com.google.gson.internal.bind; 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; import static org.evosuite.shaded.org.mockito.Mockito.*; @EvoSuiteClassExclude public class ReflectiveTypeAdapterFactory_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 = "com.google.gson.internal.bind.ReflectiveTypeAdapterFactory"; 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(); try { initMocksToAvoidTimeoutsInTheTests(); } catch(ClassNotFoundException e) {} } @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.dir", "/experiment"); } private static void initializeClasses() { org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(ReflectiveTypeAdapterFactory_ESTest_scaffolding.class.getClassLoader() , "com.google.gson.internal.bind.TimeTypeAdapter$1", "com.google.gson.reflect.TypeToken", "com.google.gson.internal.bind.TypeAdapters$23", "com.google.gson.internal.bind.TypeAdapters$24", "com.google.gson.internal.bind.TypeAdapters$25", "com.google.gson.internal.bind.TypeAdapters$26", "com.google.gson.internal.bind.TypeAdapters$20", "com.google.gson.TypeAdapter", "com.google.gson.internal.bind.JsonTreeWriter", "com.google.gson.internal.bind.TypeAdapters$21", "com.google.gson.internal.bind.TypeAdapters$22", "com.google.gson.internal.bind.TypeAdapters$27", "com.google.gson.FieldNamingStrategy", "com.google.gson.internal.bind.TypeAdapters$28", "com.google.gson.internal.bind.TypeAdapters$29", "com.google.gson.internal.bind.SqlDateTypeAdapter", "com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper", "com.google.gson.internal.bind.TimeTypeAdapter", "com.google.gson.ExclusionStrategy", "com.google.gson.internal.bind.TypeAdapters$34", "com.google.gson.internal.bind.TypeAdapters$35", "com.google.gson.internal.bind.TypeAdapters$30", "com.google.gson.internal.bind.TypeAdapters$32", "com.google.gson.internal.bind.TypeAdapters$33", "com.google.gson.JsonArray", "com.google.gson.LongSerializationPolicy", "com.google.gson.internal.bind.TypeAdapters$35$1", "com.google.gson.internal.Excluder", "com.google.gson.TypeAdapterFactory", "com.google.gson.internal.bind.TypeAdapters$EnumTypeAdapter", "com.google.gson.internal.$Gson$Types$GenericArrayTypeImpl", "com.google.gson.stream.JsonReader$1", "com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter", "com.google.gson.internal.$Gson$Types", "com.google.gson.stream.JsonReader", "com.google.gson.InstanceCreator", "com.google.gson.internal.bind.MapTypeAdapterFactory", "com.google.gson.Gson$FutureTypeAdapter", "com.google.gson.internal.LinkedTreeMap$Node", "com.google.gson.stream.JsonWriter", "com.google.gson.internal.bind.ArrayTypeAdapter$1", "com.google.gson.internal.Streams", "com.google.gson.internal.$Gson$Preconditions", "com.google.gson.internal.bind.TypeAdapters$12", "com.google.gson.internal.bind.TypeAdapters$13", "com.google.gson.internal.bind.TypeAdapters$14", "com.google.gson.internal.bind.TypeAdapters$15", "com.google.gson.internal.bind.TypeAdapters$10", "com.google.gson.internal.Primitives", "com.google.gson.internal.bind.TypeAdapters$11", "com.google.gson.stream.MalformedJsonException", "com.google.gson.internal.bind.ArrayTypeAdapter", "com.google.gson.internal.ConstructorConstructor$3", "com.google.gson.stream.JsonToken", "com.google.gson.internal.bind.TypeAdapters$16", "com.google.gson.internal.ObjectConstructor", "com.google.gson.internal.bind.TypeAdapters$17", "com.google.gson.internal.bind.TypeAdapters$18", "com.google.gson.JsonNull", "com.google.gson.internal.bind.TypeAdapters$19", "com.google.gson.internal.bind.DateTypeAdapter$1", "com.google.gson.internal.ConstructorConstructor$8", "com.google.gson.LongSerializationPolicy$1", "com.google.gson.LongSerializationPolicy$2", "com.google.gson.JsonObject", "com.google.gson.internal.bind.JsonTreeReader$1", "com.google.gson.TypeAdapter$1", "com.google.gson.Gson$6", "com.google.gson.internal.UnsafeAllocator$3", "com.google.gson.internal.UnsafeAllocator$4", "com.google.gson.internal.UnsafeAllocator$1", "com.google.gson.internal.UnsafeAllocator$2", "com.google.gson.Gson$2", "com.google.gson.Gson$3", "com.google.gson.internal.bind.ObjectTypeAdapter", "com.google.gson.Gson$4", "com.google.gson.Gson$5", "com.google.gson.internal.bind.DateTypeAdapter", "com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter", "com.google.gson.Gson$1", "com.google.gson.internal.bind.TypeAdapters$26$1", "com.google.gson.Gson", "com.google.gson.internal.LinkedTreeMap$1", "com.google.gson.internal.bind.JsonAdapterAnnotationTypeAdapterFactory", "com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$BoundField", "com.google.gson.internal.bind.ReflectiveTypeAdapterFactory", "com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1", "com.google.gson.annotations.SerializedName", "com.google.gson.internal.Excluder$1", "com.google.gson.internal.bind.TypeAdapters$2", "com.google.gson.internal.bind.JsonTreeReader", "com.google.gson.internal.bind.TypeAdapters$1", "com.google.gson.internal.bind.JsonTreeWriter$1", "com.google.gson.internal.bind.SqlDateTypeAdapter$1", "com.google.gson.JsonIOException", "com.google.gson.internal.bind.TypeAdapters$8", "com.google.gson.internal.bind.TypeAdapters$7", "com.google.gson.internal.bind.TypeAdapters", "com.google.gson.internal.bind.TypeAdapters$9", "com.google.gson.internal.bind.TypeAdapters$4", "com.google.gson.internal.LinkedTreeMap", "com.google.gson.internal.bind.TypeAdapters$3", "com.google.gson.internal.bind.TypeAdapters$6", "com.google.gson.internal.LazilyParsedNumber", "com.google.gson.internal.bind.TypeAdapters$5", "com.google.gson.internal.bind.ObjectTypeAdapter$1", "com.google.gson.JsonParseException", "com.google.gson.internal.ConstructorConstructor", "com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter", "com.google.gson.JsonElement", "com.google.gson.FieldNamingPolicy", "com.google.gson.internal.bind.CollectionTypeAdapterFactory", "com.google.gson.annotations.JsonAdapter", "com.google.gson.JsonPrimitive", "com.google.gson.internal.UnsafeAllocator", "com.google.gson.internal.Streams$AppendableWriter", "com.google.gson.internal.ConstructorConstructor$14", "com.google.gson.JsonSyntaxException", "com.google.gson.FieldNamingPolicy$4", "com.google.gson.FieldNamingPolicy$3", "com.google.gson.FieldNamingPolicy$5", "com.google.gson.internal.JsonReaderInternalAccess", "com.google.gson.internal.$Gson$Types$ParameterizedTypeImpl", "com.google.gson.FieldNamingPolicy$2", "com.google.gson.FieldNamingPolicy$1" ); } private static void initMocksToAvoidTimeoutsInTheTests() throws ClassNotFoundException { mock(Class.forName("com.google.gson.InstanceCreator", false, ReflectiveTypeAdapterFactory_ESTest_scaffolding.class.getClassLoader())); } private static void resetClasses() { org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(ReflectiveTypeAdapterFactory_ESTest_scaffolding.class.getClassLoader()); org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses( "com.google.gson.internal.bind.ReflectiveTypeAdapterFactory", "com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$BoundField", "com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1", "com.google.gson.TypeAdapter", "com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter", "com.google.gson.internal.Primitives", "com.google.gson.internal.$Gson$Types", "com.google.gson.FieldNamingPolicy", "com.google.gson.reflect.TypeToken", "com.google.gson.Gson$1", "com.google.gson.Gson", "com.google.gson.internal.Excluder", "com.google.gson.LongSerializationPolicy", "com.google.gson.internal.ConstructorConstructor", "com.google.gson.internal.bind.TypeAdapters$5", "com.google.gson.internal.bind.TypeAdapters$32", "com.google.gson.internal.bind.TypeAdapters$6", "com.google.gson.internal.bind.TypeAdapters$7", "com.google.gson.internal.bind.TypeAdapters$8", "com.google.gson.internal.bind.TypeAdapters$33", "com.google.gson.internal.bind.TypeAdapters$9", "com.google.gson.internal.bind.TypeAdapters$10", "com.google.gson.internal.bind.TypeAdapters$11", "com.google.gson.internal.bind.TypeAdapters$1", "com.google.gson.TypeAdapter$1", "com.google.gson.internal.bind.TypeAdapters$2", "com.google.gson.internal.bind.TypeAdapters$3", "com.google.gson.internal.bind.TypeAdapters$12", "com.google.gson.internal.bind.TypeAdapters$13", "com.google.gson.internal.bind.TypeAdapters$14", "com.google.gson.internal.bind.TypeAdapters$15", "com.google.gson.internal.bind.TypeAdapters$16", "com.google.gson.internal.bind.TypeAdapters$17", "com.google.gson.internal.bind.TypeAdapters$18", "com.google.gson.internal.bind.TypeAdapters$19", "com.google.gson.internal.bind.TypeAdapters$20", "com.google.gson.internal.bind.TypeAdapters$21", "com.google.gson.internal.bind.TypeAdapters$22", "com.google.gson.internal.bind.TypeAdapters$23", "com.google.gson.internal.bind.TypeAdapters$24", "com.google.gson.internal.bind.TypeAdapters$35", "com.google.gson.internal.bind.TypeAdapters$25", "com.google.gson.internal.bind.TypeAdapters$4", "com.google.gson.internal.bind.TypeAdapters$26", "com.google.gson.internal.bind.TypeAdapters$27", "com.google.gson.internal.bind.TypeAdapters$34", "com.google.gson.internal.bind.TypeAdapters$28", "com.google.gson.internal.bind.TypeAdapters$29", "com.google.gson.internal.bind.TypeAdapters$30", "com.google.gson.internal.bind.TypeAdapters", "com.google.gson.internal.bind.ObjectTypeAdapter$1", "com.google.gson.internal.bind.ObjectTypeAdapter", "com.google.gson.Gson$2", "com.google.gson.Gson$3", "com.google.gson.Gson$5", "com.google.gson.Gson$6", "com.google.gson.internal.bind.DateTypeAdapter$1", "com.google.gson.internal.bind.DateTypeAdapter", "com.google.gson.internal.bind.TimeTypeAdapter$1", "com.google.gson.internal.bind.TimeTypeAdapter", "com.google.gson.internal.bind.SqlDateTypeAdapter$1", "com.google.gson.internal.bind.SqlDateTypeAdapter", "com.google.gson.internal.bind.ArrayTypeAdapter$1", "com.google.gson.internal.bind.ArrayTypeAdapter", "com.google.gson.internal.bind.CollectionTypeAdapterFactory", "com.google.gson.internal.bind.MapTypeAdapterFactory", "com.google.gson.internal.bind.JsonAdapterAnnotationTypeAdapterFactory", "com.google.gson.internal.$Gson$Preconditions", "com.google.gson.internal.Streams", "com.google.gson.stream.JsonWriter", "com.google.gson.Gson$FutureTypeAdapter", "com.google.gson.internal.bind.TypeAdapters$EnumTypeAdapter", "com.google.gson.internal.Streams$AppendableWriter", "com.google.gson.internal.Streams$AppendableWriter$CurrentWrite", "com.google.gson.internal.JsonReaderInternalAccess", "com.google.gson.stream.JsonReader$1", "com.google.gson.stream.JsonReader", "com.google.gson.stream.MalformedJsonException", "com.google.gson.internal.bind.JsonTreeWriter$1", "com.google.gson.JsonElement", "com.google.gson.JsonPrimitive", "com.google.gson.internal.bind.JsonTreeWriter", "com.google.gson.JsonNull", "com.google.gson.JsonObject", "com.google.gson.internal.LinkedTreeMap$1", "com.google.gson.internal.LinkedTreeMap", "com.google.gson.internal.LinkedTreeMap$Node", "com.google.gson.JsonParseException", "com.google.gson.JsonSyntaxException", "com.google.gson.internal.bind.JsonTreeReader$1", "com.google.gson.internal.bind.JsonTreeReader", "com.google.gson.stream.JsonToken", "com.google.gson.internal.bind.ObjectTypeAdapter$2", "com.google.gson.internal.ConstructorConstructor$3", "com.google.gson.JsonArray", "com.google.gson.internal.$Gson$Types$ParameterizedTypeImpl", "com.google.gson.internal.ConstructorConstructor$14", "com.google.gson.internal.UnsafeAllocator", "com.google.gson.internal.UnsafeAllocator$1", "com.google.gson.internal.ConstructorConstructor$8", "com.google.gson.internal.bind.CollectionTypeAdapterFactory$Adapter", "com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper", "com.google.gson.internal.bind.MapTypeAdapterFactory$Adapter", "com.google.gson.JsonIOException", "com.google.gson.internal.$Gson$Types$WildcardTypeImpl", "com.google.gson.internal.ConstructorConstructor$12", "com.google.gson.internal.Excluder$1", "com.google.gson.internal.LazilyParsedNumber", "com.google.gson.internal.ConstructorConstructor$13", "com.google.gson.internal.$Gson$Types$GenericArrayTypeImpl", "com.google.gson.internal.ConstructorConstructor$6", "com.google.gson.internal.LinkedTreeMap$EntrySet", "com.google.gson.internal.LinkedTreeMap$LinkedTreeMapIterator", "com.google.gson.internal.LinkedTreeMap$EntrySet$1", "com.google.gson.internal.bind.TypeAdapters$35$1" ); } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
79ab9c256deee1878b631be0dfde3d792cc5d55b
0175a417f4b12b80cc79edbcd5b7a83621ee97e5
/flexodesktop/model/flexofoundation/src/main/java/org/openflexo/foundation/ie/widget/IEBlocWidget.java
fb1c6a40de008a285b0b26ff5c1c8b0994040308
[]
no_license
agilebirds/openflexo
c1ea42996887a4a171e81ddbd55c7c1e857cbad0
0250fc1061e7ae86c9d51a6f385878df915db20b
refs/heads/master
2022-08-06T05:42:04.617144
2013-05-24T13:15:58
2013-05-24T13:15:58
2,372,131
11
6
null
2022-07-06T19:59:55
2011-09-12T15:44:45
Java
UTF-8
Java
false
false
10,019
java
/* * (c) Copyright 2010-2011 AgileBirds * * This file is part of OpenFlexo. * * OpenFlexo is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * OpenFlexo 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 OpenFlexo. If not, see <http://www.gnu.org/licenses/>. * */ package org.openflexo.foundation.ie.widget; /** * Represents a bloc widget * * @author bmangez */ import java.util.Hashtable; import java.util.Vector; import java.util.logging.Logger; import org.apache.commons.lang.StringUtils; import org.openflexo.foundation.DataModification; import org.openflexo.foundation.FlexoObservable; import org.openflexo.foundation.ie.HTMLListDescriptor; import org.openflexo.foundation.ie.IEObject; import org.openflexo.foundation.ie.IETopComponent; import org.openflexo.foundation.ie.IEWOComponent; import org.openflexo.foundation.ie.IObject; import org.openflexo.foundation.ie.dm.IEDataModification; import org.openflexo.foundation.ie.dm.InnerBlocInserted; import org.openflexo.foundation.ie.dm.InnerBlocRemoved; import org.openflexo.foundation.ie.dm.TableSizeChanged; import org.openflexo.foundation.ie.dm.table.AddEmptyRow; import org.openflexo.foundation.ie.dm.table.RemoveEmptyRow; import org.openflexo.foundation.ie.dm.table.WidgetAddedToTable; import org.openflexo.foundation.ie.dm.table.WidgetRemovedFromTable; import org.openflexo.foundation.rm.FlexoProject; import org.openflexo.foundation.xml.FlexoComponentBuilder; public class IEBlocWidget extends AbstractButtonedWidget implements IETopComponent, ExtensibleWidget { /** * */ public static final String BLOC_WIDGET = "bloc_widget"; @SuppressWarnings("unused") private static final Logger logger = Logger.getLogger(IEBlocWidget.class.getPackage().getName()); // ========================================================================== // ============================= Variables // ================================== // ========================================================================== public static final String BLOC_TITLE_ATTRIBUTE_NAME = "title"; public static final String IE_BLOC_WIDGET_TAG_NAME = "IEBloc"; private String _title; private int _colSpan = 1; private int _rowSpan = 1; private String _value; private boolean _hideTable = false; private InnerBlocWidgetInterface _innerBloc; // ========================================================================== // ============================= Constructor // ================================ // ========================================================================== public IEBlocWidget(FlexoComponentBuilder builder) { this(builder.woComponent, null, builder.getProject()); initializeDeserialization(builder); } public IEBlocWidget(IEWOComponent woComponent, IEObject parent, FlexoProject prj) { super(woComponent, parent, prj); _colSpan = 1; _rowSpan = 1; } public void setColSpan(int colSpan) { _colSpan = colSpan; setChanged(); notifyObservers(new IEDataModification("description", null, new Integer(colSpan))); } public void setRowSpan(int rowSpan) { _rowSpan = rowSpan; setChanged(); notifyObservers(new IEDataModification("rowSpan", null, new Integer(rowSpan))); } public int getColSpan() { return _colSpan; } public int getRowSpan() { return _rowSpan; } public boolean getHideTable() { return _hideTable; } public void setHideTable(boolean table) { _hideTable = table; setChanged(); notifyObservers(new IEDataModification("hideTable", null, new Boolean(table))); } /** * @deprecated * @return */ @Deprecated public String getValue() { return _value; } /** * @deprecated * @param _value */ @Deprecated public void setValue(String _value) { this._value = _value; setChanged(); notifyObservers(new IEDataModification("value", null, _value)); } // ========================================================================== // ============================= Instance Methods // =========================== // ========================================================================== @Override public void performOnDeleteOperations() { if (_innerBloc != null) { _innerBloc.delete(); } super.performOnDeleteOperations(); } public void removeContent(InnerBlocWidgetInterface table) { if (table != null && table.equals(_innerBloc)) { DataModification dm = new InnerBlocRemoved(_innerBloc); _innerBloc = null; setChanged(); notifyObservers(dm); } } public void insertContent(InnerBlocWidgetInterface table) { if (table != null) { setContent(table); setChanged(); notifyObservers(new InnerBlocInserted(table)); } } public void replaceWidgetByReusable(IEWidget oldWidget, InnerBlocReusableWidget newWidget) { removeContent((InnerBlocWidgetInterface) oldWidget); insertContent(newWidget); } // ========================================================================== // ============================= Accessors // ================================== // ========================================================================== @Override public boolean isTopComponent() { return true; } public void setTitle(String title) { _title = title; setChanged(); notifyObservers(new DataModification(BLOC_TITLE_ATTRIBUTE_NAME, null, title)); } @Override public String getTitle() { return _title; } public InnerBlocWidgetInterface getContent() { return _innerBloc; } public void setContent(InnerBlocWidgetInterface content) { _innerBloc = content; _innerBloc.setParent(this); setChanged(); } @Override public String getDefaultInspectorName() { return "Bloc.inspector"; } /** * Return a Vector of embedded IEObjects at this level. NOTE that this is NOT a recursive method * * @return a Vector of IEObject instances */ @Override public Vector<IObject> getEmbeddedIEObjects() { Vector answer = new Vector(); if (_innerBloc != null) { answer.add(_innerBloc); } answer.add(getButtonList()); return answer; } public HTMLListDescriptor getContainedDescriptor() { if (getContent() != null) { return getContent().getHTMLListDescriptor(); } return null; } @Override public String getFullyQualifiedName() { return "Bloc" + getTitle(); } public void notifyListActionButtonStateChange(IEDataModification modif) { setChanged(); notifyObservers(modif); } public void handleContentResize() { setChanged(); notifyObservers(new ContentSizeChanged()); } /** * Overrides update * * @see org.openflexo.foundation.ie.IEObject#update(org.openflexo.foundation.FlexoObservable, org.openflexo.foundation.DataModification) */ @Override public void update(FlexoObservable observable, DataModification obj) { if (observable == _innerBloc && (obj instanceof WidgetAddedToTable || obj instanceof WidgetRemovedFromTable || obj instanceof TableSizeChanged || obj instanceof AddEmptyRow || obj instanceof RemoveEmptyRow)) { setChanged(); notifyObservers(new ContentSizeChanged()); } else { super.update(observable, obj); } } /** * Overrides notifyDisplayNeedsRefresh * * @see org.openflexo.foundation.ie.widget.IEWidget#notifyDisplayNeedsRefresh() */ @Override public void notifyDisplayNeedsRefresh() { super.notifyDisplayNeedsRefresh(); if (_innerBloc != null) { _innerBloc.notifyDisplayNeedsRefresh(); } } /** * Overrides getClassNameKey * * @see org.openflexo.foundation.FlexoModelObject#getClassNameKey() */ @Override public String getClassNameKey() { return BLOC_WIDGET; } public Vector<IETextFieldWidget> getAllDateTextfields() { Vector<IETextFieldWidget> v = new Vector<IETextFieldWidget>(); if (_innerBloc != null) { v.addAll(_innerBloc.getAllDateTextfields()); } return v; } @Override public Vector<IESequenceTab> getAllTabContainers() { Vector<IESequenceTab> reply = new Vector<IESequenceTab>(); if (_innerBloc == null) { return reply; } if (_innerBloc instanceof IESequenceTab) { reply.add((IESequenceTab) _innerBloc); } if (_innerBloc instanceof IEHTMLTableWidget) { reply.addAll(((IEHTMLTableWidget) _innerBloc).getAllTabContainers()); } return reply; } @Override public Vector<IEHyperlinkWidget> getAllButtonInterface() { Vector<IEHyperlinkWidget> v = new Vector<IEHyperlinkWidget>(); if (_innerBloc != null) { v.addAll(_innerBloc.getAllButtonInterface()); } if (getButtonList() != null) { v.addAll(getButtonList().getAllButtonInterface()); } return v; } @Override public void setWOComponent(IEWOComponent woComponent) { if (noWOChange(woComponent)) { return; } super.setWOComponent(woComponent); if (getContent() != null) { ((IEWidget) getContent()).setWOComponent(woComponent);// This call is very important because it will update the WOComponent } // components cache if (getButtonList() != null) { getButtonList().setWOComponent(woComponent); } } @Override public boolean areComponentInstancesValid() { if (getContent() != null) { return ((IEWidget) getContent()).areComponentInstancesValid(); } else { return true; } } @Override public void removeInvalidComponentInstances() { super.removeInvalidComponentInstances(); if (getContent() != null) { ((IEWidget) getContent()).removeInvalidComponentInstances(); } } @Override protected Hashtable<String, String> getLocalizableProperties(Hashtable<String, String> props) { if (StringUtils.isNotEmpty(getTitle())) { props.put("title", getTitle()); } return super.getLocalizableProperties(props); } }
[ "guillaume.polet@gmail.com" ]
guillaume.polet@gmail.com
e5897b44b41d70bbf226f7281f86dfeb4be0feb4
97cb6bc51b070b074d4785e492ca3c185071b7c2
/latke/src/main/java/org/b3log/latke/plugin/PluginStatus.java
25f1ed2a4eb281c72888aa3a43bdc0b5f3ba8cdd
[ "Apache-2.0" ]
permissive
HeartBeat312/b3log-latke
830fcc93146227e7e543d0270abe43421a5a85b6
94f4a33155924f2c43c015cfd839ce51e159da5e
refs/heads/master
2021-01-17T21:56:56.452496
2013-05-30T05:25:31
2013-05-30T05:25:31
null
0
0
null
null
null
null
UTF-8
Java
false
false
991
java
/* * Copyright (c) 2009, 2010, 2011, 2012, 2013, B3log Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.b3log.latke.plugin; /** * Plugin status enumerations. * * @author <a href="mailto:DL88250@gmail.com">Liang Ding</a> * @version 1.0.0.0, Jun 11, 2011 */ public enum PluginStatus { /** * Indicates a plugin is enabled. */ ENABLED, /** * Indicates a plugin is disabled. */ DISABLED }
[ "DL88250@gmail.com" ]
DL88250@gmail.com
57840d9a762cbe4c147ae13fb69c4947ea4d0227
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/22/22_6deef2dffc0b06ec4384cfc46ffec679b64207b9/HoyaClient/22_6deef2dffc0b06ec4384cfc46ffec679b64207b9_HoyaClient_s.java
bf91a0c3070cc227b25e320b86d032d82a0a06ee
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
69,351
java
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.hadoop.hoya.yarn.client; import com.beust.jcommander.JCommander; import com.google.common.annotations.VisibleForTesting; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.CommonConfigurationKeysPublic; import org.apache.hadoop.fs.FileAlreadyExistsException; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.hdfs.DFSConfigKeys; import org.apache.hadoop.hoya.HoyaExitCodes; import org.apache.hadoop.hoya.HoyaKeys; import org.apache.hadoop.hoya.HoyaXmlConfKeys; import org.apache.hadoop.hoya.api.ClusterDescription; import org.apache.hadoop.hoya.api.ClusterNode; import org.apache.hadoop.hoya.api.HoyaClusterProtocol; import org.apache.hadoop.hoya.api.OptionKeys; import org.apache.hadoop.hoya.api.RoleKeys; import org.apache.hadoop.hoya.api.StatusKeys; import org.apache.hadoop.hoya.api.proto.Messages; import org.apache.hadoop.hoya.exceptions.BadCommandArgumentsException; import org.apache.hadoop.hoya.exceptions.BadConfigException; import org.apache.hadoop.hoya.exceptions.HoyaException; import org.apache.hadoop.hoya.exceptions.NoSuchNodeException; import org.apache.hadoop.hoya.exceptions.WaitTimeoutException; import org.apache.hadoop.hoya.providers.ClientProvider; import org.apache.hadoop.hoya.providers.HoyaProviderFactory; import org.apache.hadoop.hoya.providers.ProviderRole; import org.apache.hadoop.hoya.providers.hoyaam.HoyaAMClientProvider; import org.apache.hadoop.hoya.servicemonitor.Probe; import org.apache.hadoop.hoya.servicemonitor.ProbeFailedException; import org.apache.hadoop.hoya.servicemonitor.ProbePhase; import org.apache.hadoop.hoya.servicemonitor.ProbeReportHandler; import org.apache.hadoop.hoya.servicemonitor.ProbeStatus; import org.apache.hadoop.hoya.servicemonitor.ReportingLoop; import org.apache.hadoop.hoya.tools.ConfigHelper; import org.apache.hadoop.hoya.tools.Duration; import org.apache.hadoop.hoya.tools.HoyaUtils; import org.apache.hadoop.hoya.yarn.Arguments; import org.apache.hadoop.hoya.yarn.HoyaActions; import org.apache.hadoop.hoya.yarn.appmaster.HoyaMasterServiceArgs; import org.apache.hadoop.hoya.yarn.appmaster.rpc.RpcBinder; import org.apache.hadoop.hoya.yarn.service.CompoundLaunchedService; import org.apache.hadoop.hoya.yarn.service.SecurityCheckerService; import org.apache.hadoop.io.DataOutputBuffer; import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.security.Credentials; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.token.Token; import org.apache.hadoop.yarn.api.ApplicationConstants; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ApplicationReport; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; import org.apache.hadoop.yarn.api.records.ContainerLaunchContext; import org.apache.hadoop.yarn.api.records.FinalApplicationStatus; import org.apache.hadoop.yarn.api.records.LocalResource; import org.apache.hadoop.yarn.api.records.Priority; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.YarnApplicationState; import org.apache.hadoop.yarn.client.api.YarnClientApplication; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.service.launcher.RunService; import org.apache.hadoop.yarn.service.launcher.ServiceLauncher; import org.apache.hadoop.yarn.util.Records; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.io.File; import java.io.FileWriter; import java.io.IOException; import java.io.StringWriter; import java.io.Writer; import java.net.InetSocketAddress; import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Properties; /** * Client service for Hoya */ public class HoyaClient extends CompoundLaunchedService implements RunService, ProbeReportHandler, HoyaExitCodes, HoyaKeys { private static final Logger log = LoggerFactory.getLogger(HoyaClient.class); public static final int ACCEPT_TIME = 60000; public static final String E_CLUSTER_RUNNING = "cluster already running"; public static final String E_ALREADY_EXISTS = "already exists"; public static final String PRINTF_E_ALREADY_EXISTS = "Hoya Cluster \"%s\" already exists and is defined in %s"; public static final String E_MISSING_PATH = "Missing path "; public static final String E_INCOMPLETE_CLUSTER_SPEC = "Cluster specification is marked as incomplete: "; public static final String E_UNKNOWN_CLUSTER = "Unknown cluster "; public static final String E_DESTROY_CREATE_RACE_CONDITION = "created while it was being destroyed"; private int amPriority = 0; // Queue for App master private String amQueue = "default"; private ClientArgs serviceArgs; public ApplicationId applicationId; private ReportingLoop masterReportingLoop; private Thread loopThread; private String deployedClusterName; /** * Cluster opaerations against the deployed cluster -will be null * if no bonding has yet taken place */ private HoyaClusterOperations hoyaClusterOperations; private ClientProvider provider; /** * Yarn client service */ private HoyaYarnClientImpl yarnClient; /** * Constructor */ public HoyaClient() { // make sure all the yarn configs get loaded YarnConfiguration yarnConfiguration = new YarnConfiguration(); log.debug("Hoya constructed"); } @Override // Service public String getName() { return "Hoya"; } @Override public Configuration bindArgs(Configuration config, String... args) throws Exception { config = super.bindArgs(config, args); log.debug("Binding Arguments"); serviceArgs = new ClientArgs(args); serviceArgs.parse(); serviceArgs.postProcess(); // yarn-ify YarnConfiguration yarnConfiguration = new YarnConfiguration(config); return HoyaUtils.patchConfiguration(yarnConfiguration); } @Override protected void serviceInit(Configuration conf) throws Exception { Configuration clientConf = HoyaUtils.loadHoyaClientConfigurationResource(); ConfigHelper.mergeConfigurations(conf, clientConf, HOYA_CLIENT_RESOURCE); serviceArgs.applyDefinitions(conf); serviceArgs.applyFileSystemURL(conf); // init security with our conf if (HoyaUtils.isClusterSecure(conf)) { addService(new SecurityCheckerService()); } //create the YARN client yarnClient = new HoyaYarnClientImpl(); addService(yarnClient); super.serviceInit(conf); } /** * this is where the work is done. * @return the exit code * @throws Throwable anything that went wrong */ @Override public int runService() throws Throwable { // choose the action String action = serviceArgs.action; int exitCode = EXIT_SUCCESS; String clusterName = serviceArgs.getClusterName(); // actions if (HoyaActions.ACTION_BUILD.equals(action)) { actionBuild(clusterName); exitCode = EXIT_SUCCESS; } else if (HoyaActions.ACTION_CREATE.equals(action)) { exitCode = actionCreate(clusterName); } else if (HoyaActions.ACTION_FREEZE.equals(action)) { exitCode = actionFreeze(clusterName, serviceArgs.waittime, "stopping cluster"); } else if (HoyaActions.ACTION_THAW.equals(action)) { exitCode = actionThaw(clusterName); } else if (HoyaActions.ACTION_DESTROY.equals(action)) { HoyaUtils.validateClusterName(clusterName); exitCode = actionDestroy(clusterName); } else if (HoyaActions.ACTION_EMERGENCY_FORCE_KILL.equals(action)) { exitCode = actionEmergencyForceKill(clusterName); } else if (HoyaActions.ACTION_EXISTS.equals(action)) { HoyaUtils.validateClusterName(clusterName); exitCode = actionExists(clusterName); } else if (HoyaActions.ACTION_FLEX.equals(action)) { HoyaUtils.validateClusterName(clusterName); exitCode = actionFlex(clusterName); } else if (HoyaActions.ACTION_GETCONF.equals(action)) { File outfile = null; if (serviceArgs.output != null) { outfile = new File(serviceArgs.output); } exitCode = actionGetConf(clusterName, serviceArgs.format, outfile); } else if (HoyaActions.ACTION_HELP.equals(action) || HoyaActions.ACTION_USAGE.equals(action)) { log.info("HoyaClient {}", serviceArgs.usage()); } else if (HoyaActions.ACTION_LIST.equals(action)) { if (!isUnset(clusterName)) { HoyaUtils.validateClusterName(clusterName); } exitCode = actionList(clusterName); } else if (HoyaActions.ACTION_STATUS.equals(action)) { HoyaUtils.validateClusterName(clusterName); exitCode = actionStatus(clusterName); } else { throw new HoyaException(EXIT_UNIMPLEMENTED, "Unimplemented: " + action); } return exitCode; } /** * Destroy a cluster. There's two race conditions here * #1 the cluster is started between verifying that there are no live * clusters of that name. */ public int actionDestroy(String clustername) throws YarnException, IOException { // verify that a live cluster isn't there HoyaUtils.validateClusterName(clustername); verifyFileSystemArgSet(); verifyManagerSet(); verifyNoLiveClusters(clustername); // create the directory path FileSystem fs = getClusterFS(); Path clusterDirectory = HoyaUtils.buildHoyaClusterDirPath(fs, clustername); // delete the directory; boolean exists = fs.exists(clusterDirectory); if (exists) { log.info("Cluster exists -destroying"); } else { log.info("Cluster already destroyed"); } fs.delete(clusterDirectory, true); List<ApplicationReport> instances = findAllLiveInstances(null, clustername); // detect any race leading to cluster creation during the check/destroy process // and report a problem. if (!instances.isEmpty()) { throw new HoyaException(EXIT_BAD_CLUSTER_STATE, clustername + ": " + E_DESTROY_CREATE_RACE_CONDITION + " :" + instances.get(0)); } log.info("Destroyed cluster {}", clustername); return EXIT_SUCCESS; } /** * Force kill a yarn application by ID. No niceities here */ public int actionEmergencyForceKill(String applicationId) throws YarnException, IOException { verifyManagerSet(); yarnClient.emergencyForceKill(applicationId); return EXIT_SUCCESS; } /** * Get the provider for this cluster * @param clusterSpec cluster spec * @return the provider instance * @throws HoyaException problems building the provider */ private ClientProvider createClientProvider(ClusterDescription clusterSpec) throws HoyaException { HoyaProviderFactory factory = HoyaProviderFactory.createHoyaProviderFactory(clusterSpec); return factory.createClientProvider(); } /** * Get the provider for this cluster * @param provider the name of the provider * @return the provider instance * @throws HoyaException problems building the provider */ private ClientProvider createClientProvider(String provider) throws HoyaException { HoyaProviderFactory factory = HoyaProviderFactory.createHoyaProviderFactory(provider); return factory.createClientProvider(); } /** * Create the cluster -saving the arguments to a specification file first * @param clustername cluster name * @return the status code * @throws YarnException Yarn problems * @throws IOException other problems * @throws BadCommandArgumentsException bad arguments. */ private int actionCreate(String clustername) throws YarnException, IOException { actionBuild(clustername); return startCluster(clustername); } /** * Build up the cluster specification/directory * @param clustername cluster name * @throws YarnException Yarn problems * @throws IOException other problems * @throws BadCommandArgumentsException bad arguments. */ private void actionBuild(String clustername) throws YarnException, IOException { // verify that a live cluster isn't there HoyaUtils.validateClusterName(clustername); verifyManagerSet(); verifyFileSystemArgSet(); verifyNoLiveClusters(clustername); Configuration conf = getConfig(); // build up the initial cluster specification ClusterDescription clusterSpec = new ClusterDescription(); requireArgumentSet(Arguments.ARG_ZKHOSTS, serviceArgs.zkhosts); requireArgumentSet(Arguments.ARG_VERSION, serviceArgs.version); Path appconfdir = serviceArgs.confdir; requireArgumentSet(Arguments.ARG_CONFDIR, appconfdir); // Provider requireArgumentSet(Arguments.ARG_PROVIDER, serviceArgs.provider); HoyaAMClientProvider hoyaAM = new HoyaAMClientProvider(conf); provider = createClientProvider(serviceArgs.provider); // remember this clusterSpec.type = provider.getName(); clusterSpec.name = clustername; clusterSpec.state = ClusterDescription.STATE_INCOMPLETE; long now = System.currentTimeMillis(); clusterSpec.createTime = now; clusterSpec.setInfoTime(StatusKeys.INFO_CREATE_TIME_HUMAN, StatusKeys.INFO_CREATE_TIME_MILLIS, now); // build up the options map // first the defaults provided by the provider clusterSpec.options = provider.getDefaultClusterOptions(); //propagate the filename into the 1.x and 2.x value String fsDefaultName = conf.get( CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY); clusterSpec.setOptionifUnset(OptionKeys.SITE_XML_PREFIX + CommonConfigurationKeysPublic.FS_DEFAULT_NAME_KEY, fsDefaultName); clusterSpec.setOptionifUnset(OptionKeys.SITE_XML_PREFIX + HoyaXmlConfKeys.FS_DEFAULT_NAME_CLASSIC, fsDefaultName); // patch in the properties related to the principals extracted from // the running hoya client propagatePrincipals(clusterSpec, conf); // next the options provided on the command line HoyaUtils.mergeMap(clusterSpec.options, serviceArgs.getOptionsMap()); // hbasever arg also sets an option if (isSet(serviceArgs.version)) { clusterSpec.setOption(OptionKeys.APPLICATION_VERSION, serviceArgs.version); } log.debug("Application version is {}", clusterSpec.getOption(OptionKeys.APPLICATION_VERSION, "undefined")); // build the list of supported roles List<ProviderRole> supportedRoles = new ArrayList<ProviderRole>(); // provider roles supportedRoles.addAll(provider.getRoles()); // and any extra Map<String, String> argsRoleMap = serviceArgs.getRoleMap(); Map<String, Map<String, String>> clusterRoleMap = new HashMap<String, Map<String, String>>(); // build the role map from default; set the instances for (ProviderRole role : supportedRoles) { String roleName = role.name; Map<String, String> clusterRole = provider.createDefaultClusterRole(roleName); // get the command line instance count String instanceCount = argsRoleMap.get(roleName); // this is here in case we want to extract from the provider // the min #of instances int defInstances = HoyaUtils.getIntValue(clusterRole, RoleKeys.ROLE_INSTANCES, 0, 0, -1); instanceCount = Integer.toString(HoyaUtils.parseAndValidate( "count of role " + roleName, instanceCount, defInstances, 0, -1)); clusterRole.put(RoleKeys.ROLE_INSTANCES, instanceCount); clusterRoleMap.put(roleName, clusterRole); } //AM roles are special // add in the Hoya AM role(s) Collection<ProviderRole> amRoles = hoyaAM.getRoles(); for (ProviderRole role : amRoles) { String roleName = role.name; Map<String, String> clusterRole = hoyaAM.createDefaultClusterRole(roleName); // get the command line instance count clusterRoleMap.put(roleName, clusterRole); } //finally, any roles that came in the list but aren't in the map // and overwrite any entries the role option map with command line overrides Map<String, Map<String, String>> commandOptions = serviceArgs.getRoleOptionMap(); HoyaUtils.applyCommandLineOptsToRoleMap(clusterRoleMap, commandOptions); clusterSpec.roles = clusterRoleMap; // App home or image if (serviceArgs.image != null) { if (!isUnset(serviceArgs.appHomeDir)) { // both args have been set throw new BadCommandArgumentsException("only one of " + Arguments.ARG_IMAGE + " and " + Arguments.ARG_APP_HOME + " can be provided"); } clusterSpec.setImagePath(serviceArgs.image.toUri().toString()); } else { // the alternative is app home, which now MUST be set if (isUnset(serviceArgs.appHomeDir)) { // both args have been set throw new BadCommandArgumentsException("Either " + Arguments.ARG_IMAGE + " or " + Arguments.ARG_APP_HOME + " must be provided"); } clusterSpec.setApplicationHome(serviceArgs.appHomeDir); } // set up the ZK binding String zookeeperRoot = serviceArgs.appZKPath; if (isUnset(serviceArgs.appZKPath)) { zookeeperRoot = "/yarnapps_" + getAppName() + "_" + getUsername() + "_" + clustername; } clusterSpec.setZkPath(zookeeperRoot); clusterSpec.setZkPort(serviceArgs.zkport); clusterSpec.setZkHosts(serviceArgs.zkhosts); // another sanity check before the cluster dir is created: the config // dir FileSystem srcFS = FileSystem.get(appconfdir.toUri(), conf); if (!srcFS.exists(appconfdir)) { throw new BadCommandArgumentsException( "Configuration directory specified in %s not found: %s", Arguments.ARG_CONFDIR, appconfdir.toString()); } // build up the paths in the DFS FileSystem fs = getClusterFS(); Path clusterDirectory = HoyaUtils.createHoyaClusterDirPath(fs, clustername); Path origConfPath = new Path(clusterDirectory, HoyaKeys.ORIG_CONF_DIR_NAME); Path generatedConfPath = new Path(clusterDirectory, HoyaKeys.GENERATED_CONF_DIR_NAME); Path clusterSpecPath = new Path(clusterDirectory, HoyaKeys.CLUSTER_SPECIFICATION_FILE); clusterSpec.originConfigurationPath = origConfPath.toUri().toASCIIString(); clusterSpec.generatedConfigurationPath = generatedConfPath.toUri().toASCIIString(); // save the specification to get a lock on this cluster name try { clusterSpec.save(fs, clusterSpecPath, false); } catch (FileAlreadyExistsException fae) { throw new HoyaException(EXIT_BAD_CLUSTER_STATE, PRINTF_E_ALREADY_EXISTS, clustername, clusterSpecPath); } catch (IOException e) { // this is probably a file exists exception too, but include it in the trace just in case throw new HoyaException(EXIT_BAD_CLUSTER_STATE, e, PRINTF_E_ALREADY_EXISTS, clustername, clusterSpecPath); } // bulk copy // first the original from wherever to the DFS HoyaUtils.copyDirectory(conf, appconfdir, origConfPath); // then build up the generated path. This d HoyaUtils.copyDirectory(conf, origConfPath, generatedConfPath); // Data Directory Path datapath = new Path(clusterDirectory, HoyaKeys.DATA_DIR_NAME); // create the data dir fs.mkdirs(datapath); log.debug("datapath={}", datapath); clusterSpec.dataPath = datapath.toUri().toString(); // final specification review provider.reviewAndUpdateClusterSpec(clusterSpec); // here the configuration is set up. Mark it clusterSpec.state = ClusterDescription.STATE_CREATED; clusterSpec.save(fs, clusterSpecPath, true); } public void verifyFileSystemArgSet() throws BadCommandArgumentsException { requireArgumentSet(Arguments.ARG_FILESYSTEM, serviceArgs.filesystemURL); } public void verifyManagerSet() throws BadCommandArgumentsException { InetSocketAddress rmAddr = HoyaUtils.getRmAddress(getConfig()); if (!HoyaUtils.isAddressDefined(rmAddr)) { throw new BadCommandArgumentsException( "No valid Resource Manager address provided in the argument " + Arguments.ARG_MANAGER + " or the configuration property " + YarnConfiguration.RM_ADDRESS + " value :" + rmAddr); } } /** * Create a cluster to the specification * @param clusterSpec cluster specification * @return the exit code from the operation */ public int executeClusterStart(Path clusterDirectory, ClusterDescription clusterSpec) throws YarnException, IOException { // verify that a live cluster isn't there; String clustername = clusterSpec.name; deployedClusterName = clustername; HoyaUtils.validateClusterName(clustername); verifyNoLiveClusters(clustername); Configuration config = getConfig(); boolean clusterSecure = HoyaUtils.isClusterSecure(config); //create the Hoya AM provider -this helps set up the AM HoyaAMClientProvider hoyaAM = new HoyaAMClientProvider(config); // cluster Provider ClientProvider provider = createClientProvider(clusterSpec); // make sure the conf dir is valid; Path generatedConfDirPath = createPathThatMustExist(clusterSpec.generatedConfigurationPath); Path origConfPath = createPathThatMustExist(clusterSpec.originConfigurationPath); // now build up the image path // TODO: consider supporting apps that don't have an image path Path imagePath; String csip = clusterSpec.getImagePath(); if (!isUnset(csip)) { imagePath = createPathThatMustExist(csip); } else { imagePath = null; if (isUnset(clusterSpec.getApplicationHome())) { throw new HoyaException(EXIT_BAD_CLUSTER_STATE, "Neither an image path nor binary home dir were specified"); } } // final specification review hoyaAM.validateClusterSpec(clusterSpec); provider.validateClusterSpec(clusterSpec); // do a quick dump of the values first if (log.isDebugEnabled()) { log.debug(clusterSpec.toString()); } YarnClientApplication application = yarnClient.createApplication(); ApplicationSubmissionContext appContext = application.getApplicationSubmissionContext(); ApplicationId appId = appContext.getApplicationId(); // set the application name; appContext.setApplicationName(clustername); // app type used in service enum; appContext.setApplicationType(HoyaKeys.APP_TYPE); if (clusterSpec.getOptionBool(OptionKeys.HOYA_TEST_FLAG, false)) { // test flag set appContext.setMaxAppAttempts(1); } FileSystem fs = getClusterFS(); Path tempPath = HoyaUtils.createHoyaAppInstanceTempPath(fs, clustername, appId.toString()); String libdir = "lib"; Path libPath = new Path(tempPath, libdir); fs.mkdirs(libPath); log.debug("FS={}, tempPath={}, libdir={}", fs, tempPath, libPath); // Set up the container launch context for the application master ContainerLaunchContext amContainer = Records.newRecord(ContainerLaunchContext.class); // set local resources for the application master // local files or archives as needed // In this scenario, the jar file for the application master is part of the local resources Map<String, LocalResource> localResources = new HashMap<String, LocalResource>(); // conf directory setup Path remoteHoyaConfPath = null; String relativeHoyaConfDir = null; String hoyaConfdirProp = System.getProperty(HoyaKeys.PROPERTY_HOYA_CONF_DIR); if (hoyaConfdirProp == null || hoyaConfdirProp.isEmpty()) { log.debug("No local configuration directory provided as system property"); } else { File hoyaConfDir = new File(hoyaConfdirProp); if (!hoyaConfDir.exists()) { throw new BadConfigException("Conf dir \"%s\" not found", hoyaConfDir); } Path localConfDirPath = HoyaUtils.createLocalPath(hoyaConfDir); log.debug("Copying Hoya AM configuration data from {}", localConfDirPath); remoteHoyaConfPath = new Path(clusterDirectory, HoyaKeys.SUBMITTED_HOYA_CONF_DIR); HoyaUtils.copyDirectory(config, localConfDirPath, remoteHoyaConfPath); } // the assumption here is that minimr cluster => this is a test run // and the classpath can look after itself if (!getUsingMiniMRCluster()) { log.debug("Destination is not a MiniYARNCluster -copying full classpath"); // insert conf dir first if (remoteHoyaConfPath != null) { relativeHoyaConfDir = HoyaKeys.SUBMITTED_HOYA_CONF_DIR; Map<String, LocalResource> submittedConfDir = HoyaUtils.submitDirectory(fs, remoteHoyaConfPath, relativeHoyaConfDir); HoyaUtils.mergeMaps(localResources, submittedConfDir); } log.info("Copying JARs from local filesystem"); // Copy the application master jar to the filesystem // Create a local resource to point to the destination jar path HoyaUtils.putJar(localResources, fs, this.getClass(), tempPath, libdir, HOYA_JAR); } // build up the configuration // IMPORTANT: it is only after this call that site configurations // will be valid. propagatePrincipals(clusterSpec, config); Configuration clientConfExtras = new Configuration(false); // add AM and provider specific artifacts to the resource map Map<String, LocalResource> providerResources; // standard AM resources providerResources = hoyaAM.prepareAMAndConfigForLaunch(fs, config, clusterSpec, origConfPath, generatedConfDirPath, clientConfExtras, libdir, tempPath); localResources.putAll(providerResources); //add provider-specific resources providerResources = provider.prepareAMAndConfigForLaunch(fs, config, clusterSpec, origConfPath, generatedConfDirPath, clientConfExtras, libdir, tempPath); localResources.putAll(providerResources); // now that the site config is fully generated, the provider gets // to do a quick review of them. log.debug("Preflight validation of cluster configuration"); provider.preflightValidateClusterConfiguration(clusterSpec, fs, generatedConfDirPath, clusterSecure); // now add the image if it was set if (HoyaUtils.maybeAddImagePath(fs, localResources, imagePath)) { log.debug("Registered image path {}", imagePath); } if (log.isDebugEnabled()) { for (String key : localResources.keySet()) { LocalResource val = localResources.get(key); log.debug("{}={}", key, HoyaUtils.stringify(val.getResource())); } } // Set the log4j properties if needed /* if (!log4jPropFile.isEmpty()) { Path log4jSrc = new Path(log4jPropFile); Path log4jDst = new Path(fs.getHomeDirectory(), "log4j.props"); fs.copyFromLocalFile(false, true, log4jSrc, log4jDst); FileStatus log4jFileStatus = fs.getFileStatus(log4jDst); LocalResource log4jRsrc = Records.newRecord(LocalResource.class); log4jRsrc.setType(LocalResourceType.FILE); log4jRsrc.setVisibility(LocalResourceVisibility.APPLICATION); log4jRsrc.setResource(ConverterUtils.getYarnUrlFromURI(log4jDst.toUri())); log4jRsrc.setTimestamp(log4jFileStatus.getModificationTime()); log4jRsrc.setSize(log4jFileStatus.getLen()); localResources.put("log4j.properties", log4jRsrc); } */ // Set local resource info into app master container launch context amContainer.setLocalResources(localResources); // build the environment Map<String, String> env = HoyaUtils.buildEnvMap(clusterSpec.getOrAddRole(HoyaKeys.ROLE_HOYA_AM)); String classpath = HoyaUtils.buildClasspath(relativeHoyaConfDir, libdir, getConfig(), getUsingMiniMRCluster()); env.put("CLASSPATH", classpath); if (log.isDebugEnabled()) { log.debug("AM classpath={}", classpath); log.debug("Environment Map:\n{}", HoyaUtils.stringifyMap(env)); log.debug("Files in lib path\n{}", HoyaUtils.listFSDir(fs, libPath)); } amContainer.setEnvironment(env); String rmAddr = serviceArgs.rmAddress; // spec out the RM address if (isUnset(rmAddr) && HoyaUtils.isRmSchedulerAddressDefined(config)) { rmAddr = NetUtils.getHostPortString(HoyaUtils.getRmSchedulerAddress(config)); } // build up the args list, intially as anyting List<String> commands = new ArrayList<String>(20); commands.add(ApplicationConstants.Environment.JAVA_HOME.$() + "/bin/java"); // insert any JVM options); commands.add(HoyaKeys.JVM_FORCE_IPV4); commands.add(HoyaKeys.JVM_JAVA_HEADLESS); // enable asserts if the text option is set if (serviceArgs.debug) { commands.add(HoyaKeys.JVM_ENABLE_ASSERTIONS); commands.add(HoyaKeys.JVM_ENABLE_SYSTEM_ASSERTIONS); } commands.add(String.format(HoyaKeys.FORMAT_D_CLUSTER_NAME, clustername)); commands.add(String.format(HoyaKeys.FORMAT_D_CLUSTER_TYPE, provider.getName())); // add the generic sevice entry point commands.add(ServiceLauncher.ENTRY_POINT); // immeiately followed by the classname commands.add(HoyaMasterServiceArgs.CLASSNAME); // now the app specific args if (serviceArgs.debug) { commands.add(Arguments.ARG_DEBUG); } commands.add(HoyaActions.ACTION_CREATE); commands.add(clustername); // set the cluster directory path commands.add(Arguments.ARG_HOYA_CLUSTER_URI); commands.add(clusterDirectory.toUri().toString()); if (!isUnset(rmAddr)) { commands.add(Arguments.ARG_RM_ADDR); commands.add(rmAddr); } if (serviceArgs.filesystemURL != null) { commands.add(Arguments.ARG_FILESYSTEM); commands.add(serviceArgs.filesystemURL.toString()); } if (clusterSecure) { // if the cluster is secure, make sure that // the relevant security settings go over propagateConfOption(commands, config, HoyaXmlConfKeys.KEY_HOYA_SECURITY_ENABLED); propagateConfOption(commands, config, DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY); Credentials credentials = new Credentials(); String tokenRenewer = config.get(YarnConfiguration.RM_PRINCIPAL); if (isUnset(tokenRenewer)) { throw new BadConfigException( "Can't get Master Kerberos principal %s for the RM to use as renewer", YarnConfiguration.RM_PRINCIPAL ); } // For now, only getting tokens for the default file-system. final Token<?>[] tokens = fs.addDelegationTokens(tokenRenewer, credentials); if (tokens != null) { for (Token<?> token : tokens) { log.debug("Got delegation token for {}; {}", fs.getUri(), token); } } DataOutputBuffer dob = new DataOutputBuffer(); credentials.writeTokenStorageToStream(dob); ByteBuffer fsTokens = ByteBuffer.wrap(dob.getData(), 0, dob.getLength()); amContainer.setTokens(fsTokens); } // write out the path output commands.add("1>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/out.txt"); commands.add("2>" + ApplicationConstants.LOG_DIR_EXPANSION_VAR + "/err.txt"); String cmdStr = HoyaUtils.join(commands, " "); log.info("Completed setting up app master command {}", cmdStr); amContainer.setCommands(commands); // Set up resource type requirements Resource capability = Records.newRecord(Resource.class); // Amt. of memory resource to request for to run the App Master capability.setMemory(RoleKeys.DEFAULT_AM_MEMORY); capability.setVirtualCores(RoleKeys.DEFAULT_AM_V_CORES); // the Hoya AM gets to configure the AM requirements, not the custom provider hoyaAM.prepareAMResourceRequirements(clusterSpec, capability); appContext.setResource(capability); Map<String, ByteBuffer> serviceData = new HashMap<String, ByteBuffer>(); // Service data is a binary blob that can be passed to the application // Not needed in this scenario provider.prepareAMServiceData(clusterSpec, serviceData); amContainer.setServiceData(serviceData); // The following are not required for launching an application master // amContainer.setContainerId(containerId); appContext.setAMContainerSpec(amContainer); // Set the priority for the application master Priority pri = Records.newRecord(Priority.class); // TODO - what is the range for priority? how to decide? pri.setPriority(amPriority); appContext.setPriority(pri); // Set the queue to which this application is to be submitted in the RM appContext.setQueue(amQueue); // Submit the application to the applications manager // SubmitApplicationResponse submitResp = applicationsManager.submitApplication(appRequest); // Ignore the response as either a valid response object is returned on success // or an exception thrown to denote some form of a failure log.info("Submitting application to ASM"); // submit the application applicationId = yarnClient.submitApplication(appContext); int exitCode; // wait for the submit state to be reached ApplicationReport report = monitorAppToState(new Duration(ACCEPT_TIME), YarnApplicationState.ACCEPTED); // build the probes int timeout = 60000; List<Probe> probes = provider.createProbes(report.getTrackingUrl(), config, timeout); // start ReportingLoop only when there're probes if (!probes.isEmpty()) { masterReportingLoop = new ReportingLoop("MasterStatusCheck", this, probes, null, 1000, 1000, timeout, -1); if (!masterReportingLoop.startReporting()) { throw new HoyaException(EXIT_INTERNAL_ERROR, "failed to start monitoring"); } loopThread = new Thread(masterReportingLoop, "MasterStatusCheck"); loopThread.setDaemon(true); loopThread.start(); } // may have failed, so check that if (HoyaUtils.hasAppFinished(report)) { exitCode = buildExitCode(appId, report); } else { // exit unless there is a wait exitCode = EXIT_SUCCESS; if (serviceArgs.waittime != 0) { // waiting for state to change Duration duration = new Duration(serviceArgs.waittime * 1000); duration.start(); report = monitorAppToState(duration, YarnApplicationState.RUNNING); if (report != null && report.getYarnApplicationState() == YarnApplicationState.RUNNING) { exitCode = EXIT_SUCCESS; } else { yarnClient.killRunningApplication(appId, ""); exitCode = buildExitCode(appId, report); } } } return exitCode; } /* * Methods for ProbeReportHandler */ @Override public void probeProcessStateChange(ProbePhase probePhase) { } @Override public void probeResult(ProbePhase phase, ProbeStatus status) { if (!status.isSuccess()) { try { /* TODO: need to decide the best response to probe error killApplication(applicationId); log.error("killing " + applicationId, status.getThrown()); */ } catch (Exception e) { log.warn("error killing " + applicationId, e); } } } @Override public void probeFailure(ProbeFailedException exception) { } @Override public void probeBooted(ProbeStatus status) { } @Override public boolean commence(String name, String description) { return true; } @Override public void unregister() { } @Override public void probeTimedOut(ProbePhase currentPhase, Probe probe, ProbeStatus lastStatus, long currentTime) { } @Override public void liveProbeCycleCompleted() { } @Override public void heartbeat(ProbeStatus status) { } /** * Propagate any critical principals from the current site config down to the HBase one. * @param clusterSpec cluster spec * @param config config to read from */ private void propagatePrincipals(ClusterDescription clusterSpec, Configuration config) { String dfsPrincipal = config.get(DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY); if (dfsPrincipal != null) { String siteDfsPrincipal = OptionKeys.SITE_XML_PREFIX + DFSConfigKeys.DFS_NAMENODE_USER_NAME_KEY; clusterSpec.setOptionifUnset(siteDfsPrincipal, dfsPrincipal); } } private void propagateConfOption(List<String> command, Configuration conf, String key) { String val = conf.get(key); if (val != null) { command.add(Arguments.ARG_DEFINE); command.add(key + "=" + val); } } /** * Create a path that must exist in the cluster fs * @param uri uri to create * @return the path * @throws HoyaException if the path does not exist */ public Path createPathThatMustExist(String uri) throws HoyaException, IOException { Path path = new Path(uri); verifyPathExists(path); return path; } public void verifyPathExists(Path path) throws HoyaException, IOException { if (!getClusterFS().exists(path)) { throw new HoyaException(EXIT_BAD_CLUSTER_STATE, E_MISSING_PATH + path); } } /** * verify that a live cluster isn't there * @param clustername cluster name * @throws HoyaException with exit code EXIT_BAD_CLUSTER_STATE if a cluster of that name is either * live or starting up. */ public void verifyNoLiveClusters(String clustername) throws IOException, YarnException { List<ApplicationReport> existing = findAllLiveInstances(null, clustername); if (!existing.isEmpty()) { throw new HoyaException(EXIT_BAD_CLUSTER_STATE, clustername + ": " + E_CLUSTER_RUNNING + " :" + existing.get(0)); } } public String getUsername() throws IOException { return UserGroupInformation.getCurrentUser().getShortUserName(); } /** * Get the name of any deployed cluster * @return the cluster name */ public String getDeployedClusterName() { return deployedClusterName; } /** * Get the filesystem of this cluster * @return the FS of the config */ private FileSystem getClusterFS() throws IOException { return FileSystem.get(serviceArgs.filesystemURL, getConfig()); } /** * ask if the client is using a mini MR cluster * @return */ private boolean getUsingMiniMRCluster() { return getConfig().getBoolean(YarnConfiguration.IS_MINI_YARN_CLUSTER, false); } /** * Get the application name used in the zookeeper root paths * @return an application-specific path in ZK */ private String getAppName() { return "hoya"; } /** * Wait for the app to start running (or go past that state) * @param duration time to wait * @return the app report; null if the duration turned out * @throws YarnException YARN or app issues * @throws IOException IO problems */ @VisibleForTesting public ApplicationReport monitorAppToRunning(Duration duration) throws YarnException, IOException { return monitorAppToState(duration, YarnApplicationState.RUNNING); } /** * Build an exit code for an application Id and its report. * If the report parameter is null, the app is killed * @param appId app * @param report report * @return the exit code */ private int buildExitCode(ApplicationId appId, ApplicationReport report) throws IOException, YarnException { if (null == report) { forceKillApplication("Reached client specified timeout for application"); return EXIT_TIMED_OUT; } YarnApplicationState state = report.getYarnApplicationState(); FinalApplicationStatus dsStatus = report.getFinalApplicationStatus(); switch (state) { case FINISHED: if (FinalApplicationStatus.SUCCEEDED == dsStatus) { log.info("Application has completed successfully"); return EXIT_SUCCESS; } else { log.info("Application finished unsuccessfully." + "YarnState = {}, DSFinalStatus = {} Breaking monitoring loop", state, dsStatus); return EXIT_YARN_SERVICE_FINISHED_WITH_ERROR; } case KILLED: log.info("Application did not finish. YarnState={}, DSFinalStatus={}", state, dsStatus); return EXIT_YARN_SERVICE_KILLED; case FAILED: log.info("Application Failed. YarnState={}, DSFinalStatus={}", state, dsStatus); return EXIT_YARN_SERVICE_FAILED; default: //not in any of these states return EXIT_SUCCESS; } } /** * Monitor the submitted application for reaching the requested state. * Will also report if the app reaches a later state (failed, killed, etc) * Kill application if duration!= null & time expires. * @param appId Application Id of application to be monitored * @param duration how long to wait -must be more than 0 * @param desiredState desired state. * @return the application report -null on a timeout * @throws YarnException * @throws IOException */ @VisibleForTesting public ApplicationReport monitorAppToState( Duration duration, YarnApplicationState desiredState) throws YarnException, IOException { return monitorAppToState(applicationId, desiredState, duration); } /** * Get the report of a this application * @return the app report or null if it could not be found. * @throws IOException * @throws YarnException */ public ApplicationReport getApplicationReport() throws IOException, YarnException { return yarnClient.getApplicationReport(applicationId); } /** * Monitor the submitted application for reaching the requested state. * Will also report if the app reaches a later state (failed, killed, etc) * Kill application if duration!= null & time expires. * @param appId Application Id of application to be monitored * @param duration how long to wait -must be more than 0 * @param desiredState desired state. * @return the application report -null on a timeout * @throws YarnException * @throws IOException */ @VisibleForTesting public ApplicationReport monitorAppToState( ApplicationId appId, YarnApplicationState desiredState, Duration duration) throws YarnException, IOException { return yarnClient.monitorAppToState(appId, desiredState, duration); } /** * Kill the submitted application by sending a call to the ASM * @throws YarnException * @throws IOException */ public boolean forceKillApplication(String reason) throws YarnException, IOException { if (applicationId != null) { yarnClient.killRunningApplication(applicationId, reason); return true; } return false; } /** * List Hoya instances belonging to a specific user * @param user user: "" means all users * @return a possibly empty list of Hoya AMs */ @VisibleForTesting public List<ApplicationReport> listHoyaInstances(String user) throws YarnException, IOException { return yarnClient.listHoyaInstances(user); } /** * Implement the list action: list all nodes * @return exit code of 0 if a list was created */ @VisibleForTesting public int actionList(String clustername) throws IOException, YarnException { verifyManagerSet(); String user = serviceArgs.user; List<ApplicationReport> instances = listHoyaInstances(user); if (clustername == null || clustername.isEmpty()) { log.info("Hoya instances for {}:{}", (user != null ? user : "all users"), instances.size()); for (ApplicationReport report : instances) { logAppReport(report); } return EXIT_SUCCESS; } else { HoyaUtils.validateClusterName(clustername); log.debug("Listing cluster named {}", clustername); ApplicationReport report = findClusterInInstanceList(instances, clustername); if (report != null) { logAppReport(report); return EXIT_SUCCESS; } else { throw unknownClusterException(clustername); } } } /** * Log the application report at INFO * @param report */ public void logAppReport(ApplicationReport report) { log.info(HoyaUtils.appReportToString(report, "\n")); } /** * Implement the islive action: probe for a cluster of the given name existing * @return exit code */ @VisibleForTesting public int actionFlex(String name) throws YarnException, IOException { verifyManagerSet(); log.debug("actionFlex({})", name); Map<String, Integer> roleInstances = new HashMap<String, Integer>(); Map<String, String> roleMap = serviceArgs.getRoleMap(); for (Map.Entry<String, String> roleEntry : roleMap.entrySet()) { String key = roleEntry.getKey(); String val = roleEntry.getValue(); try { roleInstances.put(key, Integer.valueOf(val)); } catch (NumberFormatException e) { throw new BadCommandArgumentsException("Requested count of role %s" + " is not a number: \"%s\"", key, val); } } return flex(name, roleInstances, serviceArgs.persist); } /** * Implement the islive action: probe for a cluster of the given name existing * @return exit code */ @VisibleForTesting public int actionExists(String name) throws YarnException, IOException { verifyManagerSet(); log.debug("actionExists({})", name); ApplicationReport instance = findInstance(getUsername(), name); if (instance == null) { log.info("cluster {} not found"); throw unknownClusterException(name); } else { // the app exists, but it may be in a terminated state HoyaUtils.OnDemandReportStringifier report = new HoyaUtils.OnDemandReportStringifier(instance); YarnApplicationState state = instance.getYarnApplicationState(); if (state.ordinal() >= YarnApplicationState.FINISHED.ordinal()) { log.info("Cluster {} found but is in state {}", state); log.debug("State {}", report); throw unknownClusterException(name); } log.info("Cluster {} is running:\n{}", name, report); } return EXIT_SUCCESS; } @VisibleForTesting public ApplicationReport findInstance(String user, String appname) throws IOException, YarnException { List<ApplicationReport> instances = listHoyaInstances(user); return findClusterInInstanceList(instances, appname); } /** * find all live instances of a specific app -if there is >1 in the cluster, * this returns them all. State should be running or less * @param user user * @param appname application name * @return the list of all matching application instances */ @VisibleForTesting public List<ApplicationReport> findAllLiveInstances(String user, String appname) throws YarnException, IOException { return yarnClient.findAllLiveInstances(user, appname); } public ApplicationReport findClusterInInstanceList(List<ApplicationReport> instances, String appname) { return yarnClient.findClusterInInstanceList(instances, appname); } /** * Connect to a Hoya AM * @param app application report providing the details on the application * @return an instance * @throws YarnException * @throws IOException */ private HoyaClusterProtocol connect(ApplicationReport app) throws YarnException, IOException { try { return RpcBinder.getProxy(getConfig(), yarnClient.getRmClient(), app, 10000, 15000); } catch (InterruptedException e) { throw new HoyaException(HoyaExitCodes.EXIT_TIMED_OUT, e, "Interrupted waiting for communications with the HoyaAM"); } } /** * Status operation * @param clustername cluster name * @return 0 -for success, else an exception is thrown * @throws YarnException * @throws IOException */ @VisibleForTesting public int actionStatus(String clustername) throws YarnException, IOException { verifyManagerSet(); HoyaUtils.validateClusterName(clustername); ClusterDescription status = getClusterDescription(clustername); log.info(status.toJsonString()); return EXIT_SUCCESS; } /** * Stop the cluster * @param clustername cluster name * @param text * @return the cluster name */ public int actionFreeze(String clustername, int waittime, String text) throws YarnException, IOException { verifyManagerSet(); HoyaUtils.validateClusterName(clustername); log.debug("actionFreeze({}, {})", clustername, waittime); ApplicationReport app = findInstance(getUsername(), clustername); if (app == null) { // exit early log.info("Cluster {} not running", clustername); // not an error to freeze a frozen cluster return EXIT_SUCCESS; } log.debug("App to freeze was found: {}:\n{}", clustername, new HoyaUtils.OnDemandReportStringifier(app)); if (app.getYarnApplicationState().ordinal() >= YarnApplicationState.FINISHED.ordinal()) { log.info("Cluster {} is a terminated state {}", clustername, app.getYarnApplicationState()); return EXIT_SUCCESS; } if (log.isDebugEnabled()) { ClusterDescription clusterSpec = getClusterDescription(clustername); log.debug(clusterSpec.toString()); } HoyaClusterProtocol appMaster = connect(app); Messages.StopClusterRequestProto r = Messages.StopClusterRequestProto.newBuilder().setMessage(text).build(); appMaster.stopCluster(r); if (masterReportingLoop != null) { masterReportingLoop.close(); masterReportingLoop = null; } log.debug("Cluster stop command issued"); if (waittime > 0) { monitorAppToState(app.getApplicationId(), YarnApplicationState.FINISHED, new Duration(waittime * 1000)); } return EXIT_SUCCESS; } /* * Creates a site conf with entries from clientProperties of ClusterStatus * @param desc ClusterDescription, can be null * @param clustername, can be null * @return site conf */ public Configuration getSiteConf(ClusterDescription desc, String clustername) throws YarnException, IOException { if (desc == null) { desc = getClusterDescription(); } if (clustername == null) { clustername = getDeployedClusterName(); } String description = "Hoya cluster " + clustername; Configuration siteConf = new Configuration(false); for (String key : desc.clientProperties.keySet()) { siteConf.set(key, desc.clientProperties.get(key), description); } return siteConf; } /** * get the cluster configuration * @param clustername cluster name * @return the cluster name */ @SuppressWarnings("UseOfSystemOutOrSystemErr") public int actionGetConf(String clustername, String format, File outputfile) throws YarnException, IOException { verifyManagerSet(); HoyaUtils.validateClusterName(clustername); ClusterDescription status = getClusterDescription(clustername); Writer writer; boolean toPrint; if (outputfile != null) { writer = new FileWriter(outputfile); toPrint = false; } else { writer = new StringWriter(); toPrint = true; } try { String description = "Hoya cluster " + clustername; if (format.equals(ClientArgs.FORMAT_XML)) { Configuration siteConf = getSiteConf(status, clustername); siteConf.writeXml(writer); } else if (format.equals(ClientArgs.FORMAT_PROPERTIES)) { Properties props = new Properties(); props.putAll(status.clientProperties); props.store(writer, description); } else { throw new BadCommandArgumentsException("Unknown format: " + format); } } finally { // data is written. // close the file writer.close(); } // then, if this is not a file write, print it if (toPrint) { // not logged System.out.println(writer.toString()); } return EXIT_SUCCESS; } /** * Restore a cluster */ public int actionThaw(String clustername) throws YarnException, IOException { HoyaUtils.validateClusterName(clustername); // see if it is actually running and bail out; verifyManagerSet(); verifyNoLiveClusters(clustername); // load spec verifyFileSystemArgSet(); return startCluster(clustername); } /** * Load and start a cluster specification. * This assumes that all validation of args and cluster state * have already taken place * @param clustername name of the cluster. * @return the exit code * @throws YarnException * @throws IOException */ private int startCluster(String clustername) throws YarnException, IOException { Path clusterSpecPath = locateClusterSpecification(clustername); ClusterDescription clusterSpec = HoyaUtils.loadAndValidateClusterSpec(getClusterFS(), clusterSpecPath); Path clusterDirectory = HoyaUtils.buildHoyaClusterDirPath(getClusterFS(), clustername); return executeClusterStart(clusterDirectory, clusterSpec); } /** * get the path of a cluster * @param clustername * @return the path to the cluster specification * @throws HoyaException if the specification is not there */ public Path locateClusterSpecification(String clustername) throws YarnException, IOException { FileSystem fs = getClusterFS(); return HoyaUtils.locateClusterSpecification(fs, clustername); } /** * Implement flexing * @param clustername name of the cluster * @param workers number of workers * @param masters number of masters * @return EXIT_SUCCESS if the #of nodes in a live cluster changed */ public int flex(String clustername, Map<String, Integer> roleInstances, boolean persist) throws YarnException, IOException { verifyManagerSet(); HoyaUtils.validateClusterName(clustername); Path clusterSpecPath = locateClusterSpecification(clustername); FileSystem fs = getClusterFS(); ClusterDescription clusterSpec = HoyaUtils.loadAndValidateClusterSpec(fs, clusterSpecPath); for (Map.Entry<String, Integer> entry : roleInstances.entrySet()) { String role = entry.getKey(); int count = entry.getValue(); if (count < 0) { throw new BadCommandArgumentsException("Requested number of " + role + " instances is out of range"); } clusterSpec.setDesiredInstanceCount(role, count); log.debug("Flexed cluster specification ( {} -> {}) : \n{}", role, count, clusterSpec); } if (persist) { Path clusterDirectory = HoyaUtils.buildHoyaClusterDirPath(getClusterFS(), clustername); log.debug("Saving the cluster specification to {}", clusterSpecPath); // save the specification if (!HoyaUtils.updateClusterSpecification(getClusterFS(), clusterDirectory, clusterSpecPath, clusterSpec)) { log.warn("Failed to save new cluster size to {}", clusterSpecPath); } else { log.debug("New cluster size: persisted"); } } int exitCode = EXIT_FALSE; // now see if it is actually running and bail out if not verifyManagerSet(); ApplicationReport instance = findInstance(getUsername(), clustername); if (instance != null) { log.info("Flexing running cluster"); HoyaClusterProtocol appMaster = connect(instance); HoyaClusterOperations clusterOps = new HoyaClusterOperations(appMaster); if (clusterOps.flex(clusterSpec)) { log.info("Cluster size updated"); exitCode = EXIT_SUCCESS; } else { log.info("Requested cluster size is the same as current size: no change"); } } else { log.info("No running cluster to update"); } return exitCode; } /** * Connect to a live cluster and get its current state * @param clustername the cluster name * @return its description */ @VisibleForTesting public ClusterDescription getClusterDescription(String clustername) throws YarnException, IOException { return createClusterOperations(clustername) .getClusterDescription(clustername); } /** * Connect to the cluster and get its current state * @return its description */ @VisibleForTesting public ClusterDescription getClusterDescription() throws YarnException, IOException { return getClusterDescription(getDeployedClusterName()); } /** * List all node UUIDs in a role * @param role role name or "" for all * @return an array of UUID strings * @throws IOException * @throws YarnException */ @VisibleForTesting public String[] listNodeUUIDsByRole(String role) throws IOException, YarnException { return createClusterOperations() .listNodeUUIDsByRole(role); } /** * List all nodes in a role. This is a double round trip: once to list * the nodes in a role, another to get their details * @param role * @return an array of ContainerNode instances * @throws IOException * @throws YarnException */ @VisibleForTesting public List<ClusterNode> listClusterNodesInRole(String role) throws IOException, YarnException { return createClusterOperations().listClusterNodesInRole(role); } /** * Get the details on a list of uuids * @param uuids * @return a possibly empty list of node details * @throws IOException * @throws YarnException */ @VisibleForTesting public List<ClusterNode> listClusterNodes(String[] uuids) throws IOException, YarnException { if (uuids.length == 0) { // short cut on an empty list return new LinkedList<ClusterNode>(); } return createClusterOperations().listClusterNodes(uuids); } /** * Get a node from the AM * @param uuid uuid of node * @return deserialized node * @throws IOException IO problems * @throws NoSuchNodeException if the node isn't found */ @VisibleForTesting public ClusterNode getNode(String uuid) throws IOException, YarnException { return createClusterOperations().getNode(uuid); } /** * Bond to a running cluster * @param clustername cluster name * @return the AM RPC client * @throws HoyaException if the cluster is unkown */ private HoyaClusterProtocol bondToCluster(String clustername) throws YarnException, IOException { verifyManagerSet(); if (clustername == null) { throw unknownClusterException(""); } ApplicationReport instance = findInstance(getUsername(), clustername); if (null == instance) { throw unknownClusterException(clustername); } return connect(instance); } /** * Create a cluster operations instance against a given cluster * @param clustername cluster name * @return a bonded cluster operations instance * @throws YarnException YARN issues * @throws IOException IO problems */ private HoyaClusterOperations createClusterOperations(String clustername) throws YarnException, IOException { HoyaClusterProtocol hoyaAM = bondToCluster(clustername); return new HoyaClusterOperations(hoyaAM); } /** * Create a cluster operations instance against the active cluster * -returning any previous created one if held. * @return a bonded cluster operations instance * @throws YarnException YARN issues * @throws IOException IO problems */ public HoyaClusterOperations createClusterOperations() throws YarnException, IOException { if (hoyaClusterOperations == null) { hoyaClusterOperations = createClusterOperations(getDeployedClusterName()); } return hoyaClusterOperations; } /** * Wait for an instance of a named role to be live (or past it in the lifecycle) * @param role role to look for * @param timeout time to wait * @return the state. If still in CREATED, the cluster didn't come up * in the time period. If LIVE, all is well. If >LIVE, it has shut for a reason * @throws IOException IO * @throws HoyaException Hoya * @throws WaitTimeoutException if the wait timed out */ @VisibleForTesting public int waitForRoleInstanceLive(String role, long timeout) throws WaitTimeoutException, IOException, YarnException { return createClusterOperations().waitForRoleInstanceLive(role, timeout); } /** * Generate an exception for an unknown cluster * @param clustername cluster name * @return an exception with text and a relevant exit code */ public HoyaException unknownClusterException(String clustername) { return new HoyaException(EXIT_UNKNOWN_HOYA_CLUSTER, "Hoya cluster not found: '" + clustername + "' "); } @Override public String toString() { return "HoyaClient in state " + getServiceState(); } /** * Get all YARN applications * @return a possibly empty list * @throws YarnException * @throws IOException */ @VisibleForTesting public List<ApplicationReport> getApplications() throws YarnException, IOException { return yarnClient.getApplications(); } @VisibleForTesting public ApplicationReport getApplicationReport(ApplicationId appId) throws YarnException, IOException { return yarnClient.getApplicationReport(appId); } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
752fcb0a7d14295ac654de787de1b91194211b3b
8e1809924281c54bf01013fb7a4356f8874b85d5
/Reactnative/src/androidTest/java/com/avl/reactnative/ExampleInstrumentedTest.java
15477c4f059cb9b0c48b8420722c7c840411127d
[]
no_license
mackzheng/BriefBook
db3bca2f9ea52390dfe563e7add064e75fc3ce62
54b7f6615d71ce90ab630f584bfc4f0a030fa013
refs/heads/master
2020-04-05T17:24:44.636149
2019-04-07T05:16:33
2019-04-07T05:16:33
157,059,437
2
0
null
null
null
null
UTF-8
Java
false
false
722
java
package com.avl.reactnative; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.avl.reactnative", appContext.getPackageName()); } }
[ "zhengmack@gmail.com" ]
zhengmack@gmail.com
0b3c854e0f430d68e3c7629142479920ee26a6e1
53d677a55e4ece8883526738f1c9d00fa6560ff7
/com/tencent/mm/plugin/webview/ui/tools/WebViewUI$21.java
251e8be54cb1de2935751154f5df65b247474dac
[]
no_license
0jinxing/wechat-apk-source
544c2d79bfc10261eb36389c1edfdf553d8f312a
f75eefd87e9b9ecf2f76fc6d48dbba8e24afcf3d
refs/heads/master
2020-06-07T20:06:03.580028
2019-06-21T09:17:26
2019-06-21T09:17:26
193,069,132
9
4
null
null
null
null
UTF-8
Java
false
false
839
java
package com.tencent.mm.plugin.webview.ui.tools; import android.view.MenuItem; import android.view.MenuItem.OnMenuItemClickListener; import com.tencent.matrix.trace.core.AppMethodBeat; import com.tencent.mm.sdk.platformtools.ab; final class WebViewUI$21 implements MenuItem.OnMenuItemClickListener { WebViewUI$21(WebViewUI paramWebViewUI) { } public final boolean onMenuItemClick(MenuItem paramMenuItem) { AppMethodBeat.i(7841); this.uxp.aqX(); this.uxp.daC(); ab.i("MicroMsg.WebViewUI", "on back btn press"); AppMethodBeat.o(7841); return true; } } /* Location: C:\Users\Lin\Downloads\dex-tools-2.1-SNAPSHOT\dex-tools-2.1-SNAPSHOT\classes3-dex2jar.jar * Qualified Name: com.tencent.mm.plugin.webview.ui.tools.WebViewUI.21 * JD-Core Version: 0.6.2 */
[ "172601673@qq.com" ]
172601673@qq.com
906a595b5dbbf55e2803673e42d602a623609ad5
5f0cbea5ec5752fd87c4bc190f5fc13fa349246c
/src/main/java/com/globo/globodns/client/exception/GloboDnsParseException.java
32a0767c556c5fc6f7ac61214d1cfd285628ec20
[ "Apache-2.0" ]
permissive
globocom/GloboDNS-Client
0fa38d7fd66411895ebc9aa69c8752f934f02540
4f9b742bdc598c41299fcf92e8443ce419709618
refs/heads/master
2020-12-24T08:16:57.883182
2018-04-20T14:35:31
2018-04-20T14:35:31
18,079,486
3
1
null
null
null
null
UTF-8
Java
false
false
1,163
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.globo.globodns.client.exception; import com.globo.globodns.client.GloboDnsException; public class GloboDnsParseException extends GloboDnsException { private static final long serialVersionUID = 5686288460895537688L; public GloboDnsParseException(String msg) { super(msg); } public GloboDnsParseException(String msg, Throwable e) { super(msg, e); } }
[ "lucas.castro@corp.globo.com" ]
lucas.castro@corp.globo.com
79a59846014e47f6057c099ea20792dafdc13ce4
c8eb5fc37993d00ea1e7ed9d19cd1fdfc07c7cea
/rest/src/main/java/org/acme/entities/Entity1365.java
ef5cc80c6600a224eb49686bcb4d8265d0c2eb60
[]
no_license
goblinbr/quarkus-multimodule-test
76ef284ecae73df0bde6a6aaae52a7c64b878167
bc9a9aaa54d3dc3d3f051ec3f847322483e14370
refs/heads/master
2020-05-21T08:28:23.897539
2019-05-17T21:00:25
2019-05-17T21:00:25
185,981,408
0
1
null
null
null
null
UTF-8
Java
false
false
1,669
java
package org.acme.entities; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import javax.validation.constraints.Max; import javax.validation.constraints.Min; import javax.validation.constraints.Size; import java.util.Objects; @Entity @Table(name = "ENTITY_1365") public class Entity1365 { @Id @Max(99999999999L) @Min(1) @Column(name = "ID") private Long id; @Size(max = 15) @Column(name = "COLUMN_1") private String column1; @Column(name = "COLUMN_2") private Boolean column2; public Entity1365() { this.id = 0L; this.column1 = ""; this.column2 = false; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getColumn1() { return column1; } public void setColumn1(String column1) { this.column1 = column1; } public Boolean getColumn2() { return column2; } public void setColumn2(Boolean column2) { this.column2 = column2; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof Entity1365)) return false; Entity1365 other = (Entity1365) o; return Objects.equals(id, other.id); } @Override public int hashCode() { return Objects.hash(id); } @Override public String toString() { return "Entity1365{" + "id=" + id + ", column1='" + column1 + '\'' + ", column2=" + column2 + '}'; } }
[ "rodrigo.goblin@gmail.com" ]
rodrigo.goblin@gmail.com
4f7fa033436bdcc7e90d858ac52bf2c5fa2cf967
1dcf2bd0aa2fabce5393d6836afd03890ff41860
/src/main/java/com/pov/mappers/ApplianceMapper.java
b17d2f3d3bed139366e80fbdca6be7c14bb2c9c3
[]
no_license
mustaphaMounsif/appliance_back
4442a11cc8bcdaf29b10244f6a2650e10132e034
27aad0e4a4f12aa2d2573454070134ecb6e22738
refs/heads/master
2023-08-19T14:16:40.852246
2021-10-14T15:23:23
2021-10-14T15:23:23
412,009,668
0
0
null
null
null
null
UTF-8
Java
false
false
1,475
java
package com.pov.mappers; import org.springframework.stereotype.Component; import com.pov.dtos.ApplianceDto; import com.pov.entities.Appliance; import com.pov.entities.Type; @Component public class ApplianceMapper { public ApplianceDto toDto(Appliance appliance,ApplianceDto applianceDto) { if(applianceDto == null) applianceDto = new ApplianceDto(); applianceDto.setDbid(appliance.getDbid()); applianceDto.setDisponibilitte(appliance.getDisponibilitte()); applianceDto.setId_appliance(appliance.getId_appliance()); applianceDto.setLibelleApplliance(appliance.getLibelleApplliance()); applianceDto.setReference(appliance.getReference()); if(appliance.getType() != null) { applianceDto.setId_type(appliance.getType().getId_type()); applianceDto.setLibelleType(appliance.getType().getLibelleType()); } return applianceDto; } public Appliance toDomain(Appliance appliance,ApplianceDto applianceDto) { if(appliance == null) appliance = new Appliance(); appliance.setDbid(applianceDto.getDbid()); appliance.setDisponibilitte(applianceDto.getDisponibilitte()); appliance.setId_appliance(applianceDto.getId_appliance()); appliance.setLibelleApplliance(applianceDto.getLibelleApplliance()); appliance.setReference(applianceDto.getReference()); if(applianceDto.getId_type() != null) { Type type=new Type(); type.setId_type(applianceDto.getId_type()); appliance.setType(type); } return appliance; } }
[ "mustaphamounsif@gmail.com" ]
mustaphamounsif@gmail.com
cab34a8f2bb619d913bba7ec4bf566aad6b57c93
ce7dbb895a37fbab059c228352679f8680a83cd7
/src/main/java/leetcode/T46_Permute.java
3d4050095de1e13d24461c57dcb9c25eb001a3df
[]
no_license
songxiaocang/algorithmpractice
5fd3d04bc55f875575d972fab2a6d90182c26851
bf8fed5952a721f64cb2c84787b51f5a76bb66c7
refs/heads/master
2020-05-18T12:40:06.357784
2020-04-06T08:45:04
2020-04-06T08:45:04
184,414,516
0
0
null
null
null
null
UTF-8
Java
false
false
1,827
java
package leetcode; import java.util.ArrayList; import java.util.Collections; import java.util.List; /** * @Author: Songxc * @Date: 21:42 2019/7/28 * @Description: 全排列 * 给定一个没有重复数字的序列,返回其所有可能的全排列。 * <p> * 示例: * <p> * 输入: [1,2,3] * 输出: * [ * [1,2,3], * [1,3,2], * [2,1,3], * [2,3,1], * [3,1,2], * [3,2,1] * ] * <p> * 来源:力扣(LeetCode) * 链接:https://leetcode-cn.com/problems/permutations * <p> * 思路: * 回溯法: * 回溯遍历 * 在排列中放置第 i 个整数, 即 swap(nums[first], nums[i]). * 继续生成从第 i 个整数开始的所有排列: backtrack(first + 1). * 现在回溯,即通过 swap(nums[first], nums[i]) 还原. * * 时间复杂度:n的k排列: 0(∑k=1~N​ P(N,k)) ,其值介于N!和 N*N!之间。 * 空间复杂度为:N! (n的阶乘) * */ public class T46_Permute { public List<List<Integer>> permute(int[] nums) { if (nums == null || nums.length <= 0) { return null; } int len = nums.length; List<List<Integer>> output = new ArrayList<>(); List<Integer> numsArr = new ArrayList<>(); for (int i = 0; i < len; i++) { numsArr.add(nums[i]); } backTrace(numsArr, len, 0, output); return output; } public void backTrace(List<Integer> nums, int len, int start, List<List<Integer>> output) { if (start == len) { output.add(new ArrayList<>(nums)); } for (int i = start; i < len; i++) { //交换顺序 Collections.swap(nums, start, i); //回溯 backTrace(nums, len, start + 1, output); //还原 Collections.swap(nums, start, i); } } }
[ "1844367805@qq.com" ]
1844367805@qq.com
5189d6b03ca894cbdf6dd75c8925271e30f55c22
d4dca92388920b64c03a112c2a6b94ca86a24326
/src/main/java/cum/xiaro/trollhack/mixin/gui/MixinGuiScreen.java
b1db1ac416ed8f814cfad5bac4ede2b5e31dd703
[]
no_license
IRunServers/TrollHack
75f3b772128350a8564154e541420e0d4e1bdfa8
2945079bd3cf49dffce96c882b06402a155dc89d
refs/heads/master
2023-09-04T16:24:35.020541
2021-10-31T19:54:43
2021-10-31T19:54:43
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,483
java
package cum.xiaro.trollhack.mixin.gui; import cum.xiaro.trollhack.module.modules.render.MapPreview; import cum.xiaro.trollhack.module.modules.render.ShulkerPreview; import net.minecraft.client.gui.GuiScreen; import net.minecraft.item.ItemMap; import net.minecraft.item.ItemShulkerBox; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.world.storage.MapData; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(GuiScreen.class) public class MixinGuiScreen { @Inject(method = "renderToolTip", at = @At("HEAD"), cancellable = true) public void renderToolTip(ItemStack stack, int x, int y, CallbackInfo info) { if (ShulkerPreview.INSTANCE.isEnabled() && stack.getItem() instanceof ItemShulkerBox) { NBTTagCompound tagCompound = ShulkerPreview.getShulkerData(stack); if (tagCompound != null) { info.cancel(); ShulkerPreview.renderShulkerAndItems(stack, x, y, tagCompound); } } else if (MapPreview.INSTANCE.isEnabled() && stack.getItem() instanceof ItemMap) { MapData mapData = MapPreview.getMapData(stack); if (mapData != null) { info.cancel(); MapPreview.drawMap(stack, mapData, x, y); } } } }
[ "62033805+Xiaro@users.noreply.github.com" ]
62033805+Xiaro@users.noreply.github.com
b8f06c3274e033803dca2968fa257da3fa3def87
a7ad1a4d3368e82aac336887de4a56ec2631fb6b
/src/main/java/com/auctions/model/Products.java
3e3307e56c6a8cb0ae3b95629527e7f83bced4fc
[]
no_license
rst1502/AuctionsApi
a72248b33ad147aeef0eb5de0eff975993daa636
db91885e2c9bcfd67ef6d6ab7a1042cc6948e409
refs/heads/master
2020-12-02T05:25:21.549150
2017-07-11T18:51:24
2017-07-11T18:51:24
96,903,373
0
0
null
null
null
null
UTF-8
Java
false
false
3,663
java
package com.auctions.model; import com.auctions.utils.DomainKeyGenerator; import javax.persistence.*; import java.time.LocalDate; import java.time.LocalDateTime; import java.util.Date; /** * Created by tsamuriwo on 7/10/17. */ @Entity(name="products") public class Products { @Id private Long id; @Version private Long version; private Date createdDate; private Date updtedDate; private String productName; private Double expectedProductprice; @ManyToOne() @JoinColumn(name="users_id",referencedColumnName="id") private Users users; private String discription; private Date closingTime; private String category; @PrePersist protected void init() { createdDate = new Date(); if(id == null || id == 0l) { id = DomainKeyGenerator.getKey(); } } public Products(){}; public Products(Long id, Long version, Date createdDate, Date updtedDate, String productName, Double expectedProductprice, Users users, String discription, Date closingTime, String category) { this.id = id; this.version = version; this.createdDate = createdDate; this.updtedDate = updtedDate; this.productName = productName; this.expectedProductprice = expectedProductprice; this.users = users; this.discription = discription; this.closingTime = closingTime; this.category = category; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Long getVersion() { return version; } public void setVersion(Long version) { this.version = version; } public Date getCreatedDate() { return createdDate; } public void setCreatedDate(Date createdDate) { this.createdDate = createdDate; } public Date getUpdtedDate() { return updtedDate; } public void setUpdtedDate(Date updtedDate) { this.updtedDate = updtedDate; } public String getProductName() { return productName; } public void setProductName(String productName) { this.productName = productName; } public Double getExpectedProductprice() { return expectedProductprice; } public void setExpectedProductprice(Double expectedProductprice) { this.expectedProductprice = expectedProductprice; } public Users getUsers() { return users; } public void setUsers(Users users) { this.users = users; } public String getDiscription() { return discription; } public void setDiscription(String discription) { this.discription = discription; } public Date getClosingTime() { return closingTime; } public void setClosingTime(Date closingTime) { this.closingTime = closingTime; } public String getCategory() { return category; } public void setCategory(String category) { this.category = category; } @Override public String toString() { return "Products{" + "id=" + id + ", version=" + version + ", createdDate=" + createdDate + ", updtedDate=" + updtedDate + ", productName='" + productName + '\'' + ", expectedProductprice=" + expectedProductprice + ", users='" + users + '\'' + ", discription='" + discription + '\'' + ", closingTime=" + closingTime + ", category='" + category + '\'' + '}'; } }
[ "tafadzwa.samuriwo@econet.co.zw" ]
tafadzwa.samuriwo@econet.co.zw
075398ec814eb865871141e61727e3054eec6ac6
1d9248f611beda2eb8d449f0559a2151e308f13f
/src/main/java/com/leetcode/example/string/_43_MultiplyStrings.java
69bd9d77b6df55c25a0a3db13b84840bdeb77725
[]
no_license
gogagubi/Leetcode-Java
ac6e6bb57f0ffa97344b1b4e9d92f068fb805f56
ac45d4b02f5b5c3da419075246e447101e4d0ef7
refs/heads/master
2023-06-07T02:14:31.221632
2021-06-28T15:34:02
2021-06-28T15:34:02
318,897,869
0
0
null
null
null
null
UTF-8
Java
false
false
1,463
java
package com.leetcode.example.string; public class _43_MultiplyStrings { public static void main(String[] args) { if (false) { _43_MultiplyStrings c = new _43_MultiplyStrings(); String num1 = "3"; String num2 = "2"; System.out.println("Multiplication result = " + c.multiply(num1, num2)); } if (false) { _43_MultiplyStrings c = new _43_MultiplyStrings(); String num1 = "123"; String num2 = "456"; System.out.println("Multiplication result = " + c.multiply(num1, num2)); } if (false) { _43_MultiplyStrings c = new _43_MultiplyStrings(); String num1 = "0"; String num2 = "0"; System.out.println("Multiplication result = " + c.multiply(num1, num2)); } if (false) { _43_MultiplyStrings c = new _43_MultiplyStrings(); String num1 = "123456789"; String num2 = "987654321"; System.out.println("Multiplication result = " + c.multiply(num1, num2)); } if (true) { _43_MultiplyStrings c = new _43_MultiplyStrings(); String num1 = "498828660196"; String num2 = "840477629533"; System.out.println("Multiplication result = " + c.multiply(num1, num2)); } } public String multiply(String num1, String num2) { return ""; } }
[ "gogagubi@gmail.com" ]
gogagubi@gmail.com
5486a828452d18232e3185295421cfc5f3d466e6
42d0f1f4a7a9609a758e4ce3c6b74e4d4c82ccc8
/mydb_bot/src/main/java/ru/home/mydb_bot/botapi/handlers/callback/query/QueryForGetData.java
6b253024fe6157f9a54a0b4c5181a220b3ec03f5
[]
no_license
chudu13/first-bot
b05919ebff1f48b00caaa0eedba12c274819b7cb
5a78e1684f29ad7bf4d1c78e034fcec978b57e1c
refs/heads/master
2022-12-24T22:34:29.191993
2020-09-27T18:31:15
2020-09-27T18:31:15
293,656,139
1
0
null
null
null
null
UTF-8
Java
false
false
2,865
java
package ru.home.mydb_bot.botapi.handlers.callback.query; import org.springframework.stereotype.Component; import org.telegram.telegrambots.meta.api.methods.send.SendMessage; import org.telegram.telegrambots.meta.api.objects.CallbackQuery; import ru.home.mydb_bot.botapi.BotState; import ru.home.mydb_bot.botapi.handlers.QueryState; import ru.home.mydb_bot.cache.UserDataCache; import ru.home.mydb_bot.service.ReplyMessagesService; import ru.home.mydb_bot.utils.Emojis; @Component public class QueryForGetData { private UserDataCache userDataCache; private ReplyMessagesService replyMessagesService; public QueryForGetData(UserDataCache userDataCache,ReplyMessagesService replyMessagesService) { this.userDataCache = userDataCache; this.replyMessagesService = replyMessagesService; } public SendMessage processSearch(long chatId,int userId,CallbackQuery buttonQuery){ String query = buttonQuery.getData(); SendMessage replyToUser = null; switch (query){ case "bNameAndSurname": userDataCache.setUsersCurrentQueryState(userId, QueryState.QUERY_GET_NAME_SURNAME); userDataCache.setUsersCurrentBotState(userId,BotState.GET_BY_SURNAME); replyToUser = replyMessagesService.getReplyMessage(chatId, "reply.askName", Emojis.INPUT); break; case "bName": userDataCache.setUsersCurrentQueryState(userId,QueryState.QUERY_GET_NAME); userDataCache.setUsersCurrentBotState(userId,BotState.GET_DATA_READY); replyToUser = replyMessagesService.getReplyMessage(chatId, "reply.askName", Emojis.INPUT); break; case "bSurname": userDataCache.setUsersCurrentQueryState(userId,QueryState.QUERY_GET_SURNAME); userDataCache.setUsersCurrentBotState(userId,BotState.GET_DATA_READY); replyToUser = replyMessagesService.getReplyMessage(chatId, "reply.askSurname", Emojis.INPUT); break; case "bCity": userDataCache.setUsersCurrentQueryState(userId,QueryState.QUERY_GET_CITY); userDataCache.setUsersCurrentBotState(userId,BotState.GET_DATA_READY); replyToUser = replyMessagesService.getReplyMessage(chatId, "reply.askCity", Emojis.CITY); break; case "bAge": userDataCache.setUsersCurrentQueryState(userId,QueryState.QUERY_GET_AGE); userDataCache.setUsersCurrentBotState(userId,BotState.GET_DATA_READY); replyToUser = replyMessagesService.getReplyMessage(chatId, "reply.askAge",Emojis.INPUT); break; default: userDataCache.setUsersCurrentBotState(userId,BotState.SHOW_HELP_MENU); } return replyToUser; } }
[ "nadirmusaev13@gmail.com" ]
nadirmusaev13@gmail.com
9f2978cb746f73e82b945b3b51bb86c62caad874
365fe62c71115c38325bc6cde9c1da797bf759c3
/src/thread/concurrent/c_001/T.java
a4fa2fb04ef2c8647cc81d3c15bf96eef63c54f2
[]
no_license
stevewang41/JavaTest
96770d06ba0fc85fb9325e1d576ae358227d5015
85eff7963c9a3d4d0245b0ed2c8c0d8da9ceb3bb
refs/heads/master
2021-07-16T03:25:18.349977
2017-10-20T13:03:41
2017-10-20T13:03:41
107,678,399
1
0
null
null
null
null
UTF-8
Java
false
false
487
java
package thread.concurrent.c_001; /** * Created by wangshiyi on 17/8/22. * <p> * synchronized关键字 * 对某个对象加锁 * * @author mashibing */ public class T { private int count = 10; private Object o = new Object(); public void m() { synchronized (o) { // 任何线程要执行下面的代码,必须先拿到o的锁 count--; System.out.println(Thread.currentThread().getName() + " count = " + count); } } }
[ "wangshiyi@baidu.com" ]
wangshiyi@baidu.com
6a3501d8c7e3f7814d9907fac21952849bf38e38
0826bfaa69b4e27b780e4053bb8dc1a9c368f85a
/src/main/java/top/aprilyolies/miaosha/vo/OrderDetailVo.java
3e524e5c70ac16055724f12d0b8dec547420742e
[]
no_license
AprilYoLies/miaosha
286aca29ab15df069988237daf55bb146e5f1eb7
c7c14afc0356dc6faa0f9f4bb45adbaaa9d9607f
refs/heads/master
2022-12-29T06:47:59.717570
2019-08-29T06:47:26
2019-08-29T06:47:26
201,009,971
0
0
null
2022-12-16T09:21:10
2019-08-07T08:44:07
Java
UTF-8
Java
false
false
396
java
package top.aprilyolies.miaosha.vo; import top.aprilyolies.miaosha.domain.OrderInfo; public class OrderDetailVo { private GoodsVo goods; private OrderInfo order; public GoodsVo getGoods() { return goods; } public void setGoods(GoodsVo goods) { this.goods = goods; } public OrderInfo getOrder() { return order; } public void setOrder(OrderInfo order) { this.order = order; } }
[ "863821569@qq.com" ]
863821569@qq.com
1ca47598ce4ec713782ae9ff494b263e54d7788a
026f1ef37e17abb5156d3998d8ab0e4daf7ab36f
/src/adapter/GradeBook.java
2ad7b224b13b88df9e71fd29dbe0eeb690f5288b
[]
no_license
eneakllomollari/Student-Database-Project
6bc51fcff6498fac83512be8ffef7b8105578803
78a0d0c02eae0e6a1af2d5e21e10f71d798952c7
refs/heads/master
2020-03-09T20:00:55.099933
2018-04-10T17:40:28
2018-04-10T17:40:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
101
java
package adapter; public class GradeBook extends CreatePrint implements Creatable, Printable { }
[ "eneakllomollari@gmail.com" ]
eneakllomollari@gmail.com
d5f1ccac7b921f941817721b7fa56e73cb3d73e6
9bad2d1e523acbd0af1d61b0573051ae0f35235f
/TopCoder/src/old/FoxAndDoraemon.java
073acb40240b972656d0656a8c8fb4b1311bf715
[]
no_license
rogerfgm/JAVA_PC
7b6821e12925d7586aa34f87995e250b7b29acc9
850575329b2e578f12ac9dc22b4532fc7d016712
refs/heads/master
2021-01-15T10:13:34.258197
2016-08-26T08:15:06
2016-08-26T08:15:06
11,860,567
1
0
null
2016-08-26T08:15:06
2013-08-03T08:45:43
Java
UTF-8
Java
false
false
1,237
java
package old; import java.util.Arrays; import java.util.Collections; import java.util.Comparator; public class FoxAndDoraemon { int[] wc = null; int spC = 0; int[][] dp = null; public int minTime(int[] workCost, int splitCost){ spC = splitCost; Arrays.sort(workCost); wc = new int[workCost.length]; for(int i = 0; i < wc.length; i++){ wc[i] = workCost[workCost.length - 1 - i]; } dp = new int[wc.length][wc.length *2 + 10]; int ret = check(0, 1); return ret; } int check(int idx, int num){ int orgNum = num; if(idx >= wc.length){ return 0; } if(dp[idx][num] > 0){ return dp[idx][num]; } if(num >= wc.length - idx ){ return wc[idx]; } int ret = check(idx, num * 2) + spC; for(int i = 1; num - i >= 1; i++){ int time = Math.max(check(idx+i, num-i), wc[idx]); ret = Math.min(ret, time); } dp[idx][orgNum] = ret; return ret; } /** * @param args */ public static void main(String[] args) { FoxAndDoraemon f = new FoxAndDoraemon(); int[] w ={3000,3000,3000,3000,3000,3000,3000,3000,3000,3000}; int sp = 3000; int ret = f.minTime(w, sp); System.out.println(ret); } }
[ "daisuke@lenovo-PC.(none)" ]
daisuke@lenovo-PC.(none)
aa9b372bb6d9c8fc32034b065871ea8686add802
14a102623dc6eee0e491dc94b5f146093fba900e
/src/main/java/m2/miage/m2gestioncours/exception/GeneralErreurException.java
dc5b904e466ffc1648f52697d0e05f5b8bc22478
[]
no_license
DucTrongVo/M2GestionCours
ebf8023d7ee446be9b1ce6df141b0daa6efac78b
07762820c3953a4284b95770ef128bcfe3a54e9f
refs/heads/master
2023-05-24T05:44:07.335310
2021-06-15T09:57:52
2021-06-15T09:57:52
346,033,872
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package m2.miage.m2gestioncours.exception; public class GeneralErreurException extends Exception{ private static final long serialVersionUID = 35928888650679218L; public GeneralErreurException() { String s = "Une erreur est survenue. Veuillez contactez notre développeur pour plus d'informaiton!"; } public GeneralErreurException(Throwable t) {super(t);} }
[ "duc-trong.vo@toulouse.miage.fr" ]
duc-trong.vo@toulouse.miage.fr
f2ac2ad25675ed2cdea998dce0b8e4b711b3a2a2
f8c3888a947f8d857f1a8dd2f31377b0ba73dc89
/app/src/main/java/com/example/vasua/digital_diary/FinalizeMeeting.java
a38afa74774e6cbd6475470bbc2cb8af01edc59a
[]
no_license
VasuMhashakhetri/DigitalDiary2
dfae9ac5e09c9b8df2f3051d89f6a0cfcd15543b
ab98aa4f78676c97f6113d3d2052518551356e58
refs/heads/master
2021-05-05T18:16:13.015722
2018-01-15T19:59:01
2018-01-15T19:59:01
117,589,506
0
0
null
null
null
null
UTF-8
Java
false
false
359
java
package com.example.vasua.digital_diary; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class FinalizeMeeting extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_finalize_meeting); } }
[ "vasuapril22@gmail.com" ]
vasuapril22@gmail.com
da6cfbf3a213562f179e19f0c5f4147a29aff033
58fc326ca008e242636d3d3c2259cb7e8472121e
/app/src/androidTest/java/com/fidanoglu/malatafus/ExampleInstrumentedTest.java
11264fa033e39b01e5470ba4a6263195028b0d20
[]
no_license
Armanfidan/malafatus
d847c8831feba04df1191d34dfd2b053b8d5f247
2d2007cc55209b464496b47c3fb13e4c9044c265
refs/heads/master
2023-03-16T01:21:16.424462
2021-03-07T21:19:38
2021-03-07T21:19:38
314,324,695
0
0
null
null
null
null
UTF-8
Java
false
false
717
java
package com.fidanoglu.malafatus; import android.content.Context; import androidx.test.InstrumentationRegistry; import androidx.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.fidanoglu.malafatus", appContext.getPackageName()); } }
[ "armanfidanoglu@gmail.com" ]
armanfidanoglu@gmail.com
6035e9bcfecd067af755946c130cd2a8e2fbaa33
e1b834dab61004ddf1d6aa774b6a2206b5e87258
/support/src/main/java/com/christianbahl/basekit/support/activity/CBAppCompatActivityDelegate.java
8b3a277a4ce95eb49798d0772f670758bd473e92
[ "Apache-2.0" ]
permissive
Bodo1981/BaseKit
7e882ece8d61765fe003fdc6354215f3e7927936
87ebe0ca010b79edce1b60b1c72a828c4c9cdbf6
refs/heads/master
2016-09-14T00:12:32.564526
2016-04-26T13:52:15
2016-04-26T13:52:15
56,670,537
0
0
null
null
null
null
UTF-8
Java
false
false
4,231
java
package com.christianbahl.basekit.support.activity; import android.content.Intent; import android.content.res.Configuration; import android.os.Bundle; import android.os.PersistableBundle; import android.support.annotation.NonNull; import android.support.v7.app.AppCompatActivity; import com.christianbahl.basekit.common.activity.CBActivityDelegateManager; /** * Created by bodo on 14.04.16. */ public class CBAppCompatActivityDelegate extends AppCompatActivity { protected CBActivityDelegateManager delegateManager = new CBActivityDelegateManager(); /** * <p>Initialize CBActivityDelegateManager. Add or remove delegates</p> */ protected void initDelegateManager() { } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); initDelegateManager(); delegateManager.onCreate(savedInstanceState); } @Override public void onCreate(Bundle savedInstanceState, PersistableBundle persistentState) { super.onCreate(savedInstanceState, persistentState); delegateManager.onCreate(savedInstanceState, persistentState); } @Override protected void onStart() { super.onStart(); delegateManager.onStart(); } @Override protected void onResume() { super.onResume(); delegateManager.onResume(); } @Override protected void onPause() { super.onPause(); delegateManager.onPause(); } @Override protected void onStop() { super.onStop(); delegateManager.onStop(); } @Override protected void onDestroy() { super.onDestroy(); delegateManager.onDestroy(); } @Override protected void onRestart() { super.onRestart(); delegateManager.onRestart(); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); delegateManager.onSaveInstanceState(outState); } @Override public void onSaveInstanceState(Bundle outState, PersistableBundle outPersistentState) { super.onSaveInstanceState(outState, outPersistentState); delegateManager.onSaveInstanceState(outState, outPersistentState); } @Override protected void onRestoreInstanceState(Bundle savedInstanceState) { super.onRestoreInstanceState(savedInstanceState); delegateManager.onRestoreInstanceState(savedInstanceState); } @Override public void onRestoreInstanceState(Bundle savedInstanceState, PersistableBundle persistentState) { super.onRestoreInstanceState(savedInstanceState, persistentState); delegateManager.onRestoreInstanceState(savedInstanceState, persistentState); } @Override protected void onNewIntent(Intent intent) { super.onNewIntent(intent); delegateManager.onNewIntent(intent); } @Override public void onBackPressed() { super.onBackPressed(); delegateManager.onBackPressed(); } @Override public void onAttachedToWindow() { super.onAttachedToWindow(); delegateManager.onAttachedToWindow(); } @Override public void onDetachedFromWindow() { super.onDetachedFromWindow(); delegateManager.onDetachedFromWindow(); } @Override public void onConfigurationChanged(Configuration newConfig) { super.onConfigurationChanged(newConfig); delegateManager.onConfigurationChanged(newConfig); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); delegateManager.onActivityResult(requestCode, resultCode, data); } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); delegateManager.onRequestPermissionsResult(requestCode, permissions, grantResults); } @Override public void startActivity(Intent intent) { super.startActivity(intent); delegateManager.startActivity(intent); } @Override public void startActivityForResult(Intent intent, int requestCode) { super.startActivityForResult(intent, requestCode); delegateManager.startActivityForResult(intent, requestCode); } @Override public void finish() { super.finish(); delegateManager.finish(); } }
[ "christian@tickaroo.com" ]
christian@tickaroo.com
20b920aa9dcb45b39f5ff5991637b07d27569696
626b714d50ca57066c075f2ae80de841f528ce2b
/src/main/java/com/vts/elendservice/config/SecurityConfiguration.java
332cefd1711fed81b497d86825cfedd0eab05e87
[]
no_license
dinhtrung90/elend-service
4486f9a5f915681146b5bfc534ce6997a2b3f7a2
8e7b89cda1e304b4950bd0f021a785f5e571cab1
refs/heads/main
2023-04-26T13:51:48.739436
2021-05-05T01:28:35
2021-05-05T01:28:35
364,431,386
0
0
null
null
null
null
UTF-8
Java
false
false
4,923
java
package com.vts.elendservice.config; import com.vts.elendservice.security.*; import com.vts.elendservice.security.SecurityUtils; import com.vts.elendservice.security.oauth2.AudienceValidator; import com.vts.elendservice.security.oauth2.JwtGrantedAuthorityConverter; import java.util.*; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; import org.springframework.core.convert.converter.Converter; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.oauth2.core.DelegatingOAuth2TokenValidator; import org.springframework.security.oauth2.core.OAuth2TokenValidator; import org.springframework.security.oauth2.jwt.*; import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter; import org.springframework.security.web.header.writers.ReferrerPolicyHeaderWriter; import org.zalando.problem.spring.web.advice.security.SecurityProblemSupport; import tech.jhipster.config.JHipsterProperties; @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) @Import(SecurityProblemSupport.class) public class SecurityConfiguration extends WebSecurityConfigurerAdapter { private final JHipsterProperties jHipsterProperties; @Value("${spring.security.oauth2.client.provider.oidc.issuer-uri}") private String issuerUri; private final SecurityProblemSupport problemSupport; public SecurityConfiguration(JHipsterProperties jHipsterProperties, SecurityProblemSupport problemSupport) { this.problemSupport = problemSupport; this.jHipsterProperties = jHipsterProperties; } @Override public void configure(HttpSecurity http) throws Exception { // @formatter:off http .csrf() .disable() .exceptionHandling() .authenticationEntryPoint(problemSupport) .accessDeniedHandler(problemSupport) .and() .headers() .contentSecurityPolicy(jHipsterProperties.getSecurity().getContentSecurityPolicy()) .and() .referrerPolicy(ReferrerPolicyHeaderWriter.ReferrerPolicy.STRICT_ORIGIN_WHEN_CROSS_ORIGIN) .and() .featurePolicy("geolocation 'none'; midi 'none'; sync-xhr 'none'; microphone 'none'; camera 'none'; magnetometer 'none'; gyroscope 'none'; fullscreen 'self'; payment 'none'") .and() .frameOptions() .deny() .and() .sessionManagement() .sessionCreationPolicy(SessionCreationPolicy.STATELESS) .and() .authorizeRequests() .antMatchers("/api/auth-info").permitAll() .antMatchers("/api/admin/**").hasAuthority(AuthoritiesConstants.ADMIN) .antMatchers("/api/**").authenticated() .antMatchers("/management/health").permitAll() .antMatchers("/management/health/**").permitAll() .antMatchers("/management/info").permitAll() .antMatchers("/management/prometheus").permitAll() .antMatchers("/management/**").hasAuthority(AuthoritiesConstants.ADMIN) .and() .oauth2ResourceServer() .jwt() .jwtAuthenticationConverter(authenticationConverter()) .and() .and() .oauth2Client(); // @formatter:on } Converter<Jwt, AbstractAuthenticationToken> authenticationConverter() { JwtAuthenticationConverter jwtAuthenticationConverter = new JwtAuthenticationConverter(); jwtAuthenticationConverter.setJwtGrantedAuthoritiesConverter(new JwtGrantedAuthorityConverter()); return jwtAuthenticationConverter; } @Bean JwtDecoder jwtDecoder() { NimbusJwtDecoder jwtDecoder = (NimbusJwtDecoder) JwtDecoders.fromOidcIssuerLocation(issuerUri); OAuth2TokenValidator<Jwt> audienceValidator = new AudienceValidator(jHipsterProperties.getSecurity().getOauth2().getAudience()); OAuth2TokenValidator<Jwt> withIssuer = JwtValidators.createDefaultWithIssuer(issuerUri); OAuth2TokenValidator<Jwt> withAudience = new DelegatingOAuth2TokenValidator<>(withIssuer, audienceValidator); jwtDecoder.setJwtValidator(withAudience); return jwtDecoder; } }
[ "jhipster-bot@jhipster.tech" ]
jhipster-bot@jhipster.tech
89e293b7a94aaafdbaebf2cac1a23422c84d188c
56817b88c57ce35f147414c5992f12209bb62489
/app/src/main/java/com/chi/marchoncitadel/Player.java
29411be73cc074a9e07997dea56acd8fd161be73
[]
no_license
Chiinozland/MarchonCitadel-ver1.3
2d95a961f8552538555d8feb27be57edb6bd5cf8
5baa1d1393d1c55acfd02d032ef8971d61dc78a9
refs/heads/master
2020-04-01T04:07:51.061384
2018-10-15T07:55:07
2018-10-15T07:55:07
152,850,915
0
0
null
null
null
null
UTF-8
Java
false
false
2,718
java
package com.chi.marchoncitadel; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Point; import android.graphics.Rect; public class Player implements GameObject{ //Bitmap to get character from image private Bitmap bitmap; private Rect melee; private Point playerPoint; private int maxX = Constants.SCREEN_WIDTH; private int maxY = Constants.SCREEN_HEIGHT; private int minX = 0; private int minY = 0; private final int MIN_SPEED = 1; private final int MAX_SPEED = 20; //motion speed of the character private int speed = 0; private boolean boosting; private final int GRAVITY = -10; private Rect detectCollision; //constructor public Player(Context context, int screenX, int screenY){ playerPoint = new Point(Constants.SCREEN_WIDTH/2, 3*Constants.SCREEN_HEIGHT/4); speed = 1; //getting bitmap from drawable resource bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.melee); maxX = screenX - bitmap.getWidth(); minX = 0; maxY = screenY - bitmap.getHeight(); minY = 0; boosting = false; detectCollision = new Rect(playerPoint.x, playerPoint.y,bitmap.getWidth(),bitmap.getHeight()); } public void setBoosting(){ boosting = true; } public void stopBoosting(){ boosting = false; } @Override public void draw(Canvas canvas) { } public void update(){ if (boosting){ speed += 5; } else { speed -= 5; } if (speed > MAX_SPEED){ speed = MAX_SPEED; } if (speed < MIN_SPEED){ speed = MIN_SPEED; } playerPoint.x -= speed + GRAVITY; if (playerPoint.x < minX){ playerPoint.x = minX; } if (playerPoint.x > maxX){ playerPoint.x = maxX; }if (playerPoint.y < minY){ playerPoint.y = minY; } if (playerPoint.y > maxY){ playerPoint.y = maxY; } detectCollision.left = playerPoint.x; detectCollision.top = playerPoint.y; detectCollision.right = playerPoint.x + bitmap.getWidth(); detectCollision.bottom = playerPoint.y + bitmap.getHeight(); } public Rect getDetectCollision(){ return detectCollision; } public Bitmap getBitmap() { return bitmap; } public Point getPlayerPoint(){ return playerPoint; } public int getSpeed() { return speed; } }
[ "amayiyy@gmail.com" ]
amayiyy@gmail.com
c1b3510cb75da92af8a28f7d7861ae4b559282f3
48ce166c189524ab56a77dd8f4b72bb422da03aa
/app/build/generated/not_namespaced_r_class_sources/debug/processDebugResources/r/androidx/cardview/R.java
94698da3fe147358bb2a23e88ce2628a980a73d9
[]
no_license
hvillalba/salvapy-app
e2b4f6528b5219e5bfeb8ef3ab368a0b85330e78
30ce7752537b3e577e7bbfbfa73c11248dc7027a
refs/heads/master
2020-07-01T09:40:19.563186
2019-08-07T21:27:20
2019-08-07T21:27:20
200,762,294
1
0
null
null
null
null
UTF-8
Java
false
false
3,185
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * gradle plugin from the resource data it found. It * should not be modified by hand. */ package androidx.cardview; public final class R { private R() {} public static final class attr { private attr() {} public static final int cardBackgroundColor = 0x7f040063; public static final int cardCornerRadius = 0x7f040064; public static final int cardElevation = 0x7f040065; public static final int cardMaxElevation = 0x7f040066; public static final int cardPreventCornerOverlap = 0x7f040067; public static final int cardUseCompatPadding = 0x7f040068; public static final int cardViewStyle = 0x7f040069; public static final int contentPadding = 0x7f0400a8; public static final int contentPaddingBottom = 0x7f0400a9; public static final int contentPaddingLeft = 0x7f0400aa; public static final int contentPaddingRight = 0x7f0400ab; public static final int contentPaddingTop = 0x7f0400ac; } public static final class color { private color() {} public static final int cardview_dark_background = 0x7f060027; public static final int cardview_light_background = 0x7f060028; public static final int cardview_shadow_end_color = 0x7f060029; public static final int cardview_shadow_start_color = 0x7f06002a; } public static final class dimen { private dimen() {} public static final int cardview_compat_inset_shadow = 0x7f07004d; public static final int cardview_default_elevation = 0x7f07004e; public static final int cardview_default_radius = 0x7f07004f; } public static final class style { private style() {} public static final int Base_CardView = 0x7f10000f; public static final int CardView = 0x7f1000c6; public static final int CardView_Dark = 0x7f1000c7; public static final int CardView_Light = 0x7f1000c8; } public static final class styleable { private styleable() {} public static final int[] CardView = { 0x101013f, 0x1010140, 0x7f040063, 0x7f040064, 0x7f040065, 0x7f040066, 0x7f040067, 0x7f040068, 0x7f0400a8, 0x7f0400a9, 0x7f0400aa, 0x7f0400ab, 0x7f0400ac }; public static final int CardView_android_minWidth = 0; public static final int CardView_android_minHeight = 1; public static final int CardView_cardBackgroundColor = 2; public static final int CardView_cardCornerRadius = 3; public static final int CardView_cardElevation = 4; public static final int CardView_cardMaxElevation = 5; public static final int CardView_cardPreventCornerOverlap = 6; public static final int CardView_cardUseCompatPadding = 7; public static final int CardView_contentPadding = 8; public static final int CardView_contentPaddingBottom = 9; public static final int CardView_contentPaddingLeft = 10; public static final int CardView_contentPaddingRight = 11; public static final int CardView_contentPaddingTop = 12; } }
[ "alfredovillalba460@hotmail.com" ]
alfredovillalba460@hotmail.com
d93ec643eee2f30a8f6ea5590202adbdf4517bde
5229a89e8795e979a50380a0ae49cc5c4362c980
/src/test/java/by/matrosov/taxipark/FindFakeDriversTest.java
7a03fab4d40c85fc701785cc948c11d9758f698c
[]
no_license
piyz/taxi-park-on-java
f3c860b0b46885d71fbabcd421c0ddf6f1797c40
34facb37a62889aaee2e91f0966c4400abad728c
refs/heads/master
2020-05-25T15:11:57.593428
2019-05-30T19:29:13
2019-05-30T19:29:13
187,861,919
0
0
null
null
null
null
UTF-8
Java
false
false
5,250
java
package by.matrosov.taxipark; import by.matrosov.taxipark.model.Driver; import by.matrosov.taxipark.model.Trip; import org.junit.After; import org.junit.Assert; import org.junit.Test; import java.util.*; public class FindFakeDriversTest extends TaxiParkUtilImpl { @After public void clearLists(){ driverList.clear(); passengerList.clear(); } @Test public void test0() { initDrivers(3); initPassengers(5); TaxiParkImpl taxiPark = new TaxiParkImpl(driverSet, passengerSet, null); Set<Driver> expected = new HashSet<>(driverList); Assert.assertEquals(expected, taxiPark.findFakeDrivers()); } @Test public void test1() { initDrivers(3); initPassengers(2); List<Trip> trips = new ArrayList<>(Arrays.asList( new Trip(setDriver(0), setPassengers(0)), new Trip(setDriver(0), setPassengers(1)) )); TaxiParkImpl taxiPark = new TaxiParkImpl(driverSet, passengerSet, trips); Set<Driver> expected = setDrivers(1,2); Assert.assertEquals(expected, taxiPark.findFakeDrivers()); } @Test public void test2() { initDrivers(4); initPassengers(10); List<Trip> trips = new ArrayList<>(Arrays.asList( new Trip(setDriver(2), setPassengers(9), 9, 36.0), new Trip(setDriver(1), setPassengers(0), 15, 28.0), new Trip(setDriver(2), setPassengers(1), 37, 30.0), new Trip(setDriver(0), setPassengers(9), 24, 10.0), new Trip(setDriver(1), setPassengers(2), 1, 6.0), new Trip(setDriver(0), setPassengers(0, 9), 9, 7.0), new Trip(setDriver(2), setPassengers(3, 2, 8), 18, 39.0, 0.1), new Trip(setDriver(1), setPassengers(9, 4), 19, 1.0, 0.2), new Trip(setDriver(1), setPassengers(3), 16, 23.0), new Trip(setDriver(2), setPassengers(4),10, 31.0, 0.2) )); TaxiParkImpl taxiPark = new TaxiParkImpl(driverSet, passengerSet, trips); Set<Driver> expected = new HashSet<>(Arrays.asList(setDriver(3))); Assert.assertEquals(expected, taxiPark.findFakeDrivers()); } @Test public void test3() { initDrivers(5); initPassengers(10); List<Trip> trips = new ArrayList<>(Arrays.asList( new Trip(setDriver(3), setPassengers(2), 24, 7.0), new Trip(setDriver(3), setPassengers(8, 5, 9), 30, 23.0, 0.4), new Trip(setDriver(3), setPassengers(4, 9, 3, 7), 24, 8.0), new Trip(setDriver(1), setPassengers(2), 32, 27.0, 0.2), new Trip(setDriver(3), setPassengers(0, 5, 7, 6), 38, 3.0, 0.2), new Trip(setDriver(3), setPassengers(8, 0), 6, 39.0), new Trip(setDriver(1), setPassengers(3, 1, 8), 18, 39.0, 0.2), new Trip(setDriver(3), setPassengers(6, 5), 19, 21), new Trip(setDriver(1), setPassengers(8, 0), 5, 5.0), new Trip(setDriver(3), setPassengers(3, 7, 9),24, 20.0) )); TaxiParkImpl taxiPark = new TaxiParkImpl(driverSet, passengerSet, trips); Set<Driver> expected = new HashSet<>(Arrays.asList(setDriver(0), setDriver(2), setDriver(4))); Assert.assertEquals(expected, taxiPark.findFakeDrivers()); } @Test public void test4() { initDrivers(10); initPassengers(20); List<Trip> trips = new ArrayList<>(Arrays.asList( new Trip(setDriver(6), setPassengers(0), 36, 1.0, 0.3), new Trip(setDriver(7), setPassengers(3, 5), 34,11.0), new Trip(setDriver(9), setPassengers(15, 1), 13, 12.0), new Trip(setDriver(3), setPassengers(7), 15, 30, 0.2), new Trip(setDriver(9), setPassengers(8, 6, 7, 11), 36, 16.0), new Trip(setDriver(3), setPassengers(11, 8, 15, 6), 37, 32.0, 0.4), new Trip(setDriver(2), setPassengers(1, 6), 12, 15, 0.1), new Trip(setDriver(2), setPassengers(3, 2, 19), 2, 11.0, 0.2), new Trip(setDriver(3), setPassengers(7, 5), 26, 10.0, 0.3), new Trip(setDriver(3), setPassengers(6, 4),10, 35.0), new Trip(setDriver(7), setPassengers(7, 14),27, 2.0, 0.3), new Trip(setDriver(3), setPassengers(3, 11),1, 33.0), new Trip(setDriver(7), setPassengers(3),26, 4.0, 0.4), new Trip(setDriver(2), setPassengers(18, 7),15, 6.0, 0.4), new Trip(setDriver(2), setPassengers(0, 1, 2),30, 17.0), new Trip(setDriver(2), setPassengers(0, 11),32, 5.0, 0.4), new Trip(setDriver(9), setPassengers(0, 15),27, 3.0), new Trip(setDriver(9), setPassengers(11, 15),11, 15.0,0.2), new Trip(setDriver(2), setPassengers(12, 14, 8),31, 34.0), new Trip(setDriver(7), setPassengers(15, 11),1, 3.0) )); TaxiParkImpl taxiPark = new TaxiParkImpl(driverSet, passengerSet, trips); Set<Driver> expected = setDrivers(0,1,4,5,8); Assert.assertEquals(expected, taxiPark.findFakeDrivers()); } }
[ "matrosovs2008@yandex.ru" ]
matrosovs2008@yandex.ru
3979fd78c6c5bde5c81b05178880ea7f3ed666a2
5df29e6eee69c99aa0002547f3c7dd7d085d1ac6
/src/main/java/cn/gson/oasys/model/dao/mealdao/MealItemDao.java
0ed0f6f31aa9611154dabfdeed58ab28fc8862d4
[ "MIT" ]
permissive
raynoldfeng/oasys
43dbf2bcd24295662bff8341b038a2f74abc457e
ca498d14685eea1d017aca3f709d0f348555110e
refs/heads/master
2022-07-15T21:35:45.603049
2020-03-25T11:41:11
2020-03-25T11:41:11
249,337,594
0
0
MIT
2022-06-17T03:02:46
2020-03-23T04:44:24
JavaScript
UTF-8
Java
false
false
647
java
package cn.gson.oasys.model.dao.mealdao; import cn.gson.oasys.model.entity.meal.MealItem; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; import java.util.List; public interface MealItemDao extends JpaRepository<MealItem, Long> { List<MealItem> findByMealNameLike(String name); MealItem findByMealName(String name); @Query("delete from MealItem meal where meal.mealId= :mealId") @Modifying int deleteThis(@Param("mealId") Long mealId); }
[ "raynoldfeng@outlook.com" ]
raynoldfeng@outlook.com
6f8e148a326f972b8ce2acc4cf2ac1bb3009e159
e31d9fbb1eb3c70b15a8181cf0c0904821ab68e7
/Emulab/Quasi/cryptop2pvoting/src/protocol/communication/CRYPTO_PARTIAL_TALLY_MSG.java
b67eeb478851a160b1ca56ddcd63139c2ac75672
[]
no_license
harkous/decentralized-voting
c789ef4f0a388d4773e087a5792f227255313f49
0f847f9d9cbdae9ddcf04323095e74f4abed2d02
refs/heads/master
2021-01-10T11:38:15.775499
2011-07-17T19:49:50
2011-07-17T19:49:50
36,497,053
0
0
null
null
null
null
UTF-8
Java
false
false
854
java
package protocol.communication; import protocol.communication.Message; import runtime.executor.E_CryptoNodeID; //import OldVoting.Vote; import java.math.BigInteger; public class CRYPTO_PARTIAL_TALLY_MSG extends Message { private static final long serialVersionUID = 1L; private BigInteger tally; // private int groupId; public CRYPTO_PARTIAL_TALLY_MSG(E_CryptoNodeID src, E_CryptoNodeID dest, BigInteger tally) { super(Message.CRYPTO_PARTIAL_TALLY_MSG, src, dest); this.tally = tally; //this.groupId = groupId; } public BigInteger getTally() { return tally; } // public int getGroupId() { // return groupId; // } @Override public void doCopy(Message msg) { super.doCopy(msg); CRYPTO_PARTIAL_TALLY_MSG m = (CRYPTO_PARTIAL_TALLY_MSG) msg; tally = m.tally; // groupId = m.groupId; } }
[ "hamza.harkous@1b0ac59f-443c-9a03-9de1-560a821f9832" ]
hamza.harkous@1b0ac59f-443c-9a03-9de1-560a821f9832
939ca30f6dc536e10b144e6481a839df44be7aa2
4b0bf4787e89bcae7e4759bde6d7f3ab2c81f849
/aliyun-java-sdk-imm/src/main/java/com/aliyuncs/imm/model/v20200930/DetectImageCarsResponse.java
0a9dbc137bdbbd8afb0c72270f3110a7be44fe55
[ "Apache-2.0" ]
permissive
aliyun/aliyun-openapi-java-sdk
a263fa08e261f12d45586d1b3ad8a6609bba0e91
e19239808ad2298d32dda77db29a6d809e4f7add
refs/heads/master
2023-09-03T12:28:09.765286
2023-09-01T09:03:00
2023-09-01T09:03:00
39,555,898
1,542
1,317
NOASSERTION
2023-09-14T07:27:05
2015-07-23T08:41:13
Java
UTF-8
Java
false
false
5,002
java
/* * 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.aliyuncs.imm.model.v20200930; import java.util.List; import com.aliyuncs.AcsResponse; import com.aliyuncs.imm.transform.v20200930.DetectImageCarsResponseUnmarshaller; import com.aliyuncs.transform.UnmarshallerContext; /** * @author auto create * @version */ public class DetectImageCarsResponse extends AcsResponse { private String requestId; private List<CarsItem> cars; public String getRequestId() { return this.requestId; } public void setRequestId(String requestId) { this.requestId = requestId; } public List<CarsItem> getCars() { return this.cars; } public void setCars(List<CarsItem> cars) { this.cars = cars; } public static class CarsItem { private String carType; private Double carTypeConfidence; private String carColor; private Double carColorConfidence; private Double confidence; private List<LicensePlatesItem> licensePlates; private Boundary boundary; public String getCarType() { return this.carType; } public void setCarType(String carType) { this.carType = carType; } public Double getCarTypeConfidence() { return this.carTypeConfidence; } public void setCarTypeConfidence(Double carTypeConfidence) { this.carTypeConfidence = carTypeConfidence; } public String getCarColor() { return this.carColor; } public void setCarColor(String carColor) { this.carColor = carColor; } public Double getCarColorConfidence() { return this.carColorConfidence; } public void setCarColorConfidence(Double carColorConfidence) { this.carColorConfidence = carColorConfidence; } public Double getConfidence() { return this.confidence; } public void setConfidence(Double confidence) { this.confidence = confidence; } public List<LicensePlatesItem> getLicensePlates() { return this.licensePlates; } public void setLicensePlates(List<LicensePlatesItem> licensePlates) { this.licensePlates = licensePlates; } public Boundary getBoundary() { return this.boundary; } public void setBoundary(Boundary boundary) { this.boundary = boundary; } public static class LicensePlatesItem { private String content; private Double confidence; private Boundary1 boundary1; public String getContent() { return this.content; } public void setContent(String content) { this.content = content; } public Double getConfidence() { return this.confidence; } public void setConfidence(Double confidence) { this.confidence = confidence; } public Boundary1 getBoundary1() { return this.boundary1; } public void setBoundary1(Boundary1 boundary1) { this.boundary1 = boundary1; } public static class Boundary1 { private Long width; private Long height; private Long left; private Long top; public Long getWidth() { return this.width; } public void setWidth(Long width) { this.width = width; } public Long getHeight() { return this.height; } public void setHeight(Long height) { this.height = height; } public Long getLeft() { return this.left; } public void setLeft(Long left) { this.left = left; } public Long getTop() { return this.top; } public void setTop(Long top) { this.top = top; } } } public static class Boundary { private Long width; private Long height; private Long left; private Long top; public Long getWidth() { return this.width; } public void setWidth(Long width) { this.width = width; } public Long getHeight() { return this.height; } public void setHeight(Long height) { this.height = height; } public Long getLeft() { return this.left; } public void setLeft(Long left) { this.left = left; } public Long getTop() { return this.top; } public void setTop(Long top) { this.top = top; } } } @Override public DetectImageCarsResponse getInstance(UnmarshallerContext context) { return DetectImageCarsResponseUnmarshaller.unmarshall(this, context); } @Override public boolean checkShowJsonItemName() { return false; } }
[ "sdk-team@alibabacloud.com" ]
sdk-team@alibabacloud.com
232a2524cef888d6b21960b572f54d075da338d7
cf6ffb645f1d6fa5837beddd135749f4c1879056
/src/main/java/com/aokai/hospital/po/Carstation.java
f2f0e1c8b5237a6ad63d39fdc4243fffda57ad71
[]
no_license
KevinAo1997/hospital
ff74605a9ac1edc1712588b7000c418af5622293
d2ffaa22786625a8d5ea18c5de8005d07b2c2810
refs/heads/master
2022-07-17T03:27:30.688862
2020-04-05T08:45:08
2020-04-05T08:45:08
253,187,960
6
2
null
2022-06-21T03:08:51
2020-04-05T08:25:14
Java
UTF-8
Java
false
false
2,549
java
package com.aokai.hospital.po; import javax.persistence.*; @Table(name = "carstation") public class Carstation { @Id @Column(name = "c_id") private Integer cId; @Column(name = "c_name") private String cName; @Column(name = "c_location") private String cLocation; @Column(name = "c_description") private String cDescription; @Column(name = "c_total") private Integer cTotal; @Column(name = "c_code") private String cCode; @Column(name = "c_price") private Double cPrice; @Column(name = "c_pricetime") private Double cPricetime; /** * @return c_id */ public Integer getcId() { return cId; } /** * @param cId */ public void setcId(Integer cId) { this.cId = cId; } /** * @return c_name */ public String getcName() { return cName; } /** * @param cName */ public void setcName(String cName) { this.cName = cName == null ? null : cName.trim(); } /** * @return c_location */ public String getcLocation() { return cLocation; } /** * @param cLocation */ public void setcLocation(String cLocation) { this.cLocation = cLocation == null ? null : cLocation.trim(); } /** * @return c_description */ public String getcDescription() { return cDescription; } /** * @param cDescription */ public void setcDescription(String cDescription) { this.cDescription = cDescription == null ? null : cDescription.trim(); } /** * @return c_total */ public Integer getcTotal() { return cTotal; } /** * @param cTotal */ public void setcTotal(Integer cTotal) { this.cTotal = cTotal; } /** * @return c_code */ public String getcCode() { return cCode; } /** * @param cCode */ public void setcCode(String cCode) { this.cCode = cCode == null ? null : cCode.trim(); } /** * @return c_price */ public Double getcPrice() { return cPrice; } /** * @param cPrice */ public void setcPrice(Double cPrice) { this.cPrice = cPrice; } /** * @return c_pricetime */ public Double getcPricetime() { return cPricetime; } /** * @param cPricetime */ public void setcPricetime(Double cPricetime) { this.cPricetime = cPricetime; } }
[ "imaokai@163.com" ]
imaokai@163.com
9e0d75a8c5e5a862cf5571ee4ab25c0f3b4bf0ad
8e425de009ddadaefc3dd61b9084c0434e5fe0c7
/src/main/java/com/training/collection/StudentFruit.java
e285ef24cdc6268a0a51e978a7ba6eb2d2397d21
[]
no_license
AkashBorgalli/Collection-Assignments
cc621dbc7e1c6eb6fe996678ec6ee3f486dc50d1
ee2c3ede6c7a8b72c34b0c9438bf768770da3e0c
refs/heads/master
2021-07-21T01:53:15.617995
2019-11-22T08:43:50
2019-11-22T08:43:50
223,360,478
0
0
null
2020-10-13T17:39:54
2019-11-22T08:41:24
Java
UTF-8
Java
false
false
1,627
java
package com.training.collection; public class StudentFruit implements Comparable<StudentFruit> { private String name; private String favFruit; public StudentFruit(String name, String favFruit) { super(); this.name = name; this.favFruit = favFruit; } /** * @return the name */ public String getName() { return name; } /** * @param name the name to set */ public void setName(String name) { this.name = name; } /** * @return the favFruit */ public String getFavFruit() { return favFruit; } /** * @param favFruit the favFruit to set */ public void setFavFruit(String favFruit) { this.favFruit = favFruit; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((favFruit == null) ? 0 : favFruit.hashCode()); result = prime * result + ((name == null) ? 0 : name.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; StudentFruit other = (StudentFruit) obj; if (favFruit == null) { if (other.favFruit != null) return false; } else if (!favFruit.equals(other.favFruit)) return false; if (name == null) { if (other.name != null) return false; } else if (!name.equals(other.name)) return false; return true; } public int compareTo(StudentFruit o) { // TODO Auto-generated method stub return this.name.compareTo(o.name); } @Override public String toString() { return "StudentFruit [name=" + name + ", favFruit=" + favFruit + "]"; } }
[ "akash.borgalli@capgemini.com" ]
akash.borgalli@capgemini.com
53f3669c17ee75ed7d3ceacd0692c704ad6b3bd3
ef8de5da49854e745490766edc7bb1c58d09bfdc
/chapter05/chapter05.01/src/test/java/io/baselogic/springsecurity/service/UserContextTests.java
4c53d8a940fba9eb26afb174a4ef52713af595e5
[ "BSD-2-Clause" ]
permissive
fossabot/spring_security_course
e1e9a4d372adad206d4d305a7710234bbe7903d7
a81f82a054e85ce2a5376aed27806a4ff933f7cc
refs/heads/master
2021-03-15T00:03:23.893632
2020-03-12T10:16:51
2020-03-12T10:16:51
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,017
java
package io.baselogic.springsecurity.service; import io.baselogic.springsecurity.dao.TestUtils; import io.baselogic.springsecurity.domain.AppUser; import lombok.extern.slf4j.Slf4j; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.context.junit.jupiter.SpringExtension; import org.springframework.transaction.annotation.Transactional; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertThrows; /** * UserContextTests * * @since chapter1.00 * @since chapter4.02 Can only setCurrentUser() with a user that exist in the db. */ @ExtendWith(SpringExtension.class) @Transactional @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @Slf4j public class UserContextTests { @Autowired private UserContext userContext; private AppUser owner = new AppUser(); @BeforeEach public void beforeEachTest() { owner.setId(1); } @Test public void initJdbcOperations() { assertThat(userContext).isNotNull(); } @Test public void setCurrentUser() { // Not in the database: // userContext.setCurrentUser(TestUtils.TEST_APP_USER_1); userContext.setCurrentUser(TestUtils.APP_USER_1); AppUser appUser = userContext.getCurrentUser(); assertThat(appUser).isNotNull(); assertThat(appUser.getId()).isEqualTo(0); } @Test public void setCurrentUser_null_User() { assertThrows(NullPointerException.class, () -> { userContext.setCurrentUser(null); }); } @Test public void setCurrentUser_invalid_User() { assertThrows(IllegalArgumentException.class, () -> { userContext.setCurrentUser(new AppUser()); }); } } // The End...
[ "mickknutson@gmail.com" ]
mickknutson@gmail.com
8d08c9e2d251a8031cb71d32a25a972c3033dc5f
b7c694df75e0bc79b7cfdda03fe3256fa6da9d95
/src/main/java/pl/sdacademy/java14poz/sklep/Main.java
0ed027152bb6618a6ec9249f56f68106ba034f79
[ "MIT" ]
permissive
p-derezinski/java14
f76119a390a3925af23813d71879d728aa342a65
5ed23fcd78eeb349028ac6e03a01f757599ceed5
refs/heads/master
2020-04-08T04:45:13.383225
2018-12-15T13:54:43
2018-12-15T13:54:43
159,030,417
0
0
null
null
null
null
UTF-8
Java
false
false
2,489
java
package pl.sdacademy.java14poz.sklep; import pl.sdacademy.java14poz.obiekty.Kanapka; public class Main { public static void main(String[] args) { User user1 = new User("Jan", "Kowalski", 25); Kanapka kanapka5 = new Kanapka("szynka, ser, jalapeno", 3); System.out.println(kanapka5); // to jest rownowazne z zapisem System.out.println(kanapka5.toString()); System.out.println(user1.toString()); System.out.println(user1); Zamowienie zamowienie1 = new Zamowienie(1, 22.95); Zamowienie zamowienie2 = new Zamowienie(2, 5.20); Zamowienie zamowienie3 = new Zamowienie(3, 99.99); Zamowienie zamowienie4 = new Zamowienie(4, 35.63); Zamowienie zamowienie5 = new Zamowienie(5, 2.55); System.out.println(zamowienie1.toString()); System.out.println(zamowienie2.toString()); System.out.println(zamowienie3); System.out.println(zamowienie4.toString()); System.out.println(zamowienie5.toString()); float suma = zamowienie1.pobierzCena() + zamowienie2.pobierzCena() + zamowienie3.pobierzCena() + zamowienie4.pobierzCena() + zamowienie5.pobierzCena(); System.out.println("Suma zamówień wynosi: " + suma + " zł."); // System.out.printf(""); - uzupelnic!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! System.out.printf("Suma: %.2f zł", suma); System.out.println(); StringBuilder budujNapis = new StringBuilder(); budujNapis.append("======================\n"); budujNapis.append("=== Lista Zamówień ===\n"); budujNapis.append("======================\n"); //StringBuilder budujListeZamowien = new StringBuilder(); budujNapis.append('\t').append("-> ").append(zamowienie1.toString()).append('\n'); budujNapis.append('\t').append("-> ").append(zamowienie2).append('\n'); budujNapis.append('\t').append("-> ").append(zamowienie3).append('\n').append('\t').append("-> ").append(zamowienie4).append('\n'); budujNapis.append('\t').append("-> ").append(zamowienie5).append('\n'); budujNapis.append("======================\n"); budujNapis.append(String.format("Suma: %.2f zł\n", suma)); budujNapis.append("======================\n"); System.out.println(budujNapis.toString()); // albo mozna pominac toString(), bo jest domyslne //System.out.println("=============================================="); } }
[ "p.derezinski@gmail.com" ]
p.derezinski@gmail.com
869c830b9eb9b8919d56219d81633d511cbe3d0a
3d41214bec391b1775ac14debee5606a8302917d
/CodingBootcamp/src/test/java/com/CodingBootCamp/MeetingServiceTest.java
c83a49ce93be69efd4deb9352dfd86c3ce79e3b4
[]
no_license
adarshkcc/codingbootcamp_backend
61deed7523416688e53bee4abd58cac9a29d76db
3ddddeb19169292300b3af25d5c15ccdbf95a303
refs/heads/main
2023-06-04T16:58:45.732621
2021-06-26T04:59:52
2021-06-26T04:59:52
380,412,542
0
0
null
null
null
null
UTF-8
Java
false
false
2,973
java
package com.CodingBootCamp; import java.time.LocalDate; import java.time.LocalTime; import javax.transaction.Transactional; import org.junit.jupiter.api.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.CodingBootCamp.model.ScheduleMeeting; import com.CodingBootCamp.repository.ScheduleMeetingImpl; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest(webEnvironment=WebEnvironment.RANDOM_PORT) @Transactional class MeetingServiceTest { @Autowired private ScheduleMeetingImpl meetcon; @Test void validInputTest() { ScheduleMeeting m=new ScheduleMeeting(); m.setDate(LocalDate.of(2022, 5, 21)); m.setEnd_time(LocalTime.of(18, 20)); //m.setMeeting_link("https://zoom"); m.setStart_time(LocalTime.of(19, 20)); meetcon.scheduleMeeting(m); } @Test void ExpiredDateTest() { ScheduleMeeting m=new ScheduleMeeting(); m.setDate(LocalDate.of(2021, 5, 11)); //m.setMeeting_link("https://zoom"); m.setStart_time(LocalTime.of(19, 20)); m.setEnd_time(LocalTime.of(20, 20)); meetcon.scheduleMeeting(m); } @Test void SameStartAndEndTime() { ScheduleMeeting m=new ScheduleMeeting(); m.setDate(LocalDate.of(2021, 8, 11)); m.setEnd_time(LocalTime.of(18, 20)); //m.setMeeting_link("https://zoom"); m.setStart_time(LocalTime.of(18, 20)); meetcon.scheduleMeeting(m); } @Test void SameDate() { ScheduleMeeting m=new ScheduleMeeting(); m.setDate(LocalDate.of(2021, 5, 19)); m.setEnd_time(LocalTime.of(18, 20)); //m.setMeeting_link("https://zoom"); m.setStart_time(LocalTime.of(18, 20)); meetcon.scheduleMeeting(m); } @Test void InvalidEndTime() { ScheduleMeeting m=new ScheduleMeeting(); m.setDate(LocalDate.of(2021, 8, 11)); //m.setMeeting_link("https://zoom"); m.setStart_time(LocalTime.of(18, 20)); m.setEnd_time(LocalTime.of(16, 20)); meetcon.scheduleMeeting(m); } @Test void InvalidInput1() { ScheduleMeeting m=new ScheduleMeeting(); m.setDate(LocalDate.of(2021, 5, 20)); //m.setMeeting_link("https://zoom"); m.setStart_time(LocalTime.of(11, 20)); m.setEnd_time(LocalTime.of(14, 40)); meetcon.scheduleMeeting(m); } @Test void InvalidInput2() { ScheduleMeeting m=new ScheduleMeeting(); m.setDate(LocalDate.of(2021, 5, 20)); // m.setMeeting_link("https://zoom"); m.setStart_time(LocalTime.of(14, 20)); m.setEnd_time(LocalTime.of(18, 30)); meetcon.scheduleMeeting(m); } @Test void InvalidInput3() { ScheduleMeeting m=new ScheduleMeeting(); m.setDate(LocalDate.of(2021, 5, 20)); //m.setMeeting_link("https://zoom"); m.setStart_time(LocalTime.of(14, 20)); m.setEnd_time(LocalTime.of(19, 40)); meetcon.scheduleMeeting(m); } @Test void testGetMeetingDetails() { meetcon.getMeetingDetails(); } @Test void getMeetings() { meetcon.getMeetingDetails(); } }
[ "rajlovesskfc@gmail.com" ]
rajlovesskfc@gmail.com
1bcd73e21e90b2992b739083a025f092fdadae5e
4e105beb47dad7047067e7703217630163ecc2e2
/src/main/java/pet/taskplanner/dao/UserDAO.java
fa8f323b3a8c4a4bda3fc3e0c219f765a3f42ff4
[ "Apache-2.0" ]
permissive
Ielay/pet-task-planner
57f6ca9fdf5e016881481b182114ecdf0d619bf3
f83103c89677ad28653822d1e59c89f59f9f50f8
refs/heads/master
2023-03-03T16:20:25.234687
2021-02-07T21:47:27
2021-02-07T21:47:27
334,746,838
0
0
null
null
null
null
UTF-8
Java
false
false
480
java
package pet.taskplanner.dao; import org.jetbrains.annotations.Nullable; import pet.taskplanner.entity.User; import java.sql.SQLException; /** * @author lelay * @since 01.02.2021 */ public interface UserDAO { /** * @return true if user was saved */ boolean createUser(User newUser) throws SQLException; /** * @return found user or null if no user was found by specified email */ @Nullable User getUser(String email) throws Exception; }
[ "ielay@yandex.ru" ]
ielay@yandex.ru
d1fdd2476c8f493d485dfefedca2aa00a5725b16
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XRENDERING-418-38-28-NSGA_II-LineCoverage:ExceptionType:StackTraceSimilarity/org/xwiki/wysiwyg/server/filter/ConversionFilter_ESTest.java
15f02f83eec6f3f2706458cb685945b98b14e2ed
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
570
java
/* * This file was automatically generated by EvoSuite * Mon Apr 06 03:15:12 UTC 2020 */ package org.xwiki.wysiwyg.server.filter; import org.junit.Test; import static org.junit.Assert.*; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(useVFS = true, useJEE = true) public class ConversionFilter_ESTest extends ConversionFilter_ESTest_scaffolding { @Test public void notGeneratedAnyTest() { // EvoSuite did not generate any tests } }
[ "pouria.derakhshanfar@gmail.com" ]
pouria.derakhshanfar@gmail.com
9f1f782e918b7d03a19bf48c5539f0d015e355e6
62252fa3bffece092c2467354c0f232cbc1c6857
/producer/src/main/java/com/cris/producer/bean/Contact.java
57ffb9eae205146ce98162ad9cec6680a98a3933
[]
no_license
sinkibo/china-unicom
61cafdadb4c2e01276bfee844fbbf237eca06186
e46a46a2d1d549515391322a38bcbc4a2528de5c
refs/heads/master
2020-06-12T16:21:24.502040
2018-12-09T11:30:00
2018-12-09T11:30:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
745
java
package com.cris.bean; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; /** * 通讯录联系人对象 * * @author cris * @version 1.0 **/ @Data @AllArgsConstructor @NoArgsConstructor @Accessors(chain = true) public class Contact implements Val<String> { private String name; private String tel; @Override public String getValue() { return this.toString(); } /** * javaBean 为自己设置数据的具体转换逻辑 * * @param s 存储的数据 */ @Override public void setValue(String s) { String[] split = s.split("\t"); this.tel = split[0]; this.name = split[1]; } }
[ "17623887386@163.com" ]
17623887386@163.com
8e5f87523201a445b4c4ded6e330551b0303bf30
a30d884c768928e2f406fad999471c8369c4dc0d
/src/main/java/실전예제/Item.java
d4529a605326b7b7a591b6399074d571ee8b4593
[]
no_license
0stein/JPA-STUDY
bc82c2d63a7ad197e4c92b0a04ebe0c2d057a67b
6edfff5b551e22f77d0d353a6da04e81bf51d3a3
refs/heads/master
2023-01-05T20:10:26.670734
2020-11-10T16:49:10
2020-11-10T16:49:10
311,681,199
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
784
java
package ½ÇÀü¿¹Á¦; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.Id; @Entity public class Item { @Id @GeneratedValue @Column(name = "ITEM_ID") private Long id; private String name; private int price; private int stockQuantity; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getPrice() { return price; } public void setPrice(int price) { this.price = price; } public int getStockQuantity() { return stockQuantity; } public void setStockQuantity(int stockQuantity) { this.stockQuantity = stockQuantity; } }
[ "aad336645@gmail.com" ]
aad336645@gmail.com
07d5c59b3c707494258c180bb1ac6673b658b75a
bbab9caee718e1cdd11fed37ca8f8e5778c08a05
/app/src/main/java/cc/eevee/turbo/ui/base/BaseDialogFragment.java
494e4c5c23d833b62be15798d6a32f6d045a8cde
[ "Apache-2.0" ]
permissive
joinAero/DroidTurbo
5a728141aea6cdc6e01fd09e675c457836d82c82
921a6cc250301e6d873063c5a9e6128fb19fd71f
refs/heads/master
2020-04-07T04:08:57.041960
2018-07-30T07:06:01
2018-07-30T07:06:01
48,672,302
1
0
null
null
null
null
UTF-8
Java
false
false
139
java
package cc.eevee.turbo.ui.base; import android.support.v4.app.DialogFragment; public class BaseDialogFragment extends DialogFragment { }
[ "join.aero@gmail.com" ]
join.aero@gmail.com
310887793da36128477bb8320d627c94587769d1
0094b5d10888b72c9d0a3b0b27072e412140ee64
/src/main/java/com/jeeplus/modules/travelorder/entity/TravelOrder.java
12f8cd4aa868b7bea73a2d35eeb4b8cb6403efdf
[]
no_license
konglingjuanyi/IVMS
cf4c93c4f5a96bb889cedc28fdff533af4e89f12
1cf90d2d597fc3d922aa48d978201f99c2e6ecd4
refs/heads/master
2021-01-16T00:09:00.532371
2016-04-08T02:47:23
2016-04-08T02:47:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,833
java
/** * Copyright &copy; 2015-2020 <a href="--版权信息--">JeePlus</a> All rights reserved. */ package com.jeeplus.modules.travelorder.entity; import org.hibernate.validator.constraints.Length; import com.jeeplus.common.persistence.DataEntity; import com.jeeplus.common.utils.excel.annotation.ExcelField; import com.jeeplus.modules.car.entity.Car; import com.jeeplus.modules.sys.entity.Area; import com.jeeplus.modules.sys.entity.User; /** * 旅行单管理Entity * @author zhangxian * @version 2016-03-01 */ public class TravelOrder extends DataEntity<TravelOrder> { private static final long serialVersionUID = 1L; private String orderName; // 订单名称 // private String startAddress; // 出发地 // private String endAddress; // 目的地 public static final String STATUS_ON_ROAD = "1"; public static final String STATUS_FREE = "0"; private Area startAddress; private Area endAddress; private String peopleNum; // 人数 private String startTime; // 开始时间 private String endTime; // 结束时间 private String status; // 状态 private Car car; private User user; public User getUser() { return user; } public void setUser(User user) { this.user = user; } public Car getCar() { return car; } public void setCar(Car car) { this.car = car; } public TravelOrder() { super(); } public TravelOrder(String id){ super(id); } @Length(min=0, max=64, message="订单名称长度必须介于 0 和 64 之间") @ExcelField(title="订单名称", align=2, sort=7) public String getOrderName() { return orderName; } public Area getStartAddress() { return startAddress; } public void setStartAddress(Area startAddress) { this.startAddress = startAddress; } public Area getEndAddress() { return endAddress; } public void setEndAddress(Area endAddress) { this.endAddress = endAddress; } public void setOrderName(String orderName) { this.orderName = orderName; } @Length(min=0, max=64, message="人数长度必须介于 0 和 64 之间") @ExcelField(title="人数", align=2, sort=10) public String getPeopleNum() { return peopleNum; } public void setPeopleNum(String peopleNum) { this.peopleNum = peopleNum; } @ExcelField(title="开始时间", align=2, sort=11) public String getStartTime() { return startTime; } public void setStartTime(String startTime) { this.startTime = startTime; } @ExcelField(title="结束时间", align=2, sort=12) public String getEndTime() { return endTime; } public void setEndTime(String endTime) { this.endTime = endTime; } @Length(min=0, max=64, message="状态长度必须介于 0 和 64 之间") @ExcelField(title="状态", align=2, sort=13) public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } }
[ "295896027@qq.com" ]
295896027@qq.com
aeea920e23af6d5cf4d0c6ae396d9de016774f54
6c1f66bc05824c191c071aa57fc4ec018f63929c
/src/ListaEncadeada.java
4c2484f3963b90b4f12eb4d78c70dd62eaa9af07
[]
no_license
LeviSilvaz99/Estrutura-de-Dados-
83a11406e07336a7e8d259b87181e4410c7e6810
5aa74c58c782a94196dcc1384e07d1f520c0c86f
refs/heads/master
2022-12-12T22:39:44.199687
2020-09-01T14:35:27
2020-09-01T14:35:27
292,013,573
0
0
null
null
null
null
UTF-8
Java
false
false
410
java
public class ListaEncadeada { private int elemento; private ListaEncadeada proximo; public void setElemento(int elemento){ this.elemento = elemento; } public int getElemento(){ return this.elemento; } public void setProximo(ListaEncadeada proximo){ this.proximo = proximo; } public ListaEncadeada getProximo(){ return this.proximo; } }
[ "57275766+LeviSilvaz99@users.noreply.github.com" ]
57275766+LeviSilvaz99@users.noreply.github.com
d2f09a5b0be8c81080a5c8e7b158b5f6fd04c25f
c3cc65d1a5dadcfb1636385ebe881928f9128f7f
/app/src/androidTest/java/com/scy/android/xjd_scyintership/ExampleInstrumentedTest.java
1997cff998bf867183645b27174c19213806d8e0
[]
no_license
scygh/xjd_scyintership
65c868e538bb6a7e50f1d0a46bbc879340fce5e1
7f6ce4fcb4648f963db05e551493da23c69fe146
refs/heads/master
2020-05-28T08:58:48.201725
2019-05-28T03:42:51
2019-05-28T03:42:51
188,948,863
0
0
null
null
null
null
UTF-8
Java
false
false
748
java
package com.scy.android.xjd_scyintership; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.runner.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getTargetContext(); assertEquals("com.scy.android.xjd_scyintership", appContext.getPackageName()); } }
[ "1797484636@qq.com" ]
1797484636@qq.com
55a17bd63531c7087748eb770ef05c2985ad3a0a
a422de59c29d077c512d66b538ff17d179cc077a
/hsxt/hsxt-tc/hsxt-tc-batchService/src/main/java/com/gy/hsxt/tc/batch/runnable/callback/DataHandler4bsgpBS.java
319a5dd68a4ee3c4d807cf97cf58cfe250ba914e
[]
no_license
liveqmock/hsxt
c554e4ebfd891e4cc3d57e920d8a79ecc020b4dd
40bb7a1fe5c22cb5b4f1d700e5d16371a3a74c04
refs/heads/master
2020-03-28T14:09:31.939168
2018-09-12T10:20:46
2018-09-12T10:20:46
148,461,898
0
0
null
2018-09-12T10:19:11
2018-09-12T10:19:10
null
UTF-8
Java
false
false
2,052
java
/* * Copyright (c) 2015-2018 SHENZHEN GUIYI SCIENCE AND TECHNOLOGY DEVELOP CO., LTD. All rights reserved. * * 注意:本内容仅限于深圳市归一科技研发有限公司内部传阅,禁止外泄以及用于其他的商业目的 */ /* * Copyright (c) 2015-2018 SHENZHEN GUIYI SCIENCE AND TECHNOLOGY DEVELOP CO., LTD. All rights reserved. * * 注意:本内容仅限于深圳市归一科技研发有限公司内部传阅,禁止外泄以及用于其他的商业目的 */ package com.gy.hsxt.tc.batch.runnable.callback; import org.springframework.data.redis.core.RedisTemplate; import com.gy.hsxt.tc.batch.mapper.TcBsgpPayMapper; /** * BSGP对账之BS端数据文件内容拆解及入库 * * @Package: com.gy.hsxt.tc.batch.runnable.callback * @ClassName: DataHandler4bsgpBS * @Description: TODO * * @author: lvyan * @date: 2015-11-13 下午2:18:48 * @version V1.0 */ public class DataHandler4bsgpBS extends DataHandlerAbstract { /** * 账单入库表 */ public static final String MY_TABLE = "T_TC_BSGP_PAY_BS_TMP"; /** * 账单入库表字段 (与数据文件字段顺序保持一致): 业务订单号|订单货币金额|订单时间|支付状态 */ public static final String[] MY_COLUMNS = { "BS_ORDER_NO", "BS_TRANS_AMOUNT", "BS_TRANS_DATE", "BS_TRANS_STATUS" }; public DataHandler4bsgpBS(TcBsgpPayMapper batchMapper, RedisTemplate redisTemplate) { super(batchMapper, redisTemplate, MY_TABLE, MY_COLUMNS); } /** * 生成对账要素 * * @param args * 一行数据 * @return */ public String generateCheckKey(String[] args) { // 对账文件字段: 业务订单号|订单货币金额|订单时间|支付状态 // BS-GP 对账要素:业务订单号|订单货币金额|支付状态 StringBuilder sb = new StringBuilder(); sb.append(args[0]).append("|"); sb.append(args[1]).append("|"); sb.append(args[3]); return sb.toString(); } }
[ "864201042@qq.com" ]
864201042@qq.com
885d92ad900b91c800fac06ff07b5c4796123311
d4af7dca9e0fc10f0ab8b4aa3710b1511c2960a5
/app/src/main/java/com/example/zeeshan/bibliotecasqlite/Utilidades/Utilidades.java
97127b6eea47bd6219de357475d5d80aae71173b
[]
no_license
ZeshanWD/BibliotecaSQLite
c49c51f645fdae6b7a8a26938ea6405a0f12a0d1
b2c5981c8db2ca57ff5ed30a57ef6c1aec698388
refs/heads/master
2021-04-29T14:48:39.286393
2018-02-22T19:41:42
2018-02-22T19:41:42
121,782,736
0
0
null
null
null
null
UTF-8
Java
false
false
763
java
package com.example.zeeshan.bibliotecasqlite.Utilidades; /** * Created by zeeshan on 24/01/2018. */ public class Utilidades { // Constantes de campos de la tabla public static final String TABLA_LIBROS = "libros"; public static final String CAMPO_ID = "_id"; public static final String CAMPO_CODIGO = "codigo"; public static final String CAMPO_TITULO = "titulo"; public static final String CAMPO_AUTOR = "autor"; public static final String CAMPO_COMENTARIO = "comentario"; public static final String CREAR_TABLA = "CREATE TABLE " + TABLA_LIBROS + " (" + CAMPO_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, " + CAMPO_CODIGO + " INTEGER, " + CAMPO_TITULO + " TEXT, " + CAMPO_AUTOR + " TEXT, " + CAMPO_COMENTARIO + " TEXT)"; }
[ "zeeshan9choudhary@gmail.com" ]
zeeshan9choudhary@gmail.com
06c83955280022215964ec6fd22612b63a45ff58
683fd12ef87df36cf63bc3446f91bb71fe3723e7
/IntJoukkoSovellus/src/test/java/ohtu/intjoukkosovellus/IntJoukkoKaksiparametrisellaKonstruktorillaTest.java
3fe8a3c302b9a01b7332ca6b09d1dee66f3d7ba6
[]
no_license
moversti/jocular-octo-wookie
cdc151eb974a50196da63a674bdca493b08f3af3
9a0bd7c34dc3eaa73279580ca8855abd9a952cc1
refs/heads/master
2021-01-10T06:12:13.360253
2015-10-09T06:51:39
2015-10-09T06:51:39
43,884,219
0
0
null
null
null
null
UTF-8
Java
false
false
290
java
package ohtu.intjoukkosovellus; import org.junit.Before; public class IntJoukkoKaksiparametrisellaKonstruktorillaTest extends IntJoukkoTest { @Before public void setUp() { joukko = new IntJoukko(4, 2); joukko.lisaa(10); joukko.lisaa(3); } }
[ "mikko.oversti@helsinki.fi" ]
mikko.oversti@helsinki.fi
6f2b444d792d950edd8e55e1a46931a229abe463
3b127fe37872f89351d1c8689f96b2f5102e91a3
/ReportCard/app/src/main/java/com/example/smuh4/reportcard/ui.java
788d03d92c7394b3f8fd76f65405fc2804ea2346
[]
no_license
zeeshanahmed1/nano
030f799152e874b098384a6fe415befa963c3fe7
f55aa28bd300ef6e281e5d84a3395f188564566f
refs/heads/master
2020-12-31T03:15:37.701997
2016-09-18T10:43:16
2016-09-18T10:43:16
68,514,911
0
0
null
null
null
null
UTF-8
Java
false
false
329
java
package com.example.smuh4.reportcard; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class ui extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_ui); } }
[ "zeeshan ahmed" ]
zeeshan ahmed
977aaa29888bd857948d8a1fe961981f5048ca91
8b6081d7fe115bb7c0438160d8893b4c57a62f70
/src/main/java/com/store/dao/ProductsuborderlinkMapper.java
00f2cd778db708a55ab77a5db8e7de5edbbc3abe
[]
no_license
aikuangyong/store
947d4488e71c9888b5b6dec934f3bf739b74dc49
3c9ba6c89caa13f3eec10296043067250c834c46
refs/heads/master
2023-04-06T05:33:37.630258
2021-04-02T03:12:11
2021-04-02T03:12:11
353,893,081
0
0
null
null
null
null
UTF-8
Java
false
false
682
java
package com.store.dao; import com.store.model.ProductsuborderlinkModel; import org.springframework.stereotype.Repository; import java.util.List; @Repository("productsuborderlinkDao") public interface ProductsuborderlinkMapper { public List<ProductsuborderlinkModel> getList(ProductsuborderlinkModel model); public int getCount(ProductsuborderlinkModel model); public void insert(ProductsuborderlinkModel model); public void batchInsert(List<ProductsuborderlinkModel> dataList); public void update(ProductsuborderlinkModel model); public void disableOrEnable(ProductsuborderlinkModel model); public void delete(ProductsuborderlinkModel model); }
[ "15016726180@139.com" ]
15016726180@139.com
4a0dc73f5baf218e9a873f28cee052b8bf7aa510
11ebccff85b719be419654dea410561cb1b5552f
/javaProgramming/src/ch18/exam18/client/ClientExample.java
86440b7bc2ce4b935cbd90b768359a30c8593516
[]
no_license
parkhyuntae12/MyRepository
f93433032933324280ef98ed2e3c5455ba2a54ea
bb09eb08c81f66922d3a3157037319579ee20179
refs/heads/master
2020-12-03T10:19:32.432964
2016-12-12T01:44:51
2016-12-12T01:44:51
66,317,335
0
0
null
null
null
null
UHC
Java
false
false
1,467
java
package ch18.exam18.client; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.PrintStream; import java.io.Reader; import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketAddress; import java.util.Scanner; public class ClientExample { public static void main(String[] args) { // TODO Auto-generated method stub //소켓생성 Socket socket = new Socket(); try { //연결요청하기 SocketAddress sa = new InetSocketAddress("192.168.0.9",5001); socket.connect(sa); System.out.println("[서버와 연결됨]"); //보낼 데이터를 키보드로부터 읽기 Scanner scanner = new Scanner(System.in); System.out.print("보낼 데이터 : "); String data = scanner.nextLine(); //서버로 데이터를 보내기 OutputStream os = socket.getOutputStream(); PrintStream ps = new PrintStream(os); ps.println(data); ps.flush(); //서버에서 보낸 데이터를 읽기 InputStream is = socket.getInputStream(); Reader reader = new InputStreamReader(is); BufferedReader br = new BufferedReader(reader); data = br.readLine(); System.out.println(data); } catch (IOException e) { e.printStackTrace(); } //서버의 연결을 끊음 try { socket.close(); } catch (IOException e) {} } }
[ "Administrator@COM-PC" ]
Administrator@COM-PC
7f52b15d3e671c1bfda3a0291b244a42915937dc
6eff6d5a38a09886d3a851f93d88c1e1a507d5b3
/src/com/keer/core/bean/model/EditorChildHidden.java
010f267004598562dbc899aadd48ee2d6338fdfa
[]
no_license
KenySee/Ext4JXC
95b7eef76f77584e71c1defa25e0cc2410834e29
acaa3d022e05a345af5371e96657446572558506
refs/heads/master
2021-08-22T13:41:03.478153
2017-11-30T09:50:53
2017-11-30T09:50:53
103,358,881
1
0
null
null
null
null
UTF-8
Java
false
false
1,489
java
package com.keer.core.bean.model; import java.util.ArrayList; import java.util.List; import javax.persistence.Entity; import net.sf.json.JSONObject; import com.keer.core.annotation.Description; @Entity @Description(Name="集合隐藏列",Group="Keer.widget.field.CollectionColumn",Desc="widget-field-collectioncolumn") @SuppressWarnings("serial") public class EditorChildHidden extends EditorHidden { private String parentProp; @Override public String toConfig(ModelDesc desc) { JSONObject config = new JSONObject(); config.accumulate("xtype", this.AsString("widget-field-collectioncolumn")); if (parentProp == null || "".equals(parentProp) || "null".equals(parentProp)){ parentProp = "parent"; } config.accumulate("parentProp", this.AsString(parentProp)); Widget widget = this.getXcontainer(); if (widget != null){ config.accumulate("xcontainer",this.AsString(widget.getAliasname())); } return config.toString(); } @Override public List<String> toRequires() { List<String> list = new ArrayList<String>(); list.add("Keer.widget.field.CollectionColumn"); Widget xcontainer = this.getXcontainer(); if (xcontainer != null){ list.add(xcontainer.getClassname()); } Widget childStore = this.getChildStore(); if (childStore != null){ list.add(childStore.getClassname()); } return list; } public String getParentProp() { return parentProp; } public void setParentProp(String parentProp) { this.parentProp = parentProp; } }
[ "KenySee@126.com" ]
KenySee@126.com
ddde201ceca799f414223ad10c61c9d360cc821c
b5365904737296ec5cb06c090aa82fdfd14ff512
/com/google/android/gms/internal/bs.java
024d1d40d38575affa95b9d0259174c04c9f028a
[]
no_license
Ravinther/alarmclock
80b8a2206c4309aae4481724c7f1dd03d5638023
3ba5aee4e0c10487ec67bb238a2a06a0a3b182b8
refs/heads/master
2021-01-19T02:33:57.314201
2016-08-11T16:27:54
2016-08-11T16:27:54
65,484,422
0
0
null
null
null
null
UTF-8
Java
false
false
7,122
java
package com.google.android.gms.internal; import android.os.Binder; import android.os.IBinder; import android.os.IInterface; import android.os.Parcel; import com.mopub.mobileads.C2625R; import com.mopub.mobileads.util.Base64; public interface bs extends IInterface { /* renamed from: com.google.android.gms.internal.bs.a */ public static abstract class C1760a extends Binder implements bs { /* renamed from: com.google.android.gms.internal.bs.a.a */ private static class C1767a implements bs { private IBinder kn; C1767a(IBinder iBinder) { this.kn = iBinder; } public void m7942P() { Parcel obtain = Parcel.obtain(); Parcel obtain2 = Parcel.obtain(); try { obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.IMediationAdapterListener"); this.kn.transact(1, obtain, obtain2, 0); obtain2.readException(); } finally { obtain2.recycle(); obtain.recycle(); } } public IBinder asBinder() { return this.kn; } public void onAdClosed() { Parcel obtain = Parcel.obtain(); Parcel obtain2 = Parcel.obtain(); try { obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.IMediationAdapterListener"); this.kn.transact(2, obtain, obtain2, 0); obtain2.readException(); } finally { obtain2.recycle(); obtain.recycle(); } } public void onAdFailedToLoad(int error) { Parcel obtain = Parcel.obtain(); Parcel obtain2 = Parcel.obtain(); try { obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.IMediationAdapterListener"); obtain.writeInt(error); this.kn.transact(3, obtain, obtain2, 0); obtain2.readException(); } finally { obtain2.recycle(); obtain.recycle(); } } public void onAdLeftApplication() { Parcel obtain = Parcel.obtain(); Parcel obtain2 = Parcel.obtain(); try { obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.IMediationAdapterListener"); this.kn.transact(4, obtain, obtain2, 0); obtain2.readException(); } finally { obtain2.recycle(); obtain.recycle(); } } public void onAdLoaded() { Parcel obtain = Parcel.obtain(); Parcel obtain2 = Parcel.obtain(); try { obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.IMediationAdapterListener"); this.kn.transact(6, obtain, obtain2, 0); obtain2.readException(); } finally { obtain2.recycle(); obtain.recycle(); } } public void onAdOpened() { Parcel obtain = Parcel.obtain(); Parcel obtain2 = Parcel.obtain(); try { obtain.writeInterfaceToken("com.google.android.gms.ads.internal.mediation.client.IMediationAdapterListener"); this.kn.transact(5, obtain, obtain2, 0); obtain2.readException(); } finally { obtain2.recycle(); obtain.recycle(); } } } public C1760a() { attachInterface(this, "com.google.android.gms.ads.internal.mediation.client.IMediationAdapterListener"); } public static bs m7908k(IBinder iBinder) { if (iBinder == null) { return null; } IInterface queryLocalInterface = iBinder.queryLocalInterface("com.google.android.gms.ads.internal.mediation.client.IMediationAdapterListener"); return (queryLocalInterface == null || !(queryLocalInterface instanceof bs)) ? new C1767a(iBinder) : (bs) queryLocalInterface; } public IBinder asBinder() { return this; } public boolean onTransact(int code, Parcel data, Parcel reply, int flags) { switch (code) { case Base64.NO_PADDING /*1*/: data.enforceInterface("com.google.android.gms.ads.internal.mediation.client.IMediationAdapterListener"); m7907P(); reply.writeNoException(); return true; case Base64.NO_WRAP /*2*/: data.enforceInterface("com.google.android.gms.ads.internal.mediation.client.IMediationAdapterListener"); onAdClosed(); reply.writeNoException(); return true; case C2625R.styleable.WalletFragmentStyle_buyButtonAppearance /*3*/: data.enforceInterface("com.google.android.gms.ads.internal.mediation.client.IMediationAdapterListener"); onAdFailedToLoad(data.readInt()); reply.writeNoException(); return true; case Base64.CRLF /*4*/: data.enforceInterface("com.google.android.gms.ads.internal.mediation.client.IMediationAdapterListener"); onAdLeftApplication(); reply.writeNoException(); return true; case C2625R.styleable.WalletFragmentStyle_maskedWalletDetailsHeaderTextAppearance /*5*/: data.enforceInterface("com.google.android.gms.ads.internal.mediation.client.IMediationAdapterListener"); onAdOpened(); reply.writeNoException(); return true; case C2625R.styleable.WalletFragmentStyle_maskedWalletDetailsBackground /*6*/: data.enforceInterface("com.google.android.gms.ads.internal.mediation.client.IMediationAdapterListener"); onAdLoaded(); reply.writeNoException(); return true; case 1598968902: reply.writeString("com.google.android.gms.ads.internal.mediation.client.IMediationAdapterListener"); return true; default: return super.onTransact(code, data, reply, flags); } } } void m7907P(); void onAdClosed(); void onAdFailedToLoad(int i); void onAdLeftApplication(); void onAdLoaded(); void onAdOpened(); }
[ "m.ravinther@yahoo.com" ]
m.ravinther@yahoo.com
03c1e122096a8228151d6b642377475aea26bfba
4d8c843b1bedeb22f04d47d8a1943232a6f95319
/src/main/java/com/mobei/Application.java
48f702186cf5e146402db356988abbbe36be6b76
[]
no_license
langying/shop-h5
9a60b58e4d30a159b582006ce78e9ff604b7da82
bb94b61f0ebdbfef49787d8ee709c7ac3f5fa6ce
refs/heads/master
2022-07-24T05:36:24.082634
2020-03-02T07:21:08
2020-03-02T07:21:08
244,305,098
0
0
null
2022-06-17T02:57:56
2020-03-02T07:16:29
Java
UTF-8
Java
false
false
1,094
java
package com.mobei; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.Banner; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.support.SpringBootServletInitializer; import org.springframework.cache.annotation.EnableCaching; @SpringBootApplication @EnableCaching @MapperScan(basePackages = {"com.mobei.app.dao"}) public class Application extends SpringBootServletInitializer{ /** */ @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { //return application.sources(Application.class); application.bannerMode(Banner.Mode.OFF); return application.sources(Application.class); } public static void main(String[] args) { //SpringApplication.run(Application.class, args); SpringApplication application = new SpringApplication(Application.class); application.setBannerMode(Banner.Mode.OFF); application.run(args); } }
[ "465192597@qq.com" ]
465192597@qq.com
fae68076b08cafe825b405996584df539a0e7ba9
e7e497b20442a4220296dea1550091a457df5a38
/java_workplace/renren_web_framework/lab/wsep/lwb/trunk/src/lwb/test/servlet/ReadTestServlet.java
affdffa2d0ee508cbd9b00edcfa77aed89c1d884
[]
no_license
gunner14/old_rr_code
cf17a2dedf8dfcdcf441d49139adaadc770c0eea
bb047dc88fa7243ded61d840af0f8bad22d68dee
refs/heads/master
2021-01-17T18:23:28.154228
2013-12-02T23:45:33
2013-12-02T23:45:33
null
0
0
null
null
null
null
UTF-8
Java
false
false
594
java
package lwb.test.servlet; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class ReadTestServlet extends BaseTestServlet { private static final long serialVersionUID = 1L; @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { //do nothing } @Override protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { doGet(req, resp); } }
[ "liyong19861014@gmail.com" ]
liyong19861014@gmail.com
ad62d6ca48ca8d4556da954418f324760e0c1d1f
cd67d5140bfeed455118699cebd2b7322d17c119
/patient - android_app/app/src/main/java/com/example/vinid/KhamBenh.java
566cc2faace802b4d301077af56cab76e8945f75
[]
no_license
niku98/hackathon
86d0240bb1c8302faefe4fc921b88e3964c7d573
b320e146f98ad9d6eaa1f7f909ecdd54f00958a7
refs/heads/master
2023-01-22T16:47:39.040743
2019-09-08T10:09:36
2019-09-08T10:09:36
206,798,596
0
0
null
2023-01-04T09:23:41
2019-09-06T13:21:56
CSS
UTF-8
Java
false
false
9,351
java
package com.example.vinid; import androidx.appcompat.app.AppCompatActivity; import androidx.core.app.NotificationCompat; import androidx.core.app.NotificationManagerCompat; import android.app.NotificationManager; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.os.Build; import android.os.Bundle; import android.os.NetworkOnMainThreadException; import android.os.VibrationEffect; import android.os.Vibrator; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import com.android.volley.DefaultRetryPolicy; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import com.github.nkzawa.emitter.Emitter; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; public class KhamBenh extends AppCompatActivity { ArrayList<Benh> listBenh = new ArrayList<Benh>(); ArrayList<String> listKhoa = new ArrayList<String>(); Intent itentQueue; String name = "", id = ""; String stt; String sessionId; SocketIO socketIO; TextView tv_test; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_kham_benh); getSupportActionBar().hide(); init(); } private void init() { getListBenh(); itentQueue = new Intent(this, ShowQueue.class); sessionId = getIntent().getStringExtra("EXTRA_SESSION_ID"); final ListView listView = findViewById(R.id.listView); ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, listKhoa); listView.setAdapter(arrayAdapter); socketIO = new SocketIO(onNewMessage, onNewConnect, onNewNotify); listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> a, View v, int position, long id) { try { final String idBenh = listBenh.get(position).getId(); final String url = "http://203.162.13.40/sick_submit?sick_id=" + idBenh + "&user_id=" + sessionId; RequestQueue requestQueue = Volley.newRequestQueue(getApplicationContext()); StringRequest stringRequest = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() { @Override public void onResponse(String response) { try { JSONObject jsonObject = new JSONObject(response); JSONObject jsonRoom = jsonObject.getJSONObject("Room"); JSONObject jsonFaculty = jsonObject.getJSONObject("Faculty"); JSONObject jsonNumber = jsonObject.getJSONObject("number_queue"); itentQueue.putExtra("ROOM", jsonRoom.getString("Number")); itentQueue.putExtra("FACULTY", jsonFaculty.getString("Name")); itentQueue.putExtra("NUMBER", jsonNumber.getString("count")); SharedPreferences sharedPreferences = getSharedPreferences("Profile", Context.MODE_PRIVATE); SharedPreferences.Editor editor = sharedPreferences.edit(); editor.putString("IDQUEUE", jsonObject.getString("id")); editor.commit(); startActivity(itentQueue); } catch (JSONException e) { e.printStackTrace(); } // Toast.makeText(KhamBenh.this, response, Toast.LENGTH_LONG).show(); } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { Toast.makeText(KhamBenh.this, "Didn't work", Toast.LENGTH_LONG).show(); } }); DefaultRetryPolicy retryPolicy = new DefaultRetryPolicy(0, -1, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT); stringRequest.setRetryPolicy(retryPolicy); requestQueue.add(stringRequest); } catch (Exception e) { e.printStackTrace(); } } }); } public Emitter.Listener onNewMessage = new Emitter.Listener() { @Override public void call(final Object... args) { runOnUiThread(new Runnable() { @Override public void run() { JSONObject data = (JSONObject) args[0]; //switch (){ //Toast.makeText(SocketIO.this, data.toString(), Toast.LENGTH_LONG).show(); Log.d("Respon", data.toString()); } }); } }; public Emitter.Listener onNewConnect = new Emitter.Listener() { @Override public void call(final Object... args) { runOnUiThread(new Runnable() { @Override public void run() { socketIO.detectUser(sessionId); } }); } }; public Emitter.Listener onNewNotify = new Emitter.Listener() { @Override public void call(final Object... args) { runOnUiThread(new Runnable() { @Override public void run() { JSONObject data = (JSONObject) args[0]; Toast.makeText(KhamBenh.this, data.toString(), Toast.LENGTH_LONG).show(); Log.d("NewNotif", data.toString()); try { stt = data.getString("stt"); final String CHANNEL_ID = "channel_id"; NotificationHelper notificationHelper = new NotificationHelper(KhamBenh.this); notificationHelper.createNotification("BỆNH VIỆN THÔNG BÁO", "Còn + " + stt + " người nữa là tới lượt bạn"); } catch (JSONException e) { e.printStackTrace(); } } }); } }; private void getListBenh() { { Thread t = new Thread(new Runnable() { public void run() { try { HttpClient httpClient = new DefaultHttpClient(); HttpGet httpPost = new HttpGet("http://203.162.13.40/get_sick"); HttpResponse response = httpClient.execute(httpPost); BufferedReader reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent(), "UTF-8")); String response_body = reader.readLine(); JSONArray jsonArray = new JSONArray(response_body); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); name = jsonObject.getString("name"); id = jsonObject.getString("id"); listKhoa.add(name); Benh benh = new Benh(id, name); listBenh.add(benh); } } catch (IOException e) { System.out.println(e); } catch (NetworkOnMainThreadException e) { System.out.println(e); } catch (JSONException e) { e.printStackTrace(); } } }); t.start(); try { t.join(); } catch (InterruptedException e) { e.printStackTrace(); } } } private void Viberation() { Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); // Vibrate for 500 milliseconds if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { v.vibrate(VibrationEffect.createOneShot(1000, VibrationEffect.DEFAULT_AMPLITUDE)); } else { //deprecated in API 26 v.vibrate(500); } } }
[ "phammanh.1221998@gmail.com" ]
phammanh.1221998@gmail.com
ed5971ab0bb4086bd0fa0a369b265c319e8abf3e
19989ad71f45ee2e1d182183a78a93530acc49b7
/Java Web/Spring MVC/Thymeleaf and Controllers/residentevil/src/main/java/org/softuni/residentevil/domain/model/service/VirusServiceModel.java
dc0fc0c3173451abaad5537ce4d24c9d9b88c6e8
[]
no_license
goldenEAGL3/SoftUni
b811c070192e317492acc113d80443e58570f2d4
ba60411d4deea3d999af20ea10be9c015b899c4a
refs/heads/master
2023-08-09T10:04:45.414043
2020-03-21T18:45:44
2020-03-21T18:45:44
175,472,191
0
2
null
2023-07-21T17:50:00
2019-03-13T17:54:34
Java
UTF-8
Java
false
false
2,918
java
package org.softuni.residentevil.domain.model.service; import org.softuni.residentevil.domain.entity.enums.Creator; import org.softuni.residentevil.domain.entity.enums.Magnitude; import org.softuni.residentevil.domain.entity.enums.Mutation; import java.time.LocalDate; import java.util.List; public class VirusServiceModel { private String id; private String name; private String description; private String sideEffects; private Creator creator; private boolean isDeadly; private boolean isCurable; private Mutation mutation; private Integer turnoverRate; private Integer hoursUntilTurn; private Magnitude magnitude; private LocalDate releasedOn; private List<CapitalServiceModel> capitals; public String getId() { return this.id; } public void setId(String id) { this.id = id; } public String getName() { return this.name; } public void setName(String name) { this.name = name; } public String getDescription() { return this.description; } public void setDescription(String description) { this.description = description; } public String getSideEffects() { return this.sideEffects; } public void setSideEffects(String sideEffects) { this.sideEffects = sideEffects; } public Creator getCreator() { return this.creator; } public void setCreator(Creator creator) { this.creator = creator; } public boolean isDeadly() { return this.isDeadly; } public void setDeadly(boolean deadly) { isDeadly = deadly; } public boolean isCurable() { return this.isCurable; } public void setCurable(boolean curable) { isCurable = curable; } public Mutation getMutation() { return this.mutation; } public void setMutation(Mutation mutation) { this.mutation = mutation; } public Integer getTurnoverRate() { return this.turnoverRate; } public void setTurnoverRate(Integer turnoverRate) { this.turnoverRate = turnoverRate; } public Integer getHoursUntilTurn() { return this.hoursUntilTurn; } public void setHoursUntilTurn(Integer hoursUntilTurn) { this.hoursUntilTurn = hoursUntilTurn; } public Magnitude getMagnitude() { return this.magnitude; } public void setMagnitude(Magnitude magnitude) { this.magnitude = magnitude; } public LocalDate getReleasedOn() { return this.releasedOn; } public void setReleasedOn(LocalDate releasedOn) { this.releasedOn = releasedOn; } public List<CapitalServiceModel> getCapitals() { return this.capitals; } public void setCapitals(List<CapitalServiceModel> capitals) { this.capitals = capitals; } }
[ "48495509+goldenEAGL3@users.noreply.github.com" ]
48495509+goldenEAGL3@users.noreply.github.com
4b3ea7619d33dc9c9de428a811a4985cff2106b4
56a5ea2bda09483e16ff1471465d66c118a89167
/app/src/main/java/com/example/application/main/hangzhou/jike/LikeClickView.java
5fcd933d156ccc464a9ed6e025d6d9924455c494
[]
no_license
Allen3C/Application
c09ea2bc0da3bbe013121e0a2896d7eab31f8ed3
f8c3c73d24b3b3d2f8c4fbe9bfea10c75615d6b6
refs/heads/master
2022-11-11T22:15:42.922863
2020-07-05T17:10:11
2020-07-05T17:10:11
255,252,033
0
0
null
null
null
null
UTF-8
Java
false
false
7,233
java
package com.example.application.main.hangzhou.jike; import android.animation.ObjectAnimator; import android.animation.ValueAnimator; import android.content.Context; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.Paint; import android.util.AttributeSet; import android.util.Log; import android.view.MotionEvent; import android.view.View; import androidx.annotation.Nullable; import com.example.application.R; import com.example.application.main.tools.SystemUtil; public class LikeClickView extends View { private boolean isLike; private Bitmap likeBitmap; private Bitmap unLikeBitmap; private Bitmap shiningBitmap; private Paint bitmPaint; private int left; private int top; private float handScale = 1.0f; private float centerX; private float centerY; public LikeClickView(Context context) { this(context, null, 0); init(); } public LikeClickView(Context context, @Nullable AttributeSet attrs) { this(context, null, 0); init(); } public LikeClickView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); //自定义属性的获取,写法固定 TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.JiKeLikeView); isLike = typedArray.getBoolean(R.styleable.JiKeLikeView_is_like,false); typedArray.recycle(); init(); } private void init() { Resources resources = getResources(); //将图片转为Bitmap供drawBitmap()调用 likeBitmap = BitmapFactory.decodeResource(resources, R.mipmap.ic_message_like); unLikeBitmap = BitmapFactory.decodeResource(resources, R.mipmap.ic_message_unlike); shiningBitmap = BitmapFactory.decodeResource(resources, R.mipmap.ic_message_like_shining); //Paint在Android中是画笔的意思 bitmPaint = new Paint(); } //控件大小会根据用户传进来的大小和测量模式做计算(也可以不根据用户输入,直接写死) //还需要定义个最小宽高 @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int measureWidth = 0; int measureHeight = 0; //最大高度是图片高度 加上 上下空白的共20dp int maxHeight = likeBitmap.getHeight() + SystemUtil.dp2px(getContext(), 20); int maxWidth = likeBitmap.getWidth() + SystemUtil.dp2px(getContext(), 30); //拿到当前控件的测量模式 int mode = MeasureSpec.getMode(widthMeasureSpec); //拿到当前控件的测量宽度和高度(用户传进来的:android:layout_width="wrap_content") int widthSize = MeasureSpec.getSize(widthMeasureSpec); int heightSize = MeasureSpec.getSize(heightMeasureSpec); //相当于用户没有具体指定自定义View的大小的模式(见onMeasure()测量模式笔记) if(mode != MeasureSpec.EXACTLY){ //测量模式未指定控件大小 如果有背景,背景有多大,我们自定义的控件就有多大 //拿到背景的高度和宽度 int suggestedMinimumWidth = getSuggestedMinimumWidth(); int suggestedMinimumHeight = getSuggestedMinimumHeight(); if(suggestedMinimumWidth == 0){ measureWidth = maxWidth; }else { measureWidth = Math.min(suggestedMinimumWidth, maxWidth); } if(suggestedMinimumHeight == 0){ measureHeight = maxHeight; }else { measureHeight = Math.min(suggestedMinimumHeight, maxHeight); } }else { //测量模式指定大小时 根据用户定义的大小来判断 measureWidth = Math.min(widthSize, maxWidth); measureHeight = Math.min(heightSize, maxHeight); } setMeasuredDimension(measureWidth, measureHeight); setPading(measureWidth, measureHeight); } private void setPading(int measureWidth, int measureHeight) { //拿到图片的宽高 int bitmapWidth = likeBitmap.getWidth(); int bitmapHeight = likeBitmap.getHeight(); //measureWidth是拿到当前控件的宽高 left = (measureWidth - bitmapWidth)/2; top = (measureHeight - bitmapHeight)/2; //下面动画缩放canvas.scale要用 int width = getMeasuredWidth(); int height = getMeasuredHeight(); centerX = width/2; centerY = height/2; } //Canvas在Android里是画布的意思 //onDraw()方法会多次调用,不要在里面有大量计算 @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Bitmap handBitmap = isLike ? likeBitmap:unLikeBitmap; //使用 canvas.scale()及其他效果方法时,必须先调用 canvas.save() 然后再调用canvas.restore() 这两个方法成对出现 canvas.save(); //自定义View 动画 的缩放 参数是比例和中心点 canvas.scale(handScale, handScale, centerX, centerY); canvas.drawBitmap(handBitmap, left, top, bitmPaint); canvas.restore(); if(isLike){ canvas.drawBitmap(shiningBitmap, left + 10, 0, bitmPaint); } } //当自定义View从界面脱离消失的时候调用,可以在里面进行资源回收:Bitmap用完最好recycle()一下 @Override protected void onDetachedFromWindow() { super.onDetachedFromWindow(); likeBitmap.recycle(); unLikeBitmap.recycle(); shiningBitmap.recycle(); } //这个方法能获取用户的点击事件 @Override public boolean onTouchEvent(MotionEvent event) { switch (event.getAction()){ case MotionEvent.ACTION_DOWN: onClick(); break; default: break; } return super.onTouchEvent(event); } private void onClick() { isLike = !isLike; //设置属性动画 ObjectAnimator handScale = ObjectAnimator.ofFloat(this, "handScale", 1.0f, 0.8f, 1.0f); handScale.setDuration(250); handScale.start(); // //用ValueAnimator写法 // ValueAnimator valueAnimator = ValueAnimator.ofFloat(1.0f, 0.8f, 1.0f); // valueAnimator.setDuration(250); // valueAnimator.start(); // valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // @Override // public void onAnimationUpdate(ValueAnimator animation) { // float animatedValue = (float) animation.getAnimatedValue(); // handScale = animatedValue; // invalidate(); // } // }); } //"handScale"属性随便起的,但是使用ObjectAnimator,该属性必须有set方法 系统会自动调用该set方法 public void setHandScale(float value){ this.handScale = value; //这个方法会去调onDraw()方法 invalidate(); } }
[ "allen3c@163.com" ]
allen3c@163.com
3a12cc77fd8af4a838f1988265e10d0a07ebae2a
fb0db16df93a5d732fe0f755b59b01742179bed5
/src/main/java/org/jboss/remoting3/remote/RemoteConnectionProvider.java
5577540c49df963d06ac5c77bcf907176359dcdf
[]
no_license
fl4via/jboss-remoting-temp
a4bee7152af872b8a82b67ee7bb12818cff23337
cc6a5e3591ba7c13776d238a08fa8b399d1db97c
refs/heads/master
2021-01-15T18:08:41.677358
2011-06-20T14:33:14
2011-06-20T14:33:14
1,920,835
0
1
null
null
null
null
UTF-8
Java
false
false
10,958
java
/* * JBoss, Home of Professional Open Source. * Copyright 2011, Red Hat, Inc., and individual contributors * as indicated by the @author tags. See the copyright.txt file in the * distribution for a full listing of individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.jboss.remoting3.remote; import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import java.net.URI; import java.net.UnknownHostException; import java.nio.ByteBuffer; import java.security.AccessController; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; import java.util.Enumeration; import java.util.HashSet; import java.util.LinkedHashMap; import java.util.Map; import java.util.Set; import org.jboss.remoting3.RemotingOptions; import org.jboss.remoting3.security.ServerAuthenticationProvider; import org.jboss.remoting3.spi.ConnectionHandlerFactory; import org.jboss.remoting3.spi.ConnectionProvider; import org.jboss.remoting3.spi.ConnectionProviderContext; import org.jboss.remoting3.spi.NetworkServerProvider; import org.xnio.Cancellable; import org.xnio.ChannelListener; import org.xnio.ChannelThreadPool; import org.xnio.ConnectionChannelThread; import org.xnio.IoUtils; import org.xnio.OptionMap; import org.xnio.Options; import org.xnio.Pool; import org.xnio.Pooled; import org.xnio.ReadChannelThread; import org.xnio.Result; import org.xnio.Sequence; import org.xnio.WriteChannelThread; import org.xnio.Xnio; import org.xnio.channels.AcceptingChannel; import org.xnio.channels.ConnectedSslStreamChannel; import org.xnio.channels.ConnectedStreamChannel; import org.xnio.channels.FramedMessageChannel; import org.xnio.sasl.SaslUtils; import javax.security.auth.callback.CallbackHandler; import javax.security.sasl.Sasl; import javax.security.sasl.SaslServerFactory; import static org.jboss.remoting3.remote.RemoteLogger.log; /** * @author <a href="mailto:david.lloyd@redhat.com">David M. Lloyd</a> */ final class RemoteConnectionProvider implements ConnectionProvider { private final ProviderInterface providerInterface = new ProviderInterface(); private final Xnio xnio; private final ChannelThreadPool<ReadChannelThread> readThreadPool; private final ChannelThreadPool<WriteChannelThread> writeThreadPool; private final ChannelThreadPool<ConnectionChannelThread> connectThreadPool; private final ConnectionProviderContext connectionProviderContext; private final Pool<ByteBuffer> bufferPool; RemoteConnectionProvider(final Xnio xnio, final Pool<ByteBuffer> bufferPool, final ChannelThreadPool<ReadChannelThread> readThreadPool, final ChannelThreadPool<WriteChannelThread> writeThreadPool, final ChannelThreadPool<ConnectionChannelThread> connectThreadPool, final ConnectionProviderContext connectionProviderContext) { this.xnio = xnio; this.readThreadPool = readThreadPool; this.writeThreadPool = writeThreadPool; this.bufferPool = bufferPool; this.connectThreadPool = connectThreadPool; this.connectionProviderContext = connectionProviderContext; } public Cancellable connect(final URI uri, final OptionMap connectOptions, final Result<ConnectionHandlerFactory> result, final CallbackHandler callbackHandler) throws IllegalArgumentException { boolean secure = connectOptions.get(Options.SECURE, false); final InetSocketAddress destination; try { destination = new InetSocketAddress(InetAddress.getByName(uri.getHost()), uri.getPort()); } catch (UnknownHostException e) { result.setException(e); return IoUtils.nullCancellable(); } ChannelListener<ConnectedStreamChannel> openListener = new ChannelListener<ConnectedStreamChannel>() { public void handleEvent(final ConnectedStreamChannel channel) { try { channel.setOption(Options.TCP_NODELAY, Boolean.TRUE); } catch (IOException e) { // ignore } final FramedMessageChannel messageChannel = new FramedMessageChannel(channel, bufferPool.allocate(), bufferPool.allocate()); final RemoteConnection remoteConnection = new RemoteConnection(bufferPool, messageChannel, connectOptions, connectionProviderContext.getExecutor()); remoteConnection.setResult(result); messageChannel.getWriteSetter().set(remoteConnection.getWriteListener()); final ClientConnectionOpenListener openListener = new ClientConnectionOpenListener(remoteConnection, callbackHandler, AccessController.getContext()); openListener.handleEvent(messageChannel); } }; if (secure) { throw new RuntimeException("NOT HERE!"); /* try { return xnio.connectSsl(destination, connectThreadPool.getThread(), readThreadPool.getThread(), writeThreadPool.getThread(), openListener, connectOptions, bufferPool); } catch (NoSuchProviderException e) { result.setException(new IOException(e)); return IoUtils.nullCancellable(); } catch (NoSuchAlgorithmException e) { result.setException(new IOException(e)); return IoUtils.nullCancellable(); }*/ } else { return xnio.connectStream(destination, connectThreadPool.getThread(), readThreadPool.getThread(), writeThreadPool.getThread(), openListener, null, connectOptions); } } public Object getProviderInterface() { return providerInterface; } private final class ProviderInterface implements NetworkServerProvider { public ChannelListener<AcceptingChannel<ConnectedStreamChannel>> getServerListener(final OptionMap optionMap, final ServerAuthenticationProvider authenticationProvider) { return new AcceptListener(optionMap, authenticationProvider); } } private final class AcceptListener implements ChannelListener<AcceptingChannel<ConnectedStreamChannel>> { private final OptionMap serverOptionMap; private final ServerAuthenticationProvider serverAuthenticationProvider; AcceptListener(final OptionMap serverOptionMap, final ServerAuthenticationProvider serverAuthenticationProvider) { this.serverOptionMap = serverOptionMap; this.serverAuthenticationProvider = serverAuthenticationProvider; } public void handleEvent(final AcceptingChannel<ConnectedStreamChannel> channel) { ConnectedStreamChannel accepted = null; try { accepted = channel.accept(readThreadPool.getThread(), writeThreadPool.getThread()); if (accepted == null) { return; } } catch (IOException e) { log.failedToAccept(e); } final FramedMessageChannel messageChannel = new FramedMessageChannel(accepted, bufferPool.allocate(), bufferPool.allocate()); RemoteConnection connection = new RemoteConnection(bufferPool, messageChannel, serverOptionMap, connectionProviderContext.getExecutor()); messageChannel.getWriteSetter().set(connection.getWriteListener()); final Map<String, SaslServerFactory> allowedMechanisms; boolean ok = false; final Map<String, ?> propertyMap; final Pooled<ByteBuffer> pooled = bufferPool.allocate(); try { ByteBuffer buffer = pooled.getResource(); buffer.put(Protocol.GREETING); ProtocolUtils.writeByte(buffer, Protocol.GREETING_VERSION, 0); propertyMap = SaslUtils.createPropertyMap(serverOptionMap); final Sequence<String> saslMechs = serverOptionMap.get(Options.SASL_MECHANISMS); final Set<String> restrictions = saslMechs == null ? null : new HashSet<String>(saslMechs); final Enumeration<SaslServerFactory> factories = Sasl.getSaslServerFactories(); allowedMechanisms = new LinkedHashMap<String, SaslServerFactory>(); try { if (restrictions == null || restrictions.contains("EXTERNAL")) { if (channel instanceof ConnectedSslStreamChannel) { ConnectedSslStreamChannel sslStreamChannel = (ConnectedSslStreamChannel) channel; allowedMechanisms.put("EXTERNAL", new ExternalSaslServerFactory(sslStreamChannel.getSslSession().getPeerPrincipal())); } } } catch (IOException e) { // ignore } while (factories.hasMoreElements()) { SaslServerFactory factory = factories.nextElement(); for (String mechName : factory.getMechanismNames(propertyMap)) { if ((restrictions == null || restrictions.contains(mechName)) && ! allowedMechanisms.containsKey(mechName)) { allowedMechanisms.put(mechName, factory); } } } for (String name : allowedMechanisms.keySet()) { ProtocolUtils.writeString(buffer, Protocol.GREETING_SASL_MECH, name); } ProtocolUtils.writeString(buffer, Protocol.GREETING_ENDPOINT_NAME, connectionProviderContext.getEndpoint().getName()); ProtocolUtils.writeShort(buffer, Protocol.GREETING_CHANNEL_LIMIT, serverOptionMap.get(RemotingOptions.MAX_INBOUND_CHANNELS, Protocol.DEFAULT_CHANNEL_COUNT)); buffer.flip(); connection.send(pooled); ok = true; } finally { if (! ok) { pooled.free(); } } messageChannel.getReadSetter().set(new ServerConnectionGreetingListener(connection, allowedMechanisms, serverAuthenticationProvider, serverOptionMap, connectionProviderContext, propertyMap)); messageChannel.resumeReads(); } } }
[ "flavia.rainone@jboss.com" ]
flavia.rainone@jboss.com
dc76024cf7638ce7b42edb52c1609800d264ae9a
13c2d3db2d49c40c74c2e6420a9cd89377f1c934
/program_data/JavaProgramData/93/1242.java
af30c9f33370535fab837d05f0970dbd79888c9a
[ "MIT" ]
permissive
qiuchili/ggnn_graph_classification
c2090fefe11f8bf650e734442eb96996a54dc112
291ff02404555511b94a4f477c6974ebd62dcf44
refs/heads/master
2021-10-18T14:54:26.154367
2018-10-21T23:34:14
2018-10-21T23:34:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,384
java
package <missing>; public class GlobalMembers { //******************************** //*?????3?5?7???? ** //*?????? 1300012861 ** //*???2013.9.26 ** //******************************** public static int Main() { int n; int a; int b; int c; n = Integer.parseInt(ConsoleInput.readToWhiteSpace(true)); a = (n % 3 == 0); b = (n % 5 == 0); c = (n % 7 == 0); if (a + b + c == 0) { System.out.print("n"); System.out.print("\n"); } else { if (a + b + c == 3) { System.out.print("3 5 7"); System.out.print("\n"); } else { if (a == 1 && b == 0 && c == 0) { System.out.print("3"); System.out.print("\n"); } else { if (a == 0 && b == 1 && c == 0) { System.out.print("5"); System.out.print("\n"); } else { if (a == 0 && b == 0 && c == 1) { System.out.print("7"); System.out.print("\n"); } else { if (a == 1 && b == 1 && c == 0) { System.out.print("3 5"); System.out.print("\n"); } else { if (a == 0 && b == 1 && c == 1) { System.out.print("5 7"); System.out.print("\n"); } else { System.out.print("3 7"); System.out.print("\n"); } } } } } } } return 0; } }
[ "y.yu@open.ac.uk" ]
y.yu@open.ac.uk
2d0b487608aa2fd6007c00e3ed16e611a7324922
e577bdfd71df9ebb3ae70a839f75661b5748a6ff
/src/WorkerWithFiles.java
2a83031b4b65be1e8140815a80fde5333ca5d427
[]
no_license
Privod123/FileCount
729ab3a52854bbbce129392258ac6feba9c0fbf1
9bd54a2e348e9b1d26cd480c6519acffe7d79d51
refs/heads/master
2020-12-09T17:30:03.195512
2020-01-12T12:29:51
2020-01-12T12:29:51
233,370,834
0
0
null
null
null
null
UTF-8
Java
false
false
2,737
java
import java.io.File; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Scanner; public class WorkerWithFiles { private String pathNameFolder; private Map<String,Integer> countFileMap = new HashMap<>(); public void setNameFolder(String pathNameFolder) { this.pathNameFolder = pathNameFolder; } public void setNameFolder() { try(Scanner scanner = new Scanner(System.in);) { System.out.println("Укажите путь до папки в которой необхдимо сделать статистику"); pathNameFolder = scanner.nextLine(); } } public String getNameFolder() { File fileFolder = new File(pathNameFolder); return fileFolder.getName(); } public String getPathNameFolder() { return pathNameFolder; } public Map<String, Integer> getCountFileMap() { return countFileMap; } public void printConsolCountFileMap(){ System.out.println("-------------------------"); for (Map.Entry<String,Integer> countFile: countFileMap.entrySet()) { String key = countFile.getKey(); int value = countFile.getValue(); System.out.println(key + " - " + value); } } public void checkerFolder(String nameFolder){ File file = new File(nameFolder); if (!file.exists()){ System.out.println("По указанному пути файл или каталог не существует."); }else { File[] fileList = file.listFiles(); for (int i = 0; i < fileList.length; i++) { if (fileList[i].isDirectory()){ try { int countFolder = countFileMap.get("Папок"); countFileMap.put("Папок",++countFolder); checkerFolder(fileList[i].getAbsolutePath()); } catch (Exception e) { countFileMap.put("Папок",1); checkerFolder(fileList[i].getAbsolutePath()); } } if (fileList[i].isFile()){ String nameFile = fileList[i].getName(); String[] splitNameFile = nameFile.split("\\."); String typeFile = splitNameFile[1]; try { int countFoundType = countFileMap.get(typeFile); countFileMap.put(typeFile,++countFoundType); } catch (Exception e) { countFileMap.put(typeFile,1); } } } } } }
[ "spas24@mail.ru" ]
spas24@mail.ru
f07221236e1a0fb78a2db1aa35226f8806efc404
22a13ca1fd3d0d462dfdc87ee505f6ea99437c33
/saml/src/main/java/com/fed/saml/sp/protocol/authn/handlers/SAMLNameID.java
6634518a1709e405cdb9efcaf7630c6b8b3d26b3
[]
no_license
vovtz/opensaml
9faf446409e47ac20af54cae00571bc1f425248a
19e46492b83e7eab72ae7901fbc46c08f2a2084a
refs/heads/master
2020-03-21T13:24:31.391378
2016-07-05T15:32:46
2016-07-05T15:32:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,214
java
package com.fed.saml.sp.protocol.authn.handlers; import org.opensaml.saml2.core.Assertion; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class SAMLNameID { private static Logger logger = LoggerFactory.getLogger(SAMLNameID.class); private Assertion assertion; public SAMLNameID(Assertion assertion) { this.assertion = assertion; } public String getNameIdValue() { logger.info("Name Id Format: " + assertion.getSubject().getNameID().getValue()); return assertion.getSubject().getNameID().getValue(); } public String getNameIdFormat() { logger.info("Name Id Format: " + assertion.getSubject().getNameID().getFormat()); return assertion.getSubject().getNameID().getFormat(); } public String getNameQualifier() { logger.info("IdP Name Qualifier: " + assertion.getSubject().getNameID().getNameQualifier()); return assertion.getSubject().getNameID().getNameQualifier(); } public String getSPNameQualifier() { logger.info("SP Name Qualifier: " + assertion.getSubject().getNameID().getSPNameQualifier()); return assertion.getSubject().getNameID().getSPNameQualifier(); } }
[ "ganeshsivam@ganesh.mac.com" ]
ganeshsivam@ganesh.mac.com
23990c95608d188d89365b5907ec1e3aa269be3f
b8bd4438f7d000cb7af3d7d433f9d5e1dcb60ae1
/pdfbox/src/main/java/org/apache/pdfbox/pdmodel/interactive/annotation/PDAnnotationWidget.java
8425e9b9fa7aef41163de02fecc008f8952fe5ad
[ "Apache-2.0", "LicenseRef-scancode-unknown", "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "APAFML", "Adobe-Glyph", "LicenseRef-scancode-unknown-license-reference" ]
permissive
balabit-deps/balabit-os-7-libpdfbox-java
32dacbfbb1658e1152e48e6d4d09c907122ebcf0
3ba7c1c0f139bcbd09292e695b1195e0cda61046
refs/heads/master
2021-06-07T16:05:20.916694
2019-04-18T11:15:26
2019-04-18T11:15:26
158,242,475
0
0
Apache-2.0
2021-04-26T18:40:17
2018-11-19T15:01:22
Java
UTF-8
Java
false
false
8,134
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.pdfbox.pdmodel.interactive.annotation; import org.apache.pdfbox.cos.COSBase; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.pdmodel.interactive.action.PDActionFactory; import org.apache.pdfbox.pdmodel.interactive.action.PDAnnotationAdditionalActions; import org.apache.pdfbox.pdmodel.interactive.action.type.PDAction; /** * This is the class that represents a widget annotation. This represents the * appearance of a field and manages user interactions. A field may have several * widget annotations, which may be on several pages. * * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a> * @version $Revision: 1.3 $ */ public class PDAnnotationWidget extends PDAnnotation { /** * The type of annotation. */ public static final String SUB_TYPE = "Widget"; /** * Constructor. */ public PDAnnotationWidget() { super(); getDictionary().setName( COSName.SUBTYPE, SUB_TYPE); } /** * Creates a PDWidget from a COSDictionary, expected to be * a correct object definition for a field in PDF. * * @param field the PDF objet to represent as a field. */ public PDAnnotationWidget(COSDictionary field) { super( field ); } /** * Returns the highlighting mode. Default value: <code>I</code> * <dl> * <dt><code>N</code></dt> * <dd>(None) No highlighting.</dd> * <dt><code>I</code></dt> * <dd>(Invert) Invert the contents of the annotation rectangle.</dd> * <dt><code>O</code></dt> * <dd>(Outline) Invert the annotation's border.</dd> * <dt><code>P</code></dt> * <dd>(Push) Display the annotation's down appearance, if any. If no * down appearance is defined, the contents of the annotation rectangle * shall be offset to appear as if it were pushed below the surface of * the page</dd> * <dt><code>T</code></dt> * <dd>(Toggle) Same as <code>P</code> (which is preferred).</dd> * </dl> * * @return the highlighting mode */ public String getHighlightingMode() { return this.getDictionary().getNameAsString(COSName.H, "I"); } /** * Sets the highlighting mode. * <dl> * <dt><code>N</code></dt> * <dd>(None) No highlighting.</dd> * <dt><code>I</code></dt> * <dd>(Invert) Invert the contents of the annotation rectangle.</dd> * <dt><code>O</code></dt> * <dd>(Outline) Invert the annotation's border.</dd> * <dt><code>P</code></dt> * <dd>(Push) Display the annotation's down appearance, if any. If no * down appearance is defined, the contents of the annotation rectangle * shall be offset to appear as if it were pushed below the surface of * the page</dd> * <dt><code>T</code></dt> * <dd>(Toggle) Same as <code>P</code> (which is preferred).</dd> * </dl> * * @param highlightingMode the highlighting mode * the defined values */ public void setHighlightingMode(String highlightingMode) { if ((highlightingMode == null) || "N".equals(highlightingMode) || "I".equals(highlightingMode) || "O".equals(highlightingMode) || "P".equals(highlightingMode) || "T".equals(highlightingMode)) { this.getDictionary().setName(COSName.H, highlightingMode); } else { throw new IllegalArgumentException( "Valid values for highlighting mode are " + "'N', 'N', 'O', 'P' or 'T'" ); } } /** * Returns the appearance characteristics dictionary. * * @return the appearance characteristics dictionary */ public PDAppearanceCharacteristicsDictionary getAppearanceCharacteristics() { COSBase mk = this.getDictionary().getDictionaryObject(COSName.getPDFName("MK")); if (mk instanceof COSDictionary) { return new PDAppearanceCharacteristicsDictionary((COSDictionary) mk); } return null; } /** * Sets the appearance characteristics dictionary. * * @param appearanceCharacteristics the appearance characteristics dictionary */ public void setAppearanceCharacteristics(PDAppearanceCharacteristicsDictionary appearanceCharacteristics) { this.getDictionary().setItem("MK", appearanceCharacteristics); } /** * Get the action to be performed when this annotation is to be activated. * * @return The action to be performed when this annotation is activated. */ public PDAction getAction() { COSDictionary action = (COSDictionary) this.getDictionary().getDictionaryObject( COSName.A ); return PDActionFactory.createAction( action ); } /** * Set the annotation action. * As of PDF 1.6 this is only used for Widget Annotations * @param action The annotation action. */ public void setAction( PDAction action ) { this.getDictionary().setItem( COSName.A, action ); } /** * Get the additional actions for this field. This will return null * if there are no additional actions for this field. * As of PDF 1.6 this is only used for Widget Annotations. * * @return The actions of the field. */ public PDAnnotationAdditionalActions getActions() { COSDictionary aa = (COSDictionary)this.getDictionary().getDictionaryObject( "AA" ); PDAnnotationAdditionalActions retval = null; if( aa != null ) { retval = new PDAnnotationAdditionalActions( aa ); } return retval; } /** * Set the actions of the field. * * @param actions The field actions. */ public void setActions( PDAnnotationAdditionalActions actions ) { this.getDictionary().setItem( "AA", actions ); } /** * This will set the border style dictionary, specifying the width and dash * pattern used in drawing the line. * * @param bs the border style dictionary to set. * */ public void setBorderStyle( PDBorderStyleDictionary bs ) { this.getDictionary().setItem( "BS", bs); } /** * This will retrieve the border style dictionary, specifying the width and * dash pattern used in drawing the line. * * @return the border style dictionary. */ public PDBorderStyleDictionary getBorderStyle() { COSDictionary bs = (COSDictionary) this.getDictionary().getItem( COSName.getPDFName( "BS" ) ); if (bs != null) { return new PDBorderStyleDictionary( bs ); } else { return null; } } // TODO where to get acroForm from? // public PDField getParent() throws IOException // { // COSBase parent = this.getDictionary().getDictionaryObject(COSName.PARENT); // if (parent instanceof COSDictionary) // { // PDAcroForm acroForm = null; // return PDFieldFactory.createField(acroForm, (COSDictionary) parent); // } // return null; // } }
[ "testbot@balabit.com" ]
testbot@balabit.com
072bae2aca9ae92ae1dcd35af8e9e304f4e7173f
40598439bba47003c9401a1cf76b5e2f6ba87f91
/Answer_2.java
e83702706c7ae4bb97dcf9dcd2669530dbfc9a36
[]
no_license
Hervnzig/caesar-cipher-decryption-bruteforce
6acd95b3dbcbd40f588aaedf1a534f8c8ff517f1
73b3b091456d47ce616a52dfca6d17b1919a9aac
refs/heads/master
2022-12-28T11:58:11.538567
2020-10-11T23:05:19
2020-10-11T23:05:19
303,193,207
0
0
null
null
null
null
UTF-8
Java
false
false
1,838
java
package com.company; public class Answer_2 { public static void main(String[] args) { String text = "We alescuwmtbel uoi ha coryld choti lnaiem t, iplr!eyfpe"; int key = 3; System.out.println(decryption(text, key)); } public static String decryption(String text, int key) { String decrypted = ""; boolean status = false; int j = 0; int row = key; int col = text.length(); char[][] mat = new char[row][col]; for (int i=0; i< col; i++){ if (j==0 || j== key-1){ status = !status; mat[j][i] = 'x'; if (status) j++; else j--; } } int index = 0; for (int i=0; i<row; i++){ for (int k=0; k<col; k++){ if (mat[i][k] == 'x' && index < col){ mat[i][k] = text.charAt(index++); } } } System.out.println("Our elements arranged in rows and columns diagonally: "); System.out.println("--------------------------------------------------------"); for (int i=0; i<row; i++){ for (int k=0; k<col; k++){ System.out.print(mat[i][k]+ " "); } System.out.println(); } System.out.println(); System.out.println("Our elements after combining them back diagnoally: "); System.out.println("--------------------------------------------------------"); for (int i=0; i<row; i++){ for (int k=0; k<col; k++){ if (mat[i][k] != 0){ decrypted += mat[i][k]; } } System.out.println(); } return decrypted; } }
[ "hervnzig1@gmail.com" ]
hervnzig1@gmail.com
1667697b21becd5377126cad8c671b739f9f65e6
7f47b4d95a6a179fcf1da5588401749cd6af6f76
/app/src/main/java/com/app/mathpix_sample/evaluator/base/Module.java
7b901d24d73f2d764da3d05a27c26805ba2f6d4f
[]
no_license
yishuinanfeng/ScanCalculator
0aabbae5aba8c6cf45a43e05cd8131ecfe4f210d
2af6885a30838f28274d11012b4f2aa6220297ba
refs/heads/master
2020-04-02T02:34:22.130569
2018-11-21T09:25:23
2018-11-21T09:25:23
153,916,784
29
0
null
null
null
null
UTF-8
Java
false
false
2,223
java
/* * Copyright (C) 2018 Duy Tran Le * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * */ package com.app.mathpix_sample.evaluator.base; import com.app.mathpix_sample.evaluator.Constants; /** * A super class for BaseModule, GraphModule */ public class Module { // Used for formatting Dec, Bin, and Hex. // Dec looks like 1,234,567. Bin is 1010 1010. Hex is 0F 1F 2F. private static final int mDecSeparatorDistance = 3; private static final int mBinSeparatorDistance = 4; private static final int mHexSeparatorDistance = 2; private static final int mOctSeparatorDistance = 3; // Used whenever math is necessary private final Evaluator mEvaluator; public Module(Evaluator evaluator) { mEvaluator = evaluator; } public int getDecSeparatorDistance() { return mDecSeparatorDistance; } public int getBinSeparatorDistance() { return mBinSeparatorDistance; } public int getHexSeparatorDistance() { return mHexSeparatorDistance; } public int getOctSeparatorDistance() { return mOctSeparatorDistance; } public char getDecimalPoint() { return Constants.DECIMAL_POINT; } public char getDecSeparator() { return Constants.DECIMAL_SEPARATOR; } public char getBinSeparator() { return Constants.BINARY_SEPARATOR; } public char getHexSeparator() { return Constants.HEXADECIMAL_SEPARATOR; } public char getOctSeparator() { return Constants.OCTAL_SEPARATOR; } public Evaluator getSolver() { return mEvaluator; } }
[ "yanxiaxue@qq.com" ]
yanxiaxue@qq.com
b1f52465a07ee226ea97a917fc9713019399c86d
3edcb6151077f690662fae5b984611bccfc4303a
/03章/src/sample/Sample03_03.java
ac6b1eab13acc9c4f77aa6e347d3f310c438f47e
[]
no_license
hisamatsunaoki/javaExecise
555da6df210078155b139395209d1ed7497bfa10
db86caae23814cc4e2327606f57caa8b717e2e65
refs/heads/master
2020-05-04T06:44:22.766856
2019-04-04T05:01:37
2019-04-04T05:01:37
179,012,463
0
0
null
null
null
null
UTF-8
Java
false
false
151
java
package sample; public class Sample03_03 { public static void main(String[] args) { System.out.println('あ'); System.out.println('\u3042'); } }
[ "49182806+hisamatsunaoki@users.noreply.github.com" ]
49182806+hisamatsunaoki@users.noreply.github.com
152cab28a85b759c34ac795239ecf99057d5bf8a
aabf54d408c4ea23ba0c1589278d71d24b6d9c73
/src/Basics/InvokeChromeBrowser.java
3a54eb67359d7e60bd9b7207828f2d8140a30197
[]
no_license
bavishwanath/Selenium
e8693519cdb78d13be49cf2aaae6d75052b75b8b
261f0b2872ec01872ffdc8a8aa02f89b924f8333
refs/heads/master
2022-01-10T18:55:50.101785
2020-12-31T08:35:08
2020-12-31T08:35:08
235,743,189
0
0
null
2022-01-04T16:49:28
2020-01-23T07:16:36
HTML
UTF-8
Java
false
false
2,356
java
package Basics; import java.io.File; import java.nio.file.Files; import java.time.Duration; import java.util.ArrayList; import java.util.Collections; import java.util.Set; import javax.swing.text.html.HTMLDocument.Iterator; import org.apache.commons.collections4.FactoryUtils; import org.openqa.selenium.By; import org.openqa.selenium.Keys; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.FluentWait; import org.openqa.selenium.support.ui.Wait; import org.openqa.selenium.support.ui.WebDriverWait; import org.testng.annotations.Test; import com.beust.jcommander.Strings; public class InvokeChromeBrowser { @Test public void launchBrowser() throws InterruptedException { System.setProperty("webdriver.chrome.driver", "D:\\automation\\drivers\\chromedriver.exe"); WebDriver driver = new ChromeDriver(); driver.manage().window().maximize(); driver.get("https://www.google.com"); //driver.findElement(By.cssSelector("body")).sendKeys(Keys.CONTROL + Keys.SHIFT +"t"); driver.get("https://www.bincodes.com/random-creditcard-generator/"); /* * Thread.sleep(9000); String content = driver.findElement(By.xpath( * "//h4[contains(text(),'Visa')]//parent::strong//parent::li")) .getText(); * System.out.println(content); String sam = content.substring(4, 21); * System.out.println(sam); driver.close(); * * * * * sample * */ // TakesScreenshot scrshot = ((TakesScreenshot)driver); File fil = // scrshot.getScreenshotAs(OutputType.FILE); // ArrayList arr = new ArrayList(); // arr.add("25"); // arr.add("1"); // arr.add("0"); // arr.add("44"); // arr.add("99"); // arr.add("52"); // System.out.println(arr); // Collections.sort(arr); // System.out.println(arr); /* * @SuppressWarnings("unchecked") Wait wait = new FluentWait<WebDriver>(driver) * .withTimeout(Duration.ofSeconds(30)) .pollingEvery(Duration.ofSeconds(5)) * .ignoring(Exception.class); */ // WebDriverWait wait = new WebDriverWait(driver, 30); /* wait.until(ExpectedConditions.elementToBeClickable(".clas")); */ // driver.close(); } }
[ "vananda@altimetrik.com" ]
vananda@altimetrik.com
c0fc458d0682fc87df64040a50acef1b25afb875
c8dbe78b2b6b708d0c1bfee826de3737da8098b4
/auth-backend/auth-web/src/main/java/club/raveland/auth/web/config/AuthProperties.java
988fcb464c03d01e6df81c593f4ac7b841de5bff
[]
no_license
shoy160/spear-auth
074e639b41038215bf4f50a84e017d0fc49fee06
b59948ea9ce6bd3a55dd60ad6be8e5a561443af1
refs/heads/master
2023-08-18T22:19:12.011578
2021-10-20T10:34:59
2021-10-20T10:35:30
419,286,743
1
0
null
null
null
null
UTF-8
Java
false
false
702
java
package club.raveland.auth.web.config; import lombok.Getter; import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.context.annotation.Configuration; import org.springframework.stereotype.Component; /** * @author shay * @date 2021/2/24 */ @Getter @Setter @Component @Configuration @ConfigurationProperties(prefix = "raveland.auth") public class AuthProperties { /** * 登录站点 */ private String loginSite = "/login"; /** * 默认用户池ID */ private String defaultPool = "148c083380021192"; /** * 默认应用ID */ private String defaultApp = "148c089410c21177"; }
[ "shoy160@qq.com" ]
shoy160@qq.com
1df2b606b6662fcf3dc44bf95ea252d827a6d153
f186b8dd78fe24da82469cb3739296baaba67168
/app/src/main/java/com/example/alsdu/lab21/NewActivity.java
c01f506b7caffb70e3245a17ea1db676b1610aef
[]
no_license
MinyeongKim/Mobile_Lab2-1
191988e10a677e0c2de84008058aad4b9355c139
66766470281a24e46661903dbbdab7af1c769d15
refs/heads/master
2020-03-09T09:46:30.858826
2018-04-09T05:47:43
2018-04-09T05:47:43
128,720,645
0
0
null
null
null
null
UTF-8
Java
false
false
1,030
java
package com.example.alsdu.lab21; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.content.Intent; import android.view.View; import android.widget.Button; import android.widget.Toast; public class NewActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_new); Intent passedIntent = getIntent(); if(passedIntent!=null){ String loginName = passedIntent.getStringExtra("loginName"); String loginAge = passedIntent.getStringExtra("loginAge"); Toast.makeText(this, "Student info: " + loginName + ", " + loginAge, Toast.LENGTH_LONG).show(); } Button button2 = (Button)findViewById(R.id.button2); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } }
[ "alsdud3221@gmail.com" ]
alsdud3221@gmail.com
7dd866490e82821dcddee701ea8447d812d9799f
fefcb9d9e74b0a25fd66c179037de4ee8722136f
/server/DAO.java
7e057c055ed6634a26974b61488b47a047c14264
[]
no_license
MirandaYates/SquadUp
b24708a655bdee1204833847e28c34e3fdc11aa0
00962fa5f280f6121508c3c8c02c33b03843096f
refs/heads/master
2021-01-20T09:41:24.394789
2017-03-05T16:54:04
2017-03-05T16:54:04
83,926,165
0
0
null
null
null
null
UTF-8
Java
false
false
3,251
java
import java.sql.*; import java.util.ArrayList; public class DAO{ private static final String DB_URL = "jdbc:mysql://localhost/squadup?useSSL=false"; private static final String USERNAME = "root"; private static final String PASSWORD = "Ryczak13!"; public DAO(){ } /* * connects to the database; if successful, returns a Connection obj connected to database, else returns null */ public Connection getConnection(){ try{ Class.forName("com.mysql.jdbc.Driver"); return DriverManager.getConnection(DB_URL, DAO.USERNAME, DAO.PASSWORD); }catch(Exception e){ e.printStackTrace(); } return null; } /* * Accepts: a sql query * * Logic: creates a 2D ArrayList of the results found from the query. * Examples (each <> is an ArrayList, anything inside it separated by commas are elements): * "select release_name from releases limit 1" would return: * <<"Release name 1">> * * "select release_name, date from releases limit 1" would return: * <<"Release name 1", "date">> * * "select release_name from releases limit 2" would return: * <<"Release name 1">, <"Release Name 2">> * * "select release_name, date from releases limit 2" would return: * <<"Release name 1", "date">, <"Release Name 2", "date">> */ public QueryResult executeQuery(Connection connection, PreparedStatement statement){ //System.out.println(statement); ArrayList<ArrayList<String>> container = new ArrayList<ArrayList<String>>(); ArrayList<String> column_names = new ArrayList<String>(); try{ ResultSet resultSet = statement.executeQuery(); ResultSetMetaData meta = resultSet.getMetaData(); final int columnCount = meta.getColumnCount(); for(int i = 1; i <= columnCount; i++){ column_names.add(meta.getColumnName(i)); } while (resultSet.next()){ ArrayList<String> columnList = new ArrayList<String>(); container.add(columnList); for (int column = 1; column <= columnCount; column++) { Object value = resultSet.getObject(column); if (value != null) { columnList.add(value.toString()); } else { columnList.add("null"); // you need this to keep your columns in sync. } } } resultSet.close(); connection.close(); }catch(Exception e){ e.printStackTrace(); } return new QueryResult(column_names, container); } public boolean executeUpdate(Connection connection, PreparedStatement statement){ try { return statement.executeUpdate() > 0; } catch (SQLException e) { e.printStackTrace(); } return false; } // accepts an insert statement and commits it to the database public int executeInsert(Connection connection, PreparedStatement statement){ try{ statement.execute(); ResultSet rs = statement.getGeneratedKeys(); if(rs.next()){ int result = rs.getInt(1); rs.close(); connection.close(); return result; } }catch(Exception e){ e.printStackTrace(); } return -1; } }
[ "brentryczak@gmail.com" ]
brentryczak@gmail.com
e9c7ac31a0dd42dffedd8de44bbbaf78b531ca90
7ffc545e01e9da65ba0dc19040cacafcf8113331
/app/src/main/java/com/example/psing/sherlocked2/TaskContract.java
5f2d13b396114a7fc3a3abbc07003b17baa216c3
[]
no_license
psinghal20/iamSherlocked
bbc786064da03cbb4d75bf0753998f5087cf3dea
94fd9e8ceb0c34b23da1b85b4ae16140e1c033be
refs/heads/master
2021-01-13T16:40:21.841965
2017-01-08T17:27:49
2017-01-08T17:27:49
77,913,157
0
0
null
null
null
null
UTF-8
Java
false
false
848
java
package com.example.psing.sherlocked2; import android.provider.BaseColumns; /** * Created by psing on 20-12-2016. */ public class TaskContract { public static final String DB_NAME = "com.aziflaj.todolist.db"; public static final int DB_VERSION = 1; public class TaskEntry implements BaseColumns { public static final String TABLE = "tasks"; public static final String TABLE1 = "season1"; public static final String TABLE2 = "season2"; public static final String TABLE3 = "season3"; public static final String TABLE4 = "season4"; public static final String COL_TASK_TITLE = "title"; public static final String COL_TASK_Duration = "duration"; public static final String COL_Rating = "rating"; public static final String COL_TASK_Summary = "summary"; } }
[ "psinghal20@gmail.com" ]
psinghal20@gmail.com
3625ec5e20dc14c3894960eae6db1ce9725fa059
b8d9dde79a95171d59197bfca840fc11ed82a3da
/spring-boot-nosql-redis/src/main/java/com/mmc/boot/system/redis/controller/TotalController.java
13cf093e2e232e3feb258346a77f933bfe037a95
[]
no_license
gaowei0115/spring-boot-system
ca61896425cbf506da29ec340ee4904949120961
6b9537ba9a8adfd508ecc0a96e0a0d4a53ec17c7
refs/heads/master
2021-06-15T15:14:34.377807
2018-12-27T03:33:25
2018-12-27T03:33:25
95,783,286
0
0
null
null
null
null
UTF-8
Java
false
false
1,156
java
package com.mmc.boot.system.redis.controller; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import redis.clients.jedis.JedisCluster; /** * @packageName:com.mmc.boot.system.redis.controller * @desrciption: * @author: gaowei * @date: 2018-12-26 16:31 * @history: (version) author date desc */ @RestController @RequestMapping("/t") public class TotalController { private static final String TOTAL_KEY = "TOTAL_KEY"; @Autowired private JedisCluster jedisCluster; @RequestMapping("total") public String totalInfo() { String result = jedisCluster.get(TOTAL_KEY); if (StringUtils.isEmpty(result)) { jedisCluster.set(TOTAL_KEY, 0 + ""); } result = jedisCluster.get(TOTAL_KEY); int count = Integer.parseInt(result); count++; jedisCluster.set(TOTAL_KEY, count + ""); String r = jedisCluster.get(TOTAL_KEY); return "当前在线人数 " + r + " 人"; } }
[ "gao_wei0115@sina.com" ]
gao_wei0115@sina.com
30a06f18e808c64b3afd69a86d4851483e95478f
74e1f9f42ef667f7cdec0f616a7581433debf834
/week/src/main/java/com/hsl/cn/common/utils/WeekUtils.java
c640ddc6348abdac3fb9e7a8b8c8ab2dd4838ff7
[]
no_license
hansonglitester/myapplication
fe1d57e13c927b5bafe32e9ccfb591fa918680f9
e1ad4cadb7f42bcd7d7908ce0efc3f1ea7a09b45
refs/heads/master
2022-06-24T12:24:03.522023
2019-09-12T10:55:37
2019-09-12T10:55:37
191,287,310
0
0
null
2022-06-17T02:30:39
2019-06-11T03:30:41
Java
UTF-8
Java
false
false
3,430
java
package com.hsl.cn.common.utils; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.List; public class WeekUtils { /** * 指定日期,获取是当前时间是的第几周 * @param Date date * @return */ public static int getWeekOFYear(Date date){ Calendar cal=Calendar.getInstance(); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.setTime(date); int week=cal.get(Calendar.WEEK_OF_YEAR); return week; } /** * 指定周的开始时间 * @param Integer year,Integer week * @return */ public static Date getWeekStart(Integer year,Integer week){ Calendar cal=Calendar.getInstance(); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.set(Calendar.YEAR, year); cal.set(Calendar.WEEK_OF_YEAR, week); cal.set(Calendar.DAY_OF_WEEK,Calendar.MONDAY); return cal.getTime(); } /** * 指定周的结束时间 * @param Integer year,Integer week * @return */ public static Date getWeekEnd(Integer year,Integer week){ Calendar cal=Calendar.getInstance(); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.set(Calendar.YEAR, year); cal.set(Calendar.WEEK_OF_YEAR, week); cal.set(Calendar.DAY_OF_WEEK,Calendar.SUNDAY); return cal.getTime(); } /** * 某一年有多少个周 * @param Integer year * @return */ public static Integer getWeeksInYear(Integer year){ Calendar cal=Calendar.getInstance(); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.set(Calendar.YEAR, year); return cal.getWeeksInWeekYear(); } /** * 指定周的结束时间 * @param Integer year,Integer week * @return */ public static List<Date> getWeekDayList(Integer year, Integer week) throws ParseException { Calendar cal=Calendar.getInstance(); cal.setFirstDayOfWeek(Calendar.MONDAY); cal.set(Calendar.YEAR, year); cal.set(Calendar.WEEK_OF_YEAR, week); cal.set(Calendar.DAY_OF_WEEK,Calendar.MONDAY); List<Date> weeklist=new ArrayList <>(); for (int i=0;i<7;i++){ weeklist.add(cal.getTime()); cal.add(cal.DATE,1);//增加一天 } return weeklist; } public static Integer getYear(Date date){ Calendar cal = Calendar.getInstance(); cal.setTime(date); return cal.get(Calendar.YEAR); } public static Integer getMonth(Date date){ Calendar cal = Calendar.getInstance(); cal.setTime(date); return cal.get(Calendar.MONTH); } //日期格式转换 public static String DateToString(String pattern,Date date) throws ParseException { SimpleDateFormat sdf =new SimpleDateFormat(pattern); return sdf.format(date); } public static void main(String[] args) throws ParseException { Date nowDate= new Date(); System.out.println( getWeekStart(getYear(nowDate),getWeekOFYear(nowDate))); // List<Date> weeklist=getWeekDayList(getYear(nowDate),getWeekOFYear(nowDate)); List<Date> weeklist=getWeekDayList(2019,4); for (Date date :weeklist){ System.out.println(DateToString("yyy-M-d",date)); } } }
[ "2275057986@qq.com" ]
2275057986@qq.com
e2c51c62a30fceac40b358aa446233b21a3efe75
949d21d5e1b9172178619c94f066c0051c5b09a1
/app/src/main/java/com/example/android/projectquizapp/MainActivity.java
6e70e9dcfe13a034f7cf58e0f51eeddb8ee66467
[]
no_license
BogdanPosa/P3GoogleABND
924f2b4cf26440a8f7c77f0a543a05a4e2af79a1
f614ef4255547bbb09ca1563eaba8ffcdf49ccc0
refs/heads/master
2021-09-10T11:13:18.768129
2018-03-25T10:57:38
2018-03-25T10:57:38
120,183,206
0
0
null
null
null
null
UTF-8
Java
false
false
1,825
java
package com.example.android.projectquizapp; import android.content.Context; import android.support.v7.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import android.widget.RadioButton; import android.widget.Toast; public class MainActivity extends AppCompatActivity { public Button startButton; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); startHelping(); } /* * This method starts the math or the vocabulary activity based on user selection */ public void startHelping() { startButton = findViewById(R.id.startButton); startButton.setOnClickListener(new View.OnClickListener() { RadioButton selectionA = (RadioButton) findViewById(R.id.buttonSelectionA); RadioButton selectionB = (RadioButton) findViewById(R.id.buttonSelectionB); @Override public void onClick(View view) { if (selectionB.isChecked()) { Intent Math = new Intent(MainActivity.this, MathActivity.class); startActivity(Math); } else if (selectionA.isChecked()) { Intent Vocabulary = new Intent(MainActivity.this, VocabularyActivity.class); startActivity(Vocabulary); } else { Context context = getApplicationContext(); CharSequence text = getString(R.string.mainInfo); int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } } }); } }
[ "posa.bogdan@yahoo.ro" ]
posa.bogdan@yahoo.ro
95b00be8d1242c8f2f5bd23dff4db0b142f0ca5d
9e7571ba65865c646956fe6124e0f01d6b481ce4
/src/main/java/com/teahyuk/payment/ap/domain/entity/CardCompany.java
d9e4966d15aaaf978c47b24733abe647c962d022
[]
no_license
teahyuk/Payment-ap-server-exam
91ae123127a33a6980b0b2f916cb9780cf2f6153
ec45b25ddc7265cc199630abca3c4712d578a752
refs/heads/master
2023-02-01T21:04:48.600851
2020-12-15T03:00:50
2020-12-15T03:00:50
275,169,139
0
0
null
2020-12-15T03:03:55
2020-06-26T14:00:01
Java
UTF-8
Java
false
false
681
java
package com.teahyuk.payment.ap.domain.entity; import com.teahyuk.payment.ap.domain.vo.uid.Uid; import lombok.AccessLevel; import lombok.Builder; import lombok.Getter; import lombok.NoArgsConstructor; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Index; import javax.persistence.Table; @Getter @NoArgsConstructor(access = AccessLevel.PROTECTED) @Entity @Table(indexes = {@Index(columnList = "uid", unique = true)}) public class CardCompany extends EntityUid { @Column(length = 450) private String string; @Builder public CardCompany(Uid uid, String string) { super(uid); this.string = string; } }
[ "jtaeh57@gmail.com" ]
jtaeh57@gmail.com