blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 7
332
| content_id
stringlengths 40
40
| detected_licenses
listlengths 0
50
| license_type
stringclasses 2
values | repo_name
stringlengths 7
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 557
values | visit_date
timestamp[us] | revision_date
timestamp[us] | committer_date
timestamp[us] | github_id
int64 5.85k
684M
⌀ | star_events_count
int64 0
77.7k
| fork_events_count
int64 0
48k
| gha_license_id
stringclasses 17
values | gha_event_created_at
timestamp[us] | gha_created_at
timestamp[us] | gha_language
stringclasses 82
values | src_encoding
stringclasses 28
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 7
5.41M
| extension
stringclasses 11
values | content
stringlengths 7
5.41M
| authors
listlengths 1
1
| author
stringlengths 0
161
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f85f7b81277d5a33c2b64c330c2467287e4d2543
|
94a3c1d3aeae085cf947df3e9421dc200b950caa
|
/demos/java-word/org.samples.docxconverters.docx4j/src/org/samples/docxconverters/docx4j/html/ooxmlToHTML.java
|
a5407cac1f177ea4ce8fb22ebe95c5221961a40a
|
[] |
no_license
|
danieldelgado/proyectos-software
|
eb781892c1922ba9bd1e98385e26fde4ccb00b4e
|
d2113065a834066d3ebf73d792f5dcff44bafc84
|
refs/heads/master
| 2020-12-24T08:46:47.655576
| 2016-08-11T06:13:11
| 2016-08-11T06:13:11
| 32,235,953
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,484
|
java
|
package org.samples.docxconverters.docx4j.html;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import javax.xml.transform.stream.StreamResult;
import org.docx4j.convert.out.html.AbstractHtmlExporter;
import org.docx4j.convert.out.html.AbstractHtmlExporter.HtmlSettings;
import org.docx4j.convert.out.html.HtmlExporterNG2;
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
public class ooxmlToHTML {
public static void main(String[] args) {
createHTML();
createHTML();
}
private static void createHTML() {
try {
long start = System.currentTimeMillis();
// 1) Load DOCX into WordprocessingMLPackage
InputStream is = new FileInputStream(new File(
"docx/ooxml.docx"));
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage
.load(is);
// 2) Prepare HTML settings
HtmlSettings htmlSettings = new HtmlSettings();
// 3) Convert WordprocessingMLPackage to HTML
OutputStream out = new FileOutputStream(new File(
"html/ooxml.html"));
AbstractHtmlExporter exporter = new HtmlExporterNG2();
StreamResult result = new StreamResult(out);
exporter.html(wordMLPackage, result, htmlSettings);
System.err.println("Generate html/ooxml.html with "
+ (System.currentTimeMillis() - start) + "ms");
} catch (Throwable e) {
e.printStackTrace();
}
}
}
|
[
"danieldelgado22g@gmail.com@244fdcff-bacd-6254-7a59-d87bfe48386a"
] |
danieldelgado22g@gmail.com@244fdcff-bacd-6254-7a59-d87bfe48386a
|
0983eee9299920ff35f261561395c69e075b8a9f
|
3c199deca05bb895ddf82afe083a7d9008a5e150
|
/src/main/java/com/buyalskaya/fitclub/controller/command/impl/UnsubscribeInPrivateCabinetCommand.java
|
723cf3d9d81b89b0547337e7ec46acfa997a2972
|
[] |
no_license
|
Julie717/FinalProject
|
fd80ceca6d5f93e5302f6f167f5594ae5b238d11
|
eac77a9c94576783a0fd65adaa65807c7b6004f8
|
refs/heads/master
| 2023-01-23T14:03:03.185522
| 2020-12-02T22:18:54
| 2020-12-02T22:18:54
| 312,540,939
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,039
|
java
|
package com.buyalskaya.fitclub.controller.command.impl;
import com.buyalskaya.fitclub.controller.AttributeName;
import com.buyalskaya.fitclub.controller.ParameterName;
import com.buyalskaya.fitclub.controller.Router;
import com.buyalskaya.fitclub.controller.command.AddRequestAttribute;
import com.buyalskaya.fitclub.controller.command.Command;
import com.buyalskaya.fitclub.exception.ServiceException;
import com.buyalskaya.fitclub.model.entity.User;
import com.buyalskaya.fitclub.model.service.ServiceFactory;
import com.buyalskaya.fitclub.util.ConfigurationManager;
import com.buyalskaya.fitclub.util.PageConfigName;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
/**
* The type Unsubscribe in private cabinet command.
* This command allows clients to unsubscribe from workouts on which they are subscribed
*
* @author Buyalskaya Yuliya
* @version 1.0
*/
public class UnsubscribeInPrivateCabinetCommand implements Command {
private static final Logger logger = LogManager.getLogger();
@Override
public Router execute(HttpServletRequest request) {
HttpSession session = request.getSession();
User user = (User) session.getAttribute(AttributeName.SESSION_USER);
String idSchedule = request.getParameter(ParameterName.SCHEDULE_ID);
String subscribe = request.getParameter(ParameterName.SUBSCRIBE);
String page = (String) session.getAttribute(AttributeName.SESSION_CURRENT_PAGE);
try {
ServiceFactory.getInstance().getScheduleService().subscribeClient(user.getIdUser(),
idSchedule, subscribe);
AddRequestAttribute.forClientPage(request, user.getLogin());
} catch (ServiceException ex) {
logger.log(Level.ERROR, ex);
page = ConfigurationManager.getProperty(PageConfigName.ERROR_500);
}
return new Router(page);
}
}
|
[
"buyalskaya.yv@gmail.com"
] |
buyalskaya.yv@gmail.com
|
05aac1692e374ad092ea8d9c11b97c0d624fc4e7
|
c6cba2a3636201d5429e59b9f772b09313f78673
|
/project/src/main/java/com/project/model/Answer.java
|
29b9da33da2de957d4973766028b655dbaf2077b
|
[] |
no_license
|
saurabhsen24/project
|
e96257c8670257b701596e13563f2fb96ead5d17
|
a712e1253b9e110b9f19225d10e4c08516a991bc
|
refs/heads/master
| 2022-12-21T15:59:33.123622
| 2020-04-11T18:54:01
| 2020-04-11T18:54:01
| 180,583,393
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 547
|
java
|
package com.project.model;
public class Answer {
private int aid;
private String ans;
private int qid;
public int getAid() {
return aid;
}
public void setAid(int aid) {
this.aid = aid;
}
public String getAns() {
return ans;
}
public void setAns(String ans) {
this.ans = ans;
}
public int getQid() {
return qid;
}
public void setQid(int qid) {
this.qid = qid;
}
@Override
public String toString() {
return "Answer [aid=" + aid + ", ans=" + ans + ", qid=" + qid + "]";
}
}
|
[
"saurabhsensaurabh@gmail.com"
] |
saurabhsensaurabh@gmail.com
|
06c627ebf3f018872bf97d84059f6d42acd9839d
|
b5c24d416f96c463eb1e8d6a783e5cb8b84d97c3
|
/src/day34/LoginActivity.java
|
96cee39bc8c6b3cb630d5599bac52b81816f5f63
|
[] |
no_license
|
tamus88/JavaProgrammingB15Online
|
accefc34a6b3d94fdc3dd4dfafa09a82b8b8dfb7
|
193caacd56ebfd55e5fa5e6b3b051e6c00aba19f
|
refs/heads/master
| 2021-05-18T18:35:30.250816
| 2020-03-30T16:24:59
| 2020-03-30T16:24:59
| 251,361,523
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,838
|
java
|
package day34;
public class LoginActivity {
public static void main(String[] args) {
loginVoid("my username", "abc123");
loginVoid("user", "abc123");
boolean result = loginReturn("user", "abc123");
System.out.println("result = " + result);
System.out.println("second run " + loginReturn("aaaa", "bbb"));
// System.out.println( loginVoid("aaaa" , "bbb") ); CAN NOT DO IT WITH VOID METHOD
//boolean result2 = loginVoid("abc","efg"); // no result to save!
// we want to continue with shopping scenario only if user signed in to the app
if (loginReturn("user1", "abc123")) {
System.out.println("Add Java Book to cart");
System.out.println("Pay for Java Book in cart");
System.out.println("View The order ");
} else {
System.out.println("NO SHOPPING UNLESS YOU SIGNED IN!!!!!!");
}
}
/**
* A method that check username and password and print the result
*
* @param user
* @param password
*/
public static void loginVoid(String user, String password) {
if (user.equals("user") && password.equals("abc123")) {
System.out.println(" LOG IN SUCCESSFUL");
} else {
System.out.println(" LOG IN FAILED");
}
}
/**
* A method that check username and password and generate result
* @param user
* @param password
* @return true only if user name and password are : user / abc123
*/
public static boolean loginReturn(String user, String password) {
return user.equals("user") && password.equals("abc123");
}
// if (user.equals("user") && password.equals("abc123") ){
// return true;
// }else {
// return false;
// }
}
|
[
"tamus88@mail.ru"
] |
tamus88@mail.ru
|
6c9527d60e0346c1517cf715449346e08cf5a125
|
dd1adec7b3b58f00f91e6163370e9329c9017f4d
|
/LimfaSportyy/src/com/Servelets/UpdateServ.java
|
63ddb1dcfb484ccf654eb99381062b1b8dc5d9fe
|
[] |
no_license
|
pr4sh4ntSingh/SposrtsClub
|
12c9dec0fceee62e6470ac5f177ab0d72b9f4d84
|
a925d2f0e492613657ff1970d47266a1babcdfe2
|
refs/heads/master
| 2021-01-01T19:45:17.799094
| 2017-07-28T17:36:53
| 2017-07-28T17:36:53
| 98,673,749
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,369
|
java
|
package com.Servelets;
import java.io.IOException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import com.bean.RegistrationBean;
import com.dbutil.CrudOperation;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
/**
* Servlet implementation class UpdateServ
*/
@WebServlet("/UpdateServ")
public class UpdateServ extends HttpServlet {
private static final long serialVersionUID = 1L;
private Connection con=null;
private PreparedStatement ps,ps1;
private RegistrationBean rb=new RegistrationBean();
public UpdateServ() {
super();
// TODO Auto-generated constructor stub
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
con=CrudOperation.createConnection();
String q="update login set isverified=1 where userid='"+request.getParameter("update")+"'";
String q1="update registration set isverified=1 where userid='"+request.getParameter("update")+"'";
try{
con.setAutoCommit(false);
ps=con.prepareStatement(q);
ps1=con.prepareStatement(q1);
int i=ps.executeUpdate();
int j=ps1.executeUpdate();
if(i>0&&j>0)
{
con.commit();
response.sendRedirect("/Sportsclub/jsp/requests.jsp");}
}
catch(SQLException se)
{
System.out.println(se);
}
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
con=CrudOperation.createConnection();
rb.setName(request.getParameter("name"));
rb.setAddr(request.getParameter("address"));
rb.setPhone(Long.parseLong(request.getParameter("phone")));
rb.setGame(request.getParameter("game"));
rb.setGender(request.getParameter("gender"));
rb.setId(request.getParameter("id"));
rb.setIdtype(request.getParameter("idtype"));
rb.setIdno(request.getParameter("idno"));
rb.setPhone(Long.parseLong(request.getParameter("phone")));
rb.setPassword(request.getParameter("password"));
rb.setRole(request.getParameter("role"));
String regisq="update registration set name=?,game=?,phone=?, idtype=?, idno=?, role=? ,sex=?,address=?,password=? where userid=? ";
try
{
con.setAutoCommit(false);
ps=con.prepareStatement(regisq);
//ps1=con.prepareStatement(loginq);
ps.setString(10,rb.getId());
ps.setString(1,rb.getName());
ps.setString(2,rb.getGame());
ps.setLong(3,rb.getPhone());
ps.setString(4,rb.getIdtype());
ps.setString(5,rb.getIdno());
ps.setString(6,rb.getRole());
///ps.setString(7,"33d");
ps.setString(7,rb.getGender());
ps.setString(8,rb.getAddr());
ps.setString(9,rb.getPassword());
System.out.println(ps);
/* ps1.setString(1,rb.getId());
ps1.setString(2,rb.getName());
ps1.setString(3,rb.getPassword());
ps1.setString(4,rb.getRole());
*/
int i=ps.executeUpdate();
int j=1;
if(i>0&&j>0)
{
con.commit();
response.sendRedirect("/Sportsclub/jsp/success.jsp");
}
}
catch(SQLException se)
{
System.out.print(se);
}
}
}
|
[
"pr4sh4ntSingh@users.noreply.github.com"
] |
pr4sh4ntSingh@users.noreply.github.com
|
daa226f424b68d22933653df3561416f4b2878f4
|
ad8dae7ddef0de6ff2901daf7275a601c0780f8f
|
/customer_manage_system/src/com/shi/ui/CustomerView.java
|
5f8faf4149b65b05c00a33d4f1d4bdc68cfdf6f1
|
[] |
no_license
|
qianwensea/Customer_Manage_System
|
8332365d8238fa0ee09db7dde2a6fab52d59cd4b
|
49ff12f9fecc9ba0008154383f389f9a9b5ee4d0
|
refs/heads/master
| 2021-04-13T21:32:09.885681
| 2020-03-22T14:06:57
| 2020-03-22T14:06:57
| 249,191,204
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 6,087
|
java
|
package com.shi.ui;
import com.shi.bean.Customer;
import com.shi.service.CustomerList;
import com.shi.util.CMUtility;
/**
*
* @ClassName: CustomerView
* @Description: TODO(CustomerView为主模块,负责菜单的显示和处理用户操作)
* @author 千文sea
* @date 2020年3月22日
*
*/
public class CustomerView {
CustomerList customerList = new CustomerList(20);
public CustomerView() {
Customer cust = new Customer("张三", '男', 30, "010-56251234", "123@email.com");
customerList.addCustomer(cust);
}
/**
*
* @Title: main
* @Description: TODO(程序入口)
* @param @param args 参数
* @return void 返回类型
*/
public static void main(String[] args) {
CustomerView test = new CustomerView();
test.enterMainMenu();
}
/**
*
* @Title: enterMainMenu
* @Description: TODO(显示客户信息界面)
* @param 参数
* @return void 返回类型
*/
public void enterMainMenu() {
while (true) {
System.out.println("-----------------客户信息管理软件------------------\n");
System.out.println(" 1 添加客户");
System.out.println(" 2 修改客户");
System.out.println(" 3 删除客户");
System.out.println(" 4 客户列表");
System.out.println(" 5 退 出\n");
System.out.print(" 请选择<1 - 5>: ");
char c = CMUtility.readMenuSelection();
switch (c) {
case '1':
addNewCustomer();
break;
case '2':
modifyCustomer();
break;
case '3':
deleteCustomer();
break;
case '4':
listAllCustomers();
break;
case '5':
System.out.print("确认是否退出(Y/N):");
char isExit = CMUtility.readConfirmSelection();
if (isExit == 'Y')
return;
}
}
}
/**
*
* @Title: addNewCustomer
* @Description: TODO(添加客户操作)
* @param 参数
* @return void 返回类型
*/
private void addNewCustomer() {
System.out.println("----------------------添加客戶---------------------\n");
System.out.print("姓名:");
String name = CMUtility.readString(10);
System.out.print("性別:");
char gender = CMUtility.readChar();
System.out.print("年龄:");
int age = CMUtility.readInt();
System.out.print("电话:");
String phone = CMUtility.readString(13);
System.out.print("邮箱:");
String email = CMUtility.readString(21);
// 将数据封装到对象中
Customer cust = new Customer(name, gender, age, phone, email);
boolean isSuccess = customerList.addCustomer(cust);
if (isSuccess) {
System.out.println("----------------------添加成功---------------------\n");
} else {
System.out.println("----------------------客戶目录已满,添加失败---------------------\n");
}
}
/**
*
* @Title: modifyCustomer
* @Description: TODO(修改客户操作)
* @param 参数
* @return void 返回类型
*/
private void modifyCustomer() {
System.out.println("----------------------修改客戶---------------------\n");
Customer cust;
int n;
while (true) {
System.out.print("请输入要修改的客户编号(输入-1退出): ");
n = CMUtility.readInt();
if (n == -1) {
return;
}
cust = customerList.getCustomer(n - 1);
if (cust == null) {
System.out.print("无法找到指定客户!");
} else { // 找到了客户
break;
}
}
// 修改客户信息
System.out.print("姓名(" + cust.getName() + "):");
String name = CMUtility.readString(10, cust.getName());
System.out.print("性别(" + cust.getGender() + "):");
char gender = CMUtility.readChar(cust.getGender());
System.out.print("年龄(" + cust.getAge() + "):");
int age = CMUtility.readInt(cust.getAge());
System.out.print("电话(" + cust.getPhone() + "):");
String phone = CMUtility.readString(15, cust.getPhone());
System.out.print("邮箱(" + cust.getEmail() + "):");
String email = CMUtility.readString(25, cust.getEmail());
Customer cust1 = new Customer(name, gender, age, phone, email);
customerList.replaceCustomer(n - 1, cust1);
System.out.println("----------------------修改客戶成功---------------------\n");
}
/**
*
* @Title: deleteCustomer
* @Description: TODO(删除客户操作)
* @param 参数
* @return void 返回类型
*/
private void deleteCustomer() {
System.out.println("------------------------删除客戶-----------------------\n");
int n;
Customer cust;
while (true) {
System.out.print("请输入要删除的客户编号(输入-1退出): ");
n = CMUtility.readInt();
if (n == -1) {
return;
}
cust = customerList.getCustomer(n - 1);
if (cust == null) {
System.out.print("无法找到指定客户!");
} else { // 找到了客户
break;
}
}
System.out.print("确认是否删除(Y/N):");
char isDelete = CMUtility.readConfirmSelection();
if (isDelete == 'N')
return;
customerList.deleteCustomer(n - 1);
System.out.println("----------------------删除客戶成功---------------------\n");
}
/**
*
* @Title: listAllCustomers
* @Description: TODO(遍历客户操作)
* @param 参数
* @return void 返回类型
*/
private void listAllCustomers() {
System.out.println("----------------------------客户列表---------------------------\n");
int total = customerList.getTotal();
if (total == 0) {
System.out.println("没有客户记录");
} else {
System.out.println("编号\t姓名\t性别\t年龄\t电话\t\t邮箱");
Customer[] allCustomers = customerList.getAllCustomers();
for (int i = 0; i < allCustomers.length; i++) {
System.out.println((i + 1) + "\t" + allCustomers[i].getName() + "\t" + allCustomers[i].getGender()
+ "\t" + allCustomers[i].getAge() + "\t" + allCustomers[i].getPhone() + "\t"
+ allCustomers[i].getEmail());
}
}
System.out.println("-------------------------客户列表完成--------------------------\n");
}
}
|
[
"1280973473@qq.com"
] |
1280973473@qq.com
|
1d229218191e793314b79654c0aea6cb0af14fae
|
c022b73b9cab4569532eb8266d3ee0ac141cd9c1
|
/gaodelocation/src/main/java/com/pateo/qiuzhiwen/gaodelocation/Utils.java
|
294a7cb895268104d5271f00b3f70c70489634f5
|
[] |
no_license
|
SalePig/GaodeAMap
|
9fda4275d24e177da45a6b0c56ec75daaf288c3f
|
b13e9f0b6c95aee59880d5aa78a799e14c9ab0f8
|
refs/heads/master
| 2021-08-22T20:53:14.894144
| 2017-12-01T08:15:39
| 2017-12-01T08:15:39
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,528
|
java
|
///**
// *
// */
//package com.pateo.qiuzhiwen.gaodelocation;
//
//import android.text.TextUtils;
//
//import com.amap.api.location.AMapLocation;
//
//import java.text.SimpleDateFormat;
//import java.util.Locale;
//
//
//public class Utils {
// /**
// * 开始定位
// */
// public final static int MSG_LOCATION_START = 0;
// /**
// * 定位完成
// */
// public final static int MSG_LOCATION_FINISH = 1;
// /**
// * 停止定位
// */
// public final static int MSG_LOCATION_STOP= 2;
//
// public final static String KEY_URL = "URL";
// public final static String URL_H5LOCATION = "file:///android_asset/location.html";
// /**
// * 根据定位结果返回定位信息的字符串
// * @param
// * @return
// */
// public synchronized static String getLocationStr(AMapLocation location){
// if(null == location){
// return null;
// }
// StringBuffer sb = new StringBuffer();
// //errCode等于0代表定位成功,其他的为定位失败,具体的可以参照官网定位错误码说明
// if(location.getErrorCode() == 0){
// sb.append("定位成功" + "\n");
// sb.append("定位类型: " + location.getLocationType() + "\n");
// sb.append("经 度 : " + location.getLongitude() + "\n");
// sb.append("纬 度 : " + location.getLatitude() + "\n");
// sb.append("精 度 : " + location.getAccuracy() + "米" + "\n");
// sb.append("提供者 : " + location.getProvider() + "\n");
//
// if (location.getProvider().equalsIgnoreCase(
// android.location.LocationManager.GPS_PROVIDER)) {
// // 以下信息只有提供者是GPS时才会有
// sb.append("速 度 : " + location.getSpeed() + "米/秒" + "\n");
// sb.append("角 度 : " + location.getBearing() + "\n");
// // 获取当前提供定位服务的卫星个数
// sb.append("星 数 : "
// + location.getSatellites() + "\n");
// } else {
// // 提供者是GPS时是没有以下信息的
// sb.append("国 家 : " + location.getCountry() + "\n");
// sb.append("省 : " + location.getProvince() + "\n");
// sb.append("市 : " + location.getCity() + "\n");
// sb.append("城市编码 : " + location.getCityCode() + "\n");
// sb.append("区 : " + location.getDistrict() + "\n");
// sb.append("区域 码 : " + location.getAdCode() + "\n");
// sb.append("地 址 : " + location.getAddress() + "\n");
// sb.append("兴趣点 : " + location.getPoiName() + "\n");
// //定位完成的时间
// sb.append("定位时间: " + formatUTC(location.getTime(), "yyyy-MM-dd HH:mm:ss") + "\n");
// }
// } else {
// //定位失败
// sb.append("定位失败" + "\n");
// sb.append("错误码:" + location.getErrorCode() + "\n");
// sb.append("错误信息:" + location.getErrorInfo() + "\n");
// sb.append("错误描述:" + location.getLocationDetail() + "\n");
// }
// //定位之后的回调时间
// sb.append("回调时间: " + formatUTC(System.currentTimeMillis(), "yyyy-MM-dd HH:mm:ss") + "\n");
// return sb.toString();
// }
//
// private static SimpleDateFormat sdf = null;
// public synchronized static String formatUTC(long l, String strPattern) {
// if (TextUtils.isEmpty(strPattern)) {
// strPattern = "yyyy-MM-dd HH:mm:ss";
// }
// if (sdf == null) {
// try {
// sdf = new SimpleDateFormat(strPattern, Locale.CHINA);
// } catch (Throwable e) {
// }
// } else {
// sdf.applyPattern(strPattern);
// }
// return sdf == null ? "NULL" : sdf.format(l);
// }
//}
|
[
"631486894@qq,com"
] |
631486894@qq,com
|
bad65cc5ce7aa4a8f488aba840515ffb3bb130df
|
1a98aaf1f74d11278fc85ea241abe4b5736a9854
|
/hybris/custom/shopping/shoppingstorefront/web/src/com/shopping/storefront/controllers/cms/PurchasedCategorySuggestionComponentController.java
|
19e62e93f0c34aa2df30314fde4dcee17929547c
|
[] |
no_license
|
ram0996/Ram
|
e85fc5de1945fed2835232bfed8f3cdd3144877d
|
2f1669207d691655e1c54768e03ac5bb24581afb
|
refs/heads/master
| 2022-04-28T06:22:56.611584
| 2022-03-22T03:13:43
| 2022-03-22T03:13:43
| 94,010,826
| 0
| 0
| null | 2022-03-22T03:15:24
| 2017-06-11T14:43:40
|
Java
|
UTF-8
|
Java
| false
| false
| 2,153
|
java
|
/*
* Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
*/
package com.shopping.storefront.controllers.cms;
import de.hybris.platform.acceleratorcms.model.components.PurchasedCategorySuggestionComponentModel;
import de.hybris.platform.acceleratorcms.model.components.SimpleSuggestionComponentModel;
import de.hybris.platform.acceleratorstorefrontcommons.controllers.cms.AbstractCMSComponentController;
import de.hybris.platform.commercefacades.product.data.ProductData;
import com.shopping.facades.suggestion.SimpleSuggestionFacade;
import com.shopping.storefront.controllers.ControllerConstants;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Controller for CMS PurchasedCategorySuggestionComponent
*/
@Controller("PurchasedCategorySuggestionComponentController")
@RequestMapping(value = ControllerConstants.Actions.Cms.PurchasedCategorySuggestionComponent)
public class PurchasedCategorySuggestionComponentController extends
AbstractCMSComponentController<PurchasedCategorySuggestionComponentModel>
{
@Resource(name = "simpleSuggestionFacade")
private SimpleSuggestionFacade simpleSuggestionFacade;
@Override
protected void fillModel(final HttpServletRequest request, final Model model,
final PurchasedCategorySuggestionComponentModel component)
{
final List<ProductData> productSuggestions = simpleSuggestionFacade
.getReferencesForPurchasedInCategory(component.getCategory().getCode(), component.getProductReferenceTypes(),
component.isFilterPurchased(), component.getMaximumNumberProducts());
model.addAttribute("title", component.getTitle());
model.addAttribute("suggestions", productSuggestions);
}
@Override
protected String getView(final PurchasedCategorySuggestionComponentModel component)
{
return ControllerConstants.Views.Cms.ComponentPrefix + StringUtils.lowerCase(SimpleSuggestionComponentModel._TYPECODE);
}
}
|
[
"venkat05.hybris@gmail.com"
] |
venkat05.hybris@gmail.com
|
8de33c30e33c34fb9b7de2a2cfb3b48129b59d36
|
8492c3c795559cb66c8b78af196ed46f4b122378
|
/141_Linked_List_Cycle/src/ListNode.java
|
294df78a62d9928dfed2476a23a027cd3cc81140
|
[] |
no_license
|
Sparklemax/LeetCode_Learn
|
f8a7284fb38aefc41c00b9b85fd132001399d7f9
|
7cc3c27642257311e2427a835e3a159f3651ae40
|
refs/heads/master
| 2020-06-26T20:57:18.113135
| 2019-09-20T12:39:11
| 2019-09-20T12:39:11
| 199,755,965
| 2
| 2
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,289
|
java
|
import java.util.List;
/**
* @author Sparklemax
* @date 2019/9/3 19:56
*/
public class ListNode {
int val;
ListNode next;
ListNode(){
}
ListNode(int x){
val = x;
next = null;
}
public ListNode buildListNode(String s){
ListNode first = null,last = null,newNode;
for (int i = 0; i < s.length(); i++) {
if(Character.isDigit((s.charAt(i)))){
newNode = new ListNode(s.charAt(i)-'0');
newNode.next = null;
if (first == null){
first = newNode;
last = newNode;
} else {
last.next = newNode;
last = newNode;
}
}
}
return first;
}
public ListNode buildListNode(String s,int pos){
ListNode first = null,last = null,newNode;
int len = 0;
for (int i = 0; i < s.length(); i++) {
if(Character.isDigit((s.charAt(i)))){
len++;
newNode = new ListNode(s.charAt(i)-'0');
newNode.next = null;
if (first == null){
first = newNode;
last = newNode;
} else {
last.next = newNode;
last = newNode;
}
}
}
ListNode p = first;
if(pos>-1&&pos<len){
for (int i = 0; i <= pos; i++) {
last.next = p;
last = p;
p = p.next;
}
}
return first;
}
public ListNode buildListNode(int[] input){
ListNode first = null,last = null,newNode;
for (int i = 0; i < input.length; i++) {
newNode = new ListNode(input[i]);
newNode.next = null;
if(first == null){
first = newNode;
last = newNode;
} else {
last.next = newNode;
last = newNode;
}
}
return first;
}
public void print(){
if(this.next==null)
System.out.println(this.val);
else {
System.out.print(this);
this.next.print();
}
}
}
|
[
"sparklemax@outlook.com"
] |
sparklemax@outlook.com
|
08a072879ea9aa790d899f1951431338284d8677
|
2ce438f7d13db58228592ed72ee01e4fcbfc2594
|
/StudyEveryDay/study_music/src/main/java/com/example/study_music/com/xkh/music/main/index/album/AlbumInfoDelegate.java
|
f590204a2cd015928880fd6a11036a52c9668928
|
[] |
no_license
|
xiakehe/music
|
ed54ec515ac59c19c173b58c505de2f89acde586
|
340921f950894afcbd477a7ddf82725439bf7bbf
|
refs/heads/master
| 2020-03-25T18:08:37.638334
| 2018-08-18T14:05:33
| 2018-08-18T14:05:33
| 144,014,814
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,341
|
java
|
package com.example.study_music.com.xkh.music.main.index.album;
import android.os.Bundle;
import android.support.v4.media.MediaBrowserCompat;
import android.util.Log;
import android.widget.ImageView;
import android.widget.TextView;
import com.example.study_core.delegate.BaseDelegate;
import com.example.study_music.R;
import com.example.study_music.R2;
import com.example.study_music.com.xkh.music.player.ui.MediaBrowserDelegate;
import com.example.study_music.com.xkh.music.util.Contact;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import butterknife.BindView;
public class AlbumInfoDelegate extends MediaBrowserDelegate implements AlbumInfoView{
private String albumId = null;
@BindView(R2.id.iv_album_info_bg)
ImageView bgView;
@BindView(R2.id.iv_album_info_pic)
ImageView albumPic;
@BindView(R2.id.tv_album_info_title)
TextView albumName;
@BindView(R2.id.tv_album_info_artist)
TextView albumArtist;
@BindView(R2.id.tv_album_info_public_time)
TextView albumTime;
@BindView(R2.id.tv_album_info_comment)
TextView albumComment;
@BindView(R2.id.tv_album_info_collection)
TextView albumCollection;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
albumId = getArguments().getString(Contact.PARAM_ALBUM_ID, "");
}
@Override
public Object setLayout() {
return R.layout.delegate_album_info;
}
@Override
protected void hidePlayBack() {
}
@Override
protected void showPlayBack() {
}
@Override
protected void onConnected(MediaBrowserCompat browserCompat) {
//browserCompat.subscribe();
}
@Override
public boolean onBackPressedSupport() {
pop();
return true;
}
@Override
public void onDestroyView() {
super.onDestroyView();
Log.d("AlbumInfoDelegate", "onDestroyView");
}
@NotNull
@Override
public BaseDelegate getHostDelegate() {
return this;
}
@Override
public void startLoading() {
}
@Override
public void onLoadSuccess() {
}
@Override
public void onLoadError(@NotNull String error) {
}
@Override
public void loadAlbumMusicList() {
}
}
|
[
"xiakehes@126.com"
] |
xiakehes@126.com
|
15a9440c2309dd3220d00ee11a3db737e9303912
|
bd0e9daa768b5332942b59686b9d9dcee7a668ec
|
/src/main/java/it/polimi/deib/provaFinale/cantiniDignani/view/gui/GiocatoreView.java
|
2c34ba807fbb0693e082c4d50791c5361f821c47
|
[] |
no_license
|
aecant/Sheepland
|
f977903420843153c3d9b6c91c0640bdbf4d429c
|
caaa8b03eb0b4b2f8660cc46c12c38d1c558b1f8
|
refs/heads/master
| 2020-04-08T23:36:09.540320
| 2018-12-03T16:26:02
| 2018-12-03T16:26:02
| 159,832,029
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,816
|
java
|
package it.polimi.deib.provaFinale.cantiniDignani.view.gui;
import it.polimi.deib.provaFinale.cantiniDignani.controller.MainClient;
import it.polimi.deib.provaFinale.cantiniDignani.model.Giocatore;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
import javax.swing.border.EmptyBorder;
/**
* Classe che si occupa della visualizzazione grafica di un giocatore
* @author alessandrodignani
*
*/
public class GiocatoreView extends JPanel {
static final long serialVersionUID = 554747254657044516L;
JPanel contenitore = new JPanel();
JPanel panelNome = new JPanel(new FlowLayout());
JLabel lblNome;
JPanel panelSoldi;
JLabel lblSoldi;
protected GiocatoreView(Giocatore g) {
super();
setPreferredSize(CostantiGui.DIMENSIONE_PANEL_GIOCATORE);
setOpaque(false);
setLayout(new BorderLayout());
contenitore.setPreferredSize(CostantiGui.DIMENSIONE_GIOCATORE_NON_CORRENTE);
contenitore.setBackground(g.getPastori().get(0).getColore().getColoreView());
contenitore.setLayout(new BorderLayout());
contenitore.setBorder(new EmptyBorder(10, 10, 10, 10));
lblNome = new JLabel(g.getNome());
lblNome.setFont(CostantiGui.FONT_NOME_GIOCATORE);
lblNome.setVerticalAlignment(SwingConstants.CENTER);
lblNome.setHorizontalAlignment(SwingConstants.CENTER);
lblSoldi = new JLabel(g.getDenaro().toString());
lblSoldi.setFont(CostantiGui.FONT_SOLDI);
Image img = Toolkit.getDefaultToolkit().getImage(CostantiGui.PERCORSO_IMMAGINI + "soldi.png").getScaledInstance(CostantiGui.DIMENSIONE_PANEL_TESSERA.width, CostantiGui.DIMENSIONE_PANEL_TESSERA.height, 0);
panelSoldi = new BackgroundPanel(img);
panelSoldi.setPreferredSize(CostantiGui.DIMENSIONE_PANEL_SOLDI);
panelSoldi.add(lblSoldi);
panelSoldi.setBackground(new Color(0, 0, 0, 0));
lblSoldi.setHorizontalAlignment(SwingConstants.CENTER);
panelNome.setBackground(CostantiGui.COLORE_SFONDO_NOME_GIOC);
panelNome.setLayout(new BorderLayout());
panelNome.add(lblNome, BorderLayout.CENTER);
panelNome.add(panelSoldi, BorderLayout.WEST);
contenitore.add(panelNome, BorderLayout.CENTER);
add(contenitore, BorderLayout.EAST);
}
protected void aggiorna() {
lblSoldi.setText("");
lblSoldi.setText(MainClient.getDatiPartita().getGiocatore(lblNome.getText()).getDenaro().toString());
panelSoldi.repaint();
panelNome.repaint();
contenitore.repaint();
repaint();
}
protected void setCorrente() {
contenitore.setPreferredSize(CostantiGui.DIMENSIONE_GIOCATORE_CORRENTE);
aggiorna();
}
protected void setNonCorrente() {
contenitore.setPreferredSize(CostantiGui.DIMENSIONE_GIOCATORE_NON_CORRENTE);
aggiorna();
}
}
|
[
"alessandro.dignani@mail.polimi.it"
] |
alessandro.dignani@mail.polimi.it
|
784cad94c07d8e79576df5986e007a9a7d91e102
|
0c0f7d6b46b9830ff4baf4a7ae52d6ea74e16248
|
/xauth/src/main/java/com/github/haozi/config/DatabaseConfiguration.java
|
d2ad40d9dad4823ef5dbf0dcbda19bed9bf6a822
|
[] |
no_license
|
haoziapple/hello-world
|
e4b76c1447613f55eff36ca65d1cf62bb6113fb1
|
945d20701749592ae2ed9de25b22d688f7a3bec2
|
refs/heads/master
| 2023-01-31T22:51:23.500400
| 2019-07-12T03:09:41
| 2019-07-12T03:09:41
| 52,886,890
| 3
| 0
| null | 2023-01-11T22:17:36
| 2016-03-01T15:21:52
|
Java
|
UTF-8
|
Java
| false
| false
| 2,010
|
java
|
package com.github.haozi.config;
import io.github.jhipster.config.JHipsterConstants;
import io.github.jhipster.config.h2.H2ConfigurationHelper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import java.sql.SQLException;
@Configuration
@EnableJpaRepositories("com.github.haozi.repository")
@EnableJpaAuditing(auditorAwareRef = "springSecurityAuditorAware")
@EnableTransactionManagement
public class DatabaseConfiguration {
private final Logger log = LoggerFactory.getLogger(DatabaseConfiguration.class);
private final Environment env;
public DatabaseConfiguration(Environment env) {
this.env = env;
}
/**
* Open the TCP port for the H2 database, so it is available remotely.
*
* @return the H2 database TCP server
* @throws SQLException if the server failed to start
*/
@Bean(initMethod = "start", destroyMethod = "stop")
@Profile(JHipsterConstants.SPRING_PROFILE_DEVELOPMENT)
public Object h2TCPServer() throws SQLException {
String port = getValidPortForH2();
log.debug("H2 database is available on port {}", port);
return H2ConfigurationHelper.createServer(port);
}
private String getValidPortForH2() {
int port = Integer.parseInt(env.getProperty("server.port"));
if (port < 10000) {
port = 10000 + port;
} else {
if (port < 63536) {
port = port + 2000;
} else {
port = port - 2000;
}
}
return String.valueOf(port);
}
}
|
[
"haozixiaowang@163.com"
] |
haozixiaowang@163.com
|
d8cf8c98e1425ba16e9c9168736281c60718bbd6
|
56326a61656e5ca4e96ac735f2bfe34abe894f3f
|
/manam.java
|
3343f2a98eb312becff2a84b0b2e4bf25b07068f
|
[] |
no_license
|
AshokKanjarla/Ashoka
|
ee95f7ee2207dc7013a1ccb446ecbba65e011b60
|
20f5356afee0fd598d4f8aa3e4cdc8886b7a6d8e
|
refs/heads/master
| 2020-08-04T16:08:06.968658
| 2019-10-01T21:06:14
| 2019-10-01T21:06:14
| 212,197,441
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 54
|
java
|
package com.nt.oops;
public class manam {
}
|
[
"noreply@github.com"
] |
noreply@github.com
|
a5bb6f74100839a2879bd8c36d7cb947e461c7a0
|
907f98fb1cfe2422e4de7664f128c106b79c484a
|
/sources/file/src/main/java/com/informatica/binge/sources/file/POS.java
|
55343063dea607f59a358238aaf952079b25fb57
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
maduhu/Surf
|
2cb6bddc3a8e3f8f11e9be72542bd40e7386d97b
|
f53bdef74fa9f7ae596b4dd2690201d3cad8a799
|
refs/heads/master
| 2020-12-24T19:51:21.763996
| 2014-04-10T06:58:10
| 2014-04-10T06:58:10
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 914
|
java
|
/*
* Copyright 2014 Informatica Corp.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.informatica.binge.sources.file;
/**
* Object to hold file position of send
*/
class POS {
private long pos;
POS(long p) {
pos = p;
}
POS() {
}
void setPosition(long p) {
pos = p;
}
long getPosition() {
return pos;
}
}
|
[
"jraj@informatica.com"
] |
jraj@informatica.com
|
06d5efd793f271370de630ab3ecc928696c0daa3
|
a949b3c85d4bd89462b826e27648e753356020b6
|
/src/main/java/com/codility/Project_Euler/p125.java
|
969355a3632414a7724985b020e80ca66565c01b
|
[] |
no_license
|
Chaklader/Codility
|
99b37522ae748fd06d4384dc5747baca54e7745a
|
dd68a7b42e191abc9089f3b9193322e1d7933fe8
|
refs/heads/main
| 2022-07-17T11:47:29.061068
| 2022-07-06T07:08:17
| 2022-07-06T07:08:17
| 144,351,836
| 1
| 8
| null | 2021-01-01T15:33:48
| 2018-08-11T03:19:46
|
Java
|
UTF-8
|
Java
| false
| false
| 801
|
java
|
package com.codility.Project_Euler;/*
* Solution to Project Euler problem 125
* Copyright (c) Project Nayuki. All rights reserved.
*
* https://www.nayuki.io/page/project-euler-solutions
* https://github.com/nayuki/Project-Euler-solutions
*/
import java.util.HashSet;
import java.util.Set;
public final class p125 implements EulerSolution {
public static void main(String[] args) {
System.out.println(new p125().run());
}
public String run() {
Set<Integer> nums = new HashSet<>();
for (int i = 1; i <= 10000; i++) {
int sum = i * i;
for (int j = i + 1; ; j++) {
sum += j * j;
if (sum >= 100000000)
break;
if (Library.isPalindrome(sum))
nums.add(sum);
}
}
long sum = 0;
for (int x : nums)
sum += x;
return Long.toString(sum);
}
}
|
[
"omi.chaklader@gmail.com"
] |
omi.chaklader@gmail.com
|
3b5221ceaa53465dc826c6ca0b23a74db3a93aa7
|
4552214a7a89edae1b470e047d599d97dfcf01e0
|
/nguyenngoctruong/ext_task/src/com/NguyenTruong/Model/Work.java
|
124feb0e805ba39f2ff840d3a600d2e295d9fb64
|
[] |
no_license
|
vickutetg/tm0614android
|
f09073791b5636e72ba59ea0d9352c614fdaad26
|
001ad1dd12a4894407eccb97b58d1570b8df40f8
|
refs/heads/master
| 2020-05-31T17:29:14.970607
| 2015-02-03T13:43:42
| 2015-02-03T13:43:42
| 34,943,933
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 757
|
java
|
package com.NguyenTruong.Model;
public class Work {
private String work;
private int hour;
private int minute;
private int second;
private boolean check = false;
public String getWork() {
return work;
}
public void setWork(String work) {
this.work = work;
}
public int getHour() {
return hour;
}
public void setHour(int hour) {
this.hour = hour;
}
public int getMinute() {
return minute;
}
public void setMinute(int minute) {
this.minute = minute;
}
public int getSecond() {
return second;
}
public void setSecond(int second) {
this.second = second;
}
public boolean isCheck() {
return check;
}
public void setCheck(boolean check) {
this.check = check;
}
}
|
[
"nguyentruong8392@gmail.com@f6597a64-05d1-0719-f566-4b59fd94b772"
] |
nguyentruong8392@gmail.com@f6597a64-05d1-0719-f566-4b59fd94b772
|
a1b41743795b90336f5dc534d3f2d4c0b315ea5d
|
41c7b0e9ba497ea704acdb77a9e637e8b91d26b5
|
/java-thread/src/com/family/biz/FatherThread.java
|
71c636c4ebc2eabf8e64650dc557493fcfa1fe30
|
[] |
no_license
|
hzy2435/java-advance
|
2ac02d1b97e26096fc18ab9f00e24b17d7845190
|
7912c1a616f72e53844e27e152b15eca0983805e
|
refs/heads/master
| 2020-05-26T10:22:34.541756
| 2019-05-23T09:19:34
| 2019-05-23T09:19:34
| 188,201,913
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 478
|
java
|
package com.family.biz;
import com.family.entity.Father;
public class FatherThread implements Runnable {
private Father father;
public FatherThread(Father father) {
this.father = father;
}
@Override
public void run() {
while (true) {
try {
Thread.sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
father.earnMoney(10);
}
}
}
|
[
"hzy2435@foxmail.com"
] |
hzy2435@foxmail.com
|
2e0d9a61115716148fcfb9405d3ee8fb10c62497
|
1e42210b5c1586060b7996e8aa0bde60ea40b762
|
/JAVA/TutorialLevel0Bot/src/MicroUtils.java
|
454bb5cd4ddcc678c1ccff4f65b4e9a544da73fd
|
[
"MIT"
] |
permissive
|
hengkey/hengkeyAI_JAVA
|
54524071d84fd837c549b62feb4e6fd3ad849476
|
813a08e57db3c07ea7d9f827dfd8317e5065012b
|
refs/heads/master
| 2020-03-20T10:27:19.844989
| 2018-08-24T12:20:25
| 2018-08-24T12:20:25
| 137,339,874
| 0
| 0
| null | null | null | null |
UHC
|
Java
| false
| false
| 32,803
|
java
|
import java.util.ArrayList;
import java.util.List;
import bwapi.DamageType;
import bwapi.Pair;
import bwapi.Player;
import bwapi.Position;
import bwapi.TechType;
import bwapi.Unit;
import bwapi.UnitSizeType;
import bwapi.UnitType;
import bwapi.UpgradeType;
import bwapi.WeaponType;
import bwta.BWTA;
import bwta.BaseLocation;
import bwta.Chokepoint;
import bwta.Region;
public class MicroUtils {
public static boolean isFactoryUnit(UnitType unitType) {
return unitType == UnitType.Terran_Vulture
|| unitType == UnitType.Terran_Siege_Tank_Siege_Mode
|| unitType == UnitType.Terran_Siege_Tank_Tank_Mode
|| unitType == UnitType.Terran_Goliath;
}
public static Unit getUnitIfVisible(UnitInfo enemyInfo) {
Unit enemy = MyBotModule.Broodwar.getUnit(enemyInfo.getUnitID()); // 보이는 적에 대한 조건
boolean canSee = enemy != null && enemy.getType() != UnitType.Unknown;
if (canSee) {
return enemy;
} else {
return null;
}
}
public static boolean isSafePlace(Unit rangedUnit) {
boolean isSafe = true;
List<UnitInfo> nearEnemisUnitInfos = InformationManager.Instance().getNearbyForce(rangedUnit.getPosition(), InformationManager.Instance().enemyPlayer, MicroSet.Tank.SIEGE_MODE_MAX_RANGE);
for (UnitInfo ui : nearEnemisUnitInfos) {
Unit unit = MyBotModule.Broodwar.getUnit(ui.getUnitID()); // 보이는 적에 대한 조건
if (unit != null && unit.getType() != UnitType.Unknown) {
if (!unit.isCompleted() && unit.getHitPoints() + 10 <= unit.getType().maxHitPoints()) { // 완성되지 않은 타워는 까도 된다.
continue;
}
}
if (ui.getType().isWorker() || MyBotModule.Broodwar.getDamageFrom(ui.getType(), rangedUnit.getType()) == 0) {
continue;
}
double distanceToNearEnemy = rangedUnit.getDistance(ui.getLastPosition());
WeaponType nearEnemyWeapon = rangedUnit.isFlying() ? ui.getType().airWeapon() : ui.getType().groundWeapon();
int enemyWeaponMaxRange = MyBotModule.Broodwar.enemy().weaponMaxRange(nearEnemyWeapon);
double enmeyTopSpeed = MyBotModule.Broodwar.enemy().topSpeed(ui.getType());
double backOffDist = ui.getType().isBuilding() ? MicroSet.Common.BACKOFF_DIST_DEF_TOWER : 0.0;
// 근처의 모든 적에 대해 안전거리 확보 : 안전거리 = 사정거리 + topSpeed() * 24 (적이 1.0초 이동거리)
if (distanceToNearEnemy <= enemyWeaponMaxRange + enmeyTopSpeed * 24 + backOffDist) {
isSafe = false;
break;
}
}
return isSafe;
}
// (지상유닛 대상) position의 적의 사정거리에서 안전한 지역인지 판단한다. 탱크, 방어건물 등 포함
public static boolean isSafePlace(Position position) {
boolean isSafe = true;
List<UnitInfo> nearEnemisUnitInfos = InformationManager.Instance().getNearbyForce(position, InformationManager.Instance().enemyPlayer, MicroSet.Tank.SIEGE_MODE_MAX_RANGE);
for (UnitInfo ui : nearEnemisUnitInfos) {
// if (!safeMine) {
// Unit unit = MyBotModule.Broodwar.getUnit(ui.getUnitID());
// if (unit != null && unit.getType() != UnitType.Unknown) {
// if (!unit.isCompleted() && unit.getHitPoints() + 10 <= unit.getType().maxHitPoints()) {
// continue;
// }
// }
// }
if (ui.getType().isWorker() || !typeCanAttackGround(ui.getType())) {
continue;
}
double distanceToNearEnemy = position.getDistance(ui.getLastPosition());
WeaponType nearEnemyWeapon = ui.getType().groundWeapon();
int enemyWeaponMaxRange = MyBotModule.Broodwar.enemy().weaponMaxRange(nearEnemyWeapon);
double enmeyTopSpeed = MyBotModule.Broodwar.enemy().topSpeed(ui.getType());
double backOffDist = ui.getType().isBuilding() ? MicroSet.Common.BACKOFF_DIST_DEF_TOWER : 0.0;
if (distanceToNearEnemy <= enemyWeaponMaxRange + enmeyTopSpeed * 24 + backOffDist) {
isSafe = false;
break;
}
}
return isSafe;
}
public static boolean smartScan(Position targetPosition) {
// if (targetPosition.isValid()) {
// MyBotModule.Broodwar.sendText("SmartScan : bad position");
// return false;
// }
if (MapGrid.Instance().scanIsActiveAt(targetPosition)) {
// MyBotModule.Broodwar.sendText("SmartScan : last scan still on");
return false;
}
// Choose the comsat with the highest energy.
// If we're not terran, we're unlikely to have any comsats....
int maxEnergy = 49; // anything greater is enough energy for a scan
Unit comsat = null;
for (Unit unit : MyBotModule.Broodwar.self().getUnits()) {
if (unit.getType() == UnitType.Terran_Comsat_Station && unit.getEnergy() > maxEnergy && unit.canUseTech(TechType.Scanner_Sweep, targetPosition)) {
maxEnergy = unit.getEnergy();
comsat = unit;
}
}
if (comsat != null) {
MapGrid.Instance().scanAtPosition(targetPosition);
return comsat.useTech(TechType.Scanner_Sweep, targetPosition);
}
return false;
}
@Deprecated
public static int groupKite(List<Unit> rangedUnits, List<Unit> targets, int coolTime) {
UnitType rangedUnitType = rangedUnits.get(0).getType();
int totalCount = rangedUnits.size();
int readyToCount = 0;
if (totalCount == 0) {
// MyBotModule.Broodwar.sendText("groupKite : totalCount is zero");
return 0;
}
for (Unit rangedUnit : rangedUnits) {
if (rangedUnit.getPlayer() != MyBotModule.Broodwar.self() ||
!CommandUtil.IsValidUnit(rangedUnit) ||
rangedUnit.getType() != rangedUnitType) {
// MyBotModule.Broodwar.sendText("groupKite : bad arg");
return 0;
}
if (rangedUnit.getGroundWeaponCooldown() == 0) {
readyToCount++;
}
}
Position rangedUnitsPosition = centerOfUnits(rangedUnits);
Position targetsPosition = centerOfUnits(targets);
if (coolTime > 0) {
return coolTime - 1;
} else if (readyToCount > totalCount * 0.7) {
return rangedUnitType.groundWeapon().damageCooldown(); // 골리앗 쿨타운 : 22 (frame)
} else {
int reverseX = rangedUnitsPosition.getX() - targetsPosition.getX(); // 타겟과 반대로 가는 x양
int reverseY = rangedUnitsPosition.getY() - targetsPosition.getY(); // 타겟과 반대로 가는 y양
double fleeRadian = Math.atan2(reverseY, reverseX);
Position fleeVector = new Position((int)(200 * Math.cos(fleeRadian)), (int)(200 * Math.sin(fleeRadian)));
// if (timeToCatch >= 0) { // 진격하라
// fleeVector = new Position(-fleeVector.getX(), -fleeVector.getY());
// }
for (Unit rangedUnit : rangedUnits) {
int x = rangedUnit.getPosition().getX() + fleeVector.getX();
int y = rangedUnit.getPosition().getY() + fleeVector.getY();
Position movePosition = new Position(x, y);
rangedUnit.rightClick(movePosition);
}
return 0;
}
}
public static boolean groundUnitFreeKiting(Unit rangedUnit, int freeKitingRadius) {
List<Unit> units = MapGrid.Instance().getUnitsNear(rangedUnit.getPosition(), freeKitingRadius, true, false, null);
boolean freeKiting = true;;
int myGroundUnitCount = 0;
for (Unit unit : units) {
if (unit.getType().isWorker() || unit.isFlying() || unit.getType().isBuilding()) {
continue;
}
if (++myGroundUnitCount > 2) {
freeKiting = false;
break;
}
}
return freeKiting;
}
/**
* rangeUnit은 target에 대한 카이팅을 한다.
*/
public static void preciseKiting(Unit rangedUnit, UnitInfo targetInfo, KitingOption kitingOption) {
Unit target = MicroUtils.getUnitIfVisible(targetInfo);
if (target != null) {
preciseKiting(rangedUnit, target, kitingOption);
} else {
CommandUtil.attackMove(rangedUnit, targetInfo.getLastPosition());
}
}
public static void preciseKiting(Unit rangedUnit, Unit target, KitingOption kitingOption) {
// 유닛 유효성 검사
if (rangedUnit.getPlayer() != MyBotModule.Broodwar.self() ||
!CommandUtil.IsValidUnit(rangedUnit) ||
!CommandUtil.IsValidUnit(target, false, false)) {
// MyBotModule.Broodwar.sendText("smartKiteTarget : bad arg");
return;
}
boolean cooltimeAlwaysAttack = kitingOption.isCooltimeAlwaysAttack();
boolean unitedKiting = kitingOption.isUnitedKiting();
Integer[] fleeAngle = kitingOption.getFleeAngle();
Position goalPosition = kitingOption.getGoalPosition();
boolean survivalInstinct = false;
boolean haveToAttack = false;
// rangedUnit, target 각각의 지상/공중 무기를 선택
WeaponType rangedUnitWeapon = target.isFlying() ? rangedUnit.getType().airWeapon() : rangedUnit.getType().groundWeapon();
WeaponType targetWeapon = rangedUnit.isFlying() ? target.getType().airWeapon() : target.getType().groundWeapon();
if ((!rangedUnit.isUnderAttack() && target.getType().isWorker())
|| (rangedUnit.getType() == UnitType.Terran_Vulture && target.getType() == UnitType.Terran_Vulture)) {
haveToAttack = true;
} else if (rangedUnit.getType() != UnitType.Terran_Vulture && MyBotModule.Broodwar.self().weaponMaxRange(rangedUnitWeapon) <= MyBotModule.Broodwar.enemy().weaponMaxRange(targetWeapon)) {
// 건물 또는 보다 긴 사정거리를 가진 적에게 카이팅은 무의미하다.
haveToAttack = true;
} else {
double distanceToTarget = rangedUnit.getDistance(target);
double distanceToAttack = distanceToTarget - MyBotModule.Broodwar.self().weaponMaxRange(rangedUnitWeapon); // 거리(pixel)
int timeToCatch = (int) (distanceToAttack / rangedUnit.getType().topSpeed()); // 상대를 잡기위해 걸리는 시간 (frame) = 거리(pixel) / 속도(pixel per frame)
// 명령에 대한 지연시간(latency)을 더한다.
timeToCatch += MicroSet.Network.LATENCY * 2; // 후퇴해야 하는 경우, 지연시간을 더하면 도망을 더 늦게갈 수도 있다. if (distanceToAttack > 0) // TODO 조절가능
// timeToCatch += target.getType().isWorker() ? 12 : 0; // 일꾼에게는 좀 덜 도망가도 된다.
int currentCooldown = rangedUnit.isStartingAttack() ? rangedUnitWeapon.damageCooldown() // // 쿨타임시간(frame)
: (target.isFlying() ? rangedUnit.getAirWeaponCooldown() : rangedUnit.getGroundWeaponCooldown());
survivalInstinct = !killedByNShot(rangedUnit, target, 1) && killedByNShot(target, rangedUnit, 2); // 생존본능(딸피)
// [카이팅시 공격조건]
// - 상대가 때리기 위해 거리를 좁혀야 할때(currentCooldown <= timeToCatch)
// - 쿨타임이 되었을때 (cooltimeAlwaysAttack && currentCooldown) (파라미터로 설정가능)
if (currentCooldown <= timeToCatch) {
haveToAttack = true;
} else if (!survivalInstinct && cooltimeAlwaysAttack && currentCooldown == 0) {
haveToAttack = true;
}
}
// 공격 또는 회피
if (haveToAttack) {
CommandUtil.attackUnit(rangedUnit, target);
} else {
boolean approachKiting = false;
int approachDistance = 100;
if (target.getType().isBuilding() && target.getType() != UnitType.Zerg_Hatchery) { // 해처리 라바때문에 마인 폭사함
approachKiting = true;
approachDistance = 80;
} else if (target.getType() == UnitType.Terran_Siege_Tank_Siege_Mode && rangedUnit.getType() == UnitType.Terran_Vulture) {
approachKiting = true;
approachDistance = 15;
} else if ((target.getType() == UnitType.Protoss_Carrier || target.getType() == UnitType.Zerg_Overlord)
&& rangedUnit.getType() == UnitType.Terran_Goliath) {
approachKiting = true;
approachDistance = 100;
}
if (approachKiting) {
if (rangedUnit.getDistance(target) >= approachDistance) {
rangedUnit.rightClick(target.getPosition());
} else {
CommandUtil.attackUnit(rangedUnit, target);
}
} else {
// 피가 거의 없거나, 근처에 아군이 거의 없으면(쿨타운시간동안 이동할수 있는 거리 * 0.8) 회피설정을 높힌다.
if (survivalInstinct || groundUnitFreeKiting(rangedUnit, (int) (rangedUnit.getType().topSpeed() * rangedUnit.getType().groundWeapon().damageCooldown() * 0.8))) {
unitedKiting = false;
fleeAngle = MicroSet.FleeAngle.WIDE_ANGLE;
}
KitingOption fleeOption = KitingOption.defaultKitingOption();
fleeOption.setUnitedKiting(unitedKiting);
fleeOption.setGoalPosition(goalPosition);
fleeOption.setFleeAngle(fleeAngle);
preciseFlee(rangedUnit, target.getPosition(), fleeOption);
}
}
}
public static void preciseFlee(Unit rangedUnit, Position targetPosition, KitingOption fleeOption) {
preciseFlee(rangedUnit, targetPosition, fleeOption, false);
}
public static void preciseFlee(Unit rangedUnit, Position targetPosition, KitingOption fleeOption, boolean bunker) {
double rangedUnitSpeed = rangedUnit.getType().topSpeed() * 24.0; // 1초(24frame)에 몇 pixel가는지
if (rangedUnit.getType() == UnitType.Terran_Vulture) {
rangedUnitSpeed += MicroSet.Upgrade.getUpgradeAdvantageAmount(UpgradeType.Ion_Thrusters);
}
// getFleePosition을 통해 최적의 회피지역을 선정한다.
// if (fleeOption.isFleeGoalPosition()) {
// double saveRadian = rangedUnit.getAngle(); // 유닛의 현재 각
// Position saveFleeVector = new Position((int)(rangedUnitSpeed * Math.cos(saveRadian)), (int)(rangedUnitSpeed * Math.sin(saveRadian))); // 이동벡터
// Position saveMovePosition = new Position(rangedUnit.getPosition().getX() + saveFleeVector.getX(), rangedUnit.getPosition().getY() + saveFleeVector.getY()); // 회피지점
// Position saveMiddlePosition = new Position(rangedUnit.getPosition().getX() + saveFleeVector.getX() / 2, rangedUnit.getPosition().getY() + saveFleeVector.getY() / 2); // 회피중간지점
// int risk = riskOfFleePosition(rangedUnit.getType(), saveMovePosition, (int) rangedUnitSpeed, false); // 회피지점에서의 예상위험도
//
// // 본진찍고 회피하는 것이 안전한가?
// if (risk < 10 && isValidGroundPosition(saveMovePosition)
// && isValidGroundPosition(saveMiddlePosition)
// && isConnectedPosition(rangedUnit.getPosition(), saveMovePosition)) {
// fleePosition = fleeOption.getGoalPosition();
// }
// }
Position fleePosition = null;
boolean unitedKiting = fleeOption.isUnitedKiting();
Position goalPosition = fleeOption.getGoalPosition();
Integer[] fleeAngle = fleeOption.getFleeAngle();
if (rangedUnit.getType() == UnitType.Terran_Marine) {
fleePosition = MicroMarine.getFleePosition(rangedUnit, targetPosition, (int) rangedUnitSpeed, unitedKiting, goalPosition, fleeAngle, bunker);
} else {
fleePosition = getFleePosition(rangedUnit, targetPosition, (int) rangedUnitSpeed, unitedKiting, goalPosition, fleeAngle);
}
// MyBotModule.Broodwar.drawCircleMap(fleePosition, 20, Color.Cyan);
rangedUnit.rightClick(fleePosition);
// CommandUtil.rightClick(rangedUnit, fleePosition);
}
/**
*
* rangedUnit은 target으로부터 회피한다.
*
* @param rangedUnit
* @param target
* @param moveDistPerSec : 초당 이동거리(pixel per 24frame). 해당 pixel만큼의 거리를 회피지점으로 선정한다. 찾지 못했을 경우 거리를 좁힌다.
* @param unitedKiting
* @param goalPosition
* @return
*/
private static Position getFleePosition(Unit rangedUnit, Position targetPosition, int moveDistPerSec, boolean unitedKiting, Position goalPosition, Integer[] fleeAngle) {
int reverseX = rangedUnit.getPosition().getX() - targetPosition.getX(); // 타겟과 반대로 가는 x양
int reverseY = rangedUnit.getPosition().getY() - targetPosition.getY(); // 타겟과 반대로 가는 y양
final double fleeRadian = Math.atan2(reverseY, reverseX); // 회피 각도
Position safePosition = null; // 0.0 means the unit is facing east.
int minimumRisk = 99999;
int minimumDistanceToGoal = 99999;
// Integer[] FLEE_ANGLE = MicroSet.FleeAngle.getFleeAngle(rangedUnit.getType()); // MicroData.FleeAngle에 저장된 유닛타입에 따른 회피 각 범위(골리앗 새끼들은 뚱뚱해서 각이 넓으면 지들끼리 낑김)
Integer[] FLEE_ANGLE = fleeAngle != null ? MicroSet.FleeAngle.getLagImproveAngle(fleeAngle) : MicroSet.FleeAngle.getFleeAngle(rangedUnit.getType());
double fleeRadianAdjust = fleeRadian; // 회피 각(radian)
int moveCalcSize = moveDistPerSec; // 이동 회피지점의 거리 = 유닛의 초당이동거리
int riskRadius = MicroSet.RiskRadius.getRiskRadius(rangedUnit.getType());
while (safePosition == null && moveCalcSize > 10) {
for(int i = 0 ; i< FLEE_ANGLE.length; i ++) {
Position fleeVector = new Position((int)(moveCalcSize * Math.cos(fleeRadianAdjust)), (int)(moveCalcSize * Math.sin(fleeRadianAdjust))); // 이동벡터
Position movePosition = new Position(rangedUnit.getPosition().getX() + fleeVector.getX(), rangedUnit.getPosition().getY() + fleeVector.getY()); // 회피지점
Position middlePosition = new Position(rangedUnit.getPosition().getX() + fleeVector.getX() / 2, rangedUnit.getPosition().getY() + fleeVector.getY() / 2); // 회피중간지점
int risk = riskOfFleePosition(rangedUnit.getType(), movePosition, riskRadius, unitedKiting); // 회피지점에서의 예상위험도
int distanceToGoal = goalPosition == null? 0 : movePosition.getApproxDistance(goalPosition); // 위험도가 같을 경우 2번째 고려사항: 목표지점까지의 거리
// 회피지점은 유효하고, 걸어다닐 수 있어야 하고, 안전해야 하고 등등
if (isValidGroundPosition(movePosition)
&& isValidGroundPosition(middlePosition)
&& MyBotModule.Broodwar.hasPath(rangedUnit.getPosition(), movePosition)
&& (risk < minimumRisk || (risk == minimumRisk && distanceToGoal < minimumDistanceToGoal))
&& isConnectedPosition(rangedUnit.getPosition(), movePosition)) {
safePosition = movePosition;
minimumRisk = risk;
minimumDistanceToGoal = distanceToGoal;
}
fleeRadianAdjust = rotate(fleeRadian, FLEE_ANGLE[i]); // 각도변경
}
if (safePosition == null) { // 회피지역이 없을 경우 1) 회피거리 짧게 잡고 다시 조회
moveCalcSize = moveCalcSize * 2 / 3;
// riskRadius = riskRadius * 2 / 3;
if (moveCalcSize <= 10 && FLEE_ANGLE.equals(MicroSet.FleeAngle.NARROW_ANGLE)) { // 회피지역이 없을 경우 2) 각 범위를 넓힘
FLEE_ANGLE = MicroSet.FleeAngle.WIDE_ANGLE;
unitedKiting = false;
moveCalcSize = moveDistPerSec;
}
}
}
if (safePosition == null) { // 회피지역이 없을 경우 3) 목표지점으로 간다. 이 경우는 거의 없다.
safePosition = goalPosition;
}
// MyBotModule.Broodwar.drawCircleMap(safePosition, 5, Color.Red, true);
return safePosition;
}
/**
* 회피지점의 위험도
*
* @param unitType
* @param position
* @param radius
* @param united
* @return
*/
public static int riskOfFleePosition(UnitType unitType, Position position, int radius, boolean united) {
int risk = 0;
List<Unit> unitsInRadius = MyBotModule.Broodwar.getUnitsInRadius(position, radius);
for (Unit u : unitsInRadius) {
if (u.getPlayer() == InformationManager.Instance().enemyPlayer) { // 적군인 경우
if (MyBotModule.Broodwar.getDamageFrom(u.getType(), unitType) > 0) { // 적군이 공격할 수 있으면 위험하겠지
if (u.getType().isWorker()) { // 일꾼은 그다지 위험하지 않다고 본다.
risk += 1;
} else if (u.getType().isBuilding()) { // 건물이 공격할 수 있으면 진짜 위험한거겠지
risk += 15;
} else if (!u.getType().isFlyer()) { // 날아다니지 않으면 길막까지 하니까
risk += 10;
} else { // 날아다니면 길막은 하지 않으니까
risk += 5;
}
} else { // 적군이 공격할 수 없을 때
if (u.getType().isBuilding()) {
risk += 5;
} else if (!u.getType().isFlyer()) {
risk += 3;
} else {
risk += 1;
}
}
} else if (u.getPlayer() == InformationManager.Instance().selfPlayer) { // 아군인 경우, united값에 따라 좋은지 싫은지 판단을 다르게 한다.
if (!u.getType().isFlyer()) {
risk += united ? -3 : 3;
} else {
risk += united ? -1 : 1;
}
} else { // 중립(미네랄, 가스 등)
risk += 1;
}
}
return risk;
}
public static Position vultureRegroupPosition(List<Unit> vultureList, int radius) {
Position centerOfUnits = MicroUtils.centerOfUnits(vultureList);
Chokepoint closestChoke = null;
double closestDist = 999999;
double minimumRisk = 999999;
for (Chokepoint choke : BWTA.getChokepoints()) {
int risk = MicroUtils.riskOfFleePosition(UnitType.Terran_Vulture, choke.getCenter(), radius, true);
double distToChoke = centerOfUnits.getDistance(choke.getCenter());
if (risk < minimumRisk || (risk == 0 && distToChoke < closestDist)) {
closestChoke = choke;
closestDist = distToChoke;
}
}
if (closestChoke != null) {
return closestChoke.getCenter();
} else {
return null;
}
}
// * 참조사이트: http://yc0345.tistory.com/45
// 공식: radian = (π / 180) * 각도
// -> 각도 = (radian * 180) / π
// -> 회원 radian = (π / 180) * ((radian * 180) / π + 회전각)
public static double rotate(double radian, int angle) {
double rotatedRadian = (Math.PI / 180) * ((radian * 180 / Math.PI) + angle);
return rotatedRadian;
}
public static boolean isUnitContainedInUnitSet(Unit unit, List<Unit> unitSet) {
for (Unit u : unitSet) {
if (u.getID() == unit.getID())
return true;
}
return false;
}
public static boolean addUnitToUnitSet(Unit unit, List<Unit> unitSet) {
if (!isUnitContainedInUnitSet(unit, unitSet)) {
return unitSet.add(unit);
}
return false;
}
public static List<Unit> getUnitsInRegion(Region region, Player player) {
List<Unit> units = new ArrayList<>();
for (Unit unit : player.getUnits()) {
if (region == BWTA.getRegion(unit.getPosition())) {
units.add(unit);
}
}
return units;
}
public static boolean typeCanAttackGround(UnitType attacker) {
return attacker.groundWeapon() != WeaponType.None ||
attacker == UnitType.Terran_Bunker ||
attacker == UnitType.Protoss_Carrier ||
attacker == UnitType.Protoss_Reaver;
}
public static boolean killedByNShot(Unit attacker, Unit target, int shot) {
UnitType attackerType = attacker.getType();
UnitType targetType = target.getType();
int multiply = shot;
if (attackerType == UnitType.Protoss_Zealot
|| attackerType == UnitType.Terran_Goliath && targetType.isFlyer()) {
multiply *= 2;
}
int damageExpected = MyBotModule.Broodwar.getDamageFrom(attackerType, targetType, attacker.getPlayer(), target.getPlayer()) * multiply;
int targetHitPoints = target.getHitPoints();
if (targetType.maxShields() == 0 && !targetType.regeneratesHP()) {
if (damageExpected >= targetHitPoints) {
return true;
}
}
int spareDamage = damageExpected - targetHitPoints;
if (spareDamage > 0) {
int targetShields = target.getShields();
if (targetShields == 0) {
return true;
}
DamageType explosionType = getDamageType(attacker, target);
UnitSizeType targetUnitSize = getUnitSize(targetType);
if (explosionType == DamageType.Explosive) {
if (targetUnitSize == UnitSizeType.Small) {
spareDamage *= 2;
} else if (targetUnitSize == UnitSizeType.Medium) {
spareDamage *= 4/3;
}
} else if (explosionType == DamageType.Concussive) {
if (targetUnitSize == UnitSizeType.Medium) {
spareDamage *= 2;
} else if (targetUnitSize == UnitSizeType.Large) {
spareDamage *= 4;
}
}
if (spareDamage > targetShields + target.getPlayer().getUpgradeLevel(UpgradeType.Protoss_Plasma_Shields)) {
return true;
}
}
return false;
}
public static List<Unit> filterTargets(List<Unit> targets, boolean includeFlyer) {
List<Unit> newTargets = new ArrayList<>();
for (Unit target : targets) {
if (!includeFlyer && target.isFlying()) {
continue;
}
if (target.isVisible() && !target.isStasised()) {
newTargets.add(target);
}
}
return newTargets;
}
public static List<UnitInfo> filterTargetInfos(List<UnitInfo> targetInfos, boolean includeFlyer) {
List<UnitInfo> newTargetInfos = new ArrayList<>();
for (UnitInfo targetInfo : targetInfos) {
Unit target = MicroUtils.getUnitIfVisible(targetInfo);
if (target != null) {
if (!CommandUtil.IsValidUnit(target)) {
continue;
}
if (!includeFlyer && target.isFlying()) {
continue;
}
if (target.isVisible() && !target.isStasised()) {
newTargetInfos.add(targetInfo);
}
} else {
UnitType enemyUnitType = targetInfo.getType();
if (!includeFlyer && enemyUnitType.isFlyer()) {
continue;
}
newTargetInfos.add(targetInfo);
}
}
return newTargetInfos;
}
public static List<UnitInfo> filterFlyingTargetInfos(List<UnitInfo> targetInfos) {
List<UnitInfo> newTargetInfos = new ArrayList<>();
for (UnitInfo targetInfo : targetInfos) {
Unit target = MicroUtils.getUnitIfVisible(targetInfo);
if (target != null) {
if (!CommandUtil.IsValidUnit(target)) {
continue;
}
if (target.isFlying()) {
newTargetInfos.add(targetInfo);
}
} else {
UnitType enemyUnitType = targetInfo.getType();
if (enemyUnitType.isFlyer()) {
newTargetInfos.add(targetInfo);
}
}
}
return newTargetInfos;
}
public static boolean exposedByEnemy(Unit myUnit, List<UnitInfo> enemiesInfo) {
for (UnitInfo ei : enemiesInfo) {
if (myUnit.getDistance(ei.getLastPosition()) <= ei.getType().sightRange()) {
return true;
}
}
return false;
}
public static Position centerOfUnits(List<Unit> units) {
if (units.isEmpty()) {
return null;
}
// 너무 멀리떨어진 유닛은 제외하고 다시 계산한다.
Position centerPosition = null;
for (int i = 0; i < 2; i++) {
int unitCount = 0;
int x = 0;
int y = 0;
for (Unit unit : units) {
if (centerPosition != null && unit.getDistance(centerPosition) > 1000) {
continue;
}
Position pos = unit.getPosition();
if (pos.isValid()) {
x += pos.getX();
y += pos.getY();
unitCount++;
}
}
if (unitCount > 0) {
centerPosition = new Position(x / unitCount, y / unitCount);
}
}
if (!isValidGroundPosition(centerPosition)) {
Position tempPosition = null;
for (int i = 0; i < 3; i++) {
tempPosition = randomPosition(centerPosition, 100);
if (isValidGroundPosition(tempPosition)) {
centerPosition = tempPosition;
break;
}
}
}
return centerPosition;
}
public static boolean isValidGroundPosition(Position position) {
return position.isValid() && BWTA.getRegion(position) != null && MyBotModule.Broodwar.isWalkable(position.getX() / 8, position.getY() / 8);
}
public static boolean existTooNarrowChoke(Position position) {
Chokepoint nearChoke = BWTA.getNearestChokepoint(position);
if (nearChoke.getWidth() < 250 && position.getDistance(nearChoke.getCenter()) < 150) {
return true;
} else {
return false;
}
}
public static boolean isExpansionPosition(Position position) {
BaseLocation expansionBase = InformationManager.Instance().getFirstExpansionLocation(InformationManager.Instance().selfPlayer);
if (position.getDistance(expansionBase.getPosition()) < 100) {
return true;
} else {
return false;
}
}
public static boolean isConnectedPosition(Position pos1, Position pos2) {
Region regionSrc = BWTA.getRegion(pos1);
Region regionDst = BWTA.getRegion(pos2);
Pair<Region, Region> regions = BWTA.getNearestChokepoint(pos1).getRegions();
if (regionSrc == regionDst
|| regions.first == regionSrc && regions.second == regionDst
|| regions.first == regionDst && regions.second == regionSrc) {
return true;
}
return false;
}
public static Position randomPosition(Position sourcePosition, int dist) {
int x = sourcePosition.getX() + (int) (Math.random() * dist) - dist / 2;
int y = sourcePosition.getY() + (int) (Math.random() * dist) - dist / 2;
Position destPosition = new Position(x, y);
return destPosition;
}
public static Unit leaderOfUnit(List<Unit> units, Position goalPosition) {
BaseLocation enemyMainBase = InformationManager.Instance().getMainBaseLocation(InformationManager.Instance().enemyPlayer);
BaseLocation enemyFirstExpansion = InformationManager.Instance().getFirstExpansionLocation(InformationManager.Instance().enemyPlayer);
if(enemyMainBase == null){
return null;
}
BaseLocation AttackLocation = enemyMainBase;
List<BaseLocation> enemyBases = InformationManager.Instance().getOccupiedBaseLocations(InformationManager.Instance().enemyPlayer);
for(BaseLocation enemyBase : enemyBases){
if (enemyFirstExpansion.getTilePosition().equals(enemyBase.getTilePosition())){
AttackLocation = enemyFirstExpansion;
break;
}
}
Unit leader = null;
int minimumDistance = 999999;
for (Unit unit : units) {
if(unit == null){break;}
if(unit.getType() == UnitType.Terran_Siege_Tank_Tank_Mode || unit.getType() == UnitType.Terran_Siege_Tank_Siege_Mode){
int dist = unit.getDistance(AttackLocation.getPosition());
if (dist < minimumDistance) {
leader = unit;
minimumDistance = dist;
}
}
}
if(leader == null){
minimumDistance = 999999;
for (Unit unit : units) {
if(unit == null){break;}
if(unit.getType() == UnitType.Terran_Goliath){
int dist = unit.getDistance(AttackLocation.getPosition());
if (dist < minimumDistance) {
leader = unit;
minimumDistance = dist;
}
}
}
}
return leader;
}
// weapon.damageType() bwapi 오류발생하여 구현함.
private static DamageType getDamageType(Unit attacker, Unit target) {
UnitType attackerType = attacker.getType();
WeaponType weapon = target.isFlying()? attackerType.airWeapon() : attackerType.groundWeapon();
if (weapon == null || weapon == WeaponType.Unknown) {
MyBotModule.Broodwar.sendText("no weapon. no war.");
return DamageType.None;
}
if (attackerType == UnitType.Terran_Siege_Tank_Tank_Mode
|| attackerType == UnitType.Terran_Siege_Tank_Siege_Mode) {
return DamageType.Explosive;
}
if (attackerType == UnitType.Terran_Vulture
|| attackerType == UnitType.Terran_Firebat
|| attackerType == UnitType.Terran_Goliath) {
return DamageType.Concussive;
}
if (attackerType == UnitType.Terran_Goliath
|| attackerType == UnitType.Terran_Wraith
|| attackerType == UnitType.Terran_Valkyrie) {
if (weapon.targetsAir()) {
return DamageType.Explosive;
}
}
return DamageType.Normal;
}
// unitType.size() bwapi 오류발생하여 구현함.
private static UnitSizeType getUnitSize(UnitType unitType) {
if (unitType.isBuilding()) {
return UnitSizeType.Large;
} else if (unitType.isWorker()
|| unitType == UnitType.Terran_Marine
|| unitType == UnitType.Terran_Firebat
|| unitType == UnitType.Terran_Ghost
|| unitType == UnitType.Terran_Medic
|| unitType == UnitType.Protoss_Zealot
|| unitType == UnitType.Protoss_High_Templar
|| unitType == UnitType.Hero_Dark_Templar
|| unitType == UnitType.Protoss_Observer
|| unitType == UnitType.Zerg_Larva
|| unitType == UnitType.Zerg_Zergling
|| unitType == UnitType.Zerg_Infested_Terran
|| unitType == UnitType.Zerg_Broodling
|| unitType == UnitType.Zerg_Scourge
|| unitType == UnitType.Zerg_Mutalisk
) {
return UnitSizeType.Small;
} else if (unitType == UnitType.Terran_Vulture
|| unitType == UnitType.Protoss_Corsair
|| unitType == UnitType.Zerg_Hydralisk
|| unitType == UnitType.Zerg_Defiler
|| unitType == UnitType.Zerg_Queen
|| unitType == UnitType.Zerg_Lurker
) {
return UnitSizeType.Medium;
} else if (unitType == UnitType.Terran_Siege_Tank_Tank_Mode
|| unitType == UnitType.Terran_Siege_Tank_Siege_Mode
|| unitType == UnitType.Terran_Goliath
|| unitType == UnitType.Terran_Wraith
|| unitType == UnitType.Terran_Dropship
|| unitType == UnitType.Terran_Science_Vessel
|| unitType == UnitType.Terran_Battlecruiser
|| unitType == UnitType.Terran_Valkyrie
|| unitType == UnitType.Protoss_Dragoon
|| unitType == UnitType.Protoss_Archon
|| unitType == UnitType.Protoss_Reaver
|| unitType == UnitType.Protoss_Shuttle
|| unitType == UnitType.Protoss_Scout
|| unitType == UnitType.Protoss_Carrier
|| unitType == UnitType.Protoss_Arbiter
|| unitType == UnitType.Zerg_Overlord
|| unitType == UnitType.Zerg_Guardian
|| unitType == UnitType.Zerg_Devourer
) {
return UnitSizeType.Large;
}
return UnitSizeType.Small;
}
}
|
[
"hengkey2@naver.com"
] |
hengkey2@naver.com
|
c5d37a85151b74f3e9743121104a85bdfe88c48d
|
5d059d98ffd879095d503f8db0bc701fab13ed11
|
/sfm-datastax/src/test/java/org/sfm/datastax/DatastaxMapperFactoryTest.java
|
852f407a5a4c5ec1fed6b5286a568c61b776ddd2
|
[
"MIT"
] |
permissive
|
sripadapavan/SimpleFlatMapper
|
c74cce774b0326d5ea5ea141ee9f3caf07a98372
|
8359a08abb3a321b3a47f91cd4046ca1a88590fd
|
refs/heads/master
| 2021-01-17T08:11:57.463205
| 2016-02-06T14:38:44
| 2016-02-07T16:50:53
| 51,313,393
| 1
| 0
| null | 2016-02-08T17:23:12
| 2016-02-08T17:23:12
| null |
UTF-8
|
Java
| false
| false
| 4,303
|
java
|
package org.sfm.datastax;
import com.datastax.driver.core.*;
import com.datastax.driver.core.ResultSet;
import org.junit.Test;
import org.sfm.beans.DbObject;
import org.sfm.beans.TestAffinityObject;
import java.text.SimpleDateFormat;
import java.util.Iterator;
import static org.junit.Assert.*;
public class DatastaxMapperFactoryTest extends AbstractDatastaxTest {
@Test
public void testDynamicMapper() throws Exception {
testInSession(new Callback() {
@Override
public void call(Session session) throws Exception {
final DatastaxMapper<DbObject> mapper = DatastaxMapperFactory.newInstance().mapTo(DbObject.class);
ResultSet rs = session.execute("select id, name, email, creation_time, type_ordinal, type_name from dbobjects");
final Iterator<DbObject> iterator = mapper.iterator(rs);
DbObject next = iterator.next();
assertEquals(1, next.getId());
assertEquals("Arnaud Roger", next.getName());
assertEquals("arnaud.roger@gmail.com", next.getEmail());
assertEquals(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2012-10-02 12:10:10"), next.getCreationTime());
assertEquals(DbObject.Type.type2, next.getTypeOrdinal());
assertEquals(DbObject.Type.type3, next.getTypeName());
assertFalse(iterator.hasNext());
rs = session.execute("select id, name from dbobjects");
next = mapper.iterator(rs).next();
assertEquals(1, next.getId());
assertEquals("Arnaud Roger", next.getName());
assertNull(next.getEmail());
assertNull(next.getCreationTime());
assertNull(next.getTypeOrdinal());
assertNull(next.getTypeName());
rs = session.execute("select id, email from dbobjects");
next = mapper.iterator(rs).next();
assertEquals(1, next.getId());
assertNull(next.getName());
assertEquals("arnaud.roger@gmail.com", next.getEmail());
assertNull(next.getCreationTime());
assertNull(next.getTypeOrdinal());
assertNull(next.getTypeName());
rs = session.execute("select id, type_ordinal from dbobjects");
next = mapper.iterator(rs).next();
assertEquals(1, next.getId());
assertNull(next.getName());
assertNull(next.getEmail());
assertNull(next.getCreationTime());
assertEquals(DbObject.Type.type2, next.getTypeOrdinal());
assertNull(next.getTypeName());
}
});
}
@Test
public void testAlias() throws Exception {
testInSession(new Callback() {
@Override
public void call(Session session) throws Exception {
final DatastaxMapper<DbObject> mapper = DatastaxMapperFactory.newInstance().addAlias("firstname", "name").mapTo(DbObject.class);
ResultSet rs = session.execute("select id, email as firstname from dbobjects");
final Iterator<DbObject> iterator = mapper.iterator(rs);
DbObject o = iterator.next();
assertEquals(1, o.getId());
assertEquals("arnaud.roger@gmail.com", o.getName());
}
});
}
@Test
public void testTypeAffinity() throws Exception {
testInSession(new Callback() {
@Override
public void call(Session session) throws Exception {
final DatastaxMapper<TestAffinityObject> mapper = DatastaxMapperFactory.newInstance().mapTo(TestAffinityObject.class);
ResultSet rs = session.execute("select id as fromInt, email as fromString from dbobjects");
final Iterator<TestAffinityObject> iterator = mapper.iterator(rs);
TestAffinityObject o = iterator.next();
assertEquals(1, o.fromInt.i);
assertNull(o.fromInt.str);
assertEquals("arnaud.roger@gmail.com", o.fromString.str);
assertEquals(0, o.fromString.i);
}
});
}
}
|
[
"arnaud.roger@gmail.com"
] |
arnaud.roger@gmail.com
|
c42493d565380ee42865a9348099a92912192896
|
9d297f1bca4c69e12d068d6c738ed3c4d032526e
|
/src/test/java/ch/aaap/harvestclient/impl/userAssignment/UserAssignmentsApiUpdateTest.java
|
b05cca2add969c1cb55bedb685eea73f769d52b5
|
[
"MIT"
] |
permissive
|
Dan-M/harvest-client
|
84f849b502d094f30fcd53ef32f7a8574c0cdb60
|
e4c427b0461cbdfd4022790f0865ad06d6535a5a
|
refs/heads/master
| 2020-03-08T09:28:39.524312
| 2018-03-20T12:09:09
| 2018-03-20T12:09:09
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,232
|
java
|
package ch.aaap.harvestclient.impl.userAssignment;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
import ch.aaap.harvestclient.HarvestTest;
import ch.aaap.harvestclient.api.UserAssignmentsApi;
import ch.aaap.harvestclient.domain.ImmutableUserAssignment;
import ch.aaap.harvestclient.domain.Project;
import ch.aaap.harvestclient.domain.User;
import ch.aaap.harvestclient.domain.UserAssignment;
import ch.aaap.harvestclient.domain.param.ImmutableUserAssignmentUpdateInfo;
import ch.aaap.harvestclient.domain.param.UserAssignmentUpdateInfo;
import ch.aaap.harvestclient.domain.reference.Reference;
import util.ExistingData;
import util.TestSetupUtil;
@HarvestTest
class UserAssignmentsApiUpdateTest {
private static final UserAssignmentsApi userAssignmentApi = TestSetupUtil.getAdminAccess().userAssignments();
private final Reference<Project> projectReference = ExistingData.getInstance().getProjectReference();
private final Reference<User> userReference = ExistingData.getInstance().getUnassignedUser();
private UserAssignment userAssignment;
@AfterEach
void afterEach() {
if (userAssignment != null) {
userAssignmentApi.delete(projectReference, userAssignment);
}
}
@Test
void changeUser() {
Reference<User> anotherUserReference = ExistingData.getInstance().getAnotherUserReference();
userAssignment = userAssignmentApi.create(projectReference, ImmutableUserAssignment.builder()
.user(userReference)
.build());
UserAssignmentUpdateInfo updateInfo = ImmutableUserAssignmentUpdateInfo.builder()
.user(anotherUserReference)
.build();
UserAssignment updatedUserAssignment = userAssignmentApi.update(projectReference, userAssignment, updateInfo);
// Changing user id has been disabled by Harvest
assertThat(updatedUserAssignment.getUser().getId()).isEqualTo(userReference.getId());
}
@Test
void changeAll() {
userAssignment = userAssignmentApi.create(projectReference,
ImmutableUserAssignment.builder().user(userReference).build());
UserAssignmentUpdateInfo updateInfo = ImmutableUserAssignmentUpdateInfo.builder()
.hourlyRate(110.)
.budget(11111111.)
.build();
UserAssignment updatedUserAssignment = userAssignmentApi.update(projectReference, userAssignment, updateInfo);
assertThat(updatedUserAssignment).isEqualToComparingOnlyGivenFields(updateInfo, "hourlyRate",
"budget");
}
@Test
void changeActive() {
userAssignment = userAssignmentApi.create(projectReference,
ImmutableUserAssignment.builder().user(userReference).build());
UserAssignmentUpdateInfo updateInfo = ImmutableUserAssignmentUpdateInfo.builder()
.active(false)
.build();
UserAssignment updatedUserAssignment = userAssignmentApi.update(projectReference, userAssignment, updateInfo);
assertThat(updatedUserAssignment.getActive()).isEqualTo(updateInfo.getActive());
}
}
|
[
"marco@3ap.ch"
] |
marco@3ap.ch
|
6af45dadd3d0504ddeac36fc6a7918933c743847
|
f5827879e8f5e13b500fa5b8182aa722f4b4b607
|
/cdm-value-objects-values/src/main/java/org/codingmatters/value/objects/values/optional/OptionalValue.java
|
2a1fc5c1e777f326bd7f18417d1ca75ca1a7631d
|
[
"Apache-2.0"
] |
permissive
|
flexiooss/codingmatters-value-objects
|
317eb6df0f11c0d49777f19e8456fb9c07f82137
|
7f80d67cac7852d2214b1c226e7c07c76fe3a1d5
|
refs/heads/master
| 2023-09-04T11:09:09.909857
| 2023-07-06T07:20:32
| 2023-07-06T07:20:32
| 67,168,059
| 0
| 0
|
Apache-2.0
| 2023-06-28T11:50:02
| 2016-09-01T21:36:04
|
Java
|
UTF-8
|
Java
| false
| false
| 4,807
|
java
|
package org.codingmatters.value.objects.values.optional;
import org.codingmatters.value.objects.values.PropertyValue;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Optional;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
public class OptionalValue {
private final Optional<PropertyValue.Value> value;
public OptionalValue(PropertyValue.Value value) {
this.value = Optional.ofNullable(value);
}
public Optional<String> stringValue() {
if(this.value.isEmpty()) return Optional.empty();
try {
return Optional.ofNullable(this.value.get().stringValue());
} catch (AssertionError e) {
return Optional.empty();
}
}
public Optional<Long> longValue() {
if(this.value.isEmpty()) return Optional.empty();
try {
return Optional.ofNullable(this.value.get().longValue());
} catch (AssertionError e) {
return Optional.empty();
}
}
public Optional<Double> doubleValue() {
if(this.value.isEmpty()) return Optional.empty();
try {
return Optional.ofNullable(this.value.get().doubleValue());
} catch (AssertionError e) {
return Optional.empty();
}
}
public Optional<Boolean> booleanValue() {
if(this.value.isEmpty()) return Optional.empty();
try {
return Optional.ofNullable(this.value.get().booleanValue());
} catch (AssertionError e) {
return Optional.empty();
}
}
public Optional<byte[]> bytesValue() {
if(this.value.isEmpty()) return Optional.empty();
try {
return Optional.ofNullable(this.value.get().bytesValue());
} catch (AssertionError e) {
return Optional.empty();
}
}
public OptionalObjectValue objectValue() {
if(this.value.isEmpty()) return new OptionalObjectValue(null);
return new OptionalObjectValue(this.value.get().objectValue());
}
public Optional<Object> rawValue() {
if(this.value.isEmpty()) return Optional.empty();
return Optional.ofNullable(this.value.get().rawValue());
}
public Optional<LocalDate> dateValue() {
if(this.value.isEmpty()) return Optional.empty();
try {
return Optional.ofNullable(this.value.get().dateValue());
} catch (AssertionError e) {
return Optional.empty();
}
}
public Optional<LocalTime> timeValue() {
if(this.value.isEmpty()) return Optional.empty();
try {
return Optional.ofNullable(this.value.get().timeValue());
} catch (AssertionError e) {
return Optional.empty();
}
}
public Optional<LocalDateTime> datetimeValue() {
if(this.value.isEmpty()) return Optional.empty();
try {
return Optional.ofNullable(this.value.get().datetimeValue());
} catch (AssertionError e) {
return Optional.empty();
}
}
public Optional<PropertyValue.Type> type() {
if(this.value.isEmpty()) return Optional.empty();
return Optional.ofNullable(this.value.get().type());
}
public boolean isa(PropertyValue.Type type) {
if(this.value.isEmpty()) return false;
return this.value.get().isa(type);
}
public boolean isNull() {
if(this.value.isEmpty()) return true;
return this.value.get().isNull();
}
public PropertyValue.Value get() {
return value.get();
}
public boolean isPresent() {
return value.isPresent();
}
public boolean isEmpty() {
return value.isEmpty();
}
public void ifPresent(Consumer<? super PropertyValue.Value> consumer) {
value.ifPresent(consumer);
}
public Optional<PropertyValue.Value> filter(Predicate<? super PropertyValue.Value> predicate) {
return value.filter(predicate);
}
public <U> Optional<U> map(Function<? super PropertyValue.Value, ? extends U> function) {
return value.map(function);
}
public <U> Optional<U> flatMap(Function<? super PropertyValue.Value, Optional<U>> function) {
return value.flatMap(function);
}
public PropertyValue.Value orElse(PropertyValue.Value objectValue) {
return value.orElse(objectValue);
}
public PropertyValue.Value orElseGet(Supplier<? extends PropertyValue.Value> supplier) {
return value.orElseGet(supplier);
}
public <X extends Throwable> PropertyValue.Value orElseThrow(Supplier<? extends X> supplier) throws X {
return value.orElseThrow(supplier);
}
}
|
[
"nel@flexio.fr"
] |
nel@flexio.fr
|
764cdb09da6db0b768c922450a814108e6cd30d4
|
65f99eb163728bb0066876bc0009846e4ad1c4f4
|
/Phase1/Work_Stream_A/Code/DevCode/01-GN/INF/Model/src/com/beshara/csc/inf/business/deploy/CountriesSessionBean.java
|
2b3adbe2ddfe1a97707109d466514816c1691935
|
[] |
no_license
|
omarEomar/CECS-GLV
|
3aedce788b0a50041b75ec3e81159d17be1ae435
|
b429c18de09f2ea08bb4d489a5458e1f28183f83
|
refs/heads/master
| 2021-05-02T12:13:27.298284
| 2018-03-06T10:11:10
| 2018-03-06T10:11:10
| 120,736,349
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 11,634
|
java
|
package com.beshara.csc.inf.business.deploy;
import com.beshara.base.dto.IBasicDTO;
import com.beshara.base.entity.BasicEntity;
import com.beshara.base.entity.IEntityKey;
import com.beshara.base.requestinfo.IRequestInfoDTO;
import com.beshara.csc.inf.business.client.InfClientFactory;
import com.beshara.csc.inf.business.dao.CountriesDAO;
import com.beshara.csc.inf.business.dto.CountriesDTO;
import com.beshara.csc.inf.business.dto.ICountriesDTO;
import com.beshara.csc.inf.business.dto.ICountryCitiesDTO;
import com.beshara.csc.inf.business.dto.IGenderCountryDTO;
import com.beshara.csc.inf.business.entity.CountriesEntity;
import com.beshara.csc.inf.business.entity.GenderCountryEntity;
import com.beshara.csc.inf.business.entity.GenderCountryEntityKey;
import com.beshara.csc.inf.business.entity.ICountriesEntityKey;
import com.beshara.csc.sharedutils.business.exception.DataBaseException;
import com.beshara.csc.sharedutils.business.exception.ItemNotFoundException;
import com.beshara.csc.sharedutils.business.exception.SharedApplicationException;
import java.rmi.RemoteException;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.Remote;
import javax.ejb.Stateless;
import javax.ejb.TransactionManagement;
import javax.ejb.TransactionManagementType;
/**
* <b>Description:</b> * <br>  ;   ;   ;
* This Class Represents the Business Object Wrapper ( as Session Bean ) for Business Component IpIuIbIlIiIsIhIiInIgI.I * <br><br> * <b>Development Environment :</b> * <br>  ;
* Oracle JDeveloper 10g ( 10.1.3.3.0.4157 ) * <br><br> * <b>Creation/Modification History :</b> * <br>  ;   ;   ;
* Code Generator 03-SEP-2007 Created * <br>  ;   ;   ;
* Developer Name 06-SEP-2007 Updated * <br>  ;   ;   ;   ;   ;
* - Add Javadoc Comments to IMIeItIhIoIdIsI.I * * @author Beshara Group
* @author Ahmed Sabry , Sherif El-Rabbat , Taha El-Fitiany
* @version 1.0
* @since 03/09/2007
*/
/**
* <b>Description:</b> * <br>  ;   ;   ;
* This Class Represents the Business Object Wrapper ( as Session Bean ) for Business Component IpIuIbIlIiIsIhIiInIgI.I * <br><br> * <b>Development Environment :</b> * <br>  ;
* Oracle JDeveloper 10g ( 10.1.3.3.0.4157 ) * <br><br> * <b>Creation/Modification History :</b> * <br>  ;   ;   ;
* Code Generator 03-SEP-2007 Created * <br>  ;   ;   ;
* Developer Name 06-SEP-2007 Updated * <br>  ;   ;   ;   ;   ;
* - Add Javadoc Comments to IMIeItIhIoIdIsI.I * * @author Beshara Group
* @author Ahmed Sabry , Sherif El-Rabbat , Taha El-Fitiany
* @version 1.0
* @since 03/09/2007
*/
@Stateless(name = "CountriesSession", mappedName = "Inf-Model-CountriesSessionBean")
@TransactionManagement(TransactionManagementType.CONTAINER)
@Remote
public class CountriesSessionBean extends InfBaseSessionBean implements CountriesSession {
/**
* JobsSession Default Constructor */
public CountriesSessionBean() {
}
@Override
protected Class<? extends BasicEntity> getEntityClass() {
return CountriesEntity.class;
}
@Override
protected CountriesDAO DAO() {
return (CountriesDAO)super.DAO();
}
/**
* @return List
*/
@Override
public List<IBasicDTO> getAll(IRequestInfoDTO ri) throws SharedApplicationException, DataBaseException {
List<ICountriesDTO> countriesDTOList = DAO().getAll();
for (ICountriesDTO country : countriesDTOList) {
ICountryCitiesDTO countryCitiesDTO = null;
try {
countryCitiesDTO =
(ICountryCitiesDTO)InfClientFactory.getCountryCitiesClient().getCapital(((ICountriesEntityKey)country.getCode()).getCntryCode());
} catch (Exception e) {
;
}
if (countryCitiesDTO != null) {
List<ICountryCitiesDTO> list = new ArrayList<ICountryCitiesDTO>();
list.add(countryCitiesDTO);
country.setCountryCitiesDTOList(list);
}
}
return (List)countriesDTOList;
}
/**
* @param id
* @return IBasicDTO
*/
@Override
public IBasicDTO getById(IEntityKey id) throws SharedApplicationException, DataBaseException {
ICountriesDTO countriesDTO = (ICountriesDTO)DAO().getById(id);
countriesDTO.setCountryCitiesDTOList((List)InfClientFactory.getCountryCitiesClient().getCities(((ICountriesEntityKey)countriesDTO.getCode()).getCntryCode()));
return countriesDTO;
}
/**
* Returns list of all countries Name and code only * @return List
* @throws RemoteException
*/
@Override
public List<IBasicDTO> getCodeName(IRequestInfoDTO ri) throws SharedApplicationException, DataBaseException {
return DAO().getCodeName();
}
@Override
public List<IBasicDTO> searchByName(IRequestInfoDTO ri, String name) throws SharedApplicationException,
DataBaseException {
List<ICountriesDTO> countriesDTOList = (List)DAO().searchByName(name);
for (ICountriesDTO country : countriesDTOList) {
ICountryCitiesDTO countryCitiesDTO = null;
try {
countryCitiesDTO =
(ICountryCitiesDTO)InfClientFactory.getCountryCitiesClient().getCapital(((ICountriesEntityKey)country.getCode()).getCntryCode());
} catch (Exception e) {
;
}
if (countryCitiesDTO != null) {
List<ICountryCitiesDTO> list = new ArrayList<ICountryCitiesDTO>();
list.add(countryCitiesDTO);
country.setCountryCitiesDTOList(list);
}
}
return (List)countriesDTOList;
}
@Override
public List<IBasicDTO> searchByCode(IRequestInfoDTO ri, Object code) throws SharedApplicationException,
DataBaseException {
List<ICountriesDTO> countriesDTOList = (List)DAO().searchByCode(code);
for (ICountriesDTO country : countriesDTOList) {
ICountryCitiesDTO countryCitiesDTO = null;
try {
countryCitiesDTO =
(ICountryCitiesDTO)InfClientFactory.getCountryCitiesClient().getCapital(((ICountriesEntityKey)country.getCode()).getCntryCode());
} catch (Exception e) {
;
}
if (countryCitiesDTO != null) {
List<ICountryCitiesDTO> list = new ArrayList<ICountryCitiesDTO>();
list.add(countryCitiesDTO);
country.setCountryCitiesDTOList(list);
}
}
return (List)countriesDTOList;
}
/**
* return country without cities
* @author I.Omar
* */
public List<IBasicDTO> searchCountries(IRequestInfoDTO ri, Long code,
List<String> excludedList) throws SharedApplicationException,
DataBaseException {
return DAO().searchCountries(code, excludedList);
}
/**
* return country without cities
* @author I.Omar
* */
public List<IBasicDTO> searchCountries(IRequestInfoDTO ri, String name,
List<String> excludedList) throws SharedApplicationException,
DataBaseException {
return DAO().searchCountries(name, excludedList);
}
/**
* return country without excluded list
* @author I.Omar
* */
public List<IBasicDTO> getAllWithoutExcludedList(IRequestInfoDTO ri,
List<String> excludedList) throws DataBaseException,
SharedApplicationException {
return DAO().getAllWithoutExcludedList(excludedList);
}
@Override
public IBasicDTO add(IRequestInfoDTO ri, IBasicDTO basicDTO) throws SharedApplicationException, DataBaseException {
if (DAO().checkDublicateName(basicDTO.getName()).size() > 0) {
throw new DataBaseException("EnteredNameAlreadyExist");
}
ICountriesDTO countriesDTO = (CountriesDTO)basicDTO;
Long countryCode = 0L;
try {
countriesDTO = (CountriesDTO)super.add(ri, countriesDTO);
countryCode = ((ICountriesEntityKey)(countriesDTO).getCode()).getCntryCode();
for (IBasicDTO dto : countriesDTO.getGenderCountryDTOList()) {
IGenderCountryDTO genderCountry = (IGenderCountryDTO)dto;
genderCountry.setCode(new GenderCountryEntityKey(genderCountry.getGenderTypesDTO().getGentypeCode(),
countryCode));
genderCountry.setCountriesDTO(countriesDTO);
super.newDAOInstance(GenderCountryEntity.class).add(genderCountry);
}
} catch (ItemNotFoundException e) {
e.printStackTrace();
} catch (DataBaseException e) {
e.printStackTrace();
throw new DataBaseException("EnteredNameAlreadyExist");
} catch (SharedApplicationException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return countriesDTO;
}
@Override
public Boolean update(IRequestInfoDTO ri, IBasicDTO basicDTO) throws SharedApplicationException,
DataBaseException {
List<IBasicDTO> nameList = DAO().checkDublicateName(basicDTO.getName());
if (nameList != null && nameList.size() > 0) {
if (!nameList.get(0).getCode().getKey().equals(basicDTO.getCode().getKey())) {
throw new DataBaseException("EnteredNameAlreadyExist");
}
}
ICountriesDTO countriesDTO = (CountriesDTO)basicDTO;
try {
super.update(ri, countriesDTO);
for (IBasicDTO dto : countriesDTO.getGenderCountryDTOList()) {
IGenderCountryDTO genderCountry = (IGenderCountryDTO)dto;
super.newDAOInstance(GenderCountryEntity.class).update(genderCountry);
}
} catch (ItemNotFoundException e) {
e.printStackTrace();
} catch (DataBaseException e) {
e.printStackTrace();
} catch (SharedApplicationException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
rollbackTransaction();
}
return Boolean.TRUE;
}
@Override
public List<IBasicDTO> getAllOrderByClass(IRequestInfoDTO ri) throws SharedApplicationException,
DataBaseException {
return DAO().getAllOrderByClass();
}
public IBasicDTO getCodeName(IRequestInfoDTO ri, IEntityKey key) throws DataBaseException,
SharedApplicationException {
return DAO().getCodeName(key);
}
public List<IBasicDTO> getCodeNameByQulKey(IRequestInfoDTO ri, String qulKey) throws SharedApplicationException,
DataBaseException{
return DAO().getCodeNameByQulKey(qulKey);
}
}
|
[
"omarezzeldinomar@gmail.com"
] |
omarezzeldinomar@gmail.com
|
77bd0b5cf521a82ecd83f96ba122adac0c540265
|
2585a8c56f1c8f0a93da572fd33a9479dac6a421
|
/mockito-demo/src/com/demo/ICompute.java
|
cb7524c6622afc6351ce97f8b94be0415fb03002
|
[] |
no_license
|
nandakumarpurohit/JUnit-Mockito
|
851a602c304b7bc5938d15fbcfd598b3c1c13c8c
|
3bae7879f0b9399e2193c48f37571dfed5125faa
|
refs/heads/master
| 2020-05-15T13:10:29.363813
| 2019-04-19T16:04:03
| 2019-04-19T16:04:03
| 182,290,576
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 83
|
java
|
package com.demo;
public interface ICompute {
public int add(int a, int b);
}
|
[
"nandakumarpurohit@gmail.com"
] |
nandakumarpurohit@gmail.com
|
899abfe10b882fa9257a8fc5460f1312211da6d7
|
b50354cade5028c83a29d73bbcb5703eafaf9eae
|
/dailyAPI/src/com/axp/service/UserMessageDetailService.java
|
2e566fb94b74d0fbb6882c15c03dbc5ce6effa0d
|
[] |
no_license
|
jameszgw/open-pdd
|
73a8407cf6e0b80f6501fccff881f1706a398e9b
|
e51dad626170623495a966513a1e5b915336ff10
|
refs/heads/master
| 2023-07-20T18:09:12.187409
| 2019-02-20T08:44:10
| 2019-02-20T08:44:10
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 288
|
java
|
package com.axp.service;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public interface UserMessageDetailService {
Map<String, Object> msgDetail(HttpServletRequest request,HttpServletResponse response);
}
|
[
"crazyda@outlook.com"
] |
crazyda@outlook.com
|
d1ab07bb5f52f6e56bcc28da7fd3f41c4d7b42ea
|
e19a5c73ec09a701d40480f5a573d8e2e0a2c7a4
|
/GoApplication/SuGoodApp/src/com/sugood/app/activity/TuanGouCodeDetailActivity.java
|
938119bd35d6043b9c3d8df23aeaf1476add2cd3
|
[] |
no_license
|
fl02china/SuGoodApp
|
0be52f41790c8206a5a4ae8554aef1ceab9e44c9
|
bb4fae63a07af7764fc90fd6c9e9ee35c3103249
|
refs/heads/master
| 2021-01-25T04:42:15.019187
| 2017-08-09T08:14:27
| 2017-08-09T08:14:27
| 93,466,480
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,599
|
java
|
package com.sugood.app.activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.facebook.drawee.view.SimpleDraweeView;
import com.google.zxing.BarcodeFormat;
import com.google.zxing.EncodeHintType;
import com.google.zxing.WriterException;
import com.google.zxing.common.BitMatrix;
import com.google.zxing.qrcode.QRCodeWriter;
import com.sugood.app.R;
import com.sugood.app.global.Constant;
import java.util.HashMap;
import java.util.Map;
import butterknife.BindView;
import butterknife.ButterKnife;
/**
* Created by Administrator on 2017/8/4.
*/
public class TuanGouCodeDetailActivity extends BaseActivity {
@BindView(R.id.code)
TextView code;
@BindView(R.id.img_code)
ImageView imgCode;
@BindView(R.id.img)
SimpleDraweeView img;
@BindView(R.id.shopname)
TextView titlename;
@BindView(R.id.usetime)
TextView usetime;
@BindView(R.id.num)
TextView num;
@BindView(R.id.line1)
LinearLayout line1;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_codedetail);
ButterKnife.bind(this);
final Intent intent = getIntent();
final Bundle bundle = intent.getExtras();
final String tuanCode = bundle.getString("tuanCode");
code.setText("团购劵号:" + tuanCode);
titlename.setText(bundle.getString("title"));
usetime.setText(bundle.getString("faildate"));
img.setImageURI(Constant.PHOTOBASEURL+bundle.getString("photo"));
line1.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent();
intent.putExtra("tuanId", bundle.getString("tuanId"));
intent.putExtra("shopId", bundle.getString("shopId"));
intent.setClass(getApplicationContext(), TuanGouActivity.class);
startActivity(intent);
}
});
Bitmap qrBitmap = generateBitmap(tuanCode, 400, 400);
imgCode.setImageBitmap(qrBitmap);
}
void startIntent(Bundle bundle) {
Intent intent = new Intent();
intent.putExtra("tuanId", bundle.getString("tuanId"));
intent.putExtra("shopId", bundle.getString("shopId"));
intent.setClass(TuanGouCodeDetailActivity.this, TuanGouActivity.class);
startActivity(intent);
}
private Bitmap generateBitmap(String content, int width, int height) {
QRCodeWriter qrCodeWriter = new QRCodeWriter();
Map<EncodeHintType, String> hints = new HashMap<>();
hints.put(EncodeHintType.CHARACTER_SET, "utf-8");
try {
BitMatrix encode = qrCodeWriter.encode(content, BarcodeFormat.QR_CODE, width, height, hints);
int[] pixels = new int[width * height];
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
if (encode.get(j, i)) {
pixels[i * width + j] = 0x00000000;
} else {
pixels[i * width + j] = 0xffffffff;
}
}
}
return Bitmap.createBitmap(pixels, 0, width, width, height, Bitmap.Config.RGB_565);
} catch (WriterException e) {
e.printStackTrace();
}
return null;
}
}
|
[
"fl02@126.com"
] |
fl02@126.com
|
235ada88b61092fa472c0edf4ee927f89abb0c47
|
bd6c87693a19c6fa647a94c921e6b74e01e3efef
|
/Images/src/images/Images.java
|
2d07af5145aba92069f5f464df4ed9fea864b824
|
[] |
no_license
|
Citla1018A/VideoClase
|
e55919d162dfa6bf3d1da2ff4859613f9128e883
|
09d63cdbeb41fb3e60a71a6a326ec3239ac31f80
|
refs/heads/main
| 2023-03-31T13:33:24.655099
| 2021-04-05T01:46:25
| 2021-04-05T01:46:25
| 353,188,220
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 466
|
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package images;
/**
*
* @author Citlalli
*/
public class Images {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
new MainFrame();
}
}
|
[
"noreply@github.com"
] |
noreply@github.com
|
eccf5c1a01ac64d457073e400d397157de32bfe7
|
6fc69fcdf2b1cb41ae2804e1a0a7a519ea10455c
|
/com/google/android/gms/internal/zztu.java
|
9358cbc02be98845e2c77e2a9eb03ad2f11b4c1a
|
[] |
no_license
|
earlisreal/aPPwareness
|
2c168843f0bd32e3c885f9bab68917dd324991f0
|
f538ef69f16099a85c2f1a8782d977a5715d65f4
|
refs/heads/master
| 2021-01-13T14:44:54.007944
| 2017-01-19T17:17:14
| 2017-01-19T17:17:14
| 79,504,981
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,118
|
java
|
package com.google.android.gms.internal;
import java.util.HashMap;
import java.util.Map;
public class zztu {
private static final String[] zzagy;
private static final Map<String, Integer> zzagz;
static {
int i = 0;
zzagy = new String[]{"text1", "text2", "icon", "intent_action", "intent_data", "intent_data_id", "intent_extra_data", "suggest_large_icon", "intent_activity", "thing_proto"};
zzagz = new HashMap(zzagy.length);
while (i < zzagy.length) {
zzagz.put(zzagy[i], Integer.valueOf(i));
i++;
}
}
public static String zzaN(int i) {
return (i < 0 || i >= zzagy.length) ? null : zzagy[i];
}
public static int zzcl(String str) {
Integer num = (Integer) zzagz.get(str);
if (num != null) {
return num.intValue();
}
throw new IllegalArgumentException(new StringBuilder(String.valueOf(str).length() + 44).append("[").append(str).append("] is not a valid global search section name").toString());
}
public static int zzqg() {
return zzagy.length;
}
}
|
[
"earl.savadera@lpunetwork.edu.ph"
] |
earl.savadera@lpunetwork.edu.ph
|
a2ad153280abc24a730a8c1477cccebbfe1e49e6
|
2ee9a8936f889bade976b475d5ed257f49f8a32f
|
/core/src/main/java/com/huawei/openstack4j/openstack/csbs/v1/domain/CheckProtectableResp.java
|
6f8cb372c0c2872bd96b3f59f564030d4250b813
|
[
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
huaweicloud/huaweicloud-sdk-java
|
f44532a5e6eae867e9620923a9467ed431d13611
|
c1372d4be2d86382dfd20ccc084ae66c5ca4a4ce
|
refs/heads/master
| 2023-09-01T06:10:00.487173
| 2022-09-01T01:50:12
| 2022-09-01T01:50:12
| 148,595,939
| 49
| 45
|
NOASSERTION
| 2023-07-18T02:12:39
| 2018-09-13T07:01:08
|
Java
|
UTF-8
|
Java
| false
| false
| 1,889
|
java
|
/*******************************************************************************
* Copyright 2018 Huawei Technologies Co.,Ltd.
*
* 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.huawei.openstack4j.openstack.csbs.v1.domain;
import com.huawei.openstack4j.model.ModelEntity;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import lombok.Builder;
import lombok.Getter;
import lombok.ToString;
import java.util.List;
/**
* Created on 2018/10/30.
*/
@Getter
@ToString
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CheckProtectableResp implements ModelEntity {
/**
*
*/
private static final long serialVersionUID = 5644353298394286767L;
/**
* 查询参数列表
*/
private List<ProtectableResp> protectable;
}
|
[
"289228042@qq.com"
] |
289228042@qq.com
|
3cf3ccd641a3b48355a7e5918756ab90b4a9f50f
|
ac7d7a2209a09b3c101fe1928b09cd16187b4b22
|
/src/main/java/com/unbank/structure/Torrent.java
|
2cd2d9192ef9f3c83969dd3ac57f81b7c4c6588a
|
[] |
no_license
|
liangyangtao/dht_spider
|
635326a6044fd2fa32209086cebdc362bfe6fdf5
|
d7ad5aa13e9b49e9973a31aeb397e7b54ba8cd2a
|
refs/heads/master
| 2020-12-25T14:24:04.238386
| 2016-06-30T03:15:34
| 2016-06-30T03:15:34
| 62,275,579
| 2
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,423
|
java
|
package com.unbank.structure;
import java.util.Date;
import java.util.List;
/**
* torrent file structure
* @author xwl
* @version
* Created on 2016年4月4日 下午9:08:04
*/
public class Torrent {
private String info_hash;
private String announce;
private List<String> announceList;
private Date creationDate;
private String comment;
private String createdBy;
private Info info;
public String getInfo_hash() {
return info_hash;
}
public void setInfo_hash(String info_hash) {
this.info_hash = info_hash;
}
public String getAnnounce() {
return announce;
}
public void setAnnounce(String announce) {
this.announce = announce;
}
public List<String> getAnnounceList() {
return announceList;
}
public void setAnnounceList(List<String> announceList) {
this.announceList = announceList;
}
public Date getCreationDate() {
return creationDate;
}
public void setCreationDate(Date creationDate) {
this.creationDate = creationDate;
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Info getInfo() {
return info;
}
public void setInfo(Info info) {
this.info = info;
}
}
|
[
"674613438@qq.com"
] |
674613438@qq.com
|
adab71c09b839ee36d7a1245be7bb8eed9d90a03
|
6060a80f2ebe40335250c39a9892e9399e40b2d9
|
/src/main/java/com/tongyuan/temp/Main.java
|
a3e226bb1b8cd80419e3c977bafd478ea44e875b
|
[] |
no_license
|
secondzc/myAlgorithm
|
26ccdc59026fa4f0b00ce7d75ea9b2a65c1c506d
|
fd0e039e0dfcedbe6e2aaa5870acee04b433239e
|
refs/heads/master
| 2020-03-23T21:07:21.786674
| 2018-08-21T01:06:44
| 2018-08-21T01:06:44
| 142,083,228
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 576
|
java
|
package com.tongyuan.temp;
/**
* Created by zhangcy on 2018/8/13
*/
public class Main {
public static void main(String[] args) {
// Integer a = 125;
// Integer b=125;
// Integer c = 321;
// Integer d = 321;
// System.out.println(a==b);//true
// System.out.println(c==d);//false
int a = 3;
Integer b = 3;
Integer c = new Integer(3);
System.out.println(a==b);
System.out.println(a==c);
System.out.println(b==c);// b是放在cache中的,c是new出来的,所以不相等
}
}
|
[
"1146923246@qq.com"
] |
1146923246@qq.com
|
1f03bccccd11d3fec20af7ed14fa70f2296b587b
|
9800df753d62031815d6b1eaeaac7a53df5c4798
|
/src/Charts/ChartMain.java
|
009a50cd1061c0ab0ff1cf2bda1744cdead60925
|
[] |
no_license
|
giannosfor/JobChart
|
f261b7cfbf76ed7c82fcff9c6499beb360536b71
|
7bceb11c2aca04d3e6e17500e7c2c1eaaa948a04
|
refs/heads/master
| 2021-01-21T13:56:52.246592
| 2012-11-10T20:42:25
| 2012-11-10T20:42:25
| 3,185,336
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,011
|
java
|
package Charts;
import Extras.OpenFile;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.io.FileNotFoundException;
import java.io.IOException;
import javax.swing.JFrame;
import org.jfree.ui.RefineryUtilities;
public class ChartMain extends JFrame {
public ChartMain() {
super("");
setLayout(new GridLayout(2, 1));
add(new ChartData().getChartPanel());
String []array = { "Occupation Fields", null, null };
try {
add(new BarChart( OpenFile.getContent("database/query1.sql") , array ).getChartPanel() );
setDefaultCloseOperation(EXIT_ON_CLOSE);
setSize(new Dimension(800, 600));
RefineryUtilities.centerFrameOnScreen(this);
setVisible(true);
} catch (FileNotFoundException fe) {
fe.printStackTrace();
System.exit(0);
} catch (IOException ie) {
ie.printStackTrace();
System.exit(0);
}
}
}
|
[
"giannis_christofakis@hotmail.com"
] |
giannis_christofakis@hotmail.com
|
8f21ea6351a73e62e68775acee751a519f27e860
|
4bb2a02aaad7aa9a4ce5371ef5579a955599d5a8
|
/src/main/java/ru/netology/manager/ProductManager.java
|
a20338fcb9b8f8cc89996dc999c75f9eeb2c2ce0
|
[] |
no_license
|
Skitovich/exceptions
|
0582e6010c3b01ad355e433619b80589df9e1321
|
dfbffeef00ed63a4e6fb07fdece49cd30dd14db3
|
refs/heads/master
| 2022-12-30T15:13:46.489533
| 2020-10-12T16:24:49
| 2020-10-12T16:24:49
| 303,441,459
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 524
|
java
|
package ru.netology.manager;
import ru.netology.domain.Product;
import ru.netology.repository.ProductRepository;
public class ProductManager {
private ProductRepository repository;
public ProductManager(ProductRepository repository) {
this.repository = repository;
}
public void add(Product item) {
repository.save(item);
}
public void findById(int id) {
repository.findById(id);
}
public void removeById(int id) {
repository.removeById(id);
}
}
|
[
"zloycvetok@gmail.com"
] |
zloycvetok@gmail.com
|
a9362254c4ffdf46d5c5361c4aa4c0d1ac93fee3
|
155d7e5c1543f6d102479de8e54527f4b77a1b38
|
/server-core/src/main/java/io/onedev/server/model/support/issue/field/spec/userchoicefield/defaultmultivalueprovider/SpecifiedDefaultMultiValue.java
|
dcaa6e0a10dad06132f12bcdac2f3362fd6c6370
|
[
"MIT"
] |
permissive
|
theonedev/onedev
|
0945cbe8c2ebeeee781ab88ea11363217bf1d0b7
|
1ec9918988611d5eb284a21d7e94e071c7b48aa7
|
refs/heads/main
| 2023-08-22T22:37:29.554139
| 2023-08-22T14:52:13
| 2023-08-22T14:52:13
| 156,317,154
| 12,162
| 880
|
MIT
| 2023-08-07T02:33:21
| 2018-11-06T02:57:01
|
Java
|
UTF-8
|
Java
| false
| false
| 1,545
|
java
|
package io.onedev.server.model.support.issue.field.spec.userchoicefield.defaultmultivalueprovider;
import io.onedev.server.annotation.Editable;
import io.onedev.server.annotation.OmitName;
import io.onedev.server.model.Project;
import io.onedev.server.util.match.Matcher;
import io.onedev.server.util.match.PathMatcher;
import io.onedev.server.util.patternset.PatternSet;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;
@Editable(order=100, name="Use specified default value",
description = "For a particular project, the first matching entry will be used")
public class SpecifiedDefaultMultiValue implements DefaultMultiValueProvider {
private static final long serialVersionUID = 1L;
private List<DefaultMultiValue> defaultValues = new ArrayList<>();
@Editable
@Size(min=1, message="At least one entry should be specified")
@OmitName
public List<DefaultMultiValue> getDefaultValues() {
return defaultValues;
}
public void setDefaultValues(List<DefaultMultiValue> defaultValues) {
this.defaultValues = defaultValues;
}
@Override
public List<String> getDefaultValue() {
Project project = Project.get();
if (project != null) {
Matcher matcher = new PathMatcher();
for (DefaultMultiValue defaultValue : getDefaultValues()) {
if (defaultValue.getApplicableProjects() == null
|| PatternSet.parse(defaultValue.getApplicableProjects()).matches(matcher, project.getPath())) {
return defaultValue.getValue();
}
}
}
return new ArrayList<>();
}
}
|
[
"robin@onedev.io"
] |
robin@onedev.io
|
0b3b8ed889db019a956b0af280bf44337579fe7f
|
07e0462d670a956dedc8e7169bc6343806d38f1d
|
/csvideo-common/src/main/java/com/csvideo/util/FFmpegUtils.java
|
76f3ee7bce3257629b683526f2f79a6e918ed2ae
|
[] |
no_license
|
chenshuai12/csvideo1.0
|
619c3542e0b79e50961fa9c54b917757a1027246
|
20c0705c6246f4cdf63a740f2ce29f13307ffe31
|
refs/heads/master
| 2022-12-22T18:32:48.493430
| 2019-08-04T10:03:37
| 2019-08-04T10:03:37
| 180,469,124
| 5
| 1
| null | 2022-12-16T07:13:16
| 2019-04-10T00:18:13
|
JavaScript
|
UTF-8
|
Java
| false
| false
| 2,594
|
java
|
package com.csvideo.util;
import java.util.ArrayList;
import java.util.List;
/**
* Created by asus on 2019/3/21.
*/
public class FFmpegUtils {
public boolean executeCodecs(String ffmpegPath,String upFilePath,String codcFilePath,String coverPath) throws Exception{
//创建一个List集合来保存转换视频文件未fiv格式的命令
List<String> convert = new ArrayList<String>();
convert.add(ffmpegPath); //添加转换工具路径
convert.add("-i"); //添加参数“-i”,该参数指定要转换的文件
convert.add(upFilePath); //添加要转换格式的视频文件的路径
convert.add("-qscale"); //指定转换的质量
convert.add("6");
convert.add("-ab"); //设置音频码率
convert.add("64");
convert.add("-ac"); //设置声道数
convert.add("2");
convert.add("-ar"); //设置声音的采样频率
convert.add("22050");
convert.add("-r"); //设置帧频
convert.add("24");
convert.add("-y"); // 添加参数“-y”,该参数指定将覆盖已存在的文件
convert.add(codcFilePath);
//创建一个List集合来保存从视频中截取图片的命令
List<String> cutpic = new ArrayList<String >();
cutpic.add(ffmpegPath);
cutpic.add("-i");
cutpic.add(upFilePath);
cutpic.add("-y");
cutpic.add("-f");
cutpic.add("image2");
cutpic.add("-ss"); //添加参数"-ss",该参数指定街区的起始时间
cutpic.add("17");
cutpic.add("-t"); //该参数指定持续时间
cutpic.add("0.001");
cutpic.add("-s"); //截取图片大小
cutpic.add("800*280"); // 添加街区的图片大小为350*240
cutpic.add(coverPath);
boolean mark = true;
ProcessBuilder builder = new ProcessBuilder();
try {
builder.command(convert);
builder.redirectErrorStream(true);
builder.start();
builder.command(cutpic);
builder.redirectErrorStream(true);
//如果此属性为true,则任何由通过此对象的start()方法启动的后续子进程生成的错误输出都将与标准输出合并
//因此两者均可使用Process.getInputStream()方法读取。这使得关联错误信息和相应的输出变得更加容易
builder.start();
}catch (Exception e){
mark = false;
System.out.println(e);
e.printStackTrace();
}
return mark;
}
}
|
[
"2323994483@qq.com"
] |
2323994483@qq.com
|
06b878a70a5f2523aa209a6d41e4e690a1447614
|
bc16f0c2c4bbfe1e738ae8198d880e0474dda680
|
/20200618-자바연산자_1/src/이항연산자_비트연산자.java
|
90542a40562ad0ad4edfb6e56093a401a9d6fb23
|
[] |
no_license
|
Heejineee/20200619_JavaStudy
|
7f1a45a5bcb2d1682f2e5336ab37cae6e67ff4e9
|
8f7b61fe797e940fd9f48950ae51063edd445f22
|
refs/heads/master
| 2022-11-26T08:49:16.675439
| 2020-08-07T07:58:20
| 2020-08-07T07:58:20
| 273,409,384
| 0
| 0
| null | null | null | null |
UHC
|
Java
| false
| false
| 685
|
java
|
/*
* 비트연산자 => 비트와 비트를 연산
*
* &(and) |(or) ^(xor) ==> 회로, 암호화/복호화
* (*) (+) (같으면 0, 다르면 1)
* ===================
* 00 0 0 0
* 01 0 1 1
* 10 0 1 1
* 11 1 1 0
* ===================
* 10 & 5 => 1010 & 0101 = 0000 ==> 0
* 10 | 5 => 1010 | 0101 = 1111 ==>15
* 10 ^ 5 => 1010 ^ 0101 = 1111 ==>15
*
*/
public class 이항연산자_비트연산자 {
public static void main(String[] args) {
// TODO Auto-generated method stub
System.out.println(10&5);
System.out.println(10|5);
System.out.println(10^5);
}
}
|
[
"SIST@DESKTOP-I8FQNHB"
] |
SIST@DESKTOP-I8FQNHB
|
bb2197521311c277172e5721cff8a488edde6fad
|
fe30a09a98c7a8823113cdffd47892046063704b
|
/src/main/java/main/Person.java
|
2a71c8eda73c0553b1687dd38206a9149e10e469
|
[] |
no_license
|
Topoy/SberTask
|
3314c9ca228afd3b20f071b714dd4f524223ae6f
|
54d5a54315f34b333b9154f9b49bafb228a9c650
|
refs/heads/master
| 2023-05-29T01:43:49.122076
| 2021-06-15T12:24:08
| 2021-06-15T12:24:08
| 376,720,833
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,210
|
java
|
package main;
import java.math.BigDecimal;
public class Person {
private String name;
private BigDecimal wallet;
private BigDecimal appendFromBank;
public Person(String name, BigDecimal wallet) {
this.name = name;
this.wallet = wallet;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public BigDecimal getWallet() {
return wallet;
}
public void setWallet(BigDecimal wallet) {
this.wallet = wallet;
}
public BigDecimal getAppendFromBank() {
return appendFromBank;
}
public void setAppendFromBank(BigDecimal appendFromBank) {
this.appendFromBank = appendFromBank;
}
@Override
public String toString() {
return "Person{" +
"name='" + name + '\'' +
", wallet=" + wallet +
'}';
}
@Override
public boolean equals(Object o) {
if (o == null || o.getClass() != this.getClass()) {
return false;
}
Person guest = (Person) o;
return this.name.equals(guest.name) && this.wallet.equals(guest.wallet);
}
}
|
[
"rinz.ler@aiesec.net"
] |
rinz.ler@aiesec.net
|
23cb8d194121f653381e8a24771028617612abff
|
ed107eefd4714aac8f3c34acacc2bcc7b582c24b
|
/src/main/java/com/wolf/concurrenttest/io/nio/TCPClient.java
|
0cc91131dfe448e5635a721dcf6c46e62ab2b5d0
|
[] |
no_license
|
liyork/concurrenttest
|
07a7a14546b473e65e372941ebe1a444251747c6
|
5da7b5d4a0551ea7c39e0d86a8fca991b682efb0
|
refs/heads/master
| 2022-10-22T11:02:45.490207
| 2021-09-28T14:06:29
| 2021-09-28T14:06:29
| 167,670,022
| 0
| 2
| null | 2022-10-05T00:08:53
| 2019-01-26T09:08:17
|
Java
|
UTF-8
|
Java
| false
| false
| 2,115
|
java
|
package com.wolf.concurrenttest.io.nio;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.nio.ByteBuffer;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.SocketChannel;
/**
* <p> Description:
* <p/>
* Date: 2015/10/23
* Time: 13:36
*
* @author 李超
* @version 1.0
* @since 1.0
*/
public class TCPClient{
// 信道选择器
private Selector selector;
// 与服务器通信的信道
SocketChannel socketChannel;
// 要连接的服务器Ip地址
private String hostIp;
// 要连接的远程服务器在监听的端口
private int hostListenningPort;
/**
* 构造函数
* @param HostIp
* @param HostListenningPort
* @throws java.io.IOException
*/
public TCPClient(String HostIp,int HostListenningPort)throws IOException{
this.hostIp=HostIp;
this.hostListenningPort=HostListenningPort;
initialize();
}
/**
* 初始化
* @throws java.io.IOException
*/
private void initialize() throws IOException{
// 打开监听信道并设置为非阻塞模式
//触发服务端的accept
InetSocketAddress remote = new InetSocketAddress(hostIp, hostListenningPort);
socketChannel= SocketChannel.open();
socketChannel.connect(remote);
//一定要先链接后设定Blocking=false
socketChannel.configureBlocking(false);
// 打开并注册选择器到信道
selector = Selector.open();
socketChannel.register(selector, SelectionKey.OP_READ);
// 启动读取线程
new TCPClientReadThread(selector,socketChannel);
}
/**
* 发送字符串到服务器
* @param message
* @throws java.io.IOException
*/
public void sendMsg(String message) throws IOException {
ByteBuffer writeBuffer= ByteBuffer.wrap(message.getBytes("UTF-8"));
while(writeBuffer.hasRemaining()) {
socketChannel.write(writeBuffer);
}
}
public static void main(String[] args) throws IOException{
TCPClient client=new TCPClient("127.0.0.1",1978);
client.sendMsg("你好!Nio!醉里挑灯看剑,梦回吹角连营1");
client.sendMsg("你好!Nio!醉里挑灯看剑,梦回吹角连营2");
}
}
|
[
"lichao30@jd.com"
] |
lichao30@jd.com
|
371cf84c82d559bb42ef8a3e915e3ba377a7e38b
|
7e1511cdceeec0c0aad2b9b916431fc39bc71d9b
|
/flakiness-predicter/input_data/original_tests/activiti-activiti/nonFlakyMethods/org.activiti.standalone.escapeclause.ExecutionQueryEscapeClauseTest-testQueryLikeByQueryVariableValue.java
|
39d29088ce2476880a315523dbad3d6b2332c320
|
[
"BSD-3-Clause"
] |
permissive
|
Taher-Ghaleb/FlakeFlagger
|
6fd7c95d2710632fd093346ce787fd70923a1435
|
45f3d4bc5b790a80daeb4d28ec84f5e46433e060
|
refs/heads/main
| 2023-07-14T16:57:24.507743
| 2021-08-26T14:50:16
| 2021-08-26T14:50:16
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 443
|
java
|
@Test public void testQueryLikeByQueryVariableValue(){
Execution execution=runtimeService.createExecutionQuery().variableValueLike("var1","%\\%%").singleResult();
assertNotNull(execution);
assertEquals(processInstance1.getId(),execution.getId());
execution=runtimeService.createExecutionQuery().variableValueLike("var1","%\\_%").singleResult();
assertNotNull(execution);
assertEquals(processInstance2.getId(),execution.getId());
}
|
[
"aalsha2@masonlive.gmu.edu"
] |
aalsha2@masonlive.gmu.edu
|
06aed0ac8217daf03da4b53fd4078dd20850abd9
|
e9affefd4e89b3c7e2064fee8833d7838c0e0abc
|
/aws-java-sdk-lightsail/src/main/java/com/amazonaws/services/lightsail/model/transform/QueryStringObjectJsonUnmarshaller.java
|
df6469baadeb5bc044a8da1b50521592945df0b5
|
[
"Apache-2.0"
] |
permissive
|
aws/aws-sdk-java
|
2c6199b12b47345b5d3c50e425dabba56e279190
|
bab987ab604575f41a76864f755f49386e3264b4
|
refs/heads/master
| 2023-08-29T10:49:07.379135
| 2023-08-28T21:05:55
| 2023-08-28T21:05:55
| 574,877
| 3,695
| 3,092
|
Apache-2.0
| 2023-09-13T23:35:28
| 2010-03-22T23:34:58
| null |
UTF-8
|
Java
| false
| false
| 3,079
|
java
|
/*
* Copyright 2018-2023 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.lightsail.model.transform;
import java.math.*;
import javax.annotation.Generated;
import com.amazonaws.services.lightsail.model.*;
import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*;
import com.amazonaws.transform.*;
import com.fasterxml.jackson.core.JsonToken;
import static com.fasterxml.jackson.core.JsonToken.*;
/**
* QueryStringObject JSON Unmarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class QueryStringObjectJsonUnmarshaller implements Unmarshaller<QueryStringObject, JsonUnmarshallerContext> {
public QueryStringObject unmarshall(JsonUnmarshallerContext context) throws Exception {
QueryStringObject queryStringObject = new QueryStringObject();
int originalDepth = context.getCurrentDepth();
String currentParentElement = context.getCurrentParentElement();
int targetDepth = originalDepth + 1;
JsonToken token = context.getCurrentToken();
if (token == null)
token = context.nextToken();
if (token == VALUE_NULL) {
return null;
}
while (true) {
if (token == null)
break;
if (token == FIELD_NAME || token == START_OBJECT) {
if (context.testExpression("option", targetDepth)) {
context.nextToken();
queryStringObject.setOption(context.getUnmarshaller(Boolean.class).unmarshall(context));
}
if (context.testExpression("queryStringsAllowList", targetDepth)) {
context.nextToken();
queryStringObject.setQueryStringsAllowList(new ListUnmarshaller<String>(context.getUnmarshaller(String.class))
.unmarshall(context));
}
} else if (token == END_ARRAY || token == END_OBJECT) {
if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {
if (context.getCurrentDepth() <= originalDepth)
break;
}
}
token = context.nextToken();
}
return queryStringObject;
}
private static QueryStringObjectJsonUnmarshaller instance;
public static QueryStringObjectJsonUnmarshaller getInstance() {
if (instance == null)
instance = new QueryStringObjectJsonUnmarshaller();
return instance;
}
}
|
[
""
] | |
3b3b9d08314e3212b07a8f2f1d652aa39088286e
|
eae77aca393b6c543401fe8d18d7ccececd52f1a
|
/hahaha/src/spiderUtil/Search.java
|
78d1345c2cd96196f6884fd0d718b1b10e9c5706
|
[] |
no_license
|
Evaneternity/JAVA-spider
|
bb85f1f6fb8a1770f5eb09a4a72fcbe8c79d638f
|
663309a12b1f9127afa5ae17a555ddf1a6ac3a01
|
refs/heads/master
| 2021-05-12T09:34:39.021053
| 2018-01-27T02:39:35
| 2018-01-27T02:39:35
| 117,324,718
| 0
| 1
| null | 2018-01-27T02:35:13
| 2018-01-13T07:46:09
|
Java
|
GB18030
|
Java
| false
| false
| 3,677
|
java
|
package spiderUtil;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import spiderUtil.Article;
import spiderUtil.UtilMethod;
import spiderUtil.Article;
public class Search {
private String url1="https://cn.bing.com/search?q=";//利用bing搜索引擎
private String url2="+site%3Awww.bxwx9.org";//在笔下小说网站内搜索
public static String main(String s) {
// TODO Auto-generated method stub
Search sea=new Search();
String firstUrl = sea.url1+s+sea.url2;
return getArticle(sea.url1+s+sea.url2);
}
/**
* 根据网页的url获取Document对象
* @param url 搜索网页的url
* @return Document对象
*/
public static Document getDocument(String url){
Document doc = null;
try {
doc = Jsoup.connect(url).timeout(5000).get();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return doc;
}
/**
* 根据获取的Document对象找到小说名的章节列表的URL
* @param Document doc
* @return 章节列表的URL
*/
public static String getSearchUrl(Document doc){
//System.out.println(s);
Element ol = doc.select("ol").first();
//System.out.println(ol.toString());
//String regex = "<a target=\"_blank\" href=\"(.*?)\"(.*?)>(.*?)<\//a>";
String regex = "<a target=\"_blank\" href=(.*?)>(.*?)</a>";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(ol.toString());
Document nextDoc = null;
if (matcher.find()) {
nextDoc = Jsoup.parse(matcher.group());
Element href = nextDoc.select("a").first();
String muluurl=new String(href.attr("href"));
System.out.println(muluurl);
//return "http://www.bxwx.org/b/5/5131/" + href.attr("href");
//return href.attr("href");
Article article = new Article();
article.setUrl(muluurl);
Document doc1 = getDocument(muluurl);
System.out.println(getFirstChUrl(doc1));
String URl=muluurl;
for(int number=0,i=0;i<URl.length();i++)
{
if(URl.charAt(i)=='/')
{
number++;
}
if(number==6)
{
URl=URl.substring(0,i+1);
//System.out.println(s);
break;
}
}
return URl+getFirstChUrl(doc1);
}else{
return null;
}
}
/**
* 根据获取的Document对象找到小说名的第一章的URL
* @param Document doc
* @return 章小说第一章的URL
*/
public static String getFirstChUrl(Document doc){
//System.out.println(s);
Element dd = doc.select("dd").get(1);
//System.out.println(ol.toString());
String regex = "<a href=\"(.*?)\">(.*?)</a>";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(dd.toString());
Document nextDoc = null;
if (matcher.find()) {
nextDoc = Jsoup.parse(matcher.group());
Element href = nextDoc.select("a").first();
String firstchurl=new String(href.attr("href"));
System.out.println(firstchurl);
//return "http://www.bxwx.org/b/5/5131/" + href.attr("href");
//return href.attr("href");
return firstchurl;
}else{
return null;
}
}
/**
* 根据url获取id
* @param url
* @return id
*/
public static String getId(String url){
String urlSpilts[] = url.split("/");
return (urlSpilts[urlSpilts.length - 1]).split("\\.")[0];
}
/**
* 根据Url(此URL为利用bing搜索引擎在笔下小说网站搜索)返回搜索到的小说的章节列表
* @param URL
* @return URL
*/
public static String getArticle(String url){
Document doc = getDocument(url);
return(getSearchUrl(doc));
}
}
|
[
"evaneternity@gmail.com"
] |
evaneternity@gmail.com
|
bd0b6724b6ea3783c3461ce12eeced57111f7404
|
1906abfede2bbc037bf156a57451b770ec04cda7
|
/Java Program/src/com/bridgelab/functionalprograms/Gambler.java
|
5de09e574c11ae0592034aca25ca7f12b3a8bb48
|
[] |
no_license
|
Rakesh100ny/Java_Programs
|
8fc1e9199d2ec883fbd80e102bb18c63cf361805
|
d58945dee6d4f1b8a766d4a2132c038cde6fc021
|
refs/heads/master
| 2021-09-16T10:39:02.547132
| 2018-06-19T14:46:03
| 2018-06-19T14:46:03
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 854
|
java
|
/******************************************************************************
*
* Purpose : Determine Gambler problem how many time he won and also calculate percentage
* @author RakeshSoni
* @version 1.0
* @since 05-03-2018
*
******************************************************************************/
package com.bridgelab.functionalprograms;
import com.bridgelab.utility.Utility;
public class Gambler {
public static void main(String[] args) {
Utility utility = new Utility();
System.out.println("Enter Stake Value : ");
int $stack = utility.inputInteger();
System.out.println("Enter Goal Value : ");
int $goal = utility.inputInteger();
System.out.println("Enter Number of Times : ");
int noOfTimes = utility.inputInteger();
Utility.calculateGamblerWinLoss($stack, $goal, noOfTimes);
}
}
|
[
"baberwalrakesh@yahoo.com"
] |
baberwalrakesh@yahoo.com
|
ea17c5a6b6212b1343893d997c63c8c67d8e7a52
|
54bfdbe6c1a249f00f87cafacccb65f8a32d40fc
|
/dspace-api/src/main/java/org/dspace/app/bulkedit/MetadataDeletion.java
|
2a77306a5498f3d58f6302f4aabfafee72a7c986
|
[
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause",
"MPL-1.0",
"W3C",
"GPL-1.0-or-later",
"LicenseRef-scancode-unicode",
"LGPL-2.1-or-later",
"LGPL-2.0-or-later",
"CDDL-1.0",
"MIT",
"Apache-2.0",
"JSON",
"EPL-1.0",
"LicenseRef-scancode-public-domain",
"LicenseRef-scancode-unicode-icu-58"
] |
permissive
|
4Science/DSpace
|
55fb70023af8e742191b3f6dd0a06a061bc8dfc9
|
0c4ee1a65dca7b0bc3382c1a6a642ac94a0a4fba
|
refs/heads/dspace-cris-7
| 2023-08-16T05:22:17.382990
| 2023-08-11T10:00:00
| 2023-08-11T10:00:00
| 63,231,221
| 43
| 96
|
BSD-3-Clause
| 2023-09-08T15:54:48
| 2016-07-13T09:02:10
|
Java
|
UTF-8
|
Java
| false
| false
| 3,848
|
java
|
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.app.bulkedit;
import java.sql.SQLException;
import org.apache.commons.cli.ParseException;
import org.apache.commons.lang3.ArrayUtils;
import org.dspace.content.MetadataField;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.MetadataFieldService;
import org.dspace.content.service.MetadataValueService;
import org.dspace.core.Context;
import org.dspace.scripts.DSpaceRunnable;
import org.dspace.services.ConfigurationService;
import org.dspace.services.factory.DSpaceServicesFactory;
import org.dspace.utils.DSpace;
/**
* {@link DSpaceRunnable} implementation to delete all the values of the given
* metadata field.
*
* @author Luca Giamminonni (luca.giamminonni at 4science.it)
*
*/
public class MetadataDeletion extends DSpaceRunnable<MetadataDeletionScriptConfiguration<MetadataDeletion>> {
private MetadataValueService metadataValueService;
private MetadataFieldService metadataFieldService;
private ConfigurationService configurationService;
private String metadataField;
private boolean list;
@Override
public void internalRun() throws Exception {
if (list) {
listErasableMetadata();
return;
}
Context context = new Context();
try {
context.turnOffAuthorisationSystem();
performMetadataValuesDeletion(context);
} finally {
context.restoreAuthSystemState();
context.complete();
}
}
private void listErasableMetadata() {
String[] erasableMetadata = getErasableMetadata();
if (ArrayUtils.isEmpty(erasableMetadata)) {
handler.logInfo("No fields has been configured to be cleared via bulk deletion");
} else {
handler.logInfo("The fields that can be bulk deleted are: " + String.join(", ", erasableMetadata));
}
}
private void performMetadataValuesDeletion(Context context) throws SQLException {
MetadataField field = metadataFieldService.findByString(context, metadataField, '.');
if (field == null) {
throw new IllegalArgumentException("No metadata field found with name " + metadataField);
}
if (!ArrayUtils.contains(getErasableMetadata(), metadataField)) {
throw new IllegalArgumentException("The given metadata field cannot be bulk deleted");
}
handler.logInfo(String.format("Deleting the field '%s' from all objects", metadataField));
metadataValueService.deleteByMetadataField(context, field);
}
private String[] getErasableMetadata() {
return configurationService.getArrayProperty("bulkedit.allow-bulk-deletion");
}
@Override
@SuppressWarnings("unchecked")
public MetadataDeletionScriptConfiguration<MetadataDeletion> getScriptConfiguration() {
return new DSpace().getServiceManager()
.getServiceByName("metadata-deletion", MetadataDeletionScriptConfiguration.class);
}
@Override
public void setup() throws ParseException {
metadataValueService = ContentServiceFactory.getInstance().getMetadataValueService();
metadataFieldService = ContentServiceFactory.getInstance().getMetadataFieldService();
configurationService = DSpaceServicesFactory.getInstance().getConfigurationService();
metadataField = commandLine.getOptionValue('m');
list = commandLine.hasOption('l');
if (!list && metadataField == null) {
throw new ParseException("One of the following parameters is required: -m or -l");
}
}
}
|
[
"luca.giamminonni@4Science.it"
] |
luca.giamminonni@4Science.it
|
1b03f83045ead4b8049457732eb924997fde112f
|
1f26360e34f60e7e143ea07dc15d16ca189f748d
|
/src/app/Main.java
|
cd3b0fa7258918380c1db9b40c683370e6ba76a7
|
[] |
no_license
|
nosremehj/gerenciar-estacionamento
|
aacff6214f710a9bda5449661d18917c7d6b25c1
|
6ab6385dc8a522e4bde50acc0c6de388eb234514
|
refs/heads/master
| 2023-03-10T09:07:15.911404
| 2021-02-22T01:35:55
| 2021-02-22T01:35:55
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,196
|
java
|
package app;
import controle.Inicial;
import controle.Logado;
import visualizacao.Cabecalho;
import visualizacao.Login;
import visualizacao.Menu;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
//App
Scanner leitor = new Scanner(System.in);
boolean root = true;
Inicial.inicializar();
do {
// Laço para manter o sistema rodando
Cabecalho.cabecalhoInicial();
Menu.menuInicial();
int opcaoUsuario = leitor.nextInt();leitor.nextLine();
switch (opcaoUsuario){
case 1:
// Faz login
if (Login.login()) {
// Chama logado
Logado.session();
} else {
System.out.println("Usuário ou senha inválidos");
}
break;
case 2:
// Sai do sistema
root = false;
break;
default:
System.out.println("Opção inválida!");
}
} while (root);
}
}
|
[
"tijhemerson@gmail.com"
] |
tijhemerson@gmail.com
|
95e73201fd3d6fe5838fe9fe8664fc81d9e48e94
|
388d2940aab8c9fe8213fd0f773e4d155cdbb303
|
/src/measure/graph/distance/TopologicalOverlap.java
|
41b24aab289c96668302dccbaadaf168614a8da3
|
[
"MIT"
] |
permissive
|
tuantx7110/CommunityEvaluation
|
ca52f589d9388dfba749fe7e7eb112c4afd3bb54
|
41ba38513b0b62d7837979de9de68abb475f9db2
|
refs/heads/master
| 2023-03-16T09:15:29.580070
| 2016-03-09T07:52:28
| 2016-03-09T07:52:28
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,662
|
java
|
package measure.graph.distance;
import java.util.Set;
import org.apache.commons.collections15.Transformer;
import edu.uci.ics.jung.graph.Graph;
import measure.graph.GraphProximity;
public class TopologicalOverlap<V, E> extends GraphProximity<V,E> {
{
type = Type.SIMILARITY;
}
public TopologicalOverlap(Graph<V, E> g) {
super(g);
}
public TopologicalOverlap(Graph<V, E> g, Transformer<E, ? extends Number> weights) {
super(g, weights);
}
public TopologicalOverlap(Graph<V, E> graph,
Transformer<E, ? extends Number> weights, boolean selfWeight,
boolean normalized) {
super(graph, weights, selfWeight, normalized);
}
public TopologicalOverlap(Graph<V, E> graph,
Transformer<E, ? extends Number> weights, boolean selfWeight) {
super(graph, weights, selfWeight);
}
public Number computeMeasure(V source, V target) {
Set<V> cNeigh = getUnionNeighbours(source, target);
double ds = 0, dt = 0, sk, tk, nom = 0;
for (V k : cNeigh) {
sk = W(source, k);
ds += sk*sk;
tk = W(target, k);
dt += tk*tk;
nom += sk*tk;
}
if(!selfWeight)
nom += W(source, target)*W(source, target);
double dom =(Math.min(ds, dt));
double sim = nom/dom;
if(sim >2 || sim < 0 ) System.err.println(sim+ " ( " +source+" , "+target+" ) " + " : "+nom+" / "+ dom + " " + cNeigh.size());
return sim;
}
public Number getDistance(V source, V target){
return 1 - getProximity(source, target).doubleValue();
}
public String toString(){
return "TopologicalOverlap"+type+ ((selfWeight)?"Aug":"");
}
@Override
public String getName() {
if (selfWeight)
return "$\\hat{TO}$";
else return "TO";
}
}
|
[
"rabbani@gmail.com"
] |
rabbani@gmail.com
|
5bb577c759ab06f6554b010ee7629e1d9c79e4bb
|
11be13cbb229aec2d6908e2d93f78141da434152
|
/12306/src/com/dhorse/control_behide/service/StationManagerServiceInter.java
|
989dfd2763d920458bd540eb0b4f64dcbb1d27e8
|
[] |
no_license
|
erliangWei/-12306
|
63631cd7a2b67dd29a3f0fac8cd704f7d828463a
|
ee265221411182b18310d04f83a32bc768454f19
|
refs/heads/master
| 2020-12-24T10:24:03.801198
| 2016-11-07T14:14:14
| 2016-11-07T14:14:14
| 73,084,305
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 897
|
java
|
package com.dhorse.control_behide.service;
import java.util.List;
import com.dhorse.control_behide.vo.AddStationVO;
import com.dhorse.control_behide.vo.ProCapitalVO;
import com.dhorse.control_behide.vo.StationDeptListVO;
import com.dhorse.control_behide.vo.StationManageVO;
import com.dhorse.control_behide.vo.UpdateStationVO;
public interface StationManagerServiceInter {
// public void getStationList(List<StationManageVO> stationList, int nowPage,int pageRecords);
public void getStationList(List<StationManageVO> stationList, int nowPage,int pageRecords);
public void addStation(AddStationVO asVO);
public void getStationDeptList(List<StationDeptListVO> sdVO);
public void getProCapitalList(List<ProCapitalVO> proCapicalList);
public void delectStation(int stationId);
public void updateStation(UpdateStationVO vo);
public int getRecords();
}
|
[
"Eli_wei@DESKTOP-0CVOV5V"
] |
Eli_wei@DESKTOP-0CVOV5V
|
f01a6c166dc63649bc8d223240db2eb40b493de6
|
8527ab8b80ce5a454e1418fc4c894aecda5e15ca
|
/analysis/src/main/java/es/ua/dlsi/im3/analysis/analysis/analyzers/tonal/academic/melodic/Accuracy.java
|
bedd99f2f1d55a2a24e7f0855c883dec31f2d62e
|
[] |
no_license
|
davidrizo/im3
|
3ad5ac269348b53b9fae02ba231a676caabaed4a
|
28a1d6661447c954c3198909522b3aa28a122bad
|
refs/heads/master
| 2022-02-10T15:58:29.330151
| 2018-06-02T16:08:00
| 2018-06-02T16:08:00
| 102,493,573
| 2
| 0
| null | 2022-02-01T00:57:18
| 2017-09-05T14:44:50
|
Java
|
UTF-8
|
Java
| false
| false
| 2,126
|
java
|
package es.ua.dlsi.im3.analysis.analysis.analyzers.tonal.academic.melodic;
import es.ua.dlsi.im3.core.score.AtomPitch;
import java.util.Map;
/**
* It computes the accuracy of a melodic analysis
* Created by drizo on 24/6/17.
*/
public class Accuracy {
private final MelodicAnalysis expected;
private final MelodicAnalysis computed;
int [][] confusionMatrix;
int notesWithoutExpectedAnalysis;
int ok;
int ko;
public Accuracy(MelodicAnalysis expected, MelodicAnalysis computed) {
this.confusionMatrix = new int[MelodicAnalysisNoteKinds.values().length][MelodicAnalysisNoteKinds.values().length];
this.expected = expected;
this.computed = computed;
computeAccuracy();
}
private void computeAccuracy() {
notesWithoutExpectedAnalysis = 0;
ok = 0;
ko = 0;
for (Map.Entry<AtomPitch, NoteMelodicAnalysis> noteMelodicAnalysisEntry: computed.getNoteAnalyses().entrySet()) {
AtomPitch ap = noteMelodicAnalysisEntry.getKey();
NoteMelodicAnalysis computedAnalysis = noteMelodicAnalysisEntry.getValue();
NoteMelodicAnalysis expectedAnalysis = expected.getAnalysis(ap);
if (expectedAnalysis == null) {
notesWithoutExpectedAnalysis++;
} else {
confusionMatrix[expectedAnalysis.getKind().ordinal()] [computedAnalysis.getKind().ordinal()]++;
if (expectedAnalysis.getKind() == computedAnalysis.getKind()) {
ok++;
} else {
ko++;
}
}
}
}
/**
*
* @return matrix[expected MelodicAnalysisNoteKinds][computed MelodicAnalysisNoteKinds]
*/
public int[][] getConfusionMatrix() {
return confusionMatrix;
}
public int getOk() {
return ok;
}
public int getKo() {
return ko;
}
public double getSuccessRate() {
return (double) ok / (double) (ok + ko);
}
public int getNotesWithoutExpectedAnalysis() {
return notesWithoutExpectedAnalysis;
}
}
|
[
"drizovalero@gmail.com"
] |
drizovalero@gmail.com
|
641e183d322e89759f6b2df5a8317d1eae5366ca
|
e661f34810f7c7f76d62b668468db3268609b1ff
|
/jt-user-consumer/src/main/java/cn/jt/pojo/BasePojo.java
|
b911b24ad8c89b9288594354f329d872190ed76f
|
[] |
no_license
|
LHCONG66/cong
|
f4dfafc1c55312a34a6a34d0d3ae9b2ca0546885
|
f792687f05596eb6a847dfff832f87fde680d89a
|
refs/heads/master
| 2020-04-10T15:04:18.648645
| 2018-12-12T00:34:17
| 2018-12-12T00:34:17
| 161,096,144
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 565
|
java
|
package cn.jt.pojo;
import java.io.Serializable;
import java.util.Date;
public class BasePojo implements Serializable{
/**
*
*/
private static final long serialVersionUID = -8604324269758940307L;
private Date created;
private Date updated;
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getUpdated() {
return updated;
}
public void setUpdated(Date updated) {
this.updated = updated;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
}
|
[
"m15557940626@163.com"
] |
m15557940626@163.com
|
aa9975ac174868ec1fa5c01aa14c9b59fc9d325a
|
55be292de0b48db85ecce061fa68890ea84001d9
|
/ElecRecord/src/com/zhbit/action/attendance/AttendanceDetailAction.java
|
07b666db0a8189217e51a16874e93d46adc3d1ee
|
[
"Apache-2.0"
] |
permissive
|
weletry/ElectronicRecord
|
3b5618b6a141bf8c38192c5f596bcd22fbb10d73
|
b150d26ca2586a20d323f71f8efcbd0791b94179
|
refs/heads/master
| 2021-05-31T17:41:54.971534
| 2016-06-23T05:25:35
| 2016-06-23T05:25:35
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 11,603
|
java
|
package com.zhbit.action.attendance;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.UnsupportedEncodingException;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Resource;
import com.zhbit.action.BaseAndExcelAction;
import com.zhbit.annotation.Limit;
import com.zhbit.entity.AttendanceDetail;
import com.zhbit.entity.AttendanceMaster;
import com.zhbit.entity.Student;
import com.zhbit.entity.Tutor;
import com.zhbit.excel.ExcelConfig;
import com.zhbit.services.AttendExcelImpl;
import com.zhbit.services.attendence.AttendanceDetailServices;
import com.zhbit.services.attendence.AttendanceMasterServices;
import com.zhbit.services.student.StudentServices;
import com.zhbit.util.DecodeUtils;
import com.zhbit.util.RequestUtils;
/**
* 项目名称:ElecRecord
* 类名称: AttendanceDetailAction
* 类描述:用于考勤信息模块的Action类
* 创建人:罗建鑫
* 创建时间:2016年6月18日 下午10:58:37
* 修改人:罗建鑫
* 修改时间:2016年6月18日 下午10:58:37
* 修改备注:
* @version
*/
public class AttendanceDetailAction extends BaseAndExcelAction {
/**
*
*/
private static final long serialVersionUID = 1L;
AttendanceDetail attendanceDetail;
AttendanceMaster attendanceMaster;
private String query_studentno;
private String query_stuname;
private Timestamp query_attendanceTime;
private String query_classname;
@Resource(name=AttendanceDetailServices.SERVICES_NAME)
AttendanceDetailServices attendanceDetailServices;
@Resource(name=AttendanceMasterServices.SERVICES_NAME)
AttendanceMasterServices attendanceMasterServices;
@Resource(name=StudentServices.SERVICES_NAME)
StudentServices studentServices;
@Override
@Limit(url="/attendancedetail/attendancedetail_importExcel.action")
public String importExcel() {
// TODO Auto-generated method stub
ExcelConfig config;
try {
config = new ExcelConfig(null, "Sheet1", 2, new FileInputStream(excel),excelFileName);
List<Object> objects=new AttendExcelImpl().parseExcel(config);
List<AttendanceDetail> attendanceDetails=new ArrayList<AttendanceDetail>();
//object中第一个元素是attendanceMaster信息,其后为attendanceDetail信息
for(int i=0;i<objects.size();i++){
if(i==0&&objects.get(i)!=null){
//转换为attendanceMaster对象
AttendanceMaster attendanceMaster=(AttendanceMaster)objects.get(i);
String[] fields={"selectedcourseno=?"};
String[] params={attendanceMaster.getSelectedcourseno()};
if(attendanceMasterServices.findObjectByFields(fields, params)==null){//当记录不存在时,才进行保存操作
//设定创建时间为当前时间
Timestamp createtime = new Timestamp(System.currentTimeMillis());
attendanceMaster.setCreateTime(createtime);
attendanceMaster=attendanceMasterServices.trimAttendanceMaster(attendanceMaster);
//保存该记录至数据库中
attendanceMasterServices.save(attendanceMaster);
}
}else {
if(objects.get(i)!=null){
AttendanceDetail attendanceDetail=(AttendanceDetail)objects.get(i);
String[] fields={"selectedcourseno=?","studentno=?","attendanceTime=?"};
Object[] params={attendanceDetail.getSelectedcourseno(),attendanceDetail.getStudentno(),attendanceDetail.getAttendanceTime()};
if(attendanceDetailServices.findObjectByFields(fields, params)==null&&attendanceDetail.getAttendanceStatus()!=null){//当学号、选课课号、考勤时间对应查询出来的记录为空且考勤状态不为空时,才进行加入集合的操作
//设定创建时间为当前时间
Timestamp createtime = new Timestamp(System.currentTimeMillis());
attendanceDetail.setCreateTime(createtime);
//通过学生学号找到学生并得到其对应的stu_id
Student student=studentServices.getStudentByNo(attendanceDetail.getStudentno());
if(student!=null){//若得到的Student不为空,进行stu_id的设定
attendanceDetail.setStuId(student.getStuId());
}
attendanceDetail=attendanceDetailServices.trimAttendanceDetail(attendanceDetail);
//将该数据保存至相对应的AttendanceDetail集合中
attendanceDetails.add(attendanceDetail);
}
}
}
}
if(attendanceDetails.size()>=1){//记录数大于1时,才进行保存操作
attendanceDetailServices.saveAttendanceDeatils(attendanceDetails);
}
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return "excelSuccess";
}
@Override
public void exportExcel() {
// TODO Auto-generated method stub
}
@Override
@Limit(url="/attendancedetail/attendancedetail_listUI.action")
public String listUI() {
// TODO Auto-generated method stub
//对传来的查询条件进行编码
if(attendanceDetail!=null){
//判断是否是学生,如果是,则将其输入的学号强转为他本人的学号
attendanceDetail.setStudentno(RequestUtils.checkStudentAuthority(request, attendanceDetail.getStudentno()));
try {
attendanceDetail.setStudentno(DecodeUtils.decodeUTF(attendanceDetail.getStudentno()));
attendanceDetail.setStuname(DecodeUtils.decodeUTF(attendanceDetail.getStuname()));
attendanceDetail.setClassname(DecodeUtils.decodeUTF(attendanceDetail.getClassname()));
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
System.out.println("编码时出错");
}
}
Student student=(Student) request.getSession().getAttribute("student");
if(student!=null){
attendanceDetail=new AttendanceDetail();
attendanceDetail.setStudentno(student.getStudentNo());
attendanceDetail.setStuname(student.getStuName());
attendanceDetail.setClassname(student.getClassName());
}
//将传过来的参数进行回显
request.setAttribute("queryCon",attendanceDetail);
setPageSize(9);
pageUtils=attendanceDetailServices.queryList(attendanceDetail, getPageNO(), getPageSize());
return "listUI";
}
@Override
@Limit(url="/attendancedetail/attendancedetail_add.action")
public String addUI() {
// TODO Auto-generated method stub
//保存查询条件
request.setAttribute("queryCon", attendanceDetail);
return "addUI";
}
@Override
@Limit(url="/attendancedetail/attendancedetail_add.action")
public String add() {
// TODO Auto-generated method stub
//先去除存在的空格,再进行存储
attendanceDetailServices.trimAttendanceDetail(attendanceDetail);
if(attendanceDetail!=null){
//设定创建时间为当前时间
Timestamp createtime = new Timestamp(System.currentTimeMillis());
attendanceDetail.setCreateTime(createtime);
//通过学号查找相应的对象从而得到其对应的Stu_id
Student student=studentServices.getStudentByNo(attendanceDetail.getStudentno());
if(student!=null){
attendanceDetail.setStuId(student.getStuId());
}
attendanceDetailServices.save(attendanceDetail);
}
//保存成功后将attendanceMatser中的属性设定为查询条件
attendanceDetail.setStudentno(getQuery_studentno());
attendanceDetail.setStuname(getQuery_stuname());
attendanceDetail.setAttendanceTime(getQuery_attendanceTime());
attendanceDetail.setClassname(getQuery_classname());
request.setAttribute("attendanceDetail",attendanceDetail);
return "add";
}
@Override
@Limit(url="/attendancedetail/attendancedetail_delete.action")
public String delete() {
// TODO Auto-generated method stub
request.setAttribute("attendanceDetail",attendanceDetail);
//先判断用户是否已经选中
if(getSelectedRow()!=null){
attendanceDetailServices.deleteObjectByIds(getSelectedRow());
}
return "delete";
}
@Override
@Limit(url="/attendancedetail/attendancedetail_editor.action")
public String editorUI() {
// TODO Auto-generated method stub
//保存查询条件
request.setAttribute("queryCon", attendanceDetail);
attendanceDetail=attendanceDetailServices.findObjectById(attendanceDetail.getId());
request.setAttribute("attendanceDetail", attendanceDetail);
//将选课课号对应的选课的信息推送到前台进行显示
String[] fields={"selectedcourseno=?"};
Object[] params={attendanceDetail.getSelectedcourseno()};
attendanceMaster=(AttendanceMaster) attendanceMasterServices.findObjectByFields(fields, params).get(0);
request.setAttribute("attendanceMaster", attendanceMaster);
return "editorUI";
}
@Override
@Limit(url="/attendancedetail/attendancedetail_editor.action")
public String editor() {
// TODO Auto-generated method stub
//去除空格外使用update方法更新考勤课程信息
attendanceDetail=attendanceDetailServices.trimAttendanceDetail(attendanceDetail);
attendanceDetailServices.update(attendanceDetail);
//保存成功后将attendanceMatser中的属性设定为查询条件
attendanceDetail.setStudentno(getQuery_studentno());
attendanceDetail.setStuname(getQuery_stuname());
attendanceDetail.setAttendanceTime(getQuery_attendanceTime());
attendanceDetail.setClassname(getQuery_classname());
request.setAttribute("attendanceDetail",attendanceDetail);
return "editor";
}
@Override
public String deleteAll() {
// TODO Auto-generated method stub
return null;
}
public String detailUI(){
attendanceDetail=attendanceDetailServices.findObjectById(attendanceDetail.getId());
request.setAttribute("attendanceDetail", attendanceDetail);
//将选课课号对应的选课的信息推送到前台进行显示
String[] fields={"selectedcourseno=?"};
Object[] params={attendanceDetail.getSelectedcourseno()};
attendanceMaster=(AttendanceMaster) attendanceMasterServices.findObjectByFields(fields, params).get(0);
request.setAttribute("attendanceMaster", attendanceMaster);
return "detailUI";
}
//-----------------------getter&setter---------------------------------
public AttendanceDetail getAttendanceDetail() {
return attendanceDetail;
}
public void setAttendanceDetail(AttendanceDetail attendanceDetail) {
this.attendanceDetail = attendanceDetail;
}
public AttendanceMaster getAttendanceMaster() {
return attendanceMaster;
}
public void setAttendanceMaster(AttendanceMaster attendanceMaster) {
this.attendanceMaster = attendanceMaster;
}
public String getQuery_studentno() {
return query_studentno;
}
public void setQuery_studentno(String query_studentno) {
this.query_studentno = query_studentno;
}
public String getQuery_stuname() {
return query_stuname;
}
public void setQuery_stuname(String query_stuname) {
this.query_stuname = query_stuname;
}
public Timestamp getQuery_attendanceTime() {
return query_attendanceTime;
}
public void setQuery_attendanceTime(Timestamp query_attendanceTime) {
this.query_attendanceTime = query_attendanceTime;
}
public String getQuery_classname() {
return query_classname;
}
public void setQuery_classname(String query_classname) {
this.query_classname = query_classname;
}
}
|
[
"luojianxin2016@sina.com"
] |
luojianxin2016@sina.com
|
f9df99ac99bfccc7833fb9896ff1993125fb099c
|
0ad73f9ec1e0f3ce4ace5339f443c6e2435c37ab
|
/myspring/src/main/java/org/learn/proxy/staticproxy/WorkerProxy.java
|
07b961dbfda1c457c6f193c00105fcf7302b931c
|
[] |
no_license
|
wtforfun/learnJava
|
c38091cb4a80e47fa50ac01808e28639d14b0b22
|
72132b65c8bb8ff013b8eab20ddfa09eefce63ad
|
refs/heads/master
| 2023-03-14T05:43:32.380728
| 2021-03-16T14:45:26
| 2021-03-16T14:45:26
| 348,281,602
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 310
|
java
|
package org.learn.proxy.staticproxy;
public class WorkerProxy implements IWork{
private Worker worker;
public void setWorker(Worker worker) {
this.worker = worker;
}
@Override
public void work() {
System.out.println("proxy is looking..");
worker.work();
}
}
|
[
"mrwangt@126.com"
] |
mrwangt@126.com
|
982ef89ce94cd3ab23e59091e5155ac323e1350c
|
399ed1bdc20f0d2e3d18d1c341d5d0fc10d79905
|
/basic/view/src/main/java/com/view/LoadingView.java
|
115d351f6db477fdda7d738cb0c317de6fdeff4f
|
[] |
no_license
|
MoJieBlog/AppExp
|
8a58754ab9578aaaf4689efe04ede519bc9459e3
|
ed4e30129314c36549883b88a7e6de3c31ed60b5
|
refs/heads/master
| 2021-06-25T13:49:11.255535
| 2020-12-18T09:15:40
| 2020-12-18T09:15:40
| 191,364,115
| 11
| 3
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 511
|
java
|
package com.view;
import android.content.Context;
import android.util.AttributeSet;
import android.widget.ProgressBar;
/**
* @describe
* @author: lixiaopeng
* @Date: 2019-07-15
*/
public class LoadingView extends ProgressBar {
public LoadingView(Context context) {
super(context);
}
public LoadingView(Context context, AttributeSet attrs) {
super(context, attrs);
setIndeterminateDrawable(getResources().getDrawable(R.drawable.dialog_loading_anim_progress));
}
}
|
[
"xiaopeng.li@niu.com"
] |
xiaopeng.li@niu.com
|
716b564ce9fd28a5075dae9c54264b807fab27bc
|
4132791194dd2688ee11cca4a64b9446caef77a9
|
/kafka/java/order-zeebe/src/test/java/io/flowing/retail/kafka/order/FetchGoodsAdapter.java
|
4b9b0ad6a93637945c87c1a6eedae5c9877f9e0b
|
[
"Apache-2.0"
] |
permissive
|
codependent/flowing-retail-1
|
98a8dbbe9f8e982747e53335cb49dca0c4b73438
|
5301b7d60539e26f73a7a654461a8a4bd730b328
|
refs/heads/master
| 2020-03-30T15:41:01.013849
| 2018-09-28T16:03:01
| 2018-09-28T16:03:01
| 151,374,804
| 1
| 0
| null | 2018-10-03T07:15:29
| 2018-10-03T07:15:37
| null |
UTF-8
|
Java
| false
| false
| 2,067
|
java
|
package io.flowing.retail.kafka.order;
import java.time.Duration;
import java.util.Collections;
import java.util.UUID;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import io.flowing.retail.kafka.order.domain.Order;
import io.flowing.retail.kafka.order.domain.OrderFlowContext;
import io.flowing.retail.kafka.order.flow.payload.FetchGoodsCommandPayload;
import io.flowing.retail.kafka.order.messages.Message;
import io.flowing.retail.kafka.order.messages.MessageSender;
import io.flowing.retail.kafka.order.persistence.OrderRepository;
import io.zeebe.gateway.ZeebeClient;
import io.zeebe.gateway.api.clients.JobClient;
import io.zeebe.gateway.api.events.JobEvent;
import io.zeebe.gateway.api.events.MessageEvent;
import io.zeebe.gateway.api.subscription.JobHandler;
import io.zeebe.gateway.api.subscription.JobWorker;
@Component
public class FetchGoodsAdapter implements JobHandler {
public static String correlationId;
private ZeebeClient zeebe;
public void subscribe(ZeebeClient zeebe) {
this.zeebe = zeebe;
zeebe.jobClient().newWorker()
.jobType("fetch-goods")
.handler(this)
.timeout(Duration.ofMinutes(1))
.open();
}
@Override
public void handle(JobClient client, JobEvent event) {
OrderFlowContext context = OrderFlowContext.fromJson(event.getPayload());
// generate an UUID for this communication
String correlationId = UUID.randomUUID().toString();
client.newCompleteCommand(event) //
.payload(Collections.singletonMap("CorrelationId_FetchGoods", correlationId)) //
.send().join();
MessageEvent messageEvent = zeebe.workflowClient().newPublishMessageCommand() //
.messageName("GoodsFetchedEvent")
.correlationKey(correlationId)
.payload("{\"pickId\":\"99\"}") //
.send().join();
System.out.println("Correlated " + messageEvent );
}
}
|
[
"bernd.ruecker@camunda.com"
] |
bernd.ruecker@camunda.com
|
b0c462e9f2c4054c15d2a3163cfc69f245d170b3
|
0d1124ff5225b15c4c6910c24c424f3877e28cbd
|
/src/main/java/com/mvc/web/entity/content/Notice.java
|
2d7ed3993088c2eda6d2647bd78f7cd27184e3f0
|
[] |
no_license
|
Abelime/ServletTest
|
b6aa61ef41d43fa96ba273164a5788f89a2bdfe5
|
cbd2dcefcbec6ad772de77095a08d29681c7145d
|
refs/heads/master
| 2023-04-25T18:47:21.707602
| 2021-06-11T01:30:08
| 2021-06-11T01:30:08
| 375,872,493
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,878
|
java
|
package com.mvc.web.entity.content;
import java.util.Date;
public class Notice {
int id;
String title;
String writeid;
String content;
Date regdate;
int hit;
String board;
public String getBoard() {
return board;
}
public void setBoard(String board) {
this.board = board;
}
@Override
public String toString() {
return "Notice [id=" + id + ", title=" + title + ", writeid=" + writeid + ", content=" + content + ", regdate="
+ regdate + ", hit=" + hit + "]";
}
public Notice(int id, String title, String writeid, String content, Date regdate, int hit) {
this.id = id;
this.title = title;
this.writeid = writeid;
this.content = content;
this.regdate = regdate;
this.hit = hit;
}
public Notice(String board, int id, String title, String writeid, String content, Date regdate, int hit) {
this.board=board;
this.id = id;
this.title = title;
this.writeid = writeid;
this.content = content;
this.regdate = regdate;
this.hit = hit;
}
public Notice(String userID, String title2, String content2) {
this.writeid=userID;
this.title=title2;
this.content=content2;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getWriteid() {
return writeid;
}
public void setWriteid(String writeid) {
this.writeid = writeid;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Date getRegdate() {
return regdate;
}
public void setRegdate(Date regdate) {
this.regdate = regdate;
}
public int getHit() {
return hit;
}
public void setHit(int hit) {
this.hit = hit;
}
}
|
[
"Hyung준영@DESKTOP-BRBF503"
] |
Hyung준영@DESKTOP-BRBF503
|
0b658535875491f5ab63b468b4555d8ea1b30fee
|
cc20492a1ec20c4591f7e53fd7827fdcbc11bd5e
|
/DataStructures/src/org/datastructures/stack/Calculator.java
|
21d5f2f332257fd6a420cbf2a3a895e130c2d050
|
[] |
no_license
|
RickUniverse/JavaBaseReview
|
51d42861836a9555d16e02c824859607f3dab084
|
b5f7ebad25eee84b9f2d48e222688bb7e7bc8471
|
refs/heads/master
| 2023-02-08T14:37:58.000647
| 2020-12-29T14:01:16
| 2020-12-29T14:01:16
| 325,299,763
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 6,011
|
java
|
package org.datastructures.stack;
/**
* 中缀表达式
* @author lijichen
* @date 2020/8/23 - 17:00
*/
public class Calculator {
public static void main(String[] args) {
//创建表达式
String expression = "300+2*6-2";
//创建两个栈
ArrayStack numStark = new ArrayStack(20);
ArrayStack operStark = new ArrayStack(20);
//定义计算需要的变量
int index = 0;//用于扫描
int num1 = 0;
int num2 = 0;
int oper = 0;
int res = 0;
char ch = ' ';//将每次扫描的char保存到ch
String keepNum = "";//用于拼接多位数
//开始循环操作
while (true) {
//依次的到表达式expression的值
ch = expression.substring(index,index + 1).charAt(0);
//判断ch是什么
if (operStark.isOper(ch)) {//如果是运算符
//判断当前的操作符符号栈是否为空
if (!operStark.isEmpty()) {
//不为空的操作
//比较操作符,跟栈中的操作符进行比较
if (operStark.priority(ch) <= operStark.priority(operStark.peek())) {//如果当前的操作符的优先级大于栈中的优先级
//则进行取出进行运算
num1 = numStark.pop();
num2 = numStark.pop();
oper = operStark.pop();//需要从栈中pop出栈一个操作符
//运算
res = operStark.cla(num1, num2, (char)oper);
//得到的结果入数栈
numStark.push(res);
//当前符号入操作符栈
operStark.push(ch);
} else {
//当前操作符优先级大于栈中符号
//直接入站
operStark.push(ch);
}
} else {
//为空的操作
//直接入栈
operStark.push(ch);
}
} else {
//如果不是运算符
//直接入数栈
//numStark.push(ch - 48);//因为ascall中1,对应的是49
/*
* 改进
* */
keepNum += ch;//当前数字拼接到keepNum
//如果ch已经是最后一个
if (index == expression.length() - 1) {
numStark.push(Integer.parseInt(keepNum));
} else {
//判断下一个是不是数字
if (operStark.isOper(expression.substring(index+1,index+2).charAt(0))) {
//如果是运算符,就入栈,不需要进行后续操作
numStark.push(Integer.parseInt(keepNum));//入栈
keepNum = "";//将keepnum置空
}
}
}
//index + 1 进行下一次的 操作
index++;
//判断是否到扫描到最后
if (index >= expression.length()) {
break;
}
}
//循环运算栈中剩余的
while (true) {
if (operStark.isEmpty()) {//符号栈为空表示计算完毕
break;
}
//表达式扫描完毕
num1 = numStark.pop();
num2 = numStark.pop();
oper = operStark.pop();//需要从栈中pop出栈一个操作符
//运算
res = operStark.cla(num1, num2, (char)oper);
numStark.push(res);
}
System.out.printf("结果为%s = %d",expression,numStark.pop());
}
}
class ArrayStack {
//最大栈空间
public int maxSize;
//栈顶
public int top = -1;
//栈数组
public int[] stack;
//构造器
public ArrayStack(int maxSize) {
this.maxSize = maxSize;
//初始化栈数组
stack = new int[this.maxSize];
}
//判断栈是否满
public boolean isFall() {
return top == this.maxSize - 1;
}
//判断栈是否空
public boolean isEmpty() {
return top == -1;
}
//入栈
public void push(int value) {
if (isFall()) {
System.out.println("栈满!");
return;
}
stack[++top] = value;
}
//出栈
public int pop() {
if (isEmpty()) {
throw new RuntimeException("栈为空!");
}
int value = stack[top];
top--;
return value;
}
//循环遍历栈
public void showStack() {
for (int i = top; i >= 0 ; i--) {
System.out.printf("stack[%d] = %d\n",i,stack[i]);
}
}
//查看栈顶数据
public int peek(){
return stack[top];
}
//判断优先级
public int priority(int val) {
if (val == '*' || val == '/') {
return 1;
}else if (val == '-' || val == '+') {
return 0;
}else {
return -1;
}
}
//判断是否是操作字符
public boolean isOper(char oper) {
if (oper == '+' || oper == '-' || oper == '*' || oper == '/'){
return true;
}
return false;
}
//计算结果
public int cla(int num1, int num2, char oper) {
int res = 0;
switch (oper) {
case '+':
res = num1 + num2;
break;
case '-':
res = num2 - num1;//注意顺序
break;
case '*':
res = num1 * num2;
break;
case '/':
res = num2 / num1;//注意顺序
break;
default:
throw new RuntimeException("计算错误!");
}
return res;
}
}
|
[
"tom_global@review.com"
] |
tom_global@review.com
|
edcfdffb089b02d50bcc7c8787fd9e52b176974c
|
6e53682a960408accdb9ac1b3b7dcf180354232e
|
/src/Repl_Homeworks/Repl00176.java
|
fe0cfb2e63bc1a75400e12dc1be0cc97c7544ece
|
[] |
no_license
|
GulenYilmaz/Java__2020__Repl.It__HW
|
8a16fa1e0489784e92486c320e420f84dcdf4129
|
d506703896ce1640f171fd22a2dfa76ec6997e0a
|
refs/heads/master
| 2022-10-18T19:16:33.499500
| 2020-06-04T01:47:06
| 2020-06-04T01:47:06
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,671
|
java
|
package Repl_Homeworks;
/*
* Encapsulation
Create the a Person class with the following:
Class Variables
firstname
lastname
birthmonth
birthday
birthyear
String ssn
Constructor
The main constructor should take in all values and assign them to their respective private class variables
Methods
Create a public getters to access all the variables.
Create a public method called formatBirthday, which will return a String composed of their birthday in mm/dd/yyyy format. For example, if birthmonth=3, birthday=22, birthyear=2000, it should return the String "3/22/2000"
in Main Class.
Instantiate and object of Person and provide values. follows below outputs for values.
using getter and method print them separately.
Note: Read carefully the steps.
Expected Output:
John
Doe
10/25/1900
123-45-6789
*/
public class Repl00176 {
public static void main(String[] args) {
Perso obj=new Perso(null, null, null, null, null);
obj.setFirstname("John");
obj.setLastname("Doe");
obj.setSsn("123-45-6789");
System.out.println(obj.getFirstname());
System.out.println(obj.getLastname());
obj.formatBirthday("10","25","1900");
System.out.println(obj.getSsn());
}
}
class Perso{
private String firstname;
private String lastname;
private String birthmonth;
private String birthday;
private String birthyear;
private String ssn;
Perso(String lastName,String birthmonth,String birthday,String birthyear,String ssn){
this.lastname=lastname;
this.firstname=firstname;
this.birthmonth=birthmonth;
this.birthday=birthday;
this.birthyear=birthyear;
this.ssn=ssn;
}
public String getFirstname() {
return firstname;
}
public void setFirstname(String firstname) {
this.firstname = firstname;
}
public String getLastname() {
return lastname;
}
public void setLastname(String lastname) {
this.lastname = lastname;
}
public String getBirthmonth() {
return birthmonth;
}
public void setBirthmonth(String birthmonth) {
this.birthmonth = birthmonth;
}
public String getBirthday() {
return birthday;
}
public void setBirthday(String birthday) {
this.birthday = birthday;
}
public String getBirthyear() {
return birthyear;
}
public void setBirthyear(String birthyear) {
this.birthyear = birthyear;
}
public String getSsn() {
return ssn;
}
public void setSsn(String ssn) {
this.ssn = ssn;
}
public String formatBirthday(String birthmonth,String birthday,String birthyear) {
this.birthmonth=birthmonth;
this.birthday=birthday;
this.birthyear=birthyear;
System.out.println(birthmonth+"/"+birthday+"/"+birthyear);
return birthday;
}
}
|
[
"gulenaltintasyilmaz@gmail.com"
] |
gulenaltintasyilmaz@gmail.com
|
4cc67a2f52cdf98d45c1c051fba89ad06b53c948
|
6ba26f52e0fb974502ad1269f43fef3714e602ad
|
/dont-let-the-unit-tests-coverage-cheat-you/src/main/java/com/coderstower/blog/dont_let_the_unit_tests_coverage_cheat_you/step4/User.java
|
1be28a8a6fe3679f625d3a7432aef3104044ceae
|
[
"Apache-2.0"
] |
permissive
|
estigma88/coders-tower-code
|
6be30d1a7d4302626f8385a2eede75bb89abc509
|
fd290104460844ec8c4b2f13e5639a9cd60a855c
|
refs/heads/master
| 2022-06-14T03:39:16.821989
| 2022-05-30T21:47:39
| 2022-05-30T21:47:39
| 190,036,422
| 3
| 4
|
Apache-2.0
| 2022-05-30T21:47:40
| 2019-06-03T15:51:29
|
Java
|
UTF-8
|
Java
| false
| false
| 1,075
|
java
|
package com.coderstower.blog.dont_let_the_unit_tests_coverage_cheat_you.step4;
import java.util.Objects;
import java.util.StringJoiner;
class User {
private String id;
private String name;
public User(String id, String name) {
this.id = id;
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass())
return false;
User user = (User) o;
return Objects.equals(id, user.id) &&
Objects.equals(name, user.name);
}
@Override
public int hashCode() {
return Objects.hash(id, name);
}
@Override
public String toString() {
return new StringJoiner(", ",
User.class.getSimpleName() + "[", "]")
.add("id='" + id + "'")
.add("name='" + name + "'")
.toString();
}
}
|
[
"estigma88@gmail.com"
] |
estigma88@gmail.com
|
df07568fc6ccc6eda553a0dfc678e300693119b4
|
339264ea7298a764eb1694a5dec3fb5f410d49c2
|
/app/src/androidTest/java/com/openclassrooms/entrevoisins/ui/neighbour_list/DetailNeighbourActivityLaunchTest.java
|
0a2cd962043f0f4a24715a44fb9a887ab0f83962
|
[] |
no_license
|
Calinnor/Project3
|
bd01f2cc71a42f0df18760e7954f8f6e242046d5
|
02968e0c3d5c42532edfd1e081dca0ee9a5d91f2
|
refs/heads/master
| 2021-05-22T18:40:30.362414
| 2020-10-27T17:54:37
| 2020-10-27T17:54:37
| 253,043,813
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,768
|
java
|
package com.openclassrooms.entrevoisins.ui.neighbour_list;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import androidx.test.espresso.ViewInteraction;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
import androidx.test.runner.AndroidJUnit4;
import com.openclassrooms.entrevoisins.R;
import org.hamcrest.Description;
import org.hamcrest.Matcher;
import org.hamcrest.TypeSafeMatcher;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.action.ViewActions.click;
import static androidx.test.espresso.assertion.ViewAssertions.matches;
import static androidx.test.espresso.contrib.RecyclerViewActions.actionOnItemAtPosition;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withParent;
import static org.hamcrest.Matchers.allOf;
@LargeTest
@RunWith(AndroidJUnit4.class)
public class DetailNeighbourActivityLaunchTest {
@Rule
public ActivityTestRule<ListNeighbourActivity> mActivityTestRule = new ActivityTestRule<>(ListNeighbourActivity.class);
@Test
public void detailNeighbourActivityLaunchTest() {
ViewInteraction recyclerView = onView(
allOf(withId(R.id.list_neighbours),
withParent(withId(R.id.container))));
recyclerView.perform(actionOnItemAtPosition(2, click()));
ViewInteraction imageView = onView(
allOf(withId(R.id.detail_avatar_view),
childAtPosition(
childAtPosition(
withId(android.R.id.content),
0),
0),
isDisplayed()));
imageView.check(matches(isDisplayed()));
}
private static Matcher<View> childAtPosition(
final Matcher<View> parentMatcher, final int position) {
return new TypeSafeMatcher<View>() {
@Override
public void describeTo(Description description) {
description.appendText("Child at position " + position + " in parent ");
parentMatcher.describeTo(description);
}
@Override
public boolean matchesSafely(View view) {
ViewParent parent = view.getParent();
return parent instanceof ViewGroup && parentMatcher.matches(parent)
&& view.equals(((ViewGroup) parent).getChildAt(position));
}
};
}
}
|
[
"frederic.hautson@gmail.com"
] |
frederic.hautson@gmail.com
|
1d3f2419dd8236444b1c6d35c629864b11a81585
|
22eb8e44dec4903c2de5351c284d23f96bd497ce
|
/src/main/java/redgear/liquidfuels/plugins/FermenterRecipes.java
|
7d1b94e1291c991103cb32da5ed807a49d6df28f
|
[] |
no_license
|
RedGear/LiquidFuels
|
6b99cc6918a92d2633788419306efb7b3b08e0ef
|
2ec60286d2ea234cb131e4fe44a02a0ac9ca7e29
|
refs/heads/master
| 2020-08-10T17:23:11.258863
| 2014-12-31T00:59:35
| 2014-12-31T00:59:35
| 15,510,947
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 866
|
java
|
package redgear.liquidfuels.plugins;
import net.minecraftforge.fluids.FluidStack;
import cpw.mods.fml.common.LoaderState.ModState;
import redgear.core.mod.IPlugin;
import redgear.core.mod.ModUtils;
import redgear.liquidfuels.core.LiquidFuels;
import redgear.liquidfuels.recipes.FermenterRecipe;
public class FermenterRecipes implements IPlugin{
@Override
public String getName() {
return "FermenterRecipes";
}
@Override
public boolean shouldRun(ModUtils mod, ModState state) {
return true;
}
@Override
public boolean isRequired() {
return true;
}
@Override
public void preInit(ModUtils mod) {
}
@Override
public void Init(ModUtils mod) {
FermenterRecipe.addFermenterRecipe(new FluidStack(LiquidFuels.mashFluid, 10), 5, 45, new FluidStack( LiquidFuels.stillageFluid, 10));
}
@Override
public void postInit(ModUtils mod) {
}
}
|
[
"LordBlackhole@gmail.com"
] |
LordBlackhole@gmail.com
|
210771a2f1062b899d3338717f2dc9671b871b57
|
70e16a5fe476839291e1f8171f0c8384365f06c5
|
/app/src/main/java/com/greenear/yeqinglu/greeneartech/ui/MainActivity.java
|
efd6b62d5f377a06cbdd434857fb22b5fa683480
|
[] |
no_license
|
Kasiea/GreenearTech
|
9158d76e5f8aac203261f21b1f4dc7fe8f93befb
|
c5dc59c3971888d2ed0651275a5ec7fc2cab9900
|
refs/heads/master
| 2021-01-24T10:27:31.527613
| 2017-04-25T03:54:06
| 2017-04-25T03:54:06
| 68,890,817
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 6,215
|
java
|
package com.greenear.yeqinglu.greeneartech.ui;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.NavigationView;
import android.support.design.widget.Snackbar;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import com.greenear.yeqinglu.greeneartech.R;
import com.greenear.yeqinglu.greeneartech.map.BDGuide;
import com.greenear.yeqinglu.greeneartech.map.Map;
import com.greenear.yeqinglu.greeneartech.map.MapActivity;
public class MainActivity extends AppCompatActivity {
private Toolbar toolbar;
private DrawerLayout drawerLayout;
private NavigationView navigationView;
private Button bms_data;
private Button map;
private Button battery_status;
private Button user_info;
private Button guid;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
initView();
bms_data.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, BmsDataShow.class);
startActivity(intent);
}
});
map.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, MapActivity.class);
startActivity(intent);
}
});
battery_status.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, BatChartShow.class);
startActivity(intent);
}
});
// user_info.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// Intent intent = new Intent(MainActivity.this, UserInfoShow.class);
// startActivity(intent);
// }
// });
//
guid.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(MainActivity.this, BDGuide.class);
startActivity(intent);
}
});
}
public void initView()
{
bms_data = (Button)findViewById(R.id.bms_data);
map = (Button)findViewById(R.id.map);
battery_status = (Button)findViewById(R.id.battery_status);
user_info = (Button)findViewById(R.id.user_info);
guid = (Button)findViewById(R.id.guid);
toolbar = (Toolbar)findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
//add NavigationView
drawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
navigationView = (NavigationView)findViewById(R.id.nav_view);
ActionBar actionBar = getSupportActionBar();
if(actionBar != null){
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeAsUpIndicator(R.drawable.menu);
}
navigationView_config();
//FloatingActionButton
FloatingActionButton floatingActionButton = (FloatingActionButton)findViewById(R.id.fab);
floatingActionButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Snackbar.make(v, "You click me", Snackbar.LENGTH_SHORT)
.setAction("OK", new View.OnClickListener(){
@Override
public void onClick(View v) {
Toast.makeText(MainActivity.this, "Oh, you click me!", Toast.LENGTH_SHORT).show();
}
}).show();
}
});
}
public void navigationView_config()
{
navigationView.setCheckedItem(R.id.profile);
navigationView.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId())
{
case R.id.profile:
Intent intent1 = new Intent(MainActivity.this, UserInfoActivity.class);
startActivity(intent1);
Toast.makeText(MainActivity.this, "I am here!", Toast.LENGTH_SHORT).show();
break;
case R.id.graph:
Intent intent2 = new Intent(MainActivity.this, BatChartShow.class);
startActivity(intent2);
break;
case R.id.map:
Intent intent3 = new Intent(MainActivity.this, MapActivity.class);
startActivity(intent3);
break;
default:
}
// drawerLayout.closeDrawers();
return true;
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
drawerLayout.openDrawer(GravityCompat.START);
break;
default:
}
return super.onOptionsItemSelected(item);
}
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
}
}
|
[
"yeqing15@gmail.com"
] |
yeqing15@gmail.com
|
37fb849cb4e67292964b6dadee532be5a9785202
|
6139f86075f050e1da80bde8791550814a95f1d5
|
/src/controllors/FileChooser.java
|
ea93d0ff74e39296e961b69451c525aca0332d6b
|
[] |
no_license
|
judyobrienie/Huffman
|
ac4da78e06f6319edf480b5e320939ceba47b1c6
|
cfe4676a5948365fe192b0e989bbb0096ef863bc
|
refs/heads/master
| 2020-05-18T15:08:09.733356
| 2017-03-28T19:51:13
| 2017-03-28T19:51:13
| 84,256,041
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,952
|
java
|
package controllors;
// SimpleFileChooser.java
// A simple file chooser to see what it takes to make one of these work.
//
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import javax.swing.*;
public class FileChooser extends JFrame {
public FileChooser() {
super("File Chooser Test Frame");
setSize(350, 200);
setDefaultCloseOperation(EXIT_ON_CLOSE);
Container c = getContentPane();
c.setLayout(new FlowLayout());
JButton openButton = new JButton("Open");
JButton saveButton = new JButton("Save");
JButton dirButton = new JButton("Pick Dir");
final JLabel statusbar =
new JLabel("Output of your selection will go here");
// Create a file chooser that opens up as an Open dialog
openButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
JFileChooser chooser = new JFileChooser();
chooser.setMultiSelectionEnabled(true);
int option = chooser.showOpenDialog(FileChooser.this);
if (option == JFileChooser.APPROVE_OPTION) {
File[] sf = chooser.getSelectedFiles();
String filelist = "nothing";
if (sf.length > 0) filelist = sf[0].getName();
for (int i = 1; i < sf.length; i++) {
filelist += ", " + sf[i].getName();
}
statusbar.setText("You chose " + filelist);
}
else {
statusbar.setText("You canceled.");
}
}
});
// Create a file chooser that opens up as a Save dialog
saveButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
JFileChooser chooser = new JFileChooser();
int option = chooser.showSaveDialog(FileChooser.this);
if (option == JFileChooser.APPROVE_OPTION) {
statusbar.setText("You saved " + ((chooser.getSelectedFile()!=null)?
chooser.getSelectedFile().getName():"nothing"));
}
else {
statusbar.setText("You canceled.");
}
}
});
// Create a file chooser that allows you to pick a directory
// rather than a file
dirButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ae) {
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int option = chooser.showOpenDialog(FileChooser.this);
if (option == JFileChooser.APPROVE_OPTION) {
statusbar.setText("You opened " + ((chooser.getSelectedFile()!=null)?
chooser.getSelectedFile().getName():"nothing"));
}
else {
statusbar.setText("You canceled.");
}
}
});
c.add(openButton);
c.add(saveButton);
c.add(dirButton);
c.add(statusbar);
}
}
|
[
"judyobrienie@gmail.com"
] |
judyobrienie@gmail.com
|
a4ece76acbdd4584bbfb4c6d71e58c8ea36c596c
|
25a4763dfc67a4639b6cabf211140b9cc5ad7b10
|
/src/main/java/org/schhx/leaf/leaf/Leaf.java
|
af91f4094c10c4efee6d81d22086ae27e083b997
|
[
"MIT"
] |
permissive
|
schhx/leaf
|
9c0ea9990a822e33600cfa02ea9c2704fe03fa86
|
f685f2eff7cbe61b6478e07ea99afbc91685c05e
|
refs/heads/master
| 2020-03-18T23:46:45.879173
| 2018-06-11T07:18:26
| 2018-06-11T07:18:26
| 135,427,482
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 221
|
java
|
package org.schhx.leaf.leaf;
/**
* @author shanchao
* @date 2018-05-31
*/
public interface Leaf {
/**
* 获取下一个id
*
* @param bizTag
* @return
*/
long nextId(String bizTag);
}
|
[
"shanchao@wosai-inc.com"
] |
shanchao@wosai-inc.com
|
eaafa553bbfc0c0fc09b92a6c8dfd3bf77b9500d
|
5827680a971ec56d5636d1ee112793b870f91122
|
/FSX_Collada3D/src/collada/Box.java
|
5eec25be9b5f30a43683d810ea9327ef5d819afa
|
[
"LicenseRef-scancode-warranty-disclaimer"
] |
no_license
|
bily/fsxp
|
61185fad6d87a1b0bc6d98dbdb8a02bd7e83c0cb
|
39f1ff19a2fd5b86e764602baf543298d985b303
|
refs/heads/master
| 2021-01-20T04:33:10.510213
| 2012-08-12T07:28:23
| 2012-08-12T07:28:23
| 7,416,727
| 3
| 4
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 900
|
java
|
package collada;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlList;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name="", propOrder={"halfExtents", "extra"})
@XmlRootElement(name="box")
public class Box
{
@XmlList
@XmlElement(name="half_extents", type=Double.class)
protected List<Double> halfExtents;
protected List<Extra> extra;
public List<Double> getHalfExtents()
{
if (this.halfExtents == null)
this.halfExtents = new ArrayList();
return this.halfExtents;
}
public List<Extra> getExtra()
{
if (this.extra == null)
this.extra = new ArrayList();
return this.extra;
}
}
|
[
"evandrix@gmail.com"
] |
evandrix@gmail.com
|
fa8f663f536492e79f9fd0558d82a7d6cfa6f42d
|
6a734eeef6e72b1b19ba5fdba945797fe12952ce
|
/src/main/java/com/product/report/exception/ErrorDetails.java
|
0b642c60bcc204f691e770ba7a89ae21dd668fa0
|
[] |
no_license
|
savysarvesh/AssignmentProject
|
5d846c65dce85533455b3d8c2a1a7d60f5a69817
|
83eb88a7d3a4d3049730839e73bc11cbe68ebda8
|
refs/heads/master
| 2022-11-20T19:51:56.885710
| 2020-07-18T11:50:46
| 2020-07-18T11:50:46
| 280,644,697
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 991
|
java
|
package com.product.report.exception;
import java.util.Date;
/**
* The Class ErrorDetails.
*/
public class ErrorDetails {
/** The timestamp. */
private Date timestamp;
/** The message. */
private String message;
/** The details. */
private String details;
/**
* Instantiates a new error details.
*
* @param timestamp the timestamp
* @param message the message
* @param details the details
*/
public ErrorDetails(Date timestamp, String message, String details) {
super();
this.timestamp = timestamp;
this.message = message;
this.details = details;
}
/**
* Gets the timestamp.
*
* @return the timestamp
*/
public Date getTimestamp() {
return timestamp;
}
/**
* Gets the message.
*
* @return the message
*/
public String getMessage() {
return message;
}
/**
* Gets the details.
*
* @return the details
*/
public String getDetails() {
return details;
}
}
|
[
"rkfnt6@pni6w2786.net.plm.eds.com"
] |
rkfnt6@pni6w2786.net.plm.eds.com
|
abaaa31d671aae4650dc8a88524db73f709e8f5d
|
717a8203ca497fdc8f698fa8ded1b43c021fe77c
|
/src/main/java/net/rakowicz/jsqlshell/SqlShellApp.java
|
57410cd81d39f18be079efc45e113e4d8dbc4f15
|
[] |
no_license
|
sjohnr/jsqlshell
|
dd2203d773a6529fa20a7646ce443b150f9b3786
|
17d2d57d59096e348b398d10b1f9642dbc9e9510
|
refs/heads/master
| 2021-01-20T16:38:48.211729
| 2014-11-18T03:53:51
| 2014-11-18T03:53:51
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 3,278
|
java
|
package net.rakowicz.jsqlshell;
import java.io.PrintStream;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class SqlShellApp {
private static PrintStream out = System.out;
public SqlShellApp (String dbName) {
DbConfig db;
Connection connection = null;
Statement statement = null;
try {
db = new DbConfig(dbName).loadDriver();
connection = db.connect();
DatabaseMetaData dbmd = connection.getMetaData();
out.print("Connected to: " + dbmd.getDatabaseProductName() + " " + dbmd.getDatabaseProductVersion());
statement = connection.createStatement();
statement.setMaxRows(1000);
out.println(" (autocommit=" + connection.getAutoCommit() + ", readonly=" + connection.isReadOnly() + ", maxrows=" + statement.getMaxRows() + ")");
out.println("Type 'help' for more options");
while (true) {
String command = CommandReader.readLine("jss> ");
try {
if (connection.isClosed()) {
connection = db.connect();
out.println("info: Connection expired, re-connected...");
}
if (statement.isClosed()) {
statement = connection.createStatement();
out.println("info: Statement was closed, re-created...");
}
if (CommandHelper.isCommand(command, out, connection, statement)) {
continue;
}
String sql = command;
if (!sql.trim().toLowerCase().startsWith("select ")) {
int changed = statement.executeUpdate(sql);
out.println("info: affected " + changed + " rows");
} else {
long started = System.currentTimeMillis();
ResultSet rset = statement.executeQuery(sql);
new DataFormatter(rset).format().printResults(out, started);
}
if (connection.getWarnings() != null) {
out.println("warning: " + connection.getWarnings().getErrorCode() + ":" + connection.getWarnings().getMessage());
}
} catch (SQLException e) {
out.println("error: " + e.getMessage());
}
connection.clearWarnings();
}
} catch (Exception e) {
if (e instanceof RuntimeException && "exit".equals(e.getMessage())) {
// exit
} else {
e.printStackTrace();
out.println("Exited...");
}
} finally {
if (statement != null) {
try {
statement.close();
} catch (Exception ignore) {
}
}
if (connection != null) {
try {
connection.close();
} catch (Exception ignore) {
}
}
}
}
}
|
[
"drakowicz@gmail.com"
] |
drakowicz@gmail.com
|
fd04352315317b8a8d1d991a595b505b78a81d44
|
1a24cc3d01b7136638063141cd3e5bdd3f8927e1
|
/app/src/main/java/com/example/lordweather/alarmReceiver.java
|
4bf39d38a99df1423fba2b23785a3c0b1b38e2cd
|
[] |
no_license
|
lakmat/Lord_Weather
|
7b3b02dd278f454bf2d2a32a1984b2cba0b1743a
|
832de87971dcb9fa894cae9684579996b220e193
|
refs/heads/master
| 2023-02-24T08:03:41.521964
| 2021-01-21T10:59:44
| 2021-01-21T10:59:44
| 331,651,113
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 600
|
java
|
package com.example.lordweather;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.ContextWrapper;
public class alarmReceiver extends BroadcastReceiver {
localService mService;
@Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction().equals("android.intent.action.BOOT_COMPLETED")){
Intent serviceIntent = new Intent(context, localService.class);
context.startService(serviceIntent);
mService.calculate();
}
}
}
|
[
"50699279+lakmat@users.noreply.github.com"
] |
50699279+lakmat@users.noreply.github.com
|
c7022393e7adfed2a42b61d62f17e662e19510f3
|
74b47b895b2f739612371f871c7f940502e7165b
|
/aws-java-sdk-chime/src/main/java/com/amazonaws/services/chime/model/transform/GetPhoneNumberOrderRequestMarshaller.java
|
441dc650171b5b608b1d4ab944c584dd90e48da0
|
[
"Apache-2.0"
] |
permissive
|
baganda07/aws-sdk-java
|
fe1958ed679cd95b4c48f971393bf03eb5512799
|
f19bdb30177106b5d6394223a40a382b87adf742
|
refs/heads/master
| 2022-11-09T21:55:43.857201
| 2022-10-24T21:08:19
| 2022-10-24T21:08:19
| 221,028,223
| 0
| 0
|
Apache-2.0
| 2019-11-11T16:57:12
| 2019-11-11T16:57:11
| null |
UTF-8
|
Java
| false
| false
| 2,084
|
java
|
/*
* Copyright 2017-2022 Amazon.com, Inc. or its affiliates. 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. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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.amazonaws.services.chime.model.transform;
import javax.annotation.Generated;
import com.amazonaws.SdkClientException;
import com.amazonaws.services.chime.model.*;
import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;
/**
* GetPhoneNumberOrderRequestMarshaller
*/
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class GetPhoneNumberOrderRequestMarshaller {
private static final MarshallingInfo<String> PHONENUMBERORDERID_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
.marshallLocation(MarshallLocation.PATH).marshallLocationName("phoneNumberOrderId").build();
private static final GetPhoneNumberOrderRequestMarshaller instance = new GetPhoneNumberOrderRequestMarshaller();
public static GetPhoneNumberOrderRequestMarshaller getInstance() {
return instance;
}
/**
* Marshall the given parameter object.
*/
public void marshall(GetPhoneNumberOrderRequest getPhoneNumberOrderRequest, ProtocolMarshaller protocolMarshaller) {
if (getPhoneNumberOrderRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getPhoneNumberOrderRequest.getPhoneNumberOrderId(), PHONENUMBERORDERID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
}
}
|
[
""
] | |
dfa7e5f8cb948a35347744c465ac7818339b9d9d
|
d53e2cd4d3bcb796db8be0a322506b0c0c2ce547
|
/src/main/java/com/mock/server/URITree/SchemaResponse.java
|
2f288e2b5b799e0ebab7ea750e87eea34398baac
|
[
"Apache-2.0"
] |
permissive
|
shubhamk0027/MockServer
|
dafe7679f081324fb51d30c558f44b4c4a40625b
|
6b426c248ba289502d2d9369f5d439f3865f712f
|
refs/heads/localDb
| 2023-05-12T20:27:43.319530
| 2020-07-23T19:57:00
| 2020-07-23T19:57:00
| 267,934,513
| 2
| 1
| null | 2020-07-23T19:57:01
| 2020-05-29T19:04:49
|
Java
|
UTF-8
|
Java
| false
| false
| 897
|
java
|
package com.mock.server.URITree;
import com.mock.server.Query.MockResponse;
import org.everit.json.schema.Schema;
import org.everit.json.schema.ValidationException;
import org.json.JSONObject;
// Schema Check details
// https://github.com/everit-org/json-schema
// http://json-schema.org/understanding-json-schema/
public class SchemaResponse implements Leaf {
private final Schema schema;
private final MockResponse response;
public SchemaResponse(Schema schema, MockResponse response) {
this.schema = schema;
this.response = response;
}
public String getSchema() {
return schema.toString();
}
public MockResponse getResponse(JSONObject jsonObject) throws ValidationException {
// If Schema is validated then return response or throw ValidationException Error
schema.validate(jsonObject);
return response;
}
}
|
[
"shubhamk0027@gmail.com"
] |
shubhamk0027@gmail.com
|
fc786b652ee5eca73a72d4ddd7f314455e39c9c0
|
de27e4f9f6d406cdf4403867b955689af99293e9
|
/sweng-exam-chliu/SwEngQuizAppTest/src/ch/epfl/sweng/quizapp/test/QuizActivityBasicTest.java
|
ca1d873a848ff53a513986191447e2a9dddb6a07
|
[] |
no_license
|
chongguang/sweng-epfl
|
adab55971f6f9fb0b5dfd76273f68feeee8a84a2
|
3df6b078b143aedcebe5bc9401acff5fa2ee403a
|
refs/heads/master
| 2020-12-24T13:28:08.308214
| 2014-12-20T22:52:58
| 2014-12-20T22:52:58
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 2,144
|
java
|
/*
* Copyright 2014 EPFL. All rights reserved.
*/
package ch.epfl.sweng.quizapp.test;
import static com.google.android.apps.common.testing.ui.espresso.Espresso.onView;
import static com.google.android.apps.common.testing.ui.espresso.assertion.ViewAssertions.matches;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.isDisplayed;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.isEnabled;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withId;
import static com.google.android.apps.common.testing.ui.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.Matchers.not;
import android.test.ActivityInstrumentationTestCase2;
import ch.epfl.sweng.quizapp.QuizActivity;
import ch.epfl.sweng.quizapp.QuizClient;
import ch.epfl.sweng.quizapp.QuizClientException;
import ch.epfl.sweng.quizapp.QuizQuestion;
import ch.epfl.sweng.quizapp.R;
/** Tests basic functionality of the QuizActivity */
public class QuizActivityBasicTest extends ActivityInstrumentationTestCase2<QuizActivity> {
public QuizActivityBasicTest() {
super(QuizActivity.class);
}
public void testQuizClientGetterSetter() throws QuizClientException {
QuizActivity activity = getActivity();
QuizClient quizClient = new QuizClient() {
@Override
public QuizQuestion fetchRandomQuestion() throws QuizClientException {
return null;
}
};
activity.setQuizClient(quizClient);
assertSame(quizClient, activity.getQuizClient());
}
public void testNextQuestionButtonName() {
getActivity();
onView(withId(R.id.nextQuestionButton))
.check(matches(withText("Next question")));
}
public void testFirstQuestionBodyVisible() {
getActivity();
onView(withId(R.id.questionBodyView))
.check(matches(isDisplayed()));
}
public void testNextQuestionDisabled() {
getActivity();
onView(withId(R.id.nextQuestionButton)).check(matches(not(isEnabled())));
}
}
|
[
"chongguang.liu@epfl.ch"
] |
chongguang.liu@epfl.ch
|
05eea372a5bffe6f956153f23f30fadbebc8d45f
|
e7f2e0f34dce1ea49f7e0452e889a37401a54a53
|
/JavaSO/src/application/Escalonador.java
|
8188fea7eea561164e75047fff6f54e04705ae38
|
[] |
no_license
|
iagoesp/Escalonador
|
69b165eb704b8a717b59514236ddf16b39ac2ed2
|
d2f6e2b7a40c4ebd00501971daebcdcd77840d43
|
refs/heads/master
| 2020-04-08T21:02:16.994344
| 2018-12-10T15:17:33
| 2018-12-10T15:17:33
| 159,726,097
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 5,352
|
java
|
package application;
import java.io.IOException;
import java.util.*;
import java.util.AbstractMap.SimpleEntry;
public class Escalonador {
private ArrayList<Processo> listaProcessos;
private ArrayList<Processo> finalizados;
private ArrayList<Processo> main;
private ArrayList<String> linha;
private String processo;
private int quantum;
private int sobrecarga;
public Escalonador(ArrayList<Processo> lista, String p, int q, int s) {
this.listaProcessos = new ArrayList<Processo>();
this.listaProcessos = lista;
this.processo = p;
this.quantum = q;
this.sobrecarga = s;
this.finalizados = new ArrayList<Processo>();
this.main = new ArrayList<Processo>();
this.linha = new ArrayList<String>();
}
public ArrayList<Processo> getLista(){
return this.listaProcessos;
}
boolean FIFO(Processo a, Processo b){
return a.getCheg() < b.getCheg();
}
boolean SJF(Processo a, Processo b){
return a.getExec() < b.getExec();
}
boolean RoundRobin(Processo a, Processo b){
return false;
}
boolean EDF(Processo a, Processo b){
int deadLineA = a.getCheg() + a.getDead();
int deadLineB = b.getCheg() + b.getDead();
return deadLineA < deadLineB;
}
int buscarProcesso(String p){
System.out.println("Buscar " + p);
int index = 0;
for(int i = 1; i < main.size(); i++) {
System.out.println(main.size() + ", " + i);
if(p=="FIFO") {
if(main.get(i).getCheg() < main.get(index).getCheg()) {
System.out.println(i);
index = i;
}
}
else if(p=="SJF") {
if(main.get(i).getExec() < main.get(index).getExec()) {
System.out.println(i);
index = i;
}
}
else if(p=="EDF") {
if(main.get(i).getCheg() + main.get(i).getDead() <
main.get(index).getCheg() + main.get(index).getDead()) {
System.out.println(i);
index = i;
}
}
}
return index;
}
public void inserir(int t) {
for(int i = 0; i < listaProcessos.size(); i++)
if(listaProcessos.get(i).getCheg() <= t){
main.add(listaProcessos.get(i));
listaProcessos.remove((listaProcessos.get(0 + i--)));
}
}
public void main() throws IOException {
int quant = listaProcessos.size();
int tempo = 0;
System.out.println("Tipo " + processo);
while(finalizados.size() < quant){
inserir(tempo);
if(main.isEmpty()==false){
int proximoProcesso = buscarProcesso(this.processo);
Processo p = main.get(proximoProcesso);
main.remove(0 + proximoProcesso);
int runtime = 0;
if(processo.equals("FIFO")==true || processo.equals("SJF")==true)
runtime = p.getExec(); //N�o Preemptivo.
else
runtime = (p.getExec() <= quantum) ? p.getExec() - 1 : quantum + sobrecarga - 1; //Preemptivo
for(int i = 0; i < listaProcessos.size(); i++){
if(listaProcessos.get(i).getCheg() <= tempo + runtime){
main.add(listaProcessos.get(i));
listaProcessos.remove(0 + (i--));
}
}
if(p.getExec() <= quantum || processo.equals("FIFO")==true || processo.equals("SJF")==true){
int tempoRestante = p.getExec();
p.setExec(0);
p.inserirExecucao(tempo, tempo + tempoRestante - 1);
finalizados.add(p);
tempo += tempoRestante - 1;
}
else{
p.setExec(p.getExec() - quantum);
p.inserirExecucao(tempo, tempo + quantum - 1);
p.inserirExecucao(tempo + quantum, tempo + quantum + sobrecarga - 1);
main.add(p);
tempo += quantum + sobrecarga - 1;
}
}
tempo++;
}
Collections.sort(finalizados);
//ordenarProcessos();
for(Processo p : finalizados) {
//System.out.print(p.getID());
String imprimir = p.Gantt();
System.out.println(imprimir);
//System.out.print(": (" + p.tempoEspera.getKey() + ", " + p.tempoEspera.getValue() + "), ");
//for(AbstractMap.SimpleEntry<Integer, Integer> e : p.getPair())
// System.out.print("(" + e.getKey() + ", " + e.getValue() + "), ");
linha.add(imprimir);
}
/*
Exportar exportar = new Exportar(linha);
exportar.escrever();
*/
new Thread() {
@Override
public void run() {
javafx.application.Application.launch(Executor.class);
}
}.start();
Executor startUpTest = Executor.waitForStartUpTest();
startUpTest.setList(finalizados);
//startUpTest.printSomething();
}
public void ordenarProcessos() {
if(processo.equals("FIFO") || processo.equals("Round Robin")){
Collections.sort(finalizados);
}
else {
if(processo.equals("SJF")) {
int j;
Processo key;
int i;
for (j = 1; j < finalizados.size(); j++){
key = finalizados.get(j);
for (i = j - 1; (i >= 0) && (finalizados.get(i).getExec() > key.getExec()); i--){
finalizados.set(i + 1, finalizados.get(i));
}
finalizados.set(i + 1, key);
}
}
}
}
}
|
[
"noreply@github.com"
] |
noreply@github.com
|
5cf5a04038e93f1966aab36dc05e891649e48c41
|
44ae706b2b2d0026d6549e31fc9c6d98247b01ba
|
/app/src/main/java/com/example/moviedb/model/MovieDetailPojo/ProductionCompany.java
|
ed68e8f57d19d53a012492f9ff8449348f75f474
|
[] |
no_license
|
muratgulecyuz/MovieDB
|
d0ffe563a7c32d105b9068be1f613b14c0a2f34e
|
58853607e486380f7c1138d696d1869a5898d148
|
refs/heads/master
| 2020-12-30T05:14:04.896436
| 2020-02-07T08:08:02
| 2020-02-07T08:08:02
| 238,872,564
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,058
|
java
|
package com.example.moviedb.model.MovieDetailPojo;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
public class ProductionCompany {
@SerializedName("id")
@Expose
private Integer id;
@SerializedName("logo_path")
@Expose
private Object logoPath;
@SerializedName("name")
@Expose
private String name;
@SerializedName("origin_country")
@Expose
private String originCountry;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Object getLogoPath() {
return logoPath;
}
public void setLogoPath(Object logoPath) {
this.logoPath = logoPath;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getOriginCountry() {
return originCountry;
}
public void setOriginCountry(String originCountry) {
this.originCountry = originCountry;
}
}
|
[
"murat.gulecyuz@kgteknoloji.com"
] |
murat.gulecyuz@kgteknoloji.com
|
bf22dcd22523ac2b19ce63564454aebb9d2b46e6
|
37b89e95cb57f7bd2ca88692118085a4a2cfca24
|
/app/src/test/java/com/example/frederick/texta/ExampleUnitTest.java
|
edf2ad0f38ea97327fed63a39b44c509459da3c2
|
[] |
no_license
|
elvisokohasirifi/texta
|
aca1d6d115fc3d0821c1a759df1b9da2eb062fc3
|
5ae78512ba6370fda54affd788a72101583c72ba
|
refs/heads/master
| 2020-04-09T02:37:03.752472
| 2018-12-01T13:34:57
| 2018-12-01T13:34:57
| 159,947,799
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 388
|
java
|
package com.example.frederick.texta;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
|
[
"elvisokohasirifi@gmail.com"
] |
elvisokohasirifi@gmail.com
|
7ad2af2baf34a77283fe6a7164922a91f7159050
|
8b95f88640c3c4f3dd09ff1ffde2791128e52bf8
|
/framework-stock-commons/src/main/java/roma/romaway/commons/android/config/ConfigsManager.java
|
9690aff0985ec894b2afb0790bd55596d69b3de8
|
[
"Apache-2.0"
] |
permissive
|
killghost/framework
|
4ebea69afc6e9b2daa8ef87d90c943d69dacf4ee
|
b0e5ca09a75fc0590233913cb369dee075682670
|
refs/heads/master
| 2020-04-30T20:55:12.239566
| 2019-02-15T09:36:31
| 2019-02-15T09:36:31
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 24,532
|
java
|
package roma.romaway.commons.android.config;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import roma.romaway.commons.android.config.ConfigsDownloader.OnDownloadCompleteListener;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.util.Log;
import android.widget.Toast;
import com.romaway.android.phone.R;
import com.romaway.android.phone.config.RomaSysConfig;
import com.romaway.android.phone.config.SysConfigs;
import com.romaway.common.android.base.Res;
import com.romaway.common.android.base.data.SharedPreferenceUtils;
import com.romaway.common.net.serverinfo.ServerInfo;
import com.romaway.common.net.serverinfo.ServerInfoMgr;
import com.romaway.common.protocol.ProtocolConstant;
import com.romaway.commons.android.fileutil.FileSystem;
import com.romaway.commons.lang.StringUtils;
import com.romaway.commons.log.Logger;
import com.trevorpage.tpsvg.SVGParserRenderer;
import com.trevorpage.tpsvg.SvgRes1;
/**
* 负责获取配制文件
* @author 万籁唤
*
*/
public class ConfigsManager {
public ConfigInfo mConfigInfo;
private Context mContext;
private String mCurrentConfigVersion;
private String mServerConfigVersion;
public String logTag;
private Handler handler = new Handler();
public String mConfigContent;
public static final String DATA_IS_ONLINE = "DATA_IS_ONLINE";
public ConfigsManager(Context context, ConfigInfo configInfo) {
// TODO Auto-generated constructor stub
mContext = context;
mConfigInfo = configInfo;
logTag = "快捷按钮配置文件:" + mConfigInfo.configFileName;
initConfig();
}
public ConfigInfo getConfigInfo(){
return mConfigInfo;
}
public static final int SAVE_TYPE_ASSETS = 0;
public static final int SAVE_TYPE_SYSTEM_DATA_FOLDER = 1;
public static final int SAVE_TYPE_SDCARD = 2;
private int savePathType = SAVE_TYPE_SYSTEM_DATA_FOLDER;//默认是内部存储路径
/**
* 图片加载路径类型
*/
public int iconLoadPathType = savePathType;//默认是内部存储路径
/**
* 设置图片加载路径类型
* @param type
*/
public void setIconLoadPathType(int type){
iconLoadPathType = type;
}
public int getIconLoadPathType(){
return iconLoadPathType;
}
public int getSavePathType(){
return savePathType;
}
/**
* 用于初始化配置文件信息
*/
public void initConfig(){
String currentVersion = "0";
File homepageConfigFile = getConfigFile(mContext,
mConfigInfo.saveFolderName,
mConfigInfo.configFileName);
String config = null;
//判断配制文件是否存在
if(!homepageConfigFile.exists()){//不存在就直接先默认采用Assets默认内置的配制
Logger.i(logTag, "界面展示:配置文件暂时不存在!并且采用的是Assets目录下默认的配置!");
config = configFileToString(
mContext,
ConfigsManager.SAVE_TYPE_ASSETS,
mConfigInfo.configFileName);
setIconLoadPathType(ConfigsManager.SAVE_TYPE_ASSETS);
// currentVersion = "0";//设置当前版本时间
}else{//配制文件存在
Logger.i(logTag, "界面展示:配置文件是存在的!当前采用的正是该配置文件!");
config = configFileToString(
mContext,
savePathType,
mConfigInfo.configFileName);
//去\r\n 空格
config = StringUtils.replaceBlank(config);
setIconLoadPathType(savePathType);
}
//获取当前正在使用的配置文件版本号
currentVersion = JsonConfigsParser.getConfigVersion(config);
mCurrentConfigVersion = StringUtils.isEmpty(currentVersion) ? "0" : currentVersion;
mConfigContent = config;
}
/**
* 获取Config
*/
public String getConfig(){
return mConfigContent;
}
/**
* 获取当前版本号
* @return
*/
public String getCurrentConfigVersion(){
return mCurrentConfigVersion;
}
/**
* 检测
* @param currentVersion
* @param serverConfigVersion
*/
public void checkConfigUpdate(String currentVersion, String serverConfigVersion){
mServerConfigVersion = serverConfigVersion == null? mCurrentConfigVersion : serverConfigVersion;
Logger.i(logTag, "界面展示:服务端版本:"+mServerConfigVersion+",当前版本:"+mCurrentConfigVersion);
//[需求]:保存本次启动相对于上次启动是否有配置文件更新
String oldVersion = SharedPreferenceUtils.getPreference(RomaSysConfig.pName, "oldConfigVersion", "");
if(!StringUtils.isEmpty(oldVersion) && oldVersion.compareTo(mCurrentConfigVersion) < 0){
RomaSysConfig.hasUpdateConfig = true;
}
//保存老版本(上一次启动的)的配置版本号
SharedPreferenceUtils.setPreference(RomaSysConfig.pName,
"oldConfigVersion", mCurrentConfigVersion);
if(mServerConfigVersion == null && Logger.getDebugMode())
Toast.makeText(mContext, "中台没有配置配制文件版本时间!", 500).show();
//比较配制文件中的版本和认证下发的版本,比认证的小,说明有更新
if(mCurrentConfigVersion.compareTo(mServerConfigVersion) < 0){
Logger.i(logTag, "开始更新:当前展示的配置文件版本比较旧,正在更新...");
//处理更新下载配制信息
updateHomepageConfig();
//设置更新标志
SharedPreferenceUtils.setPreference(RomaSysConfig.pName,
"hasUpdateConfig", true);
}else{
Logger.i(logTag, "开始更新:检测到配置文件已经是最新的了,无需更新!");
if(mCurrentConfigVersion.compareTo(mServerConfigVersion) > 0 && Logger.getDebugMode()){
Toast.makeText(mContext, "[中台警告]:当前可配置功能版本号 不应大于 认证下发的版本号!", Toast.LENGTH_LONG).show();
}
//没有更新时
//正常情况这里都是满足SVG全部存在的,但以防万一有丢失了的,可以做如下错误纠正处理。但有个缺点是必须重新启动app丢失的图标才可以展示出来
/*【待处理】循环检索配制文件中的SVG是否都存在?
如果全部存在则不做任何处理, 等待下一次启动app时采用; 如果不存在则要开始下载SVG图片了*/
}
}
/**
* 处理下载配制信息的方法
*/
private void updateHomepageConfig(){
//下载的临时文件
File homepageConfigTempFile = getConfigFile(mContext,
mConfigInfo.saveFolderName,
mConfigInfo.tempConfigFileName);
if(!homepageConfigTempFile.exists()){//下载的临时文件也不存在,开始下载
Logger.i(logTag, "开始更新:下载后会保存在临时配置文件中!");
downloadForHomepageConfig();//开始下载首页配制相关文件和SVG图片
}else{//如果存在上次下载的临时文件
String tempConfig = configFileToString(mContext,
savePathType,
mConfigInfo.tempConfigFileName);
//比较下载临时文件中的版本和认证下发的版本
if(JsonConfigsParser.getConfigVersion(tempConfig) != null &&
JsonConfigsParser.getConfigVersion(tempConfig).compareTo(mServerConfigVersion) == 0){
Logger.i(logTag, "开始更新:下载的临时文件是存在的!并且版本是最新的!");
//检查是否有丢失的图片并下载
checkMisssingIconAndDownload(mPanelConfigsDownloader, tempConfig);
}else{//不相等时,说明上次下载的临时文件已经过期了,应先删除,再重新下载
Logger.i(logTag, "开始更新:下载的临时文件是存在的!但版本号已经过时了,并删除重新开始更新!");
homepageConfigTempFile.delete();//删除临时的下载文件
downloadForHomepageConfig();//开始下载首页配制相关文件和SVG图片
}
}
}
ConfigsDownloader mPanelConfigsDownloader = new ConfigsDownloader();
/**
* 下载首页配制文件以及SVG图片
*/
private void downloadForHomepageConfig(){
Logger.i(logTag, "开始更新:配置文件下载地址:"+mConfigInfo.downloadUrl);
mPanelConfigsDownloader.startDownloadConfigFileForHomepage(mContext,
this,
new OnDownloadCompleteListener(){
@Override
public void onDownloadComplete() {
// TODO Auto-generated method stub
Logger.i(logTag, "开始更新:临时配置文件下载成功!开始图片下载准备...");
String tempConfig = configFileToString(mContext,
savePathType,
mConfigInfo.tempConfigFileName);
checkMisssingIconAndDownload(mPanelConfigsDownloader, tempConfig);
}
@Override
public void onDownloadError() {
// add by zhengms 2015/12/4 下载失败延时下载,避免环境配置或网络异常时过于频繁请求:
Logger.i(logTag, "开始更新:临时配制文件下载失败!15s后重新下载...");
if(handler != null){
handler.postDelayed(new Runnable(){
public void run() {
// String ss = mConfigInfo.downloadUrl;
// ServerInfoMgr.getInstance().changeServer(currentServerInfo)
Logger.e("","-----------------------mConfigInfo.downloadUrl="+mConfigInfo.downloadUrl);
List<ServerInfo> list = ServerInfoMgr.getInstance().getServerInfos(204);
changeServer(mConfigInfo.downloadUrl,list);
downloadForHomepageConfig();
}
}, 15000);
}
}
});
}
/**
* 切换服务器,当切换成功后,返回true,否则,返回false;
*
* @param currentServerInfo
*/
public final boolean changeServer(String url ,List<ServerInfo> mapServers) {
if (!StringUtils.isEmpty(url) && url.contains("https")) {
url = url.replace("https", "http");
}
int currIndex = url.lastIndexOf(":");
if (currIndex > 5) {
url = url.substring(0, currIndex);
}
if (mapServers == null || mapServers.isEmpty()) {
return false;
}
List<ServerInfo> lstServerInfos = mapServers;
if (lstServerInfos == null || lstServerInfos.size() <= 1) {
return false; // 若只有1个服务器,则返回
}
boolean hasFound = false;
int idx = 0;
ServerInfo tmpServerInfo = null ;
boolean useFirst = false;
for (ServerInfo s : lstServerInfos) {
if (idx == 0) {
tmpServerInfo = s;
useFirst = true;
}
if (hasFound) {
setDefaultServerInfo(s);
return true;
}
String tempUrl = s.getUrl();
int index = tempUrl.lastIndexOf(":");
if (index > 5) {
tempUrl = tempUrl.substring(0, index);
}
if (tempUrl.equalsIgnoreCase(url)) {
hasFound = true; // 服务器相同
}
idx++;
}
// 若是最后1个服务器,则使用第1条。
if (useFirst) {
setDefaultServerInfo(tmpServerInfo);
}
return useFirst;
}
private void setDefaultServerInfo(ServerInfo s) {
if(s == null){
return;
}
//++[需求]添加统一认证版本控制 wanlh 2015/12/08
String softtype = SysConfigs.SOFT_TYPE +"/";
switch(Res.getInteger(R.integer.system_server_version)){
case 1:
softtype = "";
break;
case 2:
softtype = SysConfigs.SOFT_TYPE +"/";
break;
}
//--[需求]添加统一认证版本控制 wanlh 2015/12/08
//[需求] 添加软件类型 用于初始化协议入参 wanlh 2105/11/30
// 初始化其它配置文件信息
String otherSub = "/api/config/app/ui/otherpage/online/"
+ softtype
+ SysConfigs.APPID;
if (ConfigsManager.isOnline()) {
otherSub = "/api/config/app/ui/otherpage/online/"
+ softtype
+ SysConfigs.APPID;
} else {
otherSub = "/api/config/app/ui/otherpage/beta/"
+ softtype
+ SysConfigs.APPID;
}
Logger.e("","----------------------------new URL="+s.getUrl()+otherSub);
mConfigInfo.downloadUrl = s.getUrl() + otherSub;
}
/**
* 检查缺失的配制图片,并下载
* @param configsDownloader
*/
public boolean checkMisssingIconAndDownload(ConfigsDownloader configsDownloader, String config){
return false;
}
/**
* 计算出最大需要下载图片的张数
* @param map
*/
protected void calculateMaxIconCount(Map<String, String> map){
String norstr = map.get("iconUrlNor");
if(norstr == null || norstr.equals(""))
maxDownloadIconCount--;
String selstr = map.get("iconUrlSel");
if(selstr == null || selstr.equals(""))
maxDownloadIconCount--;
}
/**
* 提交可配置文件生效
*/
private synchronized void commit(){
Logger.i(logTag, "更新完成:全部的配制信息和图片文件下载完成,并删除临时配制文件!下次启动生效!");
File homepageConfigFile = getConfigFile(mContext,
mConfigInfo.saveFolderName,
mConfigInfo.configFileName);
if(homepageConfigFile.exists()){
homepageConfigFile.delete();
}
//临时文件重命名为配制文件
File homepageConfigTempFile = getConfigFile(mContext,
mConfigInfo.saveFolderName,
mConfigInfo.tempConfigFileName);
homepageConfigTempFile.renameTo(homepageConfigFile);
}
/**
* 计数当前配制文件中有最多需要下载图片的个数
*/
private int maxDownloadIconCount = 0;
/**
* 计数已经下载成功的图片个数
*/
private int completeDownloadIconCount = 0;
/**
* 设置最大的图片下载个数
* @param maxCount
*/
public void setMaxDownloadIconCount(int maxCount){
maxDownloadIconCount = maxCount;
}
/**
* 获取最多需要下载的图片张数
* @return
*/
public int getMaxDownloadIconCount(){
return maxDownloadIconCount;
}
private Map<String, Integer> downloadCountMap = new HashMap<String, Integer>();
/*
* 下载Svg 图片配制文件
*/
protected void downloadForSvgIcon(final Map<String, String> map,
final ConfigsDownloader configsDownloader,
final String iconKey){
String filePath = map.get(iconKey);
final String saveFilePath = filePath;
ServerInfo serverInfo = ServerInfoMgr.getInstance().getDefaultServerInfo(ProtocolConstant.SERVER_FW_AUTH);
final String svgDownloadUrl = (serverInfo == null ? "" : serverInfo.getAddress() + map.get("downloadUrl")+filePath);
/*++ [优化] 优化图标下载失败修改为最多只下载3次*/
Integer downloadCount = downloadCountMap.get(svgDownloadUrl);
if(downloadCount == null)
downloadCount = 0;
if(downloadCount < 3){
downloadCount++;
downloadCountMap.put(svgDownloadUrl, downloadCount);
}else{
return;
}
/*-- [优化] 优化图标下载失败修改为最多只下载3次*/
if(svgDownloadUrl.split("http").length > 2){
if(Logger.getDebugMode())
Toast.makeText(mContext, "中台配置文件有问题!配置了错误路径["+map.get("downloadUrl")+"]应去掉IP部分!", 500).show();
}
Logger.i(logTag, "图片下载路径:"+svgDownloadUrl);
configsDownloader.startDownloadForSvgIcon(mContext,
this,
svgDownloadUrl, saveFilePath,
new OnDownloadCompleteListener(){
@Override
public void onDownloadComplete() {
// TODO Auto-generated method stub
//判断是否全部下载完成
synchronized(this){
//Logger.d(logTag, "更新完成:maxDownloadIconCount:"+maxDownloadIconCount+",completeDownloadIconCount:"+completeDownloadIconCount);
if(++completeDownloadIconCount == maxDownloadIconCount){
commit();
Logger.i(logTag, "更新完成:共更新"+maxDownloadIconCount+"张配置图片!");
maxDownloadIconCount = 0;
completeDownloadIconCount = 0;
}
}
}
@Override
public void onDownloadError() {
// TODO Auto-generated method stub
if(!svgDownloadUrl.contains("ueditor")){
Logger.i(logTag, "下载失败,图片下载路径错误!停止重新下载!"+svgDownloadUrl);
if(Logger.getDebugMode())
Toast.makeText(mContext, "[debug]可配置图片下载路径错误!"+svgDownloadUrl, Toast.LENGTH_LONG).show();
return;
}
Logger.i(logTag, "下载失败,重新开始下载! onDownloadError");
//下载失败会重新下载
downloadForSvgIcon(map,
configsDownloader,
iconKey);
}
});
}
/**
* 获取配制文件中的配制字符串信息
* @param context
* @param fromPath 从某种路径类型
* @param fileName 获取配制信息的文件名
* @return
*/
public String configFileToString(Context context, int fromPath, String fileName){
String config = "";
if(fromPath == SAVE_TYPE_ASSETS)//本地存储位置
config = FileSystem.getFromAssets(context, mConfigInfo.saveFolderName+"/"+fileName);
else if(fromPath == SAVE_TYPE_SDCARD)//SDK存储位置
config = "";//"file://"+FileSystem.getCacheRootDir(context, "").getPath()+ url;
else if(fromPath == SAVE_TYPE_SYSTEM_DATA_FOLDER)//内部文件系统存储位置
config = FileSystem.readFromFile(context,
getConfigFile(context, mConfigInfo.saveFolderName, fileName).getPath());
return config;
}
/**
* 获取存储下来的SVG Drawable
* @param context
* @param saveType 存储类型,也即配制是存储在哪个目录下
* @return
*/
public SVGParserRenderer getSVGParserRenderer(Context context, String svgPath){
String config = "";
try {
if(iconLoadPathType == SAVE_TYPE_ASSETS)//本地存储位置
config = FileSystem.getFromAssets(context, "panelConfigFolder/"+svgPath);
else if(iconLoadPathType == SAVE_TYPE_SDCARD)//SDK存储位置
config = "";//"file://"+FileSystem.getCacheRootDir(context, "").getPath()+ url;
else if(iconLoadPathType == SAVE_TYPE_SYSTEM_DATA_FOLDER)//内部文件系统存储位置
config = FileSystem.readFromFile(context,
getConfigFile(context, "panelConfigFolder", svgPath).getPath());
}catch (Exception e){
Log.e("ConfigsManager", "读取SVG图标失败: "+ e.getMessage());
}
return SvgRes1.getSVGParserRenderer(context, config);//new SVGParserRenderer(context, config);
}
/**
* 获取存储下来的SVG Drawable
* @param context
* @param saveType 存储类型,也即配制是存储在哪个目录下
* @return
*/
public SVGParserRenderer getSVGParserRenderer(Context context, String svgPath, String fillColor){
String config = "";
try {
if(iconLoadPathType == SAVE_TYPE_ASSETS)//本地存储位置
config = FileSystem.getFromAssets(context, "panelConfigFolder/"+svgPath);
else if(iconLoadPathType == SAVE_TYPE_SDCARD)//SDK存储位置
config = "";//"file://"+FileSystem.getCacheRootDir(context, "").getPath()+ url;
else if(iconLoadPathType == SAVE_TYPE_SYSTEM_DATA_FOLDER)//内部文件系统存储位置
config = FileSystem.readFromFile(context,
getConfigFile(context, "panelConfigFolder", svgPath).getPath());
}catch (Exception e){
Log.e("ConfigsManager", "读取SVG图标失败: "+ e.getMessage());
}
return SvgRes1.getSVGParserRenderer(context, config, fillColor);
}
/**
* 获取存储下来的SVG Drawable内容
* @param context
* @param saveType 存储类型,也即配制是存储在哪个目录下
* @return
*/
public String getSvgDrawableContent(Context context, String svgPath){
String config = "";
if(iconLoadPathType == SAVE_TYPE_ASSETS)//本地存储位置
config = FileSystem.getFromAssets(context, "panelConfigFolder/"+svgPath);
else if(iconLoadPathType == SAVE_TYPE_SDCARD)//SDK存储位置
config = "";//"file://"+FileSystem.getCacheRootDir(context, "").getPath()+ url;
else if(iconLoadPathType == SAVE_TYPE_SYSTEM_DATA_FOLDER)//内部文件系统存储位置
config = FileSystem.readFromFile(context,
getConfigFile(context, "panelConfigFolder", svgPath).getPath());
return config;
}
public File getConfigFile(Context context, String configFolder, String configFile){
if(iconLoadPathType == SAVE_TYPE_SDCARD){//SDK存储位置
return new File(FileSystem.getCacheRootDir(context, configFolder),
configFile);
}else
return new File(FileSystem.getDataCacheRootDir(context, configFolder),
configFile);
}
public Bitmap getBitmap(Context context, String svgPath){
Bitmap bm = null;
if(iconLoadPathType == SAVE_TYPE_ASSETS){//本地存储位置
InputStream input = null;
try {
input = context.getAssets().open("panelConfigFolder/" + svgPath);
bm = BitmapFactory.decodeStream(input);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally {
if(input != null){
try {
input.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
} else if(iconLoadPathType == SAVE_TYPE_SYSTEM_DATA_FOLDER){//内部文件系统存储位置
String path = context.getFilesDir() + "/panelConfigFolder/" + svgPath;
bm = FileSystem.parsePngFile(path);
}
return bm;
}
public static boolean isOnline() {
return SharedPreferenceUtils.getPreference(SharedPreferenceUtils.DATA_CONFIG, ConfigsManager.DATA_IS_ONLINE, true);
}
/**
* 设置是否是正式配置地址
* @param isOnline
*/
public static void setOnline(boolean isOnline) {
SharedPreferenceUtils.setPreference(SharedPreferenceUtils.DATA_CONFIG, ConfigsManager.DATA_IS_ONLINE, isOnline);
}
}
|
[
"408539831@qq.com"
] |
408539831@qq.com
|
003a354ffb81fb4512e3f9b11be9ce81f7383f80
|
6df6e3ba827ac4510d394cd823f1a9f500065703
|
/src/main/java/org/omg/spec/bpmn/_20100524/model/TChoreographyActivity.java
|
1c927ad336a487fbf989ae39a0e9ddd79e00891b
|
[
"Apache-2.0"
] |
permissive
|
nablarch/nablarch-workflow-tool
|
72211c602301384174821a4bdca2f0416b19ec38
|
7ad793366e8cace4e0406219e0677c66f26c5ff1
|
refs/heads/master
| 2021-06-10T12:33:37.263967
| 2020-10-12T10:11:12
| 2020-10-12T10:11:12
| 70,861,725
| 0
| 0
|
Apache-2.0
| 2021-03-02T04:16:04
| 2016-10-14T01:15:15
|
Java
|
UTF-8
|
Java
| false
| false
| 5,103
|
java
|
package org.omg.spec.bpmn._20100524.model;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
import javax.xml.namespace.QName;
/**
* <p>Java class for tChoreographyActivity complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="tChoreographyActivity">
* <complexContent>
* <extension base="{http://www.omg.org/spec/BPMN/20100524/MODEL}tFlowNode">
* <sequence>
* <element name="participantRef" type="{http://www.w3.org/2001/XMLSchema}QName" maxOccurs="unbounded" minOccurs="2"/>
* <element ref="{http://www.omg.org/spec/BPMN/20100524/MODEL}correlationKey" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* <attribute name="initiatingParticipantRef" use="required" type="{http://www.w3.org/2001/XMLSchema}QName" />
* <attribute name="loopType" type="{http://www.omg.org/spec/BPMN/20100524/MODEL}tChoreographyLoopType" default="None" />
* <anyAttribute processContents='lax' namespace='##other'/>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "tChoreographyActivity", propOrder = {
"participantRef",
"correlationKey"
})
@XmlSeeAlso({
TSubChoreography.class,
TChoreographyTask.class,
TCallChoreography.class
})
public abstract class TChoreographyActivity
extends TFlowNode
{
@XmlElement(required = true)
protected List<QName> participantRef;
protected List<TCorrelationKey> correlationKey;
@XmlAttribute(required = true)
protected QName initiatingParticipantRef;
@XmlAttribute
protected TChoreographyLoopType loopType;
/**
* Gets the value of the participantRef property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the participantRef property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getParticipantRef().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link QName }
*
*
*/
public List<QName> getParticipantRef() {
if (participantRef == null) {
participantRef = new ArrayList<QName>();
}
return this.participantRef;
}
/**
* Gets the value of the correlationKey property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the correlationKey property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getCorrelationKey().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link TCorrelationKey }
*
*
*/
public List<TCorrelationKey> getCorrelationKey() {
if (correlationKey == null) {
correlationKey = new ArrayList<TCorrelationKey>();
}
return this.correlationKey;
}
/**
* Gets the value of the initiatingParticipantRef property.
*
* @return
* possible object is
* {@link QName }
*
*/
public QName getInitiatingParticipantRef() {
return initiatingParticipantRef;
}
/**
* Sets the value of the initiatingParticipantRef property.
*
* @param value
* allowed object is
* {@link QName }
*
*/
public void setInitiatingParticipantRef(QName value) {
this.initiatingParticipantRef = value;
}
/**
* Gets the value of the loopType property.
*
* @return
* possible object is
* {@link TChoreographyLoopType }
*
*/
public TChoreographyLoopType getLoopType() {
if (loopType == null) {
return TChoreographyLoopType.NONE;
} else {
return loopType;
}
}
/**
* Sets the value of the loopType property.
*
* @param value
* allowed object is
* {@link TChoreographyLoopType }
*
*/
public void setLoopType(TChoreographyLoopType value) {
this.loopType = value;
}
}
|
[
"can.tago.mago524@gmail.com"
] |
can.tago.mago524@gmail.com
|
9c3795cefca4c1fb5a2dcda5e0124c450fc053f9
|
870cd6d2d6d56fc0d1048466c9e9c2ed820401ef
|
/simple-service/src/main/java/com/company/house/dto/Comment.java
|
d202cec5e5553050c883e215a73ba9616a275c0a
|
[] |
no_license
|
RadhikaBalla/java-rest-api
|
1f8ddf3e0a9b725e41730ead2d772f0191f19ea1
|
5454e4d02ad5729c94c154d3415a0eb8f7d97b7d
|
refs/heads/master
| 2022-07-09T23:05:59.956880
| 2019-11-19T14:57:11
| 2019-11-19T14:57:11
| 222,720,806
| 0
| 0
| null | 2022-06-21T02:16:19
| 2019-11-19T14:54:03
|
Java
|
UTF-8
|
Java
| false
| false
| 1,112
|
java
|
package com.company.house.dto;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement
public class Comment {
public int cid;
public String message;
public int gid;
public int likes;
public String createdDate;
public String user;
public int getCid() {
return cid;
}
public void setCid(int cid) {
this.cid = cid;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public int getGid() {
return gid;
}
public void setGid(int gid) {
this.gid = gid;
}
public int getLikes() {
return likes;
}
public void setLikes(int likes) {
this.likes = likes;
}
public String getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Date createdDate) {
DateFormat dateFormat = new SimpleDateFormat("yyyy-mm-dd");
this.createdDate = dateFormat.format(createdDate!=null?createdDate:new Date());
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
}
|
[
"noreply@github.com"
] |
noreply@github.com
|
74732e8671c48a948acba300c04615320dff1749
|
2e8264470490f35f7f6e516a6e235863398d2131
|
/WebDemo/src/CodeServlet.java
|
b813626ce446ec5300afe63c0319b48e220a1ffa
|
[] |
no_license
|
Zrbana/bbhdxp
|
c054d7a60b2c90b08172ba518f81d2660b2f68aa
|
ec5809981dbe74d757ef836c894bf2d4a41b740c
|
refs/heads/master
| 2022-12-01T00:23:05.916156
| 2021-04-21T15:39:17
| 2021-04-21T15:39:17
| 158,767,079
| 1
| 0
| null | 2022-11-16T10:56:37
| 2018-11-23T01:43:16
|
Java
|
UTF-8
|
Java
| false
| false
| 2,654
|
java
|
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;
public class CodeServlet extends HttpServlet {
public void doGet(HttpServlet req, HttpServletResponse resp) throws IOException {
// 定义宽高
int width = 100;
int height = 50;
//使用BufferImage在内存中生成图片
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
//绘制边框
Graphics g = image.getGraphics();
g.setColor(Color.WHITE);
g.fillRect(0,0,width,height);
g.setColor(Color.black);
g.drawRect(0,0,width-1,height-1);
//字符集
String str = "ABCDEFGHIjKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
//随机数
Random random = new Random();
//绘制验证码
for(int i=0;i<4;i++){
//获取随机数
int index = random.nextInt(str.length());
char ch = str.charAt(index);
//获取颜色
Color randomColor = getRandomColor(random);
g.setColor(randomColor);
//设置字体
Font font = new Font("宋体", Font.BOLD, height / 2);
g.setFont(font);
//写入验证码
g.drawString(ch + "", (i == 0) ? width / 4 * i + 2 : width / 4 * i, height - height / 4);
}
//干扰线
for (int i = 0; i < 10; i++) {
int x1 = random.nextInt(width);
int x2 = random.nextInt(width);
int y1 = random.nextInt(height);
int y2 = random.nextInt(height);
Color randomColor = getRandomColor(random);
g.setColor(randomColor);
g.drawLine(x1, x2, y1, y2);
}
ImageIO.write(image, "jpg", resp.getOutputStream());
}
private Color getRandomColor(Random random) {
//获取随机颜色
int colorIndex = random.nextInt(3);
switch (colorIndex) {
case 0:
return Color.BLUE;
case 1:
return Color.GREEN;
case 2:
return Color.RED;
case 3:
return Color.YELLOW;
default:
return Color.MAGENTA;
}
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
}
}
|
[
"1637680639@qq.com"
] |
1637680639@qq.com
|
349ae652ad55046ef8c8eb8a51f3fd00be1c2bdb
|
1815e82f67ccb3b4529b003a4116c246b72ff456
|
/src/main/pipeandfilter/StopWatch.java
|
0c61754c197c41546967f350c74f185e17d3b841
|
[] |
no_license
|
chris-noreikis/pipe-and-filter
|
3e8b5901a9ca2321f1c48e87862485772daf9d42
|
065db940aad8e78c51f68537c67599b39af1e194
|
refs/heads/master
| 2022-10-28T08:51:39.510506
| 2019-11-09T16:08:11
| 2019-11-09T16:08:11
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 957
|
java
|
package pipeandfilter;
import java.util.HashMap;
public class StopWatch {
static HashMap<String, StopWatchItem> labels = new HashMap<>();
public static void time(String label) {
StopWatchItem item = new StopWatchItem();
labels.put(label, item);
}
public static void timeEnd(String label) {
StopWatchItem item = labels.get(label);
if (labels.containsKey(label)) {
item.stop();
}
}
public static void printTimerTable() {
labels.forEach((key, value) -> System.out.println(String.format("%45s | Milliseconds | %4s", key, value.elapsedTime())));
}
private long startTime;
private long endTime;
public StopWatch() {
this.startTime = System.currentTimeMillis();
}
public void stop() {
this.endTime = System.currentTimeMillis();
}
public long getElapsedMilliseconds() {
return this.endTime - this.startTime;
}
}
|
[
"chris.noreikis@statsperform.com"
] |
chris.noreikis@statsperform.com
|
4549c961a10c87731a20d2a72922684d6f1b264f
|
4385c934afd1c1cc0c5f917667f36fc9f0a27704
|
/java/crackcoding/src/main/java/ch16moderate/Q16_07_Number_Max/Question.java
|
ac232b70d5f82263a9139d8da3d9a80fdedd11e3
|
[] |
no_license
|
krishnanram/training
|
706b4c00f7acbf5775c1d7f4f150ab044b66a57d
|
2817eedcafbe6eb61a3c4fffc3eef87350b3f159
|
refs/heads/master
| 2021-01-11T23:17:32.522776
| 2017-02-01T16:54:30
| 2017-02-01T16:54:30
| 78,564,170
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,611
|
java
|
package ch16moderate.Q16_07_Number_Max;
public class Question {
/* Flips a 1 to a 0 and a 0 to a 1 */
public static int flip(int bit) {
return 1 ^ bit;
}
/* Returns 1 if a is positive, and 0 if a is negative */
public static int sign(int a) {
return flip((a >> 31) & 0x1);
}
public static int getMaxNaive(int a, int b) {
int k = sign(a - b);
int q = flip(k);
return a * k + b * q;
}
public static int getMax(int a, int b) {
int c = a - b;
int sa = sign(a); // if a >= 0, then 1 else 0
int sb = sign(b); // if b >= 0, then 1 else 0
int sc = sign(c); // depends on whether or not a - b overflows
/* We want to define a value k which is 1 if a > b and 0 if a < b.
* (if a = b, it doesn't matter what value k is) */
int use_sign_of_a = sa ^ sb; // If a and b have different signs, then k = sign(a)
int use_sign_of_c = flip(sa ^ sb); // If a and b have the same sign, then k = sign(a - b)
/* We can't use a comparison operator, but we can multiply values by 1 or 0 */
int k = use_sign_of_a * sa + use_sign_of_c * sc;
int q = flip(k); // opposite of k
return a * k + b * q;
}
public static void main(String[] args) {
int a = 26;
int b = -15;
System.out.println("max_naive(" + a + ", " + b + ") = " + getMaxNaive(a, b));
System.out.println("max(" + a + ", " + b + ") = " + getMax(a, b));
a = -15;
b = 2147483647;
System.out.println("max_naive(" + a + ", " + b + ") = " + getMaxNaive(a, b));
System.out.println("max(" + a + ", " + b + ") = " + getMax(a, b));
}
}
|
[
"gitsureshram@gmail.com"
] |
gitsureshram@gmail.com
|
a6d96a7032e84a0afe3433bf87a5d5cd4962bd98
|
4d2670ae3bc1aef053eecba2fea194077f6d176e
|
/src/main/java/com/adyen/model/Card.java
|
848803f823c81b15d6ba8b45b3842ea6568650f0
|
[
"Apache-2.0",
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] |
permissive
|
piderman314/adyen-java-api-library
|
74206cd76faa424d8052aaa9f480adbaf83b1a3e
|
404782f1c7e011281a3c83156631847909cd3982
|
refs/heads/master
| 2021-01-19T14:18:33.270374
| 2017-04-13T09:58:13
| 2017-04-13T09:58:13
| 88,144,026
| 0
| 0
| null | 2017-04-13T08:42:59
| 2017-04-13T08:42:59
| null |
UTF-8
|
Java
| false
| false
| 6,626
|
java
|
/*
* Adyen Wherever People Pay
* This is the Adyen API Playground where you can test our API's. <br /><br />You can find out more about Adyen at <a href=\"http://www.adyen.com\">http://www.adyen.com</a>. <!--For this sample, you can use the api key \"special-key\" to test the authorization filters.-->
*
* OpenAPI spec version: 1.0.0
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
package com.adyen.model;
import com.google.gson.annotations.SerializedName;
import java.util.Objects;
/**
* Card
*/
@javax.annotation.Generated(value = "io.swagger.codegen.languages.JavaClientCodegen", date = "2016-12-14T08:41:23.938Z")
public class Card {
@SerializedName("billingAddress")
private Address billingAddress = null;
@SerializedName("expiryMonth")
private String expiryMonth = null;
@SerializedName("expiryYear")
private String expiryYear = null;
@SerializedName("cvc")
private String cvc = null;
@SerializedName("holderName")
private String holderName = null;
@SerializedName("issueNumber")
private String issueNumber = null;
@SerializedName("number")
private String number = null;
@SerializedName("startMonth")
private String startMonth = null;
@SerializedName("startYear")
private String startYear = null;
public Card billingAddress(Address billingAddress) {
this.billingAddress = billingAddress;
return this;
}
/**
* Get billingAddress
* @return billingAddress
**/
public Address getBillingAddress() {
return billingAddress;
}
public void setBillingAddress(Address billingAddress) {
this.billingAddress = billingAddress;
}
public Card expiryMonth(String expiryMonth) {
this.expiryMonth = expiryMonth;
return this;
}
/**
* the month component of the expiry date (may be left padded with 0 for single digits)
* @return expiryMonth
**/
public String getExpiryMonth() {
return expiryMonth;
}
public void setExpiryMonth(String expiryMonth) {
this.expiryMonth = expiryMonth;
}
public Card expiryYear(String expiryYear) {
this.expiryYear = expiryYear;
return this;
}
/**
* the year component of the expiry date
* @return expiryYear
**/
public String getExpiryYear() {
return expiryYear;
}
public void setExpiryYear(String expiryYear) {
this.expiryYear = expiryYear;
}
public Card cvc(String cvc) {
this.cvc = cvc;
return this;
}
/**
* the card security code which, depending on card brand, is referred to as CVV2/CVC2 (three digits) or CID (4 digits)
* @return cvc
**/
public String getCvc() {
return cvc;
}
public void setCvc(String cvc) {
this.cvc = cvc;
}
public Card holderName(String holderName) {
this.holderName = holderName;
return this;
}
/**
* the cardholder name as printed on the card
* @return holderName
**/
public String getHolderName() {
return holderName;
}
public void setHolderName(String holderName) {
this.holderName = holderName;
}
public Card issueNumber(String issueNumber) {
this.issueNumber = issueNumber;
return this;
}
/**
* <i>for some UK debit cards only</i> the issue number of the card
* @return issueNumber
**/
public String getIssueNumber() {
return issueNumber;
}
public void setIssueNumber(String issueNumber) {
this.issueNumber = issueNumber;
}
public Card number(String number) {
this.number = number;
return this;
}
/**
* the card number (without separators)
* @return number
**/
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public Card startMonth(String startMonth) {
this.startMonth = startMonth;
return this;
}
/**
* <i>for some UK debit cards only</i> the month component of the start date
* @return startMonth
**/
public String getStartMonth() {
return startMonth;
}
public void setStartMonth(String startMonth) {
this.startMonth = startMonth;
}
public Card startYear(String startYear) {
this.startYear = startYear;
return this;
}
/**
* <i>for some UK debit cards only</i> the year component of the start date
* @return startYear
**/
public String getStartYear() {
return startYear;
}
public void setStartYear(String startYear) {
this.startYear = startYear;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Card card = (Card) o;
return Objects.equals(this.billingAddress, card.billingAddress) &&
Objects.equals(this.expiryMonth, card.expiryMonth) &&
Objects.equals(this.expiryYear, card.expiryYear) &&
Objects.equals(this.cvc, card.cvc) &&
Objects.equals(this.holderName, card.holderName) &&
Objects.equals(this.issueNumber, card.issueNumber) &&
Objects.equals(this.number, card.number) &&
Objects.equals(this.startMonth, card.startMonth) &&
Objects.equals(this.startYear, card.startYear);
}
@Override
public int hashCode() {
return Objects.hash(billingAddress, expiryMonth, expiryYear, cvc, holderName, issueNumber, number, startMonth, startYear);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Card {\n");
sb.append(" billingAddress: ").append(toIndentedString(billingAddress)).append("\n");
sb.append(" expiryMonth: ").append(toIndentedString(expiryMonth)).append("\n");
sb.append(" expiryYear: ").append(toIndentedString(expiryYear)).append("\n");
sb.append(" cvc: ").append(toIndentedString(cvc)).append("\n");
sb.append(" holderName: ").append(toIndentedString(holderName)).append("\n");
sb.append(" issueNumber: ").append(toIndentedString(issueNumber)).append("\n");
sb.append(" number: ").append(toIndentedString(number)).append("\n");
sb.append(" startMonth: ").append(toIndentedString(startMonth)).append("\n");
sb.append(" startYear: ").append(toIndentedString(startYear)).append("\n");
sb.append("}");
return sb.toString();
}
/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}
|
[
"georgios.adam@adyen.com"
] |
georgios.adam@adyen.com
|
e7f6fd894016fda8fc6f69ef1a267042f818c97d
|
c5abe12e169d3f2ca9de10365ce196e3bfb34d58
|
/entry/src/test/java/com/jackson/harmonystudy/ExampleTest.java
|
ef46dd5940afb8621b1807b9eac130fd89e28533
|
[] |
no_license
|
baojie0327/harmonystudy
|
a3be23c6d0baddae3a53a6510b44e449f6a01825
|
a9f2f0522772da783031c1cd05228a0ef3534eca
|
refs/heads/master
| 2023-05-13T23:48:45.178810
| 2021-06-06T09:34:26
| 2021-06-06T09:34:26
| 374,312,670
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 132
|
java
|
package com.jackson.harmonystudy;
import org.junit.Test;
public class ExampleTest {
@Test
public void onStart() {
}
}
|
[
"512395540@qq.com"
] |
512395540@qq.com
|
88b02113725c3a9849c63d10485d5f5abd12dacd
|
e73e4b2db71a824e91f001b19b3d15af4defc76f
|
/src/com/carla/cursojava/aula34/TesteMinhaCalculadora.java
|
f854228cc0bf6e282d80f54fc439a9eb85ade975
|
[] |
no_license
|
Reis-C/Java-Iniciante-Training
|
b7740a59fcec07d7c57d893d43d10507707beb6c
|
754a9f6e33955dfc41e2348d0b57c4697f9a2577
|
refs/heads/master
| 2023-08-05T13:46:22.156669
| 2021-09-21T20:38:52
| 2021-09-21T20:38:52
| 400,617,569
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 545
|
java
|
package com.carla.cursojava.aula34;
public class TesteMinhaCalculadora {
static int resultSoma;
public static void main(String[] args) {
resultSoma = MinhaCalculadora.soma(1, 2);
// MinhaCalculadora calc = new MinhaCalculadora();
// calc.soma(1,2);
soma2Valores(1, 2);
}
// para o public static void main funcionar, fazer acesso a outros metodos, os metodos tambem precisam ser static
static int soma2Valores(int num1, int num2) {
return MinhaCalculadora.soma(num1, num2);
}
}
|
[
"carlareisaus@gmail.com"
] |
carlareisaus@gmail.com
|
d86e43ce4adae7075a84ffa1c495aa04cf0f956a
|
315ff9301f39db91a9d3f92aa1c6a9e9e6f5f919
|
/Android/touchpad/gen/com/touchpad/R.java
|
c07d7f4a493fbc928186d129e3504b7e50489751
|
[] |
no_license
|
vihangpatel/TouchPad
|
5b7e4db72da4865087e1bfcf59811705ec867019
|
a7929ab749b1a2f4636e75e8cd4bab053f7f1ed8
|
refs/heads/master
| 2021-01-20T11:04:49.280778
| 2014-08-10T02:16:02
| 2014-08-10T02:16:02
| 22,799,597
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,068
|
java
|
/* AUTO-GENERATED FILE. DO NOT MODIFY.
*
* This class was automatically generated by the
* aapt tool from the resource data it found. It
* should not be modified by hand.
*/
package com.touchpad;
public final class R {
public static final class attr {
}
public static final class drawable {
public static final int icon=0x7f020000;
}
public static final class id {
public static final int LeftButton=0x7f070001;
public static final int RightButton=0x7f070003;
public static final int View01=0x7f070000;
public static final int textView1=0x7f070002;
}
public static final class layout {
public static final int main=0x7f030000;
}
public static final class menu {
public static final int activity_main=0x7f060000;
}
public static final class string {
public static final int app_name=0x7f050001;
public static final int hello=0x7f050000;
}
public static final class xml {
public static final int app_settings=0x7f040000;
}
}
|
[
"vihang.engg@gmail.com"
] |
vihang.engg@gmail.com
|
270e0f3e9c12d3d9d9818eb8440a49dacb8b78fa
|
9ead3a02387e4194f010b317ce9a4f01dd18c521
|
/brisbane/src/main/java/co/kr/brisbane/MemberController.java
|
85c6cd33e34a6c3ed1b5c691af5a1bd955ff5e33
|
[] |
no_license
|
ujh1317/brisbane_sts
|
7f8cd4c06b0823722e94e0fdf6584e3936060fff
|
5ae0d1e96de1d507197e158822379cfe60a5c426
|
refs/heads/master
| 2023-03-31T14:18:29.248895
| 2021-03-30T16:31:21
| 2021-03-30T16:31:21
| 353,067,286
| 0
| 0
| null | null | null | null |
UHC
|
Java
| false
| false
| 7,040
|
java
|
package co.kr.brisbane;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.servlet.ModelAndView;//웹에서 보내준것 받기
import model.main.MainDto;
import model.member.MemberDto;
import java.io.IOException;
import java.sql.Timestamp;
import java.util.*;
import javax.naming.NamingException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.apache.ibatis.session.SqlSession;
@Controller
public class MemberController {
@Autowired
private SqlSession sqlSession;//변수
@RequestMapping("main.do")
public String main(String menu,Model model) {
if(menu==null){
menu="1";
}
String data="";
MainDto mainDto=sqlSession.selectOne("main.getMainArticle",menu);
if(mainDto!=null) {
data=mainDto.getData();
if(data.equals("")) {
data="등록된 글이 없습니다.";
}
}else {
data="등록된 글이 없습니다.";
}
model.addAttribute("data",data);
model.addAttribute("menu",menu);
return ".main.member.main";
}
@RequestMapping("mainWriteForm.do")
public String mainWriteForm(String menu, Model model) {
if(menu==null) {
menu="1";
}
MainDto mainDto=sqlSession.selectOne("main.getMainArticle",menu);
model.addAttribute("mainDto", mainDto);
model.addAttribute("menu", menu);
return ".main.member.mainWriteForm";
}//
@RequestMapping(value="mainWritePro.do", method=RequestMethod.POST)
public String mainWritePro(@ModelAttribute("mainDto") MainDto mainDto,HttpServletRequest request,Model model) throws IOException,NamingException{
String menu=request.getParameter("menu");
MainDto dto=sqlSession.selectOne("main.getMainArticle",menu);
mainDto.setMenu(menu);
if(dto==null) {
sqlSession.insert("main.insertMainArticle",mainDto);
}else {
sqlSession.update("main.updateMainArticle",mainDto);
}
model.addAttribute("menu",menu);
return "redirect:main.do";
}
@RequestMapping(value="mainImage.do", method=RequestMethod.POST)
public String mainImage(HttpServletRequest request,Model model) throws IOException,NamingException{
model.addAttribute("request",request);
return "/member/mainImage";
}
@RequestMapping("memberInputForm.do")
public String memberInputForm() {
return ".main.member.memberInputForm";//뷰리턴
}
//id 중복체크
@RequestMapping(value="memberConfirmId.do", method=RequestMethod.POST)
public String memberConfirmId(String id,Model model) throws IOException,NamingException{
int check=1;
MemberDto memberDto=sqlSession.selectOne("member.selectOne",id);
if(memberDto==null) {
check=-1;//사용 가능한 아이디
}
model.addAttribute("check",check);
return "/member/memberConfirmId";
}
@RequestMapping(value="memberInputPro.do", method=RequestMethod.POST)
public String memberInputPro(@ModelAttribute("memberDto") MemberDto memberDto,HttpServletRequest request) throws IOException,NamingException{
String addr=request.getParameter("addr");
String addr2=request.getParameter("addr2");
String id=request.getParameter("id");
memberDto.setAddr(addr+","+addr2);
memberDto.setRegdate(new Timestamp(System.currentTimeMillis()));
sqlSession.insert("member.insertMember",memberDto);
return "redirect:main.do";
}
//로그인
@RequestMapping(value="memberLoginPro.do",method=RequestMethod.POST)
public String memberLoginPro(String id,String pw,Model model,HttpServletRequest request) throws IOException,NamingException{
MemberDto memberDto=sqlSession.selectOne("member.selectLogin", id);
String dbPw="";
int x=-1;
int check=x;
if(memberDto!=null){
dbPw=memberDto.getPw();
if(pw.equals(dbPw)){
String name = memberDto.getName();
HttpSession session = request.getSession();
session.setAttribute("name", name);
x=1;//로그인 성공
}else{
x=0;//암호 틀림
}//else
}//
check=x;
model.addAttribute("check",check);
model.addAttribute("id",id);
model.addAttribute("memId",id);
return ".main.member.memberLoginPro";
}//
//로그아웃
@RequestMapping("memberLogout.do")
public String memberLogout() {
//return "/member/logOut";
return ".main.member.memberLogout";
}
@RequestMapping("memberModify.do")
public String memberModify() {
//return "/member/logOut";
return ".main.member.memberModify";
}
//멤버수정폼
@RequestMapping(value="memberModifyForm.do",method=RequestMethod.POST)
public String memberModifyForm(String id,Model model) throws IOException,NamingException{
MemberDto memberDto=sqlSession.selectOne("member.selectOne",id);
String addr=memberDto.getAddr();
String addr1[]=addr.split(",");
//=================================
String addr2="";
if(addr!=null) {
if(addr1.length==0) {
addr="";
memberDto.setAddr(addr);
}else if(addr1.length==1) {
addr=addr1[0];
memberDto.setAddr(addr);
}else if(addr1.length==2) {
addr=addr1[0];
addr2=addr1[1];
memberDto.setAddr(addr);
}//if
}//if
//----------------------------------
//addr=addr1[0];//주소
//String addr2=addr1[1];//상세주소
//memberDto.setAddr(addr);
//----------------------------------
model.addAttribute("addr2",addr2);
model.addAttribute("memberDto",memberDto);
//return "/member/editForm";
return ".main.member.memberModifyForm";
}
@RequestMapping(value="memberModifyPro.do",method=RequestMethod.POST)
public String editPro(@ModelAttribute("memberDto") MemberDto memberDto, HttpServletRequest request) throws IOException,NamingException{
String addr=request.getParameter("addr");
String addr2=request.getParameter("addr2");
String pw=request.getParameter("pw");
memberDto.setAddr(addr+","+addr2);
memberDto.setPw(pw);
sqlSession.update("member.memberUpdate",memberDto);
return ".main.member.memberModifyPro";
}
//회원탈퇴
@RequestMapping("memberDeleteForm.do")
public String memberDeleteForm() throws IOException,NamingException{
return ".main.member.memberDeleteForm";//뷰리턴
}
@RequestMapping(value="memberDeletePro.do",method=RequestMethod.POST)
public String memberDeletePro(String id,String pw,Model model) throws IOException,NamingException{
MemberDto memberDto=sqlSession.selectOne("member.selectLogin", id);
String dbPw="";
int x=-1;
int check=x;
if(memberDto!=null){
dbPw=memberDto.getPw();
if(pw.equals(dbPw)){
sqlSession.delete("member.memberDelete",id);
x=1;//로그인 성공
}//if
}//
check=x;
model.addAttribute("check",check);
return ".main.member.memberDeletePro";//뷰리턴
}//
}//class end
|
[
"dbwjdgus1317@gmail.com"
] |
dbwjdgus1317@gmail.com
|
78cc271ea0260dece682049a0c64c530f05a96ef
|
26b29628d6339fef77a1c6feb240aad727092e0e
|
/src/CodeLab/Week2/MinStack.java
|
736e814cd32c7a9c86e1d082742dd043f50b6a7b
|
[] |
no_license
|
ekiehuang/INFO6205_Algorithm
|
f0f082542eb609bfeec8c12e44252f1e12f01389
|
625a35f140d0c59dc54712edda1fb5163ba0c0c5
|
refs/heads/master
| 2022-12-24T14:39:30.744390
| 2020-10-02T05:51:14
| 2020-10-02T05:51:14
| 295,308,570
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,495
|
java
|
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Stack;
public class MinStack{
//Approach 1: Two stacks
private Stack<Integer> stack=new Stack<>();
private Stack<Integer> minStack=new Stack<>();
//Approach 2: less efficient
/* private ArrayList<Integer> arr=new ArrayList<>();
private Stack<Integer> minStack=new Stack<>();*/
public static void main(String[] args){
MinStack ms=new MinStack();
ms.push(0);
ms.push(1);
ms.push(0);
System.out.println(ms.getMin());
//ms.push(1);
ms.pop();
System.out.println(ms.top());
System.out.println(ms.getMin());
}
public MinStack() {
}
public void push(int x) {
//Approach 1:
stack.push(x);
if(minStack.isEmpty()||x<=minStack.peek()) minStack.push(x);
//Approach 2
/*minStack.push(x);
arr.add(x);*/
}
public void pop() {
//Approach 1:
if(stack.isEmpty()) return;
int p=stack.pop();
if(p==minStack.peek()) minStack.pop();
//Approach 2:
/*if(minStack.isEmpty()) return;
arr.remove(minStack.size()-1);
minStack.pop();*/
}
public int top() {
//Approach 1:
return stack.peek();
//Approach 2:
//return minStack.peek();
}
public int getMin() {
//Approach 1:
return minStack.peek();
//Approach 2:
/*if(arr.size()==0) return Integer.MIN_VALUE;
int min=arr.get(0);
for(Integer i:arr){
if(i<min) min=i;
}
return min;*/
}
}
|
[
"ekie729@gmail.com"
] |
ekie729@gmail.com
|
900a26ab6b85c15cf0fef835a167ac2b6795254b
|
43279fe70ca9e9fff40d25230fa74a34ce27d3f7
|
/src/main/java/com/cg/ofda/repository/IRestaurantRepository.java
|
e0c268d558c6623c210b0310316d49d49d6bd33f
|
[] |
no_license
|
Akhil17072000/Online-Food-Delivery-Application-Middleware
|
7d9fa4677c896a3d84bbd43a82698bf9d830d809
|
8d798ae5bbc8239a34fa2e23fa7e16a814abc9b2
|
refs/heads/master
| 2023-04-17T20:45:04.352560
| 2021-05-05T07:03:35
| 2021-05-05T07:03:35
| 364,487,692
| 1
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 292
|
java
|
package com.cg.ofda.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
import com.cg.ofda.entity.RestaurantEntity;
@Repository
public interface IRestaurantRepository extends JpaRepository<RestaurantEntity, Long>{
}
|
[
"akhilarora.arora007@gmail.com"
] |
akhilarora.arora007@gmail.com
|
e0e76b72195351afac5c677c8504a0b1601d7262
|
bbc8b7b7554bc075ce831fdec00407d5819005a2
|
/src/main/java/com/future/datastruct/tree/huffman/HuffmanTable.java
|
0a54438ed0891af2aaa142ac901bb56a82ae2b45
|
[] |
no_license
|
zhoujie277/algorithm
|
33bae4f3c45dc728851763f43e7cba4aa16ef993
|
8f96b6cc72ff128c29701f42e5c6023c5d83cf6f
|
refs/heads/master
| 2023-09-05T21:59:41.663638
| 2021-11-22T14:26:19
| 2021-11-22T14:31:13
| 379,934,486
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 839
|
java
|
package com.future.datastruct.tree.huffman;
import com.future.datastruct.map.HashTable;
import java.io.Serializable;
import java.util.Iterator;
/**
* 哈夫曼码表
*/
public class HuffmanTable<K> implements Iterable<K> , Serializable {
private HashTable<K, String> encodeTable;
private HashTable<String, K> decodeTable;
public HuffmanTable() {
this.encodeTable = new HashTable<>();
this.decodeTable = new HashTable<>();
}
public void put(K key, String value) {
encodeTable.put(key, value);
decodeTable.put(value, key);
}
public K get(String codec) {
return decodeTable.get(codec);
}
public String get(K key) {
return encodeTable.get(key);
}
@Override
public Iterator<K> iterator() {
return encodeTable.iterator();
}
}
|
[
"future0936@gmail.com"
] |
future0936@gmail.com
|
bb2d1b994bc5585f3431ca89fc2b45abbb738612
|
7bad0b60437feb5aa1e8c2627bf9b8a5ef8d1a7d
|
/app/src/main/java/com/adio/optimus/Home.java
|
28061b882f91803c63162a93cfd9aa9874c50b22
|
[] |
no_license
|
ooduntan/Optimus
|
32c7689b914c21ed3bd564ff925e059d1ed18b96
|
e1f03afef40a32edf9e9cf8efe483d89aadb7981
|
refs/heads/master
| 2021-06-06T12:44:33.989912
| 2016-11-20T21:23:18
| 2016-11-20T21:23:18
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 19,296
|
java
|
package com.adio.optimus;
import android.app.FragmentTransaction;
import android.bluetooth.BluetoothAdapter;
import android.content.ContentResolver;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.wifi.WifiManager;
import android.provider.Settings;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.os.Bundle;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
import java.util.Timer;
import java.util.TimerTask;
public class Home extends AppCompatActivity {
Toolbar tbar;
ViewPager mPager;
SlidingTabLayout tabs;
boolean reWifi=false,reBlue=false,reScreen=false,reData=false,reSyn=false,reRotation=false;
BluetoothAdapter bluetoothController; //= BluetoothAdapter.getDefaultAdapter();
WifiManager wifiManager;// = (WifiManager) getSystemService(Context.WIFI_SERVICE);
Button btnOpt,btnOpt2;
Switch wifi,bluetooth,threeGSwitch,rotation,Brightness,sync;
Context cont;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_home);
bluetoothController = BluetoothAdapter.getDefaultAdapter();
wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
initViews();
//setSupportActionBar(tbar);
// getSupportActionBar().setDisplayShowHomeEnabled(true);
//mPager.setAdapter(new MyPagerAdapter(getSupportFragmentManager()));
//tabs.setCustomTabView(R.layout.customtablayout, R.id.tabtext);
//tabs.setBackgroundColor(getResources().getColor(R.color.tabcolor));
//tabs.setDistributeEvenly(true);
//tabs.setViewPager(mPager);
optimize();
}
public void initViews(){
btnOpt = (Button) findViewById(R.id.btnOpt);
btnOpt2 = (Button) findViewById(R.id.btnOpt2);
wifi=(Switch) findViewById(R.id.wifi);
threeGSwitch=(Switch) findViewById(R.id.threeGSwitch);
bluetooth=(Switch) findViewById(R.id.bluetoothSwitch);
Brightness=(Switch) findViewById(R.id.screen);
rotation=(Switch) findViewById(R.id.rotationSwitch);
sync=(Switch) findViewById(R.id.sync);
//tbar = (Toolbar) findViewById(R.id.toolbar);
//tabs = (SlidingTabLayout) findViewById(R.id.tabstrip);
//mPager = (ViewPager) findViewById(R.id.pager);
btnOpt = (Button) findViewById(R.id.btnOpt);
btnOpt2 = (Button) findViewById(R.id.btnOpt2);
if (bluetoothController.isEnabled()){
bluetooth.setChecked(true);
}else{
bluetooth.setChecked(false);
}
if (wifiManager.isWifiEnabled()){
wifi.setChecked(true);
}else{
wifi.setChecked(false);
}
if (checkMobileDataStatus()){
threeGSwitch.setChecked(true);
}else{
threeGSwitch.setChecked(false);
}
if (android.provider.Settings.System.getInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0) == 1) {
rotation.setChecked(true);
}else{
rotation.setChecked(false);
}
int brightnessmode = 1;
try {
brightnessmode = android.provider.Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE);
} catch (Exception e) {
Log.d("tag", e.toString());
}
if (brightnessmode == 0) {
Brightness.setChecked(false);
}else{
Brightness.setChecked(true);
}
if (ContentResolver.getMasterSyncAutomatically()){
sync.setChecked(true);
}else{
sync.setChecked(false);
}
}
private void timer_method(){
Timer nextTimer=new Timer();
nextTimer.schedule(new TimerTask() {
@Override
public void run() {
ContentResolver.setMasterSyncAutomatically(true);
try{
setMobileDataEnabled(true);
}catch (Exception e){}
}
},300000);
ContentResolver.setMasterSyncAutomatically(false);
try{
setMobileDataEnabled(false);
}catch (Exception e){}
this.runOnUiThread(Timer_Tick);
}
private Runnable Timer_Tick=new Runnable(){
public void run(){
Toast.makeText(getApplicationContext(), "Background Sync and 3G was Turned on for 5 min after 30 min", Toast.LENGTH_LONG).show();
}
};
public boolean WifiChecker(){
WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
if (wifiManager.getConnectionInfo().getNetworkId() == -1){
return false;
}else{
return true;
}
}
public void setMobileDataEnabled(boolean enabled) throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException, NoSuchMethodException, InvocationTargetException {
final ConnectivityManager conman = (ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
final Class<?> conmanClass = Class.forName(conman.getClass().getName());
final java.lang.reflect.Field connectivityManagerField = conmanClass.getDeclaredField("mService");
connectivityManagerField.setAccessible(true);
final Object connectivityManager = connectivityManagerField.get(conman);
final Class<?> connectivityManagerClass = Class.forName(connectivityManager.getClass().getName());
final Method setMobileDataEnabledMethod = connectivityManagerClass.getDeclaredMethod("setMobileDataEnabled", Boolean.TYPE);
setMobileDataEnabledMethod.setAccessible(true);
setMobileDataEnabledMethod.invoke(connectivityManager, enabled);
}
private Boolean checkMobileDataStatus(){
boolean mobileDataEnabled = false; // Assume disabled
ConnectivityManager cm = (ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
try {
Class cmClass = Class.forName(cm.getClass().getName());
Method method = cmClass.getDeclaredMethod("getMobileDataEnabled");
method.setAccessible(true); // Make the method callable
// get the setting for "mobile data"
mobileDataEnabled = (Boolean)method.invoke(cm);
} catch (Exception e) {
// Some problem accessible private API
// TODO do whatever error handling you want here
}
return mobileDataEnabled;
}
public void optimize(){
bluetooth.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked){
bluetoothController.enable();
reBlue=false;
}else {
bluetoothController.disable();
}
}
});
wifi.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if(isChecked==true){
wifiManager.setWifiEnabled(true);
reWifi=false;
}else{
//isla.WifiTurnOn();
wifiManager.setWifiEnabled(false);
}
}
});
threeGSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (threeGSwitch.isChecked() == true) {
try {
Timer myTimer = new Timer();
myTimer.schedule(new TimerTask() {
@Override
public void run() {
timer_method();
}
}, 0, 1800000);
reData=false;
}catch (Exception e){Toast.makeText(getApplicationContext(), " items were Optmized", Toast.LENGTH_LONG).show();}
} else {
try {
setMobileDataEnabled(false);
}catch (Exception e){Toast.makeText(getApplicationContext(), " items were ", Toast.LENGTH_LONG).show();}
}
}
});
rotation.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked){
android.provider.Settings.System.putInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 1);
reRotation=false;
}else{
android.provider.Settings.System.putInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0);
}
}
});
Brightness.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (isChecked){
android.provider.Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
reScreen=false;
}else{
android.provider.Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
}
}
});
sync.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (ContentResolver.getMasterSyncAutomatically()){
ContentResolver.setMasterSyncAutomatically(false);
reSyn=false;
}else {
ContentResolver.setMasterSyncAutomatically(true);
}
}
});
btnOpt.setOnClickListener(new View.OnClickListener() {
WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
@Override
public void onClick(View v) {
int counter=0;
//Toast.makeText(Home.this, counter+" items were Optimized", Toast.LENGTH_LONG).show();
// TODO Auto-generated method stub
if(bluetoothController.isEnabled()){
counter++;
bluetoothController.disable();
bluetooth.setChecked(false);
reBlue=true;
}
if(WifiChecker()==true){
counter++;
wifiManager.setWifiEnabled(false);
wifi.setChecked(false);
reWifi=true;
}
if(android.provider.Settings.System.getInt(getContentResolver(),Settings.System.ACCELEROMETER_ROTATION, 0) == 1)
{
android.provider.Settings.System.putInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0);
counter++;
reRotation=true;
rotation.setChecked(false);
}
if (checkMobileDataStatus()==true) {
//Boolean name=turnData(false);
try {
setMobileDataEnabled( false);
reData=true;
threeGSwitch.setChecked(false);
counter++;
}catch (InvocationTargetException es){ Toast.makeText(getApplicationContext(), es.getCause().toString(), Toast.LENGTH_LONG).show();}
catch (Exception e){ Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();}
}
int brightnessmode=1;
try {
brightnessmode = android.provider.Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE);
} catch (Exception e) {
Log.d("tag", e.toString());
}
if(brightnessmode==0){
counter++;
android.provider.Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
Brightness.setChecked(true);
reScreen=true;
}
if (ContentResolver.getMasterSyncAutomatically()){
ContentResolver.setMasterSyncAutomatically(false);
reSyn=true;
sync.setChecked(false);
counter++;
}
String result="";
if (reWifi==true){
result+=" WIFI ";
}
if (reData==true){
result+=" 3G ";
}
if (reBlue==true){
result+=" BLUETOOTH ";
}
if (reRotation==true){
result+=" ROTATION ";
}
if (reScreen){
result+=" BRIGHTNESS ";
}
if (reSyn==true){
result+=" SYNCHRONIZATION ";
}
Toast.makeText(getApplicationContext(), counter+" items were Optimized: "+result, Toast.LENGTH_LONG).show();
}
});
btnOpt2.setOnClickListener(new View.OnClickListener() {
WifiManager wifiManager = (WifiManager) getSystemService(Context.WIFI_SERVICE);
@Override
public void onClick(View v) {
int itemsNumber=0;
String itemsRestored="";
if(reWifi==true){
wifiManager.setWifiEnabled(true);
wifi.setChecked(true);
itemsNumber++;
itemsRestored+=" WIFI ";
reWifi=false;
}
if(reBlue==true){
bluetoothController.enable();
bluetooth.setChecked(true);
itemsNumber++;
itemsRestored+=" BLUETOOTH ";
reBlue=false;
}
if(reRotation==true){
android.provider.Settings.System.putInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 1);
itemsNumber++;
itemsRestored+=" ROTATION ";
rotation.setChecked(true);
reRotation=false;
}
if(reData==true){
try {
setMobileDataEnabled(true);
itemsNumber++;
itemsRestored+=" 3G ";
reData=false;
threeGSwitch.setChecked(true);
}catch (Exception e){}
}
if (reScreen==true){
android.provider.Settings.System.putInt(getContentResolver(), Settings.System.SCREEN_BRIGHTNESS_MODE,
Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL);
itemsNumber++;
itemsRestored+=" BRIGHTNESS ";
reScreen=false;
Brightness.setChecked(false);
}
if (reSyn==true){
ContentResolver.setMasterSyncAutomatically(true);
itemsNumber++;
reSyn=false;
sync.setChecked(true);
itemsRestored+=" SYNCHRONIZATION ";
}
Toast.makeText(getApplicationContext(), itemsNumber+" Items Restored: "+itemsRestored, Toast.LENGTH_LONG).show();
}
});
}
public Boolean turnData(boolean ON){
try{
final ConnectivityManager conman = (ConnectivityManager) getApplicationContext().getSystemService(Context.CONNECTIVITY_SERVICE);
final Class conmanClass = Class.forName(conman.getClass().getName());
final Field iConnectivityManagerField = conmanClass.getDeclaredField("mService");
iConnectivityManagerField.setAccessible(true);
final Object iConnectivityManager = iConnectivityManagerField.get(conman);
final Class iConnectivityManagerClass = Class.forName(iConnectivityManager.getClass().getName());
final Method setMobileDataEnabledMethod = iConnectivityManagerClass.getDeclaredMethod("setMobileDataEnabled", Boolean.TYPE);
setMobileDataEnabledMethod.setAccessible(true);
setMobileDataEnabledMethod.invoke(iConnectivityManager, ON);
}catch (InvocationTargetException es){ Toast.makeText(getApplicationContext(), es.getCause().toString(), Toast.LENGTH_LONG).show();}
catch (Exception e){ Toast.makeText(getApplicationContext(), e.toString(), Toast.LENGTH_LONG).show();}
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
switch(id){
case R.id.search_action:{
Toast.makeText(getApplicationContext(), "Search action clicked", Toast.LENGTH_LONG).show();
break;
}case R.id.settings:{
Toast.makeText(getApplicationContext(), "Settings", Toast.LENGTH_LONG).show();
break;
}
}
return super.onOptionsItemSelected(item);
}
}
|
[
"stephen.oduntan@andela.com"
] |
stephen.oduntan@andela.com
|
713acbdd21655c21790b9a7da168a0b2bd5eff3d
|
9cc9a980cacea0deba70c71bd1743f202e624d8b
|
/app/src/main/java/com/vasiachess/gmailtest/MainActivity.java
|
575f48f13ee9a3c9fade40dc9ecd3ed135cd38e3
|
[] |
no_license
|
vasiachess/GmailTest
|
b0fc82cacd980d67365a62a54172bff024ce2009
|
59d285cb6410eb5fa43d8af0b0a36dbfe98bd913
|
refs/heads/master
| 2020-12-25T11:15:57.081540
| 2016-05-29T15:27:18
| 2016-05-29T15:27:18
| 59,907,182
| 0
| 0
| null | 2016-05-29T15:27:18
| 2016-05-28T17:42:22
|
Java
|
UTF-8
|
Java
| false
| false
| 11,507
|
java
|
package com.vasiachess.gmailtest;
import android.Manifest;
import android.accounts.AccountManager;
import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.text.method.ScrollingMovementMethod;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GoogleApiAvailability;
import com.google.api.client.extensions.android.http.AndroidHttp;
import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential;
import com.google.api.client.googleapis.extensions.android.gms.auth.GooglePlayServicesAvailabilityIOException;
import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.client.util.ExponentialBackOff;
import com.google.api.services.gmail.Gmail;
import com.google.api.services.gmail.GmailScopes;
import com.google.api.services.gmail.model.Label;
import com.google.api.services.gmail.model.ListLabelsResponse;
import com.google.api.services.gmail.model.ListMessagesResponse;
import com.google.api.services.gmail.model.ListThreadsResponse;
import com.google.api.services.gmail.model.Message;
import com.google.api.services.gmail.model.Thread;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
import pub.devrel.easypermissions.AfterPermissionGranted;
import pub.devrel.easypermissions.EasyPermissions;
public class MainActivity extends BaseActivity
implements EasyPermissions.PermissionCallbacks {
@Bind(R.id.btn_sign_in) Button btnSignIn;
@Bind(R.id.rv_messages) RecyclerView rvMessages;
private MessageAdapter adapter;
private String accountName;
/**
* Create the main activity.
*
* @param savedInstanceState previously saved instance data.
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
setUpView();
}
/**
* Attempt to call the API, after verifying that all the preconditions are
* satisfied. The preconditions are: Google Play Services installed, an
* account was selected and the device currently has online access. If any
* of the preconditions are not satisfied, the app will prompt the user as
* appropriate.
*/
private void getResultsFromApi() {
if (!isGooglePlayServicesAvailable()) {
acquireGooglePlayServices();
} else if (mCredential.getSelectedAccountName() == null) {
chooseAccount();
} else if (!isDeviceOnline()) {
Toast.makeText(this, "No network connection available.", Toast.LENGTH_LONG).show();
} else {
new MakeRequestTask(mCredential).execute();
}
}
/**
* Attempts to set the account used with the API credentials. If an account
* name was previously saved it will use that one; otherwise an account
* picker dialog will be shown to the user. Note that the setting the
* account to use with the credentials object requires the app to have the
* GET_ACCOUNTS permission, which is requested here if it is not already
* present. The AfterPermissionGranted annotation indicates that this
* function will be rerun automatically whenever the GET_ACCOUNTS permission
* is granted.
*/
@AfterPermissionGranted(REQUEST_PERMISSION_GET_ACCOUNTS)
private void chooseAccount() {
if (EasyPermissions.hasPermissions(
this, Manifest.permission.GET_ACCOUNTS)) {
accountName = getPreferences(Context.MODE_PRIVATE)
.getString(PREF_ACCOUNT_NAME, null);
if (accountName != null) {
mCredential.setSelectedAccountName(accountName);
getResultsFromApi();
} else {
// Start a dialog from which the user can choose an account
startActivityForResult(
mCredential.newChooseAccountIntent(),
REQUEST_ACCOUNT_PICKER);
}
} else {
// Request the GET_ACCOUNTS permission via a user dialog
EasyPermissions.requestPermissions(
this,
"This app needs to access your Google account (via Contacts).",
REQUEST_PERMISSION_GET_ACCOUNTS,
Manifest.permission.GET_ACCOUNTS);
}
}
/**
* Called when an activity launched here (specifically, AccountPicker
* and authorization) exits, giving you the requestCode you started it with,
* the resultCode it returned, and any additional data from it.
*
* @param requestCode code indicating which activity result is incoming.
* @param resultCode code indicating the result of the incoming
* activity result.
* @param data Intent (containing result data) returned by incoming
* activity result.
*/
@Override
protected void onActivityResult(
int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
switch (requestCode) {
case REQUEST_GOOGLE_PLAY_SERVICES:
if (resultCode != RESULT_OK) {
Toast.makeText(this,
"This app requires Google Play Services. Please install " +
"Google Play Services on your device and relaunch this app.", Toast.LENGTH_LONG).show();
} else {
getResultsFromApi();
}
break;
case REQUEST_ACCOUNT_PICKER:
if (resultCode == RESULT_OK && data != null &&
data.getExtras() != null) {
String accountName =
data.getStringExtra(AccountManager.KEY_ACCOUNT_NAME);
if (accountName != null) {
SharedPreferences settings =
getPreferences(Context.MODE_PRIVATE);
SharedPreferences.Editor editor = settings.edit();
editor.putString(PREF_ACCOUNT_NAME, accountName);
editor.apply();
mCredential.setSelectedAccountName(accountName);
getResultsFromApi();
}
}
break;
case REQUEST_AUTHORIZATION:
if (resultCode == RESULT_OK) {
getResultsFromApi();
}
break;
}
}
/**
* Respond to requests for permissions at runtime for API 23 and above.
*
* @param requestCode The request code passed in
* requestPermissions(android.app.Activity, String, int, String[])
* @param permissions The requested permissions. Never null.
* @param grantResults The grant results for the corresponding permissions
* which is either PERMISSION_GRANTED or PERMISSION_DENIED. Never null.
*/
@Override
public void onRequestPermissionsResult(int requestCode,
@NonNull String[] permissions,
@NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
EasyPermissions.onRequestPermissionsResult(
requestCode, permissions, grantResults, this);
}
/**
* Callback for when a permission is granted using the EasyPermissions
* library.
*
* @param requestCode The request code associated with the requested
* permission
* @param list The requested permission list. Never null.
*/
@Override
public void onPermissionsGranted(int requestCode, List<String> list) {
// Do nothing.
}
/**
* Callback for when a permission is denied using the EasyPermissions
* library.
*
* @param requestCode The request code associated with the requested
* permission
* @param list The requested permission list. Never null.
*/
@Override
public void onPermissionsDenied(int requestCode, List<String> list) {
// Do nothing.
}
@OnClick(R.id.btn_sign_in) public void onClick() {
getResultsFromApi();
}
private void setUpView() {
rvMessages.setLayoutManager(new LinearLayoutManager(this,
android.support.v7.widget.LinearLayoutManager.VERTICAL, false));
}
/**
* An asynchronous task that handles the Gmail API call.
* Placing the API calls in their own task ensures the UI stays responsive.
*/
private class MakeRequestTask extends AsyncTask<Void, Void, List<Thread>> {
private Gmail mService = null;
private Exception mLastError = null;
public MakeRequestTask(GoogleAccountCredential credential) {
HttpTransport transport = AndroidHttp.newCompatibleTransport();
JsonFactory jsonFactory = JacksonFactory.getDefaultInstance();
mService = new Gmail.Builder(
transport, jsonFactory, credential)
.setApplicationName("Gmail Test")
.build();
}
/**
* Background task to call Gmail API.
*
* @param params no parameters needed for this task.
*/
@Override
protected List<Thread> doInBackground(Void... params) {
try {
return getDataFromApi();
} catch (Exception e) {
mLastError = e;
cancel(true);
return null;
}
}
/**
* Fetch a list of Gmail labels attached to the specified account.
*
* @return List of Strings labels.
* @throws IOException
*/
private List<Thread> getDataFromApi() throws IOException {
// Get the labels in the user's account.
String user = "me";
ListThreadsResponse listResponse =
mService.users().threads().list(user).setMaxResults(10L).execute();
return listResponse.getThreads();
}
@Override
protected void onPreExecute() {
mProgress.show();
}
@Override
protected void onPostExecute(List<Thread> output) {
mProgress.hide();
if (output == null || output.size() == 0) {
Toast.makeText(MainActivity.this, "No results returned.", Toast.LENGTH_LONG).show();
} else {
if (getSupportActionBar() != null) {
getSupportActionBar().setTitle("My mail");
}
rvMessages.setVisibility(View.VISIBLE);
adapter = new MessageAdapter(MainActivity.this, output);
adapter.setListener(this::navigateToMessageActivity);
rvMessages.setAdapter(adapter);
}
}
private void navigateToMessageActivity(Thread thread) {
MessagesActivity.startActivity(MainActivity.this, thread.getId(), accountName);
}
@Override
protected void onCancelled() {
mProgress.hide();
if (mLastError != null) {
if (mLastError instanceof GooglePlayServicesAvailabilityIOException) {
showGooglePlayServicesAvailabilityErrorDialog(
((GooglePlayServicesAvailabilityIOException) mLastError)
.getConnectionStatusCode());
} else if (mLastError instanceof UserRecoverableAuthIOException) {
startActivityForResult(
((UserRecoverableAuthIOException) mLastError).getIntent(),
MainActivity.REQUEST_AUTHORIZATION);
} else {
Toast.makeText(MainActivity.this, "The following error occurred:\n"
+ mLastError.getMessage(), Toast.LENGTH_LONG).show();
}
} else {
Toast.makeText(MainActivity.this, "Request cancelled.", Toast.LENGTH_LONG).show();
}
}
}
@Override protected void onDestroy() {
super.onDestroy();
ButterKnife.unbind(this);
}
}
|
[
"vasiachess@gmail.com"
] |
vasiachess@gmail.com
|
82512054d731c0ae823377dae88fda40fca04bb5
|
a9e74f1f418071a8d0aab9b9681648de7cc5ca26
|
/JSP/MemberManager2/src/membermanager/service/LoginMemberService.java
|
0dca7e51df55b4632197c8d0a84e882a16162c5a
|
[] |
no_license
|
kytsaaa6/bitcampjn201904
|
cb687cf58582d87aae457588e18201453058413d
|
8285bdbd283607e7fdc85c5e388b353e6937447e
|
refs/heads/master
| 2020-05-28T07:37:31.082261
| 2019-10-08T02:50:48
| 2019-10-08T02:50:48
| 188,924,136
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,170
|
java
|
package membermanager.service;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.sql.Connection;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import membermanager.dao.MemberDao;
import membermanager.model.LoginInfo;
import membermanager.model.MemberInfo;
public class LoginMemberService implements MemberManagerService {
@Override
public String getViewName(HttpServletRequest request, HttpServletResponse response) {
String viewName = "/WEB-INF/view/loginMember.jsp";
try {
request.setCharacterEncoding("UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String uId = request.getParameter("uId");
String uPw = request.getParameter("uPw");
MemberInfo chk = null;
MemberDao dao = MemberDao.getInstance();
Connection conn = null;
int resultCnt = 0;
chk = dao.loginCheck(conn, uId, uPw);
if(chk.getuId().equals(uId) && chk.getuPw().equals(uPw)) {
} else {
try {
response.sendRedirect("/");
} catch (IOException e) {
e.printStackTrace();
}
}
return viewName;
}
}
|
[
"kytsaaa6@naver.com"
] |
kytsaaa6@naver.com
|
05f743177ab81877ba47b4e529a0cd32b89acc28
|
85cbcdb2486034bf67ce0514a24bc59f75d97855
|
/src/main/java/com/dk/app/config/AsyncConfiguration.java
|
938d631222375e71769b6706d4e04d74979e919d
|
[] |
no_license
|
nickbarban/dc-5
|
c0d82684abe3f5e3a5a3d34a3db1c24ba35e8b72
|
c9da64a8fc098e86ffe0b9214afa1afb0ef8dbc2
|
refs/heads/master
| 2023-05-04T13:23:29.003807
| 2016-12-21T13:52:06
| 2016-12-21T13:52:06
| 77,055,317
| 0
| 1
| null | 2023-04-17T19:00:41
| 2016-12-21T13:47:59
|
Java
|
UTF-8
|
Java
| false
| false
| 1,616
|
java
|
package com.dk.app.config;
import com.dk.app.async.ExceptionHandlingAsyncTaskExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.aop.interceptor.SimpleAsyncUncaughtExceptionHandler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.*;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import javax.inject.Inject;
@Configuration
@EnableAsync
@EnableScheduling
public class AsyncConfiguration implements AsyncConfigurer {
private final Logger log = LoggerFactory.getLogger(AsyncConfiguration.class);
@Inject
private JHipsterProperties jHipsterProperties;
@Override
@Bean(name = "taskExecutor")
public Executor getAsyncExecutor() {
log.debug("Creating Async Task Executor");
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(jHipsterProperties.getAsync().getCorePoolSize());
executor.setMaxPoolSize(jHipsterProperties.getAsync().getMaxPoolSize());
executor.setQueueCapacity(jHipsterProperties.getAsync().getQueueCapacity());
executor.setThreadNamePrefix("dancekvartal-Executor-");
return new ExceptionHandlingAsyncTaskExecutor(executor);
}
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return new SimpleAsyncUncaughtExceptionHandler();
}
}
|
[
"nbarban@millhouse.com"
] |
nbarban@millhouse.com
|
ad535c5a1ec2ad63f21e3a82057b821e4cc15e5b
|
411e90d5b6c575f4b124ea51c8c3b77656e84799
|
/app/src/test/java/com/swufestu/third/ExampleUnitTest.java
|
e16466b86282c51894edc313a8dfbe1459012382
|
[] |
no_license
|
wjs2000/BIM
|
4d908efd5897538038fd8c4beaebefa19e787b19
|
f8f489d58899ec8f86b973e25986b7c52b8caffd
|
refs/heads/master
| 2023-09-01T12:00:54.961610
| 2021-10-26T13:10:15
| 2021-10-26T13:10:15
| 409,227,450
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 379
|
java
|
package com.swufestu.third;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}
|
[
"1341656197@qq.com"
] |
1341656197@qq.com
|
c1c3171c1d541a9138c12e1f74b477b7ce1866df
|
ff242f1b292d59cfeca81f37910525a6f6cef955
|
/Panier/src/Panier/RegularItem.java
|
f1e04619330050416a94dfae7146da1e4547bce2
|
[] |
no_license
|
Jiamin-WANG/TP-TSIO-Java
|
7f0b792134ea22a319dd7ecb3ea0a2fe0d957c6a
|
9ea35ca0ae20768d6732c5d0ca3d8f94d240d06d
|
refs/heads/master
| 2020-05-01T11:54:25.645113
| 2019-04-23T22:01:31
| 2019-04-23T22:01:31
| 177,454,511
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 378
|
java
|
/**
*
*/
package Panier;
/**
* @author Jiamin WANG
*
*/
public class RegularItem extends CartItem{
/**
* les products normal
*/
public RegularItem(int quan) {
// TODO Auto-generated constructor stub
super(quan);
}
@Override
int price() {
// TODO Auto-generated method stub
int prix;
prix = this.unitPrice() * this.getQuantity();
return prix;
}
}
|
[
"wjm.imtld@gmail.com"
] |
wjm.imtld@gmail.com
|
b424aa7d9d48f0a1a42c20bf7b8290465bfe7bd6
|
4198f6e578c76e4dfb71dbc90d4df1b6039161d2
|
/QueueAndStack/Keys-Rooms/src/Main.java
|
70392d962ba42f7b2e2fa24970a851384e085b2c
|
[] |
no_license
|
SinLapis/leetcode-pre
|
591e3230ec6e20ab9c93addda738be1572dc612a
|
07c5e4432dae1f7029b53c4f1a3d0d5f67a37259
|
refs/heads/master
| 2020-04-26T23:53:05.170855
| 2019-06-14T08:48:11
| 2019-06-14T08:48:11
| 173,917,069
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 557
|
java
|
import java.util.ArrayList;
import java.util.List;
class Solution {
void visit(List<Integer> visited, List<List<Integer>> rooms, int room) {
visited.add(room);
for (int key: rooms.get(room)) {
if (!visited.contains(key)) {
visit(visited, rooms, key);
}
}
}
public boolean canVisitAllRooms(List<List<Integer>> rooms) {
List<Integer> visited = new ArrayList<>();
visit(visited, rooms, 0);
return visited.size() == rooms.size();
}
}
public class Main {
}
|
[
"stradust0001@gmail.com"
] |
stradust0001@gmail.com
|
c5ba9c91d24080cd479ad5b260e7696c87a2d40c
|
3c4763922cda3f3a990b74cdba6f8a30b07467de
|
/src/main/java/students/alex_kalashnikov/lesson_8/level_4/task_16/Shape.java
|
9d434582823e17d75f11a1ac9ba0f48c3a1623dd
|
[] |
no_license
|
VitalyPorsev/JavaGuru1
|
07db5a0cc122b097a20e56c9da431cd49d3c01ea
|
f3c25b6357309d4e9e8ac0047e51bb8031d14da8
|
refs/heads/main
| 2023-05-10T15:35:55.419713
| 2021-05-15T18:48:12
| 2021-05-15T18:48:12
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 255
|
java
|
package students.alex_kalashnikov.lesson_8.level_4.task_16;
abstract class Shape {
private String title;
Shape(String title) {
this.title = title;
}
abstract double calculateArea();
abstract double calculatePerimeter();
}
|
[
"kalashnikov_alex@yahoo.com"
] |
kalashnikov_alex@yahoo.com
|
f05b682a53197b88a1461832b1beb33c7ce68cec
|
04dabb619af020161e8525e570fba2964ae4248c
|
/2018-12-03-10-59/AssignmentJava/src/java/src/DeleteEmployee.java
|
8e61c3567f23b13e50d41e6803b755c13ee90ae7
|
[] |
no_license
|
dcjaya/JavaAS
|
aa0efdb94c00247bccfb8c4694c6ee9a14fa0769
|
33ab9062bab9a48ac118116fc6e4e7527e28916e
|
refs/heads/master
| 2020-04-09T06:10:29.549171
| 2018-12-03T12:42:53
| 2018-12-03T12:42:53
| 160,101,389
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,343
|
java
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package src;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import model.Employee;
/**
*
* @author Chami
*/
public class DeleteEmployee extends HttpServlet {
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
String employeid = request.getParameter("empId");
model.Employee employee = new Employee();
boolean result = employee.deleteEmploye(employeid);
if (result) {
request.getSession().setAttribute("success_msg", "Employee Delete Successfully.");
response.sendRedirect("admin_view_all_employee.jsp");
} else {
request.getSession().setAttribute("error_msg", "Employee Delete Successfully.");
response.sendRedirect("admin_view_all_employee.jsp");
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
|
[
"dchamith92@yahoo.com"
] |
dchamith92@yahoo.com
|
14139e61648a0b641f40ce00093ae521759896d5
|
32f38cd53372ba374c6dab6cc27af78f0a1b0190
|
/app/src/main/java/com/alipay/mobile/nebulacore/data/H5PrefData.java
|
cd59228b062e58977bc13aa08bc71b16c861027f
|
[] |
no_license
|
shuixi2013/AmapCode
|
9ea7aefb42e0413f348f238f0721c93245f4eac6
|
1a3a8d4dddfcc5439df8df570000cca12b15186a
|
refs/heads/master
| 2023-06-06T23:08:57.391040
| 2019-08-29T04:36:02
| 2019-08-29T04:36:02
| null | 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 976
|
java
|
package com.alipay.mobile.nebulacore.data;
import android.content.SharedPreferences;
import android.text.TextUtils;
import com.alipay.mobile.h5container.api.H5Data;
import com.alipay.mobile.nebulacore.env.H5Environment;
public class H5PrefData implements H5Data {
private SharedPreferences a;
public H5PrefData(String name) {
this.a = H5Environment.getContext().getSharedPreferences(!TextUtils.isEmpty(name) ? "h5_data_" + name : "h5_data_", 0);
}
public void set(String name, String value) {
this.a.edit().putString(name, value).apply();
}
public String get(String name) {
return this.a.getString(name, null);
}
public String remove(String name) {
String value = this.a.getString(name, null);
if (!TextUtils.isEmpty(value)) {
this.a.edit().remove(name).apply();
}
return value;
}
public boolean has(String name) {
return this.a.contains(name);
}
}
|
[
"hubert.yang@nf-3.com"
] |
hubert.yang@nf-3.com
|
2c3f7b53d1afaa8a916ae08542e9852d585795a1
|
d116181081822a6e07d6772747362c89a1a54b6d
|
/src/main/java/login/practice/PracticeApplication.java
|
acb82ec08bbf028fdda6c280ddc60b70d3a95973
|
[] |
no_license
|
kjs3829/spring-login
|
4ad6db6d93b1bf72f51da4eed0a7463b9661bd6f
|
3ebe61018f90f6a0b7363d7813c544e6c40afb09
|
refs/heads/master
| 2023-06-21T17:02:50.083480
| 2021-07-27T06:28:02
| 2021-07-27T06:28:02
| 389,870,195
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 311
|
java
|
package login.practice;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class PracticeApplication {
public static void main(String[] args) {
SpringApplication.run(PracticeApplication.class, args);
}
}
|
[
"kjs35323@naver.com"
] |
kjs35323@naver.com
|
6a475e707f7c40de06775788ea7d4d7919f9d6c7
|
4288aaba811b9cc4131f5337eb5be996f2046308
|
/src/c_002/T.java
|
7505d6ac5901eb39fced09af5e06333d658ac524
|
[] |
no_license
|
yafengstark/java-concurrent-audition
|
3ad1c415a9641104eb1aa0c9439581ae7e52416e
|
6fc6ddab54422adfa8539e235790f280b171e6ad
|
refs/heads/master
| 2020-06-13T03:54:12.586979
| 2019-07-10T11:36:47
| 2019-07-10T11:36:47
| 194,525,547
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 524
|
java
|
package c_002;
/**
* synchronized 关键字
* 对this加锁
*
* 每次使用锁都要newObject,比较麻烦,可以使用this代替object锁
*/
public class T {
private int count = 10;
public void m() {
synchronized (this) { // 任何线程要执行下面的代码,必须先拿到this锁
// synchronized 锁定的不是代码块,而是 this 对象
count--;
System.out.println(Thread.currentThread().getName() + " count = " + count);
}
}
}
|
[
"fengfeng043@gmail.com"
] |
fengfeng043@gmail.com
|
338878d8bfd651cff3b33e567f58ebc3bc68eed1
|
79479534f837ee072f23dcad8a1905e2a87df9e2
|
/Lab7/src/pkg/VerifyIdentifier.java
|
2f760b2ba91eb460b2c2e875682ba0285d3d1e05
|
[] |
no_license
|
AmiableNebula/cs182-projects
|
db41ad447f9a166e2b502baeaece5dc0b5491ba9
|
53cc060f4fada53c5c743e837f1cd9460302615c
|
refs/heads/master
| 2020-08-14T14:47:19.380743
| 2019-12-03T22:23:46
| 2019-12-03T22:23:46
| 205,621,970
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,489
|
java
|
package pkg;
public class VerifyIdentifier {
private static char[] validStarters = new char[] {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
private static char[] validEnders = new char[] {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',
'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
public static void main (String[] args) {
System.out.println (verifyIdentifier ("Sarah"));
}
public static boolean verifyIdentifier (String str) {
if (str.length() == 1) {
return verifyStarter (str.charAt (0));
} else if (verifyEnder (str.charAt (str.length() - 1))) {
return verifyIdentifier (str.substring (0, str.length() - 1));
} else {
return false;
}
}
private static boolean verifyStarter (char chr) {
for (int i = 0; i < validStarters.length; i++) {
if (chr == validStarters [i]) {
return true;
}
}
return false;
}
private static boolean verifyEnder (char chr) {
for (int i = 0; i < validEnders.length; i++) {
if (chr == validEnders [i]) {
return true;
}
}
return false;
}
}
|
[
"sarahramseymcneil@gmail.com"
] |
sarahramseymcneil@gmail.com
|
6f7602266d7ed66f7ee3e0147937e190dd0e766a
|
46908c747b348f95262942583dd20630b0b8f76e
|
/novice/01-05/latihan/src/main/java/kampus/DeserializeXML.java
|
35a94c0ddb96508320cbcee6969f3de5dbf85d8b
|
[] |
no_license
|
MuhammadRizqiPanji/praxis-academy
|
b9634c7131b1239af5ea8d35e6389dd07af4b96c
|
6e42a470f99f169f9d18c035ed192758dfa5da31
|
refs/heads/master
| 2020-12-22T20:56:20.594372
| 2020-02-10T07:58:15
| 2020-02-10T07:58:15
| 236,929,382
| 0
| 0
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 772
|
java
|
package kampus;
import java.beans.XMLDecoder;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
public class DeserializeXML {
public static void main(String[] args) {
try (XMLDecoder x = new XMLDecoder(new BufferedInputStream(new FileInputStream("myCollege.xml")))) {
College c = (College) x.readObject();
List<Student> s = c.getStudents();
for(Student value : s){
System.out.println(value);
}
} catch (FileNotFoundException ex){
Logger.getLogger(DeserializeXML.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
|
[
"kiky.forzamax@gmail.com"
] |
kiky.forzamax@gmail.com
|
9723ddb1956ae6b8b8579f1b05e509f1fc775b6e
|
821cdec16c095f9ed45a0691bb008653cc6391bd
|
/src/net/csdn/modules/transport/HttpTransportService.java
|
afd313138c46dd7f2d8c2b58f3519fd3ec584436
|
[] |
no_license
|
jacarrichan/ServiceFramework
|
f46f8eec452c4415a78cadfb874eb72a6562424b
|
dac41154764f9be6fa95caf0205d3fe384990a49
|
refs/heads/master
| 2021-01-18T16:17:40.827593
| 2012-08-13T13:11:10
| 2012-08-13T13:11:10
| 5,399,769
| 0
| 1
| null | null | null | null |
UTF-8
|
Java
| false
| false
| 1,617
|
java
|
package net.csdn.modules.transport;
import net.csdn.common.path.Url;
import net.csdn.modules.http.RestRequest;
import net.sf.json.JSONObject;
import java.util.List;
import java.util.Map;
import java.util.concurrent.FutureTask;
/**
* BlogInfo: WilliamZhu
* Date: 12-5-29
* Time: 下午5:09
*/
public interface HttpTransportService {
public SResponse post(Url url, Map data);
public SResponse put(Url url, Map data);
public SResponse http(Url url, String jsonData, RestRequest.Method method);
public FutureTask<SResponse> asyncHttp(final Url url, final String jsonData, RestRequest.Method method);
public List<SResponse> asyncHttps(final List<Url> urls, final String jsonData, RestRequest.Method method);
class SResponse {
private int status = 200;
private String content;
private Url url;
public SResponse(int status, String content, Url url) {
this.status = status;
this.content = content;
this.url = url;
}
public JSONObject json() {
return JSONObject.fromObject(content);
}
//
public Url getUrl() {
return url;
}
public void setUrl(Url url) {
this.url = url;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
}
|
[
"allwefantasy@gmail.com"
] |
allwefantasy@gmail.com
|
ee9134fad4a40ce316f67616cf04f926ee02399d
|
9be2f5a5532ce845a232439ff4bd99b05ad346bc
|
/benchmarks/training-lab-vue-main/android/app/src/main/java/io/ionic/traininglabvue/MainActivity.java
|
bb62e1e41bf5e9d6d56ea6783605921d1ba96efb
|
[
"MIT"
] |
permissive
|
bottlehs/minimusic
|
28a87043df3c39f63b703f7b77fe5e360bac9a57
|
b3a9b3fe20c24c91c9fd9abe609be5ed12169185
|
refs/heads/main
| 2023-07-02T02:39:51.580054
| 2021-08-02T09:31:24
| 2021-08-02T09:31:24
| 368,755,382
| 0
| 0
|
MIT
| 2021-08-02T09:31:25
| 2021-05-19T05:36:07
|
JavaScript
|
UTF-8
|
Java
| false
| false
| 127
|
java
|
package io.ionic.traininglabvue;
import com.getcapacitor.BridgeActivity;
public class MainActivity extends BridgeActivity {}
|
[
"qudgns9@gmail.com"
] |
qudgns9@gmail.com
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.