blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 4 410 | content_id stringlengths 40 40 | detected_licenses listlengths 0 51 | license_type stringclasses 2 values | repo_name stringlengths 5 132 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringlengths 4 80 | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 689M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 22 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 131 values | src_encoding stringclasses 34 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 3 9.45M | extension stringclasses 32 values | content stringlengths 3 9.45M | authors listlengths 1 1 | author_id stringlengths 0 313 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
759df2e3093299c92d69ef012fe8575b069bfaba | 5be1b993c1e9b3e4cfac947ce054e2f4184e2ff1 | /app/src/androidTest/java/com/example/anggi/anggipriatna_1202150042_modul1/ExampleInstrumentedTest.java | a2fe49d909b8829e38cbc691650b3e06d00a5c63 | [] | no_license | Priatnaanggi/testingAndroidStudio | 453af8e156b4ba8b91f1345b8b7e3b602efa4f97 | 908e1f8b42edb88e68e8aefedd1846c944f501e1 | refs/heads/master | 2021-05-08T16:23:14.615553 | 2018-02-04T12:30:47 | 2018-02-04T12:30:47 | 120,156,143 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 797 | java | package com.example.anggi.anggipriatna_1202150042_modul1;
import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() throws Exception {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();
assertEquals("com.example.anggi.anggipriatna_1202150042_modul1", appContext.getPackageName());
}
}
| [
"anggi.priatna.ap@gmail.com"
] | anggi.priatna.ap@gmail.com |
8bb3233891bcaa4b54612ce57198e023a0ccec7a | 47b6e5d6dfdc738965b8fc09200658a0ad8c3435 | /FortisBankManagement/src/bus/CurrencyAccount.java | 919e8e342744b86083df8e419d5df62f727d93f7 | [] | no_license | DiogoTM/Fortis-Bank-Management | 7d72739ed9dca319983e110a070a79ecf2ab0a9d | 117a6036282cb81a1df642ade4eaff28bafb3fe3 | refs/heads/master | 2020-04-23T21:52:20.382366 | 2019-02-19T14:12:51 | 2019-02-19T14:12:51 | 171,483,198 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 69 | java | package bus;
public class CurrencyAccount extends Account {
}
| [
"noreply@github.com"
] | DiogoTM.noreply@github.com |
e692e260de153f08b5ae2f9a61cd5e587bae27de | a60ca47aa334ea767bf35834e5f831aeefb97a93 | /teacher-api-service/src/main/java/com/example/teacherapiservice/entity/Course.java | 0fd7a2a00524d9ebc53fd5fb22a16145e4d2336e | [] | no_license | lysa-thorn/teacher-management | 36180b839bca47b12129221c04c7ecf8042ef8f6 | 4cd70f8e4d0dbb917678015a282a2dacf6300e20 | refs/heads/master | 2023-06-10T16:45:48.922362 | 2021-07-05T17:14:59 | 2021-07-05T17:14:59 | 382,666,602 | 0 | 0 | null | 2021-07-05T17:14:59 | 2021-07-03T16:52:04 | JavaScript | UTF-8 | Java | false | false | 583 | java | package com.example.teacherapiservice.entity;
import javax.persistence.*;
@Entity
@Table(name = "courses")
public class Course {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(insertable=false, updatable=false, nullable = false)
private Long id;
@Column(unique = true)
private String name;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
| [
"lysa.thorn@gmail.com"
] | lysa.thorn@gmail.com |
3c56c471a1048d57371a950166a7582d109e11d7 | 98c67b4adf20035cfc091981deb70b4468e61712 | /src/main/java/com/yan/li/rpn/utils/RPNUtils.java | c1759b3c0e756a65f644e75044171b2e870fb22b | [
"MIT"
] | permissive | liyanxin2012/yl-rpn | aa99dffc289ba13a6b79f46b6335077ad06fb866 | 154517cff85064a20d40cd844541608af71c3f4f | refs/heads/master | 2021-07-05T14:30:59.814076 | 2019-06-19T12:42:45 | 2019-06-19T12:42:45 | 192,728,579 | 0 | 0 | MIT | 2020-10-13T14:01:15 | 2019-06-19T12:32:40 | Java | UTF-8 | Java | false | false | 2,720 | java | package com.yan.li.rpn.utils;
import com.yan.li.rpn.consts.RPNFunctions;
import com.yan.li.rpn.consts.RPNOperators;
import com.yan.li.rpn.domain.RPNElementNode;
import java.math.BigDecimal;
import java.util.Stack;
/**
* Reverse polish notation utils
*
* @author yan.li
*/
public final class RPNUtils {
/**
* default calculate precision
*/
public static final Integer CLAC_PRECISION = 15;
/**
* default show precision
*/
public static final Integer SHOW_PRECISION = 10;
/**
* String converts to bigdecimal
*
* @param val
* @return
*/
public static BigDecimal strToBig(String val) {
return formatCalcBig(new BigDecimal(val.trim()));
}
/**
* sqrt the amt
*
* @param amt
* @return
*/
public static BigDecimal sqrt(BigDecimal amt) {
return formatCalcBig(new BigDecimal(Math.sqrt(amt.doubleValue())));
}
/**
* format the bigDecimal
*
* @param amt
* @return
*/
public static BigDecimal formatCalcBig(BigDecimal amt) {
return amt.setScale(CLAC_PRECISION, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
}
/**
* format the bigDecimal
*
* @param amt
* @return
*/
public static BigDecimal formatShowBig(BigDecimal amt) {
return amt.setScale(SHOW_PRECISION, BigDecimal.ROUND_HALF_UP).stripTrailingZeros();
}
/**
* Determines if the param is valid
*
* @param param
* @return
*/
private static boolean isValidParam(String param) {
return RPNRegexUtils.isDigital(param) || RPNOperators.isOperator(param) || RPNFunctions.isFunction(param);
}
/**
* Determines if the input params is valid
*
* @param inputParams
* @return
*/
public static boolean isValidInputParams(String inputParams) {
if (inputParams == null || inputParams.trim() == "") {
return false;
}
for (RPNElementNode node : RPNParserUtils.parseInputParams(inputParams)) {
if (isValidParam(node.getValue()) == false) {
return false;
}
}
return true;
}
/**
* Print digital stack
*
* @param digitalStack
* @return
*/
public static String printDigitalStack(Stack<BigDecimal> digitalStack) {
if (digitalStack.empty()) {
return "";
}
StringBuffer sb = new StringBuffer();
for (BigDecimal element : digitalStack) {
sb.append(formatShowBig(element).toPlainString());
sb.append(" ");
}
return sb.toString().trim();
}
private RPNUtils() {
}
}
| [
"yan.li@andpay.me"
] | yan.li@andpay.me |
8626be3835db78253339d51a5c8ff0dea1aa313f | 927432070c54e6c5e301dda2b460a2e2ce8f1d46 | /src/cn/lut/curiezhang/model/Examinee.java | e88e60f1492bbae9e9ae1cd1ee36ead7a983b2d9 | [] | no_license | CurieZhang/cmis | 11f35b8eb396c5908b88068a3c062146cb667b8b | f32d8aeccdd7971665a1f37bcf02ba0f89306441 | refs/heads/master | 2020-07-25T19:53:24.292359 | 2019-10-13T07:32:29 | 2019-10-13T07:32:29 | 208,407,246 | 0 | 0 | null | null | null | null | GB18030 | Java | false | false | 13,873 | java | package cn.lut.curiezhang.model;
import java.util.Date;
import java.util.ResourceBundle;
/**
* SSH框架进行考生管理的持久层的POJO类
* @author curiezhang
*
*/
public class Examinee {
// ksh 考生号
private String examineeId;
// xm 姓名
private String examineeName;
// 照片
private String examineePictureUrl;
// xbdm 性别代码
private String examineeSexId;
@SuppressWarnings("unused")
private String examineeSexIdView;
// xbdm 性别名称
private String examineeSexName;
// csrq 出生日期
private Date examineeBirthday;
// 联系地址
private String examineeAddress;
// 邮政编码
private String examineeZipCode;
// 联系电话
private String examineeContactPhone;
// 移动电话
private String examineeMobilePhone;
// 县区代码
private String examineeCountyDistrictId;
// 县区名称
private String examineeCountyDistrictName;
// zzmmdm 政治面貌代码
private String examineePoliticalStatusId;
// zzmmdm 政治面貌名称
private String examineePoliticalStatusName;
// mzdm 民族代码
private String examineeNationalityId;
// mzdm 民族名称
private String examineeNationalityName;
// kslxdm 考生类型代码
private String examineeExamineeTypeId;
// kslxdm 考生类型名称
private String examineeExamineeTypeName;
// kldm 科类代码 见科类代码表
private String examineeDisciplineId;
// klmc 科类名称 见科类代码表
private String examineeDisciplineName;
// kslbdm 考生类别代码
private String examineeExamineeCategoryId;
// kslbdm 考生类别名称
private String examineeExamineeCategoryName;
// bylbdm 毕业类别代码 省考试院文件里应该有此项
private String examineeGraduationCategoryId;
// Bylbmc 毕业类别名称 普通高中毕业 其他中等专业学校毕业 职业高中毕业 中等师范毕业
private String examineeGraduationCategoryName;
// byxxmc 毕业学校代码
private String examineeGraduationSchoolId;
// byxxmc 毕业学校名称
private String examineeGraduationSchoolName;
// wyyzdm 外语语种代码
private String examineeForeignLanguageId;
// Wyyzmc 外语语种名称
private String examineeForeignLanguageName;
// sfzh 身份证号
private String examineeIdNumber;
// bmddm 报名点代码
private String examineeRegistrationPointId;
// Bmdmc 报名点名称
private String examineeRegistrationPointName;
// 创建人
private String examineeCreator;
// 创建时间
private Date examineeCreatingTime;
// 审核人
private String examineeAuditor;
// 审核时间
private Date examineeAuditingTime;
// 类型 0整个平台 1学生 2院校 3考点 4管理机构
private Byte examineeType;
@SuppressWarnings("unused")
private String examineeTypeView;
// 备注
private String examineeMemo;
// 错误(信息有错误时使用)
private String examineeError;
// 状态 0正常 1确认 2有错误
private Byte examineeStatus;
@SuppressWarnings("unused")
private String examineeStatusView;
// 考生科类
private Discipline discipline;
// 县区代码
private CountyDistrict countyDistrict;
public Examinee() {
}
public Examinee(String examineeId) {
this.examineeId = examineeId;
}
public String getExamineeId() {
return examineeId;
}
public void setExamineeId(String examineeId) {
this.examineeId = examineeId;
}
public String getExamineeName() {
return examineeName;
}
public void setExamineeName(String examineeName) {
this.examineeName = examineeName;
}
public String getExamineePictureUrl() {
return examineePictureUrl;
}
public void setExamineePictureUrl(String examineePictureUrl) {
this.examineePictureUrl = examineePictureUrl;
}
public String getExamineeSexId() {
return examineeSexId;
}
public void setExamineeSexId(String examineeSexId) {
this.examineeSexId = examineeSexId;
}
public String getExamineeSexIdView() {
if (this.examineeSexId == null || this.examineeSexId.trim().length() == 0) {
return ResourceBundle.getBundle("Messages").getString("Application.null");
} else if (this.examineeSexId.trim().equals("1")) {
return ResourceBundle.getBundle("Messages").getString("Examinee.fieldName.examineeSex.1");
} else if (this.examineeSexId.trim().equals("2")) {
return ResourceBundle.getBundle("Messages").getString("Examinee.fieldName.examineeSex.2");
} else {
return ResourceBundle.getBundle("Messages").getString("Examinee.fieldName.examineeSex.others");
}
}
public void setExamineeSexIdView(String examineeSexIdView) {
this.examineeSexIdView = examineeSexIdView;
}
public String getExamineeSexName() {
return examineeSexName;
}
public void setExamineeSexName(String examineeSexName) {
this.examineeSexName = examineeSexName;
}
public Date getExamineeBirthday() {
return examineeBirthday;
}
public void setExamineeBirthday(Date examineeBirthday) {
this.examineeBirthday = examineeBirthday;
}
public String getExamineeAddress() {
return examineeAddress;
}
public void setExamineeAddress(String examineeAddress) {
this.examineeAddress = examineeAddress;
}
public String getExamineeZipCode() {
return examineeZipCode;
}
public void setExamineeZipCode(String examineeZipCode) {
this.examineeZipCode = examineeZipCode;
}
public String getExamineeContactPhone() {
return examineeContactPhone;
}
public void setExamineeContactPhone(String examineeContactPhone) {
this.examineeContactPhone = examineeContactPhone;
}
public String getExamineeMobilePhone() {
return examineeMobilePhone;
}
public void setExamineeMobilePhone(String examineeMobilePhone) {
this.examineeMobilePhone = examineeMobilePhone;
}
public String getExamineeCountyDistrictId() {
return examineeCountyDistrictId;
}
public void setExamineeCountyDistrictId(String examineeCountyDistrictId) {
this.examineeCountyDistrictId = examineeCountyDistrictId;
}
public String getExamineeCountyDistrictName() {
return examineeCountyDistrictName;
}
public void setExamineeCountyDistrictName(String examineeCountyDistrictName) {
this.examineeCountyDistrictName = examineeCountyDistrictName;
}
public String getExamineePoliticalStatusId() {
return examineePoliticalStatusId;
}
public void setExamineePoliticalStatusId(String examineePoliticalStatusId) {
this.examineePoliticalStatusId = examineePoliticalStatusId;
}
public String getExamineePoliticalStatusName() {
return examineePoliticalStatusName;
}
public void setExamineePoliticalStatusName(String examineePoliticalStatusName) {
this.examineePoliticalStatusName = examineePoliticalStatusName;
}
public String getExamineeNationalityId() {
return examineeNationalityId;
}
public void setExamineeNationalityId(String examineeNationalityId) {
this.examineeNationalityId = examineeNationalityId;
}
public String getExamineeNationalityName() {
return examineeNationalityName;
}
public void setExamineeNationalityName(String examineeNationalityName) {
this.examineeNationalityName = examineeNationalityName;
}
public String getExamineeExamineeTypeId() {
return examineeExamineeTypeId;
}
public void setExamineeExamineeTypeId(String examineeExamineeTypeId) {
this.examineeExamineeTypeId = examineeExamineeTypeId;
}
public String getExamineeExamineeTypeName() {
return examineeExamineeTypeName;
}
public void setExamineeExamineeTypeName(String examineeExamineeTypeName) {
this.examineeExamineeTypeName = examineeExamineeTypeName;
}
public Discipline getDiscipline() {
return discipline;
}
public void setDiscipline(Discipline discipline) {
this.discipline = discipline;
}
public String getExamineeDisciplineId() {
return examineeDisciplineId;
}
public void setExamineeDisciplineId(String examineeDisciplineId) {
this.examineeDisciplineId = examineeDisciplineId;
}
public String getExamineeDisciplineName() {
return examineeDisciplineName;
}
public void setExamineeDisciplineName(String examineeDisciplineName) {
this.examineeDisciplineName = examineeDisciplineName;
}
public String getExamineeExamineeCategoryId() {
return examineeExamineeCategoryId;
}
public void setExamineeExamineeCategoryId(String examineeExamineeCategoryId) {
this.examineeExamineeCategoryId = examineeExamineeCategoryId;
}
public String getExamineeExamineeCategoryName() {
return examineeExamineeCategoryName;
}
public void setExamineeExamineeCategoryName(String examineeExamineeCategoryName) {
this.examineeExamineeCategoryName = examineeExamineeCategoryName;
}
public String getExamineeGraduationCategoryId() {
return examineeGraduationCategoryId;
}
public void setExamineeGraduationCategoryId(String examineeGraduationCategoryId) {
this.examineeGraduationCategoryId = examineeGraduationCategoryId;
}
public String getExamineeGraduationCategoryName() {
return examineeGraduationCategoryName;
}
public void setExamineeGraduationCategoryName(String examineeGraduationCategoryName) {
this.examineeGraduationCategoryName = examineeGraduationCategoryName;
}
public String getExamineeGraduationSchoolId() {
return examineeGraduationSchoolId;
}
public void setExamineeGraduationSchoolId(String examineeGraduationSchoolId) {
this.examineeGraduationSchoolId = examineeGraduationSchoolId;
}
public String getExamineeGraduationSchoolName() {
return examineeGraduationSchoolName;
}
public void setExamineeGraduationSchoolName(String examineeGraduationSchoolName) {
this.examineeGraduationSchoolName = examineeGraduationSchoolName;
}
public String getExamineeForeignLanguageId() {
return examineeForeignLanguageId;
}
public void setExamineeForeignLanguageId(String examineeForeignLanguageId) {
this.examineeForeignLanguageId = examineeForeignLanguageId;
}
public String getExamineeForeignLanguageName() {
return examineeForeignLanguageName;
}
public void setExamineeForeignLanguageName(String examineeForeignLanguageName) {
this.examineeForeignLanguageName = examineeForeignLanguageName;
}
public String getExamineeIdNumber() {
return examineeIdNumber;
}
public void setExamineeIdNumber(String examineeIdNumber) {
this.examineeIdNumber = examineeIdNumber;
}
public String getExamineeRegistrationPointId() {
return examineeRegistrationPointId;
}
public void setExamineeRegistrationPointId(String examineeRegistrationPointId) {
this.examineeRegistrationPointId = examineeRegistrationPointId;
}
public String getExamineeRegistrationPointName() {
return examineeRegistrationPointName;
}
public void setExamineeRegistrationPointName(String examineeRegistrationPointName) {
this.examineeRegistrationPointName = examineeRegistrationPointName;
}
public String getExamineeCreator() {
return examineeCreator;
}
public void setExamineeCreator(String examineeCreator) {
this.examineeCreator = examineeCreator;
}
public Date getExamineeCreatingTime() {
return examineeCreatingTime;
}
public void setExamineeCreatingTime(Date examineeCreatingTime) {
this.examineeCreatingTime = examineeCreatingTime;
}
public String getExamineeAuditor() {
return examineeAuditor;
}
public void setExamineeAuditor(String examineeAuditor) {
this.examineeAuditor = examineeAuditor;
}
public Date getExamineeAuditingTime() {
return examineeAuditingTime;
}
public void setExamineeAuditingTime(Date examineeAuditingTime) {
this.examineeAuditingTime = examineeAuditingTime;
}
public Byte getExamineeType() {
return examineeType;
}
public void setExamineeType(Byte examineeType) {
this.examineeType = examineeType;
}
public String getExamineeTypeView() {
if (this.examineeType == null) {
return ResourceBundle.getBundle("Messages").getString("Application.null");
} else if (this.examineeType == 0) {
return ResourceBundle.getBundle("Messages").getString("Application.type.0");
} else if (this.examineeType == 1) {
return ResourceBundle.getBundle("Messages").getString("Application.type.1");
} else if (this.examineeType == 2) {
return ResourceBundle.getBundle("Messages").getString("Application.type.2");
} else if (this.examineeType == 3) {
return ResourceBundle.getBundle("Messages").getString("Application.type.3");
} else if (this.examineeType == 4) {
return ResourceBundle.getBundle("Messages").getString("Application.type.4");
} else {
return ResourceBundle.getBundle("Messages").getString("Application.type.others");
}
}
public void setExamineeTypeView(String examineeTypeView) {
this.examineeTypeView = examineeTypeView;
}
public String getExamineeMemo() {
return examineeMemo;
}
public void setExamineeMemo(String examineeMemo) {
this.examineeMemo = examineeMemo;
}
public String getExamineeError() {
return examineeError;
}
public void setExamineeError(String examineeError) {
this.examineeError = examineeError;
}
public Byte getExamineeStatus() {
return examineeStatus;
}
public void setExamineeStatus(Byte examineeStatus) {
this.examineeStatus = examineeStatus;
}
public String getExamineeStatusView() {
// 添加null判断
if (this.examineeStatus == null) {
return ResourceBundle.getBundle("Messages").getString("Application.null");
} else if (this.examineeStatus == 0) {
return ResourceBundle.getBundle("Messages").getString("Examinee.fieldName.examineeStatus.0");
} else if (this.examineeStatus == 1) {
return ResourceBundle.getBundle("Messages").getString("Examinee.fieldName.examineeStatus.1");
} else {
return ResourceBundle.getBundle("Messages").getString("Examinee.fieldName.examineeStatus.2");
}
}
public void setExamineeStatusView(String examineeStatusView) {
this.examineeStatusView = examineeStatusView;
}
public CountyDistrict getCountyDistrict() {
return countyDistrict;
}
public void setCountyDistrict(CountyDistrict countyDistrict) {
this.countyDistrict = countyDistrict;
}
}
| [
"zhjl@lut.cn"
] | zhjl@lut.cn |
728aff777a580ce77795a41899aba1dda498e572 | 495d80e0db47fa3cf3994f6dc0e51d97eb1531c1 | /Java-Fundamentals/Java-OOP-Advanced/2 Iterators and Comparators/LinkedList Traversal/Main.java | 307fc2c9904ab8f5c818a9a54bea299af70091ba | [] | no_license | VeselinValev/Java-SoftUni-Courses | d37ce5f68ac824d9864d53455da9f7a0e0d8feb9 | afc5b1a61470ed13a3331187c8bc5073361659c1 | refs/heads/master | 2020-04-12T09:58:00.469403 | 2019-01-08T12:10:04 | 2019-01-08T12:10:04 | 162,414,367 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 810 | java | import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
LinkedList<Integer> list = new LinkedList<>();
int n = Integer.parseInt(reader.readLine());
for (int i = 0; i < n; i++){
String[] input = reader.readLine().split(" ");
switch (input[0]){
case "Add": list.add(Integer.parseInt(input[1]));break;
case "Remove": list.remove(Integer.parseInt(input[1]));break;
}
}
System.out.println(list.getSize());
for (Integer item: list){
System.out.print(item + " ");
}
}
} | [
"37142700+VeselinValev@users.noreply.github.com"
] | 37142700+VeselinValev@users.noreply.github.com |
6f3b52ca668cd038da154adf676cca1866c9e0c7 | 8df0553905ff0503e705c29e37a7fe588e7e332d | /hljlivelibrary/src/main/java/com/hunliji/hljlivelibrary/models/LiveSpotMedia.java | cf40b094f686770ae030ee1112ff6445de3ec7d3 | [] | no_license | Catfeeds/myWorkspace | 9cd0af10597af9d28f8d8189ca0245894d270feb | 3c0932e626e72301613334fd19c5432494f198d2 | refs/heads/master | 2020-04-11T12:19:27.141598 | 2018-04-04T08:14:31 | 2018-04-04T08:14:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,495 | java | package com.hunliji.hljlivelibrary.models;
import android.os.Parcel;
import android.os.Parcelable;
import com.hunliji.hljcommonlibrary.models.Media;
import com.hunliji.hljcommonlibrary.models.note.NoteSpot;
import java.util.List;
/**
* Created by luohanlin on 2017/11/30.
*/
public class LiveSpotMedia implements Parcelable {
private Media media;
private List<NoteSpot> spots;
public LiveSpotMedia(Media media) {
this.media = media;
}
public LiveSpotMedia(
Media media, List<NoteSpot> spots) {
this.media = media;
this.spots = spots;
}
public Media getMedia() {
return media;
}
public List<NoteSpot> getSpots() {
return spots;
}
@Override
public int describeContents() { return 0; }
@Override
public void writeToParcel(Parcel dest, int flags) {
dest.writeParcelable(this.media, flags);
dest.writeTypedList(this.spots);
}
protected LiveSpotMedia(Parcel in) {
this.media = in.readParcelable(Media.class.getClassLoader());
this.spots = in.createTypedArrayList(NoteSpot.CREATOR);
}
public static final Parcelable.Creator<LiveSpotMedia> CREATOR = new Parcelable
.Creator<LiveSpotMedia>() {
@Override
public LiveSpotMedia createFromParcel(Parcel source) {return new LiveSpotMedia(source);}
@Override
public LiveSpotMedia[] newArray(int size) {return new LiveSpotMedia[size];}
};
}
| [
"hdwhhc@sina.cn"
] | hdwhhc@sina.cn |
a731d178fe3f90ec850f2ec5ef493f835883e108 | 3d37600536a0388be0531e1b4c5d7b5633ccd935 | /gateway/src/test/java/org/isolution/nexus/test/support/EndpointBuilder.java | 5e4ea1df8518873175c9323aea3a63ca39e91236 | [] | no_license | alexwibowo/nexus | 5234654a69b7592b60a767cc5e0680faa5f309d8 | 20bd4986d983743ce057c03de06749e4f028b509 | refs/heads/master | 2020-04-01T16:51:52.696637 | 2013-12-18T07:34:53 | 2013-12-18T07:34:53 | 1,091,514 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 900 | java | package org.isolution.nexus.test.support;
import org.isolution.nexus.domain.Endpoint;
import org.isolution.nexus.domain.EndpointProtocol;
import org.isolution.nexus.domain.Status;
/**
* User: Alex Wibowo
* Date: 24/08/11
* Time: 11:11 PM
*/
public class EndpointBuilder extends AbstractNexusModelBuilder<Endpoint>{
public EndpointBuilder() {
withEndpointProtocol(EndpointProtocol.HTTP)
.withStatus(Status.ACTIVE);
}
@Override
protected Endpoint createNew() {
return new Endpoint();
}
public EndpointBuilder withUri(String value) {
put("uri", value);
return this;
}
public EndpointBuilder withEndpointProtocol(EndpointProtocol value) {
put("protocol", value);
return this;
}
public EndpointBuilder withStatus(Status value) {
put("status", value);
return this;
}
}
| [
"alexwibowo@gmail.com"
] | alexwibowo@gmail.com |
282a92d1865be0104615e2b35b8bbf1881b4150e | ff7e107a5068b07436342353dbf912d587c3840b | /resflow-master0925/resflow-intf/src/main/java/com/zres/project/localnet/portal/webservice/res/BusinessRenameServiceIntf.java | 74ab7658d10d071b730c0d89362feb3f1a4fef53 | [] | no_license | lichao20000/resflow-master | 0f0668c7a6cb03cafaca153b9e9b882b2891b212 | 78217aa31f17dd5c53189e695a3a0194fced0d0a | refs/heads/master | 2023-01-27T19:15:40.752341 | 2020-12-10T02:07:32 | 2020-12-10T02:07:32 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 319 | java | package com.zres.project.localnet.portal.webservice.res;
import java.util.Map;
/**
* @ClassName BusinessRenameServiceIntf
* @Description TODO
* @Author wang.g2
* @Date 2020/8/11 11:44
*/
public interface BusinessRenameServiceIntf {
public Map<String, Object> custInfoRename(Map<String, Object> custInfo);
}
| [
"2832383563@qq.com"
] | 2832383563@qq.com |
393c683bdf990314f295beb6a40761628702d3d6 | 300321c5c3abfa3b1a351cb84a196ae9bcf3ceff | /src/main/java/model/Requerimiento_5.java | 5c72c680a99642465c8bd160aa55e92a77b83609 | [] | no_license | ju4nr3v0l/reto4_ciclo2 | eaa832609efc379784ea48d9c5508f45f114a034 | 71e02b1c901d61cf11a94427ff180cff496419db | refs/heads/master | 2023-07-07T21:01:21.366194 | 2021-08-11T14:08:23 | 2021-08-11T14:08:23 | 395,010,905 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 676 | java | package model;
public class Requerimiento_5 {
private String constructora;
private Integer salarioLider;
public Requerimiento_5(){
}
public Requerimiento_5(String constructora, Integer salarioLider) {
this.constructora = constructora;
this.salarioLider = salarioLider;
}
public String getConstructora() {
return constructora;
}
public void setConstructora(String constructora) {
this.constructora = constructora;
}
public Integer getSalarioLider() {
return salarioLider;
}
public void setSalarioLider(Integer salarioLider) {
this.salarioLider = salarioLider;
}
}
| [
"juanmarulanda144490@correo.itm.edu.co"
] | juanmarulanda144490@correo.itm.edu.co |
3b64722d3ad7b0598b7b0ed2b4cc229a8a4adba9 | 56f359335428f0f2a92cb8aa483960cb81b29acf | /service/service-vod/src/test/java/test.java | 2a8e17606c93e3d0f6b22f646d6b8cbd74f09b58 | [] | no_license | handsomeZZD/guli_college | b99fa714a8a1c527d6c878eab6a82a47daa776ad | 09db3021259a40c6de6ba957b1960fa46cc5ec43 | refs/heads/master | 2023-01-03T02:23:39.654491 | 2020-10-29T04:42:20 | 2020-10-29T04:42:20 | 292,276,670 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 285 | java | import com.zzd.utils.VodConstant;
/**
* @Author ZZD
* @Date 2020/9/19 23:16
* @Email 1396896729@qq.com
* @description
*/
public class test {
public static void main(String[] args) {
System.out.println(VodConstant.ACCESS_KEY_ID+VodConstant.ACCESS_KEY_SECRET);
}
}
| [
"1396896729@qq.com"
] | 1396896729@qq.com |
9d3d7451d12175fadd363ecc61dc093dcbae3ddc | 9183a43eb548308ba62b220fd141f993d1eee8a1 | /src/main/java/controlador/Logica.java | 12ffbd831494aa210bf24b6b7189e8f485720ecc | [] | no_license | arobld00/masterman | 7db6fd393f6dce94db033334b2f0f43be460981f | e55d38028bf6eef558781601aa9e9ac2c5b44d92 | refs/heads/master | 2022-02-24T19:43:58.564004 | 2019-08-31T16:14:07 | 2019-08-31T16:14:07 | 200,369,408 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 458 | java | package controlador;
import java.util.HashMap;
import java.util.Map;
import modelo.Sesion;
import modelo.EstadoEnum;
public abstract class Logica {
protected Sesion sesion;
protected Map<EstadoEnum, AceptadorControlador> controladores;
protected Logica() {
this.controladores = new HashMap<EstadoEnum, AceptadorControlador>();
}
public AceptadorControlador getControlador() {
return this.controladores.get(this.sesion.getEstado());
}
}
| [
"arobld00@gmail.com"
] | arobld00@gmail.com |
017891448ec1555431d3cb7b8c937776f5c8764e | 276b714e0a6d4c5bd5ba1e94d4b2ca5b91528e9e | /src/com/capgemini/bankapp/service/BankAccountService.java | 51c3d8ff9b2b27afa1732681b564687c385afe26 | [] | no_license | Anushamandapati/BankApp | 7ca367a3ec1928eecb00b3ae72af2761a51e4ae8 | 6fa21ba0cb864e3c5b0cadfded5c4270c0d016e5 | refs/heads/master | 2020-03-28T21:09:32.080965 | 2018-09-26T12:05:12 | 2018-09-26T12:05:12 | 149,133,661 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 315 | java | package com.capgemini.bankapp.service;
public interface BankAccountService
{
public double getBalance(long accountId);
public double withdraw(long accountId, double amount);
public double deposit(long accountId, double amount);
public boolean fundTransfer(long fromAcc, long toAcc, double amount);
}
| [
"amandapa@IN-MUM-LDVM032.corp.capgemini.com"
] | amandapa@IN-MUM-LDVM032.corp.capgemini.com |
e7b374b5e427efd48c3184e24dcec4650bce0911 | 0fd9e6a1a77f987682ed450861702acc4ca59eb0 | /src/botting/bot/manager/impl/PrayerManager.java | 3d865128599757fe0367c2a5b1e502dc4ed647c0 | [] | no_license | YouriDudock/Runescape-Reflection-Bot | 38b8173431b44768aebbebb951872a3e8787c6df | 04ca10fa658159f77ac287039384e8406bb0fbd4 | refs/heads/master | 2022-11-29T16:50:03.335695 | 2020-08-15T15:07:03 | 2020-08-15T15:07:03 | 287,764,317 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,349 | java | package botting.bot.manager.impl;
import botting.bot.BotInstance;
import botting.bot.debug.DebugPriority;
import botting.bot.manager.Manager;
import botting.game.data.GamePrayer;
import botting.game.data.GameSkill;
import botting.game.data.GameTab;
import botting.rs.client.clients.ikov.Ikov;
import static java.lang.Thread.sleep;
/**
* @author Youri Dudock
*/
public class PrayerManager extends Manager {
public PrayerManager(BotInstance bot) {
super(bot);
}
public int getPrayerPoints() {
return bot.getAccessors().getClient().getStats()[Ikov.Game.Skills.PRAYER.getID()];
}
public void enablePrayer(GamePrayer prayer) {
try {
getManagers().getHud().openTab(Ikov.Game.Tabs.PRAYER);
sleep(500);
getManagers().getMouse().click(prayer.getPoint());
debug("Clicked prayer:" + prayer.toString(), DebugPriority.HIGH);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
// @TODO actual prayer check? lol
public boolean hasPrayerOn() {
try {
int prayerPoints = getPrayerPoints();
sleep(2000);
return getPrayerPoints() != prayerPoints;
} catch (InterruptedException e) {
e.printStackTrace();
}
return false;
}
}
| [
"Youridudock@gmail.com"
] | Youridudock@gmail.com |
ec99852dd6f972bfc631d0dd40485cd302b7004d | 37f6a7b84075f2f1e371747ed33ea49c0d267ead | /src/main/java/org/fbi/lrb/margin/repository/dao/LrbMargActMapper.java | cd62dbb145796ed12df344f1bdf9f662473a45aa | [] | no_license | liveqmock/lnkapp-lrb-margin | 4b0e7ad9031e283769fa94ad3ca83a464fe756a4 | a69a7606a0cee5bb0c6db1d9ac52dc3fa3c7f034 | refs/heads/master | 2022-08-06T09:43:32.567987 | 2015-03-01T07:20:37 | 2015-03-01T07:20:37 | 35,888,770 | 0 | 1 | null | 2022-07-29T07:17:01 | 2015-05-19T14:52:01 | Java | UTF-8 | Java | false | false | 3,184 | java | package org.fbi.lrb.margin.repository.dao;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.fbi.lrb.margin.repository.model.LrbMargAct;
import org.fbi.lrb.margin.repository.model.LrbMargActExample;
import org.fbi.lrb.margin.repository.model.LrbMargActKey;
public interface LrbMargActMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table LNK.LRB_MARG_ACT
*
* @mbggenerated Tue Nov 11 18:16:54 CST 2014
*/
int countByExample(LrbMargActExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table LNK.LRB_MARG_ACT
*
* @mbggenerated Tue Nov 11 18:16:54 CST 2014
*/
int deleteByExample(LrbMargActExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table LNK.LRB_MARG_ACT
*
* @mbggenerated Tue Nov 11 18:16:54 CST 2014
*/
int deleteByPrimaryKey(LrbMargActKey key);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table LNK.LRB_MARG_ACT
*
* @mbggenerated Tue Nov 11 18:16:54 CST 2014
*/
int insert(LrbMargAct record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table LNK.LRB_MARG_ACT
*
* @mbggenerated Tue Nov 11 18:16:54 CST 2014
*/
int insertSelective(LrbMargAct record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table LNK.LRB_MARG_ACT
*
* @mbggenerated Tue Nov 11 18:16:54 CST 2014
*/
List<LrbMargAct> selectByExample(LrbMargActExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table LNK.LRB_MARG_ACT
*
* @mbggenerated Tue Nov 11 18:16:54 CST 2014
*/
LrbMargAct selectByPrimaryKey(LrbMargActKey key);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table LNK.LRB_MARG_ACT
*
* @mbggenerated Tue Nov 11 18:16:54 CST 2014
*/
int updateByExampleSelective(@Param("record") LrbMargAct record, @Param("example") LrbMargActExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table LNK.LRB_MARG_ACT
*
* @mbggenerated Tue Nov 11 18:16:54 CST 2014
*/
int updateByExample(@Param("record") LrbMargAct record, @Param("example") LrbMargActExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table LNK.LRB_MARG_ACT
*
* @mbggenerated Tue Nov 11 18:16:54 CST 2014
*/
int updateByPrimaryKeySelective(LrbMargAct record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table LNK.LRB_MARG_ACT
*
* @mbggenerated Tue Nov 11 18:16:54 CST 2014
*/
int updateByPrimaryKey(LrbMargAct record);
} | [
"zhanrui@gmail.com"
] | zhanrui@gmail.com |
98ad3379771bef04c5b3052de4710ed9b1b6bf71 | f0591201f9e05a43ae063ec0f3f4b4915e2e4a59 | /project-sysmgr-ui/src/main/java/com/spirit/project/sysmgr/ui/client/RoleFeignClient.java | 059edfdacbe19c7f1510e70fbfaeffd9f16dec1f | [] | no_license | dante7qx/microservice-spirit | d7867237eb499bc4c5b83ad12650aaf658ea72f4 | e6a2cd52ac44c12ea6d983430a801a3db43c0e8f | refs/heads/master | 2021-01-22T22:20:39.295929 | 2017-08-08T02:03:56 | 2017-08-08T02:03:56 | 85,531,358 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,994 | java | package com.spirit.project.sysmgr.ui.client;
import java.util.List;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.spirit.feignconfig.FeignClientConfig;
import com.spirit.project.commom.dto.req.PageReq;
import com.spirit.project.commom.dto.resp.BaseResp;
import com.spirit.project.commom.dto.resp.PageResp;
import com.spirit.project.sysmgr.ui.client.fallback.RoleFeignClientFallback;
import com.spirit.project.sysmgr.ui.constant.SpiritServiceConsts;
import com.spirit.project.sysmgr.ui.vo.role.AuthorityRoleVO;
import com.spirit.project.sysmgr.ui.vo.role.RoleVO;
/**
* 角色Feign Client
*
* @author dante
*
*/
@FeignClient(name = SpiritServiceConsts.PROJECT_SYSMGR_SERVER_NAME, fallback = RoleFeignClientFallback.class, configuration=FeignClientConfig.class)
public interface RoleFeignClient {
@RequestMapping(method = RequestMethod.POST, value = "/role/query_page")
BaseResp<PageResp<RoleVO>> findPage(PageReq pageReq);
@RequestMapping(method = RequestMethod.POST, value = "/role/query_by_id/{id}")
BaseResp<RoleVO> findByRoleId(@PathVariable("id") Long id);
@RequestMapping(method = RequestMethod.POST, value = "/role/query_all_role")
BaseResp<List<RoleVO>> findAllRole();
@RequestMapping(method = RequestMethod.POST, value = "/role/query_authority_role_by_id/{id}")
BaseResp<List<AuthorityRoleVO>> findAuthorityRoleByRoleId(@PathVariable("id") Long id);
@RequestMapping(method = RequestMethod.POST, value = "/role/add")
BaseResp<RoleVO> addRole(RoleVO roleVO);
@RequestMapping(method = RequestMethod.POST, value = "/role/update")
BaseResp<RoleVO> updateRole(RoleVO roleVO);
@SuppressWarnings("rawtypes")
@RequestMapping(method = RequestMethod.DELETE, value = "/role/delete_by_id/{id}")
BaseResp deleteByRoleId(@PathVariable("id") Long id);
}
| [
"sunchao.0129@163.com"
] | sunchao.0129@163.com |
c83652ad4c4f1d2de186aac776bbf490dd2ec8e7 | bedefc6d80c8e4f9c51d9198f123aad546622972 | /Leetcode/src/main/java/Leetcode/Leetcode_101_IsSymmetric.java | 131509850d9c5b188d6e09c079ac43271080287f | [] | no_license | ouyangnengda/AL | 2a2e72cb6e30436993a50fff09e08f988a21f1ae | d7469f1aafc9bce6cc37d6f6e32811373ca05295 | refs/heads/master | 2020-07-16T22:03:56.740037 | 2019-10-10T11:51:55 | 2019-10-10T11:51:55 | 205,693,057 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,568 | java | package Leetcode;
import java.util.LinkedList;
import java.util.List;
import java.util.Queue;
/**
* @Description: 判断是否为对称二叉树
* @Author: 欧阳能达
* @Created: 2019年09月21日 22:05:00
**/
public class Leetcode_101_IsSymmetric {
public static void main(String[] args) {
pro();
}
public static void pro() {
}
public static void test() {
}
public boolean isSymmetric(TreeNode root) {
TreeNode treeNode = root;
if (root == null) {
return false;
}
List<TreeNode> queue = new LinkedList<>();
queue.add(treeNode);
while (!queue.isEmpty()) {
//首先判断queue里面的元素是否符合对称,符合则进行下一步,否则直接返回false;
if (queueIsSy(queue)) {
int size = queue.size();
while (size > 0) {
TreeNode temp = queue.remove(size);
queue.add(temp.left);
queue.add(temp.right);
size = size - 1;
}
} else {
return false;
}
}
return true;
}
private boolean queueIsSy(List<TreeNode> queue) {
if (queue == null) {
return false;
}
int i = 0;
while (queue.remove(i).val == queue.remove(queue.size() - 1 - i).val) {
if (i >= (queue.size() / 2 - 1)) {
return true;
}
i = i + 1;
}
return false;
}
}
| [
"42287049+ouyangnengda@users.noreply.github.com"
] | 42287049+ouyangnengda@users.noreply.github.com |
df7a17c783dc5e9108dd8532cc1220b7c2e37ff7 | 1893371d3d83a0716578cc1eeaf8fa04249793cb | /src/com/hl/controller/log/findLogByDateController.java | e7f85d47005b7dfde13b6fdfdb3c82005afafe9f | [] | no_license | mocker1024/LogSystem | 9a8c3f93af060194d1f3ea4b17b927d26408951d | c7762083926eb88dc88f68a127320793c17f4ba4 | refs/heads/master | 2020-05-09T18:07:55.032802 | 2019-05-20T05:22:06 | 2019-05-20T05:22:06 | 181,328,306 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,852 | java | package com.hl.controller.log;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;
import com.hl.common.AppResult;
import com.hl.dao.LogDao;
import com.hl.entity.Log;
/**
* Servlet implementation class findLogByDateController
*/
public class findLogByDateController extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
findLogByDate(request, response);
}
public void findLogByDate(HttpServletRequest request, HttpServletResponse response) throws IOException {
request.setCharacterEncoding("utf-8");
String uname = request.getParameter("uname");
String date = request.getParameter("date");
LogDao logDao = new LogDao();
AppResult aResult = null;
Log log = null;
try {
log = logDao.findLogBydate(uname, date);
if(log==null || log.getLog_context()==null) {
aResult = new AppResult(201, date+"没有日志", null);
throw new RuntimeException();
}
aResult = new AppResult(200, "找到"+date+"日志", log);
} catch (Exception e) {
e.printStackTrace();
}
response.setCharacterEncoding("utf-8");
response.setContentType("text/json");
response.getWriter().println(JSON.toJSONString(aResult));
response.getWriter().flush();
}
}
| [
"1015314146@qq.com"
] | 1015314146@qq.com |
c2d8d76a1d7b64a2d68b5161637d6d5a922c97c5 | 5b50424fd1a8a1ca91f680f8c47e3f8f04758679 | /usecase1/src/main/java/com/example/demo/controller/EmpController.java | bca950c9bd531fe5ac66d3c3fed13eaa2c1f0831 | [] | no_license | Gopaltiramsetti/gopal | 9a48d5d92e0d67420bc58ec4f76320d8591dc97b | e8d61a8968ddd1f57208c84eff51bbe04943e7c7 | refs/heads/master | 2022-12-23T10:05:30.833799 | 2020-03-11T12:52:52 | 2020-03-11T12:52:52 | 173,540,595 | 0 | 0 | null | 2022-12-16T08:15:56 | 2019-03-03T06:41:47 | Java | UTF-8 | Java | false | false | 220 | java | package com.example.demo.controller;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class EmpController {
@RequestMapping(value = "/", method = RequestMethod.GET)
}
| [
"admin@1A-1"
] | admin@1A-1 |
3bec6345b6c6962d8864ede0dd493c1266936361 | 81b0bb3cfb2e9501f53451e7f03ec072ee2b0e13 | /src/com/google/android/gms/internal/zzki.java | bd7f14fb913cd7aa14daa402d11d4a2916a721dd | [] | no_license | reverseengineeringer/me.lyft.android | 48bb85e8693ce4dab50185424d2ec51debf5c243 | 8c26caeeb54ffbde0711d3ce8b187480d84968ef | refs/heads/master | 2021-01-19T02:32:03.752176 | 2016-07-19T16:30:00 | 2016-07-19T16:30:00 | 63,710,356 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 673 | java | package com.google.android.gms.internal;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import com.google.android.gms.ads.internal.zzu;
@zzir
public class zzki
extends Handler
{
public zzki(Looper paramLooper)
{
super(paramLooper);
}
public void handleMessage(Message paramMessage)
{
try
{
super.handleMessage(paramMessage);
return;
}
catch (Exception paramMessage)
{
zzu.zzft().zzb(paramMessage, false);
throw paramMessage;
}
}
}
/* Location:
* Qualified Name: com.google.android.gms.internal.zzki
* Java Class Version: 6 (50.0)
* JD-Core Version: 0.7.1
*/ | [
"reverseengineeringer@hackeradmin.com"
] | reverseengineeringer@hackeradmin.com |
4e0cf6acc0422d972bfaa62436312725ade993c8 | 71c826ffa53ac8af9760f4443ba0dc0d78b4a8e9 | /src/main/java/oasis/names/specification/ubl/schema/xsd/commonaggregatecomponents_2/UnstructuredPriceType.java | bcd002fd0883c18fde26829269d88299aa435426 | [] | no_license | yosmellopez/xml-dependencies | 5fc4df3b40ea9af6d6815d64a55aa02cbbe2fb45 | ad2404c11ae9982e9500692f2173261b2f258796 | refs/heads/master | 2022-09-25T15:03:45.927106 | 2020-05-27T03:20:13 | 2020-05-27T03:20:13 | 267,195,324 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,876 | java | //
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.2-147
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2017.04.19 at 09:27:25 AM COT
//
package oasis.names.specification.ubl.schema.xsd.commonaggregatecomponents_2;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.PriceAmountQuantityType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_2.TimeAmountQuantityType;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>ABIE</ccts:ComponentType><ccts:DictionaryEntryName>Unstructured Price. Details</ccts:DictionaryEntryName><ccts:Definition>This class is a alternative to the class Price, and it contain a Tele line</ccts:Definition><ccts:ObjectClass>Unstructured Price</ccts:ObjectClass>
* </ccts:Component>
* </pre>
*
*
*
* <p>Java class for UnstructuredPriceType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="UnstructuredPriceType">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}PriceAmountQuantity" minOccurs="0"/>
* <element ref="{urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2}TimeAmountQuantity" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UnstructuredPriceType", propOrder = {
"priceAmountQuantity",
"timeAmountQuantity"
})
public class UnstructuredPriceType {
@XmlElement(name = "PriceAmountQuantity", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected PriceAmountQuantityType priceAmountQuantity;
@XmlElement(name = "TimeAmountQuantity", namespace = "urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2")
protected TimeAmountQuantityType timeAmountQuantity;
/**
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Unstructured Price. Price_ Amount. Quantity</ccts:DictionaryEntryName><ccts:Definition>Statement for the price amount</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Unstructured Price</ccts:ObjectClass><ccts:PropertyTermQualifier>Price</ccts:PropertyTermQualifier><ccts:PropertyTerm>Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Quantity</ccts:RepresentationTerm><ccts:DataType>Quantity. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
* @return possible object is
* {@link PriceAmountQuantityType }
*/
public PriceAmountQuantityType getPriceAmountQuantity() {
return priceAmountQuantity;
}
/**
* Sets the value of the priceAmountQuantity property.
*
* @param value allowed object is
* {@link PriceAmountQuantityType }
*/
public void setPriceAmountQuantity(PriceAmountQuantityType value) {
this.priceAmountQuantity = value;
}
/**
* <pre>
* <?xml version="1.0" encoding="UTF-8"?><ccts:Component xmlns:ccts="urn:un:unece:uncefact:documentation:2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><ccts:ComponentType>BBIE</ccts:ComponentType><ccts:DictionaryEntryName>Unstructured Price. Time_ Amount. Quantity</ccts:DictionaryEntryName><ccts:Definition>Statement for the time amount</ccts:Definition><ccts:Cardinality>0..1</ccts:Cardinality><ccts:ObjectClass>Unstructured Price</ccts:ObjectClass><ccts:PropertyTermQualifier>Time</ccts:PropertyTermQualifier><ccts:PropertyTerm>Amount</ccts:PropertyTerm><ccts:RepresentationTerm>Quantity</ccts:RepresentationTerm><ccts:DataType>Quantity. Type</ccts:DataType>
* </ccts:Component>
* </pre>
*
* @return possible object is
* {@link TimeAmountQuantityType }
*/
public TimeAmountQuantityType getTimeAmountQuantity() {
return timeAmountQuantity;
}
/**
* Sets the value of the timeAmountQuantity property.
*
* @param value allowed object is
* {@link TimeAmountQuantityType }
*/
public void setTimeAmountQuantity(TimeAmountQuantityType value) {
this.timeAmountQuantity = value;
}
}
| [
"yosmellopez@gmail.com"
] | yosmellopez@gmail.com |
a599468612750ad3bd214b2336830342791a5631 | 70b0b8e282a3ca02d8d7e014e0e16c4023a42e3e | /spring_blog2/src/main/java/spring/model/team/TeamDAO_old.java | d94ead7dcf4cb807912b2f9d4a5082870469f1d2 | [] | no_license | HwangSeungJu/blog | 9fde9ca2b0dfbcc79823c2d71064466540807673 | 65fb023228ecf1d2313b9b2eb4b06d06c7a6ba82 | refs/heads/master | 2021-01-19T01:45:37.105522 | 2017-03-09T04:12:42 | 2017-03-09T04:12:42 | 84,395,573 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,498 | java | package spring.model.team;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.springframework.stereotype.Repository;
import spring.utility.blog.DBClose;
import spring.utility.blog.DBOpen;
@Repository
public class TeamDAO_old {
public boolean updateFile(Map map){
boolean flag = false;
Connection con = DBOpen.open();
PreparedStatement pstmt = null;
String filename = (String)map.get("filename");
int no = (Integer)map.get("no");
StringBuffer sql = new StringBuffer();
sql.append(" update team ");
sql.append(" set filename = ? ");
sql.append(" where no = ? ");
try {
pstmt = con.prepareStatement(sql.toString());
pstmt.setString(1,filename );
pstmt.setInt(2,no );
int cnt = pstmt.executeUpdate();
if(cnt>0)flag =true;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally{
DBClose.close(con, pstmt);
}
return flag;
}
public int total(String col, String word){
int total=0;
Connection con = DBOpen.open();
PreparedStatement pstmt = null;
ResultSet rs = null;
StringBuffer sql = new StringBuffer();
sql.append(" select count(*) ");
sql.append(" from team ");
if(word.trim().length()>0)
sql.append(" where "+col+" like '%'||?||'%' ");
try {
pstmt = con.prepareStatement(sql.toString());
if(word.trim().length()>0)
pstmt.setString(1, word);
rs = pstmt.executeQuery();
if(rs.next()){
total = rs.getInt(1);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally{
DBClose.close(con, pstmt, rs);
}
return total;
}
public boolean delete(int no){
boolean flag = false;
Connection con = DBOpen.open();
PreparedStatement pstmt = null;
StringBuffer sql = new StringBuffer();
sql.append(" delete from team ");
sql.append(" where no = ? ");
try {
pstmt = con.prepareStatement(sql.toString());
pstmt.setInt(1, no);
int cnt = pstmt.executeUpdate();
if(cnt>0)flag=true;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally{
DBClose.close(con, pstmt);
}
return flag;
}
public boolean update(TeamDTO dto){
boolean flag = false;
Connection con = DBOpen.open();
PreparedStatement pstmt = null;
StringBuffer sql = new StringBuffer();
sql.append(" update TEAM ");
sql.append(" set ");
sql.append(" phone = ?, ");
sql.append(" zipcode = ?, ");
sql.append(" address1 = ?, ");
sql.append(" address2 = ?, ");
sql.append(" skill = ?, ");
sql.append(" hobby = ? ");
if(dto.getFilename().trim().length()>0)
sql.append(" ,filename = ? ");
sql.append(" where no = ? ");
try {
int i=0;
pstmt = con.prepareStatement(sql.toString());
pstmt.setString(++i, dto.getPhone());
pstmt.setString(++i, dto.getZipcode());
pstmt.setString(++i, dto.getAddress1());
pstmt.setString(++i, dto.getAddress2());
pstmt.setString(++i, dto.getSkillstr());
pstmt.setString(++i, dto.getHobby());
if(dto.getFilename().trim().length()>0)
pstmt.setString(++i, dto.getFilename());
pstmt.setInt(++i, dto.getNo());
int cnt = pstmt.executeUpdate();
if(cnt>0)flag =true;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally{
DBClose.close(con, pstmt);
}
return flag;
}
public TeamDTO read(int no){
TeamDTO dto = null;
Connection con = DBOpen.open();
PreparedStatement pstmt = null;
ResultSet rs = null;
StringBuffer sql = new StringBuffer();
sql.append(" select * from team ");
sql.append(" where no = ? ");
try {
pstmt = con.prepareStatement(sql.toString());
pstmt.setInt(1, no);
rs = pstmt.executeQuery();
if(rs.next()){
dto = new TeamDTO();
dto.setNo(rs.getInt("no"));
dto.setName(rs.getString("name"));
dto.setPhone(rs.getString("phone"));
dto.setZipcode(rs.getString("zipcode"));
dto.setAddress1(rs.getString("address1"));
dto.setAddress2(rs.getString("address2"));
dto.setSkillstr(rs.getString("skill"));
dto.setHobby(rs.getString("hobby"));
dto.setGender(rs.getString("gender"));
dto.setFilename(rs.getString("filename"));
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally{
DBClose.close(con, pstmt, rs);
}
return dto;
}
public boolean create(TeamDTO dto){
boolean flag = false;
Connection con = DBOpen.open();
PreparedStatement pstmt = null;
StringBuffer sql = new StringBuffer();
sql.append(" insert into TEAM ");
sql.append(" (no,name,gender,phone,zipcode,address1, ");
sql.append(" address2,skill,hobby,filename) ");
sql.append(" values ");
sql.append(" ((select nvl(max(no),0)+1 from team), ");
sql.append(" ?,?,?,?,?,?,?,?,?) ");
try {
pstmt = con.prepareStatement(sql.toString());
pstmt.setString(1, dto.getName());
pstmt.setString(2, dto.getGender());
pstmt.setString(3, dto.getPhone());
pstmt.setString(4, dto.getZipcode());
pstmt.setString(5, dto.getAddress1());
pstmt.setString(6, dto.getAddress2());
pstmt.setString(7, dto.getSkillstr());
pstmt.setString(8, dto.getHobby());
pstmt.setString(9, dto.getFilename());
int cnt = pstmt.executeUpdate();
if(cnt>0) flag = true;
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally{
DBClose.close(con, pstmt);
}
return flag;
}
public List<TeamDTO> list(Map map){
List<TeamDTO> list = new ArrayList<TeamDTO>();
Connection con = DBOpen.open();
PreparedStatement pstmt = null;
ResultSet rs = null;
String col = (String)map.get("col");
String word = (String)map.get("word");
int sno = (Integer)map.get("sno");
int eno = (Integer)map.get("eno");
StringBuffer sql = new StringBuffer();
sql.append(" select no, name, phone, skill,filename, r ");
sql.append(" from( ");
sql.append(" select no, name, phone, skill,filename, ");
sql.append(" rownum r ");
sql.append(" from( ");
sql.append(" select no, name, phone, skill, ");
sql.append(" filename from team ");
if(word.trim().length()>0)
sql.append(" where "+col+" like '%'||?||'%' ");
sql.append(" order by no desc ");
sql.append(" ) ");
sql.append(" )where r>= ? and r<=? ");
try {
pstmt = con.prepareStatement(sql.toString());
int i=1;
if(word.trim().length()>0)
pstmt.setString(i++, word);
pstmt.setInt(i++, sno);
pstmt.setInt(i++, eno);
rs = pstmt.executeQuery();
while(rs.next()){
TeamDTO dto = new TeamDTO();
dto.setNo(rs.getInt("no"));
dto.setName(rs.getString("name"));
dto.setPhone(rs.getString("phone"));
dto.setSkillstr(rs.getString("skill"));
dto.setFilename(rs.getString("filename"));
list.add(dto);
}
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} finally{
DBClose.close(con, pstmt, rs);
}
return list;
}
}
| [
"soldesk@s13"
] | soldesk@s13 |
d95d93cf639beca55c28cac32d72868010205fed | ef0c1514e9af6de3ba4a20e0d01de7cc3a915188 | /sdk/edgeorder/azure-resourcemanager-edgeorder/src/main/java/com/azure/resourcemanager/edgeorder/fluent/models/AddressUpdateProperties.java | c0ec7ac26b2a00cdf0436e3ec0f25ccb7e180e35 | [
"MIT",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-or-later",
"CC0-1.0",
"BSD-3-Clause",
"UPL-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause",
"LicenseRef-scancode-generic-cla"
] | permissive | Azure/azure-sdk-for-java | 0902d584b42d3654b4ce65b1dad8409f18ddf4bc | 789bdc6c065dc44ce9b8b630e2f2e5896b2a7616 | refs/heads/main | 2023-09-04T09:36:35.821969 | 2023-09-02T01:53:56 | 2023-09-02T01:53:56 | 2,928,948 | 2,027 | 2,084 | MIT | 2023-09-14T21:37:15 | 2011-12-06T23:33:56 | Java | UTF-8 | Java | false | false | 2,588 | java | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.
package com.azure.resourcemanager.edgeorder.fluent.models;
import com.azure.core.annotation.Fluent;
import com.azure.core.util.logging.ClientLogger;
import com.azure.resourcemanager.edgeorder.models.ContactDetails;
import com.azure.resourcemanager.edgeorder.models.ShippingAddress;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
/** Address Properties. */
@Fluent
public final class AddressUpdateProperties {
@JsonIgnore private final ClientLogger logger = new ClientLogger(AddressUpdateProperties.class);
/*
* Shipping details for the address
*/
@JsonProperty(value = "shippingAddress")
private ShippingAddress shippingAddress;
/*
* Contact details for the address
*/
@JsonProperty(value = "contactDetails")
private ContactDetails contactDetails;
/**
* Get the shippingAddress property: Shipping details for the address.
*
* @return the shippingAddress value.
*/
public ShippingAddress shippingAddress() {
return this.shippingAddress;
}
/**
* Set the shippingAddress property: Shipping details for the address.
*
* @param shippingAddress the shippingAddress value to set.
* @return the AddressUpdateProperties object itself.
*/
public AddressUpdateProperties withShippingAddress(ShippingAddress shippingAddress) {
this.shippingAddress = shippingAddress;
return this;
}
/**
* Get the contactDetails property: Contact details for the address.
*
* @return the contactDetails value.
*/
public ContactDetails contactDetails() {
return this.contactDetails;
}
/**
* Set the contactDetails property: Contact details for the address.
*
* @param contactDetails the contactDetails value to set.
* @return the AddressUpdateProperties object itself.
*/
public AddressUpdateProperties withContactDetails(ContactDetails contactDetails) {
this.contactDetails = contactDetails;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (shippingAddress() != null) {
shippingAddress().validate();
}
if (contactDetails() != null) {
contactDetails().validate();
}
}
}
| [
"noreply@github.com"
] | Azure.noreply@github.com |
09f2aa06b05c409bed74083422dc380c09163527 | bec5dbb00c7fd26d8333ed4b460946b70de2ba95 | /src/test/java/com/kidd/test/pattern/structural/six/Sourceable6.java | a39815ecc785cba12879ca74444a3d26a5c2aa92 | [] | no_license | jinny-c/kidd | 0306b46ea1b61ef88b1dc06650d6a32bd2a369fe | 5a9c459f439e9c05a005dbe733481281ba329315 | refs/heads/master | 2023-05-25T19:48:20.660570 | 2023-05-17T08:15:26 | 2023-05-17T08:15:26 | 103,634,120 | 2 | 1 | null | 2022-12-16T01:26:10 | 2017-09-15T08:34:45 | JavaScript | UTF-8 | Java | false | false | 136 | java | package com.kidd.test.pattern.structural.six;
public interface Sourceable6 {
public void method1();
public void method2();
}
| [
"chaijindong@163.com"
] | chaijindong@163.com |
8e046deef88f2bef159bda0c6f69af0603589cce | 9942a1c2c028768483b01d495bba5f8805ac0449 | /service/src/main/java/com/qzdsoft/eshop/service/advertisement/AdvertisementService.java | a81b6898545c989900ddc15ab9d2accc9be9f3b5 | [] | no_license | Ysheep/yihuicloud | 8f16b3045ff40d29b66735d3d86cd9ce2706ce92 | fcb703a7b583e22b0edbcda2289c488c8923f73b | refs/heads/master | 2021-05-02T02:03:49.283168 | 2018-02-09T08:45:37 | 2018-02-09T08:45:37 | 120,878,581 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 657 | java | package com.qzdsoft.eshop.service.advertisement;
import java.util.List;
import com.qzdsoft.eshop.domain.advertisement.Advertisement;
import com.qzdsoft.eshop.vo.advertisement.AdvertisementInfo;
import com.qzdsoft.eshop.vo.advertisement.AdvertisementQueryInfo;
import com.qzdsoft.vo.LayTableResponse;
import com.qzdsoft.vo.Response;
public interface AdvertisementService {
LayTableResponse<AdvertisementInfo> getAllAdvertisements(AdvertisementQueryInfo info);
AdvertisementInfo selctById(Integer advertisementId);
Response<String> createOrUpdate(Advertisement info);
Response<String> del(Integer adverId);
List<AdvertisementInfo> list();
}
| [
"mianjun8616@163.com"
] | mianjun8616@163.com |
db13322e8c622c6e383738777caf7da33b664138 | 5fb1d46be542a6e41b4ad128d405bdd25da16c0f | /app/src/main/java/com/riteshk/fundhunt/entities/MenuEntity.java | 4bed9662519996f4e1fe5f1db6edc732b8e9e629 | [] | no_license | Yazon2006/FundHunt | d48beaa40ea40998aa6c84e880af18d163db30fe | 8ede98275eacf8faa8e0cb5f1059893829605c89 | refs/heads/master | 2021-01-10T14:41:45.585007 | 2015-12-13T18:01:39 | 2015-12-13T18:01:39 | 47,583,633 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 478 | java | package com.riteshk.fundhunt.entities;
import java.io.Serializable;
public class MenuEntity implements Serializable{
private String itemName;
private String screenContent;
public MenuEntity (String itemName, String screenContent) {
this.itemName = itemName;
this.screenContent = screenContent;
}
public String getItemName() {
return itemName;
}
public String getScreenContent() {
return screenContent;
}
}
| [
"j.motorniy@gmail.com"
] | j.motorniy@gmail.com |
02d3d88d9bb4c4f7747d932e2a533a0b34617831 | 855de33facf79369f29af548623170e486de5d01 | /LCMS/Server/src/main/java/org/data/commoditydata/CommodityData.java | 08bfed93d0796d33855d1f8b1d8f254aa4c7b070 | [] | no_license | JianghuCao/teamwork | 7fd1a513383f0f956a50f2a6d0c3db23c82c5585 | 2ea1f88fa8188a7e26a2cec45583322bf05d2850 | refs/heads/master | 2021-01-20T10:04:49.382743 | 2015-10-25T08:56:19 | 2015-10-25T08:57:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 163 | java | package org.data.commoditydata;
import org.dataservice.commoditydataservice.CommodityDataService;
public class CommodityData implements CommodityDataService{
}
| [
"bgf@qq.com"
] | bgf@qq.com |
8da9c9e717cd69e9fbcf0ce47da63e91bb67cb2d | c1359fa06ba83761727b2010c8f418c3315b5714 | /Scrolling world/Galeata.java | 2f745d5ac0a5ae2e062f826eb20354f7ce518003 | [] | no_license | Starnox/CNMB_Hackathon_2017_LumberJack | ab94a3aa7d45ee44c385a76644c8652dd7cf787c | 1d8e33a884e32f3d20d27ac70b77a580e3593c8d | refs/heads/master | 2023-04-09T07:48:36.343780 | 2021-04-20T08:24:36 | 2021-04-20T08:24:36 | 107,758,599 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 483 | java | import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Galeata here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Galeata extends Actor
{
/**
* Act - do whatever the Galeata wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
// Add your action code here.
}
}
| [
"eduard.mihailescu1@yahoo.ca"
] | eduard.mihailescu1@yahoo.ca |
7063823b1803aa327b36923aa8aea67c926edf50 | f851f634c7ffb4d86334b6a6313acce170722b1b | /stocks/target/classes/edu/citytech/stocks/stocks/model/Dividends.java | ef3d4a81c225692f41ff854bfd68fde2b2647284 | [] | no_license | jortiz01/SP-500-Project | aed1eeaa990c8db8e1c08a560a4c3bf244aebbda | 02745c5f190e320260670edeee2adaf5f8ecadd0 | refs/heads/main | 2023-08-12T10:10:10.189087 | 2021-10-06T22:43:51 | 2021-10-06T22:43:51 | 409,317,586 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 950 | java | package edu.citytech.stocks.stocks.model;
import java.util.Arrays;
import java.util.Map;
public class Dividends
{
private Map<Integer, Float>[] months;
private float yield;
private String frequency;
@Override
public String toString() {
return "Dividends{" +
"months=" + Arrays.toString(months) +
", yield=" + yield +
", frequency='" + frequency + '\'' +
'}';
}
public Map<Integer, Float>[] getMonths() {
return months;
}
public void setMonths(Map<Integer, Float>[] months) {
this.months = months;
}
public float getYield ()
{
return yield;
}
public void setYield (float yield)
{
this.yield = yield;
}
public String getFrequency ()
{
return frequency;
}
public void setFrequency (String frequency)
{
this.frequency = frequency;
}
} | [
"66872947+jortiz01@users.noreply.github.com"
] | 66872947+jortiz01@users.noreply.github.com |
3f8c33c9bc815d66d41b9ca69cf503e1f8ee98a4 | 29acc5b6a535dfbff7c625f5513871ba55554dd2 | /aws-java-sdk-support/src/main/java/com/amazonaws/services/support/model/DescribeAttachmentLimitExceededException.java | a2a80b671710cbda251a7895cce2b34095b13ea7 | [
"JSON",
"Apache-2.0"
] | permissive | joecastro/aws-sdk-java | b2d25f6a503110d156853836b49390d2889c4177 | fdbff1d42a73081035fa7b0f172b9b5c30edf41f | refs/heads/master | 2021-01-21T16:52:46.982971 | 2016-01-11T22:55:28 | 2016-01-11T22:55:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,265 | java | /*
* Copyright 2010-2016 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.support.model;
import com.amazonaws.AmazonServiceException;
/**
* <p>
* The limit for the number of <a>DescribeAttachment</a> requests in a short
* period of time has been exceeded.
* </p>
*/
public class DescribeAttachmentLimitExceededException extends
AmazonServiceException {
private static final long serialVersionUID = 1L;
/**
* Constructs a new DescribeAttachmentLimitExceededException with the
* specified error message.
*
* @param message
* Describes the error encountered.
*/
public DescribeAttachmentLimitExceededException(String message) {
super(message);
}
} | [
"aws@amazon.com"
] | aws@amazon.com |
4bf9bc6c517ae7476325fa898d436c1dfc21e348 | d132a32f07cdc583c021e56e61a4befff6228900 | /src/main/java/net/minecraft/network/play/server/S2APacketParticles.java | ea17b6e8ea136cea8bd4e7399806c0a8acf51d23 | [] | no_license | TechCatOther/um_clean_forge | 27d80cb6e12c5ed38ab7da33a9dd9e54af96032d | b4ddabd1ed7830e75df9267e7255c9e79d1324de | refs/heads/master | 2020-03-22T03:14:54.717880 | 2018-07-02T09:28:10 | 2018-07-02T09:28:10 | 139,421,233 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,055 | java | package net.minecraft.network.play.server;
import java.io.IOException;
import net.minecraft.network.INetHandler;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.INetHandlerPlayClient;
import net.minecraft.util.EnumParticleTypes;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class S2APacketParticles implements Packet
{
private EnumParticleTypes particleType;
private float xCoord;
private float yCoord;
private float zCoord;
private float xOffset;
private float field_149230_f;
private float field_149231_g;
private float particleSpeed;
private int particleCount;
private boolean field_179752_j;
private int[] particleArguments;
private static final String __OBFID = "CL_00001308";
public S2APacketParticles() {}
public S2APacketParticles(EnumParticleTypes p_i45977_1_, boolean p_i45977_2_, float p_i45977_3_, float p_i45977_4_, float p_i45977_5_, float p_i45977_6_, float yOffset, float zOffset, float particleSpeedIn, int p_i45977_10_, int ... p_i45977_11_)
{
this.particleType = p_i45977_1_;
this.field_179752_j = p_i45977_2_;
this.xCoord = p_i45977_3_;
this.yCoord = p_i45977_4_;
this.zCoord = p_i45977_5_;
this.xOffset = p_i45977_6_;
this.field_149230_f = yOffset;
this.field_149231_g = zOffset;
this.particleSpeed = particleSpeedIn;
this.particleCount = p_i45977_10_;
this.particleArguments = p_i45977_11_;
}
public void readPacketData(PacketBuffer buf) throws IOException
{
this.particleType = EnumParticleTypes.getParticleFromId(buf.readInt());
if (this.particleType == null)
{
this.particleType = EnumParticleTypes.BARRIER;
}
this.field_179752_j = buf.readBoolean();
this.xCoord = buf.readFloat();
this.yCoord = buf.readFloat();
this.zCoord = buf.readFloat();
this.xOffset = buf.readFloat();
this.field_149230_f = buf.readFloat();
this.field_149231_g = buf.readFloat();
this.particleSpeed = buf.readFloat();
this.particleCount = buf.readInt();
int i = this.particleType.getArgumentCount();
this.particleArguments = new int[i];
for (int j = 0; j < i; ++j)
{
this.particleArguments[j] = buf.readVarIntFromBuffer();
}
}
public void writePacketData(PacketBuffer buf) throws IOException
{
buf.writeInt(this.particleType.getParticleID());
buf.writeBoolean(this.field_179752_j);
buf.writeFloat(this.xCoord);
buf.writeFloat(this.yCoord);
buf.writeFloat(this.zCoord);
buf.writeFloat(this.xOffset);
buf.writeFloat(this.field_149230_f);
buf.writeFloat(this.field_149231_g);
buf.writeFloat(this.particleSpeed);
buf.writeInt(this.particleCount);
int i = this.particleType.getArgumentCount();
for (int j = 0; j < i; ++j)
{
buf.writeVarIntToBuffer(this.particleArguments[j]);
}
}
@SideOnly(Side.CLIENT)
public EnumParticleTypes func_179749_a()
{
return this.particleType;
}
public void handleParticles(INetHandlerPlayClient netHandler)
{
netHandler.handleParticles(this);
}
public void processPacket(INetHandler handler)
{
this.handleParticles((INetHandlerPlayClient)handler);
}
@SideOnly(Side.CLIENT)
public boolean func_179750_b()
{
return this.field_179752_j;
}
@SideOnly(Side.CLIENT)
public double getXCoordinate()
{
return (double)this.xCoord;
}
@SideOnly(Side.CLIENT)
public double getYCoordinate()
{
return (double)this.yCoord;
}
@SideOnly(Side.CLIENT)
public double getZCoordinate()
{
return (double)this.zCoord;
}
@SideOnly(Side.CLIENT)
public float getXOffset()
{
return this.xOffset;
}
@SideOnly(Side.CLIENT)
public float getYOffset()
{
return this.field_149230_f;
}
@SideOnly(Side.CLIENT)
public float getZOffset()
{
return this.field_149231_g;
}
@SideOnly(Side.CLIENT)
public float getParticleSpeed()
{
return this.particleSpeed;
}
@SideOnly(Side.CLIENT)
public int getParticleCount()
{
return this.particleCount;
}
@SideOnly(Side.CLIENT)
public int[] getParticleArgs()
{
return this.particleArguments;
}
} | [
"alone.inbox@gmail.com"
] | alone.inbox@gmail.com |
dc97bfc041d80b57bc5e3c9ee757e2d9d2519c84 | 156ed60b65c508f7210f279a6680280a10006400 | /3.JavaMultithreading/src/com/javarush/task/task27/task2708/RealEstate.java | e7f5d312799500b8da2862bfa629a86b634f3012 | [] | no_license | Abergaz/JavaRushTasks | 90f42c6d37402098528d5cb6b7dfb63bd51220ae | 5dcb38dff61c09384bf711d2357848f7327b08ec | refs/heads/master | 2020-04-29T02:16:21.371765 | 2019-07-23T11:13:27 | 2019-07-23T11:13:27 | 175,760,604 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,138 | java | package com.javarush.task.task27.task2708;
import java.util.HashSet;
import java.util.Set;
public class RealEstate {
private final Set<Apartment> allApartments;
private final Set<Apartment> activeApartments;
public RealEstate() {
allApartments = new HashSet();
activeApartments = new HashSet();
//add some data
allApartments.add(new Apartment(this));
allApartments.add(new Apartment(this));
allApartments.add(new Apartment(this));
allApartments.add(new Apartment(this));
allApartments.add(new Apartment(this));
allApartments.add(new Apartment(this));
}
public Set<Apartment> getAllApartments() {
return allApartments;
}
public void up(Apartment apartment) {
activeApartments.add(apartment);
}
public void revalidate() {
synchronized (activeApartments) {
activeApartments.clear();
for (Apartment apartment : allApartments) {
boolean randomValue = Math.random() * 2 % 2 == 0;
apartment.revalidate(randomValue);
}
}
}
}
| [
"zagreba@gmail.com"
] | zagreba@gmail.com |
0e8a1d8c08d79bba0b2e3ff1cc6b05e99aa94241 | 71dcd74aa0ef9dc825ce07a0df6a52fe2563b3e5 | /restful-ipservice/src/main/java/org/jeannyil/fuse/cxfrs/ipservice/exception/TypeValidationException.java | 3a2f0ed2ba0882e33ae1c069fb7c6cad831c485b | [
"Apache-2.0"
] | permissive | jeanNyil/fuse7-TP-swaggerv2-cxfrs | 3c54b1d205772130df73fc59be4a3b325d3f6442 | bb949727217ad409a12120a29bdec8bcd4c28899 | refs/heads/master | 2021-01-25T00:00:19.450061 | 2018-03-19T10:10:38 | 2018-03-19T10:10:38 | 123,287,283 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 847 | java | package org.jeannyil.fuse.cxfrs.ipservice.exception;
public class TypeValidationException extends Exception {
private static final long serialVersionUID = 1L;
public TypeValidationException() {
// TODO Auto-generated constructor stub
}
public TypeValidationException(String message) {
super(message);
// TODO Auto-generated constructor stub
}
public TypeValidationException(Throwable cause) {
super(cause);
// TODO Auto-generated constructor stub
}
public TypeValidationException(String message, Throwable cause) {
super(message, cause);
// TODO Auto-generated constructor stub
}
public TypeValidationException(String message, Throwable cause, boolean enableSuppression,
boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
// TODO Auto-generated constructor stub
}
}
| [
"jnyilimb@redhat.com"
] | jnyilimb@redhat.com |
7174b84c665cef2d452b510e2c0bda4ea94128a5 | a0cd546101594e679544d24f92ae8fcc17013142 | /refactorit-core/src/test/projects/MoveMember/Issue246/out/A2.java | 5dcffcfca8a8454eacbeac983ff926bf7bccfead | [] | no_license | svn2github/RefactorIT | f65198bb64f6c11e20d35ace5f9563d781b7fe5c | 4b1fc1ebd06c8e192af9ccd94eb5c2d96f79f94c | refs/heads/master | 2021-01-10T03:09:28.310366 | 2008-09-18T10:17:56 | 2008-09-18T10:17:56 | 47,540,746 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 86 | java | public class A2 extends A {
public void foo(B b) {
b.foo(this, b);
}
} | [
"l950637@285b47d1-db48-0410-a9c5-fb61d244d46c"
] | l950637@285b47d1-db48-0410-a9c5-fb61d244d46c |
4d0756e8253aaeee8eb1d88ae00b0a2395131432 | 7457025bbad3f37dd8bc9128d1fc254be53285b7 | /weixin-sdk/weixin-sdk-qy/src/main/java/com/dmd/weixin/qy/contact/tag/TagUsersResult.java | 6813e08d24af46e0bfb173ae765af7fd67129e23 | [
"MIT"
] | permissive | zeng08/weixin | 8f21a7f665343bfeba6a660eb059e404145b6976 | 07954f6ebabc75bb61a987afae44500d3054228a | refs/heads/master | 2020-03-19T02:03:24.964055 | 2017-09-11T06:09:41 | 2017-09-11T06:09:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,331 | java | package com.dmd.weixin.qy.contact.tag;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Arrays;
import java.util.List;
/**
* Created by exizhai on 10/5/2015.
*/
public class TagUsersResult {
@JsonProperty("errcode")
private int code;
@JsonProperty("errmsg")
private String message;
@JsonIgnore
private String invalidUsers;
@JsonProperty("partylist")
private List<Integer> invalidDepartments;
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
@JsonProperty("invalidlist")
public void setInvalidUsers(String invalidUsers) {
this.invalidUsers = invalidUsers;
}
public List<String> getInvalidUserList() {
//fuck, 为何不返回数组
String[] users = this.invalidUsers.split("|");
return Arrays.asList(users);
}
public List<Integer> getInvalidDepartments() {
return invalidDepartments;
}
public void setInvalidDepartments(List<Integer> invalidDepartments) {
this.invalidDepartments = invalidDepartments;
}
}
| [
"qiaozhi_china@163.com"
] | qiaozhi_china@163.com |
5bf2be0b0b99968fb3ed34434f2b0b77433a5fe8 | dfd64498c48dcebfec5834bd2b834445d62da74c | /bed_restapi/src/main/java/com/capstone/model/DailyLogs.java | 997fd0be723271236825a3388e1606e9ad1496de | [] | no_license | akscodebay/DietManagementSystem | e162776a55a11288b7777ba0d506033ecf09dbc0 | 72a6c482970c00af6a4aee68dd54946aabc65024 | refs/heads/main | 2023-01-29T01:58:31.450111 | 2020-12-10T14:33:10 | 2020-12-10T14:33:10 | 320,273,580 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,201 | java | package com.capstone.model;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
@Entity
public class DailyLogs {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
Long id;
String userId;
String date;
String breakfast;
String lunch;
String dinner;
String fruits;
String vegetables;
String workouts;
public DailyLogs() {
super();
// TODO Auto-generated constructor stub
}
public DailyLogs(String userId, String date, String breakfast, String lunch, String dinner, String fruits,
String vegetables, String workouts) {
super();
this.userId = userId;
this.date = date;
this.breakfast = breakfast;
this.lunch = lunch;
this.dinner = dinner;
this.fruits = fruits;
this.vegetables = vegetables;
this.workouts = workouts;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getDate() {
return date;
}
public void setDate(String date) {
this.date = date;
}
public String getBreakfast() {
return breakfast;
}
public void setBreakfast(String breakfast) {
this.breakfast = breakfast;
}
public String getLunch() {
return lunch;
}
public void setLunch(String lunch) {
this.lunch = lunch;
}
public String getDinner() {
return dinner;
}
public void setDinner(String dinner) {
this.dinner = dinner;
}
public String getFruits() {
return fruits;
}
public void setFruits(String fruits) {
this.fruits = fruits;
}
public String getVegetables() {
return vegetables;
}
public void setVegetables(String vegetables) {
this.vegetables = vegetables;
}
public String getWorkouts() {
return workouts;
}
public void setWorkouts(String workouts) {
this.workouts = workouts;
}
@Override
public String toString() {
return "DailyLogs [id=" + id + ", userId=" + userId + ", date=" + date + ", breakfast=" + breakfast + ", lunch="
+ lunch + ", dinner=" + dinner + ", fruits=" + fruits + ", vegetables=" + vegetables + ", workouts="
+ workouts + "]";
}
}
| [
"noreply@github.com"
] | akscodebay.noreply@github.com |
f3a00e55d8cc02bf76e9af776a249c97544227ed | b796c2ed217a0fcc5ebc5fc331ee15bbcf5318d3 | /lab7/ThematicList/src/main/java/pl/basistam/jms/MessageSender.java | 5ef1e3cfcab6d53d060c4e20ac392b9cbbcd771e | [] | no_license | Besanouno/soa | 89232c29e6a409215a7df7b1b9aa88de65c6cca3 | d9de71a2e3ca5c96d996ea892fe94c2519af6933 | refs/heads/master | 2021-01-18T16:28:42.070858 | 2018-04-01T11:42:59 | 2018-04-01T11:42:59 | 86,746,345 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 182 | java | package pl.basistam.jms;
public interface MessageSender {
void sendToAll(String subject, String message);
void sendToOne(String subject, String receiver, String message);
}
| [
"basistamarcin@gmail.com"
] | basistamarcin@gmail.com |
7d2c61ae0a92856a3c202db1ac45bb6e9649f2e9 | 7342e9d64cc5c816f4e3652cbf9569e58c0650d9 | /TicketService/src/ticket/TicketService.java | 6816fc976e21fd136522dd51ce782955882a1240 | [] | no_license | sauloperez/distributed-computing | 0e5cda636017d3162655af9ef844d10564cf90bd | 31efb6b9089cedd8435be0a6f81e5eee3c3f4167 | refs/heads/master | 2020-06-07T06:43:22.662434 | 2013-06-20T16:33:12 | 2013-06-20T16:33:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 357 | java | package ticket;
import javax.jws.WebMethod;
import javax.jws.WebService;
@WebService
public interface TicketService {
@WebMethod public void ticketcreation(String name, int type, int date);
@WebMethod public void ticketread();
@WebMethod public void ticketupdate();
@WebMethod public void ticketdelete();
@WebMethod public void ticketlists();
}
| [
"srinivasan@srinivasan-VPCEH15EN.(none)"
] | srinivasan@srinivasan-VPCEH15EN.(none) |
645fad00c01c4498b6f4d502ba8a2a8819069cc1 | 2fcdae7475c10ccd1013d06c55a8388982772dc9 | /matlab_gen/build/rosjava_build/irob_msgs/build/generated-src/irob_msgs/ToolPose.java | 6f02ed94232e1fa0b425c810d69f309225e5b717 | [
"MIT"
] | permissive | ABC-iRobotics/irob-saf | c880454e0426e425eac1d613987f2dd754c22049 | d1d0e1e0ff5e938a2cf6e3597d9c2965a7f65421 | refs/heads/master | 2023-04-15T10:59:18.724153 | 2023-04-06T08:32:25 | 2023-04-06T08:32:25 | 70,881,053 | 14 | 8 | MIT | 2022-11-18T12:15:32 | 2016-10-14T06:34:56 | MATLAB | UTF-8 | Java | false | false | 728 | java | package irob_msgs;
public interface ToolPose extends org.ros.internal.message.Message {
static final java.lang.String _TYPE = "irob_msgs/ToolPose";
static final java.lang.String _DEFINITION = "# ToolPose.msg\n# A representation of robot tool pose in free space, composed of position,\n# orientation and jaw angle.\n \ngeometry_msgs/Point position\ngeometry_msgs/Quaternion orientation\nfloat64 jaw\n";
static final boolean _IS_SERVICE = false;
static final boolean _IS_ACTION = false;
geometry_msgs.Point getPosition();
void setPosition(geometry_msgs.Point value);
geometry_msgs.Quaternion getOrientation();
void setOrientation(geometry_msgs.Quaternion value);
double getJaw();
void setJaw(double value);
}
| [
"tamas.daniel.nagy@irob.uni-obuda.hu"
] | tamas.daniel.nagy@irob.uni-obuda.hu |
8f93b77c12f289637e4134499a87395bbb72cb4b | 24b1b6e5408656205e10534e8a00bbaed254b24b | /src/infrastrcutre/webbdrivers/ChromeWebDriver.java | 8dd4dc93a3032b9270e0c5dc9c007d29189020a3 | [] | no_license | ElenaIvanova888/HomeWork | 10335d9a448f35b23674d8a39f487da74498c4fa | 904d7ab289b12046df2af0e58678cceff27615c4 | refs/heads/master | 2020-06-01T04:24:28.908870 | 2019-08-03T17:44:51 | 2019-08-03T17:44:51 | 190,634,656 | 0 | 0 | null | 2019-08-03T17:44:52 | 2019-06-06T19:01:10 | Java | UTF-8 | Java | false | false | 387 | java | package infrastrcutre.webbdrivers;
public class ChromeWebDriver implements IWebDriver{
@Override
public void open(String url) {
System.out.println("Chrome open URL "+url);
}
@Override
public void click() {
System.out.println("Clicking element in Chrome");
}
@Override
public void sendKeys(String sendKeys) {
System.out.println("Enter value to Chrome: "+sendKeys);
}
}
| [
"lekaivanova@gmail.com"
] | lekaivanova@gmail.com |
d81c848d4cbadd7cd0ef97fffaa4f54964b261b3 | e8334ebd7d9280eaf97dca538d35ea6380d0f6bf | /src/main/java/structural/composite/CompositePatternDemo.java | 824f9169859189c31af19be1b4a3525f784251e5 | [] | no_license | mvlaeva/DesignPatterns | aa888d37d099fc994dc3bc5f0f945270edf370b7 | 885f480fe3117e2df5816b5e2aa06b2a9ce0b720 | refs/heads/master | 2020-07-16T22:48:27.109899 | 2019-11-18T12:41:34 | 2019-12-02T13:39:12 | 205,884,413 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,128 | java | package structural.composite;
public class CompositePatternDemo {
public static void main(String[] args) {
Employee CEO = new Employee("John", "CEO", 30000);
Employee headSales = new Employee("Ivan", "Head Sales", 20000);
Employee headMarketing = new Employee("George", "Head Marketing", 20000);
Employee clerk1 = new Employee("Christopher", "Marketing", 10000);
Employee clerk2 = new Employee("Ana", "Marketing", 10000);
Employee salesExecutive1 = new Employee("Cathelin", "Sales", 10000);
Employee salesExecutive2 = new Employee("Emma", "Sales", 10000);
CEO.add(headSales);
CEO.add(headMarketing);
headSales.add(salesExecutive1);
headSales.add(salesExecutive2);
headMarketing.add(clerk1);
headMarketing.add(clerk2);
System.out.println(CEO);
for (Employee headEmployee : CEO.getSubordinates()) {
System.out.println(headEmployee);
for (Employee employee : headEmployee.getSubordinates()) {
System.out.println(employee);
}
}
}
}
| [
"mirela_vlaeva@epam.com"
] | mirela_vlaeva@epam.com |
b469895081f2f4d302d0e5b5a6c0f74fadcd9d55 | d5a6495e49ca821f52b6904101cf7b571593643c | /src/main/java/pl/sda/spring/bookstore/config/SecurityConfig.java | e9779149e0c58aaa2ed16e744270f2de06281ebc | [] | no_license | krzywyzielarz/spring-demo-tarr3 | 3a4facb320bd9ed147298248f7a749588bf35db2 | dcbe999ae9e40cc2fcb7cb5cfa756d23bc07ef2e | refs/heads/master | 2020-05-24T15:35:57.675892 | 2019-05-19T14:38:15 | 2019-05-19T14:38:15 | 187,335,799 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,847 | java | package pl.sda.spring.bookstore.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.password.PasswordEncoder;
@EnableWebSecurity
public class SecurityConfig {
@Autowired
public void configure(AuthenticationManagerBuilder auth,
@Qualifier("repositoryUserDetailsService") UserDetailsService userDetailsService,
PasswordEncoder passwordEncoder)
throws Exception {
auth.userDetailsService(userDetailsService).passwordEncoder(passwordEncoder);
//.inMemoryAuthentication()
//.withUser("admin")
//.password("{noop}admin")
//.roles("USER");
}
@Configuration
@Order(1)
public static class MvcSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.antMatcher("/mvc/**")
.authorizeRequests()
.antMatchers("/mvc/login", "/mvc/register").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/mvc/login")
.loginProcessingUrl("/mvc/login")
.and()
.logout().logoutUrl("/mvc/logout").logoutSuccessUrl("/mvc/bookstore/all");
}
}
@Configuration
@Order(2)
public static class ApiSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.antMatcher("/api/**")
.authorizeRequests()
.antMatchers("/api/users").permitAll()
.anyRequest().authenticated()
.and()
.httpBasic()
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.csrf().disable();
}
}
}
| [
"k.kossobucki@gmail.com"
] | k.kossobucki@gmail.com |
a2b5751643169d1fc914eb78164e9e357dd52551 | 28c95ff3e059e896d2f10caf25b3353c7ac50109 | /characteristic/u2a7d/src/main/java/org/im97mori/ble/characteristic/u2a7d/DescriptorValueChanged.java | f82b1b1d963a43cce414c00571fef328079944b8 | [
"MIT"
] | permissive | im97mori-github/JavaBLEUtil | 7c8fd4bf0b640c87a874a07aa8873815ba1beb09 | 335b7a76869abf89ad1397aaf7544c1ca5b92526 | refs/heads/master | 2023-08-30T21:04:34.786942 | 2023-08-25T12:00:07 | 2023-08-26T23:07:11 | 242,078,480 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 11,230 | java | package org.im97mori.ble.characteristic.u2a7d;
import static org.im97mori.ble.BLEUtils.BASE_UUID;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;
import java.util.UUID;
import org.im97mori.ble.BLEUtils;
import org.im97mori.ble.ByteArrayInterface;
import androidx.annotation.NonNull;
/**
* Descriptor Value Changed (Characteristics UUID: 0x2A7D)
*/
public class DescriptorValueChanged implements ByteArrayInterface {
/**
* @see #FLAGS_SOURCE_OF_CHANGE_SERVER
* @see #FLAGS_SOURCE_OF_CHANGE_CLIENT
*/
public static final int FLAGS_SOURCE_OF_CHANGE_MASK = 0b00000000_00000001;
/**
* 0: Source of Change Server
*/
public static final int FLAGS_SOURCE_OF_CHANGE_SERVER = 0b00000000_00000000;
/**
* 1: Source of Change Client
*/
public static final int FLAGS_SOURCE_OF_CHANGE_CLIENT = 0b00000000_00000001;
/**
* @see #FLAGS_CHANGE_TO_ONE_OR_MORE_ES_TRIGGER_SETTING_DESCRIPTORS_FALSE
* @see #FLAGS_CHANGE_TO_ONE_OR_MORE_ES_TRIGGER_SETTING_DESCRIPTORS_TRUE
*/
public static final int FLAGS_CHANGE_TO_ONE_OR_MORE_ES_TRIGGER_SETTING_DESCRIPTORS_MASK = 0b00000000_00000010;
/**
* 0: Change to one or more ES Trigger Setting Descriptors False
*/
public static final int FLAGS_CHANGE_TO_ONE_OR_MORE_ES_TRIGGER_SETTING_DESCRIPTORS_FALSE = 0b00000000_00000000;
/**
* 1: Change to one or more ES Trigger Setting Descriptors True
*/
public static final int FLAGS_CHANGE_TO_ONE_OR_MORE_ES_TRIGGER_SETTING_DESCRIPTORS_TRUE = 0b00000000_00000010;
/**
* @see #FLAGS_CHANGE_TO_ES_CONFIGURATION_DESCRIPTORS_FALSE
* @see #FLAGS_CHANGE_TO_ES_CONFIGURATION_DESCRIPTORS_TRUE
*/
public static final int FLAGS_CHANGE_TO_ES_CONFIGURATION_DESCRIPTORS_MASK = 0b00000000_00000100;
/**
* 0: Change to ES Configuration Descriptor False
*/
public static final int FLAGS_CHANGE_TO_ES_CONFIGURATION_DESCRIPTORS_FALSE = 0b00000000_00000000;
/**
* 1: Change to ES Configuration Descriptor True
*/
public static final int FLAGS_CHANGE_TO_ES_CONFIGURATION_DESCRIPTORS_TRUE = 0b00000000_00000100;
/**
* @see #FLAGS_CHANGE_TO_ES_MEASUREMENT_DESCRIPTORS_FALSE
* @see #FLAGS_CHANGE_TO_ES_MEASUREMENT_DESCRIPTORS_TRUE
*/
public static final int FLAGS_CHANGE_TO_ES_MEASUREMENT_DESCRIPTORS_MASK = 0b00000000_00001000;
/**
* 0: Change to ES Measurement Descriptor False
*/
public static final int FLAGS_CHANGE_TO_ES_MEASUREMENT_DESCRIPTORS_FALSE = 0b00000000_00000000;
/**
* 1: Change to ES Measurement Descriptor True
*/
public static final int FLAGS_CHANGE_TO_ES_MEASUREMENT_DESCRIPTORS_TRUE = 0b00000000_00001000;
/**
* @see #FLAGS_CHANGE_TO_CHARACTERISTIC_USER_DESCRIPTION_DESCRIPTORS_FALSE
* @see #FLAGS_CHANGE_TO_CHARACTERISTIC_USER_DESCRIPTION_DESCRIPTORS_TRUE
*/
public static final int FLAGS_CHANGE_TO_CHARACTERISTIC_USER_DESCRIPTION_DESCRIPTORS_MASK = 0b00000000_00010000;
/**
* 0: Change to Characteristic User Description Descriptor False
*/
public static final int FLAGS_CHANGE_TO_CHARACTERISTIC_USER_DESCRIPTION_DESCRIPTORS_FALSE = 0b00000000_00000000;
/**
* 1: Change to Characteristic User Description Descriptor True
*/
public static final int FLAGS_CHANGE_TO_CHARACTERISTIC_USER_DESCRIPTION_DESCRIPTORS_TRUE = 0b00000000_00010000;
/**
* Flags
*/
private final int mFlags;
/**
* Characteristic UUID
*/
private final byte[] mCharacteristicUUID;
/**
* Constructor from byte array
*
* @param values
* byte array from <a href=
* "https://developer.android.com/reference/android/bluetooth/BluetoothGattCharacteristic#getValue()">BluetoothGattCharacteristic#getValue()</a>
*/
public DescriptorValueChanged(@NonNull byte[] values) {
mFlags = BLEUtils.createSInt16(values, 0);
mCharacteristicUUID = Arrays.copyOfRange(values, 2, values.length);
}
/**
* Constructor from parameters
*
* @param flags
* Flags
* @param characteristicUUID
* Characteristic UUID
*/
public DescriptorValueChanged(int flags, @NonNull byte[] characteristicUUID) {
mFlags = flags;
mCharacteristicUUID = characteristicUUID;
}
/**
* @return Flags
*/
public int getFlags() {
return mFlags;
}
/**
* @return {@code true}:Source of Change Server, {@code false}:Source of Change
* Client
*/
public boolean isFlagsSourceOfChangeServer() {
return isFlagsMatched(FLAGS_SOURCE_OF_CHANGE_MASK, FLAGS_SOURCE_OF_CHANGE_SERVER);
}
/**
* @return {@code true}:Source of Change Client, {@code false}:Source of Change
* Server
*/
public boolean isFlagsSourceOfChangeClient() {
return isFlagsMatched(FLAGS_SOURCE_OF_CHANGE_MASK, FLAGS_SOURCE_OF_CHANGE_CLIENT);
}
/**
* @return {@code true}:Change to one or more ES Trigger Setting Descriptors
* False, {@code false}:Change to one or more ES Trigger Setting
* Descriptors True
*/
public boolean isFlagsChangeToOneOrMoreEsTriggerSettingDescriptorsFalse() {
return isFlagsMatched(FLAGS_CHANGE_TO_ONE_OR_MORE_ES_TRIGGER_SETTING_DESCRIPTORS_MASK,
FLAGS_CHANGE_TO_ONE_OR_MORE_ES_TRIGGER_SETTING_DESCRIPTORS_FALSE);
}
/**
* @return {@code true}:Change to one or more ES Trigger Setting Descriptors
* True, {@code false}:Change to one or more ES Trigger Setting
* Descriptors False
*/
public boolean isFlagsChangeToOneOrMoreEsTriggerSettingDescriptorsTrue() {
return isFlagsMatched(FLAGS_CHANGE_TO_ONE_OR_MORE_ES_TRIGGER_SETTING_DESCRIPTORS_MASK,
FLAGS_CHANGE_TO_ONE_OR_MORE_ES_TRIGGER_SETTING_DESCRIPTORS_TRUE);
}
/**
* @return {@code true}:Change to ES Configuration Descriptor False,
* {@code false}:Change to ES Configuration Descriptor True
*/
public boolean isFlagsChangeToEsConfigurationDescriptorFalse() {
return isFlagsMatched(FLAGS_CHANGE_TO_ES_CONFIGURATION_DESCRIPTORS_MASK,
FLAGS_CHANGE_TO_ES_CONFIGURATION_DESCRIPTORS_FALSE);
}
/**
* @return {@code true}:Change to ES Configuration Descriptor True,
* {@code false}:Change to ES Configuration Descriptor False
*/
public boolean isFlagsChangeToEsConfigurationDescriptorTrue() {
return isFlagsMatched(FLAGS_CHANGE_TO_ES_CONFIGURATION_DESCRIPTORS_MASK,
FLAGS_CHANGE_TO_ES_CONFIGURATION_DESCRIPTORS_TRUE);
}
/**
* @return {@code true}:Change to ES Measurement Descriptor False,
* {@code false}:Change to ES Measurement Descriptor True
*/
public boolean isFlagsChangeToEsMeasurementDescriptorFalse() {
return isFlagsMatched(FLAGS_CHANGE_TO_ES_MEASUREMENT_DESCRIPTORS_MASK,
FLAGS_CHANGE_TO_ES_MEASUREMENT_DESCRIPTORS_FALSE);
}
/**
* @return {@code true}:Change to ES Measurement Descriptor True,
* {@code false}:Change to ES Measurement Descriptor False
*/
public boolean isFlagsChangeToEsMeasurementDescriptorTrue() {
return isFlagsMatched(FLAGS_CHANGE_TO_ES_MEASUREMENT_DESCRIPTORS_MASK,
FLAGS_CHANGE_TO_ES_MEASUREMENT_DESCRIPTORS_TRUE);
}
/**
* @return {@code true}:Change to Characteristic User Description Descriptor
* False, {@code false}:Change to Characteristic User Description
* Descriptor True
*/
public boolean isFlagsChangeToCharacteristicUserDescriptionDescriptorFalse() {
return isFlagsMatched(FLAGS_CHANGE_TO_CHARACTERISTIC_USER_DESCRIPTION_DESCRIPTORS_MASK,
FLAGS_CHANGE_TO_CHARACTERISTIC_USER_DESCRIPTION_DESCRIPTORS_FALSE);
}
/**
* @return {@code true}:Change to Characteristic User Description Descriptor
* True, {@code false}:Change to Characteristic User Description
* Descriptor False
*/
public boolean isFlagsChangeToCharacteristicUserDescriptionDescriptorTrue() {
return isFlagsMatched(FLAGS_CHANGE_TO_CHARACTERISTIC_USER_DESCRIPTION_DESCRIPTORS_MASK,
FLAGS_CHANGE_TO_CHARACTERISTIC_USER_DESCRIPTION_DESCRIPTORS_TRUE);
}
/**
* @return Characteristic UUID
*/
public byte[] getCharacteristicUUID() {
return mCharacteristicUUID;
}
/**
* @return Characteristic {@link UUID} instance
*/
@NonNull
public UUID createCharacteristicUUID() {
UUID uuid;
if (mCharacteristicUUID.length == 2) {
// combine with BASE UUID
long lsb = BASE_UUID.getLeastSignificantBits();
long msb = BASE_UUID.getMostSignificantBits();
long target = mCharacteristicUUID[0] & 0xff;
target |= (mCharacteristicUUID[1] & 0xff) << 8;
target = target << 32;
uuid = new UUID(msb | target, lsb);
} else {
ByteBuffer bb = ByteBuffer.wrap(mCharacteristicUUID, 0, 16).order(ByteOrder.LITTLE_ENDIAN);
long msb = 0;
long lsb = 0;
msb |= ((long) bb.getInt()) << 32;
msb |= ((long) bb.getShort()) << 16;
msb |= (long) bb.getShort();
lsb |= ((long) bb.get()) << 56;
lsb |= ((long) bb.get()) << 48;
lsb |= ((long) bb.getShort());
lsb |= ((long) bb.getInt()) << 16;
uuid = new UUID(msb, lsb);
}
return uuid;
}
/**
* {@inheritDoc}
*/
@Override
@NonNull
public byte[] getBytes() {
byte[] data = new byte[2 + mCharacteristicUUID.length];
ByteBuffer byteBuffer = ByteBuffer.wrap(data).order(ByteOrder.LITTLE_ENDIAN);
byteBuffer.putShort((short) mFlags);
byteBuffer.put(mCharacteristicUUID);
return data;
}
/**
* check Flags
*
* @param mask
* bitmask for expect
* @param expect
* one of {@link #FLAGS_SOURCE_OF_CHANGE_SERVER} ,
* {@link #FLAGS_SOURCE_OF_CHANGE_CLIENT} ,
* {@link #FLAGS_CHANGE_TO_ONE_OR_MORE_ES_TRIGGER_SETTING_DESCRIPTORS_FALSE}
* ,
* {@link #FLAGS_CHANGE_TO_ONE_OR_MORE_ES_TRIGGER_SETTING_DESCRIPTORS_TRUE}
* , {@link #FLAGS_CHANGE_TO_ES_CONFIGURATION_DESCRIPTORS_FALSE} ,
* {@link #FLAGS_CHANGE_TO_ES_CONFIGURATION_DESCRIPTORS_TRUE} ,
* {@link #FLAGS_CHANGE_TO_ES_MEASUREMENT_DESCRIPTORS_FALSE} ,
* {@link #FLAGS_CHANGE_TO_ES_MEASUREMENT_DESCRIPTORS_TRUE} ,
* {@link #FLAGS_CHANGE_TO_CHARACTERISTIC_USER_DESCRIPTION_DESCRIPTORS_FALSE}
* ,
* {@link #FLAGS_CHANGE_TO_CHARACTERISTIC_USER_DESCRIPTION_DESCRIPTORS_TRUE}
* @return {@code true}:same as expect, {@code false}:not match
*/
private boolean isFlagsMatched(int mask, int expect) {
return (mask & mFlags) == expect;
}
}
| [
"github@im97mori.org"
] | github@im97mori.org |
067749f2f80f2f1744fb796f3feed96b0de66ba8 | b13e3c45285ecfc8d725fbf9a73bf8dfd0f76683 | /JavaGame/src/project/ui/ClickListener.java | eff5c124dd25e29bea4ff7e9b7ebd11fc367b663 | [] | no_license | 90301379/JavaGameOnGitHub | 8225ec81dfe3dc9c14749f0d049d4fd859d4fef9 | c30892eb0308059e548a7b631380d7fc1f4380d2 | refs/heads/master | 2020-12-24T06:54:04.985034 | 2016-06-08T15:00:14 | 2016-06-08T15:00:58 | 60,705,013 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 83 | java | package project.ui;
public interface ClickListener {
public void onClick();
}
| [
"90301379@ep-student.org"
] | 90301379@ep-student.org |
a41a1cc3d164773b0de71eb280f1dd172772b755 | 9f30fbae8035c2fc1cb681855db1bc32964ffbd4 | /Java/jinliangjin/task5/src/main/java/com/ptt/util/CookieUtil.java | d4fdce2bd5ba653263a765931d3da09ffa7809b8 | [] | no_license | IT-xzy/Task | f2d309cbea962bec628df7be967ac335fd358b15 | 4f72d55b8c9247064b7c15db172fd68415492c48 | refs/heads/master | 2022-12-23T04:53:59.410971 | 2019-06-20T21:14:15 | 2019-06-20T21:14:15 | 126,955,174 | 18 | 395 | null | 2022-12-16T12:17:21 | 2018-03-27T08:34:32 | null | UTF-8 | Java | false | false | 3,084 | java | package com.ptt.util;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @ClassName: CookieUtil
* @Description:
* @Author: Jin
* @CreateDate: 2018/5/31 15:10
* @Version: 1.0
*/
@Component
public class CookieUtil {
private static int maxAge;
private static String path;
@Value("${maxAge}")
public void setMaxAge(String maxAge) {
CookieUtil.maxAge = Integer.parseInt(maxAge);
}
@Value("${path}")
public void setPath(String path) {
CookieUtil.path = path;
}
public static void addCookie(HttpServletResponse response, Cookie cookie){
if(null !=cookie)
response.addCookie(cookie);
}
public static void addCookie(HttpServletResponse response, String cookieName, String cookieValue){
if(null != cookieName && !cookieName.equals("")){
if(null != cookieValue)
cookieValue = "";
Cookie cookie = new Cookie(cookieName, cookieValue);
if(maxAge > 0)
cookie.setMaxAge(maxAge);
if(null == path)
cookie.setPath("/");
else cookie.setPath(path);
addCookie(response, cookie);
}
}
public static Cookie getCookieByName(HttpServletRequest request, String cookieName){
Cookie[] cookies = request.getCookies();
if(null == cookieName || cookieName.equals("") || null == cookies)
return null;
for(Cookie cookie:cookies){
if(cookie.getName().equals(cookieName))
return cookie;
}
return null;
}
public static String getCookieValue(HttpServletRequest request, String cookieName){
Cookie cookie = getCookieByName(request, cookieName);
if(null == cookie)
return null;
else return cookie.getValue();
}
public static void deleteCookie(HttpServletResponse response, Cookie cookie){
if(null != cookie){
cookie.setValue(null);
cookie.setPath("/");
cookie.setMaxAge(0);
response.addCookie(cookie);
}
}
public static void deleteCookie(HttpServletRequest request, HttpServletResponse response, String cookieName){
Cookie cookie = getCookieByName(request, cookieName);
if(null != cookie && cookie.getName().equals(cookieName))
deleteCookie(response, cookie);
}
public static void editCookie(HttpServletRequest request, HttpServletResponse response, String cookieName,
String cookieValue){
Cookie cookie = getCookieByName(request, cookieName);
if(null != cookie && null != cookieName && !cookieName.equals("") && !cookie.getName().equals(cookieName))
addCookie(response, cookieName, cookieValue);
}
}
| [
"noreply@github.com"
] | IT-xzy.noreply@github.com |
7e24bcc5e5c21be3f3ed4d575db5299512096f3e | c4a1d528bfddb9a4651faafd353fdee184241721 | /src/leetcode/editor/cn/P239_SlidingWindowMaximum.java | e6adb2e5cd6a3ddcf48f6a8026448c365e262a76 | [] | no_license | chen-tju/LeetCode | c3d116946ad1b1986a2007f7d56b4f8f0a9f02e2 | 446bb62fe2855e972e0a3cb7817f36a61b70f80f | refs/heads/main | 2023-07-13T12:26:40.460158 | 2021-08-18T14:09:33 | 2021-08-18T14:09:33 | 284,684,952 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,625 | java | //给你一个整数数组 nums,有一个大小为 k 的滑动窗口从数组的最左侧移动到数组的最右侧。你只可以看到在滑动窗口内的 k 个数字。滑动窗口每次只向右移动一位
//。
//
// 返回滑动窗口中的最大值。
//
//
//
// 示例 1:
//
//
//输入:nums = [1,3,-1,-3,5,3,6,7], k = 3
//输出:[3,3,5,5,6,7]
//解释:
//滑动窗口的位置 最大值
//--------------- -----
//[1 3 -1] -3 5 3 6 7 3
// 1 [3 -1 -3] 5 3 6 7 3
// 1 3 [-1 -3 5] 3 6 7 5
// 1 3 -1 [-3 5 3] 6 7 5
// 1 3 -1 -3 [5 3 6] 7 6
// 1 3 -1 -3 5 [3 6 7] 7
//
//
// 示例 2:
//
//
//输入:nums = [1], k = 1
//输出:[1]
//
//
// 示例 3:
//
//
//输入:nums = [1,-1], k = 1
//输出:[1,-1]
//
//
// 示例 4:
//
//
//输入:nums = [9,11], k = 2
//输出:[11]
//
//
// 示例 5:
//
//
//输入:nums = [4,-2], k = 2
//输出:[4]
//
//
//
// 提示:
//
//
// 1 <= nums.length <= 105
// -104 <= nums[i] <= 104
// 1 <= k <= nums.length
//
// Related Topics 堆 Sliding Window
// 👍 754 👎 0
package leetcode.editor.cn;
//滑动窗口最大值
import sun.awt.image.ImageWatched;
import java.util.Deque;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
public class P239_SlidingWindowMaximum{
public static void main(String[] args) {
//测试代码
Solution solution = new P239_SlidingWindowMaximum().new Solution();
Solution_deque solution1 = new P239_SlidingWindowMaximum().new Solution_deque();
int[] nums = {1,3,-1,-3,5,3,6,7};
int[] res = solution1.maxSlidingWindow(nums, 3);
for (int i : res) {
System.out.print(i + " ");
}
}
class Solution_deque{//定义一个双向队列,单调队列存放元素下标
public int[] maxSlidingWindow(int[] nums, int k) {
Deque<Integer> deque = new LinkedList<>();
for(int i = 0; i < k; i++){
while(!deque.isEmpty() && nums[i] >= nums[deque.peekLast()]){
deque.pollLast();
}
deque.offerLast(i);
}
int[] res = new int[nums.length - k + 1];
res[0] = nums[deque.peekFirst()];
for (int i = k; i < nums.length; i++) {
while(!deque.isEmpty() && nums[i] >= nums[deque.peekLast()]){
deque.pollLast();
}
deque.offerLast(i);
while(deque.peekFirst() <= i - k){
deque.pollFirst();
}
res[i - k + 1] = nums[deque.peekFirst()];
}
return res;
}
}
//力扣代码
//leetcode submit region begin(Prohibit modification and deletion)
class Solution {//定义一个优先队列,用大根堆的方式选出k个数字中最大的
public int[] maxSlidingWindow(int[] nums, int k) {
Queue<int[]> pq = new PriorityQueue<>((a, b) -> (a[0] == b[0] ? b[1] - a[1] : b[0] - a[0]));
for(int i = 0; i < k; i++){
pq.offer(new int[]{nums[i], i});
}
int[] res = new int[nums.length - k + 1];
res[0] = pq.peek()[0];
for(int i = k; i < nums.length; i++){
pq.offer(new int[]{nums[i], i});
while(pq.peek()[1] <= i - k){
pq.poll();
}
res[i - k + 1] = pq.peek()[0];
}
return res;
}
}
//leetcode submit region end(Prohibit modification and deletion)
} | [
"321913135@qq.com"
] | 321913135@qq.com |
250e2fcb8d08ba23d2b3c2f604105d57d1d0bb4c | 5cc7f1b2c6c7fdedeb0200114269f7fcb20aa6f0 | /app/src/main/java/com/piistech/gratecrm/Model/ColorItem.java | 4b96eef72130f52692d212bf2db2031a92bcd897 | [] | no_license | Omar-Khaium/GrateCRM | 94cd697d4869bcb605706b0d4d0c96b816f3fc67 | acaf650336dc3c4e0cdf5fdc810ed55aa7521883 | refs/heads/master | 2020-08-24T07:23:27.091189 | 2019-11-11T12:39:27 | 2019-11-11T12:39:27 | 216,783,722 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 528 | java | package com.piistech.gratecrm.Model;
public class ColorItem {
private boolean flag;
private String color;
public ColorItem() {
}
public ColorItem(boolean flag, String color) {
this.flag = flag;
this.color = color;
}
public boolean isFlag() {
return flag;
}
public void setFlag(boolean flag) {
this.flag = flag;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
}
| [
"zahidhasan9103@gmail.com"
] | zahidhasan9103@gmail.com |
f1c019f32119885e366636f307780c04092ce1e4 | d582332bb1ea5d852d31d6e5e169b80bf1143846 | /src/main/java/org/apache/ibatis/type/TypeAliasRegistry.java | 3adfbdc5981d07981fd3b57a80194c195d1c3fd0 | [] | no_license | catkingluo123/active.real.time | f0b0cf6d7f52cd184b26a929bf377a6c1e04b71c | da2b9692ed61780974e37c738a80273fa85ee43a | refs/heads/master | 2020-07-02T11:51:49.090153 | 2016-11-21T13:06:58 | 2016-11-21T13:06:58 | 74,264,755 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,927 | java | /*
* Copyright 2009-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.ibatis.type;
import org.apache.ibatis.io.ResolverUtil;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.type.Alias;
import org.apache.ibatis.type.TypeException;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.ResultSet;
import java.util.*;
/**
* @author Clinton Begin
*/
public class TypeAliasRegistry {
private final Map<String, Class<?>> TYPE_ALIASES = new HashMap<String, Class<?>>();
public TypeAliasRegistry() {
registerAlias("string", String.class);
registerAlias("byte", Byte.class);
registerAlias("long", Long.class);
registerAlias("short", Short.class);
registerAlias("int", Integer.class);
registerAlias("integer", Integer.class);
registerAlias("double", Double.class);
registerAlias("float", Float.class);
registerAlias("boolean", Boolean.class);
registerAlias("byte[]", Byte[].class);
registerAlias("long[]", Long[].class);
registerAlias("short[]", Short[].class);
registerAlias("int[]", Integer[].class);
registerAlias("integer[]", Integer[].class);
registerAlias("double[]", Double[].class);
registerAlias("float[]", Float[].class);
registerAlias("boolean[]", Boolean[].class);
registerAlias("_byte", byte.class);
registerAlias("_long", long.class);
registerAlias("_short", short.class);
registerAlias("_int", int.class);
registerAlias("_integer", int.class);
registerAlias("_double", double.class);
registerAlias("_float", float.class);
registerAlias("_boolean", boolean.class);
registerAlias("_byte[]", byte[].class);
registerAlias("_long[]", long[].class);
registerAlias("_short[]", short[].class);
registerAlias("_int[]", int[].class);
registerAlias("_integer[]", int[].class);
registerAlias("_double[]", double[].class);
registerAlias("_float[]", float[].class);
registerAlias("_boolean[]", boolean[].class);
registerAlias("date", Date.class);
registerAlias("decimal", BigDecimal.class);
registerAlias("bigdecimal", BigDecimal.class);
registerAlias("biginteger", BigInteger.class);
registerAlias("object", Object.class);
registerAlias("date[]", Date[].class);
registerAlias("decimal[]", BigDecimal[].class);
registerAlias("bigdecimal[]", BigDecimal[].class);
registerAlias("biginteger[]", BigInteger[].class);
registerAlias("object[]", Object[].class);
registerAlias("map", Map.class);
registerAlias("hashmap", HashMap.class);
registerAlias("list", List.class);
registerAlias("arraylist", ArrayList.class);
registerAlias("collection", Collection.class);
registerAlias("iterator", Iterator.class);
registerAlias("ResultSet", ResultSet.class);
}
@SuppressWarnings("unchecked")
// throws class cast exception as well if types cannot be assigned
public <T> Class<T> resolveAlias(String string) {
try {
if (string == null) return null;
String key = string.toLowerCase(Locale.ENGLISH); // issue #748
Class<T> value;
if (TYPE_ALIASES.containsKey(key)) {
value = (Class<T>) TYPE_ALIASES.get(key);
} else {
value = (Class<T>) Resources.classForName(string);
}
return value;
} catch (ClassNotFoundException e) {
throw new TypeException("Could not resolve type alias '" + string + "'. Cause: " + e, e);
}
}
public void registerAliases(String packageName){
registerAliases(packageName, Object.class);
}
public void registerAliases(String packageName, Class<?> superType){
ResolverUtil<Class<?>> resolverUtil = new ResolverUtil<Class<?>>();
resolverUtil.find(new ResolverUtil.IsA(superType), packageName);
Set<Class<? extends Class<?>>> typeSet = resolverUtil.getClasses();
for(Class<?> type : typeSet){
// Ignore inner classes and interfaces (including package-info.java)
// Skip also inner classes. See issue #6
if (!type.isAnonymousClass() && !type.isInterface() && !type.isMemberClass()) {
registerAlias(type);
}
}
}
public void registerAlias(Class<?> type) {
String alias = type.getSimpleName();
org.apache.ibatis.type.Alias aliasAnnotation = type.getAnnotation(Alias.class);
if (aliasAnnotation != null) {
alias = aliasAnnotation.value();
}
registerAlias(alias, type);
}
public void registerAlias(String alias, Class<?> value) {
if (alias == null) throw new TypeException("The parameter alias cannot be null");
String key = alias.toLowerCase(Locale.ENGLISH); // issue #748
if (TYPE_ALIASES.containsKey(key) && TYPE_ALIASES.get(key) != null && !TYPE_ALIASES.get(key).equals(value)) {
throw new TypeException("The alias '" + alias + "' is already mapped to the value '" + TYPE_ALIASES.get(key).getName() + "'.");
}
TYPE_ALIASES.put(key, value);
}
public void registerAlias(String alias, String value) {
try {
registerAlias(alias, Resources.classForName(value));
} catch (ClassNotFoundException e) {
throw new TypeException("Error registering type alias "+alias+" for "+value+". Cause: " + e, e);
}
}
/**
* @since 3.2.2
*/
public Map<String, Class<?>> getTypeAliases() {
return Collections.unmodifiableMap(TYPE_ALIASES);
}
}
| [
"995548830@qq.com"
] | 995548830@qq.com |
6c3440fbc57ac009c5d23b7d3173a585a8bcabef | cb50ef9b55cd54978bbb7c339c73311b0b2cf2fb | /app/src/main/java/com/moon/gossipnews/contant/UrlStrings.java | 950a936ca6b22225edbc6c56e8f702081af5ff9f | [
"Apache-2.0"
] | permissive | Hubyu/GossipNews | 4e60fe876b3f95420dd97375dc36e421f40d6816 | dac92b0b2a8d7cd389aa0ecd60ee0f3d7e9aa69e | refs/heads/master | 2021-01-17T20:30:09.069699 | 2016-07-25T04:07:33 | 2016-07-25T04:07:33 | 63,742,123 | 0 | 0 | null | 2016-07-20T02:05:47 | 2016-07-20T02:05:47 | null | UTF-8 | Java | false | false | 403 | java | package com.moon.gossipnews.contant;
/**
* Created by Administrator on 2016/7/20.
*/
public class UrlStrings {
public static final String URL_HOT = "http://www.jinrongbaguanv.com/jinba/index_articles/1";
public static final String URL_CONTENT = "http://www.jinrongbaguanv.com/jinba/article/";
// public static final String URL_CONTENT = "http://www.jinrongbaguanv.com/jinba/article/s%";
}
| [
"1390369755@qq.com"
] | 1390369755@qq.com |
4696019038a467828fe3c92c21f11c060b140396 | a08020d9f583ab20fd93ce3208c0395c358673cf | /app/src/main/java/com/techbeloved/moviesbeloved/data/source/local/FavoriteDatabase.java | 391b40acb5a0917a56004d8fc324e7b2619f80f5 | [] | no_license | odifek/MoviesBeloved | 9230c564ed615663e2633a44696cb626c4da8a55 | 458b3821d1b222dc94ef853ca1d9557432b8d45b | refs/heads/master | 2020-03-28T23:24:28.116990 | 2019-11-17T22:27:07 | 2019-11-17T22:27:07 | 149,289,891 | 1 | 0 | null | 2018-09-29T21:41:42 | 2018-09-18T13:07:53 | Java | UTF-8 | Java | false | false | 769 | java | package com.techbeloved.moviesbeloved.data.source.local;
import androidx.room.Database;
import androidx.room.RoomDatabase;
import androidx.room.TypeConverters;
import com.techbeloved.moviesbeloved.data.models.MovieEntity;
import com.techbeloved.moviesbeloved.data.models.ReviewEntity;
import com.techbeloved.moviesbeloved.data.models.VideoEntity;
@Database(entities = {MovieEntity.class, ReviewEntity.class, VideoEntity.class}, version = 4, exportSchema = false)
@TypeConverters({DateConverter.class, ListConverter.class})
public abstract class FavoriteDatabase extends RoomDatabase {
private static FavoriteDatabase INSTANCE;
public abstract MoviesDao moviesDao();
public abstract ReviewsDao reviewsDao();
public abstract VideosDao videosDao();
}
| [
"kennedy998@gmail.com"
] | kennedy998@gmail.com |
95b38ec504bcb69516b625bd9efdfcb96d67b410 | eb44f148f8192d21cd4464ce800556a4004a2e22 | /ts_client/src/main/java/com/xlinclass/utils/HttpUtil.java | 2ca53d9c6fa1f11b995cda861659ab829d0251a8 | [] | no_license | taoshengyijiupro/distributed_transaction | 64b70b5fcaf2f6255e9119070dbf58c6739dd130 | 14d58b329fe1b6d02c9795e902c18fc861f7e8da | refs/heads/master | 2022-07-25T01:07:18.486330 | 2019-09-01T17:35:56 | 2019-09-01T17:35:56 | 205,710,180 | 0 | 0 | null | 2022-06-21T01:47:30 | 2019-09-01T17:32:13 | Java | UTF-8 | Java | false | false | 963 | java | package com.xlinclass.utils;
import com.xlinclass.transaction.TransactionUtil;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
/**
* <p>Description: </p>
* <p>blog: http://www.xlinclass.com</p>
*
* @author 涛声依旧
* @date 2019/8/24 16:15
*/
@Component
public class HttpUtil {
private static RestTemplate restTemplate = new RestTemplate();
public static Object post(String url){
HttpHeaders header = new HttpHeaders();
header.set("groupId", TransactionUtil.getCurrent());
header.set("transactionCount", String.valueOf(TransactionUtil.getCount()));
HttpEntity<MultiValueMap<String, String>> httpEntity = new HttpEntity<>(null, header);
return restTemplate.postForObject(url,httpEntity,Object.class);
}
}
| [
"1035399264@qq.com"
] | 1035399264@qq.com |
b87b4cc722224762f2958d8ababc19fc34dd1c47 | b9144725bc82c1d95447d9b29c3432f8310dddbe | /GPA++/GPA++/src/com/gpa/presentation/ClassHistory.java | 29a5ef7db94116f45afc7fe3ef410206b918dab5 | [] | no_license | EmilySu/AndroidApp | 16b60ed9574a6e2a60dc3923116b9655eac874b2 | b962ae1d862866e16d20746a021369db62c8bf58 | refs/heads/master | 2016-09-05T23:21:02.536216 | 2014-02-11T04:19:02 | 2014-02-11T04:19:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,914 | java | package com.gpa.presentation;
import java.util.ArrayList;
import DBLayout.DBFunc;
import android.app.Activity;
import android.content.Intent;
import android.database.Cursor;
import android.os.Bundle;
import android.text.Html;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;
import com.gpa.R;
import entities.NoteAdapter;
public class ClassHistory extends Activity
{
//static final String[] images = new String[] { "image1", "image2" };
//static final String[] videos = new String[] { "video1", "video2" };
//static final String[] audios = new String[] { "audio1", "audio2" };
ArrayList<String> categories;
int classId;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.com_gpa_presentation_activity_class_history);
Bundle extras = getIntent().getExtras();
classId = extras.getInt("classId");
DBshare dbshare = (DBshare) getApplication();
DBFunc dbfunc = dbshare.getDbfunc();
Cursor c = dbfunc.displayCategories(classId);
categories = (new NoteAdapter()).adapteNoteCategories(c);
ListView lv_category = (ListView) findViewById(R.id.lv_lectures);
lv_category.setTextFilterEnabled(true);
//show an empty list message if there are no recorded notes
if (categories.isEmpty())
{
categories.add("No recorded notes in previous lectures,\nPlease record a note.");
lv_category.setEnabled(false);
}
else
{
lv_category.setEnabled(true);
}
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, categories)
{
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
View view = super.getView(position, convertView, parent);
TextView text1 = (TextView) view.findViewById(android.R.id.text1);
text1.setText(Html.fromHtml(formatCategories(categories.get(position).split(",")[0],
categories.get(position).split(",")[1])));
return view;
}
};
lv_category.setAdapter(adapter);
lv_category.setOnItemClickListener(new OnItemClickListener()
{
public void onItemClick(AdapterView<?> parent, View view, int position, long id)
{
String category = categories.get(position).split(",")[0];
Intent intent = new Intent(ClassHistory.this, NotesDetail.class);
intent.putExtra("noteCategory", category);
intent.putExtra("classId", classId);
startActivity(intent);
}
});
}
public String formatCategories(String category, String date)
{
String ret = "<b>" + category + "</b><br/><small>" + date;
return ret + "</small>";
}
}
| [
"emilyycg@gmail.com"
] | emilyycg@gmail.com |
e1d1b8216dccf5aff53656f8d02c6250d37e287a | 3c4763922cda3f3a990b74cdba6f8a30b07467de | /src/main/java/students/deniss_jankovskis/lesson_11/level_2/CountAllBooksTest.java | 5e6cbc8d56feab98bbece14336690b7e8dbd06f2 | [] | 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 | 2,083 | java | package students.deniss_jankovskis.lesson_11.level_2;
class CountAllBooksTest {
public static void main(String[] args) {
CountAllBooksTest test = new CountAllBooksTest();
test.countAllBooksTest1();
test.countAllBooksTest2();
test.countAllBooksTest3();
}
public void countAllBooksTest1() {
Book book1 = new Book("F. Scott Fitzgerald", "The Great Gatsby");
Book book2 = new Book("Leo Tolstoy", "War and Peace");
Book book3 = new Book("Gustave Flaubert", "Madame Bovary");
BookDatabaseImpl bookDatabase = new BookDatabaseImpl();
bookDatabase.save(book1);
int realResult = bookDatabase.countAllBooks();
checkTestResult(realResult, 1, "Count All Books Test 1");
}
public void countAllBooksTest2() {
Book book1 = new Book("F. Scott Fitzgerald", "The Great Gatsby");
Book book2 = new Book("Leo Tolstoy", "War and Peace");
Book book3 = new Book("Gustave Flaubert", "Madame Bovary");
BookDatabaseImpl bookDatabase = new BookDatabaseImpl();
bookDatabase.save(book1);
bookDatabase.save(book2);
int realResult = bookDatabase.countAllBooks();
checkTestResult(realResult, 2, "Count All Books Test 2");
}
public void countAllBooksTest3() {
Book book1 = new Book("F. Scott Fitzgerald", "The Great Gatsby");
Book book2 = new Book("Leo Tolstoy", "War and Peace");
Book book3 = new Book("Gustave Flaubert", "Madame Bovary");
BookDatabaseImpl bookDatabase = new BookDatabaseImpl();
bookDatabase.save(book1);
bookDatabase.save(book2);
bookDatabase.save(book3);
int realResult = bookDatabase.countAllBooks();
checkTestResult(realResult, 3, "Count All Books Test 3");
}
public void checkTestResult(int realResult, int expectedResult, String testName) {
if (realResult == expectedResult) {
System.out.println(testName + " = OK");
} else {
System.out.println(testName + " = FALSE");
}
}
}
| [
"denissjankovskis@outlook.com"
] | denissjankovskis@outlook.com |
c3d0a5ce0971d813c97a06c78ba27627f0ed9aec | 3d1d79d14f0f9f4f65a9fa55aafeca419b70e18d | /app/src/main/java/com/mseptember/tubefav/ui/detailvideos/VideoDetailActivity.java | 80f7618d87f9a6ce161cc0eac31af9d9d38e8b4b | [] | no_license | MyricSeptember/TubeFav | 483d8807a7c8529e221b7d2efaff4a030cd9e8cd | ba3b18b5ae96c5aacaf169cd94f2de5009895501 | refs/heads/master | 2021-04-29T12:09:20.678058 | 2018-02-21T13:49:11 | 2018-02-21T13:49:11 | 121,723,880 | 2 | 0 | null | null | null | null | UTF-8 | Java | false | false | 981 | java | package com.mseptember.tubefav.ui.detailvideos;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.app.AppCompatActivity;
import com.mseptember.tubefav.R;
import com.mseptember.tubefav.injection.Injectable;
import javax.inject.Inject;
import dagger.android.AndroidInjector;
import dagger.android.DispatchingAndroidInjector;
import dagger.android.support.HasSupportFragmentInjector;
public class VideoDetailActivity extends AppCompatActivity implements HasSupportFragmentInjector, Injectable {
@Inject
DispatchingAndroidInjector<Fragment> supportFragmentInjector;
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail_activity);
}
@Override
public AndroidInjector<Fragment> supportFragmentInjector() {
return supportFragmentInjector;
}
}
| [
"MSeptember@jhb.dvt.co.za"
] | MSeptember@jhb.dvt.co.za |
e2b462c6db2f9269b4b8855112764738180839e7 | a4411d688395ff7351609e3a3eba16e3a05e347e | /projekatt/Durag-backend-projekat/src/main/java/com/durag/service/UserService.java | 82a1a8b728191341ba5da6fc35e19b23eb363514 | [] | no_license | milos-dragovic/projekatNJT | cac0443df2dbb2981be709e5489c2cec6fd09678 | 3a77aa25e41bdbe367b6d003afabc7944495de4e | refs/heads/master | 2022-12-13T21:52:17.259405 | 2019-12-15T19:23:49 | 2019-12-15T19:23:49 | 228,215,056 | 0 | 0 | null | 2022-12-11T17:18:22 | 2019-12-15T16:27:33 | CSS | UTF-8 | Java | false | false | 244 | java | package com.durag.service;
import java.util.List;
import com.durag.model.User;
/**
* UserService interfejs
* */
public interface UserService{
User findByUserName(String userName);
User save(User user);
List<User> findAllUsers();
}
| [
"milosh.dr93@yahoo.com"
] | milosh.dr93@yahoo.com |
19d794653bfecd10878acce29a87447b4ee6e3df | 312150cdb29a686ec8462abb991c1f05d64a2c22 | /buffer/src/main/java/io/atomix/catalyst/buffer/SwappedBuffer.java | a69296ca57809c4c42a221ad0dafd6027e84b498 | [
"Apache-2.0"
] | permissive | y-higuchi/catalyst | 67ede205bca392017f6eef8bc5bbb4411aad808a | a81d4305595415815a2497f5eafae0fca4677552 | refs/heads/master | 2021-01-24T21:57:49.827231 | 2016-05-02T06:45:45 | 2016-05-02T06:45:45 | 58,782,180 | 0 | 0 | null | 2016-05-14T00:50:55 | 2016-05-14T00:50:52 | Java | UTF-8 | Java | false | false | 2,242 | java | /*
* Copyright 2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.atomix.catalyst.buffer;
import io.atomix.catalyst.util.ReferenceManager;
import java.nio.ByteOrder;
/**
* Byte order swapped buffer.
*
* @author <a href="http://github.com/kuujo">Jordan Halterman</a>
*/
public class SwappedBuffer extends AbstractBuffer {
private final Buffer root;
SwappedBuffer(Buffer root, Bytes bytes, ReferenceManager<Buffer> referenceManager) {
super(bytes, referenceManager);
this.root = root;
}
public SwappedBuffer(Buffer buffer, long offset, long initialCapacity, long maxCapacity, ReferenceManager<Buffer> referenceManager) {
super(buffer.bytes().order(buffer.order() == ByteOrder.BIG_ENDIAN ? ByteOrder.LITTLE_ENDIAN : ByteOrder.BIG_ENDIAN), offset, initialCapacity, maxCapacity, referenceManager);
this.root = buffer instanceof SwappedBuffer ? ((SwappedBuffer) buffer).root : buffer;
root.acquire();
}
/**
* Returns the root buffer.
*
* @return The root buffer.
*/
public Buffer root() {
return root;
}
@Override
public boolean isDirect() {
return root.isDirect();
}
@Override
public boolean isFile() {
return root.isFile();
}
@Override
public boolean isReadOnly() {
return root.isReadOnly();
}
@Override
protected void compact(long from, long to, long length) {
if (root instanceof AbstractBuffer) {
((AbstractBuffer) root).compact(from, to, length);
}
}
@Override
public Buffer acquire() {
root.acquire();
return this;
}
@Override
public boolean release() {
return root.release();
}
@Override
public void close() {
root.release();
}
}
| [
"jordan.halterman@gmail.com"
] | jordan.halterman@gmail.com |
ef35cb7fff5db381bd019accb31251aba5fa69b5 | e77893848a20f9e954b92614ba3b99be9b2503dc | /src/main/java/br/com/rpires/hackerrank/binary/Trees.java | 7ffe3a62862cc87555a584e460cdbdca96dff4f5 | [] | no_license | digaomilleniun/HackerRank | bd0c4f5f10ea8ccb8e79f2aa2e5c7710ed62b31f | 3addbd6149f376a4ac724170c3d0b16b0c1bce99 | refs/heads/master | 2021-01-01T19:48:13.568811 | 2017-09-08T02:20:04 | 2017-09-08T02:20:04 | 98,690,346 | 2 | 1 | null | null | null | null | UTF-8 | Java | false | false | 1,975 | java | /**
*
*/
package br.com.rpires.hackerrank.binary;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* @author Rodrigo Pires
*
* EX: Is This a Binary Search Tree?
*
*/
public class Trees {
static boolean checkBST(Node root) {
boolean result = true;
result = checkBSTLeft(root, root.data, result);
return result;
}
static boolean checkBSTLeft(Node node, int data, boolean result) {
while (result == true) {
if (node.left != null) {
if (node.left.data >= data) {
result = false;
break;
} else if (node.left.data < data) {
//checkBSTLeft(node.left);
}
}
}
return true;
}
public static void main(String[] args) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Digite o numero que sera o node master.\n");
String master = in.readLine();
System.out.print("Digite os numeros separados por virgula para montar a arvore binaria:\n");
String str = in.readLine();
String[] valores = str.split(",");
Node node = criarNode(master, str, valores);
boolean result = checkBST(node);
System.out.println(result);
}
private static Node criarNode(String master, String str, String[] valores) {
Node nodeMaster = new Node(Integer.parseInt(master));
for (int i = 0; i < str.length(); i++) {
nodeMaster.inserirNode(Integer.parseInt(valores[i]));
}
return nodeMaster;
}
}
class Node {
int data;
Node left;
Node right;
public Node(int data) {
this.data = data;
}
public void inserirNode(int data) {
inserirNode(this, data);
}
private void inserirNode(Node node, int data) {
if (data < node.data) {
if (node.left != null) {
inserirNode(node.left, data);
} else {
node.left = new Node(data);
}
} else {
if (node.right != null) {
inserirNode(node.right, data);
} else {
node.right = new Node(data);
}
}
}
}
| [
"digaomilleniun@gmail.com"
] | digaomilleniun@gmail.com |
5b6a8d7cf924362621650b25a841c1c7d8f898cd | bd35936321650b3d74e82674e22e9b3c0d0f89af | /app/src/main/java/com/pkeugine/whewigo/detail/DetailActivity.java | 493b7b73b7d2efd0b7281af995b2c3ec14d6b250 | [] | no_license | pkeugine/JustGo | 35926a74191f0059bd0902d43ccdf7bd5154a4de | c9d3a15f891757491e560dc32e4348cce70c5424 | refs/heads/master | 2021-07-19T15:02:39.403042 | 2020-08-29T09:53:46 | 2020-08-29T09:53:46 | 205,986,263 | 7 | 5 | null | 2020-08-06T13:44:47 | 2019-09-03T04:04:01 | Java | UTF-8 | Java | false | false | 14,933 | java | package com.pkeugine.whewigo.detail;
import androidx.annotation.NonNull;
import android.content.Intent;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.text.method.ScrollingMovementMethod;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.pkeugine.whewigo.R;
import com.pkeugine.whewigo.common.BaseActivity;
import com.pkeugine.whewigo.data.Detail;
import com.pkeugine.whewigo.data.Review;
import com.pkeugine.whewigo.common.GpsTracker;
import com.pkeugine.whewigo.common.RetrofitExService;
import com.google.gson.JsonObject;
import com.skt.Tmap.TMapInfo;
import com.skt.Tmap.TMapMarkerItem;
import com.skt.Tmap.TMapPoint;
import com.skt.Tmap.TMapView;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import retrofit2.Retrofit;
import retrofit2.converter.gson.GsonConverterFactory;
public class DetailActivity extends BaseActivity {
@BindView(R.id.linearLayoutTmap)
LinearLayout linearLayoutTmap;
@BindView(R.id.text_title)
TextView textTitle;
@BindView(R.id.address)
TextView addressView;
@BindView(R.id.address_num)
TextView addressNumView;
@BindView(R.id.address_num_field)
LinearLayout addressNumViewField;
@BindView(R.id.tel_no)
TextView telNoView;
@BindView(R.id.park_flag)
TextView parkFlagView;
@BindView(R.id.additional_info)
TextView additionalInfoView;
@BindView(R.id.desc)
TextView descView;
@BindView(R.id.tel_field)
LinearLayout telField;
@BindView(R.id.park_field)
LinearLayout parkField;
@BindView(R.id.additional_field)
LinearLayout additionalField;
@BindView(R.id.desc_field)
LinearLayout descField;
@BindView(R.id.nick_name)
TextView nickNameView;
@BindView(R.id.point)
TextView pointView;
@BindView(R.id.comment)
TextView commentView;
@BindView(R.id.add_review)
Button addReview;
@BindView(R.id.more_reviews)
Button moreReviews;
@BindView(R.id.confirm)
Button confirmButton;
// 뒤로가기 버튼
@OnClick(R.id.title_back)
public void back() {
onBackPressed();
}
// 경토 탐색 버튼
@OnClick(R.id.path_search)
public void pathSearch() {
Intent intent = new Intent(DetailActivity.this, PathSearchActivity.class);
intent.putExtra("endLat", placeLat);
intent.putExtra("endLon", placeLon);
startActivity(intent);
}
// 현 위치 버튼
@OnClick(R.id.current_pos)
public void current() {
ArrayList<TMapPoint> arrays = new ArrayList<>();
arrays.add(myPoint);
arrays.add(placePoint);
TMapInfo info = tMapView.getDisplayTMapInfo(arrays);
Log.d("result", "info : " + info.getTMapZoomLevel() + "," + tMapView.getZoomLevel());
tMapView.setZoomLevel(info.getTMapZoomLevel());
tMapView.setCenterPoint(gpsTracker.getLongitude(), gpsTracker.getLatitude());
}
private GpsTracker gpsTracker;
private TMapView tMapView;
private TMapPoint myPoint;
private TMapPoint placePoint;
private TMapMarkerItem placeMarker;
private TMapMarkerItem myMarker;
private String TmapapiKey;
private String TourapiKey;
private String poiId;
private String addressName;
private int keyType;
private double placeLat;
private double placeLon;
private Detail.PoiDetailInfo detail;
private Review review;
private int responseCount;
private int mposition;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_detail);
ButterKnife.bind(this);
TmapapiKey = getMetadata(this, "com.pkeugine.jhw.TmapKey");
TourapiKey = getMetadata(this, "com.pkeugine.jhw.TourKey");
showWaitingDialog();
// 이전 액티비티에서 넘어온 정보 받아오기
Intent intent = this.getIntent();
if (intent != null) {
if (intent.getIntExtra("keytype", -1) != -1) {
keyType = intent.getIntExtra("keytype", -1);
}
if (intent.getIntExtra("position", 0) != 0) {
mposition = intent.getIntExtra("position", 0);
}
if (intent.getStringExtra("poiId") != null && intent.getStringExtra("addressname") != null) {
poiId = intent.getStringExtra("poiId");
addressName = intent.getStringExtra("addressname");
} else {
Log.e("getData error", "======================================");
onBackPressed();
}
}
getData();
}
// 상세정보, 리뷰 정보 받아오기 ( 네트워크 통신 )
private void getData() {
responseCount = 1;
getDetails();
//getReviews();
}
// 상세정보 받아오기
private void getDetails() {
if(keyType==3) {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(RetrofitExService.Tour_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
RetrofitExService retrofitExService = retrofit.create(RetrofitExService.class);
Call<JsonObject> call = retrofitExService.getTourDetailData(TourapiKey,"AND","Whewigo", poiId,'Y','Y','Y','Y', "json");
Log.d("pppath : ", call.request().url().toString() + "");
call.enqueue(new Callback<JsonObject>() {
@Override
public void onResponse(@NonNull Call<JsonObject> call, @NonNull Response<JsonObject> response) {
if (response.isSuccessful()) {
Log.d("getData unfail", "==============================count" + responseCount);
JsonObject tourDetailInfo = response.body().get("response").getAsJsonObject().get("body").getAsJsonObject().get("items").getAsJsonObject().get("item").getAsJsonObject();
StringBuilder address = new StringBuilder();
address.append(tourDetailInfo.get("addr1"));
if(tourDetailInfo.has("addr2")) { address.append(tourDetailInfo.get("addr2").getAsString()); }
detail = new Detail.PoiDetailInfo();
detail.setAddress(address.toString());
if(tourDetailInfo.has("tel")) { detail.setTel(tourDetailInfo.get("tel").getAsString()); }
if(tourDetailInfo.has("overview")) {
String desc = tourDetailInfo.get("overview").getAsString();
desc = desc.replaceAll("<br />","\n");
desc = desc.replaceAll("<br>","\n");
desc = desc.replaceAll("<b>","");
desc = desc.replaceAll("</b>","");
detail.setDesc(desc);
}
if(tourDetailInfo.has("mapx")) { detail.setLon(tourDetailInfo.get("mapx").getAsDouble()); }
if(tourDetailInfo.has("mapy")) { detail.setLat(tourDetailInfo.get("mapy").getAsDouble()); }
if(tourDetailInfo.has("contentid")) { detail.setId(tourDetailInfo.get("contentid").getAsString()); }
if(tourDetailInfo.has("title")) { detail.setName(tourDetailInfo.get("title").getAsString()); }
if (responseCount >= 1) init();
else responseCount++;
}
}
@Override
public void onFailure(@NonNull Call<JsonObject> call, @NonNull Throwable t) {
Log.e("getData fail", "======================================");
}
});
} else {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(RetrofitExService.Tmap_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
RetrofitExService retrofitExService = retrofit.create(RetrofitExService.class);
Call<Detail> call = retrofitExService.getDetailData(poiId, 1, TmapapiKey);
Log.d("pppath : ", call.request().url().toString() + "");
call.enqueue(new Callback<Detail>() {
@Override
public void onResponse(@NonNull Call<Detail> call, @NonNull Response<Detail> response) {
if (response.isSuccessful()) {
Log.d("getData unfail", "==============================count" + responseCount);
detail = response.body().getPoiDetailInfo();
if (responseCount >= 1) init();
else responseCount++;
}
}
@Override
public void onFailure(@NonNull Call<Detail> call, @NonNull Throwable t) {
Log.e("getData fail", "======================================");
}
});
}
}
// 리뷰정보 받아오기
private void getReviews() {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(RetrofitExService.DB_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
RetrofitExService retrofitExService = retrofit.create(RetrofitExService.class);
Call<List<Review>> call = retrofitExService.useDB("select.jsp", Integer.parseInt(poiId));
call.enqueue(new Callback<List<Review>>() {
@Override
public void onResponse(@NonNull Call<List<Review>> call, @NonNull Response<List<Review>> response) {
if (response.isSuccessful()) {
List<Review> body = response.body();
if (body != null) {
review = body.get(0);
Log.d("getData unfail", "==============================count" + responseCount);
nickNameView.setText(review.getUserId());
pointView.setText(review.getGrade() + "");
commentView.setText(review.getOpinion());
if (responseCount >= 1) init();
else responseCount++;
}
}
}
@Override
public void onFailure(@NonNull Call<List<Review>> call, @NonNull Throwable t) {
Log.e("getData fail", "======================================");
}
});
}
// 뷰 초기화 및 보여주기
private void init() {
textTitle.setText(detail.getName());
// 마커 표시
placeLat = detail.getLat();
placeLon = detail.getLon();
tMapView = new TMapView(this);
tMapView.setSKTMapApiKey(TmapapiKey);
// 현위치
gpsTracker = new GpsTracker(DetailActivity.this);
myPoint = new TMapPoint(gpsTracker.getLatitude(), gpsTracker.getLongitude());
myMarker = new TMapMarkerItem();
myMarker.setTMapPoint(myPoint);
myMarker.setName("현위치");
myMarker.setVisible(TMapMarkerItem.VISIBLE);
myMarker.setIcon(BitmapFactory.decodeResource(getResources(), R.drawable.i_location));
myMarker.setPosition((float) 0.5, 1);
tMapView.addMarkerItem("mypos", myMarker);
tMapView.setCenterPoint(placeLon, placeLat);
placePoint = new TMapPoint(placeLat, placeLon);
placeMarker = new TMapMarkerItem();
placeMarker.setTMapPoint(placePoint);
placeMarker.setCanShowCallout(true);
placeMarker.setAutoCalloutVisible(true);
placeMarker.setCalloutTitle(detail.getName());
tMapView.addMarkerItem("placepos", placeMarker);
linearLayoutTmap.addView(tMapView);
tMapView.bringMarkerToFront(placeMarker);
if(keyType==3) {
addressNumViewField.setVisibility(View.GONE);
parkField.setVisibility(View.GONE);
additionalField.setVisibility(View.GONE);
addressView.setText(addressName);
if (!detail.getTel().equals("")) {
telNoView.setText(detail.getTel());
} else {
telField.setVisibility(View.GONE);
}
descView.setMovementMethod(ScrollingMovementMethod.getInstance());
if (!detail.getDesc().equals("")) descView.setText(detail.getDesc());
else {
descField.setVisibility(View.GONE);
}
} else {
// 상세 정보
addressView.setText(addressName);
if (detail.getFirstNo().isEmpty() || detail.getSecondNo().isEmpty()) {
addressNumView.setText(detail.getFirstNo() + "-" + detail.getSecondNo());
} else {
addressNumViewField.setVisibility(View.GONE);
}
if (!detail.getTel().equals("")) {
telNoView.setText(detail.getTel());
} else {
telField.setVisibility(View.GONE);
}
if (detail.getParkFlag().equals("1")) parkFlagView.setText("가능");
else if (detail.getParkFlag().equals("0")) parkFlagView.setText("불가능");
else {
parkField.setVisibility(View.GONE);
}
additionalInfoView.setMovementMethod(ScrollingMovementMethod.getInstance());
if (!detail.getAdditionalInfo().equals("")) {
String[] strs = detail.getAdditionalInfo().split(";");
StringBuilder sb = new StringBuilder();
for (int i = 0; i < strs.length; i++) {
sb.append(strs[i] + "\n");
}
sb.deleteCharAt(sb.length() - 1);
additionalInfoView.setText(sb.toString());
} else {
additionalField.setVisibility(View.GONE);
}
descView.setMovementMethod(ScrollingMovementMethod.getInstance());
if (!detail.getDesc().equals("")) descView.setText(detail.getDesc());
else {
descField.setVisibility(View.GONE);
}
}
confirmButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent resultIntent = new Intent();
resultIntent.putExtra("returnPos", mposition);
setResult(RESULT_OK,resultIntent);
finish();
}
});
cancelWaitingDialog();
}
} | [
"pkeugine@gmail.com"
] | pkeugine@gmail.com |
80577625599804cb6c33b6f60e1d9a889c0d13f3 | 7c04fdc109483ed13f68380b9408215a2abba0c0 | /test/com/twu/biblioteca/BibliotecaAppTest.java | ed0854dfae1a435ded2c5053df32bd01f94f86f9 | [
"Apache-2.0"
] | permissive | fernandotelles/twu-biblioteca-fernandotelles | 63d630eda9552adb98058a887c4a613d4d19e3e3 | d81f15905139baa3e7db0edc65835b25f8ca0114 | refs/heads/master | 2020-03-22T18:37:54.908306 | 2018-07-17T15:00:37 | 2018-07-17T15:00:37 | 140,471,996 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 722 | java | package com.twu.biblioteca;
import org.junit.Test;
import java.io.OutputStream;
import java.io.PrintStream;
import static org.junit.Assert.assertEquals;
public class BibliotecaAppTest {
private static final String WELCOME_MESSAGE = "Hello!";
@Test
public void testAppShowsAWelcomeMessageWhenItStarts() {
final StringBuilder actualWelcomeMessage = new StringBuilder();
System.setOut(new PrintStream(new OutputStream() {
@Override
public void write(int b) {
actualWelcomeMessage.append((char)b);
}
}));
BibliotecaApp.main(new String[0]);
assertEquals(WELCOME_MESSAGE, actualWelcomeMessage.toString());
}
} | [
"fernandotalves@gmail.com"
] | fernandotalves@gmail.com |
66e3cb29688654310bd7b9ce6e5a6c978211eebf | a08f0c2e3e492c364f035d3b3b5fc4c29611e7c9 | /testing-application-from-scatch/junit-5-fundamentals/06/demos/m5/Module5Gradle/src/test/java/com/wiredbraincoffee/reward/tests/RewardByConversionServiceTest.java | 5cdcd3f5c49bb0a5377ed06c06fa91ff9c738719 | [] | no_license | chamanbharti/java-works | 9832eb8ba6a81c88250fa81a71fa9db728993cd3 | aec6b503bde515dc174b23404c936635a7f59add | refs/heads/master | 2023-04-26T16:49:48.915313 | 2021-05-31T12:44:50 | 2021-05-31T12:44:50 | 328,213,982 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,798 | java | package com.wiredbraincoffee.reward.tests;
import com.wiredbraincoffee.reward.RewardByConversionService;
import com.wiredbraincoffee.reward.RewardInformation;
import com.wiredbraincoffee.reward.RewardService;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class RewardByConversionServiceTest implements TestHelper {
private RewardByConversionService reward = null;
@BeforeEach
void setUp() {
reward = new RewardByConversionService();
reward.setAmount(10);
reward.setNeededPoints(100);
}
@Test
@DisplayName("Correct amount is set")
void correctAmount() {
assertEquals(10, reward.getAmount());
}
@Test
@DisplayName("When empty order and zero points no rewards should be applied")
void emptyOrderZeroPoints() {
RewardInformation info = reward.applyReward(getEmptyOrder(), 0);
assertEquals(0, info.getDiscount());
assertEquals(0, info.getPointsRedeemed());
}
@Test
@DisplayName("When not enough points no rewards should be applied")
void notEnoughPoints() {
RewardInformation info = reward.applyReward(getSampleOrder(), 10);
assertEquals(0, info.getDiscount());
assertEquals(0, info.getPointsRedeemed());
}
@Test
@DisplayName("When empty order and enough points no rewards should be applied")
void emptyOrderEnoughPoints() {
RewardInformation info = reward.applyReward(getEmptyOrder(), 200);
assertEquals(0, info.getDiscount());
assertEquals(0, info.getPointsRedeemed());
}
@Override
public RewardService getRewardService() {
return reward;
}
}
| [
"chaman.bharti84@gmail.com"
] | chaman.bharti84@gmail.com |
1b91baaeef895547912e41e0ccc3a59c11c7a8d4 | e164699b6fd5b3d014a8f65d9036f8e3c89b1381 | /src/test/java/de/aschoerk/javaconv/Base.java | b8acc2706a1ce393bc7b29fb2f9388c35d2a06bf | [
"Apache-2.0"
] | permissive | aschoerk/converter-page | 43ee6c0bed8e353bae0d74d0f413b3ebb76f007a | 03c43e283236c94a468282b7dbf124851e34a15d | refs/heads/master | 2022-02-27T21:26:05.165227 | 2022-02-09T09:30:00 | 2022-02-09T09:30:00 | 57,377,736 | 53 | 9 | null | 2019-05-21T10:42:25 | 2016-04-29T10:49:54 | Java | UTF-8 | Java | false | false | 278 | java | package de.aschoerk.javaconv;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
/**
* Created by aschoerk on 15.05.16.
*/
@RunWith(JUnit4.class)
public class Base {
protected String call(String s) {
return JavaConverter.convert2Rust(s);
}
}
| [
"Blau28%"
] | Blau28% |
87e9613f77181fd19535629dc19497ee8fac7215 | 2fa6639cab62e9ce19b5edd4c3048c8df8682c9c | /src/org/rs2server/rs2/tickable/impl/CleanupTick.java | 2e6bf20be6abdfee3300c1a43c39e5896e66097c | [
"MIT"
] | permissive | kewle003/hyperion | c320f6c217ac9177e1fe842f101cb3e7fce2dc83 | 35c24a0127b844ab2ce3d8168db6b933aee33a29 | refs/heads/master | 2021-01-19T00:16:03.714756 | 2013-11-25T04:56:15 | 2013-11-25T04:56:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 702 | java | package org.rs2server.rs2.tickable.impl;
import org.rs2server.rs2.model.World;
import org.rs2server.rs2.task.impl.CleanupTask;
import org.rs2server.rs2.tickable.Tickable;
/**
* A tickable which runs periodically and performs tasks such as garbage
* collection.
* @author Graham Edgecombe
*
*/
public class CleanupTick extends Tickable {
/**
* The delay in ticks between consecutive cleanups.
*/
public static final int CLEANUP_CYCLE_TIME = 500;
/**
* Creates the cleanup event to run every 5 minutes.
*/
public CleanupTick() {
super(CLEANUP_CYCLE_TIME);
}
@Override
public void execute() {
World.getWorld().submit(new CleanupTask());
}
}
| [
"markkewley@hotmail.com"
] | markkewley@hotmail.com |
d9427c0deadb297db3259d33cf4136553d61fd8c | ad1b8eabae5a606215a24e549da12ed15d0a1ad3 | /Lecture10/TodoWithDB/app/src/main/java/me/bhavyaaggarwal/todowithdb/MainActivity.java | f895a68493c9b5c84c45f68901ca0daa4b1000b3 | [] | no_license | bhavyaagg/CB-Pandora | 444406d8e05401045d9a058b45c5a9d0a74a456c | ff686e75cdbe5add647b68c9be6593cdb052c31c | refs/heads/master | 2021-03-19T15:36:47.650556 | 2018-01-27T08:11:59 | 2018-01-27T08:11:59 | 114,443,772 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,685 | java | package me.bhavyaaggarwal.todowithdb;
import android.database.sqlite.SQLiteDatabase;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import java.util.ArrayList;
import me.bhavyaaggarwal.todowithdb.adapters.TodoAdapter;
import me.bhavyaaggarwal.todowithdb.db.TodoDatabaseHelper;
import me.bhavyaaggarwal.todowithdb.db.tables.TodoTable;
import me.bhavyaaggarwal.todowithdb.models.Todo;
public class MainActivity extends AppCompatActivity {
public static final String TAG = "TODOS";
ListView lvTodos;
EditText etTask;
Button btnAdd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
lvTodos = findViewById(R.id.lvTodos);
etTask = findViewById(R.id.etTask);
btnAdd = findViewById(R.id.btnAdd);
TodoDatabaseHelper myDbHelper = new TodoDatabaseHelper(this);
final SQLiteDatabase writeDb = myDbHelper.getWritableDatabase();
final SQLiteDatabase readDb = myDbHelper.getReadableDatabase();
final TodoAdapter todoAdapter = new TodoAdapter(this, TodoTable.getAllTodos(readDb));
lvTodos.setAdapter(todoAdapter);
btnAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
TodoTable.insertTodo(new Todo(0, etTask.getText().toString(), false), writeDb);
todoAdapter.refreshTodos(readDb);
}
});
}
}
| [
"bhavyaaggarwal1209@gmail.com"
] | bhavyaaggarwal1209@gmail.com |
595c4f658e130068f4c38f537c1f043ba1dc45bc | 590f065619a7168d487eec05db0fd519cfb103b5 | /evosuite-tests/com/iluwatar/roleobject/CustomerCore_ESTest_scaffolding.java | 32a23fff7648ba370d9329a28367ebb983dda312 | [] | no_license | parthenos0908/EvoSuiteTrial | 3de131de94e8d23062ab3ba97048d01d504be1fb | 46f9eeeca7922543535737cca3f5c62d71352baf | refs/heads/master | 2023-02-17T05:00:39.572316 | 2021-01-18T00:06:01 | 2021-01-18T00:06:01 | 323,848,050 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,215 | java | /**
* Scaffolding file used to store all the setups needed to run
* tests automatically generated by EvoSuite
* Mon Jan 11 12:00:16 GMT 2021
*/
package com.iluwatar.roleobject;
import org.evosuite.runtime.annotation.EvoSuiteClassExclude;
import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.After;
import org.junit.AfterClass;
import org.evosuite.runtime.sandbox.Sandbox;
import org.evosuite.runtime.sandbox.Sandbox.SandboxMode;
@EvoSuiteClassExclude
public class CustomerCore_ESTest_scaffolding {
@org.junit.Rule
public org.evosuite.runtime.vnet.NonFunctionalRequirementRule nfr = new org.evosuite.runtime.vnet.NonFunctionalRequirementRule();
private static final java.util.Properties defaultProperties = (java.util.Properties) java.lang.System.getProperties().clone();
private org.evosuite.runtime.thread.ThreadStopper threadStopper = new org.evosuite.runtime.thread.ThreadStopper (org.evosuite.runtime.thread.KillSwitchHandler.getInstance(), 3000);
@BeforeClass
public static void initEvoSuiteFramework() {
org.evosuite.runtime.RuntimeSettings.className = "com.iluwatar.roleobject.CustomerCore";
org.evosuite.runtime.GuiSupport.initialize();
org.evosuite.runtime.RuntimeSettings.maxNumberOfThreads = 100;
org.evosuite.runtime.RuntimeSettings.maxNumberOfIterationsPerLoop = 10000;
org.evosuite.runtime.RuntimeSettings.mockSystemIn = true;
org.evosuite.runtime.RuntimeSettings.sandboxMode = org.evosuite.runtime.sandbox.Sandbox.SandboxMode.RECOMMENDED;
org.evosuite.runtime.sandbox.Sandbox.initializeSecurityManagerForSUT();
org.evosuite.runtime.classhandling.JDKClassResetter.init();
setSystemProperties();
initializeClasses();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
}
@AfterClass
public static void clearEvoSuiteFramework(){
Sandbox.resetDefaultSecurityManager();
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
}
@Before
public void initTestCase(){
threadStopper.storeCurrentThreads();
threadStopper.startRecordingTime();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().initHandler();
org.evosuite.runtime.sandbox.Sandbox.goingToExecuteSUTCode();
setSystemProperties();
org.evosuite.runtime.GuiSupport.setHeadless();
org.evosuite.runtime.Runtime.getInstance().resetRuntime();
org.evosuite.runtime.agent.InstrumentingAgent.activate();
}
@After
public void doneWithTestCase(){
threadStopper.killAndJoinClientThreads();
org.evosuite.runtime.jvm.ShutdownHookHandler.getInstance().safeExecuteAddedHooks();
org.evosuite.runtime.classhandling.JDKClassResetter.reset();
resetClasses();
org.evosuite.runtime.sandbox.Sandbox.doneWithExecutingSUTCode();
org.evosuite.runtime.agent.InstrumentingAgent.deactivate();
org.evosuite.runtime.GuiSupport.restoreHeadlessMode();
}
public static void setSystemProperties() {
java.lang.System.setProperties((java.util.Properties) defaultProperties.clone());
java.lang.System.setProperty("user.dir", "C:\\Users\\disto\\gitrepos\\EvoSuiteTrial");
java.lang.System.setProperty("java.io.tmpdir", "C:\\Users\\disto\\AppData\\Local\\Temp\\");
}
private static void initializeClasses() {
org.evosuite.runtime.classhandling.ClassStateSupport.initializeClasses(CustomerCore_ESTest_scaffolding.class.getClassLoader() ,
"com.iluwatar.roleobject.BorrowerRole",
"com.iluwatar.roleobject.CustomerCore",
"com.iluwatar.roleobject.Role",
"com.iluwatar.roleobject.CustomerRole",
"com.iluwatar.roleobject.Customer",
"com.iluwatar.roleobject.InvestorRole"
);
}
private static void resetClasses() {
org.evosuite.runtime.classhandling.ClassResetter.getInstance().setClassLoader(CustomerCore_ESTest_scaffolding.class.getClassLoader());
org.evosuite.runtime.classhandling.ClassStateSupport.resetClasses(
"com.iluwatar.roleobject.Customer",
"com.iluwatar.roleobject.CustomerCore",
"com.iluwatar.roleobject.CustomerRole",
"com.iluwatar.roleobject.BorrowerRole",
"com.iluwatar.roleobject.InvestorRole"
);
}
}
| [
"distortion0908@gmail.com"
] | distortion0908@gmail.com |
2a0e73e285a505f3876e17ff156d323fa28fdc53 | 561d3392af66206dce74aaf221fe32d023d53958 | /Repaso_Final/src/bar_tapas/Tapas.java | 3fcb4dfeb1b7f450c926a643d1e06f377d9ecb97 | [] | no_license | Juanvi123/Proyectos-y-ejercicios- | d3a44b09856118284e85ede55647a4a88ecbca8b | 55a4469fbd3c46ae90bfb91cad5e768b610d8eef | refs/heads/master | 2023-08-29T05:39:11.926892 | 2021-10-23T09:32:34 | 2021-10-23T09:32:34 | 380,043,845 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 786 | 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 bar_tapas;
/**
*
* @author juanv
*/
public class Tapas {
//DECLARAMOS VARIABLES
private String nombre;
private double precio;
//CONSTRUCTOR
public Tapas(String nombre, double precio) {
this.nombre = nombre;
this.precio = precio;
}
//GETTERS Y SETTERS
public String getNombre() {
return nombre;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public double getPrecio() {
return precio;
}
public void setPrecio(double precio) {
this.precio = precio;
}
}
| [
"juanvitj@gmail.com"
] | juanvitj@gmail.com |
791fd25fe34bc8df788d69c49997fbbd2bb62012 | 6a226757400a447a8672ae1bc4f7fd7f5c97f844 | /chess/DroidFish/src/com/chess/android/appdevthree/book/CtgBook.java | 62e5b479c1b23d93403874e233e2e48d15317ab2 | [] | no_license | freeandroapp/Ultimate-Chess | ffc4a3b6fb65bba95cfe2ff5abab0c4a8972a224 | 39c11b98d6abd19dfe788a87f4da6c67fad64925 | refs/heads/master | 2016-09-05T15:33:40.708990 | 2012-10-13T17:41:55 | 2012-10-13T17:41:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 31,266 | java | /*
DroidFish - An Android chess program.
Copyright (C) 2011 Peter Österlund, peterosterlund2@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.chess.android.appdevthree.book;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.ArrayList;
import java.util.List;
import com.chess.android.appdevthree.book.DroidBook.BookEntry;
import com.chess.android.appdevthree.gamelogic.Move;
import com.chess.android.appdevthree.gamelogic.Piece;
import com.chess.android.appdevthree.gamelogic.Position;
import com.chess.android.appdevthree.gamelogic.TextIO;
import com.chess.android.appdevthree.gamelogic.UndoInfo;
class CtgBook implements IOpeningBook {
private BookOptions options = new BookOptions();
private File ctgFile;
private File ctbFile;
private File ctoFile;
static boolean canHandle(BookOptions options) {
String filename = options.filename;
return (filename.endsWith(".ctg") ||
filename.endsWith(".ctb") ||
filename.endsWith(".cto"));
}
@Override
public boolean enabled() {
return ctgFile.canRead() &&
ctbFile.canRead() &&
ctoFile.canRead();
}
@Override
public void setOptions(BookOptions options) {
this.options = new BookOptions(options);
String fileName = options.filename;
int len = fileName.length();
ctgFile = new File(fileName.substring(0, len-1) + "g");
ctbFile = new File(fileName.substring(0, len-1) + "b");
ctoFile = new File(fileName.substring(0, len-1) + "o");
}
@Override
public List<BookEntry> getBookEntries(Position pos) {
RandomAccessFile ctgF = null;
RandomAccessFile ctbF = null;
RandomAccessFile ctoF = null;
try {
ctgF = new RandomAccessFile(ctgFile, "r");
ctbF = new RandomAccessFile(ctbFile, "r");
ctoF = new RandomAccessFile(ctoFile, "r");
CtbFile ctb = new CtbFile(ctbF);
CtoFile cto = new CtoFile(ctoF);
CtgFile ctg = new CtgFile(ctgF, ctb, cto);
List<BookEntry> ret = null;
PositionData pd = ctg.getPositionData(pos);
if (pd != null) {
boolean mirrorColor = pd.mirrorColor;
boolean mirrorLeftRight = pd.mirrorLeftRight;
ret = pd.getBookMoves();
UndoInfo ui = new UndoInfo();
for (BookEntry be : ret) {
pd.pos.makeMove(be.move, ui);
PositionData movePd = ctg.getPositionData(pd.pos);
pd.pos.unMakeMove(be.move, ui);
double weight = be.weight;
if (movePd == null) {
// System.out.printf("%s : no pos\n", TextIO.moveToUCIString(be.move));
weight = 0;
} else {
int recom = movePd.getRecommendation();
if ((recom >= 64) && (recom < 128)) {
if (options.tournamentMode)
weight = 0;
} else if (recom >= 128) {
if (options.preferMainLines)
weight *= 10;
}
int score = movePd.getOpponentScore();
// double w0 = weight;
weight = weight * score;
// System.out.printf("%s : w0:%.3f rec:%d score:%d %.3f\n", TextIO.moveToUCIString(be.move),
// w0, recom, score, weight);
}
be.weight = weight;
}
if (mirrorLeftRight) {
for (int i = 0; i < ret.size(); i++)
ret.get(i).move = mirrorMoveLeftRight(ret.get(i).move);
}
if (mirrorColor) {
for (int i = 0; i < ret.size(); i++)
ret.get(i).move = mirrorMoveColor(ret.get(i).move);
}
}
return ret;
} catch (IOException e) {
return null;
} finally {
if (ctgF != null) try { ctgF.close(); } catch (IOException e) { }
if (ctbF != null) try { ctbF.close(); } catch (IOException e) { }
if (ctoF != null) try { ctoF.close(); } catch (IOException e) { }
}
}
/** Read len bytes from offs in file f. */
private final static byte[] readBytes(RandomAccessFile f, int offs, int len) throws IOException {
byte[] ret = new byte[len];
f.seek(offs);
f.readFully(ret);
return ret;
}
/** Convert len bytes starting at offs in buf to an integer. */
private final static int extractInt(byte[] buf, int offs, int len) {
int ret = 0;
for (int i = 0; i < len; i++) {
int b = buf[offs + i];
if (b < 0) b += 256;
ret = (ret << 8) + b;
}
return ret;
}
private final static class CtbFile {
int lowerPageBound;
int upperPageBound;
CtbFile(RandomAccessFile f) throws IOException {
byte[] buf = readBytes(f, 4, 8);
lowerPageBound = extractInt(buf, 0, 4);
upperPageBound = extractInt(buf, 4, 4);
}
}
private final static class BitVector {
private List<Byte> buf = new ArrayList<Byte>();
private int length = 0;
void addBit(boolean value) {
int byteIdx = length / 8;
int bitIdx = 7 - (length & 7);
while (buf.size() <= byteIdx)
buf.add(Byte.valueOf((byte)0));
if (value)
buf.set(byteIdx, (byte)(buf.get(byteIdx) | (1 << bitIdx)));
length++;
}
void addBits(int mask, int numBits) {
for (int i = 0; i < numBits; i++) {
int b = numBits - 1 - i;
addBit((mask & (1 << b)) != 0);
}
}
/** Number of bits left in current byte. */
int padBits() {
int bitIdx = length & 7;
return (bitIdx == 0) ? 0 : 8 - bitIdx;
}
final byte[] toByteArray() {
byte[] ret = new byte[buf.size()];
for (int i = 0; i < buf.size(); i++)
ret[i] = buf.get(i);
return ret;
}
}
/** Converts a position to a byte array. */
private final static byte[] positionToByteArray(Position pos) {
BitVector bits = new BitVector();
bits.addBits(0, 8); // Header byte
for (int x = 0; x < 8; x++) {
for (int y = 0; y < 8; y++) {
int p = pos.getPiece(Position.getSquare(x, y));
switch (p) {
case Piece.EMPTY: bits.addBits(0x00, 1); break;
case Piece.WKING: bits.addBits(0x20, 6); break;
case Piece.WQUEEN: bits.addBits(0x22, 6); break;
case Piece.WROOK: bits.addBits(0x16, 5); break;
case Piece.WBISHOP: bits.addBits(0x14, 5); break;
case Piece.WKNIGHT: bits.addBits(0x12, 5); break;
case Piece.WPAWN: bits.addBits(0x06, 3); break;
case Piece.BKING: bits.addBits(0x21, 6); break;
case Piece.BQUEEN: bits.addBits(0x23, 6); break;
case Piece.BROOK: bits.addBits(0x17, 5); break;
case Piece.BBISHOP: bits.addBits(0x15, 5); break;
case Piece.BKNIGHT: bits.addBits(0x13, 5); break;
case Piece.BPAWN: bits.addBits(0x07, 3); break;
}
}
}
TextIO.fixupEPSquare(pos);
boolean ep = pos.getEpSquare() != -1;
boolean cs = pos.getCastleMask() != 0;
if (!ep && !cs)
bits.addBit(false); // At least one pad bit
int specialBits = (ep ? 3 : 0) + (cs ? 4 : 0);
while (bits.padBits() != specialBits)
bits.addBit(false);
if (ep)
bits.addBits(Position.getX(pos.getEpSquare()), 3);
if (cs) {
bits.addBit(pos.h8Castle());
bits.addBit(pos.a8Castle());
bits.addBit(pos.h1Castle());
bits.addBit(pos.a1Castle());
}
if ((bits.length & 7) != 0) throw new RuntimeException();
int header = bits.length / 8;
if (ep) header |= 0x20;
if (cs) header |= 0x40;
byte[] buf = bits.toByteArray();
buf[0] = (byte)header;
return buf;
}
private final static class CtoFile {
RandomAccessFile f;
CtoFile(RandomAccessFile f) {
this.f = f;
}
final static ArrayList<Integer> getHashIndices(byte[] encodedPos, CtbFile ctb) throws IOException {
ArrayList<Integer> ret = new ArrayList<Integer>();
int hash = getHashValue(encodedPos);
for (int n = 0; n < 0x7fffffff; n = 2*n + 1) {
int c = (hash & n) + n;
if (c < ctb.lowerPageBound)
continue;
ret.add(c);
if (c >= ctb.upperPageBound)
break;
}
return ret;
}
final int getPage(int hashIndex) throws IOException {
byte[] buf = readBytes(f, 16 + 4 * hashIndex, 4);
int page = extractInt(buf, 0, 4);
return page;
}
private final static int tbl[] = {
0x3100d2bf, 0x3118e3de, 0x34ab1372, 0x2807a847,
0x1633f566, 0x2143b359, 0x26d56488, 0x3b9e6f59,
0x37755656, 0x3089ca7b, 0x18e92d85, 0x0cd0e9d8,
0x1a9e3b54, 0x3eaa902f, 0x0d9bfaae, 0x2f32b45b,
0x31ed6102, 0x3d3c8398, 0x146660e3, 0x0f8d4b76,
0x02c77a5f, 0x146c8799, 0x1c47f51f, 0x249f8f36,
0x24772043, 0x1fbc1e4d, 0x1e86b3fa, 0x37df36a6,
0x16ed30e4, 0x02c3148e, 0x216e5929, 0x0636b34e,
0x317f9f56, 0x15f09d70, 0x131026fb, 0x38c784b1,
0x29ac3305, 0x2b485dc5, 0x3c049ddc, 0x35a9fbcd,
0x31d5373b, 0x2b246799, 0x0a2923d3, 0x08a96e9d,
0x30031a9f, 0x08f525b5, 0x33611c06, 0x2409db98,
0x0ca4feb2, 0x1000b71e, 0x30566e32, 0x39447d31,
0x194e3752, 0x08233a95, 0x0f38fe36, 0x29c7cd57,
0x0f7b3a39, 0x328e8a16, 0x1e7d1388, 0x0fba78f5,
0x274c7e7c, 0x1e8be65c, 0x2fa0b0bb, 0x1eb6c371
};
private final static int getHashValue(byte[] encodedPos) {
int hash = 0;
int tmp = 0;
for (int i = 0; i < encodedPos.length; i++) {
int ch = encodedPos[i];
tmp += ((0x0f - (ch & 0x0f)) << 2) + 1;
hash += tbl[tmp & 0x3f];
tmp += ((0xf0 - (ch & 0xf0)) >> 2) + 1;
hash += tbl[tmp & 0x3f];
}
return hash;
}
}
private final static class CtgFile {
private RandomAccessFile f;
private CtbFile ctb;
private CtoFile cto;
CtgFile(RandomAccessFile f, CtbFile ctb, CtoFile cto) {
this.f = f;
this.ctb = ctb;
this.cto = cto;
}
final PositionData getPositionData(Position pos) throws IOException {
boolean mirrorColor = !pos.whiteMove;
boolean needCopy = true;
if (mirrorColor) {
pos = mirrorPosColor(pos);
needCopy = false;
}
boolean mirrorLeftRight = false;
if ((pos.getCastleMask() == 0) && (Position.getX(pos.getKingSq(true)) < 4)) {
pos = mirrorPosLeftRight(pos);
mirrorLeftRight = true;
needCopy = false;
}
if (needCopy)
pos = new Position(pos);
byte[] encodedPos = positionToByteArray(pos);
ArrayList<Integer> hashIdxList = CtoFile.getHashIndices(encodedPos, ctb);
PositionData pd = null;
for (int i = 0; i < hashIdxList.size(); i++) {
int page = cto.getPage(hashIdxList.get(i));
if (page < 0)
continue;
pd = findInPage(page, encodedPos);
if (pd != null) {
pd.pos = pos;
pd.mirrorColor = mirrorColor;
pd.mirrorLeftRight = mirrorLeftRight;
break;
}
}
return pd;
}
private final PositionData findInPage(int page, byte[] encodedPos) throws IOException {
byte[] pageBuf = readBytes(f, (page+1)*4096, 4096);
try {
int nPos = extractInt(pageBuf, 0, 2);
int nBytes = extractInt(pageBuf, 2, 2);
for (int i = nBytes; i < 4096; i++)
pageBuf[i] = 0; // Don't depend on trailing garbage
int offs = 4;
for (int p = 0; p < nPos; p++) {
boolean match = true;
for (int i = 0; i < encodedPos.length; i++)
if (encodedPos[i] != pageBuf[offs+i]) {
match = false;
break;
}
if (match)
return new PositionData(pageBuf, offs);
int posLen = pageBuf[offs] & 0x1f;
offs += posLen;
int moveBytes = extractInt(pageBuf, offs, 1);
offs += moveBytes;
offs += PositionData.posInfoBytes;
}
return null;
} catch (ArrayIndexOutOfBoundsException ex) {
return null; // Ignore corrupt book file entries
}
}
}
private final static class PositionData {
private byte[] buf;
private int posLen;
private int moveBytes;
final static int posInfoBytes = 3*4 + 4 + (3+4)*2 + 1 + 1 + 1;
Position pos;
boolean mirrorColor = false;
boolean mirrorLeftRight = false;
PositionData(byte[] pageBuf, int offs) {
posLen = pageBuf[offs] & 0x1f;
moveBytes = extractInt(pageBuf, offs + posLen, 1);
int bufLen = posLen + moveBytes + posInfoBytes;
buf = new byte[bufLen];
for (int i = 0; i < bufLen; i++)
buf[i] = pageBuf[offs + i];
}
final ArrayList<BookEntry> getBookMoves() {
ArrayList<BookEntry> entries = new ArrayList<BookEntry>();
int nMoves = (moveBytes - 1) / 2;
for (int mi = 0; mi < nMoves; mi++) {
int move = extractInt(buf, posLen + 1 + mi * 2, 1);
int flags = extractInt(buf, posLen + 1 + mi * 2 + 1, 1);
Move m = decodeMove(pos, move);
if (m == null)
continue;
// System.out.printf("mi:%d m:%s flags:%d\n", mi, TextIO.moveToUCIString(m), flags);
BookEntry ent = new BookEntry(m);
switch (flags) {
default:
case 0x00: ent.weight = 1; break; // No annotation
case 0x01: ent.weight = 8; break; // !
case 0x02: ent.weight = 0; break; // ?
case 0x03: ent.weight = 32; break; // !!
case 0x04: ent.weight = 0; break; // ??
case 0x05: ent.weight = 0.5; break; // !?
case 0x06: ent.weight = 0.125; break; // ?!
case 0x08: ent.weight = 1000000; break; // Only move
}
entries.add(ent);
}
return entries;
}
/** Return (wins + draws/2) / games. */
final int getOpponentScore() {
int statStart = posLen + moveBytes;
// int wins = extractInt(buf, statStart + 3, 3);
int loss = extractInt(buf, statStart + 6, 3);
int draws = extractInt(buf, statStart + 9, 3);
return loss * 2 + draws;
}
final int getRecommendation() {
int statStart = posLen + moveBytes;
int recom = extractInt(buf, statStart + 30, 1);
return recom;
}
private static final class MoveInfo {
int piece;
int pieceNo;
int dx;
int dy;
}
private final static MoveInfo MI(int piece, int pieceNo, int dx, int dy) {
MoveInfo mi = new MoveInfo();
mi.piece = piece;
mi.pieceNo = pieceNo;
mi.dx = dx;
mi.dy = dy;
return mi;
}
private final static MoveInfo[] moveInfo = new MoveInfo[256];
static {
moveInfo[0x00] = MI(Piece.WPAWN , 4, +1, +1);
moveInfo[0x01] = MI(Piece.WKNIGHT, 1, -2, -1);
moveInfo[0x03] = MI(Piece.WQUEEN , 1, +2, +0);
moveInfo[0x04] = MI(Piece.WPAWN , 1, +0, +1);
moveInfo[0x05] = MI(Piece.WQUEEN , 0, +0, +1);
moveInfo[0x06] = MI(Piece.WPAWN , 3, -1, +1);
moveInfo[0x08] = MI(Piece.WQUEEN , 1, +4, +0);
moveInfo[0x09] = MI(Piece.WBISHOP, 1, +6, +6);
moveInfo[0x0a] = MI(Piece.WKING , 0, +0, -1);
moveInfo[0x0c] = MI(Piece.WPAWN , 0, -1, +1);
moveInfo[0x0d] = MI(Piece.WBISHOP, 0, +3, +3);
moveInfo[0x0e] = MI(Piece.WROOK , 1, +3, +0);
moveInfo[0x0f] = MI(Piece.WKNIGHT, 0, -2, -1);
moveInfo[0x12] = MI(Piece.WBISHOP, 0, +7, +7);
moveInfo[0x13] = MI(Piece.WKING , 0, +0, +1);
moveInfo[0x14] = MI(Piece.WPAWN , 7, +1, +1);
moveInfo[0x15] = MI(Piece.WBISHOP, 0, +5, +5);
moveInfo[0x18] = MI(Piece.WPAWN , 6, +0, +1);
moveInfo[0x1a] = MI(Piece.WQUEEN , 1, +0, +6);
moveInfo[0x1b] = MI(Piece.WBISHOP, 0, -1, +1);
moveInfo[0x1d] = MI(Piece.WBISHOP, 1, +7, +7);
moveInfo[0x21] = MI(Piece.WROOK , 1, +7, +0);
moveInfo[0x22] = MI(Piece.WBISHOP, 1, -2, +2);
moveInfo[0x23] = MI(Piece.WQUEEN , 1, +6, +6);
moveInfo[0x24] = MI(Piece.WPAWN , 7, -1, +1);
moveInfo[0x26] = MI(Piece.WBISHOP, 0, -7, +7);
moveInfo[0x27] = MI(Piece.WPAWN , 2, -1, +1);
moveInfo[0x28] = MI(Piece.WQUEEN , 0, +5, +5);
moveInfo[0x29] = MI(Piece.WQUEEN , 0, +6, +0);
moveInfo[0x2a] = MI(Piece.WKNIGHT, 1, +1, -2);
moveInfo[0x2d] = MI(Piece.WPAWN , 5, +1, +1);
moveInfo[0x2e] = MI(Piece.WBISHOP, 0, +1, +1);
moveInfo[0x2f] = MI(Piece.WQUEEN , 0, +1, +0);
moveInfo[0x30] = MI(Piece.WKNIGHT, 1, -1, -2);
moveInfo[0x31] = MI(Piece.WQUEEN , 0, +3, +0);
moveInfo[0x32] = MI(Piece.WBISHOP, 1, +5, +5);
moveInfo[0x34] = MI(Piece.WKNIGHT, 0, +1, +2);
moveInfo[0x36] = MI(Piece.WKNIGHT, 0, +2, +1);
moveInfo[0x37] = MI(Piece.WQUEEN , 0, +0, +4);
moveInfo[0x38] = MI(Piece.WQUEEN , 1, -4, +4);
moveInfo[0x39] = MI(Piece.WQUEEN , 0, +5, +0);
moveInfo[0x3a] = MI(Piece.WBISHOP, 0, +6, +6);
moveInfo[0x3b] = MI(Piece.WQUEEN , 1, -5, +5);
moveInfo[0x3c] = MI(Piece.WBISHOP, 0, -5, +5);
moveInfo[0x41] = MI(Piece.WQUEEN , 1, +5, +5);
moveInfo[0x42] = MI(Piece.WQUEEN , 0, -7, +7);
moveInfo[0x44] = MI(Piece.WKING , 0, +1, -1);
moveInfo[0x45] = MI(Piece.WQUEEN , 0, +3, +3);
moveInfo[0x4a] = MI(Piece.WPAWN , 7, +0, +2);
moveInfo[0x4b] = MI(Piece.WQUEEN , 0, -5, +5);
moveInfo[0x4c] = MI(Piece.WKNIGHT, 1, +1, +2);
moveInfo[0x4d] = MI(Piece.WQUEEN , 1, +0, +1);
moveInfo[0x50] = MI(Piece.WROOK , 0, +0, +6);
moveInfo[0x52] = MI(Piece.WROOK , 0, +6, +0);
moveInfo[0x54] = MI(Piece.WBISHOP, 1, -1, +1);
moveInfo[0x55] = MI(Piece.WPAWN , 2, +0, +1);
moveInfo[0x5c] = MI(Piece.WPAWN , 6, +1, +1);
moveInfo[0x5f] = MI(Piece.WPAWN , 4, +0, +2);
moveInfo[0x61] = MI(Piece.WQUEEN , 0, +6, +6);
moveInfo[0x62] = MI(Piece.WPAWN , 1, +0, +2);
moveInfo[0x63] = MI(Piece.WQUEEN , 1, -7, +7);
moveInfo[0x66] = MI(Piece.WBISHOP, 0, -3, +3);
moveInfo[0x67] = MI(Piece.WKING , 0, +1, +1);
moveInfo[0x69] = MI(Piece.WROOK , 1, +0, +7);
moveInfo[0x6a] = MI(Piece.WBISHOP, 0, +4, +4);
moveInfo[0x6b] = MI(Piece.WKING , 0, +2, +0);
moveInfo[0x6e] = MI(Piece.WROOK , 0, +5, +0);
moveInfo[0x6f] = MI(Piece.WQUEEN , 1, +7, +7);
moveInfo[0x72] = MI(Piece.WBISHOP, 1, -7, +7);
moveInfo[0x74] = MI(Piece.WQUEEN , 0, +2, +0);
moveInfo[0x79] = MI(Piece.WBISHOP, 1, -6, +6);
moveInfo[0x7a] = MI(Piece.WROOK , 0, +0, +3);
moveInfo[0x7b] = MI(Piece.WROOK , 1, +0, +6);
moveInfo[0x7c] = MI(Piece.WPAWN , 2, +1, +1);
moveInfo[0x7d] = MI(Piece.WROOK , 1, +0, +1);
moveInfo[0x7e] = MI(Piece.WQUEEN , 0, -3, +3);
moveInfo[0x7f] = MI(Piece.WROOK , 0, +1, +0);
moveInfo[0x80] = MI(Piece.WQUEEN , 0, -6, +6);
moveInfo[0x81] = MI(Piece.WROOK , 0, +0, +1);
moveInfo[0x82] = MI(Piece.WPAWN , 5, -1, +1);
moveInfo[0x85] = MI(Piece.WKNIGHT, 0, -1, +2);
moveInfo[0x86] = MI(Piece.WROOK , 0, +7, +0);
moveInfo[0x87] = MI(Piece.WROOK , 0, +0, +5);
moveInfo[0x8a] = MI(Piece.WKNIGHT, 0, +1, -2);
moveInfo[0x8b] = MI(Piece.WPAWN , 0, +1, +1);
moveInfo[0x8c] = MI(Piece.WKING , 0, -1, -1);
moveInfo[0x8e] = MI(Piece.WQUEEN , 1, -2, +2);
moveInfo[0x8f] = MI(Piece.WQUEEN , 0, +7, +0);
moveInfo[0x92] = MI(Piece.WQUEEN , 1, +1, +1);
moveInfo[0x94] = MI(Piece.WQUEEN , 0, +0, +3);
moveInfo[0x96] = MI(Piece.WPAWN , 1, +1, +1);
moveInfo[0x97] = MI(Piece.WKING , 0, -1, +0);
moveInfo[0x98] = MI(Piece.WROOK , 0, +3, +0);
moveInfo[0x99] = MI(Piece.WROOK , 0, +0, +4);
moveInfo[0x9a] = MI(Piece.WQUEEN , 0, +0, +6);
moveInfo[0x9b] = MI(Piece.WPAWN , 2, +0, +2);
moveInfo[0x9d] = MI(Piece.WQUEEN , 0, +0, +2);
moveInfo[0x9f] = MI(Piece.WBISHOP, 1, -4, +4);
moveInfo[0xa0] = MI(Piece.WQUEEN , 1, +0, +3);
moveInfo[0xa2] = MI(Piece.WQUEEN , 0, +2, +2);
moveInfo[0xa3] = MI(Piece.WPAWN , 7, +0, +1);
moveInfo[0xa5] = MI(Piece.WROOK , 1, +0, +5);
moveInfo[0xa9] = MI(Piece.WROOK , 1, +2, +0);
moveInfo[0xab] = MI(Piece.WQUEEN , 1, -6, +6);
moveInfo[0xad] = MI(Piece.WROOK , 1, +4, +0);
moveInfo[0xae] = MI(Piece.WQUEEN , 1, +3, +3);
moveInfo[0xb0] = MI(Piece.WQUEEN , 1, +0, +4);
moveInfo[0xb1] = MI(Piece.WPAWN , 5, +0, +2);
moveInfo[0xb2] = MI(Piece.WBISHOP, 0, -6, +6);
moveInfo[0xb5] = MI(Piece.WROOK , 1, +5, +0);
moveInfo[0xb7] = MI(Piece.WQUEEN , 0, +0, +5);
moveInfo[0xb9] = MI(Piece.WBISHOP, 1, +3, +3);
moveInfo[0xbb] = MI(Piece.WPAWN , 4, +0, +1);
moveInfo[0xbc] = MI(Piece.WQUEEN , 1, +5, +0);
moveInfo[0xbd] = MI(Piece.WQUEEN , 1, +0, +2);
moveInfo[0xbe] = MI(Piece.WKING , 0, +1, +0);
moveInfo[0xc1] = MI(Piece.WBISHOP, 0, +2, +2);
moveInfo[0xc2] = MI(Piece.WBISHOP, 1, +2, +2);
moveInfo[0xc3] = MI(Piece.WBISHOP, 0, -2, +2);
moveInfo[0xc4] = MI(Piece.WROOK , 1, +1, +0);
moveInfo[0xc5] = MI(Piece.WROOK , 1, +0, +4);
moveInfo[0xc6] = MI(Piece.WQUEEN , 1, +0, +5);
moveInfo[0xc7] = MI(Piece.WPAWN , 6, -1, +1);
moveInfo[0xc8] = MI(Piece.WPAWN , 6, +0, +2);
moveInfo[0xc9] = MI(Piece.WQUEEN , 1, +0, +7);
moveInfo[0xca] = MI(Piece.WBISHOP, 1, -3, +3);
moveInfo[0xcb] = MI(Piece.WPAWN , 5, +0, +1);
moveInfo[0xcc] = MI(Piece.WBISHOP, 1, -5, +5);
moveInfo[0xcd] = MI(Piece.WROOK , 0, +2, +0);
moveInfo[0xcf] = MI(Piece.WPAWN , 3, +0, +1);
moveInfo[0xd1] = MI(Piece.WPAWN , 1, -1, +1);
moveInfo[0xd2] = MI(Piece.WKNIGHT, 1, +2, +1);
moveInfo[0xd3] = MI(Piece.WKNIGHT, 1, -2, +1);
moveInfo[0xd7] = MI(Piece.WQUEEN , 0, -1, +1);
moveInfo[0xd8] = MI(Piece.WROOK , 1, +6, +0);
moveInfo[0xd9] = MI(Piece.WQUEEN , 0, -2, +2);
moveInfo[0xda] = MI(Piece.WKNIGHT, 0, -1, -2);
moveInfo[0xdb] = MI(Piece.WPAWN , 0, +0, +2);
moveInfo[0xde] = MI(Piece.WPAWN , 4, -1, +1);
moveInfo[0xdf] = MI(Piece.WKING , 0, -1, +1);
moveInfo[0xe0] = MI(Piece.WKNIGHT, 1, +2, -1);
moveInfo[0xe1] = MI(Piece.WROOK , 0, +0, +7);
moveInfo[0xe3] = MI(Piece.WROOK , 1, +0, +3);
moveInfo[0xe5] = MI(Piece.WQUEEN , 0, +4, +0);
moveInfo[0xe6] = MI(Piece.WPAWN , 3, +0, +2);
moveInfo[0xe7] = MI(Piece.WQUEEN , 0, +4, +4);
moveInfo[0xe8] = MI(Piece.WROOK , 0, +0, +2);
moveInfo[0xe9] = MI(Piece.WKNIGHT, 0, +2, -1);
moveInfo[0xeb] = MI(Piece.WPAWN , 3, +1, +1);
moveInfo[0xec] = MI(Piece.WPAWN , 0, +0, +1);
moveInfo[0xed] = MI(Piece.WQUEEN , 0, +7, +7);
moveInfo[0xee] = MI(Piece.WQUEEN , 1, -1, +1);
moveInfo[0xef] = MI(Piece.WROOK , 0, +4, +0);
moveInfo[0xf0] = MI(Piece.WQUEEN , 1, +7, +0);
moveInfo[0xf1] = MI(Piece.WQUEEN , 0, +1, +1);
moveInfo[0xf3] = MI(Piece.WKNIGHT, 1, -1, +2);
moveInfo[0xf4] = MI(Piece.WROOK , 1, +0, +2);
moveInfo[0xf5] = MI(Piece.WBISHOP, 1, +1, +1);
moveInfo[0xf6] = MI(Piece.WKING , 0, -2, +0);
moveInfo[0xf7] = MI(Piece.WKNIGHT, 0, -2, +1);
moveInfo[0xf8] = MI(Piece.WQUEEN , 1, +1, +0);
moveInfo[0xf9] = MI(Piece.WQUEEN , 1, +0, +6);
moveInfo[0xfa] = MI(Piece.WQUEEN , 1, +3, +0);
moveInfo[0xfb] = MI(Piece.WQUEEN , 1, +2, +2);
moveInfo[0xfd] = MI(Piece.WQUEEN , 0, +0, +7);
moveInfo[0xfe] = MI(Piece.WQUEEN , 1, -3, +3);
}
private final static int findPiece(Position pos, int piece, int pieceNo) {
for (int x = 0; x < 8; x++)
for (int y = 0; y < 8; y++) {
int sq = Position.getSquare(x, y);
if (pos.getPiece(sq) == piece)
if (pieceNo-- == 0)
return sq;
}
return -1;
}
private final Move decodeMove(Position pos, int moveCode) {
MoveInfo mi = moveInfo[moveCode];
if (mi == null)
return null;
int from = findPiece(pos, mi.piece, mi.pieceNo);
if (from < 0)
return null;
int toX = (Position.getX(from) + mi.dx) & 7;
int toY = (Position.getY(from) + mi.dy) & 7;
int to = Position.getSquare(toX, toY);
int promoteTo = Piece.EMPTY;
if ((pos.getPiece(from) == Piece.WPAWN) && (toY == 7))
promoteTo = Piece.WQUEEN;
Move m = new Move(from, to, promoteTo);
return m;
}
}
private final static int mirrorSquareColor(int sq) {
int x = Position.getX(sq);
int y = 7 - Position.getY(sq);
return Position.getSquare(x, y);
}
private final static int mirrorPieceColor(int piece) {
if (Piece.isWhite(piece)) {
piece = Piece.makeBlack(piece);
} else {
piece = Piece.makeWhite(piece);
}
return piece;
}
private final static Position mirrorPosColor(Position pos) {
Position ret = new Position(pos);
for (int sq = 0; sq < 64; sq++) {
int mSq = mirrorSquareColor(sq);
int piece = pos.getPiece(sq);
int mPiece = mirrorPieceColor(piece);
ret.setPiece(mSq, mPiece);
}
ret.setWhiteMove(!pos.whiteMove);
int castleMask = 0;
if (pos.a1Castle()) castleMask |= (1 << Position.A8_CASTLE);
if (pos.h1Castle()) castleMask |= (1 << Position.H8_CASTLE);
if (pos.a8Castle()) castleMask |= (1 << Position.A1_CASTLE);
if (pos.h8Castle()) castleMask |= (1 << Position.H1_CASTLE);
ret.setCastleMask(castleMask);
int epSquare = pos.getEpSquare();
if (epSquare >= 0) {
int mEpSquare = mirrorSquareColor(epSquare);
ret.setEpSquare(mEpSquare);
}
ret.halfMoveClock = pos.halfMoveClock;
ret.fullMoveCounter = pos.fullMoveCounter;
return ret;
}
private final static Move mirrorMoveColor(Move m) {
if (m == null) return null;
Move ret = new Move(m);
ret.from = mirrorSquareColor(m.from);
ret.to = mirrorSquareColor(m.to);
ret.promoteTo = mirrorPieceColor(m.promoteTo);
return ret;
}
private final static int mirrorSquareLeftRight(int sq) {
int x = 7 - Position.getX(sq);
int y = Position.getY(sq);
return Position.getSquare(x, y);
}
private final static Position mirrorPosLeftRight(Position pos) {
Position ret = new Position(pos);
for (int sq = 0; sq < 64; sq++) {
int mSq = mirrorSquareLeftRight(sq);
int piece = pos.getPiece(sq);
ret.setPiece(mSq, piece);
}
int epSquare = pos.getEpSquare();
if (epSquare >= 0) {
int mEpSquare = mirrorSquareLeftRight(epSquare);
ret.setEpSquare(mEpSquare);
}
ret.halfMoveClock = pos.halfMoveClock;
ret.fullMoveCounter = pos.fullMoveCounter;
return ret;
}
private final static Move mirrorMoveLeftRight(Move m) {
if (m == null) return null;
Move ret = new Move(m);
ret.from = mirrorSquareLeftRight(m.from);
ret.to = mirrorSquareLeftRight(m.to);
ret.promoteTo = m.promoteTo;
return ret;
}
}
| [
"freeandroapp@gmail.com"
] | freeandroapp@gmail.com |
82c17f9066c2ba6f7c9615e78b1cab86324907c5 | fe2a1b5760d6aa5b4a653db44ccba0d858fd0450 | /s2id90_java_source_files/contest/util/TimedSearchTask.java | 2f979ca3fca264befaf74af6e7c2597a177e168b | [
"MIT"
] | permissive | PlatoTUE/webtech_team | 32ae31aa7e528cb3338905f4b5893b93480376b5 | a18908f9e77eeec9dd84af659407726804b5eb2a | refs/heads/master | 2020-05-29T11:53:29.491024 | 2015-12-11T23:12:34 | 2015-12-11T23:12:34 | 47,889,296 | 0 | 0 | null | 2015-12-12T18:19:28 | 2015-12-12T18:19:28 | null | UTF-8 | Java | false | false | 1,138 | 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 nl.tue.s2id90.contest.util;
import java.util.Timer;
import java.util.TimerTask;
import nl.tue.s2id90.game.GameState;
import nl.tue.s2id90.game.Player;
/**
* This search task automatically stops after given number of seconds. This is done
* by calling its stop() method in a TimerTask.
* @author huub
* @param <M> Move
* @param <U> UndoMove
* @param <S> GameState<M>
*/
public abstract class TimedSearchTask<M, U, S extends GameState<M>>
extends SearchTask<M, U, S> {
static Timer timer = new Timer(); // can schedule multiple tasks, so no need to make a new one
public TimedSearchTask(Player<M, S> player, S s, int timeLimitInSeconds) {
super(player, s);
TimerTask task = new TimerTask() {
@Override
public void run() {
TimedSearchTask.this.stop();
}
};
timer.schedule(task, timeLimitInSeconds*1000);
}
}
| [
"dennis.vandenbrand@nubisonline.nl"
] | dennis.vandenbrand@nubisonline.nl |
fc50e0067ec5d37b8a62f56e95c5409dadd7f1b6 | ec5f9311040fa6946d3ef05386f1e8b382b29ec9 | /src/br/com/alura/gerenciador/servlet/MonitoramentoFilter.java | d84bac5905252546ad50550d81f00a793c1cde1b | [] | no_license | elvisguarda03/gerenciador | e55b4d058657c7cee3246c710dab0ac9f7f1c001 | a6309021e09acda27669cde030eb5577945edea8 | refs/heads/master | 2020-12-07T22:02:13.184455 | 2020-01-09T13:07:07 | 2020-01-09T13:07:07 | 232,811,630 | 0 | 0 | null | null | null | null | ISO-8859-1 | Java | false | false | 1,112 | java | package br.com.alura.gerenciador.servlet;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
//@WebFilter("/gerenciador/")
public class MonitoramentoFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {}
@Override
public void destroy() {}
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
long before = System.currentTimeMillis();
String action = "";
try {
action = ((HttpServletRequest) request).getRequestURI().split("/")[2];
} catch (ArrayIndexOutOfBoundsException aiobe) {
// Ignoring
}
//Executa a ação
chain.doFilter(request, response);
long after = System.currentTimeMillis();
System.out.println("Tempo de execução da ação " + action + " -> " + (after - before));
}
}
| [
"elvis.guarda@capgemini.com"
] | elvis.guarda@capgemini.com |
b64939089b1608ba5a41345873c25168b8c6f7e0 | 5282eeb47504dedaafe7a3e295eaca34c1d87b91 | /src/main/java/org/sonatype/plugins/portallocator/PortType.java | 94c85e4da1c1438df9a7ec764114e7a905977db5 | [] | no_license | rlodge/port-allocator-maven-plugin | f2305493f66dd2adc8bc8e65c7c99c1a4b860a28 | 046c848f3247d4f9a9297b5709fe381de50bcd0c | refs/heads/master | 2021-01-22T05:33:00.013482 | 2020-10-02T18:19:10 | 2020-10-02T18:19:10 | 29,200,537 | 0 | 1 | null | 2015-01-13T16:55:27 | 2015-01-13T16:55:27 | null | UTF-8 | Java | false | false | 857 | java | package org.sonatype.plugins.portallocator;
import org.sonatype.plugins.portallocator.strategy.AllocationStrategy;
import org.sonatype.plugins.portallocator.strategy.ConsistentRandomAllocationStrategy;
import org.sonatype.plugins.portallocator.strategy.DefaultAllocationStrategy;
import org.sonatype.plugins.portallocator.strategy.IncrementingAllocationStrategy;
import org.sonatype.plugins.portallocator.strategy.RandomAllocationStrategy;
/**
* @author Ross M. Lodge
*/
public enum PortType {
RANDOM(new RandomAllocationStrategy()),
CONSISTENT(new ConsistentRandomAllocationStrategy()),
INCREMENTING(new IncrementingAllocationStrategy()),
DEFAULT(new DefaultAllocationStrategy());
public final AllocationStrategy allocationStrategy;
PortType(final AllocationStrategy allocationStrategy) {
this.allocationStrategy = allocationStrategy;
}
}
| [
"rlodge@concentricsky.com"
] | rlodge@concentricsky.com |
c247746d56b3a21551c9e4640711efec549b0b6e | 15b6a1032a38dcabeb76126c476f899ecccadb2a | /src/main/java/com/huang/design/pattern/chapter1/simplefactory/OperationAdd.java | dfb07c8f9fe90e2990c6e4f63c2404399c6612c8 | [] | no_license | huang-up/sdk-quick-get | c8bb2dcdff62b678c3c6032af4b8d4721dc836e2 | 79323827d708e47d8fecd7073b458348c5d52bdd | refs/heads/master | 2020-05-01T00:06:22.037795 | 2019-03-22T15:02:58 | 2019-03-22T15:02:58 | 102,743,859 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 280 | java | package com.huang.design.pattern.chapter1.simplefactory;
/**
* Created by admin on 2017/9/19.
*/
public class OperationAdd extends Operation {
@Override
public double getResult() {
double result = 0;
result = numA + numB;
return result;
}
}
| [
"1101035657@qq.com"
] | 1101035657@qq.com |
9436e432d8037a15a230167135f001c503cd0f90 | 92a799ed7d8cf96c62d2c0875624e12cc45d2c02 | /src/com/kh/MasterPiece/mypage/review/controller/ReviewSearchServlet.java | a6b52e090a6bfe5d4a5bffb359f209ebecc2da37 | [] | no_license | kovd2/MasterPiece | 94d19cf3a5075bf2b6082bff9b84304cb460ba89 | e4a2222ab39206a0ad4a5b7af23e17b5349fee13 | refs/heads/master | 2020-03-28T17:06:44.111073 | 2018-10-05T01:32:44 | 2018-10-05T01:32:44 | 148,748,539 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,393 | java | package com.kh.MasterPiece.mypage.review.controller;
import java.io.IOException;
import java.util.ArrayList;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.kh.MasterPiece.board.model.vo.PageInfo;
import com.kh.MasterPiece.member.model.vo.Member;
import com.kh.MasterPiece.mypage.review.model.service.ReviewService;
import com.kh.MasterPiece.mypage.review.model.vo.Review;
/**
* Servlet implementation class ReviewSearchServlet
*/
@WebServlet("/ReviewSearchServlet")
public class ReviewSearchServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public ReviewSearchServlet() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String writer = String.valueOf(((Member)(request.getSession().getAttribute("loginUser"))).getUserId());
int currentPage; //현재 페이지를 표시할 변수
int limit; //한 페이지에 게시글이 몇 개가 보여질 것인지 표시
int maxPage; //전체 페이지에서 가장 마지막 페이지
int startPage; //한 번에 표시될 페이지가 시작할 페이지
int endPage; //한 번에 표시될 페이지가 끝나는 페이지
currentPage = 1;
limit = 10;
if(request.getParameter("currentPage") != null){
currentPage = Integer.parseInt(request.getParameter("currentPage"));
}
//파라미터값 꺼낸것
int searchType = Integer.parseInt(request.getParameter("search_type"));
String searchText = request.getParameter("search_text");
int listCount = new ReviewService().searchCount(writer, searchType, searchText);
maxPage = (int)((double)listCount / limit + 0.9);
startPage = (((int)((double)currentPage / limit + 0.9)) - 1) * limit + 1;
endPage = startPage + limit - 1;
if(maxPage < endPage){
endPage = maxPage;
}
PageInfo pi = new PageInfo(currentPage, listCount, limit, maxPage, startPage, endPage);
ArrayList<Review> list = new ReviewService().searchList(writer, searchType, searchText, currentPage, limit);
String page = null;
if(list != null){
page = "views/mypage/review/review_myPage.jsp";
request.setAttribute("list", list);
request.setAttribute("searchType", searchType);
request.setAttribute("searchText", searchText);
request.setAttribute("pi", pi);
request.setAttribute("entire", "아무거나");
}else{
page = "views/common/errorPage.jsp";
request.setAttribute("msg", "실패");
}
RequestDispatcher view = request.getRequestDispatcher(page);
view.forward(request, response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doGet(request, response);
}
}
| [
"syong9233@naver.com"
] | syong9233@naver.com |
99925f3093ade0e99870164cbbbbffb8df44b2c9 | 4aa7ba4305de05ca5a9134979875799917735773 | /src/main/java/com/luo/blog/controller/vo/BlogDetailVO.java | 15191ee306bcaa946c0c29829bf9fe931d83fe7f | [] | no_license | VictorMuyan/blog | 1ae662284dc0042c4ea1141c0decb916f0482fa4 | 2fb4f3f5676afb2c9fedcf59d881d05e09d2a583 | refs/heads/master | 2023-04-01T01:08:42.543367 | 2021-04-14T20:34:17 | 2021-04-14T20:34:17 | 355,003,220 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,615 | java | package com.luo.blog.controller.vo;
import java.util.Date;
import java.util.List;
public class BlogDetailVO {
private Long blogId;
private String blogTitle;
private Integer blogCategoryId;
private Integer commentCount;
private String blogCategoryIcon;
private String blogCategoryName;
private String blogCoverImage;
private Long blogViews;
private List<String> blogTags;
private String blogContent;
private Byte enableComment;
private Date createTime;
public Long getBlogId() {
return blogId;
}
public void setBlogId(Long blogId) {
this.blogId = blogId;
}
public String getBlogTitle() {
return blogTitle;
}
public void setBlogTitle(String blogTitle) {
this.blogTitle = blogTitle;
}
public Integer getBlogCategoryId() {
return blogCategoryId;
}
public void setBlogCategoryId(Integer blogCategoryId) {
this.blogCategoryId = blogCategoryId;
}
public String getBlogCategoryIcon() {
return blogCategoryIcon;
}
public void setBlogCategoryIcon(String blogCategoryIcon) {
this.blogCategoryIcon = blogCategoryIcon;
}
public String getBlogCategoryName() {
return blogCategoryName;
}
public void setBlogCategoryName(String blogCategoryName) {
this.blogCategoryName = blogCategoryName;
}
public Long getBlogViews() {
return blogViews;
}
public void setBlogViews(Long blogViews) {
this.blogViews = blogViews;
}
public List<String> getBlogTags() {
return blogTags;
}
public void setBlogTags(List<String> blogTags) {
this.blogTags = blogTags;
}
public String getBlogContent() {
return blogContent;
}
public void setBlogContent(String blogContent) {
this.blogContent = blogContent;
}
public Integer getCommentCount() {
return commentCount;
}
public void setCommentCount(Integer commentCount) {
this.commentCount = commentCount;
}
public Byte getEnableComment() {
return enableComment;
}
public void setEnableComment(Byte enableComment) {
this.enableComment = enableComment;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getBlogCoverImage() {
return blogCoverImage;
}
public void setBlogCoverImage(String blogCoverImage) {
this.blogCoverImage = blogCoverImage;
}
}
| [
"xju833@gmail.com"
] | xju833@gmail.com |
9e5571f1a8115fe8086b92a831cb6887feb39986 | ad9db087bcf5a3bb49d9cc6dab7451519808558f | /src/com/yogee/application/CompanyController.java | 74b7a498f114950ac05563b1745ce2ac53728329 | [] | no_license | habib123/FromHandling | 160367efea4dbd47ef8d959dd16df91a87c4f1b5 | de5f1f241860170debb6cefa325ffac8de64c594 | refs/heads/master | 2020-05-18T18:00:10.321988 | 2014-11-27T22:39:45 | 2014-11-27T22:39:45 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 830 | java | package com.yogee.application;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@Controller
@RequestMapping("/company")
public class CompanyController {
@RequestMapping(value= {"/"})
public ModelAndView launchInputForm() {
ModelAndView model = new ModelAndView( "inputForm");
return model;
}
@RequestMapping(value= {"/submitData"})
public ModelAndView getInputForm(@ModelAttribute UserDomainObject user) {
ModelAndView model = new ModelAndView( "displayResults","user11",user);
return model;
}
@ModelAttribute("user11")
public UserDomainObject inputFormBackingObject33(){
return new UserDomainObject();
}
}
| [
"habib_tum@ymail.com"
] | habib_tum@ymail.com |
f222affc85c5fbc200f8b63c4a7376d19f6e14c5 | 625dbf71a0d1dec2dbc153a6fc25113f90e503ad | /src/com/kartikhariharan/prayerbookapp/adapters/PrayerSearchAdapter.java | c418c13e075d52c3645e01c324aeebe871dad739 | [] | no_license | kartikg3/prayer-book-app | 0efcc17309efbc1169079f9d550695de9ff01a3f | d98b040df0611fcbed2e96f167a84a8edff4dbf4 | refs/heads/master | 2021-01-01T06:17:04.738775 | 2015-01-01T03:25:18 | 2015-01-01T03:25:18 | 19,089,962 | 1 | 1 | null | null | null | null | UTF-8 | Java | false | false | 8,766 | java | package com.kartikhariharan.prayerbookapp.adapters;
import java.util.List;
import com.kartikhariharan.prayerbookapp.Prayer;
import com.kartikhariharan.prayerbookapp.R;
import com.kartikhariharan.prayerbookapp.SearchPrayerDetailExpandOnClickListener;
import com.kartikhariharan.prayerbookapp.ShareOnClickListener;
import com.kartikhariharan.prayerbookapp.R.drawable;
import com.kartikhariharan.prayerbookapp.R.id;
import com.kartikhariharan.prayerbookapp.R.layout;
import com.kartikhariharan.prayerbookapp.activities.SearchableActivity;
import android.content.ContentValues;
import android.content.Context;
import android.database.DataSetObserver;
import android.text.Html;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
public class PrayerSearchAdapter extends ArrayAdapter<Prayer> {
private List<Prayer> prayerList;
Context context;
int lastExpandedPosition;
public PrayerSearchAdapter(Context context, List<Prayer> prayerList) {
super(context, R.layout.row_prayer_title_list, prayerList);
this.context = context;
this.prayerList = prayerList;
this.lastExpandedPosition = -1;
}
public PrayerSearchAdapter(Context context, List<Prayer> prayerList, int lastExpandedPosition) {
super(context, R.layout.row_prayer_title_list, prayerList);
this.context = context;
this.prayerList = prayerList;
this.lastExpandedPosition = lastExpandedPosition;
}
public int getCount() {
return prayerList.size();
}
public Prayer getItem(int arg0) {
return prayerList.get(arg0);
}
public long getItemId(int position) {
return position;
}
public int getItemViewType(int arg0) {
return 0;
}
public View getView(int position, View convertView, ViewGroup parent) {
View row = null;
Prayer prayer = prayerList.get(position);
if (!prayer.isExpandedState()) {
if (row == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = inflater.inflate(R.layout.row_prayer_title_list, parent, false);
}
TextView tvChild = (TextView) row.findViewById(R.id.tvPrayerTitle);
tvChild.setText(prayer.getTitle());
ImageView indicator = (ImageView) row.findViewById(R.id.ivPrayerListIndicator);
if (indicator != null) {
indicator.setImageResource(R.drawable.plus_blue_01);
}
} else {
if (row == null) {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
row = inflater.inflate(R.layout.row_prayer_detail_list, parent, false);
}
TextView tvChild = (TextView) row.findViewById(R.id.tvPrayerTitle);
tvChild.setText(prayer.getTitle());
TextView tvContent = (TextView) row.findViewById(R.id.tvPrayerContent);
String content = new String(prayer.getContent());
String query = new String( ((SearchableActivity) context).getQuery() );
content = content.replaceAll("\n", "<br/>");
content = content.replaceAll( "(?i)("+query+")" ,
String.format("<font color='#FF4500'>$1</font>"));
tvContent.setText(Html.fromHtml(content));
ImageButton indicator = (ImageButton) row.findViewById(R.id.ivPrayerListIndicator);
indicator.setOnClickListener(new SearchPrayerDetailExpandOnClickListener(context, this, prayerList, position) {
@Override
public void onClick(View v) {
Prayer prayer = prayerList.get(this.position);
if ( prayer.isExpandedState() ) {
prayer.setExpandedState(false);
this.plAdapter.setLastExpandedPosition(-1);
this.position = -1;
} else {
prayer.setExpandedState(true);
this.plAdapter.setLastExpandedPosition(this.position);
}
ArrayAdapter<Prayer> newPlAdapter = new PrayerSearchAdapter(context, prayerList, this.position);
((SearchableActivity) context).getLvSearchResults().setAdapter(newPlAdapter);
}
});
if (indicator != null) {
indicator.setBackgroundResource(R.drawable.collapse_blue_01);
}
ImageButton favoritesButton = (ImageButton) row.findViewById(R.id.btnFavorite);
if (prayer.isFavoriteState()) {
favoritesButton.setBackgroundResource(R.drawable.star_yellow_01);
} else {
favoritesButton.setBackgroundResource(R.drawable.star_gray_01);
}
//favoritesButton.setOnClickListener(new SearchFavoriteOnClickListener(context, this, prayerList, prayer) {});
favoritesButton.setOnClickListener(new SearchPrayerDetailExpandOnClickListener(context, this, prayerList, position) {
@Override
public void onClick(View v) {
Prayer prayer = prayerList.get(this.position);
SearchableActivity searchableActivity = (SearchableActivity) context;
ContentValues values = new ContentValues();
if ( prayer.isFavoriteState() ) {
// Update in database
values.put(SearchableActivity.getIsFavorite(), 0);
searchableActivity.getDatabase().update(SearchableActivity.getPrayerTableName(),
values,
String.format("%s=%d",
SearchableActivity.getPrayerId(),
prayer.getId()),
null);
prayer.setFavoriteState(false);
Toast.makeText(context, "Removed from Favorite Prayers", Toast.LENGTH_SHORT).show();
} else {
// Update in database
values.put(SearchableActivity.getIsFavorite(), 1);
searchableActivity.getDatabase().update(SearchableActivity.getPrayerTableName(),
values,
String.format("%s=%d",
SearchableActivity.getPrayerId(),
prayer.getId()),
null);
prayer.setFavoriteState(true);
Toast.makeText(context, "Added to Favorite Prayers", Toast.LENGTH_SHORT).show();
}
ArrayAdapter<Prayer> newPlAdapter = new PrayerSearchAdapter(context, prayerList);
((SearchableActivity) context).getLvSearchResults().setAdapter(newPlAdapter);
}
});
ImageButton shareButton = (ImageButton) row.findViewById(R.id.btnShare);
String promoString = "- Sent via PrayerBookApp";
String textToShare = String.format("%s\n\n%s\n\n%s", prayer.getTitle(), prayer.getContent(), promoString);
shareButton.setOnClickListener(new ShareOnClickListener(context, textToShare) {
});
}
row.setOnClickListener(new SearchPrayerDetailExpandOnClickListener(context, this, prayerList, position) {
@Override
public void onClick(View v) {
Prayer prayer = prayerList.get(this.position);
if ( prayer.isExpandedState() ) {
prayer.setExpandedState(false);
this.plAdapter.setLastExpandedPosition(-1);
this.position = -1;
} else {
prayer.setExpandedState(true);
this.plAdapter.setLastExpandedPosition(this.position);
}
// Collapse all other prayers
for (int i = 0 ; i < prayerList.size() ; i++) {
if (prayer.getId() == prayerList.get(i).getId()) {
continue;
} else {
prayerList.get(i).setExpandedState(false);
}
}
ArrayAdapter<Prayer> newPlAdapter = new PrayerSearchAdapter(context, prayerList, this.position);
((SearchableActivity) context).getLvSearchResults().setAdapter(newPlAdapter);
}
});
return row;
}
@Override
public int getViewTypeCount() {
return 1;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public boolean isEmpty() {
return false;
}
@Override
public void registerDataSetObserver(DataSetObserver observer) {
}
@Override
public void unregisterDataSetObserver(DataSetObserver observer) {
}
@Override
public boolean areAllItemsEnabled() {
return true;
}
@Override
public boolean isEnabled(int position) {
return true;
}
public int getLastExpandedPosition() {
return lastExpandedPosition;
}
public void setLastExpandedPosition(int lastExpandedPosition) {
this.lastExpandedPosition = lastExpandedPosition;
}
public void expandPrayer(int position) {
Prayer prayer = prayerList.get(position);
prayer.setExpandedState(true);
lastExpandedPosition = position;
// Collapse all other prayers
for (int i = 0 ; i < prayerList.size() ; i++) {
if (prayer.getId() == prayerList.get(i).getId()) {
continue;
} else {
prayerList.get(i).setExpandedState(false);
}
}
ArrayAdapter<Prayer> newPlAdapter = new PrayerSearchAdapter(context, prayerList, position);
((SearchableActivity) context).getLvSearchResults().setAdapter(newPlAdapter);
}
}
| [
"kartikg3@gmail.com"
] | kartikg3@gmail.com |
d1925d5f2b4c4d67d2d3c891fd26827e6fa95cb0 | 3ca53c13d2953805c00406476ceda9684887a8ad | /src/com/iwxxm/taf/MDBandType.java | ddadfc012b13b37a7e844406f227cd31b2b9426c | [] | no_license | yw2017051032/tac2iwxxm | ae93c12b08b7316cd59de032d4ae2e8082bc6c0b | 5a08cb9ecd0833fd4435bf6db81a2b8126380ec1 | refs/heads/master | 2020-03-17T03:03:06.671868 | 2018-06-05T16:55:59 | 2018-06-05T17:06:03 | 133,217,637 | 3 | 0 | null | null | null | null | GB18030 | Java | false | false | 6,761 | java | //
// 此文件是由 JavaTM Architecture for XML Binding (JAXB) 引用实现 v2.2.8-b130911.1802 生成的
// 请访问 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// 在重新编译源模式时, 对此文件的所有修改都将丢失。
// 生成时间: 2018.04.04 时间 07:08:22 PM CST
//
package com.iwxxm.taf;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType;
/**
* <p>MD_Band_Type complex type的 Java 类。
*
* <p>以下模式片段指定包含在此类中的预期内容。
*
* <pre>
* <complexType name="MD_Band_Type">
* <complexContent>
* <extension base="{http://www.isotc211.org/2005/gmd}MD_RangeDimension_Type">
* <sequence>
* <element name="maxValue" type="{http://www.isotc211.org/2005/gco}Real_PropertyType" minOccurs="0"/>
* <element name="minValue" type="{http://www.isotc211.org/2005/gco}Real_PropertyType" minOccurs="0"/>
* <element name="units" type="{http://www.isotc211.org/2005/gco}UomLength_PropertyType" minOccurs="0"/>
* <element name="peakResponse" type="{http://www.isotc211.org/2005/gco}Real_PropertyType" minOccurs="0"/>
* <element name="bitsPerValue" type="{http://www.isotc211.org/2005/gco}Integer_PropertyType" minOccurs="0"/>
* <element name="toneGradation" type="{http://www.isotc211.org/2005/gco}Integer_PropertyType" minOccurs="0"/>
* <element name="scaleFactor" type="{http://www.isotc211.org/2005/gco}Real_PropertyType" minOccurs="0"/>
* <element name="offset" type="{http://www.isotc211.org/2005/gco}Real_PropertyType" minOccurs="0"/>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "MD_Band_Type", namespace = "http://www.isotc211.org/2005/gmd", propOrder = {
"maxValue",
"minValue",
"units",
"peakResponse",
"bitsPerValue",
"toneGradation",
"scaleFactor",
"offset"
})
public class MDBandType
extends MDRangeDimensionType
{
protected RealPropertyType maxValue;
protected RealPropertyType minValue;
protected UomLengthPropertyType units;
protected RealPropertyType peakResponse;
protected IntegerPropertyType bitsPerValue;
protected IntegerPropertyType toneGradation;
protected RealPropertyType scaleFactor;
protected RealPropertyType offset;
/**
* 获取maxValue属性的值。
*
* @return
* possible object is
* {@link RealPropertyType }
*
*/
public RealPropertyType getMaxValue() {
return maxValue;
}
/**
* 设置maxValue属性的值。
*
* @param value
* allowed object is
* {@link RealPropertyType }
*
*/
public void setMaxValue(RealPropertyType value) {
this.maxValue = value;
}
/**
* 获取minValue属性的值。
*
* @return
* possible object is
* {@link RealPropertyType }
*
*/
public RealPropertyType getMinValue() {
return minValue;
}
/**
* 设置minValue属性的值。
*
* @param value
* allowed object is
* {@link RealPropertyType }
*
*/
public void setMinValue(RealPropertyType value) {
this.minValue = value;
}
/**
* 获取units属性的值。
*
* @return
* possible object is
* {@link UomLengthPropertyType }
*
*/
public UomLengthPropertyType getUnits() {
return units;
}
/**
* 设置units属性的值。
*
* @param value
* allowed object is
* {@link UomLengthPropertyType }
*
*/
public void setUnits(UomLengthPropertyType value) {
this.units = value;
}
/**
* 获取peakResponse属性的值。
*
* @return
* possible object is
* {@link RealPropertyType }
*
*/
public RealPropertyType getPeakResponse() {
return peakResponse;
}
/**
* 设置peakResponse属性的值。
*
* @param value
* allowed object is
* {@link RealPropertyType }
*
*/
public void setPeakResponse(RealPropertyType value) {
this.peakResponse = value;
}
/**
* 获取bitsPerValue属性的值。
*
* @return
* possible object is
* {@link IntegerPropertyType }
*
*/
public IntegerPropertyType getBitsPerValue() {
return bitsPerValue;
}
/**
* 设置bitsPerValue属性的值。
*
* @param value
* allowed object is
* {@link IntegerPropertyType }
*
*/
public void setBitsPerValue(IntegerPropertyType value) {
this.bitsPerValue = value;
}
/**
* 获取toneGradation属性的值。
*
* @return
* possible object is
* {@link IntegerPropertyType }
*
*/
public IntegerPropertyType getToneGradation() {
return toneGradation;
}
/**
* 设置toneGradation属性的值。
*
* @param value
* allowed object is
* {@link IntegerPropertyType }
*
*/
public void setToneGradation(IntegerPropertyType value) {
this.toneGradation = value;
}
/**
* 获取scaleFactor属性的值。
*
* @return
* possible object is
* {@link RealPropertyType }
*
*/
public RealPropertyType getScaleFactor() {
return scaleFactor;
}
/**
* 设置scaleFactor属性的值。
*
* @param value
* allowed object is
* {@link RealPropertyType }
*
*/
public void setScaleFactor(RealPropertyType value) {
this.scaleFactor = value;
}
/**
* 获取offset属性的值。
*
* @return
* possible object is
* {@link RealPropertyType }
*
*/
public RealPropertyType getOffset() {
return offset;
}
/**
* 设置offset属性的值。
*
* @param value
* allowed object is
* {@link RealPropertyType }
*
*/
public void setOffset(RealPropertyType value) {
this.offset = value;
}
}
| [
"852406820@qq.com"
] | 852406820@qq.com |
e6fc45eadb093e4c824957329ba6ce3b30c738f0 | 5b6d6458a0a7f88dee8acb36f769e176703b8d8f | /Longest Palindromic Substring/src/Solution.java | 813b73b917a5b87a245617bdb6bda440ba81b3e3 | [] | no_license | allench86/leetcode | 2cf3c0acecf42459e9c4c0136605fa98f983326c | 524bed89063df245353bfa4e6a4e360d7eaaa9dd | refs/heads/master | 2016-09-07T19:00:57.608354 | 2015-05-11T05:32:12 | 2015-05-11T05:32:12 | 23,098,320 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,073 | java | public class Solution {
public static void main(String[] args) {
Solution s = new Solution();
String t = "a";
System.out.println(s.longestPalindrome(t));
}
public String longestPalindrome(String s) {
if (s == null || s.isEmpty()) {
return s;
}
String longest = s.substring(0, 1);
for (int i = 0; i < s.length() - 1; i++) {
String tmp = findPalindrome(s, i, i);
if (tmp.length() > longest.length()) {
longest = tmp;
}
tmp = findPalindrome(s, i, i + 1);
if (tmp.length() > longest.length()) {
longest = tmp;
}
}
return longest;
}
private String findPalindrome(String s, int centerIndex1, int centerIndex2) {
while (centerIndex1 >= 0 && centerIndex2 < s.length() && s.charAt(centerIndex1) == s.charAt(centerIndex2)) {
centerIndex1--;
centerIndex2++;
}
return s.substring(centerIndex1 + 1, centerIndex2);
}
}
| [
"allench86@gmail.com"
] | allench86@gmail.com |
c6ce9191f1ca9ab961e21e0658f53f5a7dd8572d | 54ff6035dd35bef90bf45ab953c1bd8227b30357 | /bookstore-catalog-service/src/main/java/com/devd/spring/bookstorecatalogservice/service/ProductService.java | 68d9abcafbbd3c42b00ce74d4ea59d5c28260ef0 | [] | no_license | rtnkanth/BookStoreApp-Distributed-Application-Master | fc9920973235e87b84b37cda2fd05734f0f4911f | 305952379d25c7cec766712f55fa451ac9699a6e | refs/heads/master | 2023-01-06T20:36:08.007115 | 2020-11-08T13:41:35 | 2020-11-08T13:41:35 | 310,784,551 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 836 | java | package com.devd.spring.bookstorecatalogservice.service;
import com.devd.spring.bookstorecatalogservice.repository.dao.Product;
import com.devd.spring.bookstorecatalogservice.web.CreateProductRequest;
import com.devd.spring.bookstorecatalogservice.web.UpdateProductRequest;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import javax.validation.Valid;
/**
* @author: Rtnkanth, Date : 2020-09-27
*/
public interface ProductService {
String createProduct(@Valid CreateProductRequest createProductRequest);
Product getProduct(String productId);
void deleteProduct(String productId);
void updateProduct(UpdateProductRequest updateProductRequest);
Page<Product> findAllProducts(Pageable pageable);
Page<Product> getAllProducts(String sort, Integer page, Integer size);
}
| [
"rtnkanth@gmail.com"
] | rtnkanth@gmail.com |
3ec5d7c50d7da98bd9d7611909cde8d3fb5cea8d | a2f856405ca9fd949ffddbe696e9f733df96b2c8 | /app/src/main/java/com/example/timeline/AdminAppReleases.java | d3214bab8ea908b9545df000f9f00c9a1ef8657e | [] | no_license | rejonehridoy/Timeline | 5cfa36a1d537f6a9738ec248c1bf9e716c1146d5 | 283574e2d89d2eea799cca1ddd703ceb6eef0590 | refs/heads/master | 2022-12-22T03:56:08.399824 | 2020-09-22T21:00:11 | 2020-09-22T21:00:11 | 297,771,342 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 9,146 | java | package com.example.timeline;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.SearchView;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.textfield.TextInputLayout;
import com.google.firebase.database.annotations.Nullable;
import com.google.firebase.firestore.DocumentSnapshot;
import com.google.firebase.firestore.EventListener;
import com.google.firebase.firestore.FirebaseFirestore;
import com.google.firebase.firestore.FirebaseFirestoreException;
import com.google.firebase.firestore.QueryDocumentSnapshot;
import com.google.firebase.firestore.QuerySnapshot;
import java.util.ArrayList;
public class AdminAppReleases extends AppCompatActivity {
private TextInputLayout id,bug,description,downloadLink,releaseDate,version,versionType;
private ReleaseInfoAdapter mAdapter;
private RecyclerView.LayoutManager mLayoutManager;
private RecyclerView info_recylerView;
private Toolbar all_toolbar,latest_toolbar;
private LinearLayout layout_all_releases,layout_latest;
private FloatingActionButton btnAdd;
private Button btnBrowse;
private ArrayList<ReleaseInfo> infos = new ArrayList<>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_admin_app_releases);
layout_all_releases = findViewById(R.id.AAR_layout_all);
layout_latest = findViewById(R.id.AAR_layout_latest);
btnAdd = findViewById(R.id.AAR_btnAdd);
info_recylerView = findViewById(R.id.AAR_all_recylerView);
//latest section
id = findViewById(R.id.AAR_id);
description = findViewById(R.id.AAR_description);
bug = findViewById(R.id.AAR_bug);
downloadLink = findViewById(R.id.AAR_downloadLink);
releaseDate = findViewById(R.id.AAR_releaseDate);
version = findViewById(R.id.AAR_appVersion);
versionType = findViewById(R.id.AAR_versionType);
btnBrowse = findViewById(R.id.AAR_btnBrowse);
toolbar_setting();
get_data_from_firebase();
get_latest_release_data();
BottomNavigationView bottomNav = findViewById(R.id.AAR_bottomNavigation);
bottomNav.setOnNavigationItemSelectedListener(navListener);
btnAdd.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
startActivity(new Intent(AdminAppReleases.this,AdminAppReleasesNew.class));
}
});
btnBrowse.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if (downloadLink !=null && downloadLink.getEditText() !=null && !downloadLink.getEditText().toString().isEmpty()){
Uri webpage = Uri.parse(downloadLink.getEditText().getText().toString());
Intent webintent = new Intent(Intent.ACTION_VIEW,webpage);
startActivity(webintent);
}
}
});
}
@Override
protected void onStart() {
super.onStart();
get_data_from_firebase();
get_latest_release_data();
}
private void get_data_from_firebase(){
FirebaseFirestore.getInstance().collection("UpdateRelease").addSnapshotListener(this, new EventListener<QuerySnapshot>() {
@Override
public void onEvent(@Nullable QuerySnapshot queryDocumentSnapshots, @Nullable FirebaseFirestoreException e) {
if (e!=null){
return;
}
if (!queryDocumentSnapshots.isEmpty()){
infos.clear();
for (QueryDocumentSnapshot snapshot:queryDocumentSnapshots){
infos.add(snapshot.toObject(ReleaseInfo.class));
}
info_recylerView.setHasFixedSize(true);
mLayoutManager = new LinearLayoutManager(AdminAppReleases.this);
mAdapter = new ReleaseInfoAdapter(infos);
info_recylerView.setLayoutManager(mLayoutManager);
info_recylerView.setAdapter(mAdapter);
mAdapter.setOnItemClickListener(new ReleaseInfoAdapter.OnItemClickListener() {
@Override
public void onItemClick(int position) {
Intent intent = new Intent(AdminAppReleases.this,AdminAppReleaseDetails.class);
intent.putExtra("id",infos.get(position).getId());
intent.putExtra("bug",infos.get(position).getBug());
intent.putExtra("downloadLink",infos.get(position).getDownloadLink());
intent.putExtra("description",infos.get(position).getDescription());
intent.putExtra("releaseDate",infos.get(position).getReleaseDate());
intent.putExtra("version",infos.get(position).getVersion());
intent.putExtra("versionType",infos.get(position).getVersionType());
startActivity(intent);
}
});
}
}
});
}
private void toolbar_setting(){
// this is for latest toolbar
latest_toolbar = findViewById(R.id.AAR_latest_toolbar);
latest_toolbar.setTitle("Latest Version");
setSupportActionBar(latest_toolbar);
// this is for all toolbar
all_toolbar = findViewById(R.id.AAR_all_toolbar);
all_toolbar.setTitle("Releases");
setSupportActionBar(all_toolbar);
}
private BottomNavigationView.OnNavigationItemSelectedListener navListener =
new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()) {
case R.id.releases_nav_all:
layout_all_releases.setVisibility(View.VISIBLE);
layout_latest.setVisibility(View.GONE);
break;
case R.id.releases_nav_latest:
layout_all_releases.setVisibility(View.GONE);
layout_latest.setVisibility(View.VISIBLE);
break;
}
return true;
}
};
private void get_latest_release_data(){
FirebaseFirestore.getInstance().collection("UpdateRelease").document("latestRelease")
.addSnapshotListener(this, new EventListener<DocumentSnapshot>() {
@Override
public void onEvent(@javax.annotation.Nullable DocumentSnapshot documentSnapshot, @javax.annotation.Nullable FirebaseFirestoreException e) {
if (documentSnapshot.exists()){
id.getEditText().setText(documentSnapshot.getString("id"));
bug.getEditText().setText(documentSnapshot.getString("bug"));
description.getEditText().setText(documentSnapshot.getString("description"));
version.getEditText().setText(documentSnapshot.getString("version"));
versionType.getEditText().setText(documentSnapshot.getString("versionType"));
releaseDate.getEditText().setText(documentSnapshot.getString("releaseDate"));
downloadLink.getEditText().setText(documentSnapshot.getString("downloadLink"));
}
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.password_manager_menu,menu);
MenuItem searchItem = menu.findItem(R.id.PM_search_menu);
SearchView searchView = (SearchView) searchItem.getActionView();
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
return false;
}
@Override
public boolean onQueryTextChange(String s) {
mAdapter.getFilter().filter(s);
return false;
}
});
return true;
}
}
| [
"rejone.hridoy@gmail.com"
] | rejone.hridoy@gmail.com |
9232a6cf706ca76d505f9fb61c36ddf58941009a | d9a96c7322c52e8fdca4ef3927d6ed2c8d1bfa42 | /app/src/main/java/fr/rogerleoen/edeipapp/AccueilCahierTextActivity.java | 81e556423c170ce4ef16623e64fb6a6fea6ea8bb | [] | no_license | roger-jb/EdeipApp | 365d729fcf92e25cad91776a62051bf228352cae | 96da382d60726214ce49493b9edc8b09133dabfc | refs/heads/master | 2021-01-18T10:52:34.586246 | 2016-05-29T08:50:41 | 2016-05-29T08:50:41 | 56,853,443 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 363 | java | package fr.rogerleoen.edeipapp;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
public class AccueilCahierTextActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_accueil_cahier_text);
}
}
| [
"roger.jeanbaptiste@gmail.com"
] | roger.jeanbaptiste@gmail.com |
c83cfbe2d8d462d06df1dff53a1905cd3ca0aa9c | 7a5a7000afeabd1c82acc633e0b38c9e52bcd3a1 | /src/main/java/com/sanguebom/group/sanguebomsd/Atividades/ActivityCadastro.java | cd2df70a44a7fcbc5e715c3ed54a7374560f67a2 | [] | no_license | rntser/sanguebomfinal | 6af4cd010f524316ab85a3afdc2a7d0d4fe4c176 | 8730fcca59275bd489c0231105962645fd9b04e3 | refs/heads/master | 2020-04-21T04:32:57.808722 | 2019-02-05T21:28:38 | 2019-02-05T21:28:38 | 169,315,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,901 | java | package com.sanguebom.group.sanguebomsd.Atividades;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.Switch;
import android.widget.Toast;
import com.google.android.gms.tasks.OnCompleteListener;
import com.google.android.gms.tasks.Task;
import com.google.firebase.auth.AuthResult;
import com.google.firebase.auth.FirebaseAuth;
import com.sanguebom.group.sanguebomsd.MainActivity;
import com.sanguebom.group.sanguebomsd.Models.Usuario;
import com.sanguebom.group.sanguebomsd.R;
import com.sanguebom.group.sanguebomsd.config.ConfiguracaoFirebase;
public class ActivityCadastro extends MainActivity {
private EditText campoEmail, campoSenha;
private Button botaoCadastrarUsuario;
private FirebaseAuth autenticacao;
private Usuario usuario;
private ImageView logarUsandoFacebook;
private Switch tipoAcesso;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_cadastro);
tipoAcesso = findViewById(R.id.switchAcesso);
campoSenha = findViewById(R.id.edtSenha);
campoEmail = findViewById(R.id.edtEmail);
logarUsandoFacebook = (ImageView) findViewById(R.id.imgFacebookid);
logarUsandoFacebook.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
startActivity(new Intent(ActivityCadastro.this, MainActivity.class));
}
});
botaoCadastrarUsuario = findViewById( R.id.btncadastrarUsuárioId);
//cadastro de usuário
botaoCadastrarUsuario.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
String textoEmail = campoEmail.getText().toString();
String textoSenha = campoSenha.getText().toString();
//validar se os campos foram preenchidos
if (!textoEmail.isEmpty()){
if(!textoSenha.isEmpty()){
usuario = new Usuario();
usuario.setEmail(textoEmail);
usuario.setSenha(textoSenha);
cadastrarUsuario();
//verificar se tiver logado
if(tipoAcesso.isChecked()){//cadastro
autenticacao.createUserWithEmailAndPassword(
textoEmail, textoSenha
).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if( task.isSuccessful()){
Toast.makeText(ActivityCadastro.this, "Cadastro realizado com sucesso",Toast.LENGTH_SHORT).show();
//direcionar para tela principal do app
}else{
Toast.makeText(ActivityCadastro.this, "Falha ao cadastrar usuário",Toast.LENGTH_SHORT).show();
}
}
});
}else {//login do usuário
autenticacao.signInWithEmailAndPassword(
textoEmail, textoSenha
).addOnCompleteListener(new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if( task.isSuccessful()){
Toast.makeText(ActivityCadastro.this, "Logado realizado com sucesso",Toast.LENGTH_SHORT).show();
startActivity(new Intent(getApplicationContext(),ActivityCategorias.class));
}
else{
Toast.makeText(ActivityCadastro.this, "Erro ao fazer o login" +task.getException(),Toast.LENGTH_SHORT).show();
}
}
});
}
}else{
Toast.makeText(ActivityCadastro.this, "Prencha a senha!", Toast.LENGTH_SHORT).show();
}
}
else{
Toast.makeText(ActivityCadastro.this, "Prencha o E-mail!", Toast.LENGTH_SHORT).show();
}
}
});
}
public void cadastrarUsuario(){
autenticacao = ConfiguracaoFirebase.getFirebaseAutenticacao();
autenticacao.createUserWithEmailAndPassword( usuario.getEmail(),usuario.getSenha()
).addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()){
Toast.makeText(ActivityCadastro.this, "Sucesso ao cadastrar usuário!", Toast.LENGTH_SHORT).show();
startActivity(new Intent(getApplicationContext(),ActivityCategorias.class));
finish();
}else{
Toast.makeText(ActivityCadastro.this, "Erro ao cadastrar usuario!", Toast.LENGTH_SHORT).show();
}
}
});
}
} | [
"renatonogueira74@gmail.com"
] | renatonogueira74@gmail.com |
752be3696b50f91fd210feaf5630478b8223632c | fdf2a9387e8f662cc34fa835981c4941695e52da | /fxclient-app/src/main/java/com/fxclient/app/util/NetSettingUtil.java | 5ab14560f1d63356ebbc294424e8e3da2050a38c | [] | no_license | wubinzhuang/client | fb6ac200f07f1772598568e823960375943e1dcf | 400d9f1bad751abe6cb6fe5b2eb50b90c5fb40b5 | refs/heads/master | 2021-09-09T23:59:02.284837 | 2018-03-20T09:19:47 | 2018-03-20T09:19:47 | 125,969,868 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,505 | java | package com.fxclient.app.util;
import java.io.*;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.fxclient.app.model.NetSettingBo;
import com.fxclient.framework.appcontext.FxAppContext;
public class NetSettingUtil
{
public static List<NetSettingBo> Load()
{
try
{
FileReader netstr = new FileReader(FxAppContext.getInstance().getBaseDir() + File.separator + "config" + File.separator + "netsttings");
BufferedReader bufferedReader = new BufferedReader(netstr);
String str = null;
StringBuffer sb = new StringBuffer();
while ((str = bufferedReader.readLine()) != null)
{
sb.append(str);
}
bufferedReader.close();
List<NetSettingBo> netsttrings = JSON.parseArray(sb.toString(), NetSettingBo.class);
return netsttrings;
}
catch (IOException e)
{
System.out.println(e.getMessage());
}
return null;
}
public static void SaveNetSettings(List<NetSettingBo> netSettings)
{
String json = JSON.toJSONString(netSettings);
try
{
Writer w = new FileWriter(FxAppContext.getInstance().getBaseDir() + File.separator + "config" + File.separator + "netsttings", false);
w.write(json);
w.close();
}
catch (IOException e)
{
System.out.println(e.getMessage());
}
}
}
| [
"wubin.zhuang@yeadun.com"
] | wubin.zhuang@yeadun.com |
cf322b6a50307dcb4d47c95e55d2cff433491c7b | 9d5a71dc716312c931cc8c036c9eed22a6df5057 | /src/tests/PerspectiveCamController.java | b25792fb2c27a8c9867ba7efc7a7eada606b0551 | [] | no_license | FlipE/EntityUnknown | ffadb36f9dc8a835f337b6471037a4e86b5e0390 | a5deb5931963e3ce16f49921f9329e0403806fb3 | refs/heads/master | 2020-05-18T01:09:53.806608 | 2013-04-13T16:08:30 | 2013-04-13T16:08:30 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,041 | java | package tests;
/*******************************************************************************
* Copyright 2011 See AUTHORS file.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
******************************************************************************/
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputAdapter;
import com.badlogic.gdx.graphics.PerspectiveCamera;
import com.badlogic.gdx.math.Matrix4;
import com.badlogic.gdx.math.Plane;
import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.math.Vector3;
public class PerspectiveCamController extends InputAdapter {
public PerspectiveCamera cam;
enum TransformMode {
Rotate, Translate, Zoom, None
}
Vector3 lookAt = new Vector3();
TransformMode mode = TransformMode.Translate;
boolean translated = false;
public PerspectiveCamController (PerspectiveCamera cam) {
this.cam = cam;
}
@Override
public boolean touchDown (int x, int y, int pointer, int button) {
mode = TransformMode.Rotate;
last.set(x, y);
tCurr.set(x, y);
return true;
}
@Override
public boolean touchUp (int x, int y, int pointer, int button) {
mode = TransformMode.None;
return true;
}
Vector2 tCurr = new Vector2();
Vector2 last = new Vector2();
Vector2 delta = new Vector2();
Vector2 currWindow = new Vector2();
Vector2 lastWindow = new Vector2();
Vector3 curr3 = new Vector3();
Vector3 delta3 = new Vector3();
Plane lookAtPlane = new Plane(new Vector3(0, 1, 0), 0);
Matrix4 rotMatrix = new Matrix4();
Vector3 xAxis = new Vector3(1, 0, 0);
Vector3 yAxis = new Vector3(0, 1, 0);
Vector3 point = new Vector3();
@Override
public boolean touchDragged (int x, int y, int pointer) {
if (pointer != 0) return false;
delta.set(x, y).sub(last);
if (mode == TransformMode.Rotate) {
point.set(cam.position).sub(lookAt);
if (point.tmp().nor().dot(yAxis) < 0.9999f) {
xAxis.set(cam.direction).crs(yAxis).nor();
rotMatrix.setToRotation(xAxis, delta.y / 5);
point.mul(rotMatrix);
}
rotMatrix.setToRotation(yAxis, -delta.x / 5);
point.mul(rotMatrix);
cam.position.set(point.add(lookAt));
cam.lookAt(lookAt.x, lookAt.y, lookAt.z);
}
if (mode == TransformMode.Zoom) {
cam.fieldOfView -= -delta.y / 10;
}
if (mode == TransformMode.Translate) {
tCurr.set(x, y);
translated = true;
}
cam.update();
last.set(x, y);
return true;
}
@Override
public boolean scrolled (int amount) {
cam.fieldOfView -= -amount * Gdx.graphics.getDeltaTime() * 100;
cam.update();
return true;
}
}
| [
"chris@cbaker.co.uk"
] | chris@cbaker.co.uk |
70ef3d2adb698df8f6a4b577c01ab7e5c9afe7fb | 0b37d1d8b4f02d51e24a84010bffe44c648e2438 | /hongs-core/src/main/java/io/github/ihongs/action/ActionDriver.java | dabf930155a4e80f1981309749f9e187700548f6 | [
"MIT"
] | permissive | ihongs/HongsCORE | 331ffec67038e155c5f789caf3290eadc92482bc | 919f43e208f3d7d59103de18685bdfbed8daa3c6 | refs/heads/master | 2023-09-04T03:03:05.681551 | 2023-08-26T08:00:26 | 2023-08-26T08:00:26 | 57,011,712 | 63 | 10 | MIT | 2023-06-13T23:10:24 | 2016-04-25T04:29:13 | Java | UTF-8 | Java | false | false | 38,144 | java | package io.github.ihongs.action;
import io.github.ihongs.Cnst;
import io.github.ihongs.Core;
import io.github.ihongs.CoreConfig;
import io.github.ihongs.CoreLocale;
import io.github.ihongs.CoreLogger;
import io.github.ihongs.HongsCause;
import io.github.ihongs.util.Dist;
import io.github.ihongs.util.Inst;
import io.github.ihongs.util.Syno;
import io.github.ihongs.util.Synt;
import io.github.ihongs.util.daemon.Chore;
import io.github.ihongs.util.daemon.Gate;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.Enumeration;
import java.util.Properties;
import java.util.HashMap;
import java.util.Map;
import java.util.List;
import java.util.Locale;
import java.util.TimeZone;
import java.util.function.Consumer;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.RequestDispatcher;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletContext;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequestWrapper;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.servlet.http.Cookie;
import javax.servlet.http.Part;
/**
* 动作驱动器
*
* <p>
* 其他的 Servlet,Filter 继承此类即可安全的使用 Core 请求对象;
* 也可以将其作为 Filter 加入到 web.xml,
* 其后的 Servlet,Filter 实例对象均可安全的使用 Core 请求对象.
* </p>
*
* <h3>配置选项:</h3>
* <pre>
* server.id 服务ID
* core.language.probing 探测语言
* core.language.default 默认语言
* core.timezone.probing 探测时区
* core.timezone.default 默认时区
* </pre>
*
* @author Hong
*/
public class ActionDriver implements Filter, Servlet {
private static final Pattern URL_REG = Pattern.compile("^\\w+://[^/]+");
private static final Pattern URI_REG = Pattern.compile("^\\w+://|^/" );
private transient FilterConfig FILT_CONF = null;
private transient ServletConfig SERV_CONF = null;
/**
* 首位标识, 为 true 表示最先执行,负责初始化和清理
*/
private transient boolean FIRST = false;
/**
* 关闭标识, 为 true 表示有初始化, 需要承担全局清理
*/
private transient boolean SETUP = false;
/**
* 初始化 Filter
* @param conf
* @throws ServletException
*/
@Override
public void init( FilterConfig conf) throws ServletException {
this.init(conf.getServletContext());
this.FILT_CONF = conf;
}
/**
* 初始化 Servlet
* @param conf
* @throws ServletException
*/
@Override
public void init(ServletConfig conf) throws ServletException {
this.init(conf.getServletContext());
this.SERV_CONF = conf;
}
/**
* 公共初始化
* @param cont
* @throws ServletException
*/
synchronized final void init(ServletContext cont) throws ServletException {
if (Core.ENVIR != 1) {
Core.ENVIR = 1;
} else {
return;
}
Properties def = CoreConfig.getInstance("default");
Properties cnf = CoreConfig.getInstance("defines");
FIRST=true;
if (Core.SERV_PATH == null) {
SETUP=true;
System.setProperty("file.encoding", "UTF-8");
/** 核心属性配置 **/
Core.DEBUG = Synt.declare(cont.getInitParameter("debug"), (byte) 0);
Core.SERVER_ID = Synt.declare(cont.getInitParameter("server-id"), "0" );
Core.SERV_PATH = cont.getContextPath();
Core.BASE_PATH = cont.getRealPath ("");
Core.BASE_PATH = Core.BASE_PATH.replaceFirst("[/\\\\]$", "");
Core.CORE_PATH = Core.BASE_PATH + File.separator + "WEB-INF";
Core.CONF_PATH = Core.CORE_PATH + File.separator + "etc";
Core.DATA_PATH = Core.CORE_PATH + File.separator + "var";
//** 系统属性配置 **/
// 用于替换下面系统属性中的变量
Map m = new HashMap(5);
m.put("SERVER_ID", Core.SERVER_ID);
m.put("BASE_PATH", Core.BASE_PATH);
m.put("CORE_PATH", Core.CORE_PATH);
m.put("CONF_PATH", Core.CONF_PATH);
m.put("DATA_PATH", Core.DATA_PATH);
// 启动系统属性
for(Map.Entry et : cnf.entrySet()) {
String k = (String) et.getKey ();
String v = (String) et.getValue();
if (k.startsWith("envir.")) {
k = k.substring(6 );
v = Syno.inject(v,m);
System.setProperty(k,v);
}
}
if (4 == (4 & Core.DEBUG)) {
// 调试系统属性
for(Map.Entry et : cnf.entrySet()) {
String k = (String) et.getKey ();
String v = (String) et.getValue();
if (k.startsWith("debug.")) {
k = k.substring(6 );
v = Syno.inject(v,m);
System.setProperty(k,v);
}
}
}
// 默认域名前缀
String su = System.getProperty ("serv.url");
if (null != su) {
Matcher matcher = URL_REG.matcher( su );
if (matcher.find()) {
Core.SERV_PATH = su.substring(0 + matcher.end());
Core.SERV_HREF = su.substring(0 , matcher.end());
} else {
Core.SERV_PATH = su;
Core.SERV_HREF = "";
}
}
// 设置默认语言
Core.ACTION_LANG.set(def.getProperty("core.language.default", Cnst.LANG_DEF));
Core.ACTION_ZONE.set(def.getProperty("core.timezone.default", Cnst.ZONE_DEF));
TimeZone.setDefault ( TimeZone.getTimeZone(Core.getZoneId( )) );
Locale .setDefault ( Core.getLocale() );
}
// 调用一下可预加载动作类
ActionRunner.getActions();
// 清空全局以准备重新开始
Core.GLOBAL_CORE.reset( );
// 设置全局资源锁清理任务
Chore ch = Chore.getInstance( );
ch.runTimed(() -> Gate.clean());
// 启动后需立即执行的任务
String ss = cnf.getProperty ( "serve.init" );
if (ss != null) for (String sn : ss .split(";")) {
sn = sn.trim();
if (! sn.isEmpty()) try {
Class cs = Class.forName(sn);
if (Consumer.class.isAssignableFrom(cs)) {
((Consumer)cs.getDeclaredConstructor().newInstance()).accept(cont);
} else
if (Runnable.class.isAssignableFrom(cs)) {
((Runnable)cs.getDeclaredConstructor().newInstance()).run();
} else
{
throw new ServletException("Can not run init class: "+sn);
}
} catch (ClassNotFoundException ex) {
throw new ServletException(ex);
} catch ( NoSuchMethodException ex) {
throw new ServletException(ex);
} catch (IllegalAccessException ex) {
throw new ServletException(ex);
} catch (InstantiationException ex) {
throw new ServletException(ex);
} catch (InvocationTargetException ex) {
throw new ServletException(ex);
}
}
CoreLogger.info(
"Action server is started"
+ "\r\n\tDEBUG : {}"
+ "\r\n\tSERVER_ID : {}"
+ "\r\n\tCORE_PATH : {}"
+ "\r\n\tCONF_PATH : {}"
+ "\r\n\tDATA_PATH : {}"
+ "\r\n\tBASE_PATH : {}"
+ "\r\n\tSERV_HREF : {}{}",
Core.DEBUG , Core.SERVER_ID,
Core.CORE_PATH, Core.CONF_PATH,
Core.DATA_PATH, Core.BASE_PATH,
Core.SERV_HREF, Core.SERV_PATH
);
}
/**
* 公共销毁
*/
@Override
public void destroy () {
if (!FIRST) {
return;
}
long time = System.currentTimeMillis()
- Core.STARTS_TIME;
Core core = Core.GLOBAL_CORE;
CoreLogger.info(
"Action server is stopped"
+ "\r\n\tSERVER_ID : {}"
+ "\r\n\tRuntime : {}"
+ "\r\n\tObjects : {}",
Core.SERVER_ID,
Inst.phrase(time),
core.toString ( )
);
if (!SETUP) {
return;
}
try {
Core.GLOBAL_CORE.reset( );
} catch ( Throwable e) {
CoreLogger.error(e);
}
}
@Override
public void service (ServletRequest rep, ServletResponse rsp)
throws ServletException, IOException {
doDriver(rep, rsp, new DriverProxy() {
@Override
public void doDriver(Core core, ActionHelper hlpr)
throws ServletException, IOException {
doAction(core, hlpr);
}
});
}
@Override
public void doFilter(ServletRequest rep, ServletResponse rsp, final FilterChain chn)
throws ServletException, IOException {
doDriver(rep, rsp, new DriverProxy() {
@Override
public void doDriver(Core core, ActionHelper hlpr)
throws ServletException, IOException {
doFilter(core, hlpr, chn);
}
});
}
final void doDriver(ServletRequest rep, ServletResponse rsp, final DriverProxy agt)
throws ServletException, IOException {
HttpServletRequest req = (HttpServletRequest ) rep;
HttpServletResponse rsq = (HttpServletResponse) rsp;
ActionHelper hlpr;
Core core = (Core) req.getAttribute(Core.class.getName());
if ( core == null) {
/**
* 外层调用
*/
core = Core.getInstance( );
req.setAttribute ( Core.class.getName(), core );
hlpr = new ActionHelper( req, rsq );
core.set ( ActionHelper.class.getName(), hlpr );
try {
doLaunch(core, hlpr, req );
agt.doDriver ( core, hlpr);
doCommit(core, hlpr, req, rsq );
} catch (IOException ex) {
// 非调试模式忽略客户端中途断开
if (4 != (4 & Core.DEBUG)) {
Throwable cx = ex.getCause( );
if (cx != null
&& cx.getClass().getSimpleName().equalsIgnoreCase("EofException")) {
throw ex;
}
if (ex.getClass().getSimpleName().equalsIgnoreCase("EofException")) {
throw ex;
}
}
CoreLogger.error(ex);
throw ex;
} catch (ServletException | RuntimeException ex) {
// 30x,40x 错误不需要记录到日志
if (4 != (4 & Core.DEBUG)) {
Throwable cx = ex.getCause( );
if (cx instanceof HongsCause) {
int st = ((HongsCause)cx).getState();
if (299 < st && st < 500) {
throw ex;
}
}
if (ex instanceof HongsCause) {
int st = ((HongsCause)ex).getState();
if (299 < st && st < 500) {
throw ex;
}
}
}
CoreLogger.error(ex);
throw ex;
} catch (Error er) {
CoreLogger.error(er);
throw er;
} finally {
doFinish(core, hlpr, req );
}
} else {
/**
* 内层调用
*/
Core.THREAD_CORE.set(core);
hlpr = core.got(ActionHelper.class);
hlpr.updateHelper( req, rsq );
/**/ agt.doDriver(core, hlpr);
}
}
private void doCommit(Core core, ActionHelper hlpr, HttpServletRequest req, HttpServletResponse rsp)
throws ServletException, IOException {
/**
* 输出特定服务信息
*/
if (rsp.isCommitted( ) == false) {
String pb;
CoreConfig cc = core.got(CoreConfig.class);
pb = cc.getProperty("core.service.by");
if ( pb != null && pb.length( ) != 0 ) {
rsp.setHeader( "Server" , pb );
}
pb = cc.getProperty("core.powered.by");
if ( pb != null && pb.length( ) != 0 ) {
rsp.setHeader("X-Powered-By", pb );
}
}
Map dat = hlpr.getResponseData();
if (dat != null) {
req .setAttribute( Cnst.RESPON_ATTR, dat );
hlpr.updateHelper( req, rsp );
hlpr.flush();
}
}
private void doLaunch(Core core, ActionHelper hlpr, HttpServletRequest req)
throws ServletException {
Core.ACTION_TIME.set(System.currentTimeMillis(/***/));
Core.ACTION_NAME.set(getOriginPath(req).substring(1));
/*
// 无需指定, 在需要时提取
Core.CLIENT_ADDR.set(getClientAddr(req));
Core.SERVER_HREF.set(getServerHref(req));
*/
// 外部没有指定网站域名则在首次请求时进行设置(非线程安全)
if (Core.SERV_HREF == null
|| Core.SERV_HREF.isEmpty()) {
Core.SERV_HREF = Core.SERVER_HREF.get();
}
CoreConfig conf = core.got(CoreConfig.class);
Core.ACTION_LANG.set(conf.getProperty("core.language.default", Cnst.LANG_DEF));
if (conf.getProperty("core.language.probing", false)) {
/**
* 语言可以记录到Session/Cookies里
*/
String sess = conf.getProperty("core.language.session", Cnst.LANG_KEY);
String lang = (String) hlpr.getSessibute(sess);
if (lang == null || lang.length() == 0) {
lang = (String) hlpr.getCookibute(sess);
if (lang == null || lang.length() == 0) {
lang = req.getHeader("Accept-Language");
}
}
/**
* 检查是否是支持的语言
*/
if (lang != null) {
lang = CoreLocale.getAcceptLanguage(lang);
if (lang != null) {
Core.ACTION_LANG.set(lang);
}
}
}
Core.ACTION_ZONE.set(conf.getProperty("core.timezone.default", Cnst.ZONE_DEF));
if (conf.getProperty("core.timezone.probing", false)) {
/**
* 时区可以记录到Session/Cookies里
*/
String sess = conf.getProperty("core.timezone.session", Cnst.ZONE_KEY);
String zone = (String) hlpr.getSessibute(sess);
if (zone == null || zone.length() == 0) {
zone = (String) hlpr.getCookibute(sess);
if (zone == null || zone.length() == 0) {
zone = req.getHeader(/**/ "X-Timezone");
}
}
/**
* 过滤一下避免错误时区
*/
if (zone != null) {
zone = TimeZone.getTimeZone(zone).getID();
// if (zone != null) {
Core.ACTION_ZONE.set(zone);
// }
}
}
}
private void doFinish(Core core, ActionHelper hlpr, HttpServletRequest req) {
try {
if (4 == (4 & Core.DEBUG)) {
/**
* 提取必要的客户相关标识
* 以便判断用户和模拟登录
*/
HttpSession ses;
Object uid;
String mem;
String tim;
req = hlpr.getRequest(/***/);
ses = req .getSession(false);
tim = Inst.phrase(System.currentTimeMillis() - Core.ACTION_TIME.get());
uid = hlpr.getSessibute(Cnst.UID_SES);
if (uid != null) {
mem = "uid="+ uid.toString();
} else
if (ses != null) {
mem = "sid="+ ses. getId ( );
} else {
mem = "-";
}
StringBuilder sb = new StringBuilder("...");
sb.append("\r\n\tACTION_NAME : ").append(Core.ACTION_NAME.get())
.append("\r\n\tACTION_TIME : ").append(Core.ACTION_TIME.get())
.append("\r\n\tACTION_LANG : ").append(Core.ACTION_LANG.get())
.append("\r\n\tACTION_ZONE : ").append(Core.ACTION_ZONE.get())
.append("\r\n\tThread : ").append(Thread.currentThread().getName())
.append("\r\n\tMethod : ").append(req.getMethod())
.append("\r\n\tMember : ").append(mem)
.append("\r\n\tRuntime : ").append(tim)
.append("\r\n\tObjects : ").append(core.toString());
/**
* 显示请求报头及输入输出
* 这对调试程序非常有帮助
*/
if (Synt.declare(System.getProperty("show.headers"), false)) {
Map map = new HashMap();
Enumeration<String> nms = req.getHeaderNames();
while (nms.hasMoreElements()) {
String nme = nms.nextElement();
map.put(nme , req.getHeader(nme));
}
if (!map.isEmpty()) {
sb.append("\r\n\tHeaders : ")
.append(Syno.indent(Dist.toString(map)).substring(1));
}
}
if (Synt.declare(System.getProperty("show.context"), false)) {
Map map = new HashMap();
Enumeration<String> nms = req.getAttributeNames();
while (nms.hasMoreElements()) {
String nme = nms.nextElement();
map.put(nme , req.getAttribute(nme));
}
if (!map.isEmpty()) {
sb.append("\r\n\tContext : ")
.append(Syno.indent(Dist.toString(map)).substring(1));
}
}
if (Synt.declare(System.getProperty("show.session"), false) && ses != null) {
Map map = new HashMap();
Enumeration<String> nms = ses.getAttributeNames();
while (nms.hasMoreElements()) {
String nme = nms.nextElement();
map.put(nme , ses.getAttribute(nme));
}
if (!map.isEmpty()) {
sb.append("\r\n\tSession : ")
.append(Syno.indent(Dist.toString(map)).substring(1));
}
}
if (Synt.declare(System.getProperty("show.cookies"), false)) {
Map map = new HashMap();
Cookie[] cks = req.getCookies();
for (Cookie cke : cks) {
map.put(cke.getName( ), cke.getValue( ));
}
if (!map.isEmpty()) {
sb.append("\r\n\tCookies : ")
.append(Syno.indent(Dist.toString(map)).substring(1));
}
}
if (Synt.declare(System.getProperty("show.request"), false)) {
Map rd = null;
try {
rd = hlpr.getRequestData( );
} catch ( RuntimeException ex ) {
CoreLogger.debug(ex.getMessage());
}
if (rd != null && !rd.isEmpty()) {
sb.append("\r\n\tRequest : ")
.append(Syno.indent(Dist.toString(rd)).substring(1));
}
}
if (Synt.declare(System.getProperty("show.response"),false)) {
Map xd = hlpr.getResponseData();
if (xd == null) {
xd = (Map) req.getAttribute(Cnst.RESPON_ATTR);
}
if (xd != null && !xd.isEmpty()) {
sb.append("\r\n\tResponse : ")
.append(Syno.indent(Dist.toString(xd)).substring(1));
}
}
CoreLogger.debug(sb.toString());
}
// 删除上传的临时文件
Map<String, List<Part>> ud = Synt.asMap(hlpr.getAttribute(Cnst.UPLOAD_ATTR));
if (ud != null) {
for(List<Part> pa : ud.values()) {
for (Part pr : pa) {
try {
pr.delete();
} catch (IOException ex) {
CoreLogger.error(ex);
}
}
}
}
} finally {
// 销毁此周期内的对象
try {
core.reset( );
Core.THREAD_CORE.remove();
req.removeAttribute(Core.class.getName());
} catch (Error e) {
CoreLogger.error(e);
} catch (Exception e) {
CoreLogger.error(e);
}
}
}
/**
* 执行过滤
* 如需其他操作请覆盖此方法
* @param core
* @param hlpr
* @param chn
* @throws ServletException
* @throws IOException
*/
protected void doFilter(Core core, ActionHelper hlpr, FilterChain chn)
throws ServletException, IOException {
chn.doFilter(hlpr.getRequest(), hlpr.getResponse());
}
/**
* 执行动作
* 如需其他操作请覆盖此方法
* @param core
* @param hlpr
* @throws ServletException
* @throws IOException
*/
protected void doAction(Core core, ActionHelper hlpr)
throws ServletException, IOException {
this.service(hlpr.getRequest(), hlpr.getResponse());
}
/**
* 服务动作
* 覆盖方法类似 HttpServlet
* @param req
* @param rsp
* @throws ServletException
* @throws IOException
*/
protected void service(HttpServletRequest req, HttpServletResponse rsp)
throws ServletException, IOException {
// Nothing todo
}
//** 配置信息方法 **/
public String getFilterInfo() {
return "";
}
@Override
public String getServletInfo() {
return "";
}
public FilterConfig getFilterConfig() {
return FILT_CONF;
}
@Override
public ServletConfig getServletConfig() {
return SERV_CONF;
}
public ServletContext getServletContext() {
if (SERV_CONF != null) return SERV_CONF.getServletContext();
if (FILT_CONF != null) return FILT_CONF.getServletContext();
throw new IllegalStateException("err.servlet_config_not_initialized");
}
public String getInitParameter(String name) {
if (SERV_CONF != null) return SERV_CONF.getInitParameter (name);
if (FILT_CONF != null) return FILT_CONF.getInitParameter (name);
throw new IllegalStateException("err.servlet_config_not_initialized");
}
public Enumeration<String> getInitParameterNames() {
if (SERV_CONF != null) return SERV_CONF.getInitParameterNames();
if (FILT_CONF != null) return FILT_CONF.getInitParameterNames();
throw new IllegalStateException("err.servlet_config_not_initialized");
}
//** 静态工具函数 **/
/**
* 获得当前工作的Core
* @param req
* @return
*/
public static final Core getActualCore(HttpServletRequest req) {
Core core = (Core) req.getAttribute(Core.class.getName());
if (core == null) {
core = Core.GLOBAL_CORE ;
} else {
Core.THREAD_CORE.set(core);
}
return core;
}
/**
* 获得当前的ServletPath
* @param req
* @return
*/
public static final String getRecentPath(HttpServletRequest req) {
String uri = (String) req.getAttribute(RequestDispatcher.INCLUDE_SERVLET_PATH);
String suf = (String) req.getAttribute(RequestDispatcher.INCLUDE_PATH_INFO);
if (uri == null) {
uri = req.getServletPath();
suf = req.getPathInfo();
}
if (suf != null) {
uri += suf;
}
return uri;
}
/**
* 获得起源的ServletPath
* @param req
* @return
*/
public static final String getOriginPath(HttpServletRequest req) {
String uri = (String) req.getAttribute(RequestDispatcher.FORWARD_SERVLET_PATH);
String suf = (String) req.getAttribute(RequestDispatcher.FORWARD_PATH_INFO);
if (uri == null) {
uri = req.getServletPath();
suf = req.getPathInfo();
}
if (suf != null) {
uri += suf;
}
return uri;
}
/**
* 获取当前的服务网址
* @param req
* @return
*/
public static final String getServerHref(HttpServletRequest req) {
String item = (String) req.getAttribute(Cnst.SERVER_ATTR);
if (null != item) {
return item;
}
String prot;
String host;
int port;
prot = req.getScheme();
host = req.getServerName();
port = req.getServerPort();
// RFC 7239, 标准代理格式
item = req.getHeader("Forwarded");
if (null != item) {
String line;
int beg = 0 , end, sep;
end = item.indexOf(',', beg);
if (end != -1) {
item = item.substring(beg, end);
}
while (end != -1) {
end = item.indexOf(';', beg);
if (end != -1) {
line = item.substring(beg, end);
} else {
line = item.substring(beg /**/);
}
sep = line.indexOf("=" /**/);
if (sep != -1) {
String key = line.substring(0, sep).trim();
String val = line.substring(1+ sep).trim();
if ("proto".equals(key)) {
prot = val;
} else
if ("host" .equals(key)) {
host = val;
} else
if ("port" .equals(key)) {
port = Synt.asInt(val);
}
}
beg = end + 1;
}
} else {
// 非标准的格式
item = req.getHeader("X-Forwarded-Proto");
if (item != null) {
prot = item;
}
item = req.getHeader("X-Forwarded-Host" );
if (item != null) {
host = item;
}
item = req.getHeader("X-Forwarded-Port" );
if (item != null) {
port = Synt.asInt(item);
}
}
if (port != 80 && port != 443) {
host += ":" + port;
}
return prot+"://"+host;
}
/**
* 获取当前的远程地址
* @param req
* @return
*/
public static final String getClientAddr(HttpServletRequest req) {
String addr = (String) req.getAttribute(Cnst.CLIENT_ATTR);
if (null != addr) {
return addr;
}
// RFC 7239, 标准代理格式
String h_0 = req.getHeader("Forwarded");
if ( h_0 != null && h_0.length() != 0 ) {
// 按逗号拆分代理节点
int e_0,b_0 = 0;
String h_1;
while (true) {
e_0 = h_0.indexOf(',' , b_0);
if (e_0 != -1) {
h_1 = h_0.substring(b_0, e_0);
b_0 = e_0 + 1;
} else
if (b_0 != 0) {
h_1 = h_0.substring(b_0);
} else
{
h_1 = h_0;
}
// 按分号拆分条目
int e_1,b_1 = 0;
String h_2;
while (true) {
e_1 = h_1.indexOf(';' , b_1);
if (e_1 != -1) {
h_2 = h_1.substring(b_1, e_1);
b_1 = e_1 + 1;
} else
if (b_1 != 0) {
h_2 = h_1.substring(b_1);
} else
{
h_2 = h_1;
}
// 拆分键值对
int e_2 = h_2.indexOf ('=');
if (e_2 != -1) {
String key = h_2.substring(0 , e_2).trim();
String val = h_2.substring(1 + e_2).trim();
key = key.toLowerCase( );
// 源地址
if ( "for" .equals(key )
&& ! "unknown".equals(val )) {
/**
* 按照官方文档的格式描述
* IPv4 的形式为 X.X.X.X:PORT
* IPv6 的形式为 "[X:X:X:X:X]:PORT"
* 需去掉端口引号和方括号
*/
if (val.startsWith("\"")
&& val. endsWith("\"")) {
val = val.substring(1 , val.length() - 1);
}
if (val.startsWith("[" )) {
e_2 = val.indexOf("]" );
if (e_2 != -1) {
val = val.substring(1 , e_2);
}
} else {
e_2 = val.indexOf(":" );
if (e_2 != -1) {
val = val.substring(0 , e_2);
}
}
return val;
}
}
if (e_1 == -1) {
break;
}
}
if (e_0 == -1) {
break;
}
}
}
// 其他非标准代理地址报头
for (String key : new String[] {
"X-Forwarded-For",
"Proxy-Client-IP",
"WL-Proxy-Client-IP"} ) {
String val = req.getHeader(key);
if (val != null && val.length( ) != 0 ) {
int pos = val.indexOf (',');
if (pos > 0) {
val = val.substring(0, pos);
} val = val.trim();
if (!"unknown".equalsIgnoreCase(val)) {
return val;
}
}
}
// 上级客户端真实网络地址
return req.getRemoteAddr( );
}
/**
* 补全URL, 增加域名前缀
* @param url
* @return
*/
public static String fixUrl(String url) {
if (URL_REG.matcher(url).find( ) == false) {
if (url.startsWith ("/")) {
url = Core.SERVER_HREF.get()
+ url;
} else {
url = Core.SERVER_HREF.get()
+ Core.SERV_PATH
+ "/"
+ url;
}}
return url;
}
/**
* 补全URI, 增加应用前缀
* @param uri
* @return
*/
public static String fixUri(String uri) {
if (URI_REG.matcher(uri).find( ) == false) {
uri = Core.SERV_PATH
+ "/"
+ uri;
}
return uri;
}
/**
* 执行动作代理
*/
public static interface DriverProxy {
public void doDriver(Core core, ActionHelper hlpr) throws ServletException, IOException;
}
/**
* 路径匹配助手
*
* 构建通配符简单正则,
* 忽略换行及首尾空白.
*
* <ul>
* <li><b>*</b> 表零个或多个字符</li>
* <li><b>,</b> 分隔多组路径模式</li>
* </ul>
*
* <pre>
* 如通配项
* <code>*.js,*.css,*.html,*.gif,*.jpg,*.png,*.bmp,</code>
* <code>/centre/sign/create.act,/centre/login.html</code>
* 转为正则
* <code>^(.*\.js|.*\.css|.*\.html|.*\.gif|.*\.jpg|.*\.png|.*\.bmp|/centre/sign/create\.act|/centre/login\.html)$</code>
* </pre>
*
* @author Hongs
*/
public static final class PathPattern {
private final Pattern include;
private final Pattern exclude;
public PathPattern(String urlInclude, String urlExclude) {
include = compile(urlInclude);
exclude = compile(urlExclude);
}
public PathPattern(String urlInclude) {
this(urlInclude, null);
}
@Override
public String toString() {
if (include == null
&& exclude == null) {
return "";
} else
if (exclude == null) {
return "Include: "+include.toString();
} else
if (include == null) {
return "Exclude: "+exclude.toString();
} else
{
return "Include: "+include.toString()
+ "\r\n" +
"Exclude: "+exclude.toString();
}
}
public boolean matches(String uri) {
if (include == null
&& exclude == null) {
return true;
} else
if (exclude == null) {
return include.matcher(uri).matches();
} else
if (include == null) {
return !exclude.matcher(uri).matches();
} else
{
return include.matcher(uri).matches()
&& !exclude.matcher(uri).matches();
}
}
private Pattern compile(String pat) {
if (pat == null) {
return null ;
}
pat = pat.trim();
if (pat.length() == 0) {
return null ;
}
pat = pat.replaceAll("[\\^\\$\\(\\)\\[\\]\\{\\}\\+\\?\\.\\|\\\\]", "\\\\$0");
pat = pat.replaceAll("^,\\s*|\\s*,$", "" );
pat = pat.replaceAll( "\\s*,\\s*" , "|");
pat = pat.replace("*", ".*");
pat = "^("+ pat +")$";
return Pattern.compile (pat);
}
}
/**
* 路径重设助手
*
* 让外部可以重设路径,
* 使得内部程序可续用.
*/
public static class PathWrapper extends HttpServletRequestWrapper {
private String pathInfo;
private String servletPath;
private String contextPath;
public PathWrapper (HttpServletRequest req) {
super(req);
}
public PathWrapper setPathInfo(String path) {
pathInfo = path;
return this;
}
public PathWrapper setServletPath(String path) {
servletPath = path;
return this;
}
public PathWrapper setContextPath(String path) {
contextPath = path;
return this;
}
@Override
public String getPathInfo() {
if (null != pathInfo) {
return pathInfo;
}
return super.getPathInfo();
}
@Override
public String getServletPath() {
if (null != servletPath) {
return servletPath;
}
return super.getServletPath();
}
@Override
public String getContextPath() {
if (null != contextPath) {
return contextPath;
}
return super.getContextPath();
}
}
}
| [
"ihongs@live.cn"
] | ihongs@live.cn |
75a70ecd882892c0b7b77f38815a59049393dc84 | 9098a573c056032dd4432c2205fb6f12879aad33 | /simulations/tests/org/denovogroup/rangzen/simulation/MessagePropagationSimulationTest.java | f656a4989843169a0c5ec60ed013684e7b1ca70b | [
"Apache-2.0"
] | permissive | murmur-project/murmur | 14996ac0cd3afbe0a7390991663385f54747fe98 | 2e68bd712f2d6a70bcc23cfc0bf07201fe7f5c04 | refs/heads/master | 2021-01-10T06:50:12.797102 | 2016-04-08T06:42:56 | 2016-04-08T06:42:56 | 55,756,325 | 3 | 1 | null | null | null | null | UTF-8 | Java | false | false | 3,868 | java | /*
* Copyright (c) 2014, De Novo Group
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
package org.denovogroup.rangzen.simulation;
import uk.me.jstott.jcoord.LatLng;
import sim.util.Double2D;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertFalse;
import org.junit.Test;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.util.Set;
import java.util.PriorityQueue;
/**
* Tests of methods from MessagePropagationSimulation.
*/
@RunWith(JUnit4.class)
public class MessagePropagationSimulationTest {
private MessagePropagationSimulation sim;
private double DELTA = 1;
private double OPPOSITE_CORNER_Y = 0;
private double OPPOSITE_CORNER_X = 26300;
private static final double METERS_PER_KILOMETER = 1000;
@Before
public void setUp() {
sim = new MessagePropagationSimulation(System.currentTimeMillis());
}
@Test
public void coordinateTransformTest() {
Location originLocation =
new Location(MessagePropagationSimulation.LOWEST_LATITUDE,
MessagePropagationSimulation.LOWEST_LONGITUDE,
0);
Double2D origin = sim.translateLatLonToSimCoordinates(originLocation);
assertEquals("Lowest lon not at x=0 meters", origin.x, 0, DELTA);
assertEquals("Lowest lat not at y=0 meters",
origin.y,
MessagePropagationSimulation.height,
DELTA);
Location oppositeCornerLocation =
new Location(MessagePropagationSimulation.HIGHEST_LATITUDE,
MessagePropagationSimulation.HIGHEST_LONGITUDE,
0);
Double2D oppositeCorner =
sim.translateLatLonToSimCoordinates(oppositeCornerLocation);
// Margin of error of 100 meters because the tool used to calculate
// the "correct" value only gives precision out to 100 meters.
// (http://www.movable-type.co.uk/scripts/latlong.html)
assertEquals("Highest lon not at correct meter location",
OPPOSITE_CORNER_X,
oppositeCorner.x,
100);
assertEquals("Highest lat not at correct meter location",
OPPOSITE_CORNER_Y,
oppositeCorner.y,
100);
}
}
| [
"barathraghavan@gmail.com"
] | barathraghavan@gmail.com |
4b09714df7fe7bfd3f197173b3fbe8621340b1aa | e998415cd55b29153ccbc2692eeb5ca7bff97a6b | /src/java/controller/ManageProductServlet.java | 2ecd7569ed5e90e845f05647babeb6a1dc8bcaae | [] | no_license | loitn148/shop | 858766a8e20065106657fa3fdae5273eaf8e15e6 | 3c6c3621cbbd6d172205a529c52c08262dafca00 | refs/heads/master | 2020-03-20T13:13:31.247306 | 2018-06-17T05:18:32 | 2018-06-17T05:18:32 | 137,450,729 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,494 | 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 controller;
import DAO.ProductDAO;
import java.io.IOException;
import java.sql.SQLException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import model.Product;
/**
*
* @author loitn148
*/
public class ManageProductServlet extends HttpServlet {
ProductDAO prodDAO = new ProductDAO();
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
String command = request.getParameter("command");
String product_id = request.getParameter("product_id");
String url = "";
try {
switch(command){
case "delete" :
prodDAO.delete(Long.parseLong(product_id));
url = "/shop/admin/manage_product.jsp";
break;
}
} catch (SQLException e) {
}
response.sendRedirect(url);
}
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
String command = request.getParameter("command");
String prodName = request.getParameter("prodName");
String prodSlug = request.getParameter("prodSlug");
String prodPrice = request.getParameter("prodPrice");
String prodDiscount = request.getParameter("prodDiscount");
String catId = request.getParameter("catId");
String prodDescription = request.getParameter("prodDescription");
String prodImage = request.getParameter("prodImage");
String url = "", error = "";
if(prodName.equals("") || prodSlug.equals("") || prodPrice.equals("")){
error = "Please fill Form on Name, Slug & Price!";
request.setAttribute("error", error);
}
double price = Double.parseDouble(prodPrice),
discount = Double.parseDouble(prodDiscount),
price_sale = price - price*discount/100;
long category = catId.equals("") ? 0: Long.parseLong(catId);
try {
if(error.length() == 0) {
switch(command){
case "insert" :
prodDAO.insert(new Product(prodName, category, prodSlug, price, discount, prodDescription, prodImage, price_sale));
url = "/shop/admin/manage_product.jsp";
break;
case "update" :
prodDAO.update(new Product(prodName, category, prodSlug, price, discount, prodDescription, prodImage, price_sale), Long.parseLong(request.getParameter("product_id")));
url = "/shop/admin/manage_product.jsp";
break;
}
} else {
url = "/shop/admin/insert_product.jsp";
}
} catch (SQLException e) {
}
response.sendRedirect(url);
}
}
| [
"loitn148@gmail.com"
] | loitn148@gmail.com |
c2e374133b7f37fd0e98053bdcbfe0dbd2ea8a3b | 96fea6041c7c832a10305450bd3ccf7e073a6c62 | /kanbanboard-contract/src/main/java/de/muspellheim/kanbanboard/contract/messages/commands/Failure.java | 469da24c0685c48bf2a10394404f398325ab4ff1 | [
"MIT"
] | permissive | falkoschumann/kanbanboard | 3e2c8faf0984a377c5db1a56f5f62826c3073977 | d132e746afcc0a79d3068af0e039f8c143e2abea | refs/heads/master | 2022-12-25T12:29:19.773249 | 2020-10-12T18:39:14 | 2020-10-12T18:39:14 | 297,732,704 | 0 | 0 | null | 2020-10-07T13:26:11 | 2020-09-22T18:09:56 | Kotlin | UTF-8 | Java | false | false | 302 | java | /*
* Kanban Board - Contract
* Copyright (c) 2020 Falko Schumann <falko.schumann@muspellheim.de>
*/
package de.muspellheim.kanbanboard.contract.messages.commands;
import lombok.NonNull;
import lombok.Value;
@Value
public class Failure implements CommandStatus {
@NonNull String errorMessage;
}
| [
"falko.schumann@muspellheim.de"
] | falko.schumann@muspellheim.de |
9a09c7f9f00fbe94cc78e72acedc2ab67da14c51 | 2854474a43787258710147ba2a62783e33413b47 | /Practice/src/com/techlab/template/Game.java | b4d4e6c17c5332245cac9d27bd3f43e30b50cb7a | [] | no_license | saket3199/rootProjects | 067ecb522c3ff4006c673ca739b924e303800023 | 379ce5a6ece8dbd0a846814b70bce7a637bc32b0 | refs/heads/main | 2023-08-11T08:57:09.102698 | 2021-09-28T05:17:24 | 2021-09-28T05:17:24 | 392,203,353 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 245 | java | package com.techlab.template;
public abstract class Game {
public abstract void initialize();
public abstract void startPlay();
public abstract void endPlay();
public final void play()
{
initialize();
startPlay();
endPlay();
}
}
| [
"57292901+saket3199@users.noreply.github.com"
] | 57292901+saket3199@users.noreply.github.com |
97680045b820d9dc094a908b44c0e0f9f9cd5b55 | 6f83d72d595a2f588d802f12b0cd34fb6d959b20 | /AddressBookMainSystem/src/com/capgemini/ContactDetails.java | e74f0894905a6434d01c9f64e048517a8e882c88 | [] | no_license | deekshita121/AddressBookMainSystem | c0d5b0882b1b5c882ae4ce468a8f966c7f87546d | b94c7195e5ffd9b0f3e9c92967e14a70066ff101 | refs/heads/main | 2022-12-29T15:10:56.750322 | 2020-10-12T18:17:22 | 2020-10-12T18:17:22 | 302,694,035 | 0 | 0 | null | 2020-10-10T14:47:13 | 2020-10-09T16:19:38 | Java | UTF-8 | Java | false | false | 1,685 | java | package com.capgemini;
public class ContactDetails {
public String firstName;
public String lastName;
public String address;
public String city;
public String state;
public int zip;
public long phoneNo;
public String email;
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 getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public int getZip() {
return zip;
}
public void setZip(int zip) {
this.zip = zip;
}
public long getPhoneNo() {
return phoneNo;
}
public void setPhoneNo(long phoneNo) {
this.phoneNo = phoneNo;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public ContactDetails(String f,String l,String a,String c,String s,int z,long p,String e) {
// TODO Auto-generated constructor stub
setFirstName(f);
setLastName(l);
setAddress(a);
setCity(c);
setState(s);
setZip(z);
setPhoneNo(p);
setEmail(e);
}
@Override
public String toString() {
return "Contact Details: "+firstName +" "+ lastName+ ", "+address+", "+city+", " +state+ ", "+zip+", "+ phoneNo + ", "+email+" ";
}
}
| [
"deekshitaalavala@gmail.com"
] | deekshitaalavala@gmail.com |
360e6d63e45c143f5e3241ded3daa3976191ebb4 | c885ef92397be9d54b87741f01557f61d3f794f3 | /results/JxPath-15/org.apache.commons.jxpath.ri.axes.UnionContext/BBC-F0-opt-80/tests/4/org/apache/commons/jxpath/ri/axes/UnionContext_ESTest.java | 1b2d7cb57e49256936a22dc5fd34885ea59f3c42 | [
"CC-BY-4.0",
"MIT"
] | permissive | pderakhshanfar/EMSE-BBC-experiment | f60ac5f7664dd9a85f755a00a57ec12c7551e8c6 | fea1a92c2e7ba7080b8529e2052259c9b697bbda | refs/heads/main | 2022-11-25T00:39:58.983828 | 2022-04-12T16:04:26 | 2022-04-12T16:04:26 | 309,335,889 | 0 | 1 | null | 2021-11-05T11:18:43 | 2020-11-02T10:30:38 | null | UTF-8 | Java | false | false | 14,314 | java | /*
* This file was automatically generated by EvoSuite
* Thu Oct 14 05:22:13 GMT 2021
*/
package org.apache.commons.jxpath.ri.axes;
import org.junit.Test;
import static org.junit.Assert.*;
import static org.evosuite.shaded.org.mockito.Mockito.*;
import static org.evosuite.runtime.EvoAssertions.*;
import java.util.Locale;
import org.apache.commons.jxpath.BasicNodeSet;
import org.apache.commons.jxpath.BasicVariables;
import org.apache.commons.jxpath.JXPathContext;
import org.apache.commons.jxpath.Pointer;
import org.apache.commons.jxpath.ri.EvalContext;
import org.apache.commons.jxpath.ri.JXPathContextReferenceImpl;
import org.apache.commons.jxpath.ri.QName;
import org.apache.commons.jxpath.ri.axes.ChildContext;
import org.apache.commons.jxpath.ri.axes.DescendantContext;
import org.apache.commons.jxpath.ri.axes.InitialContext;
import org.apache.commons.jxpath.ri.axes.NodeSetContext;
import org.apache.commons.jxpath.ri.axes.PrecedingOrFollowingContext;
import org.apache.commons.jxpath.ri.axes.PredicateContext;
import org.apache.commons.jxpath.ri.axes.RootContext;
import org.apache.commons.jxpath.ri.axes.UnionContext;
import org.apache.commons.jxpath.ri.compiler.Constant;
import org.apache.commons.jxpath.ri.compiler.CoreOperationLessThan;
import org.apache.commons.jxpath.ri.compiler.CoreOperationLessThanOrEqual;
import org.apache.commons.jxpath.ri.compiler.CoreOperationOr;
import org.apache.commons.jxpath.ri.compiler.Expression;
import org.apache.commons.jxpath.ri.compiler.ExpressionPath;
import org.apache.commons.jxpath.ri.compiler.ExtensionFunction;
import org.apache.commons.jxpath.ri.compiler.NodeNameTest;
import org.apache.commons.jxpath.ri.compiler.ProcessingInstructionTest;
import org.apache.commons.jxpath.ri.compiler.Step;
import org.apache.commons.jxpath.ri.model.NodePointer;
import org.apache.commons.jxpath.ri.model.VariablePointer;
import org.apache.commons.jxpath.ri.model.beans.NullPointer;
import org.evosuite.runtime.EvoRunner;
import org.evosuite.runtime.EvoRunnerParameters;
import org.evosuite.runtime.ViolatedAssumptionAnswer;
import org.evosuite.runtime.testdata.EvoSuiteFile;
import org.junit.runner.RunWith;
@RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true)
public class UnionContext_ESTest extends UnionContext_ESTest_scaffolding {
@Test(timeout = 4000)
public void test00() throws Throwable {
Object object0 = new Object();
JXPathContextReferenceImpl jXPathContextReferenceImpl0 = new JXPathContextReferenceImpl((JXPathContext) null, object0, (Pointer) null);
Expression[] expressionArray0 = new Expression[8];
Integer integer0 = new Integer(1);
Constant constant0 = new Constant(integer0);
CoreOperationLessThan coreOperationLessThan0 = new CoreOperationLessThan(constant0, constant0);
Step[] stepArray0 = new Step[2];
Step step0 = mock(Step.class, new ViolatedAssumptionAnswer());
doReturn(0, 0, 0).when(step0).getAxis();
stepArray0[0] = step0;
ExpressionPath expressionPath0 = new ExpressionPath(coreOperationLessThan0, expressionArray0, stepArray0);
expressionArray0[0] = (Expression) expressionPath0;
CoreOperationOr coreOperationOr0 = new CoreOperationOr(expressionArray0);
CoreOperationLessThanOrEqual coreOperationLessThanOrEqual0 = new CoreOperationLessThanOrEqual(coreOperationOr0, expressionArray0[1]);
BasicNodeSet basicNodeSet0 = new BasicNodeSet();
// Undeclared exception!
try {
jXPathContextReferenceImpl0.createPathAndSetValue((String) null, (Expression) coreOperationLessThanOrEqual0, (Object) basicNodeSet0);
fail("Expecting exception: RuntimeException");
} catch(RuntimeException e) {
//
// java.lang.StackOverflowError
//
verifyException("org.apache.commons.jxpath.ri.JXPathContextReferenceImpl", e);
}
}
@Test(timeout = 4000)
public void test01() throws Throwable {
Object object0 = new Object();
JXPathContextReferenceImpl jXPathContextReferenceImpl0 = new JXPathContextReferenceImpl((JXPathContext) null, object0, (Pointer) null);
EvalContext evalContext0 = jXPathContextReferenceImpl0.getAbsoluteRootContext();
ProcessingInstructionTest processingInstructionTest0 = new ProcessingInstructionTest("org.apache.commons.jxpath.ri.axes.UnionContext");
ChildContext childContext0 = new ChildContext(evalContext0, processingInstructionTest0, true, true);
BasicVariables basicVariables0 = new BasicVariables();
QName qName0 = new QName("");
VariablePointer variablePointer0 = new VariablePointer(basicVariables0, qName0);
RootContext rootContext0 = new RootContext(jXPathContextReferenceImpl0, variablePointer0);
EvalContext[] evalContextArray0 = new EvalContext[2];
evalContextArray0[0] = evalContext0;
evalContextArray0[1] = (EvalContext) childContext0;
UnionContext unionContext0 = new UnionContext(rootContext0, evalContextArray0);
boolean boolean0 = unionContext0.setPosition(1);
assertEquals(1, unionContext0.getPosition());
assertTrue(boolean0);
}
@Test(timeout = 4000)
public void test02() throws Throwable {
EvalContext[] evalContextArray0 = new EvalContext[0];
UnionContext unionContext0 = new UnionContext((EvalContext) null, evalContextArray0);
int int0 = unionContext0.getDocumentOrder();
assertEquals(0, int0);
}
@Test(timeout = 4000)
public void test03() throws Throwable {
JXPathContext jXPathContext0 = JXPathContext.newContext((Object) null);
Integer integer0 = Integer.getInteger("@(#) $RCSfile: IllegalAddException.java,v $ $Revision: 1.25 $ $Date: 2004/02/06 09:28:30 $ $Name: jdom_1_0 $", (int) (byte)44);
QName qName0 = new QName("@(#) $RCSfile: IllegalAddException.java,v $ $Revision: 1.25 $ $Date: 2004/02/06 09:28:30 $ $Name: jdom_1_0 $", "@(#) $RCSfile: IllegalAddException.java,v $ $Revision: 1.25 $ $Date: 2004/02/06 09:28:30 $ $Name: jdom_1_0 $");
Locale locale0 = new Locale("@(#) $RCSfile: IllegalAddException.java,v $ $Revision: 1.25 $ $Date: 2004/02/06 09:28:30 $ $Name: jdom_1_0 $", "5NrOG:TRx6%");
NodePointer nodePointer0 = NodePointer.newNodePointer(qName0, jXPathContext0, locale0);
JXPathContextReferenceImpl jXPathContextReferenceImpl0 = new JXPathContextReferenceImpl(jXPathContext0, integer0, nodePointer0);
EvalContext evalContext0 = jXPathContextReferenceImpl0.getAbsoluteRootContext();
EvalContext[] evalContextArray0 = new EvalContext[5];
NodeNameTest nodeNameTest0 = new NodeNameTest(qName0);
DescendantContext descendantContext0 = new DescendantContext(evalContext0, true, nodeNameTest0);
evalContextArray0[0] = (EvalContext) descendantContext0;
UnionContext unionContext0 = new UnionContext(evalContext0, evalContextArray0);
// Undeclared exception!
unionContext0.setPosition(565);
}
@Test(timeout = 4000)
public void test04() throws Throwable {
JXPathContextReferenceImpl jXPathContextReferenceImpl0 = (JXPathContextReferenceImpl)JXPathContext.newContext((JXPathContext) null, (Object) "\u0004'>;fV'IDn-a");
QName qName0 = new QName("\u0004'>;fV'IDn-a", "");
InitialContext initialContext0 = (InitialContext)jXPathContextReferenceImpl0.getAbsoluteRootContext();
ExtensionFunction extensionFunction0 = new ExtensionFunction(qName0, (Expression[]) null);
PredicateContext predicateContext0 = new PredicateContext(initialContext0, extensionFunction0);
EvalContext[] evalContextArray0 = new EvalContext[4];
evalContextArray0[0] = (EvalContext) predicateContext0;
UnionContext unionContext0 = new UnionContext(predicateContext0, evalContextArray0);
// Undeclared exception!
try {
unionContext0.setPosition(Integer.MIN_VALUE);
fail("Expecting exception: RuntimeException");
} catch(RuntimeException e) {
//
// Undefined function: \u0004'>;fV'IDn-a:
//
verifyException("org.apache.commons.jxpath.ri.JXPathContextReferenceImpl", e);
}
}
@Test(timeout = 4000)
public void test05() throws Throwable {
Integer integer0 = new Integer(0);
JXPathContextReferenceImpl jXPathContextReferenceImpl0 = (JXPathContextReferenceImpl)JXPathContext.newContext((Object) integer0);
QName qName0 = new QName((String) null, (String) null);
Locale locale0 = Locale.ROOT;
NullPointer nullPointer0 = (NullPointer)NodePointer.newNodePointer(qName0, (Object) null, locale0);
RootContext rootContext0 = new RootContext(jXPathContextReferenceImpl0, nullPointer0);
EvalContext[] evalContextArray0 = new EvalContext[7];
evalContextArray0[0] = (EvalContext) rootContext0;
UnionContext unionContext0 = new UnionContext(rootContext0, evalContextArray0);
// Undeclared exception!
try {
unionContext0.setPosition(0);
fail("Expecting exception: UnsupportedOperationException");
} catch(UnsupportedOperationException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.apache.commons.jxpath.ri.axes.RootContext", e);
}
}
@Test(timeout = 4000)
public void test06() throws Throwable {
BasicNodeSet basicNodeSet0 = new BasicNodeSet();
NodeSetContext nodeSetContext0 = new NodeSetContext((EvalContext) null, basicNodeSet0);
QName qName0 = new QName("g`8vPL@<A");
NodeNameTest nodeNameTest0 = new NodeNameTest(qName0);
PrecedingOrFollowingContext precedingOrFollowingContext0 = new PrecedingOrFollowingContext(nodeSetContext0, nodeNameTest0, true);
DescendantContext descendantContext0 = new DescendantContext(precedingOrFollowingContext0, true, nodeNameTest0);
EvalContext[] evalContextArray0 = new EvalContext[7];
evalContextArray0[0] = (EvalContext) precedingOrFollowingContext0;
evalContextArray0[1] = (EvalContext) nodeSetContext0;
evalContextArray0[2] = (EvalContext) precedingOrFollowingContext0;
evalContextArray0[3] = (EvalContext) descendantContext0;
evalContextArray0[4] = (EvalContext) nodeSetContext0;
evalContextArray0[5] = (EvalContext) nodeSetContext0;
evalContextArray0[6] = (EvalContext) descendantContext0;
UnionContext unionContext0 = new UnionContext(descendantContext0, evalContextArray0);
// Undeclared exception!
try {
unionContext0.setPosition((-1));
fail("Expecting exception: IndexOutOfBoundsException");
} catch(IndexOutOfBoundsException e) {
//
// Index: 2, Size: 0
//
verifyException("java.util.ArrayList", e);
}
}
@Test(timeout = 4000)
public void test07() throws Throwable {
UnionContext unionContext0 = new UnionContext((EvalContext) null, (EvalContext[]) null);
// Undeclared exception!
try {
unionContext0.getDocumentOrder();
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
verifyException("org.apache.commons.jxpath.ri.axes.UnionContext", e);
}
}
@Test(timeout = 4000)
public void test08() throws Throwable {
Object object0 = new Object();
JXPathContextReferenceImpl jXPathContextReferenceImpl0 = new JXPathContextReferenceImpl((JXPathContext) null, object0, (Pointer) null);
EvalContext evalContext0 = jXPathContextReferenceImpl0.getAbsoluteRootContext();
ProcessingInstructionTest processingInstructionTest0 = new ProcessingInstructionTest("')");
ChildContext childContext0 = new ChildContext(evalContext0, processingInstructionTest0, false, true);
EvalContext[] evalContextArray0 = new EvalContext[7];
evalContextArray0[0] = evalContext0;
EvalContext evalContext1 = jXPathContextReferenceImpl0.getAbsoluteRootContext();
evalContextArray0[1] = evalContext1;
UnionContext unionContext0 = new UnionContext(childContext0, evalContextArray0);
// Undeclared exception!
try {
unionContext0.setPosition(2);
fail("Expecting exception: NullPointerException");
} catch(NullPointerException e) {
//
// no message in exception (getMessage() returned null)
//
}
}
@Test(timeout = 4000)
public void test09() throws Throwable {
JXPathContextReferenceImpl jXPathContextReferenceImpl0 = new JXPathContextReferenceImpl((JXPathContext) null, (Object) null, (Pointer) null);
EvalContext evalContext0 = jXPathContextReferenceImpl0.getAbsoluteRootContext();
EvalContext[] evalContextArray0 = new EvalContext[5];
evalContextArray0[0] = evalContext0;
ProcessingInstructionTest processingInstructionTest0 = new ProcessingInstructionTest("");
ChildContext childContext0 = new ChildContext(evalContext0, processingInstructionTest0, false, false);
evalContextArray0[1] = (EvalContext) childContext0;
evalContextArray0[2] = evalContext0;
evalContextArray0[3] = evalContext0;
evalContextArray0[4] = evalContext0;
UnionContext unionContext0 = new UnionContext(evalContext0, evalContextArray0);
unionContext0.setPosition(1);
unionContext0.setPosition(7);
assertEquals(7, unionContext0.getPosition());
}
@Test(timeout = 4000)
public void test10() throws Throwable {
Object object0 = new Object();
JXPathContextReferenceImpl jXPathContextReferenceImpl0 = new JXPathContextReferenceImpl((JXPathContext) null, object0, (Pointer) null);
BasicVariables basicVariables0 = new BasicVariables();
QName qName0 = new QName("");
VariablePointer variablePointer0 = new VariablePointer(basicVariables0, qName0);
RootContext rootContext0 = new RootContext(jXPathContextReferenceImpl0, variablePointer0);
EvalContext[] evalContextArray0 = new EvalContext[2];
UnionContext unionContext0 = new UnionContext(rootContext0, evalContextArray0);
int int0 = unionContext0.getDocumentOrder();
assertEquals(1, int0);
}
}
| [
"pderakhshanfar@serg2.ewi.tudelft.nl"
] | pderakhshanfar@serg2.ewi.tudelft.nl |
f701bf60eebba76bae973b5ce47100dc5615d18b | 89580bc7dd31d1f52786261f51085986c4423a2a | /src/com/pages/addMoviesdb.java | 0af5b1f96cca96e77151aa7cd50707892b918a22 | [] | no_license | rajendraarora16/imdb | cd20bb3a3f4474a0b843e0c3ac295e21f367808d | 3c9af59f6b152a231ea36b15374059d6d5b0edc5 | refs/heads/master | 2021-01-10T05:39:38.082079 | 2016-11-28T04:03:54 | 2016-11-28T04:03:54 | 44,228,818 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,721 | java | package com.pages;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.util.Random;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class addMoviesdb extends HttpServlet{
/*Random generator!*/
protected static String getRandomWord() {
String SALTCHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";
StringBuilder salt = new StringBuilder();
Random rnd = new Random();
while (salt.length() < 8) {
int index = (int) (rnd.nextFloat() * SALTCHARS.length());
salt.append(SALTCHARS.charAt(index));
}
String saltStr = salt.toString();
return saltStr;
}
/*-----------------*/
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException{
String movieURL = getRandomWord();
String userName = request.getParameter("userName");
String userEmail = request.getParameter("userEmail");
String movieName = request.getParameter("movieName");
String imgURL = request.getParameter("imgURL");
String actName = request.getParameter("actName");
String releasingDate = request.getParameter("releasingDate");
String directorName = request.getParameter("directorName");
String producerName = request.getParameter("producerName");
String writerName = request.getParameter("writerName");
String screenplayName = request.getParameter("screenplayName");
String starringName = request.getParameter("starringName");
String musicName = request.getParameter("musicName");
String productionName = request.getParameter("productionName");
String distributorName = request.getParameter("distributorName");
String runningTime = request.getParameter("runningTime");
String country = request.getParameter("country");
String language = request.getParameter("language");
String budget = request.getParameter("budget");
String boxofficeName = request.getParameter("boxofficeName");
String discription = request.getParameter("discription");
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/imdb", "root", "1234");
String sqlQuery = "INSERT INTO movies(movieURL, userName, userEmail, movieName, imgURL, actName, releasingDate, directorName, producerName, writerName, screenplayName, starringName, musicName, productionName, distributorName, runningTime, country, language, budget, boxofficeName, discription) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
PreparedStatement stmt = con.prepareStatement(sqlQuery);
stmt.setString(1, movieURL);
stmt.setString(2, userName);
stmt.setString(3, userEmail);
stmt.setString(4, movieName);
stmt.setString(5, imgURL);
stmt.setString(6, actName);
stmt.setString(7, releasingDate);
stmt.setString(8, directorName);
stmt.setString(9, producerName);
stmt.setString(10, writerName);
stmt.setString(11, screenplayName);
stmt.setString(12, starringName);
stmt.setString(13, musicName);
stmt.setString(14, productionName);
stmt.setString(15, distributorName);
stmt.setString(16, runningTime);
stmt.setString(17, country);
stmt.setString(18, language);
stmt.setString(19, budget);
stmt.setString(20, boxofficeName);
stmt.setString(21, discription);
stmt.executeUpdate();
con.close();
//Redirecting to movie page
response.sendRedirect("./movieDetails?sid="+movieURL);
}catch(Exception e){e.printStackTrace();}
}
}
| [
"rajendraarora16@yahoo.com"
] | rajendraarora16@yahoo.com |
71ad86702000d9df366349dd66287638aacf12e6 | a0caa255f3dbe524437715adaee2094ac8eff9df | /src/main/java/p000/cul.java | 8cb054155da6195ef9c8d99e420b6dd01dc24e2c | [] | no_license | AndroidTVDeveloper/com.google.android.tvlauncher | 16526208b5b48fd48931b09ed702fe606fe7d694 | 0f959c41bbb5a93e981145f371afdec2b3e207bc | refs/heads/master | 2021-01-26T07:47:23.091351 | 2020-02-26T20:58:19 | 2020-02-26T20:58:19 | 243,363,961 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 134 | java | package p000;
/* renamed from: cul */
/* compiled from: PG */
public interface cul {
/* renamed from: f */
void mo3526f();
}
| [
"eliminater74@gmail.com"
] | eliminater74@gmail.com |
815165b476caf7027ae70469dbbab47f2044a46c | 22128b12c55164d73b678c7d146cc9f9ba48d74f | /HttpClient/src/test/java/tech/vineyard/httpclient/AbstractTestHttpClient.java | 3214d3d8ae68e05b0c1a79be545a2b707d9924cf | [] | no_license | alexis779/fan | 1509b65d72860293491ecfd2374db9a4dc2a2886 | 86da47c31d61bb40d9a5f329b07cb88973c7437a | refs/heads/master | 2022-04-30T22:45:24.055662 | 2022-03-07T21:04:08 | 2022-03-07T21:04:08 | 536,503 | 0 | 3 | null | 2022-03-07T21:04:09 | 2010-02-25T23:16:45 | Java | UTF-8 | Java | false | false | 3,904 | java | package tech.vineyard.httpclient;
import static org.junit.Assert.assertTrue;
import java.io.IOException;
import java.net.URI;
import org.junit.Test;
import tech.vineyard.httpclient.Job2;
import tech.vineyard.httpclient.JobQueue;
public abstract class AbstractTestHttpClient {
private static final String METHOD = "HEAD";
protected JobQueue jobList = new JobQueue();
public abstract void doRequest(JobQueue queue);
/**
* Test a single request.
* @throws IOException
* @throws InterruptedException
*/
@Test
public void truveo() throws IOException, InterruptedException {
addJob("http://www.truveo.com/");
doRequest(jobList);
assertTrue(jobList.isEmpty());
}
/**
* Test Keep-Alive policy.
* @throws IOException
* @throws InterruptedException
*/
@Test
public void arNetlog() throws IOException, InterruptedException {
addJob("http://ar.netlog.com/go/explore/videos/videoid=158666");
addJob("http://ar.netlog.com/go/explore/videos/videoid=332671");
doRequest(jobList);
assertTrue(jobList.isEmpty());
}
/**
* Special characters in a non default encoding in the response.
* @throws IOException
* @throws InterruptedException
*/
@Test
public void terraTv() throws IOException, InterruptedException {
addJob("http://terratv.terra.com.br/Especiais/Homem/Carro-Online/4540-223046/Peugeot-2008-busca-unir-conceitos.htm");
doRequest(jobList);
assertTrue(jobList.isEmpty());
}
/**
* EOF received instead of a valid response in the second request.
* @throws IOException
* @throws InterruptedException
*/
@Test
public void readEOF() throws IOException, InterruptedException {
addJob("http://player.video.news.com.au/theaustralian/?WWB2Xw2hVigi5nVg5SeexyQt75YMby44");
addJob("http://player.video.news.com.au/news/?0jVea_1AyVm3C6as4TojvlG1_ocW_D33");
doRequest(jobList);
assertTrue(jobList.isEmpty());
addJob("http://video.tvguide.com/Date+Night+2010/Date+Night/4866938?autoplay=true%20partnerid=OVG");
addJob("http://video.tvguide.com/Brooks++Dunn/Put+a+Girl+in+It/5445966?autoplay=true%20partnerid=OVG");
doRequest(jobList);
assertTrue(jobList.isEmpty());
addJob("http://zoome.jp/type-r/diary/4");
addJob("http://zoome.jp/tentaclelost/diary/9");
doRequest(jobList);
assertTrue(jobList.isEmpty());
}
/**
* Limit the number of redirects if stuck in infinite loop.
* @throws IOException
* @throws InterruptedException
*/
@Test
public void bollywo() throws IOException, InterruptedException {
addJob("http://www.bollywo.com/video/165906/rana-hits-the-dance-floormp4.html");
addJob("http://www.bollywo.com/videos/71928/djmafijanr2010.html");
doRequest(jobList);
assertTrue(jobList.isEmpty());
}
/**
* Server error.
* @throws IOException
* @throws InterruptedException
*/
@Test
public void liveVideo() throws IOException, InterruptedException {
addJob("http://www.livevideo.com/video/2134E01DFB10434C82C4735B9397B885/scrapbooking-en-estados-unidos.aspx");
doRequest(jobList);
assertTrue(jobList.isEmpty());
addJob("http://www.vidilife.com/video_play_1666607_Perfect_BlackBerry_8900_Forsted_Housing_Faceplate_.htm");
doRequest(jobList);
assertTrue(jobList.isEmpty());
}
/**
* Connection reset by peer exception.
* @throws IOException
* @throws InterruptedException
*/
@Test
public void timsah() throws IOException, InterruptedException {
addJob("http://www.timsah.com/Ashlynn-Brooke-nefes-kesen-cekim/ZrrTVyxhOk-");
addJob("http://www.timsah.com/Misirlarin-korkulu-ruyasi/dTrrT7a2LdW");
//addJob("http://www.timsah.com/15-saniyede-kirmizi-kart-gordu/ZTQddOMBsVz");
doRequest(jobList);
assertTrue(jobList.isEmpty());
}
private void addJob(String url) {
URI uri = URI.create(url);
if (jobList.isEmpty()) {
jobList.setHost(uri.getHost());
}
String path = JobQueue.getPath(uri);
jobList.add(new Job2(METHOD, path));
}
}
| [
"alexis779@hotmail.com"
] | alexis779@hotmail.com |
65c2f0dd1a4bd4be8d26cd3c316528b4c50b0bf7 | 0cdb534c2b1eb8fa0c555bc5750eae22486919a4 | /src/main/java/com/domain/sysassets/TipoActivo.java | 17f656bf75fa8eea46c457fdd68270667edbf672 | [] | no_license | spidyxD/SysAssetsBeta-1 | 7eb6444c396790d72cd6145c6e1465457f7d613d | 6d145f641380ee3871fd28da8436300d1093e97b | refs/heads/master | 2020-03-25T01:36:13.062963 | 2018-08-02T05:14:59 | 2018-08-02T05:14:59 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,773 | java | package com.domain.sysassets;
// Generated 01/08/2018 09:51:25 PM by Hibernate Tools 4.3.1
/**
* TipoActivo generated by hbm2java
*/
public class TipoActivo implements java.io.Serializable {
private TipoActivoId id;
private CategoriaActivo categoriaActivo;
private String descripcion;
private String codigoPresup;
private Short vidaUtil;
public TipoActivo() {
}
public TipoActivo(TipoActivoId id, CategoriaActivo categoriaActivo) {
this.id = id;
this.categoriaActivo = categoriaActivo;
}
public TipoActivo(TipoActivoId id, CategoriaActivo categoriaActivo, String descripcion, String codigoPresup, Short vidaUtil) {
this.id = id;
this.categoriaActivo = categoriaActivo;
this.descripcion = descripcion;
this.codigoPresup = codigoPresup;
this.vidaUtil = vidaUtil;
}
public TipoActivoId getId() {
return this.id;
}
public void setId(TipoActivoId id) {
this.id = id;
}
public CategoriaActivo getCategoriaActivo() {
return this.categoriaActivo;
}
public void setCategoriaActivo(CategoriaActivo categoriaActivo) {
this.categoriaActivo = categoriaActivo;
}
public String getDescripcion() {
return this.descripcion;
}
public void setDescripcion(String descripcion) {
this.descripcion = descripcion;
}
public String getCodigoPresup() {
return this.codigoPresup;
}
public void setCodigoPresup(String codigoPresup) {
this.codigoPresup = codigoPresup;
}
public Short getVidaUtil() {
return this.vidaUtil;
}
public void setVidaUtil(Short vidaUtil) {
this.vidaUtil = vidaUtil;
}
}
| [
"addielo.oamvi@gmail.com"
] | addielo.oamvi@gmail.com |
5941159ad36eb42a14af476707b10c96244e938b | fb98b24d78b3e1c04e25e84390cc28879c951355 | /src/javaBasics/IfElseConditionConcept.java | ec8609e275aa0b2134b24c90c724b61a75f8e773 | [] | no_license | sahild333/AugustAllAutomationScript | 9dc49334c33940f4d960d3957b7426e999c507e2 | d499a28b3dfd91d0a54b35411e1f337cf1f33d29 | refs/heads/master | 2023-03-30T15:36:39.485277 | 2021-03-21T00:05:34 | 2021-03-21T00:05:34 | 349,858,182 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,231 | java | package javaBasics;
public class IfElseConditionConcept {
public static void main(String[] args) {
// if-else condition - inserting sense into script to verify - verification point (check point)
// 1. if-condition - condition provided - if match - then script inside if block will execute otherwise it will not
// 2. else if-condition - condition provided - if if-condition is not fulfilled then it will come to else if block
// 3. else-condition - no condition provided - will execute only if if-condition and else if-condition fail
int a=10;
int b=20;
int c=10;
//if and else block
if(a==b) {
System.out.println("a is equal to b, Test passed");
}
else {
System.out.println("a is not equal to b, Test failed");
} // only else prints because if condition failed
//if only block - condition fulfilled
if (a==c) {
System.out.println("a is equal to c, Test passed");
}
//if only block - condition not fulfilled - nothing prints
if(a!=c) {
System.out.println("a is not equal to c, Test failed");
}
//multiple conditions - only prints first correct condition
if (a==b ) {
System.out.println("a is equal to b");
}
else if(a==c) {
System.out.println("a is equal to c");
}
else if (b==c) {
System.out.println("b is equal to c");
}
else {
System.out.println("a,b and c are different");
}
//string
String x = "Java";
String y = "Selenium";
String z = "java";
//condition 1 - sensitive to upper/lower case
if(x.equals(y)) {
System.out.println("x is equal to z");
}
else {
System.out.println("x is not equal to z");
}
//condition 2 - not sensitive to upper/lower case
if(x.equalsIgnoreCase(z)) {
System.out.println("x is equal to z");
}
else {
System.out.println("x is not equal to z");
}
String name1 = "John";
int age1 = 30;
String name2 = "Joe";
int age2 = 25;
if (name1.equalsIgnoreCase(name2)) {
System.out.println(name1+ "and" +name2+ "have same name");
}
else {
System.out.println(name1+ " and " +name2+ " are different customers.");
}
// Customer Tom - username tom12 & password tom@123
// Registered customer
// After registration - login credentials - stored in Database
// Login - username tom12 & password tom@123
// if-else condition tom12==tom12 && tom@123==tom@123 then login should happen
String inputUsername = "tom12";
String inputPassword = "tom@123";
String DBusername = "Tom12";
String DBpassword = "tom@123";
if(inputUsername.equals(DBusername) && inputPassword.equals(DBpassword)) {
System.out.println("Credentials are valid");
System.out.println("Welcome Tom!");
}
else {
System.out.println("Username or password is incorrect");
System.out.println("Access Denied");
}
//Assignment: logical operators &&, ||, !
// 1. create conditon for matching username but different password
// 2. create condition for different username but matching password
// java Basic operators
// String email= "john@gmail.com";
// String password= "Johnisgreat!";
// String emailDB= "john@gmail.com";
// String passwordDB= "JohnisGreat!";
//
// if (email.equals(emailDB) && password.equals(passwordDB)) {
// System.out.println("Login Successful");
// System.out.println("Welcome John!");
// }
// else {
// System.out.println("Email or Password is incorrect");
// System.out.println("Please try again.");
// }
String email= "john@gmail.com";
String password= "JohnisGreat!";
String emailDB= "John@gmail.com";
String passwordDB= "JohnisGreat!";
//
// if (email.equals(emailDB) && password.equals(passwordDB)) {
// System.out.println("Login Successful");
// System.out.println("Welcome John!");
// }
// else {
// System.out.println("Email or password is incorrect.");
// System.out.println("Please try again.");
// }
if (email.equals(emailDB) && password.equals(passwordDB) || email.equalsIgnoreCase(emailDB) && password.equals(passwordDB)) {
System.out.println("Login Successful");
System.out.println("Welcome John");
}
else {
System.out.println("Invalid Email or Password");
System.out.println("Please try again");
}
}
}
| [
"Sahil Duggal@DESKTOP-DPP3R90"
] | Sahil Duggal@DESKTOP-DPP3R90 |
abf6461cc0ac63fafc91ef5dff4ad25e51f12150 | 914e29eda8657beda51cdba8a944b9cad6f92755 | /lab3a_IntentsLab/app/build/generated/source/buildConfig/debug/course/labs/intentslab/BuildConfig.java | b47acac44b0532560064da1b1cdc88142a7e8644 | [] | no_license | blank0123/Android | a2cb072a39160e0e10989f780af889ee53e8e138 | 61e93a47ce1719d1be0dcfce58d943244414a6b8 | refs/heads/main | 2023-02-11T16:50:42.396323 | 2021-01-03T04:53:44 | 2021-01-03T04:53:44 | 323,656,694 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 451 | java | /**
* Automatically generated file. DO NOT MODIFY
*/
package course.labs.intentslab;
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "course.labs.intentslab";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "1.0";
}
| [
"1589080613@qq.com"
] | 1589080613@qq.com |
82b18634adaba28aee6072c8fafa4573f89397de | f35e9ffcdde1f80b1641300549ad0aa183e9c69d | /MobileSensingCollector/ref-src/Controller.java | 9b15ad25854995235f09f58e01912a0a29ac76b9 | [] | no_license | Institute-Web-Science-and-Technologies/MobSens | 8aad2e62514354ca7ff15c928d91d7cd2558ee22 | 68ef62a862680df37860bc3479168bb6f34262b6 | refs/heads/master | 2021-01-13T06:27:49.014355 | 2014-05-08T08:21:15 | 2014-05-08T08:21:15 | 19,567,624 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 6,168 | java | package mobsens.collector;
import java.util.Date;
import mobsens.collector.communications.ConnectingActivity;
import mobsens.collector.drivers.messaging.CollectorStatusDriver;
import mobsens.collector.drivers.messaging.ExternalizeResponseDriver;
import mobsens.collector.drivers.messaging.LogDriver;
import mobsens.collector.drivers.messaging.UploadResponseDriver;
import mobsens.collector.intents.IntentStartCollector;
import mobsens.collector.intents.IntentStopCollector;
import mobsens.collector.util.Logging;
import android.content.Intent;
import android.os.Bundle;
import android.os.IBinder;
import android.os.RemoteException;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
public class Controller extends ConnectingActivity
{
private final LogDriver logDriver;
private final UploadResponseDriver uploadResponseDriver;
private final ExternalizeResponseDriver externalizeResponseDriver;
private final CollectorStatusDriver collectorStatusDriver;
private CollectorIPC collectorIPC;
private TextView textViewControllerLog;
private TextView textViewControllerTitle;
private Button buttonControllerStartStop;
public Controller()
{
super(Collector.class);
logDriver = new LogDriver(this)
{
@Override
protected void onLog(Date time, String title, String subtitle, String description)
{
String text = title + "\r\n " + subtitle;
if (description != null)
{
text += "\r\n" + description.replaceAll("(?m)^", "> ");
}
textViewControllerLog.setText(text + "\r\n\r\n" + textViewControllerLog.getText());
}
};
uploadResponseDriver = new UploadResponseDriver(this)
{
@Override
protected void onUploadResponse(String handle, Date startTime, Date endTime, long transmitted, String response, Throwable exception)
{
Logging.log(Controller.this, endTime, "Upload complete", handle, transmitted + " bytes transmitted");
}
};
externalizeResponseDriver = new ExternalizeResponseDriver(this)
{
@Override
protected void onExternalizeResponse(String handle, Date startTime, Date endTime, long transmitted, Throwable exception)
{
Logging.log(Controller.this, endTime, "Externalize complete", handle, transmitted + " bytes transmitted");
}
};
collectorStatusDriver = new CollectorStatusDriver(this)
{
@Override
protected void onCollectorStatus(boolean status)
{
if (status)
{
buttonControllerStartStop.setText("Stop");
}
else
{
buttonControllerStartStop.setText("Start");
}
}
};
collectorIPC = null;
}
@Override
public boolean onMenuItemSelected(int featureId, MenuItem item)
{
switch (item.getItemId())
{
case R.id.action_settings:
startActivity(new Intent(getApplicationContext(), Settings.class));
return true;
case R.id.action_tag:
startActivity(new Intent(getApplicationContext(), Fasttag.class));
return true;
case R.id.action_map:
startActivity(new Intent(getApplicationContext(), Map.class));
return true;
case R.id.action_stage:
startActivity(new Intent(getApplicationContext(), Stage.class));
return true;
default:
return super.onMenuItemSelected(featureId, item);
}
}
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_controller);
textViewControllerLog = (TextView) findViewById(R.id.controller_log);
textViewControllerTitle = (TextView) findViewById(R.id.controller_title);
buttonControllerStartStop = (Button) findViewById(R.id.controller_start_stop);
buttonControllerStartStop.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
if (collectorIPC != null)
{
try
{
if (collectorIPC.isCollecting())
{
IntentStopCollector.sendBroadcast(Controller.this);
}
else
{
IntentStartCollector.sendBroadcast(Controller.this, textViewControllerTitle.getText().toString());
}
}
catch (RemoteException e)
{
Logging.log(Controller.this, e);
}
}
}
});
logDriver.start();
uploadResponseDriver.start();
externalizeResponseDriver.start();
collectorStatusDriver.start();
}
@Override
protected void onDestroy()
{
logDriver.stop();
uploadResponseDriver.stop();
externalizeResponseDriver.stop();
collectorStatusDriver.stop();
super.onDestroy();
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.controller, menu);
return true;
}
@Override
protected void onConnected(IBinder service)
{
collectorIPC = CollectorIPC.Stub.asInterface(service);
try
{
if (collectorIPC.isCollecting())
{
buttonControllerStartStop.setText("Stop");
}
else
{
buttonControllerStartStop.setText("Start");
}
}
catch (RemoteException e)
{
Logging.log(this, e);
}
Logging.log(this, "Controller", "Connected", null);
}
@Override
protected void onDisconnected()
{
collectorIPC = null;
Logging.log(this, "Controller", "Disconnected", null);
}
@Override
protected void onSaveInstanceState(Bundle outState)
{
super.onSaveInstanceState(outState);
outState.putString(R.id.controller_log + "text", textViewControllerLog.getText().toString());
outState.putString(R.id.controller_title + "text", textViewControllerTitle.getText().toString());
}
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState)
{
super.onRestoreInstanceState(savedInstanceState);
textViewControllerLog.setText(savedInstanceState.getString(R.id.controller_log + "text"));
textViewControllerTitle.setText(savedInstanceState.getString(R.id.controller_title + "text"));
}
}
| [
"lukashaertel@googlemail.com"
] | lukashaertel@googlemail.com |
a148c0cb4f0c4053b09f3d5fed74f1451b3feabe | e7261cb90588d780390a1c3559a32ff980c167aa | /test/quoridorClient/WallTest.java | 820e31c94b302f0fd25144c05435ca3ce6e2e44e | [] | no_license | gordon-derek/Quoridor | 3d4e6b8e3e3cc4221a07951579eafda161ec0e29 | d538c99ef689678aac21dc12eff7426ece062673 | refs/heads/master | 2022-05-09T16:45:07.166521 | 2014-12-11T01:48:41 | 2014-12-11T01:48:41 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 246 | java | package quoridorClient;
import static org.junit.Assert.*;
import org.junit.Test;
import quoridorClient.gui.Wall;
public class WallTest {
@Test
public void testCreation() {
Wall testSpace = new Wall("");
assertNotNull(testSpace);
}
}
| [
"gordon.derek46@gmail.com"
] | gordon.derek46@gmail.com |
02206e2d611625b26986532195d341400c507bf0 | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/11/11_0b70443882dbcdde31a1ee5c0c53f7b98da277ef/SifterHelper/11_0b70443882dbcdde31a1ee5c0c53f7b98da277ef_SifterHelper_s.java | e4fa86fac5a51dc40e42882ca8912c25397bddff | [] | no_license | zhongxingyu/Seer | 48e7e5197624d7afa94d23f849f8ea2075bcaec0 | c11a3109fdfca9be337e509ecb2c085b60076213 | refs/heads/master | 2023-07-06T12:48:55.516692 | 2023-06-22T07:55:56 | 2023-06-22T07:55:56 | 259,613,157 | 6 | 2 | null | 2023-06-22T07:55:57 | 2020-04-28T11:07:49 | null | UTF-8 | Java | false | false | 4,751 | java | package com.SifterReader.android;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Context;
import android.content.res.Resources.NotFoundException;
public class SifterHelper {
private final Context mContext;
private String mAccessKey;
public SifterHelper(Context context, String accessKey) {
mContext = context;
mAccessKey = accessKey;
}
public SifterHelper(Context context) {
mContext = context;
getKey();
}
public URLConnection getSifterConnection(String sifterURL) {
URLConnection sifterConnection = null;
try {
// create URL object to SifterAPI
URL sifter = new URL(sifterURL); // throws MalformedURLException
// open connection to SifterAPI
sifterConnection = sifter.openConnection(); // throws IOException
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} // catch errors, do nothing, return null, use onConnectionError
return sifterConnection;
}
public InputStream getSifterInputStream(URLConnection sifterConnection) {
// send header requests
sifterConnection.setRequestProperty(SifterReader.X_SIFTER_TOKEN, mAccessKey);
sifterConnection.addRequestProperty(SifterReader.HEADER_REQUEST_ACCEPT, SifterReader.APPLICATION_JSON);
InputStream is = null;
try {
is = sifterConnection.getInputStream(); // throws FileNotFound, IOException
} catch (IOException e) {
e.printStackTrace();
// also catches FileNotFoundException: invalid domain
// IOException: invalid access key
HttpURLConnection httpSifterConnection = (HttpURLConnection)sifterConnection;
is = httpSifterConnection.getErrorStream();
} // catch errors, return error stream, could be null if none found
return is;
}
public JSONObject onConnectionError() throws JSONException, NotFoundException {
JSONObject connectionError = new JSONObject();
connectionError.put(SifterReader.LOGIN_ERROR, // throws JSONException
mContext.getResources().getString(R.string.connection_error)); // throws NotFoundException
connectionError.put(SifterReader.LOGIN_DETAIL,
mContext.getResources().getString(R.string.connection_error_msg));
return connectionError;
}
public void resetKey(String accessKey) {
mAccessKey = accessKey; // TODO SifterHelper should get keys from key_file
}
public void getKey(){
File keyFile = mContext.getFileStreamPath(SifterReader.KEY_FILE);
// if (!keyFile.exists()) {
// if (onMissingToken())
// loginKeys();
// return;
// }
// boolean fileReadError = false;
try {
BufferedReader in = new BufferedReader(new FileReader(keyFile));
String inputLine;
StringBuilder x = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
x.append(inputLine);
}
in.close();
JSONObject loginKeys = new JSONObject(x.toString());
mAccessKey = loginKeys.getString(SifterReader.ACCESS_KEY);
} catch (FileNotFoundException e) {
e.printStackTrace();
// fileReadError = true;
} catch (IOException e) {
e.printStackTrace();
// fileReadError = true;
} catch (JSONException e) {
e.printStackTrace();
// fileReadError = true;
}
// if (fileReadError || mDomain.isEmpty() || mAccessKey.isEmpty()) {
// if (onMissingToken())
// loginKeys();
// return;
// }
}
public JSONObject getSifterJSONObject(URLConnection sifterConnection) throws JSONException,NotFoundException,IOException {
JSONObject sifterJSONObject = new JSONObject();
InputStream sifterInputStream = getSifterInputStream(sifterConnection);
if (sifterInputStream == null) { // null means MalformedURLException or IOException
return onConnectionError(); // throws JSONException, NotFoundException
}
BufferedReader in = new BufferedReader(new InputStreamReader(sifterInputStream));
String inputLine;
StringBuilder x = new StringBuilder();
try {
while ((inputLine = in.readLine()) != null)
x.append(inputLine);
} catch (IOException e) {
in.close();sifterInputStream.close();
throw e;
} // catch error and close buffered reader
in.close();sifterInputStream.close();
// sifterInputStream must stay open for buffered reader
sifterJSONObject = new JSONObject(x.toString()); // throws JSONException
return sifterJSONObject;
}
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
5cd97d5c4cfd2e29d7307ce1eaf5ac61979325d0 | d88c98a13bac735a0319ad9028d9d2e4f2ea511a | /src/main/java/com/_520it/crm/query/OrderbillitemQueryObject.java | ef41c161b307deb0f4b293674f6907e5a7ac048b | [] | no_license | minishow/wechat | a1c482fddfc90030e26499016ab974de9eaf3e8a | db915c7db525b924a0647f72f38aa3c74ca208b5 | refs/heads/master | 2021-08-08T10:03:36.438672 | 2017-11-07T13:58:17 | 2017-11-07T13:58:17 | 110,126,944 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 177 | java | package com._520it.crm.query;
import lombok.Getter;
import lombok.Setter;
@Setter@Getter
public class OrderbillitemQueryObject extends QueryObject{
private Long billId;
}
| [
"343997217@qq.com"
] | 343997217@qq.com |
0c2f9be5634f8c9fec6bc2937db682a0eca9d489 | 528320da5444a1570b521abdd9b238ceeb3f5837 | /app/src/main/java/andy/lee/intentservicealarm/MyIntentService.java | cbd5dfa732dc5abff8685a379492e93cf8cec47c | [] | no_license | andyNinty/BroIntentAlarmProject | 2328c6208befa937d7659672bd0ef2c4f49d6a79 | c5f598137ac94de9514fa0f9aa9afea943b90a77 | refs/heads/master | 2021-01-13T04:22:21.625454 | 2017-02-15T12:30:09 | 2017-02-15T12:30:09 | 77,445,797 | 3 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,896 | java | package andy.lee.intentservicealarm;
import android.app.AlarmManager;
import android.app.IntentService;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.preference.PreferenceManager;
import android.util.Log;
public class MyIntentService extends IntentService {
private static final String TAG = "MyIntentService";
private static final int POLL_INTERVAL = 1000 * 15;
public MyIntentService() {
super(TAG);
}
@Override
protected void onHandleIntent(Intent intent) {
Log.i(TAG, "received intent " + intent);
}
public static boolean isServiceAlarmOn(Context context) {
Intent intent = new Intent(context, MyIntentService.class);
PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, PendingIntent.FLAG_NO_CREATE);
return pendingIntent != null;
}
public static void setServiceAlarm(Context context, boolean isOn) {
Intent intent = new Intent(context, MyIntentService.class);
PendingIntent pendingIntent = PendingIntent.getService(context, 0, intent, 0);
AlarmManager manager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
if (isOn) {
//此方法在6.0以上便不再适用,查看6.0源码得知,其最小时间已经规定为60s,估计是和Doze模式有关
//更多请看https://developer.android.com/training/monitoring-device-state/doze-standby.html#restrictions
manager.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), POLL_INTERVAL, pendingIntent);
} else {
manager.cancel(pendingIntent);
pendingIntent.cancel();
}
PreferenceManager.getDefaultSharedPreferences(context).edit()
.putBoolean(Constant.IS_SERVICE_START,isOn)
.apply();
}
}
| [
"andy645928714@gmail.com"
] | andy645928714@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.